Frame 1
function GlobalGameData() {
this.timeLimit = 300;
this.decks = new Array();
this.deckId = -1;
this.addDeck = function (str) {
var _local6 = str.split("_");
var _local7 = new Array();
var _local5 = 0;
while (_local5 < _local6.length) {
var _local3 = _local6[_local5].toLowerCase();
var _local2 = _local3.substring(1, _local3.length);
if (_local2.toLowerCase() == "j") {
_local2 = 11;
} else if (_local2.toLowerCase() == "q") {
_local2 = 12;
} else if (_local2.toLowerCase() == "k") {
_local2 = 13;
}
var _local4 = new Array();
_local4.push(_local2);
_local4.push(_local3);
_local7.push(_local4);
_local5++;
}
this.decks.push(_local7);
};
this.getDecks = function () {
return(this.decks);
};
this.getNextDeck = function () {
this.deckId++;
return(this.decks[this.deckId]);
};
}
function I18n() {
this.labels = new Array();
this.addLabel = function (lbl) {
this.labels.push(lbl);
};
this.getLabel = function (lbl) {
var _local2 = 0;
while (_local2 < this.labels.length) {
if (this.labels[_local2][0].toLowerCase() == lbl.toLowerCase()) {
return(this.labels[_local2][1]);
}
_local2++;
}
return("M: " + lbl.toUpperCase());
};
}
function parseGameData(myGameData) {
var _local13 = new XML();
_local13.ignoreWhite = true;
_local13.parseXML(myGameData);
var _local12 = _local13.firstChild;
if (_local12.nodeName == "gamedata") {
var _local14 = _local12.attributes.timelimit;
var _local11 = _local12.attributes.relaxMode == "true";
_level0.GAME_MODE = _local12.attributes.mode;
_level0.TIME_LIMIT = _local14;
_level0.RELAX = _local11;
var _local3 = _local12.firstChild;
var _local10 = true;
while (_local3 != null) {
if (_local3.nodeName == "cards") {
if ((!_local10) && (!_local11)) {
var _local6 = _local3.attributes.value;
GLOBAL_GAME_DATA.addDeck(_local6);
}
_local10 = false;
} else if (_local3.nodeName == "text") {
var _local7 = _local3.attributes.id;
var _local9 = _local3.firstChild;
var _local4 = new Array();
_local4.push(_local7);
_local4.push(_local9);
GLOBAL_I18N.addLabel(_local4);
}
_local3 = _local3.nextSibling;
}
if (_local11) {
_level0.lbltimeleft._visible = false;
_level0.txtTimeLeft._visible = false;
var _local8 = 128;
while (_local8--) {
var _local1 = new Array(cardArray.length);
var _local2 = cardArray.length;
while (_local2--) {
_local1[_local2] = cardArray[_local2];
}
var _local5 = new Array();
while (_local1.length > 0) {
_local5.push(_local1.splice((Math.random() * _local1.length) | 0, 1));
}
GLOBAL_GAME_DATA.addDeck(_local5.join("_"));
}
}
}
}
_root.GLOBAL_GAME_DATA = new GlobalGameData();
_root.GLOBAL_I18N = new I18n();
var cardArray = ["H1", "H2", "H3", "H4", "H5", "H6", "H7", "H8", "H9", "H10", "HJ", "HQ", "HK", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "S10", "SJ", "SQ", "SK", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C10", "CJ", "CQ", "CK", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", "dJ", "dQ", "dK"];
Frame 5
if (((gameData == null) || (gameData == undefined)) || (gameData == "")) {
gotoAndPlay(_currentframe - 1);
} else {
parseGameData(gameData);
}
Frame 6
function updateTimeLeft(lft) {
if (lft <= 10) {
if ((lft != _level0.lastPlaySec) && (lft != 0)) {
_level0.snd_timeout.start();
_level0.lastPlaySec = lft;
}
}
var _local2 = lft / 60;
_local2 = Math.floor(_local2);
secs = lft - (_local2 * 60);
if (secs < 10) {
secs = "0" + secs;
}
_level0.txtTimeLeft.text = (_local2 + ":") + secs;
}
function roundEnded() {
_level0.snd_endRound.start();
GLOBAL_TIMER.stopTimer();
if (_level0.GAME_MODE == "short") {
gameOver();
return(undefined);
}
if (getRound() != null) {
TOTAL_SCORE = TOTAL_SCORE + getRound().getTotalScore();
fscommand ("playData", "1523,8=" + getRound().getTotalScore());
}
if (((rounds.length > 0) && (GLOBAL_TIMER.length > 0)) && (getRound().isCompleted())) {
attachMovie("RoundBackground", "roundBackground", 60);
var e = roundBackground;
e._x = 0;
e._y = 0;
attachMovie("NextRoundSplash", "nextRoundSplasher", 61);
var e = nextRoundSplasher;
e._x = 316;
e._y = 88;
e.fillData(getRound());
} else {
gameOver();
}
}
function gameOver() {
attachMovie("RoundBackground", "roundBackground", 60);
var e = roundBackground;
e._x = 0;
e._y = 0;
attachMovie("GameOverSplash", "gameOverSplasher", 61);
var e = gameOverSplasher;
e._x = 356;
e._y = 72;
e.fillData(getRound());
var evt = new Object();
evt.onEvent = function () {
fscommand ("gameOver", _level0.TOTAL_SCORE);
clearInterval(_level0.onEndTimern);
};
_level0.onEndTimern = setInterval(evt, "onEvent", 5000);
}
function startGame() {
fscommand ("gameStart");
fscommand ("playData", ("1112," + version) + ",0=0");
_level0.nextRound();
}
function nextRound() {
var _local2 = rounds.shift();
if (_local2 != null) {
ROUND_ID++;
this.roundId.text = ROUND_ID;
CURRENT_ROUND = _local2;
var _local3 = GLOBAL_GAME_DATA.getNextDeck();
_local2.setDeck(_local3);
_local2.generateCards();
_local2.linkAndInitCards();
_local2.roundMultiply = 1 + ((ROUND_ID - 1) * 0.1);
_local2.openRound();
} else {
CURRENT_ROUND = null;
}
}
function startTimer() {
GLOBAL_TIMER.startTimer();
}
function getRound() {
return(CURRENT_ROUND);
}
function rnd(lowNumber, highNumber) {
var _local3 = highNumber - lowNumber;
var _local2 = Math.random() * _local3;
var _local1 = Math.round(_local2);
_local1 = _local1 + lowNumber;
return(_local1);
}
var CARDCOORD = [[290, 30], [440, 30], [590, 30], [262, 65], [312, 65], [415, 65], [465, 65], [565, 65], [615, 65], [240, 105], [290, 105], [340, 105], [390, 105], [440, 105], [490, 105], [540, 105], [587, 105], [640, 105], [215, 145], [265, 145], [315, 145], [365, 145], [415, 145], [465, 145], [515, 145], [565, 145], [615, 145], [665, 145]];
var version = 2;
var ANIM_INDEX = 3000;
var rounds = new Array();
var CURRENT_ROUND = null;
var TOTAL_SCORE = 0;
var ROUND_ID = 0;
var timeoutSounder = null;
var GLOBAL_TIMER = new GlobalTimer();
GLOBAL_TIMER.setTime(TIME_LIMIT);
if (!_level0.RELAX) {
var t = setInterval(GLOBAL_TIMER, "onTimerEvent", 200);
}
txtDebug.text = gameData;
lblroundscore.text = GLOBAL_I18N.getLabel("roundscore");
lbltimeleft.text = GLOBAL_I18N.getLabel("timeleft");
lbltimeleft._visible = !_level0.RELAX;
txtTimeLeft._visible = !_level0.RELAX;
lbllongestrun.text = GLOBAL_I18N.getLabel("longestrun");
lblround.text = GLOBAL_I18N.getLabel("round");
lblendgame.text = GLOBAL_I18N.getLabel("endgame");
snd_cardcleared = new Sound();
snd_cardcleared.attachSound("SndCardClick");
snd_turncard = new Sound();
snd_turncard.attachSound("SndCardClick");
snd_scarab = new Sound();
snd_scarab.attachSound("SndScarab");
snd_startRound = new Sound();
snd_startRound.attachSound("SndRound");
snd_endRound = new Sound();
snd_endRound.attachSound("SndRound");
snd_joker = new Sound();
snd_joker.attachSound("SndJoker");
snd_timeout = new Sound();
snd_timeout.attachSound("SndTimeOut");
snd_endplate = new Sound();
snd_endplate.attachSound("SndEndPlate");
snd_startRound.start();
stop();
var x = 0;
while (x < 12) {
var g = new GameRound();
rounds.push(g);
x++;
}
var onEndTimern = null;
Symbol 17 MovieClip [Bagge] Frame 65
removeMovieClip(this);
Symbol 183 MovieClip [PlayCard] Frame 1
frontCover._visible = true;
Symbol 183 MovieClip [PlayCard] Frame 4
frontCover._visible = false;
Symbol 188 MovieClip [PointDisplay] Frame 20
removeMovieClip(this);
Symbol 204 MovieClip [GameOverSplash] Frame 1
lblgameover.text = _level0.GLOBAL_I18N.getLabel("gameover");
lblsum_roundscore.text = _level0.GLOBAL_I18N.getLabel("sum_roundscore");
lbltoprunbonus.text = _level0.GLOBAL_I18N.getLabel("toprunbonus");
lbljokerbonus.text = _level0.GLOBAL_I18N.getLabel("jokerbonus");
lblunusedbonus.text = _level0.GLOBAL_I18N.getLabel("unusedbonus");
lbltot_roundscore.text = _level0.GLOBAL_I18N.getLabel("tot_roundscore");
lbltot_score.text = _level0.GLOBAL_I18N.getLabel("tot_score");
function endSplash() {
}
txtLongRunBonus._visible = false;
txtJokerBonus._visible = false;
txtUnusedcardBonus._visible = false;
txtTotalScore._visible = false;
txtTotalRoundScore._visible = false;
Symbol 204 MovieClip [GameOverSplash] Frame 7
txtLongRunBonus._visible = true;
Symbol 204 MovieClip [GameOverSplash] Frame 14
txtJokerBonus._visible = true;
txtUnusedcardBonus._visible = true;
Symbol 204 MovieClip [GameOverSplash] Frame 20
txtTotalRoundScore._visible = true;
txtTotalScore._visible = true;
Symbol 204 MovieClip [GameOverSplash] Frame 25
stop();
Symbol 219 MovieClip [NextRoundSplash] Frame 1
lblsum_roundscore.text = _level0.GLOBAL_I18N.getLabel("sum_roundscore");
lbltoprunbonus.text = _level0.GLOBAL_I18N.getLabel("toprunbonus");
lbljokerbonus.text = _level0.GLOBAL_I18N.getLabel("jokerbonus");
lblunusedbonus.text = _level0.GLOBAL_I18N.getLabel("unusedbonus");
lbltot_roundscore.text = _level0.GLOBAL_I18N.getLabel("tot_roundscore");
lbltot_score.text = _level0.GLOBAL_I18N.getLabel("tot_score");
lblsecondsleft.text = _level0.GLOBAL_I18N.getLabel("secondsleft");
var timer = new Object();
timer.secs = 6;
txtNextSec.text = timer.secs;
timer._self = this;
timer.onEvent = function () {
if (this.secs > 0) {
this.secs--;
this._self.txtNextSec.text = this.secs;
} else {
this._self.endSplash();
}
};
setInterval(timer, "onEvent", 1000);
function endSplash() {
removeMovieClip(_level0.roundBackground);
removeMovieClip(this);
nextRound();
}
txtLongRunBonus._visible = false;
txtJokerBonus._visible = false;
txtUnusedcardBonus._visible = false;
txtTotalScore._visible = false;
txtTotalRoundScore._visible = false;
Symbol 219 MovieClip [NextRoundSplash] Frame 7
txtLongRunBonus._visible = true;
Symbol 219 MovieClip [NextRoundSplash] Frame 14
txtJokerBonus._visible = true;
txtUnusedcardBonus._visible = true;
Symbol 219 MovieClip [NextRoundSplash] Frame 20
txtTotalRoundScore._visible = true;
txtTotalScore._visible = true;
Symbol 219 MovieClip [NextRoundSplash] Frame 25
stop();
Symbol 225 MovieClip [NoMoreMovesSplash] Frame 1
lblNoMore.text = _level0.GLOBAL_I18N.getLabel("nomoremoves");
Symbol 225 MovieClip [NoMoreMovesSplash] Frame 5
stop();
Symbol 227 MovieClip [TimesUpSplash] Frame 1
lblTimes.text = _level0.GLOBAL_I18N.getLabel("timesup");
Symbol 227 MovieClip [TimesUpSplash] Frame 5
stop();
Symbol 247 MovieClip Frame 1
#initclip 1
function GameRound() {
this.STACK_X = 465;
this.STACK_Y = 265;
this.roundMultiply = 1;
this.rndId = 0;
this.setRoundId = function (id) {
this.rndId = id;
};
this.getRoundId = function () {
return(this.rndId);
};
this.CARDS = new Array();
this.POINTS_ZORDER = 1000;
this.NUM_CARDS_HIDDEN = 23;
this.TOP_CARD = null;
this.PREVIOUS_TOP_CARD = null;
this.JOKER_USED = false;
this.TOP_RUN = 0;
this.CHAIN_LENGTH = 0;
this.CARDS_CLEARED = 0;
this.POINTS = 0;
this.NUM_SPECIALS_CLEARED = 0;
this.closingRound = false;
this.isCompleted = function () {
return(this.NUM_SPECIALS_CLEARED == 3);
};
this.wrongClick = function (crd) {
this.POINTS = Math.round(this.POINTS - (20 * this.roundMultiply));
if (this.POINTS < 0) {
this.POINTS = 0;
}
_level0.points.text = this.POINTS;
fscommand ("playData", (("51," + crd._name) + "=") + getTimer());
};
this.getLongRunBonus = function () {
return(Math.round((this.TOP_RUN * 200) * this.roundMultiply));
};
this.getJokerBonus = function () {
if (this.NUM_SPECIALS_CLEARED == 3) {
return(Math.round((this.JOKER_USED ? 0 : 2000) * this.roundMultiply));
}
return(0);
};
this.getUnusedcardBonus = function () {
return(Math.round(((this.NUM_SPECIALS_CLEARED == 3) ? (this.NUM_CARDS_HIDDEN * 500) : 0) * this.roundMultiply));
};
this.getTotalScore = function () {
return(((this.POINTS + this.getLongRunBonus()) + this.getJokerBonus()) + this.getUnusedcardBonus());
};
this.incChain = function () {
this.CHAIN_LENGTH++;
if (this.TOP_RUN < this.CHAIN_LENGTH) {
this.TOP_RUN = this.CHAIN_LENGTH;
_level0.topRun.text = this.TOP_RUN;
}
};
this.resetChain = function () {
this.CHAIN_LENGTH = 0;
};
this.updateStatusInfo = function () {
_level0.cardsLeft.text = this.NUM_CARDS_HIDDEN;
};
this.cardCleared = function (card) {
if (card.getValue() == -1) {
this.JOKER_USED = true;
_level0.snd_joker.start();
fscommand ("playData", "666=0");
return(undefined);
}
var cardPoint = Math.round((100 + (this.CHAIN_LENGTH * 50)) * this.roundMultiply);
this.incChain();
this.CARDS_CLEARED++;
var specialCleared = false;
if (card.getRow() == 4) {
this.NUM_SPECIALS_CLEARED++;
specialCleared = true;
attachMovie("Bagge", "bagge" + card._name, _level0.ANIM_INDEX++);
var y = eval ("bagge" + card._name);
fscommand ("playData", "1011,1,0=0");
if (card.specialNum == 1) {
y._x = 311;
} else if (card.specialNum == 2) {
y._x = 463;
} else if (card.specialNum == 3) {
y._x = 610;
}
y._y = 63;
specialBonus = 0;
if (this.NUM_SPECIALS_CLEARED == 1) {
specialBonus = 1000;
}
if (this.NUM_SPECIALS_CLEARED == 2) {
specialBonus = 1500;
}
if (this.NUM_SPECIALS_CLEARED == 3) {
specialBonus = 2000;
}
if (cardPoint < specialBonus) {
cardPoint = specialBonus;
}
}
this.POINTS = Math.round(this.POINTS + cardPoint);
_level0.points.text = this.POINTS;
fscommand ("playData", (("34," + card._name) + "=") + cardPoint);
attachMovie("PointDisplay", "display_" + card._name, 5000 + (IDG++));
var p = eval ("display_" + card._name);
(p._x = 425);
(p._y = 220);
p.setText(cardPoint);
p.animate(p._x, p._y - 80, 1000);
if (specialCleared) {
_level0.snd_scarab.start();
} else {
_level0.snd_cardcleared.start();
}
};
this.endWaitEnded = function () {
clearInterval(this.endWaiterRef);
var x = 0;
while (x < this.CARDS.length) {
var e = this.CARDS[x];
removeMovieClip(e);
x++;
}
var e = joker;
removeMovieClip(e);
_level0.topRun.text = "";
_level0.points.text = "";
_level0.cardsLeft.text = "";
removeMovieClip("TimeUpSplash");
removeMovieClip("NoMoreMoves");
_level0.roundEnded();
};
this.closeRound = function () {
if (!this.closingRound) {
this.closingRound = true;
_level0.GLOBAL_TIMER.stopTimer();
var x = 0;
while (x < this.CARDS.length) {
var e = this.CARDS[x];
e.onRelease = "undefined";
e.onRollOver = "undefined";
x++;
}
var e = joker;
e.onRelease = "undefined";
e.onRollOver = "undefined";
var playSound = false;
if ((_level0.GLOBAL_TIMER.length == 0) && (this.NUM_SPECIALS_CLEARED < 3)) {
attachMovie("TimesUpSplash", "TimeUpSplash", _level0.ANIM_INDEX++);
var e = TimeUpSplash;
e._x = 254;
e._y = 121;
playSound = true;
}
if (this.NO_MORE_MOVES && (this.NUM_SPECIALS_CLEARED < 3)) {
attachMovie("NoMoreMovesSplash", "NoMoreMoves", _level0.ANIM_INDEX++);
var e = NoMoreMoves;
e._x = 254;
e._y = 121;
playSound = true;
}
if (playSound) {
_level0.snd_endplate.start(0, 1);
}
this.endWaiterRef = setInterval(this, "endWaitEnded", 3500);
fscommand ("playData", (("1512," + getTimer()) + ",0=") + getRound().getTotalScore());
}
};
this.openRound = function () {
fscommand ("playData", (("1511," + getTimer()) + ",0=") + getRound().getTotalScore());
fscommand ("playData", ("56," + _level0.ROUND_ID) + "=0");
_level0.topRun.text = "0";
_level0.points.text = "0";
_level0.startTimer();
};
this.anymoreMoves = function () {
var retval = false;
if (!this.JOKER_USED) {
retval = true;
}
var x = 0;
while (x < 28) {
var e = eval ("c" + x);
if ((e.isOpen() && (e.onTable)) && (e.compare(this.TOP_CARD))) {
retval = true;
break;
}
x++;
}
if (this.NUM_CARDS_HIDDEN > 0) {
retval = true;
}
if (this.NUM_SPECIALS_CLEARED == 3) {
retval = false;
}
if (retval) {
} else {
this.NO_MORE_MOVES = true;
this.closeRound();
}
};
this.generateCards = function () {
var x = 0;
while (x < this.DECK.length) {
attachMovie("PlayCard", "c" + x, 100 + x);
var e = eval ("c" + x);
e._x = 395;
e._y = 265;
e.initialize(this.DECK[x][0], this.DECK[x][1]);
this.CARDS.push(e);
e.onTable = false;
if (x < 28) {
var o = new Object();
o._self = this;
o.moved = function (ref) {
this._self.onInitialCardPlaced(ref);
};
e.setMoveEndListener(o);
e.animate(CARDCOORD[x][0], CARDCOORD[x][1], 1000);
e.onTable = true;
} else if (x == 28) {
var o = new Object();
o._self = this;
o.moved = function (ref) {
this._self.onFirstStackCardPlaced(ref);
};
e.setMoveEndListener(o);
e.animate(this.STACK_X, this.STACK_Y, 500);
this.TOP_CARD = e;
} else {
e.setBehaviour("topstack");
}
x++;
}
_level0.cardsLeft.text = this.NUM_CARDS_HIDDEN;
attachMovie("PlayCard", "joker", 160);
var e = joker;
e._x = 395;
e._y = 265;
e.initialize(-1, "joker");
e.animate(295, 230, 500);
var o = new Object();
o._self = this;
o.moved = function (ref) {
this._self.onInitialCardPlaced(ref);
};
e.setMoveEndListener(o);
};
this.onFirstStackCardPlaced = function (ref) {
ref.gotoAndStop(1);
ref.setBehaviour("openstack");
};
this.onInitialCardPlaced = function (ref) {
ref.gotoAndStop(1);
ref.setBehaviour("foundation");
};
this.linkAndInitCards = function () {
var _local2 = 0;
while (_local2 < 28) {
if (_local2 == 0) {
this.CARDS[_local2].specialNum = 1;
this.CARDS[_local2].setRow(4);
this.CARDS[_local2].addChild(this.CARDS[3]);
this.CARDS[_local2].addChild(this.CARDS[4]);
} else if (_local2 == 1) {
this.CARDS[_local2].specialNum = 2;
this.CARDS[_local2].setRow(4);
this.CARDS[_local2].addChild(this.CARDS[5]);
this.CARDS[_local2].addChild(this.CARDS[6]);
} else if (_local2 == 2) {
this.CARDS[_local2].specialNum = 3;
this.CARDS[_local2].setRow(4);
this.CARDS[_local2].addChild(this.CARDS[7]);
this.CARDS[_local2].addChild(this.CARDS[8]);
} else if (_local2 == 3) {
this.CARDS[_local2].setRow(3);
this.CARDS[_local2].addChild(this.CARDS[9]);
this.CARDS[_local2].addChild(this.CARDS[10]);
} else if (_local2 == 4) {
this.CARDS[_local2].setRow(3);
this.CARDS[_local2].addChild(this.CARDS[10]);
this.CARDS[_local2].addChild(this.CARDS[11]);
} else if (_local2 == 5) {
this.CARDS[_local2].setRow(3);
this.CARDS[_local2].addChild(this.CARDS[12]);
this.CARDS[_local2].addChild(this.CARDS[13]);
} else if (_local2 == 6) {
this.CARDS[_local2].setRow(3);
this.CARDS[_local2].addChild(this.CARDS[13]);
this.CARDS[_local2].addChild(this.CARDS[14]);
} else if (_local2 == 7) {
this.CARDS[_local2].setRow(3);
this.CARDS[_local2].addChild(this.CARDS[15]);
this.CARDS[_local2].addChild(this.CARDS[16]);
} else if (_local2 == 8) {
this.CARDS[_local2].setRow(3);
this.CARDS[_local2].addChild(this.CARDS[16]);
this.CARDS[_local2].addChild(this.CARDS[17]);
} else if (_local2 == 9) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[18]);
this.CARDS[_local2].addChild(this.CARDS[19]);
} else if (_local2 == 10) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[19]);
this.CARDS[_local2].addChild(this.CARDS[20]);
} else if (_local2 == 11) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[20]);
this.CARDS[_local2].addChild(this.CARDS[21]);
} else if (_local2 == 12) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[21]);
this.CARDS[_local2].addChild(this.CARDS[22]);
} else if (_local2 == 13) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[22]);
this.CARDS[_local2].addChild(this.CARDS[23]);
} else if (_local2 == 14) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[23]);
this.CARDS[_local2].addChild(this.CARDS[24]);
} else if (_local2 == 15) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[24]);
this.CARDS[_local2].addChild(this.CARDS[25]);
} else if (_local2 == 16) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[25]);
this.CARDS[_local2].addChild(this.CARDS[26]);
} else if (_local2 == 17) {
this.CARDS[_local2].setRow(2);
this.CARDS[_local2].addChild(this.CARDS[26]);
this.CARDS[_local2].addChild(this.CARDS[27]);
} else {
this.CARDS[_local2].setRow(1);
}
_local2++;
}
};
this.setDeck = function (dck) {
this.DECK = dck;
};
}
Movable = function () {
this.doAnimate = false;
this.onMoveEndListener = null;
};
Movable.prototype = new MovieClip();
Movable.prototype.onFrameEntered = function () {
if (this.doAnimate) {
if (this.startTime == null) {
this.startTime = getTimer();
}
var _local5 = this.targetX;
var _local4 = this.targetY;
var _local3 = _local5 - this.startX;
var _local2 = _local4 - this.startY;
if (this.algorithm == "cubic_out") {
var _local7 = Math.round(this.easeOutCubic(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.easeOutCubic(getTimer() - this.startTime, this.startY, _local2, this.duration));
} else if (this.algorithm == "bounce_out") {
var _local7 = Math.round(this.easeOutBounce(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.easeOutBounce(getTimer() - this.startTime, this.startY, _local2, this.duration));
} else if (this.algorithm == "easeInQuad") {
var _local7 = Math.round(this.easeInQuad(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.easeInQuad(getTimer() - this.startTime, this.startY, _local2, this.duration));
} else if (this.algorithm == "easeOutElastic") {
var _local7 = Math.round(this.easeOutElastic(getTimer() - this.startTime, this.startX, _local3, this.duration));
var _local6 = Math.round(this.easeOutElastic(getTimer() - this.startTime, this.startY, _local2, this.duration));
}
this._x = _local7;
this._y = _local6;
if ((Math.abs(this._x - _local5) < 2) && (Math.abs(this._y - _local4) < 2)) {
this.startTime = null;
this._x = _local5;
this._y = _local4;
this.doAnimate = false;
if (this.onMoveEndListener != null) {
this.onMoveEndListener.moved(this);
}
}
}
};
Movable.prototype.setMoveEndListener = function (list) {
this.onMoveEndListener = list;
};
Movable.prototype.animate = function (targetX, targetY, duration) {
this.targetX = targetX;
this.targetY = targetY;
this.startX = this._x;
this.startY = this._y;
this.duration = duration;
this.doAnimate = true;
this.startTime = null;
this.algorithm = "cubic_out";
};
Movable.prototype.easeInQuad = function (t, b, c, d) {
if (t > d) {
t = d;
}
return((((c * t) * t) / (d * d)) + b);
};
Movable.prototype.easeOutQuad = function (t, b, c, d) {
if (t > d) {
t = d;
}
return((((((-c) * t) * t) / (d * d)) + (((2 * c) * t) / d)) + b);
};
Movable.prototype.easeOutCubic = function (t, b, c, d) {
if (t > d) {
t = d;
}
t = (t / d) - 1;
return((c * (((t * t) * t) + 1)) + b);
};
Movable.prototype.easeOutQuart = function (t, b, c, d) {
if (t > d) {
t = d;
}
t = (t / d) - 1;
return(((-c) * ((((t * t) * t) * t) - 1)) + b);
};
Movable.prototype.easeOutElastic = function (t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / d;
if (t == 1) {
return(b + c);
}
if (!p) {
p = d * 0.3;
}
if (a < Math.abs(c)) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
return((((a * Math.pow(2, -10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p)) + c) + b);
};
PointDisplay = function () {
};
PointDisplay.prototype = new Movable();
Object.registerClass("PointDisplay", PointDisplay);
PointDisplay.prototype.onEnterFrame = function () {
this.onFrameEntered();
};
PointDisplay.prototype.setText = function (txt) {
this.txtDisplay.text = txt;
};
NextRoundSplash = function () {
};
Object.registerClass("NextRoundSplash", NextRoundSplash);
NextRoundSplash.prototype.fillData = function (round) {
this.txtRoundScore.text = round.POINTS;
this.txtLongRunBonus.text = round.getLongRunBonus();
this.txtJokerBonus.text = round.getJokerBonus();
this.txtUnusedcardBonus.text = round.getUnusedcardBonus();
this.txtTotalRoundScore.text = round.getTotalScore();
this.txtTotalScore.text = _level0.TOTAL_SCORE;
};
GameOverSplash = function () {
};
Object.registerClass("GameOverSplash", GameOverSplash);
GameOverSplash.prototype.fillData = function (round) {
this.txtRoundScore.text = round.POINTS;
this.txtLongRunBonus.text = round.getLongRunBonus();
this.txtJokerBonus.text = round.getJokerBonus();
this.txtUnusedcardBonus.text = round.getUnusedcardBonus();
this.txtTotalRoundScore.text = round.getTotalScore();
this.txtTotalScore.text = _level0.TOTAL_SCORE;
};
PlayCard = function () {
this.label = null;
this.value = null;
this.row = null;
this.doRollOver = false;
this.doClick = false;
};
PlayCard.prototype = new Movable();
Object.registerClass("PlayCard", PlayCard);
PlayCard.prototype.initialize = function (lbl, val) {
this.label = val;
this.value = lbl;
this.frontCover.attachMovie(this.label, "frontCover", 1);
this.clickListener = null;
this.childs = new Array();
this.parents = new Array();
};
PlayCard.prototype.getValue = function () {
return(this.value);
};
PlayCard.prototype.setRow = function (i) {
this.row = i;
};
PlayCard.prototype.getRow = function () {
return(this.row);
};
PlayCard.prototype.addChild = function (child) {
this.childs.push(child);
child.addParent(this);
};
PlayCard.prototype.addParent = function (parent) {
this.parents.push(parent);
};
PlayCard.prototype.removeChild = function (child) {
var _local2 = 0;
while (_local2 < this.childs.length) {
if (this.childs[_local2]._name == child._name) {
this.childs.splice(_local2, 1);
return(undefined);
}
_local2++;
}
};
PlayCard.prototype.removeFromParents = function () {
var _local2 = 0;
while (_local2 < this.parents.length) {
this.parents[_local2].removeChild(this);
_local2++;
}
};
PlayCard.prototype.isOpen = function () {
if (this.childs.length == 0) {
return(true);
}
return(false);
};
PlayCard.prototype.onEnterFrame = function () {
this.onFrameEntered();
};
PlayCard.prototype.onRelease = function () {
};
PlayCard.prototype.onRollOver = function () {
};
PlayCard.prototype.onRollOut = function () {
};
PlayCard.prototype.onLoad = function () {
this.gotoAndStop(4);
};
PlayCard.prototype.setBehaviour = function (behave) {
if (behave == "openstack") {
this.onRollOver = null;
this.onRollOut = null;
this.onRelease = null;
}
if (behave == "foundation") {
this.onRollOver = function () {
if (this.isOpen()) {
this.gotoAndStop(2);
}
};
this.onRollOut = function () {
if (this.isOpen()) {
this.gotoAndStop(1);
}
};
this.onRelease = function () {
if (this.isOpen()) {
this.onValidClick();
}
};
}
if (behave == "topstack") {
this.onRollOver = null;
this.onRollOut = null;
this.onRelease = function () {
_level0.snd_turncard.start();
this.gotoAndStop(1);
if (this.getDepth() < getRound().TOP_CARD.getDepth()) {
this.swapDepths(getRound().TOP_CARD);
}
getRound().PREVIOUS_TOP_CARD = getRound().TOP_CARD;
getRound().TOP_CARD = this;
var evt = new Object();
evt._self = this;
evt.moved = function (ref) {
evt._self.onMovedToStack(ref);
};
this.setMoveEndListener(evt);
getRound().resetChain();
this.animate(getRound().STACK_X, getRound().STACK_Y, 50);
this.setBehaviour("openstack");
fscommand ("playData", (("824," + this._name) + "=") + getTimer());
getRound().NUM_CARDS_HIDDEN--;
getRound().updateStatusInfo();
getRound().anymoreMoves();
};
}
};
PlayCard.prototype.onValidClick = function () {
if (this.compare(getRound().TOP_CARD)) {
this.onRollOver = null;
this.onRelease = null;
if (this.getDepth() < getRound().TOP_CARD.getDepth()) {
this.swapDepths(getRound().TOP_CARD);
}
getRound().PREVIOUS_TOP_CARD = getRound().TOP_CARD;
getRound().TOP_CARD = this;
this.onTable = false;
getRound().cardCleared(this);
var evt = new Object();
evt._self = this;
evt.moved = function (ref) {
evt._self.onMovedToStack(ref);
};
this.setMoveEndListener(evt);
this.animate(getRound().STACK_X, getRound().STACK_Y, 250);
this.removeFromParents();
getRound().anymoreMoves();
} else {
getRound().wrongClick(this);
}
};
PlayCard.prototype.onMovedToStack = function (ref) {
if (getRound().PREVIOUS_TOP_CARD != null) {
removeMovieClip(getRound().PREVIOUS_TOP_CARD);
ref.gotoAndStop(1);
_level0.txtDebug.text = ((_level0.txtDebug.text + "top:") + ref.value) + newline;
}
};
PlayCard.prototype.compare = function (comp) {
if ((this.getValue() > -1) && (comp.getValue() > -1)) {
var _local2 = Math.abs(this.getValue() - comp.getValue());
if ((_local2 == 1) || (_local2 == 12)) {
return(true);
}
return(false);
}
return(true);
};
GlobalTimer = function () {
this.started = false;
this.length = 300;
this.totalTime = 300;
this.elapsed = 0;
this.setTime = function (time) {
this.length = time;
this.totalTime = time;
};
this.onTimerEvent = function () {
if (this.started) {
var _local2 = Math.floor((getTimer() - this.initialStartTime) / 1000);
this.length = this.totalTime - (this.elapsed + _local2);
if ((this.totalTime - (this.elapsed + _local2)) < 0) {
_level0.updateTimeLeft(0);
this.length = 0;
getRound().closeRound();
} else {
_level0.updateTimeLeft(this.totalTime - (this.elapsed + _local2));
}
}
};
this.startTimer = function () {
if ((this.initialStartTime == null) || (this.initialStartTime == undefined)) {
this.initialStartTime = getTimer();
}
this.started = true;
};
this.stopTimer = function () {
if ((this.started && (this.initialStartTime != null)) && (this.initialStartTime != 0)) {
this.elapsed = this.elapsed + Math.floor((getTimer() - this.initialStartTime) / 1000);
}
this.initialStartTime = null;
this.started = false;
};
};
#endinitclip
Symbol 249 Button
on (release) {
if ((getRound().isCancelled == null) || (getRound().isCancelled == undefined)) {
getRound().isCancelled = true;
fscommand ("playData", "0,1=" + getTimer());
getRound().closeRound();
}
}
Symbol 262 Button
on (release) {
endSplash();
}
Symbol 266 MovieClip Frame 1
function endSplash() {
_level0.startGame();
clearInterval(timerId);
unloadMovie (_level0.rndBack);
unloadMovie (_level0.startSplash);
}
lblstartgame.text = _level0.GLOBAL_I18N.getLabel("startgame");
lblinstructions.text = _level0.GLOBAL_I18N.getLabel((_level0.RELAX ? "relax_" : "") + "instructions");
lblstart.text = _level0.GLOBAL_I18N.getLabel("start");
lblsecondstilstart.text = _level0.GLOBAL_I18N.getLabel("secondstilstart");
var timerId = -1;
var timer = new Object();
timer.secs = 10;
txtNextSec.text = timer.secs;
timer._self = this;
timer.onEvent = function () {
if (this.secs > 0) {
this.secs--;
this._self.lblsec.text = this.secs;
} else {
this._self.endSplash();
}
};
timerId = setInterval(timer, "onEvent", 1000);