Frame 1
var gotya = (new com.vascogames.as2.Gotya());
stop();
Frame 2
var inited = false;
onEnterFrame = function () {
if (!inited) {
var _local1 = attachMovie("Board", "board", 0);
_local1.init(new MoneyRules(_local1));
inited = true;
}
};
Symbol 13 MovieClip [ScoreDisplay] Frame 1
#initclip 11
Object.registerClass("ScoreDisplay", ScoreDisplay);
#endinitclip
Symbol 60 MovieClip [Board] Frame 1
#initclip 9
Object.registerClass("Board", Board);
#endinitclip
Instance of Symbol 34 MovieClip [cardbox] "cardBox0" in Symbol 60 MovieClip [Board] Frame 1
//component parameters
onClipEvent (construct) {
fieldnum = 1;
}
Instance of Symbol 34 MovieClip [cardbox] "cardBox1" in Symbol 60 MovieClip [Board] Frame 1
//component parameters
onClipEvent (construct) {
fieldnum = 2;
}
Instance of Symbol 34 MovieClip [cardbox] "cardBox2" in Symbol 60 MovieClip [Board] Frame 1
//component parameters
onClipEvent (construct) {
fieldnum = 3;
}
Instance of Symbol 34 MovieClip [cardbox] "cardBox3" in Symbol 60 MovieClip [Board] Frame 1
//component parameters
onClipEvent (construct) {
fieldnum = 4;
}
Symbol 154 MovieClip [Card] Frame 1
#initclip 10
Object.registerClass("Card", Card);
#endinitclip
Symbol 187 Button
on (press) {
gotya.startGame();
gotoAndStop (2);
}
Symbol 188 MovieClip [__Packages.com.vascogames.as2.Gotya] Frame 0
class com.vascogames.as2.Gotya
{
var encryptedScore;
function Gotya () {
if (_root._url.indexOf("file://") == 0) {
debugMode = true;
}
debug("Api initialized V1.2");
}
function getMatchId() {
debug("Get match id");
if (_root.wedid > 0) {
return("" + (_root.wedid * 1024));
}
return("" + int(Math.random() * 10000));
}
function debug(msg) {
if (debugMode) {
trace("Gotya API :: " + msg);
}
}
function sendAwardcode(rcode) {
debug("Award code received: " + rcode);
flash.external.ExternalInterface.call("vascogamesgas", rcode);
}
function sendScore(score) {
debug((((("Score received: " + score) + " - ") + encryptScore(score)) + " ecrypt ") + md5(encryptScore(score)));
flash.external.ExternalInterface.call("vascogamessendcom", md5(encryptScore(score)), score);
}
function startGame() {
debug("Started Game");
flash.external.ExternalInterface.call("vascogamesstartcom", "1");
}
function gameOverScore(score) {
debug(("Game over score received: " + score) + " ");
flash.external.ExternalInterface.call("vascogamessendgocom", md5(encryptScore(score)), score);
}
function scoreError() {
debug("Error Score");
flash.external.ExternalInterface.call("vascogamesscerrorcom", "1");
}
function checkandaddscore(totalescore, score) {
totalescore = Number(totalescore);
score = Number(score);
var _local3 = vgscoreold.split("-vg-");
_local3 = _local3[1];
debug((((((("check " + vgscoreold) + " - ") + totalescore) + " - ") + score) + " spiltest ") + _local3);
if (String(_local3) == String(totalescore)) {
totalescore = totalescore + score;
vgscoreold = ("-vg-" + String(totalescore)) + "-vg-";
sendScore(Number(totalescore));
} else {
scoreError();
return(Number(_local3));
}
return(totalescore);
}
function encryptScore(score) {
var _local5 = score.toString();
encryptedScore = "";
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5.charAt(_local2);
var _local4 = digitsArray[0][_local3];
encryptedScore = encryptedScore + _local4;
_local2++;
}
return(encryptedScore);
}
function md5(s) {
return(binl2hex(core_md5(str2binl(s), s.length * chrsz)));
}
function core_md5(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (len % 32));
x[(((len + 64) >>> 9) << 4) + 14] = len;
var _local5 = 1732584193 /* 0x67452301 */;
var _local4 = -271733879;
var _local3 = -1732584194;
var _local2 = 271733878 /* 0x10325476 */;
var _local6 = 0;
while (_local6 < x.length) {
var _local11 = _local5;
var _local10 = _local4;
var _local9 = _local3;
var _local8 = _local2;
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 0], 7, -680876936);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 1], 12, -389564586);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 2], 17, 606105819);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 3], 22, -1044525330);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 4], 7, -176418897);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 5], 12, 1200080426);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 6], 17, -1473231341);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 7], 22, -45705983);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 8], 7, 1770035416);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 9], 12, -1958414417);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 10], 17, -42063);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 11], 22, -1990404162);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 12], 7, 1804603682);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 13], 12, -40341101);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 14], 17, -1502002290);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 15], 22, 1236535329);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 1], 5, -165796510);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 6], 9, -1069501632);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 11], 14, 643717713);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 0], 20, -373897302);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 5], 5, -701558691);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 10], 9, 38016083);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 15], 14, -660478335);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 4], 20, -405537848);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 9], 5, 568446438);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 14], 9, -1019803690);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 3], 14, -187363961);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 8], 20, 1163531501);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 13], 5, -1444681467);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 2], 9, -51403784);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 7], 14, 1735328473);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 12], 20, -1926607734);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 5], 4, -378558);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 8], 11, -2022574463);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 11], 16, 1839030562);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 14], 23, -35309556);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 1], 4, -1530992060);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 4], 11, 1272893353);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 7], 16, -155497632);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 10], 23, -1094730640);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 13], 4, 681279174);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 0], 11, -358537222);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 3], 16, -722521979);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 6], 23, 76029189);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 9], 4, -640364487);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 12], 11, -421815835);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 15], 16, 530742520);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 2], 23, -995338651);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 0], 6, -198630844);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 7], 10, 1126891415);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 14], 15, -1416354905);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 5], 21, -57434055);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 12], 6, 1700485571);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 3], 10, -1894986606);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 10], 15, -1051523);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 1], 21, -2054922799);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 8], 6, 1873313359);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 15], 10, -30611744);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 6], 15, -1560198380);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 13], 21, 1309151649);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 4], 6, -145523070);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 11], 10, -1120210379);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 2], 15, 718787259);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 9], 21, -343485551);
_local5 = safe_add(_local5, _local11);
_local4 = safe_add(_local4, _local10);
_local3 = safe_add(_local3, _local9);
_local2 = safe_add(_local2, _local8);
_local6 = _local6 + 16;
}
return(Array(_local5, _local4, _local3, _local2));
}
function md5_cmn(q, a, b, x, s, t) {
return(safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
function md5_ff(a, b, c, d, x, s, t) {
return(md5_cmn((b & c) | ((~b) & d), a, b, x, s, t));
}
function md5_gg(a, b, c, d, x, s, t) {
return(md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
}
function md5_hh(a, b, c, d, x, s, t) {
return(md5_cmn((b ^ c) ^ d, a, b, x, s, t));
}
function md5_ii(a, b, c, d, x, s, t) {
return(md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
}
function safe_add(x, y) {
var _local1 = new Number((x & 65535) + (y & 65535));
var _local2 = new Number(((x >> 16) + (y >> 16)) + (_local1 >> 16));
return((_local2 << 16) | (_local1 & 65535));
}
function bit_rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
function str2binl(str) {
var _local4 = new Array();
var _local5 = (1 << chrsz) - 1;
var _local2 = 0;
while (_local2 < (str.length * chrsz)) {
_local4[_local2 >> 5] = _local4[_local2 >> 5] | ((str.charCodeAt(_local2 / chrsz) & _local5) << (_local2 % 32));
_local2 = _local2 + chrsz;
}
return(_local4);
}
function binl2str(bin) {
var _local4 = new String("");
var _local5 = (1 << chrsz) - 1;
var _local2 = 0;
while (_local2 < (bin.length * 32)) {
_local4 = _local4 + String.fromCharCode((bin[_local2 >> 5] >>> (_local2 % 32)) & _local5);
_local2 = _local2 + chrsz;
}
return(_local4);
}
function binl2hex(binarray) {
var _local3 = "0123456789abcdef";
var _local4 = new String("");
var _local1 = 0;
while (_local1 < (binarray.length * 4)) {
_local4 = _local4 + (_local3.charAt((binarray[_local1 >> 2] >> (((_local1 % 4) * 8) + 4)) & 15) + _local3.charAt((binarray[_local1 >> 2] >> ((_local1 % 4) * 8)) & 15));
_local1++;
}
return(_local4);
}
var debugMode = false;
var vgscoreold = "-vg-0-vg-";
var firstDigitArray = ["10f85au", "11kt50e", "12cmt5s2", "13v507", "14fc5i3", "1556f7l", "167gj81", "17yn90y", "185o3ko", "19ntakn"];
var digitsArray = [com.vascogames.as2.Gotya.prototype.firstDigitArray];
var b64pad = new String("");
var chrsz = new Number(8);
}
Symbol 189 MovieClip [__Packages.Board] Frame 0
class Board extends MovieClip
{
var rules, timeAlertColor, timeAlert, scoreAlertColor, scoreAlert, hand, handPos, flippedHand, scrapPos, endgameButton, discardButton, timeValue, config, startTime, timeTitle, scoreTitle, endgameText, discardText, attachMovie, remainingTime, cardLists, getURL, result, scoreValue;
function Board () {
super();
}
function init(rules) {
trace("init");
seed = _root.gotya.getMatchId();
this.rules = rules;
timeAlertColor = new Color(timeAlert);
timeAlertColor.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:0, ab:0});
scoreAlertColor = new Color(scoreAlert);
scoreAlertColor.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:0, ab:0});
var _local4 = 10;
hand = new Pile(this, 52 * (_local4++));
hand.setPosFromTemplate(handPos, "h0");
hand.singleCard = true;
flippedHand = new Pile(this, 52 * (_local4++));
flippedHand.setPosFromTemplate(scrapPos, "h1");
flippedHand.singleCard = true;
var _local3 = 0;
while (_local3 < 4) {
columns[_local3] = new Column(this, 52 * (_local4++));
columns[_local3].setPosFromTemplate(this["pilePos" + _local3], "p" + _local3);
columns[_local3].setComponents(this["valueCounter" + _local3], this["cardBox" + _local3]);
columns[_local3].number = _local3;
_local3++;
}
parseGameData();
var thisBoard = this;
endgameButton.onPress = function () {
thisBoard.relaxDiscardsLeft = 0;
thisBoard.rules.endGame();
};
discardButton.onPress = function () {
thisBoard.rules.discardClicked();
};
var _local5 = new Object();
_local5.onKeyDown = function () {
if (Key.getCode() == 49) {
thisBoard.rules.columnClicked(thisBoard.columns[0]);
} else if (Key.getCode() == 50) {
thisBoard.rules.columnClicked(thisBoard.columns[1]);
} else if (Key.getCode() == 51) {
thisBoard.rules.columnClicked(thisBoard.columns[2]);
} else if (Key.getCode() == 52) {
thisBoard.rules.columnClicked(thisBoard.columns[3]);
} else if (Key.getCode() == 32) {
thisBoard.rules.discardClicked();
}
};
Key.addListener(_local5);
fscommand ("gameStart");
}
function cardDiscarded() {
if (_global.relaxMode) {
relaxDiscardsLeft--;
timeValue.text = "" + relaxDiscardsLeft;
if (relaxDiscardsLeft == 0) {
rules.endGame();
}
}
}
function parseGameData() {
var _local11 = new XML(_root.gameData);
_global.relaxMode = false;
config = new Object();
var _local10 = _local11.firstchild.childNodes;
var _local7 = 0;
while (_local7 < _local10.length) {
if (config[_local10[_local7].nodeName] == undefined) {
config[_local10[_local7].nodeName] = new Object();
}
config[_local10[_local7].nodeName][_local10[_local7].attributes.id] = new String(_local10[_local7].firstChild.nodeValue);
_local7++;
}
startTime = new Number(180) * 1000;
timeTitle.text = config.text.time;
scoreTitle.text = config.text.score;
endgameText.text = config.text.endgame;
discardText.text = config.text.discard;
if (_global.relaxMode) {
timeTitle.text = config.text.remaining;
timeValue.text = "" + relaxDiscardsLeft;
}
_local7 = 0;
var _local4 = 0;
while (_local4 < 4) {
var _local6 = 0;
while (_local6 < 13) {
var _local5 = "";
if (_local4 == 0) {
_local5 = "h";
}
if (_local4 == 1) {
_local5 = "s";
}
if (_local4 == 2) {
_local5 = "d";
}
if (_local4 == 3) {
_local5 = "c";
}
var _local8 = (_local6 + 1) + _local5;
var _local9 = attachMovie("Card", _local8, _local7++);
_local9.setFaceValue(_local8, _local6, _local4);
this[_local8] = _local9;
_local6++;
}
_local4++;
}
initRound(0);
}
function nextInt() {
return(gen());
}
function nextDouble() {
return(gen() / 2147483647);
}
function nextIntRange(min, max) {
min = min - 0.4999;
max = max + 0.4999;
return(Math.round(min + ((max - min) * nextDouble())));
}
function nextDoubleRange(min, max) {
return(min + ((max - min) * nextDouble()));
}
function gen() {
return((seed = (seed * 16807) % 2147483647));
}
function initRound(roundNum) {
seed++;
remainingTime = startTime;
trace("timeleft = " + startTime);
setRemainingTime(remainingTime);
timeAlertColor.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:0, ab:0});
scoreAlertColor.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:0, ab:0});
setScore(0);
hand.removeAllCards();
flippedHand.removeAllCards();
var _local4 = 0;
while (_local4 < 4) {
columns[_local4].removeAllCards();
_local4++;
}
var _local7 = cardLists[roundNum];
if (_global.relaxMode) {
trace("generate cards");
_local7 = generateCards();
} else {
_local7 = generateCards();
}
var _local6 = _local7.split("_");
_local4 = 0;
while (_local4 < 52) {
var _local5 = _local6[_local4];
var _local3 = this[_local5];
_local3.setFrontFaceUp(true);
_local3.forceTo(hand.x, hand.y);
_local3._alpha = 100;
_local3._visible = true;
hand.pushCard(_local3);
_local4++;
}
playTimeOffset = getTimer();
rules.init();
}
function generateCards() {
var _local4 = new Array();
var _local10 = "cdhs";
var _local5 = 0;
while (_local5 < 4) {
var _local3 = 1;
while (_local3 <= 13) {
_local4.push(("" + _local3) + _local10.charAt(_local5));
_local3++;
}
_local5++;
}
var _local7 = "";
var _local2 = 0;
while (_local2 < 52) {
var _local8 = nextIntRange(100, 999) / 1000;
var _local6 = ((_local8 * (52 - _local2)) + _local2) >> 0;
trace(_local6);
var _local9 = _local4[_local6];
_local4[_local6] = _local4[_local2];
_local4[_local2] = _local9;
if (_local2 > 0) {
_local7 = _local7 + "_";
}
_local7 = _local7 + _local4[_local2];
_local2++;
}
return(_local7);
}
function onEnterFrame() {
if ((!hasWon) && (_root.playTime != undefined)) {
remainingTime = startTime - ((_root.playTime * 1000) - playTimeOffset);
if (remainingTime > startTime) {
playTimeOffset = playTimeOffset - (remainingTime - startTime);
remainingTime = startTime;
}
_root.playTime = undefined;
}
scoreAlertColor.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:scoreAlertValue, ab:0});
scoreAlertValue = scoreAlertValue * 0.8;
var _local4 = getTimer();
if ((lastTime != -1) && ((_local4 - lastTime) > 0)) {
remainingTime = remainingTime - (_local4 - lastTime);
if (remainingTime < 0) {
if (!hasWon) {
setRemainingTime(0);
timeAlertColor.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:0, ab:0});
rules.win();
} else {
setRemainingTime(0);
var _local5 = (roundNum == 1) || (_global.shortGameMode);
if (_global.relaxMode) {
_local5 = relaxDiscardsLeft <= 0;
}
if (_local5) {
if (!hasReportedGameOver) {
hasReportedGameOver = true;
getURL("FSCommand:gameOver", score);
}
} else {
result._visible = false;
hasWon = false;
roundNum++;
initRound(roundNum);
}
}
} else {
if (_global.relaxMode && (!hasWon)) {
remainingTime = startTime;
}
setRemainingTime(remainingTime);
}
}
lastTime = _local4;
}
function setRemainingTime(remainingTime) {
if (_global.relaxMode) {
if (relaxDiscardsLeft <= 0) {
result.qin.text = ("Next round begins in " + Math.round(remainingTime / 1000)) + " seconds";
} else {
result.qin.text = "";
}
return(undefined);
}
if (hasWon) {
if (remainingTime < 0) {
remainingTime = 0;
}
if (roundNum == 0) {
result.qin.text = ("Next round begins in " + Math.round(remainingTime / 1000)) + " seconds";
} else {
result.qin.text = "";
}
}
var _local4 = Math.round(remainingTime / 1000);
var _local5 = Math.floor(_local4 / 60);
if (_local4 < 60) {
var _local8 = (Math.sin(remainingTime / 100) * 25) + 25;
var _local7 = (_local8 * (60 - _local4)) / 60;
timeAlertColor.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:_local7, ab:0});
}
_local4 = _local4 % 60;
_local5 = _local5 % 100;
var _local3 = "";
if (_local5 < 10) {
_local3 = _local3 + "0";
}
_local3 = _local3 + (_local5 + ":");
if (_local4 < 10) {
_local3 = _local3 + "0";
}
_local3 = _local3 + (_local4 + "");
timeValue.text = _local3;
}
function getTimeLeft() {
return(Math.floor(remainingTime / 1000));
}
function getTotalTime() {
return(Math.floor(startTime / 1000));
}
function endGame(score) {
_root.gotya.gameOverScore(score);
roundNum = 1;
win(score, 0, score);
}
function win(baseScore, timeScore, totalScore) {
if (!hasWon) {
var _local4 = roundNum == 1;
if (_global.relaxMode) {
_local4 = relaxDiscardsLeft <= 0;
}
result = attachMovie("Result", "result", 100000);
if (!_local4) {
result.roundlabel.text = "RESULT OF ROUND 1";
} else {
result.roundlabel.text = "FINAL RESULT";
}
if (!_global.relaxMode) {
result.timebonus_text.text = config.text.timebonus;
result.timebonus.text = timeScore.toString();
result.totalscore_text.text = config.text.totalscore;
result.totalscore.text = totalScore.toString();
} else {
result.timebonus_text._visible = false;
result.timebonus._visible = false;
result.totalscore_text._visible = false;
result.totalscore._visible = false;
}
result.score_text.text = config.text.score;
result.score.text = baseScore.toString();
result.qin.text = (((config.text.exit_game_in + " ") + Math.floor(remainingTime / 1000)) + " ") + config.text.seconds;
result.previousscore_text._visible = _local4;
result.previousscore._visible = _local4;
result.allrounds_text._visible = _local4;
result.allrounds._visible = _local4;
result.previousscore_text.text = config.text.previous_score;
result.previousscore.text = score;
score = _root.gotya.checkandaddscore(score, totalScore);
if (_local4) {
_root.gotya.gameOverScore(score);
}
result.allrounds_text.text = config.text.all_rounds_score;
result.allrounds.text = score;
result._x = 0;
result._y = 0;
hasWon = true;
remainingTime = 5000;
}
}
function showScoreAlert() {
scoreAlertValue = 100;
}
function setScore(score) {
var _local2 = "";
if (score < 1000) {
_local2 = _local2 + "0";
}
if (score < 100) {
_local2 = _local2 + "0";
}
if (score < 10) {
_local2 = _local2 + "0";
}
_local2 = _local2 + (score + "");
scoreValue.text = _local2;
}
var seed = "1";
var columns = new Array();
var hasWon = false;
var cards = new Array();
var lastTime = -1;
var scoreAlertValue = 0;
var score = 0;
var roundNum = 0;
var hasReportedGameOver = false;
var playTimeOffset = 0;
var relaxDiscardsLeft = 20;
}
Symbol 190 MovieClip [__Packages.Pile] Frame 0
class Pile
{
var board, cards, depthOffset, singleCard, id, x, y;
function Pile (newBoard, offset) {
board = newBoard;
cards = new Array();
depthOffset = offset;
singleCard = false;
}
function setPosFromTemplate(mc, newId) {
id = newId;
x = mc._x;
y = mc._y;
mc._visible = false;
}
function removeAllCards() {
var _local2 = 0;
while (_local2 < cards.length) {
var _local3 = cards[_local2];
_local2++;
}
cards = new Array();
}
function setSingleCardMode(singleCardMode) {
singleCard = singleCardMode;
}
function pushCard(card) {
if (singleCard && (cards.length > 1)) {
cards[cards.length - 2]._visible = false;
}
var _local3 = cards.length + depthOffset;
card.swapDepths(_local3);
cards.push(card);
card.setPile(this);
}
function popCard() {
if (singleCard && (cards.length > 2)) {
cards[cards.length - 3]._visible = true;
}
return(cards.pop());
}
function cardCount() {
return(cards.length);
}
function mayDrop(draggedCards) {
return(false);
}
function cardClicked(card) {
}
}
Symbol 191 MovieClip [__Packages.Column] Frame 0
class Column extends Pile
{
var x, cards, y, valueCounter, cardBox, id, board, depthOffset, value;
function Column (newBoard, offset) {
super(newBoard, offset);
}
function pushCard(card) {
card.slideTo(x, y + (cards.length * 16));
if (card.value == 0) {
containsAce = true;
}
super.pushCard(card);
}
function setComponents(valueCounter, cardBox) {
this.valueCounter = valueCounter;
this.cardBox = cardBox;
}
function setPosFromTemplate(mc, newId) {
id = newId;
x = mc._x;
y = mc._y;
mc._alpha = 0;
mc._visible = true;
var thisPile = this;
mc.onPress = function () {
thisPile.click();
};
}
function setCanMove(canMove) {
cardBox._visible = canMove;
}
function removeAllCards() {
super.removeAllCards();
cards = new Array();
score = (0);
containsAce = false;
}
function clear(splashName) {
var _local2 = 0;
while (_local2 < cards.length) {
var _local3 = cards[_local2];
_local3.fadeOut(_local2 * 4);
_local2++;
}
var _local4 = board.attachMovie("ScoreDisplay", boaster + depthOffset, (50000 + depthOffset) + boasterId);
boasterId++;
if (boasterId == 10) {
boasterId = 0;
}
_local4.init(cardBox, splashName, (cards.length + 3) * 16);
cards = new Array();
score = (0);
containsAce = false;
}
function showScorePenalty(splashName) {
var _local2 = board.attachMovie("ScoreDisplay", boaster + depthOffset, (50000 + depthOffset) + boasterId);
boasterId++;
if (boasterId == 10) {
boasterId = 0;
}
_local2.init(cardBox, splashName, (cards.length + 3) * 16);
}
function cardClicked(card) {
click();
}
function click() {
board.rules.columnClicked(this);
}
function get score() {
return(value);
}
function set score(newValue) {
value = newValue;
valueCounter.text = value.toString();
//return(score);
}
var containsAce = false;
var boasterId = 0;
}
Symbol 192 MovieClip [__Packages.Card] Frame 0
class Card extends MovieClip
{
var xSlideTarget, _x, ySlideTarget, _y, frontFaceUp, pile, id, value, suit, frontFace, attachMovie, _width, _height, backFace, _alpha, _visible, getDepth;
function Card () {
super();
xSlideTarget = _x;
ySlideTarget = _y;
frontFaceUp = false;
}
function setPile(newPile) {
pile = newPile;
}
function onPress() {
pile.cardClicked(this);
}
function setFaceValue(newFaceValue, newValue, newSuit) {
id = newFaceValue;
value = newValue;
suit = newSuit;
frontFace = attachMovie(id, "frontFace", 0);
frontFace._width = _width;
frontFace._height = _height;
frontFace._visible = false;
}
function setFrontFaceUp(newFrontFaceUp) {
frontFaceUp = newFrontFaceUp;
backFace._visible = !frontFaceUp;
frontFace._visible = frontFaceUp;
}
function fadeOut(delay) {
fadeoutTime = 10 + delay;
}
function onEnterFrame() {
if (fadeoutTime > 0) {
fadeoutTime--;
if (fadeoutTime < 10) {
_alpha = fadeoutTime * 10;
}
if (fadeoutTime == 0) {
_visible = false;
}
}
if (slideTime > 0) {
movePos((xSlideTarget - _x) / slideTime, (ySlideTarget - _y) / slideTime);
slideTime--;
if (slideTime == 0) {
slideEnd();
}
}
}
function slideTo(x, y) {
xSlideTarget = x;
ySlideTarget = y;
slideTime = 5;
movePos((xSlideTarget - _x) / slideTime, (ySlideTarget - _y) / slideTime);
slideTime--;
slideStart();
}
function forceTo(x, y) {
_x = x;
_y = y;
xSlideTarget = x;
ySlideTarget = y;
}
function movePos(xa, ya) {
setPos(_x + xa, _y + ya);
}
function setPos(x, y) {
_x = Math.round(x);
_y = Math.round(y);
}
function slideStart() {
super.swapDepths(getDepth() + 100000);
}
function slideEnd() {
super.swapDepths(getDepth() - 100000);
}
function swapDepths(targetDepth) {
if (slideTime > 0) {
slideEnd();
}
super.swapDepths(targetDepth);
if (slideTime > 0) {
slideStart();
}
}
var slideTime = 0;
var fadeoutTime = 0;
var lastClickTime = 0;
}
Symbol 193 MovieClip [__Packages.ScoreDisplay] Frame 0
class ScoreDisplay extends MovieClip
{
var scoreDisplayHolder, _x, _y, orgxscale, _xscale, orgyscale, _yscale, _alpha, removeMovieClip;
function ScoreDisplay () {
super();
}
function init(mc, splashName, yo) {
var _local2 = scoreDisplayHolder.attachMovie(splashName, foo, 1);
_local2._x = 0;
_local2._y = 0;
_x = mc._x;
_y = mc._y + yo;
orgxscale = _xscale;
orgyscale = _yscale;
time = 0;
_alpha = 0;
}
function onEnterFrame() {
var _local3 = Math.sin((time / lifeSpan) * 3.14159265359);
_alpha = (_local3 * _local3) * 100;
var _local2 = (time / lifeSpan) * 2;
_local2 = Math.sqrt(_local2);
_xscale = _local2 * orgxscale;
_yscale = _local2 * orgyscale;
time++;
if (time > lifeSpan) {
removeMovieClip();
}
}
var lifeSpan = 25;
var time = 0;
}
Symbol 194 MovieClip [__Packages.Rules] Frame 0
class Rules
{
function Rules () {
}
function init() {
}
function win() {
}
function endGame() {
}
function discardClicked() {
}
function columnClicked(column) {
}
}
Symbol 195 MovieClip [__Packages.MoneyRules] Frame 0
class MoneyRules extends Rules
{
var board, xylophone, dingding, card_layout, negative_horn, startsound;
function MoneyRules (board) {
super();
this.board = board;
xylophone = new Sound(_root);
dingding = new Sound(_root);
card_layout = new Sound(_root);
negative_horn = new Sound(_root);
startsound = new Sound(_root);
xylophone.attachSound("xylophone");
dingding.attachSound("ding_ding");
card_layout.attachSound("card_layout");
negative_horn.attachSound("negative_horn");
startsound.attachSound("startsound");
}
function init() {
score = 0;
clearings = 0;
hasWon = false;
newCardRevealed();
var _local2 = 0;
while (_local2 < 4) {
var _local3 = board.columns[_local2];
_local3.score = 0;
_local2++;
}
startsound.start();
}
function win() {
if (hasWon) {
return(undefined);
}
hasWon = true;
var _local4 = score;
var _local3 = board.getTimeLeft();
var _local2 = Math.floor((5000 * (_local3 / board.getTotalTime())) / (1 + board.flippedHand.cards.length));
if (_local2 < 0) {
_local2 = 0;
}
board.win(score, _local2, score + _local2);
playData((((("7," + _local4) + ",") + _local3) + ",") + (score + _local2), _local2);
score = score + _local2;
}
function endGame() {
if (hasWon) {
return(undefined);
}
hasWon = true;
board.endGame(score);
playData("8," + score, 0);
}
function discardClicked() {
if (hasWon) {
return(undefined);
}
if (board.hand.cards.length > 0) {
playData("6", 0);
card_layout.start();
var _local2 = board.hand.popCard();
_local2.slideTo(board.flippedHand.x, board.flippedHand.y);
_local2.setFrontFaceUp(false);
board.flippedHand.pushCard(_local2);
newCardRevealed();
board.cardDiscarded();
}
}
function columnClicked(column) {
if (hasWon) {
return(undefined);
}
if (board.hand.cards.length > 0) {
var _local4 = board.hand.cards[board.hand.cards.length - 1];
if (canMove(_local4, column)) {
card_layout.start();
column.pushCard(board.hand.popCard());
column.score = column.score + getCardValue(_local4, column.__get__score());
var _local3 = score;
if ((column.__get__score() < 21) && (column.cards.length == 5)) {
scoreFiveCardCharlie(column);
} else if (((column.__get__score() == 11) && (column.containsAce)) && (column.cards.length == 2)) {
scoreBlackJack(column);
} else if (_local4.id == "13h") {
scoreMagic(column);
} else if ((column.__get__score() == 21) || ((column.__get__score() == 11) && (column.containsAce))) {
score21(column);
}
playData((column.number + 1).toString(), score - _local3);
newCardRevealed();
return(undefined);
}
var _local3 = score;
negative_horn.start();
score = score - 100;
if (score < 0) {
score = 0;
}
board.setScore(score);
playData("5", score - _local3);
board.showScoreAlert();
}
}
function scoreFiveCardCharlie(column) {
dingding.start();
score = score + (getNextClearValue() * 3);
board.setScore(score);
column.clear("charlie");
}
function scoreBlackJack(column) {
dingding.start();
score = score + (getNextClearValue() * 2);
board.setScore(score);
column.clear("bj");
}
function scoreMagic(column) {
dingding.start();
score = score + getNextClearValue();
board.setScore(score);
column.clear("magic");
}
function score21(column) {
dingding.start();
score = score + getNextClearValue();
board.setScore(score);
column.clear("21");
}
function getNextClearValue() {
clearings++;
return(clearings * 100);
}
function newCardRevealed() {
board.cardsleft.text = board.hand.cards.length.toString();
board.discards.text = board.flippedHand.cards.length.toString();
if (board.hand.cards.length > 0) {
var _local4 = board.hand.cards[board.hand.cards.length - 1];
var _local2 = 0;
while (_local2 < board.columns.length) {
var _local3 = board.columns[_local2];
_local3.setCanMove(canMove(_local4, _local3));
_local2++;
}
return(undefined);
}
win();
var _local2 = 0;
for(;;){
if (_local2 >= board.columns.length) {
return(undefined);
}
var _local3 = board.columns[_local2];
_local3.setCanMove(false);
_local2++;
};
}
function canMove(card, column) {
if (card.id == "13h") {
return(true);
}
return((column.__get__score() + getCardValue(card, column.__get__score())) <= 21);
}
function getCardValue(card, baseScore) {
var _local1 = card.value + 1;
if (_local1 > 10) {
_local1 = 10;
}
return(_local1);
}
function playData(cmd, scoreGained) {
fscommand ("playData", (cmd + "=") + scoreGained);
}
var score = 0;
var clearings = 0;
var hasWon = false;
}