Frame 1
function isRecordScore(tool, category, main_score, secondary_score) {
var _local8 = "highscores_" + category;
var _local4 = _root.getSavedObject(tool, _local8);
var _local2 = 0;
while (_local2 < _local4.maxlength) {
var _local3 = _local4.main_score[_local2];
var _local5 = _local4.secondary_score[_local2];
if (_local3 == undefined) {
return(true);
}
if ((_local3 < main_score) || ((_local3 == main_score) && (_local5 < secondary_score))) {
return(true);
}
_local2++;
}
return(false);
}
function addRecordScore(tool, category, player, main_score, secondary_score) {
var _local12 = "highscores_" + category;
var _local3 = _root.getSavedObject(tool, _local12);
var _local2 = 0;
while (_local2 < _local3.maxlength) {
var _local6 = _local3.main_score[_local2];
var _local7 = _local3.secondary_score[_local2];
if (_local6 == undefined) {
break;
}
if ((_local6 < main_score) || ((_local6 == main_score) && (_local7 < secondary_score))) {
break;
}
_local2++;
}
var _local4 = player;
var _local9 = main_score;
var _local8 = secondary_score;
do {
var _local5 = _local3.player[_local2];
var _local6 = _local3.main_score[_local2];
var _local7 = _local3.secondary_score[_local2];
_local3.player[_local2] = _local4;
_local3.main_score[_local2] = _local9;
_local3.secondary_score[_local2] = _local8;
_local4 = _local5;
_local9 = _local6;
_local8 = _local7;
_local2++;
} while ((_local4 != undefined) && (_local2 < _local3.maxlength));
_local3.length = _local2;
_root.flushSavedObject();
}
function getRecordScore(tool, category, idx) {
var _local5 = "highscores_" + category;
var _local3 = _root.getSavedObject(tool, _local5);
var _local2 = new Object();
_local2.player = _local3.player[idx];
_local2.main_score = _local3.main_score[idx];
_local2.secondary_score = _local3.secondary_score[idx];
return(_local2);
}
function initRecordsTable(tool, category, maxlength) {
var _local2 = "highscores_" + category;
var _local3 = _root.getSavedObject(tool, _local2);
if (_local3.maxlength != undefined) {
return(undefined);
}
resetRecordsTable(tool, category, maxlength);
_root.flushSavedObject();
}
function resetRecordsTable(tool, category, maxlength) {
var _local4 = "highscores_" + category;
var _local2 = _root.getSavedObject(tool, _local4);
delete _local2.player;
delete _local2.main_score;
delete _local2.secondary_score;
_local2.maxlength = maxlength;
_local2.player = new Array(maxlength);
_local2.main_score = new Array(maxlength);
_local2.secondary_score = new Array(maxlength);
_root.flushSavedObject();
}
function newRandomCards(num) {
cards = new Array();
var _local1 = 1;
while (_local1 <= num) {
cards[_local1] = newRandomCard();
_local1++;
}
return(cards);
}
function newRandomCard() {
return(new cardObj(randomColor(), randomShape(), randomColor(), randomShape()));
}
function randomColor() {
switch (int(Math.random() * 4)) {
case 0 :
return("red");
case 1 :
return("blue");
case 2 :
return("green");
case 3 :
return("yellow");
}
}
function randomShape() {
switch (int(Math.random() * 4)) {
case 0 :
return("luna");
case 1 :
return("stella");
case 2 :
return("terra");
case 3 :
return("sol");
}
}
function isColor(type) {
if ((((type == "red") || (type == "blue")) || (type == "yellow")) || (type == "green")) {
return(true);
}
return(false);
}
function getNextDepth() {
if ((nonReggedMCs == undefined) || (nonReggedMCs == NaN)) {
nonReggedMCs = 0;
}
if (nextAvailableDepth == undefined) {
nextAvailableDepth = 11000 - nonReggedMCs;
}
nextAvailableDepth--;
return(nextAvailableDepth);
}
function handleDealClickGameNotOver() {
if ((_root.mainDeck.noMoreDeals() == 1) && (_root.lastDealWarningIssued == false)) {
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("no_more_deals_mc", "dummy", 15000);
_local2.swapDepths(15000);
_local2._x = 64.3;
_local2._y = 209.4;
_local2.onMouseDown = _root.unloadSelf;
_root.playSound("tool_message.wav");
_root.lastDealWarningIssued = true;
return(undefined);
}
_root.mainDeck.deal();
return(undefined);
}
function handleHighScoresUpdate() {
_root.initHighScores();
var _local9 = Number(_root.total_points_txt.text);
var _local8 = Number(_root.currentLevel);
if (_root.total_points_txt.text == 0) {
return(false);
}
if ((!_root.isRecordScore("RPN", "basic_scores", _root.total_points_txt.text, _root.currentLevel)) && (!_root.isRecordScore("RPN", "basic_levels", _root.currentLevel, _root.total_points_txt.text))) {
return(false);
}
_root.newHighscore = true;
_root.rpnStopSynergies();
_root.jumpToScores();
var _local3 = _root.getReggedStageMC();
_root.hs_mc = _local3;
_local3.attachMovie("highscore_mc", "highscore", 20000);
_local3.swapDepths(20000);
_local3._x = 185.8;
_local3._y = 361.4;
var _local6 = new Object();
_local6.parent = _local3.highscore;
_local6.onKeyDown = function () {
var _local2 = Key.getCode();
if ((_local2 == 13) || (_local2 == 13)) {
Key.removeListener(this);
this.parent.handleSubmitPress();
}
};
Key.addListener(_local6);
_local3.highscore.points = _local9;
_local3.highscore.level = _local8;
var _local4 = new TextFormat();
_local4.font = "AndalusNumbers";
_local4.bold = true;
_local4.size = 14;
_local4.align = "center";
_local4.letterSpacing = 2;
var _local5 = _local3.highscore.playerName;
_local4.color = 4203023 /* 0x40220F */;
_local5.setNewTextFormat(_local4);
_local5.sharpness = 0;
_local5.antiAliasType = "advanced";
_local5.embedFonts = true;
return(true);
}
function setCard(obj, val) {
if (val != undefined) {
setCard(obj, undefined);
obj.leftColor.attachMovie(val.leftColor + "_mc", "leftCol_mc", getNextDepth());
obj.rightColor.attachMovie(val.rightColor + "_mc", "rightCol_mc", getNextDepth());
obj.rightShape.attachMovie(val.rightShape + "_mc", "rightShp_mc", getNextDepth());
if ((val.leftShape == "luna") || (val.leftShape == "terra")) {
obj.leftShape.attachMovie(val.leftShape + "_flipped_mc", "leftShp_mc", getNextDepth());
} else {
obj.leftShape.attachMovie(val.leftShape + "_mc", "leftShp_mc", getNextDepth());
}
obj.cardval = val;
obj._visible = true;
_root.registerStageMC(obj.leftColor.leftCol_mc);
_root.registerStageMC(obj.rightColor.rightCol_mc);
_root.registerStageMC(obj.leftShape.leftShp_mc);
_root.registerStageMC(obj.rightShape.rightShp_mc);
if (val.joker) {
setJoker(obj);
}
} else {
obj.leftColor.leftCol_mc.removeMovieClip();
obj.leftShape.leftShp_mc.removeMovieClip();
obj.rightColor.rightCol_mc.removeMovieClip();
obj.rightShape.rightShp_mc.removeMovieClip();
obj.jokerEffect.removeMovieClip();
obj.extraDealEffect.removeMovieClip();
obj.cardval = undefined;
obj._visible = false;
}
}
function setJoker(card) {
card.cardval.joker = true;
card.attachMovie("joker_tile_mc", "jokerEffect", getNextDepth());
_root.registerStageMC(card.jokerEffect);
}
function setExtraDealCard(card) {
card.cardval.extradeal = true;
card.tween = new mx.transitions.Tween(card, "_alpha", mx.transitions.easing.Regular.easeInOut, 95, 60, 1, 1);
card.tween.onMotionFinished = card.tween.yoyo;
}
function unsetExtraDealCard(card) {
card.cardval.extradeal = false;
card.tween.stop();
}
function playSound(name, loops, vol) {
if (!_root.bgSoundsEnabled) {
return(undefined);
}
if (loops == undefined) {
loops = 0;
}
var _local2 = new Sound();
_local2.attachSound(name);
_local2.start(0, loops);
}
function playSequencedSound(name, func) {
if (!_root.bgSoundsEnabled) {
func();
return(undefined);
}
var _local3 = new Sound();
_local3.onSoundComplete = function () {
this.func();
};
_local3.func = func;
_local3.attachSound(name);
_local3.start();
}
function clearStage() {
_root.game_bg_mc2.swapDepths(1);
_root.tutorial_text_bg_mc.swapDepths(2);
for (obj in _root.stageObjs) {
_root.stageObjs[obj].removeMovieClip();
delete _root.stageObjs[obj];
_root.stageObjs[obj] = undefined;
}
delete _root.stageObjs;
_root.stageObjs = undefined;
if ((nonReggedMCs == undefined) || (nonReggedMCs == NaN)) {
nonReggedMCs = 0;
}
nextAvailableDepth = 11000 - nonReggedMCs;
}
function getStageMC(regged) {
if (_root.stageObjs == undefined) {
_root.stageObjs = new Array();
}
if ((nonReggedMCs == undefined) || (nonReggedMCs == NaN)) {
nonReggedMCs = 0;
}
if (regged != true) {
nonReggedMCs++;
}
var _local2 = 0;
if (regged) {
_local2 = "Regged" + _root.stageObjs.length;
} else {
_local2 = nonReggedMCs;
}
var _local3 = "dynamicObject" + _local2;
_root.createEmptyMovieClip(_local3, _root.getNextDepth());
return(_root[_local3]);
}
function getReggedStageMC() {
var _local1 = getStageMC(true);
registerStageMC(_local1);
return(_local1);
}
function registerStageMC(mc) {
if (_root.stageObjs == undefined) {
_root.stageObjs = new Array();
}
_root.stageObjs.push(mc);
}
function generateIdxSet(nums, maxNum) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
while (_local3 < nums) {
_local6.push(int(((maxNum - _local3) * Math.random()) + 1));
_local3++;
}
_local3 = 0;
while (_local3 < nums) {
var _local2 = _local6[_local3];
var _local4 = _local5;
_local4.sort();
var _local1 = 0;
while (_local1 < _local3) {
if (_local4[_local1] <= _local2) {
_local2++;
}
_local1++;
}
_local5.push(_local2);
_local3++;
}
return(_local5);
}
function generateConstraints(level, slotsNum) {
var _local4 = new Array();
var _local9 = _root.getConstraintNums(level);
var _local5 = _root.generateIdxSet(_local9.totalConstraints, slotsNum);
var _local7 = _local9.genColor;
var _local6 = _local9.genShape + _local7;
var _local8 = _local9.spcColor + _local6;
var _local2;
var _local3 = 0;
while (_local3 < _local7) {
_local2 = new Object();
_local2.idx = _local5[_local3];
_local2.cnstr = "color";
_local4.push(_local2);
_local3++;
}
_local3 = _local7;
while (_local3 < _local6) {
_local2 = new Object();
_local2.idx = _local5[_local3];
_local2.cnstr = "shape";
_local4.push(_local2);
_local3++;
}
_local3 = _local6;
while (_local3 < _local8) {
_local2 = new Object();
_local2.idx = _local5[_local3];
_local2.cnstr = randomColor();
_local4.push(_local2);
_local3++;
}
_local3 = _local8;
while (_local3 < _local9.totalConstraints) {
_local2 = new Object();
_local2.idx = _local5[_local3];
_local2.cnstr = randomShape();
_local4.push(_local2);
_local3++;
}
return(_local4);
}
function getConstraintNums(level) {
var _local1 = new Object();
if (level > 30) {
level = 30;
}
_local1.genColor = genColorPerLevel[level - 1];
_local1.genShape = genShapePerLevel[level - 1];
_local1.spcColor = spcColorPerLevel[level - 1];
_local1.spcShape = spcShapePerLevel[level - 1];
_local1.totalConstraints = ((_local1.genColor + _local1.genShape) + _local1.spcColor) + _local1.spcShape;
return(_local1);
}
function loadMouse() {
Mouse.hide();
if (_root.mouse_mc) {
_root.mouse_mc.unloadMovie();
_root.mouse_mc = undefined;
}
if (_root.mouse_mc == undefined) {
_root.mouse_mc = _root.getStageMC();
_root.mouse_mc.swapDepths(25000);
_root.mouse_mc.attachMovie("mouse_mc", "dummy", _root.getNextDepth());
_root.mouse_mc.onEnterFrame = _root.updateMouseLocation;
}
}
function updateMouseLocation() {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
function unloadSelf() {
this.unloadMovie();
}
function getSavedObject(tool, name) {
var _local1 = SharedObject.getLocal((tool + "_") + name);
if (_local1 == undefined) {
trace(((("FATAL: getSavedObject(" + tool) + ", ") + name) + ") has failed. Possibly a permissions/space issue.");
return(undefined);
}
if (_local1.data.val == undefined) {
_local1.data.val = new Object();
}
return(_local1.data.val);
}
function flushSavedObject() {
var _local1 = SharedObject.getLocal((tool + "_") + name);
_local1.flush();
}
function setFadein(obj, step) {
obj._alpha = 0;
obj.fadein_step = step;
obj.onEnterFrame = _root.fadeInEffect;
}
function setFadeout(obj, step) {
obj._alpha = 100;
obj.fadeout_step = step;
obj.onEnterFrame = _root.fadeOutEffect;
}
function fadeInEffect() {
this._alpha = this._alpha + this.fadein_step;
if (this._alpha > 100) {
this._alpha = 100;
this.onEnterFrame = undefined;
}
}
function fadeOutEffect() {
this._alpha = this._alpha - this.fadeout_step;
if (this._alpha < 0) {
this._alpha = 0;
this.onEnterFrame = undefined;
}
}
function initHighScores() {
if ((_root.getRecordScore("RPN", "basic_scores", 0).player == undefined) || (_root.getRecordScore("RPN", "basic_levels", 0).player == undefined)) {
_root.resetRecordsTable("RPN", "basic_levels", 11);
_root.resetRecordsTable("RPN", "basic_scores", 11);
var _local2 = 10;
while (_local2 >= 0) {
_root.addRecordScore("RPN", "basic_scores", "Sorcerer", 100 + (_local2 * 100), 1);
_root.addRecordScore("RPN", "basic_levels", "Sorcerer", 1 + _local2, 100 + (_local2 * 100));
_local2--;
}
}
}
function setSynergy() {
var _local2;
_local2 = _root.currentLevel - 3;
if (_local2 < 1) {
_root.synergy1 = undefined;
_root.synergy2 = undefined;
return(undefined);
}
while (_local2 > 28) {
_local2 = _local2 - 28;
}
if (_local2 == 1) {
_root.generateSynergySet();
}
var _local5 = _root.synergiesSet[_local2 - 1].s1;
var _local4 = _root.synergiesSet[_local2 - 1].s2;
_root.playSound("Synergy Startup");
var _local6 = ((_local5 + "_") + _local4) + "_synergy_mc";
_root.synergy1 = _local5;
_root.synergy2 = _local4;
var _local3 = _root.getReggedStageMC();
_local3.swapDepths(20500);
_local3.attachMovie(_local6, "movie", 100);
_local3._x = 324.9;
_local3._y = 246.6;
_local3.movie.onRollOver = _root.synergyOnRollOver;
_local3.movie.onRollOut = _root.synergyOnRollOut;
}
function synergyOnRollOver() {
if (_root.inGameMenuDisabled == false) {
return(undefined);
}
if (_root.rpnGameOver()) {
return(undefined);
}
if (this.synergy_mo_mc != undefined) {
return(undefined);
}
if (this._currentframe != this._totalframes) {
return(undefined);
}
this.lala = _root.getReggedStageMC();
this.lala.swapDepths(20500);
this.lala.attachMovie("synergy_mo_mc", "movie", 25000);
this.lala._x = 463;
this.lala._y = 167;
}
function synergyOnRollOut() {
removeMovieClip(this.lala);
}
function generateSynergySet() {
_root.synergiesSet = new Array();
var _local2 = new Array();
var _local6 = 0;
while (_local6 < 4) {
var _local5 = _local6 + 1;
while (_local5 < 4) {
var _local4 = new Object();
_local4.s1 = colorsArray[_local6];
_local4.s2 = colorsArray[_local5];
_local2.push(_local4);
_local5++;
}
_local5 = 0;
while (_local5 < 4) {
var _local4 = new Object();
_local4.s1 = shapesArray[_local6];
_local4.s2 = colorsArray[_local5];
_local2.push(_local4);
_local5++;
}
_local6++;
}
_local6 = 0;
while (_local6 < 4) {
var _local5 = _local6 + 1;
while (_local5 < 4) {
var _local4 = new Object();
_local4.s1 = shapesArray[_local6];
_local4.s2 = shapesArray[_local5];
_local2.push(_local4);
_local5++;
}
_local6++;
}
while (_local2.length > 0) {
var _local7 = int(Math.random() * _local2.length);
_root.synergiesSet.push(_local2[_local7]);
var _local8 = new Array();
var _local3 = 0;
while (_local3 < _local7) {
_local8.push(_local2[_local3]);
_local3++;
}
_local3 = _local7 + 1;
while (_local3 < _local2.length) {
_local8.push(_local2[_local3]);
_local3++;
}
_local2 = _local8;
}
}
function addExtrasByLevel(level) {
if (_root.specialDebugMode == level) {
_root.addExtraDeals(4, 4);
_root.addExtraBonuses("red_bomb", 2);
_root.addExtraBonuses("switch", 2);
_root.addExtraBonuses("joker", 2);
_root.addExtraBonuses("blue_bomb", 2);
}
if (level == 1) {
_root.addExtraDeals(4, 3);
}
if ((level == 10) || (level == 15)) {
_root.addExtraBonuses(randomTransformColor(), 1);
_root.addExtraBonuses(randomTransformShape(), 1);
}
if (level == 20) {
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
}
if (level == 25) {
_root.addExtraBonuses(randomTransformColor(), 1);
_root.addExtraBonuses(randomTransformColor(), 1);
_root.addExtraBonuses(randomTransformShape(), 1);
_root.addExtraBonuses(randomTransformShape(), 1);
}
if (level == 30) {
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
}
if (level > 30) {
_root.addExtraBonuses(randomTransform(), 1);
}
}
function randomTransform() {
if (int(Math.random() * 2) == 0) {
return(randomTransformColor());
}
return(randomTransformShape());
}
function randomTransformColor() {
return(_root.randomColor() + "_transform");
}
function randomTransformShape() {
var _local2 = _root.randomShape();
return(_local2 + "_transform");
}
function addExtraDeals(cards, num) {
if ((num == undefined) || (num < 1)) {
return(undefined);
}
_root.mainExtras.add(("d" + cards) + "_extradeal", num, _root.extraDealClick, "extra_deal_mo_mc", cards);
}
function addExtraBonuses(type, num) {
if ((num == undefined) || (num < 1)) {
return(undefined);
}
_root.mainExtras.add(type + "_mc", num, eval (("_root.extra" + type) + "Click"), type + "_mo_mc", undefined);
}
function extraDealClick() {
if (_root.mainExtras.mActive == false) {
return(undefined);
}
_root.tutorialNotifyExtraDealClicked();
var _local3 = _root.mainExtras.getExtraInfo(this.idx);
this.onRollOut();
_root.mainExtras.remove(this.idx);
_root.mainDeck.setExtraDeal(_local3);
_root.playSound("Extra Deal");
_root.lastDealWarningIssued = false;
}
function extrared_bombClick() {
if (_root.mainTable.isEmpty()) {
playSound("Illegal Click");
return(undefined);
}
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
this.mouse_over_elem.removeMovieClip();
extrasAddTip("red_bomb");
_root.playSound("tool_message.wav");
_root.mainExtras.remove(this.idx);
_root.onMouseDown = _root.redBombOnTileClick;
_root.lastDealWarningIssued = false;
}
function redBombOnTileClick() {
var _local3 = _root.mainTable.getSlotIdxFromCursor();
if ((_local3 == undefined) || (_root.mainTable.getCard(_local3) == undefined)) {
playSound("Illegal Click");
return(undefined);
}
_root.playSound("red_bomb.wav");
_root.mainTable.setCard(_local3, eval("NULL"));
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("red_bomb_effect", dummy, _root.getNextDepth());
_local2.swapDepths(16500);
var _local4 = _root.mainTable.getTileEffectCoords(_local3);
_local2._x = _local4._x;
_local2._y = _local4._y;
_root.tutorialNotifyExtraDealClicked();
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function extrablue_bombClick() {
if (!_root.mainTable.hasConstraints()) {
playSound("Illegal Click");
return(undefined);
}
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
this.mouse_over_elem.removeMovieClip();
extrasAddTip("blue_bomb");
_root.playSound("tool_message.wav");
_root.mainExtras.remove(this.idx);
_root.onMouseDown = _root.blueBombOnTileClick;
_root.lastDealWarningIssued = false;
}
function blueBombOnTileClick() {
var _local3 = _root.mainTable.getConstraintIdxFromCursor();
if (_local3 == undefined) {
playSound("Illegal Click");
return(undefined);
}
_root.playSound("blue_bomb.wav");
_root.mainTable.setConstraint(_local3, eval("NULL"));
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("blue_bomb_effect", dummy, _root.getNextDepth());
_local2.swapDepths(16500);
var _local4 = _root.mainTable.getSliceEffectCoords(_local3);
_local2._x = _local4._x;
_local2._y = _local4._y;
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function extraswitchClick() {
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
this.mouse_over_elem.removeMovieClip();
extrasAddTip("switch");
_root.playSound("tool_message.wav");
_root.mainExtras.remove(this.idx);
_root.onMouseDown = _root.switchOnTileClick;
_root.lastDealWarningIssued = false;
}
function switchOnTileClick() {
var _local2 = _root.mainTable.getSlotIdxFromCursor();
if ((_local2 != undefined) && (_root.mainTable.getCard(_local2) != undefined)) {
if (!switchTableTile(_local2)) {
playSound("Illegal Click");
return(undefined);
}
} else {
_local2 = _root.mainDeck.getSlotIdxFromCursor();
if (_local2 != undefined) {
switchDeckTile(_local2);
} else {
playSound("Illegal Click");
return(undefined);
}
}
_root.playSound("switch.wav");
_root.tutorialNotifyExtraDealClicked();
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function switchDeckTile(idx) {
var _local2 = _root.mainDeck.getCard(idx).cardval;
var _local3 = new cardObj(_local2.rightColor, _local2.rightShape, _local2.leftColor, _local2.leftShape);
_root.setFadein(_root.mainDeck.setCard(idx, _local3), 4);
}
function switchTableTile(idx) {
var _local2 = _root.mainTable.getCard(idx);
var _local4 = new cardObj(_local2.rightColor, _local2.rightShape, _local2.leftColor, _local2.leftShape);
_root.mainTable.setCard(idx, undefined);
if (_root.mainTable.illegalPlacement(idx, _local4, -1)) {
_root.mainTable.setCard(idx, _local2);
return(false);
}
_root.setFadein(_root.mainTable.setCard(idx, _local4), 4);
return(true);
}
function extrajokerClick() {
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
this.mouse_over_elem.removeMovieClip();
_root.playSound("tool_message.wav");
_root.mainExtras.remove(this.idx);
extrasAddTip("joker");
_root.onMouseDown = _root.jokerOnTileClick;
_root.lastDealWarningIssued = false;
}
function jokerOnTileClick() {
var _local2 = _root.mainTable.getSlotIdxFromCursor();
var _local3 = _root.mainDeck.getSlotIdxFromCursor();
if (((_local2 == undefined) || (_root.mainTable.getCard(_local2) == undefined)) && (_local3 == undefined)) {
playSound("Illegal Click");
return(undefined);
}
if (_local2 != undefined) {
_root.mainTable.setJoker(_local2);
} else {
_root.mainDeck.setJoker(_local3);
}
_root.playSound("joker.wav");
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function extraDealMO() {
if (_root.mainExtras.mActive == false) {
return(undefined);
}
if (this.mouse_over_elem == undefined) {
this.mouse_over_elem = _root.getReggedStageMC();
this.mouse_over_elem.swapDepths(17020);
this.mouse_over_elem.attachMovie(this.tip, "msg", 17020);
this.mouse_over_elem._x = this._x - 53;
this.mouse_over_elem._y = this._y - 128;
this.mouse_over_elem._alpha = 0;
_root.setFadein(this.mouse_over_elem, 10);
}
}
function extraDealMOut() {
this.mouse_over_elem.removeMovieClip();
this.mouse_over_elem = undefined;
}
function transformClick(extradeal, color, shape) {
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
extradeal.mouse_over_elem.removeMovieClip();
_root.playSound("tool_message.wav");
_root.mainExtras.remove(extradeal.idx);
_root.transformToColor = color;
_root.transformToShape = shape;
if (color != undefined) {
extrasAddTip(color + "_transform");
}
if (shape != undefined) {
extrasAddTip(shape + "_transform");
}
_root.onMouseDown = _root.transformOnTileClick;
_root.lastDealWarningIssued = false;
}
function transformOnTileClick() {
var _local2 = _root.mainTable.getSlotIdxAndSideFromCursor();
var _local3 = _root.mainDeck.getSlotIdxAndSideFromCursor();
if (((_local2 == undefined) || (_root.mainTable.getCard(_local2.idx) == undefined)) && (_local3 == undefined)) {
playSound("Illegal Click");
return(false);
}
if (_local2 != undefined) {
if (!transformTableTile(_local2.idx, _local2.leftSide)) {
return(undefined);
}
} else {
transformDeckTile(_local3.idx, _local3.leftSide);
}
_root.playSound("transform.wav");
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function transformTableTile(idx, left) {
var _local3 = _root.mainTable.getCard(idx);
var _local2 = new cardObj(_local3.leftColor, _local3.leftShape, _local3.rightColor, _local3.rightShape);
if (left) {
if (_root.transformToColor != undefined) {
_local2.leftColor = _root.transformToColor;
}
if (_root.transformToShape != undefined) {
_local2.leftShape = _root.transformToShape;
}
} else {
if (_root.transformToColor != undefined) {
_local2.rightColor = _root.transformToColor;
}
if (_root.transformToShape != undefined) {
_local2.rightShape = _root.transformToShape;
}
}
_root.mainTable.setCard(idx, undefined);
if (_root.mainTable.illegalPlacement(idx, _local2, -1)) {
_root.mainTable.setCard(idx, _local3);
playSound("Illegal Click");
return(false);
}
var _local4 = _root.mainTable.setCard(idx, _local2);
if (left) {
if (_root.transformToColor != undefined) {
_root.setFadein(_local4.leftColor, 4);
}
if (_root.transformToShape != undefined) {
_root.setFadein(_local4.leftShape, 4);
}
} else {
if (_root.transformToColor != undefined) {
_root.setFadein(_local4.rightColor, 4);
}
if (_root.transformToShape != undefined) {
_root.setFadein(_local4.rightShape, 4);
}
}
return(true);
}
function transformDeckTile(idx, left) {
var _local4 = _root.mainDeck.getCard(idx).cardval;
var _local2 = new cardObj(_local4.leftColor, _local4.leftShape, _local4.rightColor, _local4.rightShape);
if (left) {
if (_root.transformToColor != undefined) {
_local2.leftColor = _root.transformToColor;
}
if (_root.transformToShape != undefined) {
_local2.leftShape = _root.transformToShape;
}
} else {
if (_root.transformToColor != undefined) {
_local2.rightColor = _root.transformToColor;
}
if (_root.transformToShape != undefined) {
_local2.rightShape = _root.transformToShape;
}
}
var _local3 = _root.mainDeck.setCard(idx, _local2);
if (left) {
if (_root.transformToColor != undefined) {
_root.setFadein(_local3.leftColor, 4);
}
if (_root.transformToShape != undefined) {
_root.setFadein(_local3.leftShape, 4);
}
} else {
if (_root.transformToColor != undefined) {
_root.setFadein(_local3.rightColor, 4);
}
if (_root.transformToShape != undefined) {
_root.setFadein(_local3.rightShape, 4);
}
}
return(true);
}
function extrablue_transformClick() {
transformClick(this, "blue", undefined);
}
function extragreen_transformClick() {
transformClick(this, "green", undefined);
}
function extrared_transformClick() {
transformClick(this, "red", undefined);
}
function extrayellow_transformClick() {
transformClick(this, "yellow", undefined);
}
function extraluna_transformClick() {
transformClick(this, undefined, "luna");
}
function extraterra_transformClick() {
transformClick(this, undefined, "terra");
}
function extrasol_transformClick() {
transformClick(this, undefined, "sol");
}
function extrastella_transformClick() {
transformClick(this, undefined, "stella");
}
function extrasAddTip(name) {
_root.extra_tip_mc = _root.getReggedStageMC();
with (_root.extra_tip_mc) {
attachMovie(name + "_tip_mc", "dummy", 10000);
_x = 320;
_y = 60;
}
}
function extrasRemoveTip() {
removeMovieClip(_root.extra_tip_mc);
}
function getRandomTip() {
return(tips[int(Math.random() * tips.length)]);
}
function getInstruction(idx) {
if (instructions.length <= idx) {
return(undefined);
}
return(instructions[idx]);
}
function rpnInit() {
var _local3 = new TextFormat();
_local3.font = "AndalusNumbers";
_local3.bold = true;
_local3.size = 18;
var _local2 = _root.points_txt;
_local3.color = 7623171 /* 0x745203 */;
_local2.setNewTextFormat(_local3);
_local2.setTextFormat(_local3);
_local2.sharpness = 0;
_local2.antiAliasType = "advanced";
_local2.selectable = false;
_local2.embedFonts = true;
_local2 = _root.level_txt;
_local3.color = 4203023 /* 0x40220F */;
_local2.setNewTextFormat(_local3);
_local2.setTextFormat(_local3);
_local2.sharpness = 0;
_local2.antiAliasType = "advanced";
_local2.selectable = false;
_local2.embedFonts = true;
_local2 = _root.total_points_txt;
_local3.color = 7672066 /* 0x751102 */;
_local2.setNewTextFormat(_local3);
_local2.setTextFormat(_local3);
_local2.sharpness = 0;
_local2.antiAliasType = "advanced";
_local2.selectable = false;
_local2.embedFonts = true;
_local2 = _root.instructions_txt;
_local3.font = "Calligraphic";
_local3.size = 14;
_local3.color = 7672066 /* 0x751102 */;
_local3.align = "left";
_local2.setNewTextFormat(_local3);
_local2.setTextFormat(_local3);
_local2.sharpness = 0;
_local2.antiAliasType = "advanced";
_local2.selectable = false;
_local2.embedFonts = true;
var _local4 = new Array(185, 185, 195, 205, 220);
var _local5 = new Array(368, 388, 408, 428, 448);
_root.mainExtras = new rpnExtraDeals(47, 350, _local4, _local5);
}
function rpnGameOver() {
return((_root.mainTable.isFull() || (_root.mainDeck.isEmpty())) || ((_root.mainTimer != undefined) && (_root.mainTimer.isTimeElapsed())));
}
function rpnGameWon() {
return(_root.rpnGameOver() && (_root.mainTable.getScore() == 48));
}
function rpnGameLost() {
return(_root.rpnGameOver() && (!_root.rpnGameWon()));
}
function rpnNewGame(level, baseScore, from_quest) {
if ((level == 1) && (from_quest != false)) {
from_quest = true;
}
if (level > 0) {
_root.kongregateStats.submit("Level", level);
}
if (from_quest) {
_root.levelDone = false;
}
_root.onMouseDown = undefined;
_root.onMouseUp = undefined;
_root.level_txt.text = level;
_root.currentLevel = level;
_root.baseScore = baseScore;
_root.bonusesGiven = false;
_root.roundBonusPoints = 0;
if (from_quest) {
_root.clearStage();
}
if (!_root.isTutorialRunning()) {
_root.tutorial_txt.text = "";
} else {
_root.tutorial_text_bg_mc = _root.getReggedStageMC();
_root.tutorial_text_bg_mc.swapDepths(_root.tutorial_txt);
tutorial_text_bg_mc.attachMovie("tutorial_text_bg_mc", "bg_mc", 10000);
tutorial_text_bg_mc._x = 38;
tutorial_text_bg_mc._y = 376;
}
_root.mainExtras.activate();
_root.mainExtras.refresh();
_root.lastDealWarningIssued = false;
_root.highScoresUpdated = false;
if (level == 1) {
_root.kongregateServices.connect();
}
if (((from_quest != true) && (!_root.isTutorialRunning())) && (_root.currentLevel <= 30)) {
rpnLoadQuestScreen();
return(undefined);
}
_root.levelUpdated = false;
inGame = true;
_root.game_bg_mc2 = _root.getReggedStageMC();
_root.game_bg_mc2.swapDepths(-16383);
_root.game_bg_mc2._alpha = 100;
var _local5 = int((level - 1) / 10) + 1;
if (_local5 > 3) {
_local5 = 3;
}
if (_root.isTutorialRunning()) {
_local5 = 0;
}
_root.game_bg_mc2.attachMovie(("game_bg" + _local5) + "_mc", "bg", -5000);
_root.game_bg_mc2._x = 0;
_root.game_bg_mc2._y = 0;
if (_root.currentLevel <= 30) {
_root.dragon_mc = _root.getReggedStageMC();
_root.dragon_mc.attachMovie("dragon_fire_bad_mc", "movie", _root.getNextDepth());
_root.dragon_mc._x = -2;
_root.dragon_mc._y = 0;
_root.dragon_mc.movie.gotoAndStop(1);
} else {
_root.dragon_mc.removeMovieClip("movie");
}
_root.victory_mc = _root.getReggedStageMC();
_root.victory_mc.attachMovie("Star Burst", "movie", _root.getNextDepth());
_root.victory_mc._x = 0;
_root.victory_mc._y = 0;
_root.victory_mc.movie.gotoAndStop("start");
_root.wizard_wand_mc = _root.getReggedStageMC();
_root.wizard_wand_mc.swapDepths(1000);
_root.wizard_wand_mc.attachMovie("Wand", "movie", 1000);
_root.wizard_wand_mc._x = 0;
_root.wizard_wand_mc._y = 0;
_root.wizard_wand_mc.movie.onlyOnce = true;
_root.wizard_wand_mc.movie.gotoAndStop("prestart");
_root.text_highlight_mc = _root.getReggedStageMC();
_root.text_highlight_mc.attachMovie("Text Highlight", "movie", _root.getNextDepth());
_root.text_highlight_mc._x = -8;
_root.text_highlight_mc._y = -6;
_root.text_highlight_mc.movie.gotoAndStart("start");
if (_root.gameMode == "survival") {
rpnInitTimer();
} else {
_root.mainTimer = undefined;
}
_root.resetTableAndDeck();
rpnStopSynergies(false);
_root.won_this_round_txt._visible = false;
_root.setSynergy();
var _local4 = _root.generateConstraints(_root.level_txt.text, _root.mainTable.mSlotsNum);
var _local2 = 0;
while (_local2 < _local4.length) {
_root.mainTable.setConstraint(_local4[_local2].idx, _local4[_local2].cnstr);
_local2++;
}
_root.rpnPlayBGMusic(undefined);
_root.playSequencedSound("StartGame", _root.moveToGameMusic);
_root.addExtrasByLevel(level);
_root.instructions_txt.text = "";
_root.hasBonuses = false;
_root.currInstructionIdx = 0;
if (!_root.isTutorialRunning()) {
_root.setInstructionsColor(1399040, 14);
_root.rpnSetTextMessage(("Level " + level) + " begins!\n");
if (level == 1) {
_root.setInstructionsColor(7672066, 14);
_root.currInstructionIdx = 1;
_root.textIsInstruction = true;
_root.rpnAddTextMessage("1. " + _root.getInstruction(0));
}
if (level == 2) {
_root.setInstructionsColor(7672066, 14, true, -0.5);
_root.rpnAddTextMessage("The triangle in the inner circle is a \"limiter\". The two tiles you put next to it have to match the way the limiter shows. This limiter is a \"color\" limiter - the two tiles must have matching colors.\n");
}
if (level == 4) {
_root.setInstructionsColor(7672066, 14);
_root.rpnAddTextMessage("Every synergic match you create this round will get you special bonuses. You can see the synergic couple on the right, above the level box.");
}
if (level == 10) {
_root.setInstructionsColor(7672066, 14);
_root.rpnAddTextMessage("From now on, you will get special power-ups every 5 levels - \"transform tools\". These tools can change one color or one symbol to another.");
}
}
_root.loadMouse();
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
DeactivateDeal();
_root.menu_mc.onRelease = undefined;
_root.menu_mc.enabled = false;
_root.deal_mc.enabled = false;
_root.tip_btn.enabled = false;
if (!(((((((level == 1) || (level == 10)) || (level == 15)) || (level == 20)) || (level == 25)) || (level == 30)) || (level > 30))) {
_root.rpnNotifyExtrasAdded();
}
if (level != 0) {
_root.lastGameWasTutorial = false;
}
}
function resetTableAndDeck() {
var tableSlots = Array();
tableSlots.push("dummy");
var i = 1;
while (i <= 8) {
tableSlots.push(eval (("_root.circleSlot" + i) + "_mc"));
i++;
}
_root.mainDeck.unsetExtras();
delete _root.mainTable;
_root.mainTable = new rpnTable(8, tableSlots);
delete _root.mainDeck;
_root.mainDeck = new rpnDeck(4);
}
function rpnReset() {
_root.mainExtras.reset();
_root.mainTable.reset();
_root.mainDeck.reset();
inGame = false;
}
function rpnPlayBGMusic(name) {
if (_root.bgmusic_on != name) {
_root.bgmusic_sound.stop();
delete _root.bgmusic_sound;
_root.bgmusic_sound = new Sound();
_root.bgmusic_sound.attachSound(name);
if (_root.bgMusicEnabled) {
_root.bgmusic_sound.start(0, 100000);
}
_root.bgmusic_on = name;
}
}
function rpnEnableBGMusic() {
_root.bgMusicEnabled = true;
_root.bgmusic_sound.start(0, 100000);
}
function rpnDisableBGMusic() {
_root.bgMusicEnabled = false;
_root.bgmusic_sound.stop();
}
function rpnEnableSounds() {
_root.bgSoundsEnabled = true;
}
function rpnDisableSounds() {
_root.bgSoundsEnabled = false;
}
function rpnHandleGameWon() {
inGame = false;
_root.endTutorial();
_root.mainDeck.unsetExtras();
_root.mainTimer.suspendTimer();
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
_root.DeactivateDeal();
_root.menu_mc.onRelease = undefined;
_root.menu_mc.enabled = false;
_root.tip_btn.enabled = false;
if (_root.currentLevel <= 30) {
_root.dragon_mc.removeMovieClip("movie");
_root.dragon_mc = _root.getReggedStageMC();
_root.dragon_mc.swapDepths(20499);
_root.dragon_mc.attachMovie("dragon_fire_good_mc", "movie", _root.getNextDepth());
_root.dragon_mc._x = -2;
_root.dragon_mc._y = 0;
_root.dragon_mc.movie.gotoAndPlay(1);
} else {
_root.raiseGameWonSign();
}
}
function rpnHandleBonuses() {
var _local5 = false;
var _local2 = getHarmonicPoints();
if (_local2 != undefined) {
_root.addExtraDeals(2, _local2.D2);
_root.addExtraDeals(3, _local2.D3);
_root.addExtraDeals(4, _local2.D4);
_root.addExtraBonuses("red_bomb", _local2.RB);
_root.addExtraBonuses("switch", _local2.SW);
_root.addExtraBonuses("joker", _local2.JO);
_root.addExtraBonuses("blue_bomb", _local2.BB);
if (((((((_local2.D2 > 0) || (_local2.D3 > 0)) || (_local2.D4 > 0)) || (_local2.RB > 0)) || (_local2.SW > 0)) || (_local2.JO > 0)) || (_local2.BB > 0)) {
_local5 = true;
}
_root.roundBonusPoints = _root.roundBonusPoints + Number(_local2.points);
}
var _local3 = getPoolPoints();
_root.addExtraDeals(2, _local3.D2);
_root.addExtraDeals(3, _local3.D3);
_root.addExtraDeals(4, _local3.D4);
_root.addExtraBonuses("red_bomb", _local3.RB);
_root.addExtraBonuses("switch", _local3.SW);
_root.addExtraBonuses("joker", _local3.JO);
_root.addExtraBonuses("blue_bomb", _local3.BB);
if (((((((_local3.D2 > 0) || (_local3.D3 > 0)) || (_local3.D4 > 0)) || (_local3.RB > 0)) || (_local3.SW > 0)) || (_local3.JO > 0)) || (_local3.BB > 0)) {
_local5 = true;
}
_root.roundBonusPoints = _root.roundBonusPoints + Number(_local3.points);
var _local7 = _root.hasBonuses;
var _local4 = getSynergyPoints();
_root.addExtraDeals(2, _local4.D2);
_root.addExtraDeals(3, _local4.D3);
_root.addExtraDeals(4, _local4.D4);
if (((_local4.D2 > 0) || (_local4.D3 > 0)) || (_local4.D4 > 0)) {
_local5 = true;
}
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
if (_root.mainTimer != undefined) {
var _local6 = int(_root.mainTimer.remainingSeconds()) * 2;
if (_local6 > 0) {
_root.addSpecialSetsMsg("Survival time bonus, ", _local6, 0, 0, 0, 0, 0, 0, 0);
}
_root.roundBonusPoints = _root.roundBonusPoints + _local6;
}
if (!_local7) {
_root.setInstructionsColor(1510, 14);
_root.rpnAddTextMessage("Don't forget: creating special sets will get you special bonuses!\n");
}
_root.setInstructionsColor(617, 16, false);
_root.rpnAddTextMessage("Click anywhere to continue\n");
if (!_local5) {
_root.rpnNotifyExtrasAdded();
}
clearInterval(_root.bonusIntervalId);
_root.bonusesGiven = true;
}
function dragonDefeatedAfterEffect() {
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("end_game_mc", "dummy", 15000);
_local2.swapDepths(15000);
_local2._x = -23.6;
_local2._y = -52.1;
}
function rpnInitTimer() {
_root.timer_green_bg_mc = _root.getReggedStageMC();
_root.timer_green_bg_mc.swapDepths(18702);
with (_root.timer_green_bg_mc) {
attachMovie("timer_green_bg_mc", "movie", 18702);
_x = 503;
_y = 63;
}
_root.timer_mask_mc = _root.getReggedStageMC();
_root.timer_mask_mc.swapDepths(18701);
with (_root.timer_mask_mc) {
attachMovie("timer_mask_mc", "movie", 18701);
_x = 503;
_y = 63;
}
_root.timer_green_bg_mc.setMask(_root.timer_mask_mc);
_root.mainTimer = new cpiTimer(_root.timer_mask_mc);
var timerLength = (Math.min(120 + (4 * _root.currentLevel), 240) * 1000);
_root.mainTimer.startTimer(timerLength);
_root.mainTimer.suspendTimer();
_root.timer_mc = _root.getReggedStageMC();
_root.timer_mc.swapDepths(18700);
with (_root.timer_mc) {
attachMovie("timer_bg_mc", "movie", 18700);
_x = 503;
_y = 63;
}
}
function rpnHandleGameLost() {
inGame = false;
_root.endTutorial();
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
DeactivateDeal();
_root.menu_mc.onRelease = undefined;
_root.menu_mc.enabled = false;
_root.mainDeck.unsetExtras();
_root.mainTimer.suspendTimer();
_root.rpnPlayBGMusic(undefined);
_root.dragon_mc.swapDepths(22000);
if (_root.currentLevel <= 30) {
_root.dragon_mc.movie.gotoAndPlay(2);
} else {
_root.raiseGameOverSign();
}
}
function raiseGameOverSign() {
_root.playSequencedSound("Game Over", _root.moveToBGMusic);
if (_root.currentLevel <= 30) {
_root.setInstructionsColor(7672066, 14);
_root.rpnSetTextMessage("The ring was not strong enough to stop the dragon and you have been incinerated...\n");
_root.playSound("New Message");
}
_root.setInstructionsColor(1510, 30);
_root.rpnAddTextMessage("Game Over\n");
_root.setInstructionsColor(1510, 14);
_root.rpnAddTextMessage("Click anywhere to continue\n");
_root.onMouseUp = rpnLostClick;
}
function raiseGameWonSign() {
_root.victory_mc.movie.play();
_root.playSound("Ring Complete");
_root.instructions_txt.text = "";
_root.instructions_txt.filters = filter;
_root.setInstructionsColor(622336, 18, true);
_root.rpnSetTextMessage(newline);
_root.setWonColor();
_root.won_this_round_txt._visible = true;
_root.playSound("New Message");
if (!_root.lastGameWasTutorial) {
_root.bonusIntervalId = setInterval(rpnHandleBonuses, 1000);
} else {
trace("No bonuses for tutorial");
_root.rpnNotifyExtrasAdded();
_root.bonusesGiven = true;
}
}
function moveToBGMusic() {
_root.rpnPlayBGMusic("background_music");
}
function moveToGameMusic() {
_root.rpnPlayBGMusic("game_music");
}
function rpnDealClicked() {
_root.playSound("button1.wav");
_root.tutorialNotifyDealClicked();
if (!_root.rpnGameOver()) {
_root.handleDealClickGameNotOver();
return(undefined);
}
if (_root.lastGameWasTutorial) {
_root.mainExtras.reset();
_root.rpnNewGame(1, 0, false);
return(undefined);
}
if (_root.rpnGameWon()) {
_root.baseScore = _root.baseScore + Number(_root.points_txt.text);
_root.currentLevel++;
_root.rpnNewGame(_root.currentLevel, _root.baseScore);
return(undefined);
}
if (!_root.highScoresUpdated) {
if (_root.handleHighScoresUpdate()) {
return(undefined);
}
}
_root.mainExtras.reset();
_root.jumpToEntry();
}
function setInstructionsColor(color, size, isBold, letterSpacing) {
if (isBold == undefined) {
isBold = true;
}
if (letterSpacing == undefined) {
letterSpacing = 0;
}
var _local2 = new TextFormat();
_local2.font = "Calligraphic";
_local2.bold = isBold;
_local2.size = size;
_local2.letterSpacing = letterSpacing;
var _local3 = _root.instructions_txt;
_local2.color = color;
_local3.setNewTextFormat(_local2);
_local3.sharpness = 0;
_local3.antiAliasType = "advanced";
_local3.selectable = false;
_local3.embedFonts = true;
}
function setWonColor() {
color = 622336 /* 0x097F00 */;
size = 18;
bold = true;
if (isBold == undefined) {
isBold = true;
}
if (letterSpacing == undefined) {
letterSpacing = 0;
}
var _local2 = new TextFormat();
_local2.font = "Calligraphic";
_local2.bold = isBold;
_local2.size = size;
_local2.letterSpacing = letterSpacing;
var _local3 = _root.instructions_txt;
_local2.color = color;
_local3.setNewTextFormat(_local2);
_local3.sharpness = 0;
_local3.antiAliasType = "advanced";
_local3.selectable = false;
_local3.embedFonts = true;
}
function setTipColor(color, size) {
var _local2 = new TextFormat();
_local2.font = "Calligraphic";
_local2.bold = true;
_local2.size = size;
_local2.letterSpacing = 0;
var _local3 = _root.tips_box.movie.tip_txt;
_local2.color = color;
_local3.setNewTextFormat(_local2);
_local3.sharpness = 0;
_local3.antiAliasType = "advanced";
_local3.selectable = false;
_local3.embedFonts = true;
}
function rpnAddTextMessage(msg) {
if (_root.currentLevel == 0) {
return(undefined);
}
_root.textIsIntstruction = false;
_root.instructions_txt.replaceText(10000, 10000, msg);
}
function rpnSetTextMessage(msg) {
if (_root.currentLevel == 0) {
return(undefined);
}
_root.textIsInstruction = false;
_root.instructions_txt.text = msg;
}
function rpnSetInstructionTextMessage(msg) {
if (_root.currentLevel == 0) {
return(undefined);
}
_root.textIsInstruction = true;
_root.instructions_txt.text = msg;
}
function updateInstructionInWindow() {
if (!_root.textIsInstruction) {
_root.currInstructionIdx = 0;
}
var _local2 = _root.currInstructionIdx + 1;
var _local3 = _root.getInstruction(_local2 - 1);
if (_local3 == undefined) {
_root.currInstructionIdx = 0;
updateInstructionInWindow();
return(undefined);
}
_root.setInstructionsColor(7672066, 14);
rpnSetInstructionTextMessage((_local2 + ". ") + _local3);
_root.currInstructionIdx++;
}
function DeactivateDeal() {
_root.deal_mc.onPress = undefined;
}
function ActivateDeal() {
_root.deal_mc.onPress = _root.rpnDealClicked;
}
function rpnNotifyExtrasAdded() {
if (_root.rpnGameOver()) {
if (_root.currentLevel == 30) {
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("end_game_mc", "dummy", 15000);
_local2.swapDepths(15000);
_local2._x = -25.5;
_local2._y = -51;
}
_root.deal_mc.onPress = undefined;
if (_root.currentLevel < 30) {
_root.onMouseUp = _root.rpnDealClicked;
} else {
_root.onMouseUp = _root.rpnNextRoundAfter30;
}
} else {
_root.mainTable.activate();
_root.mainDeck.activate();
_root.mainExtras.activate();
_root.mainTimer.resumeTimer();
_root.menu_mc.onRelease = rpnMenuReleased;
_root.menu_mc.enabled = true;
_root.deal_mc.enabled = true;
_root.tip_btn.enabled = true;
ActivateDeal();
}
}
function rpnLoadQuestScreen(level) {
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
_root.tip_btn.enabled = false;
if (level == undefined) {
level = _root.currentLevel;
}
_root.quest_screen_mc = _root.getReggedStageMC();
_root.quest_screen_mc.attachMovie("quest_screen_mc", "dummy", 23000);
_root.quest_screen_mc.swapDepths(23000);
_root.quest_screen_mc._x = 0;
_root.quest_screen_mc._y = 0;
var _local7 = 106;
var _local9 = 320;
var _local8 = 214;
var _local2 = 1;
while (_local2 <= 30) {
var _local3 = _root.quest_screen_mc.attachMovie("circle_mc", "sand_circle" + _local2, 23000 + _local2);
var _local5 = 0.190399554763018;
var _local4 = _local2 * _local5;
if (_local2 > 10) {
_local4 = _local4 + _local5;
}
if (_local2 > 20) {
_local4 = _local4 + _local5;
}
_local3._x = _local9 + (_local7 * Math.sin(_local4));
_local3._y = _local8 - (_local7 * Math.cos(_local4));
if (_local2 < level) {
_local3.gotoAndStop("big");
}
if (_local2 > level) {
_local3.gotoAndStop("small");
}
if (_local2 == level) {
_local3.gotoAndPlay("small");
}
_local2++;
}
var _local10 = new mx.transitions.Tween(_root.quest_screen_mc, "_alpha", mx.transitions.easing.Regular.easeIn, 0, 100, 1, 1);
_local10.onMotionFinished = function () {
_root.quest_screen_mc.dummy.next_quest_txt.text = _root.quest_screen_mc.next_txt;
};
}
function rpnNextRound() {
rpnNewGame(_root.currentLevel, _root.baseScore, true);
}
function rpnNextRoundAfter30() {
_root.baseScore = _root.baseScore + Number(_root.points_txt.text);
_root.currentLevel++;
rpnNextRound();
}
function rpnLostClick() {
_root.onMouseUp = undefined;
_root.rpnDealClicked();
}
function rpnStopSynergies(remove) {
var i = 1;
while (i <= 8) {
var li = ((i == 8) ? 1 : (i + 1));
var synergyName = ((("synergy" + i) + li) + "_mc");
var synergy = eval ("_root." + synergyName);
synergy.gotoAndStop(1);
synergy.running = false;
var barName = ((("bar" + i) + li) + "_mc");
var bar = eval ("_root." + barName);
bar.gotoAndStop(1);
bar.running = false;
bar._visible = false;
if (remove == true) {
removeMovieClip(synergy);
removeMovieClip(bar);
}
i++;
}
}
function rpnMenuReleased() {
if (_root.gameMenu_mc != undefined) {
return(undefined);
}
_root.playSound("button1.wav");
if (_root.rpnGameOver()) {
if (_root.handleHighScoresUpdate()) {
return(undefined);
}
}
_root.inGameMenuDisabled = false;
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
_root.DeactivateDeal();
_root.mainTimer.suspendTimer();
_root.menu_mc.enabled = false;
_root.deal_mc.enabled = false;
_root.tip_btn.enabled = false;
_root.gameMenu_mc = _root.getReggedStageMC();
var _local2 = _root.gameMenu_mc;
_local2.swapDepths(21000);
_local2.attachMovie("inGameMenu_mc", "movie", 21000);
_local2._x = 0;
_local2._y = 0;
_root.setFadein(_local2, 10);
}
function startTutorial() {
tutorialStage = -1;
tutorialIsRunning = true;
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
_root.DeactivateDeal();
_root.lastGameWasTutorial = true;
}
function endTutorial() {
tutorialIsRunning = false;
}
function tutorialStartGame() {
endTutorial();
setTutorialTextMessage("");
_root.rpnNewGame(1, 0, false);
}
function tutorialOKClicked() {
var _local2 = tutorialUntils[tutorialStage];
if (_local2 == seconds10) {
tutorialStage++;
beginTutorialStage();
} else {
setTutorialTextMessage(_root.tutorial_txt.text);
}
}
function advanceTutorial() {
if (oneTileRemaining() && (tutorialStage < 12)) {
tutorialStage = 12;
beginTutorialStage();
advanceTutorial();
return(undefined);
}
if ((tutorialStage < 0) || (tutorialUntils[tutorialStage]())) {
tutorialStage++;
beginTutorialStage();
advanceTutorial();
}
}
function beginTutorialStage() {
tutorialBegins[tutorialStage]();
setTutorialTextMessage(tutorialMessages[tutorialStage]);
}
function isTutorialRunning() {
return(tutorialIsRunning);
}
function isTutorialDone() {
}
function ringNotEmpty() {
return(!_root.mainTable.isEmpty());
}
function stage1begin() {
_root.mainTable.activate();
_root.mainDeck.activate();
_root.mainExtras.deactivate();
_root.menu_mc.enabled = false;
}
function twoNeighbouringTiles() {
var _local2 = 1;
while (_local2 <= 8) {
var _local4 = _root.mainTable.getCard(_local2);
var _local3 = _root.mainTable.getCard(((_local2 < 8) ? (_local2 + 1) : 1));
if ((_local4 != undefined) && (_local3 != undefined)) {
return(true);
}
_local2++;
}
return(false);
}
function twoTilesFit() {
return(_root.mainTable.getScore() > 0);
}
function beginTutorialTimer() {
tutorialTimer = getTimer();
}
function seconds10() {
return((getTimer() - tutorialTimer) > 10000);
}
function resetDealClicked() {
tutorialDealClicked = false;
_root.ActivateDeal();
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
}
function tutorialNotifyDealClicked() {
tutorialDealClicked = true;
}
function dealIsPressed() {
if (tutorialDealClicked) {
_root.mainTable.activate();
_root.mainDeck.activate();
}
return(tutorialDealClicked);
}
function enableExtraDeals() {
_root.mainExtras.activate();
tutorialExtraDealClicked = false;
_root.addExtraDeals(4, 2);
_root.addExtraBonuses("red_bomb", 1);
_root.addExtraBonuses("switch", 1);
}
function tutorialNotifyExtraDealClicked() {
tutorialExtraDealClicked = true;
}
function extraDeal4CardPressed() {
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.menu_mc.enabled = false;
if (tutorialExtraDealClicked) {
_root.mainTable.activate();
_root.mainDeck.activate();
}
return(tutorialExtraDealClicked);
}
function addConstraint() {
var _local2 = 1;
while (_local2 <= 8) {
if (_root.mainTable.getCard(_local2) != undefined) {
} else {
_root.mainTable.setConstraint(_local2, "color");
break;
}
_local2++;
}
beginTutorialTimer();
}
function ringIsComplete() {
return(_root.mainTable.isFull());
}
function gameWon() {
return(_root.mainTable.getScore() == 48);
}
function never() {
return(false);
}
function startGame() {
endTutorial();
}
function setTutorialTextMessage(msg) {
setTutorialColor(16777130, 20);
_root.tutorial_txt.text = msg;
var _local2 = 20;
while (_root.tutorial_txt.maxscroll > 1) {
_local2 = _local2 - 2;
setTutorialColor(16777130, _local2);
_root.tutorial_txt.text = msg;
}
new mx.transitions.Tween(_root.tutorial_txt, "_alpha", mx.transitions.easing.None.easeIn, 40, 100, 0.5, 1);
}
function setTutorialColor(color, size) {
var _local2 = new TextFormat();
_local2.font = "Calligraphic";
_local2.bold = true;
_local2.size = size;
_local2.letterSpacing = 0;
var _local3 = _root.tutorial_txt;
_local2.color = color;
_local3.setNewTextFormat(_local2);
_local3.sharpness = 0;
_local3.antiAliasType = "advanced";
_local3.selectable = false;
_local3.embedFonts = true;
}
function oneTileRemaining() {
return(_root.mainTable.filledSlotsNum() == 7);
}
function checkNoCurrentTile() {
return(_root.currentTile() == undefined);
}
function jumpToGame() {
trace(_root.classic_btn);
trace(_root.classic_btn.enabled);
_root.classic_btn.enabled = false;
_root.survival_btn.enabled = false;
_root.menu_text_highlight_mc.removeMovieClip("movie");
gotoAndPlay (6);
}
var nextAvailableDepth;
var nonReggedMCs;
var genColorPerLevel = new Array(0, 1, 0, 1, 2, 0, 0, 1, 1, 0, 1, 1, 1, 2, 1, 0, 1, 0, 0, 1, 2, 1, 1, 0, 2, 2, 1, 2, 1, 2);
var genShapePerLevel = new Array(0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 2, 0, 1, 1, 2, 2, 2, 3, 1, 2, 2);
var spcColorPerLevel = new Array(0, 0, 0, 0, 0, 1, 1, 1, 0, 2, 0, 1, 2, 0, 2, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2);
var spcShapePerLevel = new Array(0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 2, 1, 0, 2, 1, 2, 2, 2, 3, 1, 2, 2, 3, 3, 1, 2, 2, 2, 3, 2);
var advGenColorPerLevel = new Array(1, 1, 0, 1, 1, 1, 1, 2, 1, 1, 0, 2, 1, 0, 1, 0, 0, 2, 1, 2, 1, 0, 3, 2, 2, 1, 1, 3, 2, 2);
var advGenShapePerLevel = new Array(1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 2, 2, 1, 2, 2);
var advSpcColorPerLevel = new Array(1, 0, 2, 0, 1, 1, 2, 0, 2, 1, 1, 2, 1, 1, 3, 2, 1, 2, 1, 2, 1, 1, 2, 1, 3, 2, 1, 3, 3, 2);
var advSpcShapePerLevel = new Array(0, 1, 0, 2, 1, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 2, 3, 1, 2, 2, 3, 3, 1, 2, 1, 2, 3, 1, 1, 2);
var colorsArray = new Array("yellow", "green", "blue", "red");
var shapesArray = new Array("stella", "luna", "sol", "terra");
var synergiesSet;
var tips = new Array("One ping means the tile you used fits an adjacent tile.", "Two pings mean the tile you used fits the tiles on both sides.", "If you put a tile next to another and see smoke comes out - the tiles don't fit.", "Extra deals differ in size. You can get a 2 cards, a 3 cards or a 4 cards extra deal.", "You can place together two tiles that don't fit, but make sure everything fits when you put the last tile in the ring.", "Color quadruples harmonic set is a set where there's an equal number of each color in the ring.", "Double double harmonic set is a set where there are at least two of each color and two of each symbol.", "Double triples harmonic set is a set where there are at least three of each color and three of each symbol.", "Symbol quadruples harmonic set is a set where there's an equal number of each symbol in the ring.", "Starting in level 10 you get transform tools every 5 levels. These tools allow you to change tiles to a specific color or symbol.", "When you complete the 30th ring you defeat the dragon. You can go on playing for a personal record.", "After level 30 you get one random transform tool each level.");
var instructions = new Array("Try to fit the tiles in the ring matching either color or symbol and complete a full magic circle.", "Use the cards that were dealt to the four slots on your left. Press \"deal\" when you can't use the ones already in the slots.", "After exhausting the 4 standard deals you have in one round try using the extra deals to survive a tricky ring.", "Once a tile is inside the ring you can not drag it back to the slot.", "You can move a tile that is already in the ring to another place in the ring, unless a Limiter is preventing this.", "A cracked slot can not contain cards (not including extra deals).", "Eight tiles make a set - a complete magic ring that can prevent the dragon from burning you.", "Each tile has two sides - left and right. Each side has one color and one symbol.", "There are four symbols: Luna (moon), Terra (earth), Sol (sun) and Stella (star), and four colors: Red, Green, Yellow and Blue.", "Creating special combinations of tiles will get you bonus points and bonus tools.", "\"Harmonic sets\" are special combinations of tiles, where all colors or all symbols are equally represented.", "\"Pool sets\" are sets with large amounts of one color or symbol.", "The first Limiter appears in the second round. it looks like a pizza Limiter with the word \"Color\" on it.", "The \"Color\" Limiter prevents you from matching next to it two tiles that don't have a matching color.", "As you advance in level, the number of Limiters grows and they become more specific.");
var mainTable;
var mainDeck;
var mainExtras;
var tileOriginalLocation;
var inGame = false;
var dragon_mc;
var victory_mc;
var wizard_wand_mc;
var text_highlight_mc;
var tips_box;
var lastDealWarningIssued = false;
var tutorialMode = true;
var tutorialStage = -1;
var tutorialIsRunning = false;
var tutorialTimer;
var tutorialDealClicked = false;
var tutorialExtraDealClicked = false;
var tutorialMessages = new Array("Pick a tile from the slot and put it anywhere in the ring.", "Good! Now pick another tile and put it in the ring next to the first tile. Try to fit either color or symbol.", "These tiles don\u2019t fit each other. You can put them next to each other now, but when you fill the ring with tiles a wrong match will make the magic circle fail and you will lose the game\u2026", "Very good! Completing a full ring where adjacent tiles fit each other will protect you from the dragon\u2019s breath.", "", "When you have no use for the current tiles press the \u201CDeal\u201D button. You will get new tiles but each press of the button decreases the amount of tiles in the slots.", "Great! You have 4 standard deals each round so you can use the \u201CDeal\u201D button 2 more times.", "", "If the 4 standard deals are not enough you can use the \u201CExtra Deals\u201D in the bonus toolbox. Press the 4 card extra deal and see what happens.", "The \u201CExtra Deal\u201D bonuses and other tools can be used when you have a tough ring that you just cannot complete with only the standard deals.", "You can see what other bonus tools do by moving the mouse over them.", "When you see a triangle inside the ring it means you are somehow limited. This is a \u201CColor\u201D limiter. The two tiles that touch it must match in color. ", "", "One more tile to go! Don't forget to make sure all the tiles match, so the ring will be strong enough to protect you.", "This time the dragon got you\u2026 You can press \"OK\" and test your skill starting your first real ring!", "Congratulations! You have completed a full ring preventing the dragon\u2019s breath from reaching you!", "You now know pretty much everything you need to start playing the game. Press \u201COK\u201D to start the 1st ring of the classic mode.");
var tutorialBegins = new Array(stage1begin, undefined, undefined, beginTutorialTimer, undefined, resetDealClicked, beginTutorialTimer, undefined, enableExtraDeals, beginTutorialTimer, beginTutorialTimer, addConstraint, undefined, undefined, undefined, undefined, beginTutorialTimer);
var tutorialUntils = new Array(ringNotEmpty, twoNeighbouringTiles, twoTilesFit, seconds10, checkNoCurrentTile, dealIsPressed, seconds10, checkNoCurrentTile, extraDeal4CardPressed, seconds10, seconds10, undefined, oneTileRemaining, ringIsComplete, gameWon, seconds10, never);
_root.inGameScene = false;
_root.onEnterFrame = function () {
Mouse.hide();
};
if (_root.bgMusicEnabled == undefined) {
_root.tutorialAlreadyPlayed = undefined;
_root.bgMusicEnabled = true;
_root.bgSoundsEnabled = true;
_root.fullscreenEnabled = false;
}
_root.rpnPlayBGMusic("background_music");
_root.loadMouse();
_root.menusDisabled = false;
_root.newHighscore = false;
_root.menu_text_highlight_mc = _root.getReggedStageMC();
_root.menu_text_highlight_mc.attachMovie("Menu Text Highlight", "movie", _root.getNextDepth());
_root.menu_text_highlight_mc._x = 0;
_root.menu_text_highlight_mc._y = 0;
_root.menu_text_highlight_mc.movie.gotoAndStart("start");
_root.classic_btn.enabled = true;
_root.survival_btn.enabled = true;
_root.instructions_btn.enabled = true;
_root.powerups_btn.enabled = true;
_root.options_btn.enabled = true;
_root.highscores_btn.enabled = true;
_root.credits_btn.enabled = true;
_root.quit_btn.enabled = true;
_root.currentLevel = 1;
_root.baseScore = 0;
fscommand ("showmenu", false);
stop();
Frame 3
Frame 4
function writeHighScores() {
_root.initHighScores();
_root.getReggedStageMC();
var _local2 = _root.getReggedStageMC();
_root.scoresObj = _local2;
var _local3 = 0;
while (_local3 <= 10) {
var _local7 = _root.getRecordScore("RPN", "basic_scores", _local3);
var _local8 = _local7.player;
var _local10 = _local7.main_score;
var _local9 = _local7.secondary_score;
if (_local8 == undefined) {
} else {
var _local4 = "player_name_" + _local3;
var _local6 = "level_" + _local3;
var _local5 = "score_" + _local3;
_local2.createTextField(_local4, _root.getNextDepth(), 110, 62 + (_local3 * 23), 100, 22);
setHighscoresText(_local2[_local4], "left");
_local2[_local4].text = _local8;
_local2.createTextField(_local6, _root.getNextDepth(), 190, 62 + (_local3 * 23), 27, 22);
setHighscoresText(_local2[_local6], "right");
_local2[_local6].text = _local9;
_local2.createTextField(_local5, _root.getNextDepth(), 225, 62 + (_local3 * 23), 65, 22);
setHighscoresText(_local2[_local5], "right");
_local2[_local5].text = _local10;
}
_local3++;
}
_local3 = 0;
while (_local3 <= 10) {
var _local7 = _root.getRecordScore("RPN", "basic_levels", _local3);
var _local8 = _local7.player;
var _local9 = _local7.main_score;
var _local10 = _local7.secondary_score;
if (_local8 == undefined) {
} else {
var _local4 = "player_name2_" + _local3;
var _local6 = "level2_" + _local3;
var _local5 = "score2_" + _local3;
_local2.createTextField(_local4, _root.getNextDepth(), 379, 62 + (_local3 * 23), 100, 22);
setHighscoresText(_local2[_local4], "left");
_local2[_local4].text = _local8;
_local2.createTextField(_local6, _root.getNextDepth(), 459, 62 + (_local3 * 23), 27, 22);
setHighscoresText(_local2[_local6], "right");
_local2[_local6].text = _local9;
_local2.createTextField(_local5, _root.getNextDepth(), 494, 62 + (_local3 * 23), 65, 22);
setHighscoresText(_local2[_local5], "right");
_local2[_local5].text = _local10;
}
_local3++;
}
}
function updateHighScores() {
var _local3 = _root.scoresObj;
var _local2 = 0;
while (_local2 <= 10) {
var _local4 = _root.getRecordScore("RPN", "basic_scores", _local2);
var _local5 = _local4.player;
var _local10 = _local4.main_score;
var _local8 = _local4.secondary_score;
if (_local5 == undefined) {
} else {
var _local6 = "player_name_" + _local2;
var _local9 = "level_" + _local2;
var _local7 = "score_" + _local2;
_local3[_local6].text = _local5;
_local3[_local9].text = _local8;
_local3[_local7].text = _local10;
}
_local2++;
}
_local2 = 0;
while (_local2 <= 10) {
var _local4 = _root.getRecordScore("RPN", "basic_levels", _local2);
var _local5 = _local4.player;
var _local8 = _local4.main_score;
var _local10 = _local4.secondary_score;
if (_local5 == undefined) {
} else {
var _local6 = "player_name2_" + _local2;
var _local9 = "level2_" + _local2;
var _local7 = "score2_" + _local2;
_local3[_local6].text = _local5;
_local3[_local9].text = _local8;
_local3[_local7].text = _local10;
}
_local2++;
}
}
function setHighscoresText(tf, alignment) {
var _local1 = new TextFormat();
_local1.font = "GaramondEmbed";
_local1.bold = true;
_local1.size = 16;
_local1.align = alignment;
_local1.color = 8396832 /* 0x802020 */;
tf.setNewTextFormat(_local1);
tf.sharpness = 0;
tf.antiAliasType = "advanced";
tf.selectable = false;
tf.embedFonts = true;
}
if (!_root.newHighscore) {
_root.clearStage();
}
var scoresObj;
writeHighScores();
Selection.setFocus(_root.hs_mc.highscore.playerName);
Selection.setSelection(0, 0);
Frame 6
function isRecordScore(tool, category, main_score, secondary_score) {
var _local8 = "highscores_" + category;
var _local4 = _root.getSavedObject(tool, _local8);
var _local2 = 0;
while (_local2 < _local4.maxlength) {
var _local3 = _local4.main_score[_local2];
var _local5 = _local4.secondary_score[_local2];
if (_local3 == undefined) {
return(true);
}
if ((_local3 < main_score) || ((_local3 == main_score) && (_local5 < secondary_score))) {
return(true);
}
_local2++;
}
return(false);
}
function addRecordScore(tool, category, player, main_score, secondary_score) {
var _local12 = "highscores_" + category;
var _local3 = _root.getSavedObject(tool, _local12);
var _local2 = 0;
while (_local2 < _local3.maxlength) {
var _local6 = _local3.main_score[_local2];
var _local7 = _local3.secondary_score[_local2];
if (_local6 == undefined) {
break;
}
if ((_local6 < main_score) || ((_local6 == main_score) && (_local7 < secondary_score))) {
break;
}
_local2++;
}
var _local4 = player;
var _local9 = main_score;
var _local8 = secondary_score;
do {
var _local5 = _local3.player[_local2];
var _local6 = _local3.main_score[_local2];
var _local7 = _local3.secondary_score[_local2];
_local3.player[_local2] = _local4;
_local3.main_score[_local2] = _local9;
_local3.secondary_score[_local2] = _local8;
_local4 = _local5;
_local9 = _local6;
_local8 = _local7;
_local2++;
} while ((_local4 != undefined) && (_local2 < _local3.maxlength));
_local3.length = _local2;
_root.flushSavedObject();
}
function getRecordScore(tool, category, idx) {
var _local5 = "highscores_" + category;
var _local3 = _root.getSavedObject(tool, _local5);
var _local2 = new Object();
_local2.player = _local3.player[idx];
_local2.main_score = _local3.main_score[idx];
_local2.secondary_score = _local3.secondary_score[idx];
return(_local2);
}
function initRecordsTable(tool, category, maxlength) {
var _local2 = "highscores_" + category;
var _local3 = _root.getSavedObject(tool, _local2);
if (_local3.maxlength != undefined) {
return(undefined);
}
resetRecordsTable(tool, category, maxlength);
_root.flushSavedObject();
}
function resetRecordsTable(tool, category, maxlength) {
var _local4 = "highscores_" + category;
var _local2 = _root.getSavedObject(tool, _local4);
delete _local2.player;
delete _local2.main_score;
delete _local2.secondary_score;
_local2.maxlength = maxlength;
_local2.player = new Array(maxlength);
_local2.main_score = new Array(maxlength);
_local2.secondary_score = new Array(maxlength);
_root.flushSavedObject();
}
function newRandomCards(num) {
cards = new Array();
var _local1 = 1;
while (_local1 <= num) {
cards[_local1] = newRandomCard();
_local1++;
}
return(cards);
}
function newRandomCard() {
return(new cardObj(randomColor(), randomShape(), randomColor(), randomShape()));
}
function randomColor() {
switch (int(Math.random() * 4)) {
case 0 :
return("red");
case 1 :
return("blue");
case 2 :
return("green");
case 3 :
return("yellow");
}
}
function randomShape() {
switch (int(Math.random() * 4)) {
case 0 :
return("luna");
case 1 :
return("stella");
case 2 :
return("terra");
case 3 :
return("sol");
}
}
function isColor(type) {
if ((((type == "red") || (type == "blue")) || (type == "yellow")) || (type == "green")) {
return(true);
}
return(false);
}
function getNextDepth() {
if ((nonReggedMCs == undefined) || (nonReggedMCs == NaN)) {
nonReggedMCs = 0;
}
if (nextAvailableDepth == undefined) {
nextAvailableDepth = 11000 - nonReggedMCs;
}
nextAvailableDepth--;
return(nextAvailableDepth);
}
function handleDealClickGameNotOver() {
if ((_root.mainDeck.noMoreDeals() == 1) && (_root.lastDealWarningIssued == false)) {
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("no_more_deals_mc", "dummy", 15000);
_local2.swapDepths(15000);
_local2._x = 64.3;
_local2._y = 209.4;
_local2.onMouseDown = _root.unloadSelf;
_root.playSound("tool_message.wav");
_root.lastDealWarningIssued = true;
return(undefined);
}
_root.mainDeck.deal();
return(undefined);
}
function handleHighScoresUpdate() {
_root.initHighScores();
var _local9 = Number(_root.total_points_txt.text);
var _local8 = Number(_root.currentLevel);
if (_root.total_points_txt.text == 0) {
return(false);
}
if ((!_root.isRecordScore("RPN", "basic_scores", _root.total_points_txt.text, _root.currentLevel)) && (!_root.isRecordScore("RPN", "basic_levels", _root.currentLevel, _root.total_points_txt.text))) {
return(false);
}
_root.newHighscore = true;
_root.rpnStopSynergies();
_root.jumpToScores();
var _local3 = _root.getReggedStageMC();
_root.hs_mc = _local3;
_local3.attachMovie("highscore_mc", "highscore", 20000);
_local3.swapDepths(20000);
_local3._x = 185.8;
_local3._y = 361.4;
var _local6 = new Object();
_local6.parent = _local3.highscore;
_local6.onKeyDown = function () {
var _local2 = Key.getCode();
if ((_local2 == 13) || (_local2 == 13)) {
Key.removeListener(this);
this.parent.handleSubmitPress();
}
};
Key.addListener(_local6);
_local3.highscore.points = _local9;
_local3.highscore.level = _local8;
var _local4 = new TextFormat();
_local4.font = "AndalusNumbers";
_local4.bold = true;
_local4.size = 14;
_local4.align = "center";
_local4.letterSpacing = 2;
var _local5 = _local3.highscore.playerName;
_local4.color = 4203023 /* 0x40220F */;
_local5.setNewTextFormat(_local4);
_local5.sharpness = 0;
_local5.antiAliasType = "advanced";
_local5.embedFonts = true;
return(true);
}
function setCard(obj, val) {
if (val != undefined) {
setCard(obj, undefined);
obj.leftColor.attachMovie(val.leftColor + "_mc", "leftCol_mc", getNextDepth());
obj.rightColor.attachMovie(val.rightColor + "_mc", "rightCol_mc", getNextDepth());
obj.rightShape.attachMovie(val.rightShape + "_mc", "rightShp_mc", getNextDepth());
if ((val.leftShape == "luna") || (val.leftShape == "terra")) {
obj.leftShape.attachMovie(val.leftShape + "_flipped_mc", "leftShp_mc", getNextDepth());
} else {
obj.leftShape.attachMovie(val.leftShape + "_mc", "leftShp_mc", getNextDepth());
}
obj.cardval = val;
obj._visible = true;
_root.registerStageMC(obj.leftColor.leftCol_mc);
_root.registerStageMC(obj.rightColor.rightCol_mc);
_root.registerStageMC(obj.leftShape.leftShp_mc);
_root.registerStageMC(obj.rightShape.rightShp_mc);
if (val.joker) {
setJoker(obj);
}
} else {
obj.leftColor.leftCol_mc.removeMovieClip();
obj.leftShape.leftShp_mc.removeMovieClip();
obj.rightColor.rightCol_mc.removeMovieClip();
obj.rightShape.rightShp_mc.removeMovieClip();
obj.jokerEffect.removeMovieClip();
obj.extraDealEffect.removeMovieClip();
obj.cardval = undefined;
obj._visible = false;
}
}
function setJoker(card) {
card.cardval.joker = true;
card.attachMovie("joker_tile_mc", "jokerEffect", getNextDepth());
_root.registerStageMC(card.jokerEffect);
}
function setExtraDealCard(card) {
card.cardval.extradeal = true;
card.tween = new mx.transitions.Tween(card, "_alpha", mx.transitions.easing.Regular.easeInOut, 95, 60, 1, 1);
card.tween.onMotionFinished = card.tween.yoyo;
}
function unsetExtraDealCard(card) {
card.cardval.extradeal = false;
card.tween.stop();
}
function playSound(name, loops, vol) {
if (!_root.bgSoundsEnabled) {
return(undefined);
}
if (loops == undefined) {
loops = 0;
}
var _local2 = new Sound();
_local2.attachSound(name);
_local2.start(0, loops);
}
function playSequencedSound(name, func) {
if (!_root.bgSoundsEnabled) {
func();
return(undefined);
}
var _local3 = new Sound();
_local3.onSoundComplete = function () {
this.func();
};
_local3.func = func;
_local3.attachSound(name);
_local3.start();
}
function clearStage() {
_root.game_bg_mc2.swapDepths(1);
_root.tutorial_text_bg_mc.swapDepths(2);
for (obj in _root.stageObjs) {
_root.stageObjs[obj].removeMovieClip();
delete _root.stageObjs[obj];
_root.stageObjs[obj] = undefined;
}
delete _root.stageObjs;
_root.stageObjs = undefined;
if ((nonReggedMCs == undefined) || (nonReggedMCs == NaN)) {
nonReggedMCs = 0;
}
nextAvailableDepth = 11000 - nonReggedMCs;
}
function getStageMC(regged) {
if (_root.stageObjs == undefined) {
_root.stageObjs = new Array();
}
if ((nonReggedMCs == undefined) || (nonReggedMCs == NaN)) {
nonReggedMCs = 0;
}
if (regged != true) {
nonReggedMCs++;
}
var _local2 = 0;
if (regged) {
_local2 = "Regged" + _root.stageObjs.length;
} else {
_local2 = nonReggedMCs;
}
var _local3 = "dynamicObject" + _local2;
_root.createEmptyMovieClip(_local3, _root.getNextDepth());
return(_root[_local3]);
}
function getReggedStageMC() {
var _local1 = getStageMC(true);
registerStageMC(_local1);
return(_local1);
}
function registerStageMC(mc) {
if (_root.stageObjs == undefined) {
_root.stageObjs = new Array();
}
_root.stageObjs.push(mc);
}
function generateIdxSet(nums, maxNum) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
while (_local3 < nums) {
_local6.push(int(((maxNum - _local3) * Math.random()) + 1));
_local3++;
}
_local3 = 0;
while (_local3 < nums) {
var _local2 = _local6[_local3];
var _local4 = _local5;
_local4.sort();
var _local1 = 0;
while (_local1 < _local3) {
if (_local4[_local1] <= _local2) {
_local2++;
}
_local1++;
}
_local5.push(_local2);
_local3++;
}
return(_local5);
}
function generateConstraints(level, slotsNum) {
var _local4 = new Array();
var _local9 = _root.getConstraintNums(level);
var _local5 = _root.generateIdxSet(_local9.totalConstraints, slotsNum);
var _local7 = _local9.genColor;
var _local6 = _local9.genShape + _local7;
var _local8 = _local9.spcColor + _local6;
var _local2;
var _local3 = 0;
while (_local3 < _local7) {
_local2 = new Object();
_local2.idx = _local5[_local3];
_local2.cnstr = "color";
_local4.push(_local2);
_local3++;
}
_local3 = _local7;
while (_local3 < _local6) {
_local2 = new Object();
_local2.idx = _local5[_local3];
_local2.cnstr = "shape";
_local4.push(_local2);
_local3++;
}
_local3 = _local6;
while (_local3 < _local8) {
_local2 = new Object();
_local2.idx = _local5[_local3];
_local2.cnstr = randomColor();
_local4.push(_local2);
_local3++;
}
_local3 = _local8;
while (_local3 < _local9.totalConstraints) {
_local2 = new Object();
_local2.idx = _local5[_local3];
_local2.cnstr = randomShape();
_local4.push(_local2);
_local3++;
}
return(_local4);
}
function getConstraintNums(level) {
var _local1 = new Object();
if (level > 30) {
level = 30;
}
_local1.genColor = genColorPerLevel[level - 1];
_local1.genShape = genShapePerLevel[level - 1];
_local1.spcColor = spcColorPerLevel[level - 1];
_local1.spcShape = spcShapePerLevel[level - 1];
_local1.totalConstraints = ((_local1.genColor + _local1.genShape) + _local1.spcColor) + _local1.spcShape;
return(_local1);
}
function loadMouse() {
Mouse.hide();
if (_root.mouse_mc) {
_root.mouse_mc.unloadMovie();
_root.mouse_mc = undefined;
}
if (_root.mouse_mc == undefined) {
_root.mouse_mc = _root.getStageMC();
_root.mouse_mc.swapDepths(25000);
_root.mouse_mc.attachMovie("mouse_mc", "dummy", _root.getNextDepth());
_root.mouse_mc.onEnterFrame = _root.updateMouseLocation;
}
}
function updateMouseLocation() {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
function unloadSelf() {
this.unloadMovie();
}
function getSavedObject(tool, name) {
var _local1 = SharedObject.getLocal((tool + "_") + name);
if (_local1 == undefined) {
trace(((("FATAL: getSavedObject(" + tool) + ", ") + name) + ") has failed. Possibly a permissions/space issue.");
return(undefined);
}
if (_local1.data.val == undefined) {
_local1.data.val = new Object();
}
return(_local1.data.val);
}
function flushSavedObject() {
var _local1 = SharedObject.getLocal((tool + "_") + name);
_local1.flush();
}
function setFadein(obj, step) {
obj._alpha = 0;
obj.fadein_step = step;
obj.onEnterFrame = _root.fadeInEffect;
}
function setFadeout(obj, step) {
obj._alpha = 100;
obj.fadeout_step = step;
obj.onEnterFrame = _root.fadeOutEffect;
}
function fadeInEffect() {
this._alpha = this._alpha + this.fadein_step;
if (this._alpha > 100) {
this._alpha = 100;
this.onEnterFrame = undefined;
}
}
function fadeOutEffect() {
this._alpha = this._alpha - this.fadeout_step;
if (this._alpha < 0) {
this._alpha = 0;
this.onEnterFrame = undefined;
}
}
function initHighScores() {
if ((_root.getRecordScore("RPN", "basic_scores", 0).player == undefined) || (_root.getRecordScore("RPN", "basic_levels", 0).player == undefined)) {
_root.resetRecordsTable("RPN", "basic_levels", 11);
_root.resetRecordsTable("RPN", "basic_scores", 11);
var _local2 = 10;
while (_local2 >= 0) {
_root.addRecordScore("RPN", "basic_scores", "Sorcerer", 100 + (_local2 * 100), 1);
_root.addRecordScore("RPN", "basic_levels", "Sorcerer", 1 + _local2, 100 + (_local2 * 100));
_local2--;
}
}
}
function setSynergy() {
var _local2;
_local2 = _root.currentLevel - 3;
if (_local2 < 1) {
_root.synergy1 = undefined;
_root.synergy2 = undefined;
return(undefined);
}
while (_local2 > 28) {
_local2 = _local2 - 28;
}
if (_local2 == 1) {
_root.generateSynergySet();
}
var _local5 = _root.synergiesSet[_local2 - 1].s1;
var _local4 = _root.synergiesSet[_local2 - 1].s2;
_root.playSound("Synergy Startup");
var _local6 = ((_local5 + "_") + _local4) + "_synergy_mc";
_root.synergy1 = _local5;
_root.synergy2 = _local4;
var _local3 = _root.getReggedStageMC();
_local3.swapDepths(20500);
_local3.attachMovie(_local6, "movie", 100);
_local3._x = 324.9;
_local3._y = 246.6;
_local3.movie.onRollOver = _root.synergyOnRollOver;
_local3.movie.onRollOut = _root.synergyOnRollOut;
}
function synergyOnRollOver() {
if (_root.inGameMenuDisabled == false) {
return(undefined);
}
if (_root.rpnGameOver()) {
return(undefined);
}
if (this.synergy_mo_mc != undefined) {
return(undefined);
}
if (this._currentframe != this._totalframes) {
return(undefined);
}
this.lala = _root.getReggedStageMC();
this.lala.swapDepths(20500);
this.lala.attachMovie("synergy_mo_mc", "movie", 25000);
this.lala._x = 463;
this.lala._y = 167;
}
function synergyOnRollOut() {
removeMovieClip(this.lala);
}
function generateSynergySet() {
_root.synergiesSet = new Array();
var _local2 = new Array();
var _local6 = 0;
while (_local6 < 4) {
var _local5 = _local6 + 1;
while (_local5 < 4) {
var _local4 = new Object();
_local4.s1 = colorsArray[_local6];
_local4.s2 = colorsArray[_local5];
_local2.push(_local4);
_local5++;
}
_local5 = 0;
while (_local5 < 4) {
var _local4 = new Object();
_local4.s1 = shapesArray[_local6];
_local4.s2 = colorsArray[_local5];
_local2.push(_local4);
_local5++;
}
_local6++;
}
_local6 = 0;
while (_local6 < 4) {
var _local5 = _local6 + 1;
while (_local5 < 4) {
var _local4 = new Object();
_local4.s1 = shapesArray[_local6];
_local4.s2 = shapesArray[_local5];
_local2.push(_local4);
_local5++;
}
_local6++;
}
while (_local2.length > 0) {
var _local7 = int(Math.random() * _local2.length);
_root.synergiesSet.push(_local2[_local7]);
var _local8 = new Array();
var _local3 = 0;
while (_local3 < _local7) {
_local8.push(_local2[_local3]);
_local3++;
}
_local3 = _local7 + 1;
while (_local3 < _local2.length) {
_local8.push(_local2[_local3]);
_local3++;
}
_local2 = _local8;
}
}
function setTileOrigin(tile_mc) {
if (tile_mc == undefined) {
tileOriginalLocation.tile = undefined;
return(undefined);
}
tileOriginalLocation.tile = tile_mc;
tileOriginalLocation._x = tile_mc._x;
tileOriginalLocation._y = tile_mc._y;
tileOriginalLocation._rotation = tile_mc._rotation;
}
function returnTileToOrigin() {
currentTile()._x = tileOriginalLocation._x;
currentTile()._y = tileOriginalLocation._y;
currentTile()._rotation = tileOriginalLocation._rotation;
currentTile().rotate_tween.stop();
delete currentTile().rotate_tween;
if (currentTile().idx != undefined) {
_root.mainTable.applyNewSmoke(currentTile().idx);
}
}
function currentTile() {
return(tileOriginalLocation.tile);
}
function placeTileOnTarget(tile, target) {
if (target == undefined) {
return(false);
}
var _local3 = ((currentTile() == undefined) ? -1 : (currentTile().idx));
if (_local3 == target.idx) {
return(false);
}
if (_root.mainTable.getCard(target.idx) != undefined) {
_root.playSound("Tile Mismatch");
return(false);
}
if (_root.mainTable.illegalPlacement(target.idx, tile.cardval, _local3)) {
_root.setInstructionsColor(16711680, 14);
_root.rpnSetTextMessage("The tile doesn't fit here. The limiter in the inner circle allows only a specific match.\n");
_root.playSound("Tile Mismatch");
return(false);
}
_root.mainTable.setCard(target.idx, tile.cardval);
return(true);
}
function adjustToCursor(obj) {
obj._x = _root._xmouse;
obj._y = _root._ymouse;
}
function deckCardOnPress() {
cardPressTime = getTimer();
if (!this.isOccupied) {
return(undefined);
}
_root.onMouseMove = cardOnMouseMove;
setTileOrigin(this);
adjustToCursor(this);
if (_root.getInstanceAtDepth(19000) == undefined) {
this.swapDepths(19000);
} else {
this.swapDepths(_root.getInstanceAtDepth(19000));
}
this.startDrag();
}
function deckCardOnRelease() {
this.onPress = _root.deckCardOnPress;
if ((getTimer() - cardPressTime) < 100) {
this.onPress = _root.deckCardOnRelease;
return(undefined);
}
this.stopDrag();
_root.onMouseMove = undefined;
var _local3 = _root.mainTable.getSlotFromCursor();
returnTileToOrigin();
if (placeTileOnTarget(currentTile(), _local3)) {
_root.setCard(currentTile(), _root.newRandomCard());
applyNewSynergies();
_root.mainTable.applyNewBars();
_root.mainTable.applyNewSmoke(_local3.idx);
_root.giveBonusTipIfPossible();
var _local4 = _root.mainTable.getScore();
playScoreMusic(_local3.idx);
_root.lastDealWarningIssued = false;
} else {
_root.playSound("enteringSlot.wav");
}
this.swapDepths(_root.getNextDepth());
setTileOrigin(undefined);
}
function tableCardOnPress() {
cardPressTime = getTimer();
_root.onMouseMove = cardOnMouseMove;
setTileOrigin(this);
adjustToCursor(this);
if (_root.getInstanceAtDepth(19000) == undefined) {
this.swapDepths(19000);
} else {
this.swapDepths(_root.getInstanceAtDepth(19000));
}
_root.mainTable.liftedIdx = currentTile().idx;
this.startDrag();
}
function tableCardOnRelease() {
this.onPress = _root.tableCardOnPress;
if ((getTimer() - cardPressTime) < 100) {
this.onPress = _root.tableCardOnRelease;
return(undefined);
}
this.stopDrag();
_root.onMouseMove = undefined;
_root.mainTable.liftedIdx = undefined;
var _local3 = _root.mainTable.getSlotFromCursor();
if (placeTileOnTarget(currentTile(), _local3)) {
_root.mainTable.setCard(currentTile().idx, undefined);
this.removeMovieClip();
var _local4 = _root.mainTable.getScore();
playScoreMusic(_local3.idx);
_root.lastDealWarningIssued = false;
applyNewSynergies();
_root.mainTable.applyNewBars();
_root.mainTable.applyNewSmoke(_local3.idx);
} else {
if ((currentTile().idx == _local3.idx) || (_local3 == undefined)) {
playScoreMusic(currentTile().idx);
} else {
_root.playSound("enteringSlot.wav");
}
returnTileToOrigin();
this.swapDepths(_root.getNextDepth());
}
setTileOrigin(undefined);
}
function cardOnMouseMove() {
targetSlot = _root.mainTable.getSlotFromCursor();
if (targetSlot == undefined) {
return(undefined);
}
var _local5 = currentTile();
if (_local5._rotation == targetSlot._rotation) {
return(undefined);
}
if (((_local5.rotate_tween.finalRotation == targetSlot._rotation) && (_local5.rotate_tween != undefined)) && (_local5.rotate_tween.completed == false)) {
return(undefined);
}
_local5.rotate_tween.stop();
delete _local5.rotate_tween;
var _local3 = _local5._rotation;
var _local4 = targetSlot._rotation;
while ((_local3 - _local4) > 180) {
_local4 = _local4 + 360;
}
while ((_local4 - _local3) > 180) {
_local3 = _local3 + 360;
}
_local5.rotate_tween = new mx.transitions.Tween(currentTile(), "_rotation", mx.transitions.easing.Regular.easeIn, _local3, _local4, 0.2, 1);
_local5.rotate_tween.completed = false;
_local5.rotate_tween.finalRotation = targetSlot._rotation;
_local5.rotate_tween.onMotionFinished = function () {
this.completed = true;
};
currentTile()._x = root._xmouse;
currentTile()._y = root._ymouse;
}
function playScoreMusic(idx) {
var _local6 = ((idx == 8) ? 1 : (idx + 1));
var _local5 = ((idx == 1) ? 8 : (idx - 1));
var _local4 = _root.mainTable.getCard(idx);
var _local10 = _root.mainTable.getCard(_local6);
var _local7 = _root.mainTable.getCard(_local5);
var _local8 = false;
var _local9 = false;
var _local3 = 0;
if (_root.mainTable.cardsMatch(_local4, _local7)) {
_local3++;
_local8 = true;
}
if (_root.mainTable.cardsMatch(_local10, _local4)) {
_local3++;
_local9 = true;
}
if (_local3 > 0) {
_root.playSound(_local3 + "match.wav");
_root.wizard_wand_mc.movie.fadeIn = true;
_root.wizard_wand_mc.movie.fadeOut = true;
_root.wizard_wand_mc.movie.gotoAndPlay("start");
} else {
_root.playSound("enteringSlot.wav");
}
if (checkSynergy(idx) || (checkSynergy(_local5))) {
_root.playSound("Synergy");
}
}
function giveBonusTipIfPossible() {
if (_root.isTutorialRunning()) {
return(undefined);
}
if (_root.mainTable.filledSlotsNum() == 5) {
var _local7 = _root.mainTable.countTiles();
var _local5 = 0;
var _local6 = "";
for (elem in _local7) {
if (_local7[elem] <= _local5) {
continue;
}
_local5 = _local7[elem];
_local6 = elem;
}
_local6 = _local6.charAt(0).toUpperCase() + _local6.substr(1, _local6.length - 1);
_root.setInstructionsColor(1450919, 14);
_root.rpnSetTextMessage(((((("You have " + _local5) + " ") + _local6) + "s in the ring. Try accumulating more to create a \"") + _local6) + " Pool set\"");
_root.playSound("New Message");
return(undefined);
}
if (_root.mainTable.filledSlotsNum() == 6) {
var _local7 = _root.mainTable.countTiles();
var _local4 = 17;
var _local3 = 17;
for (elem in _local7) {
var _local2 = _local7[elem];
if ((((elem == "red") || (elem == "blue")) || (elem == "green")) || (elem == "yellow")) {
if (_local4 > _local2) {
_local4 = _local2;
}
} else if (_local3 > _local2) {
_local3 = _local2;
}
}
if (_local3 >= 2) {
_root.setInstructionsColor(1450919, 14);
_root.rpnSetTextMessage("You have 4 Shape doubles in the ring. Try to create a \"Shape Harmonic set\" by accumulating 3 or 4 from each shape.");
_root.playSound("New Message");
return(undefined);
}
if (_local4 >= 2) {
_root.rpnSetTextMessage("You have 4 Color doubles in the ring. Try to create a \"Color Harmonic set\" by accumulating 3 or 4 from each color.");
_root.playSound("New Message");
return(undefined);
}
return(undefined);
}
}
function applyNewSynergies() {
var idx = 1;
while (idx <= 8) {
var hasSynergy = checkSynergy(idx);
var lidx = ((idx == 8) ? 1 : (idx + 1));
var s_mc = eval (((("_root.synergy" + idx) + "") + lidx) + "_mc");
if (s_mc.running == undefined) {
s_mc.running = false;
}
if (hasSynergy && (!s_mc.running)) {
s_mc.gotoAndPlay(1);
s_mc.swapDepths(16020 + idx);
s_mc.running = true;
}
if ((!hasSynergy) && (s_mc.running)) {
s_mc.swapDepths(-100 + idx);
s_mc.gotoAndStop(1);
s_mc.running = false;
}
idx++;
}
}
function addExtrasByLevel(level) {
if (_root.specialDebugMode == level) {
_root.addExtraDeals(4, 4);
_root.addExtraBonuses("red_bomb", 2);
_root.addExtraBonuses("switch", 2);
_root.addExtraBonuses("joker", 2);
_root.addExtraBonuses("blue_bomb", 2);
}
if (level == 1) {
_root.addExtraDeals(4, 3);
}
if ((level == 10) || (level == 15)) {
_root.addExtraBonuses(randomTransformColor(), 1);
_root.addExtraBonuses(randomTransformShape(), 1);
}
if (level == 20) {
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
}
if (level == 25) {
_root.addExtraBonuses(randomTransformColor(), 1);
_root.addExtraBonuses(randomTransformColor(), 1);
_root.addExtraBonuses(randomTransformShape(), 1);
_root.addExtraBonuses(randomTransformShape(), 1);
}
if (level == 30) {
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
_root.addExtraBonuses(randomTransform(), 1);
}
if (level > 30) {
_root.addExtraBonuses(randomTransform(), 1);
}
}
function randomTransform() {
if (int(Math.random() * 2) == 0) {
return(randomTransformColor());
}
return(randomTransformShape());
}
function randomTransformColor() {
return(_root.randomColor() + "_transform");
}
function randomTransformShape() {
var _local2 = _root.randomShape();
return(_local2 + "_transform");
}
function addExtraDeals(cards, num) {
if ((num == undefined) || (num < 1)) {
return(undefined);
}
_root.mainExtras.add(("d" + cards) + "_extradeal", num, _root.extraDealClick, "extra_deal_mo_mc", cards);
}
function addExtraBonuses(type, num) {
if ((num == undefined) || (num < 1)) {
return(undefined);
}
_root.mainExtras.add(type + "_mc", num, eval (("_root.extra" + type) + "Click"), type + "_mo_mc", undefined);
}
function extraDealClick() {
if (_root.mainExtras.mActive == false) {
return(undefined);
}
_root.tutorialNotifyExtraDealClicked();
var _local3 = _root.mainExtras.getExtraInfo(this.idx);
this.onRollOut();
_root.mainExtras.remove(this.idx);
_root.mainDeck.setExtraDeal(_local3);
_root.playSound("Extra Deal");
_root.lastDealWarningIssued = false;
}
function extrared_bombClick() {
if (_root.mainTable.isEmpty()) {
playSound("Illegal Click");
return(undefined);
}
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
this.mouse_over_elem.removeMovieClip();
extrasAddTip("red_bomb");
_root.playSound("tool_message.wav");
_root.mainExtras.remove(this.idx);
_root.onMouseDown = _root.redBombOnTileClick;
_root.lastDealWarningIssued = false;
}
function redBombOnTileClick() {
var _local3 = _root.mainTable.getSlotIdxFromCursor();
if ((_local3 == undefined) || (_root.mainTable.getCard(_local3) == undefined)) {
playSound("Illegal Click");
return(undefined);
}
_root.playSound("red_bomb.wav");
_root.mainTable.setCard(_local3, eval("NULL"));
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("red_bomb_effect", dummy, _root.getNextDepth());
_local2.swapDepths(16500);
var _local4 = _root.mainTable.getTileEffectCoords(_local3);
_local2._x = _local4._x;
_local2._y = _local4._y;
_root.tutorialNotifyExtraDealClicked();
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function extrablue_bombClick() {
if (!_root.mainTable.hasConstraints()) {
playSound("Illegal Click");
return(undefined);
}
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
this.mouse_over_elem.removeMovieClip();
extrasAddTip("blue_bomb");
_root.playSound("tool_message.wav");
_root.mainExtras.remove(this.idx);
_root.onMouseDown = _root.blueBombOnTileClick;
_root.lastDealWarningIssued = false;
}
function blueBombOnTileClick() {
var _local3 = _root.mainTable.getConstraintIdxFromCursor();
if (_local3 == undefined) {
playSound("Illegal Click");
return(undefined);
}
_root.playSound("blue_bomb.wav");
_root.mainTable.setConstraint(_local3, eval("NULL"));
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("blue_bomb_effect", dummy, _root.getNextDepth());
_local2.swapDepths(16500);
var _local4 = _root.mainTable.getSliceEffectCoords(_local3);
_local2._x = _local4._x;
_local2._y = _local4._y;
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function extraswitchClick() {
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
this.mouse_over_elem.removeMovieClip();
extrasAddTip("switch");
_root.playSound("tool_message.wav");
_root.mainExtras.remove(this.idx);
_root.onMouseDown = _root.switchOnTileClick;
_root.lastDealWarningIssued = false;
}
function switchOnTileClick() {
var _local2 = _root.mainTable.getSlotIdxFromCursor();
if ((_local2 != undefined) && (_root.mainTable.getCard(_local2) != undefined)) {
if (!switchTableTile(_local2)) {
playSound("Illegal Click");
return(undefined);
}
} else {
_local2 = _root.mainDeck.getSlotIdxFromCursor();
if (_local2 != undefined) {
switchDeckTile(_local2);
} else {
playSound("Illegal Click");
return(undefined);
}
}
_root.playSound("switch.wav");
_root.tutorialNotifyExtraDealClicked();
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function switchDeckTile(idx) {
var _local2 = _root.mainDeck.getCard(idx).cardval;
var _local3 = new cardObj(_local2.rightColor, _local2.rightShape, _local2.leftColor, _local2.leftShape);
_root.setFadein(_root.mainDeck.setCard(idx, _local3), 4);
}
function switchTableTile(idx) {
var _local2 = _root.mainTable.getCard(idx);
var _local4 = new cardObj(_local2.rightColor, _local2.rightShape, _local2.leftColor, _local2.leftShape);
_root.mainTable.setCard(idx, undefined);
if (_root.mainTable.illegalPlacement(idx, _local4, -1)) {
_root.mainTable.setCard(idx, _local2);
return(false);
}
_root.setFadein(_root.mainTable.setCard(idx, _local4), 4);
return(true);
}
function extrajokerClick() {
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
this.mouse_over_elem.removeMovieClip();
_root.playSound("tool_message.wav");
_root.mainExtras.remove(this.idx);
extrasAddTip("joker");
_root.onMouseDown = _root.jokerOnTileClick;
_root.lastDealWarningIssued = false;
}
function jokerOnTileClick() {
var _local2 = _root.mainTable.getSlotIdxFromCursor();
var _local3 = _root.mainDeck.getSlotIdxFromCursor();
if (((_local2 == undefined) || (_root.mainTable.getCard(_local2) == undefined)) && (_local3 == undefined)) {
playSound("Illegal Click");
return(undefined);
}
if (_local2 != undefined) {
_root.mainTable.setJoker(_local2);
} else {
_root.mainDeck.setJoker(_local3);
}
_root.playSound("joker.wav");
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function extraDealMO() {
if (_root.mainExtras.mActive == false) {
return(undefined);
}
if (this.mouse_over_elem == undefined) {
this.mouse_over_elem = _root.getReggedStageMC();
this.mouse_over_elem.swapDepths(17020);
this.mouse_over_elem.attachMovie(this.tip, "msg", 17020);
this.mouse_over_elem._x = this._x - 53;
this.mouse_over_elem._y = this._y - 128;
this.mouse_over_elem._alpha = 0;
_root.setFadein(this.mouse_over_elem, 10);
}
}
function extraDealMOut() {
this.mouse_over_elem.removeMovieClip();
this.mouse_over_elem = undefined;
}
function transformClick(extradeal, color, shape) {
_root.mainExtras.deactivate();
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
extradeal.mouse_over_elem.removeMovieClip();
_root.playSound("tool_message.wav");
_root.mainExtras.remove(extradeal.idx);
_root.transformToColor = color;
_root.transformToShape = shape;
if (color != undefined) {
extrasAddTip(color + "_transform");
}
if (shape != undefined) {
extrasAddTip(shape + "_transform");
}
_root.onMouseDown = _root.transformOnTileClick;
_root.lastDealWarningIssued = false;
}
function transformOnTileClick() {
var _local2 = _root.mainTable.getSlotIdxAndSideFromCursor();
var _local3 = _root.mainDeck.getSlotIdxAndSideFromCursor();
if (((_local2 == undefined) || (_root.mainTable.getCard(_local2.idx) == undefined)) && (_local3 == undefined)) {
playSound("Illegal Click");
return(false);
}
if (_local2 != undefined) {
if (!transformTableTile(_local2.idx, _local2.leftSide)) {
return(undefined);
}
} else {
transformDeckTile(_local3.idx, _local3.leftSide);
}
_root.playSound("transform.wav");
_root.mainExtras.activate();
_root.mainDeck.activate();
_root.mainTable.activate();
extrasRemoveTip();
_root.onMouseDown = undefined;
}
function transformTableTile(idx, left) {
var _local3 = _root.mainTable.getCard(idx);
var _local2 = new cardObj(_local3.leftColor, _local3.leftShape, _local3.rightColor, _local3.rightShape);
if (left) {
if (_root.transformToColor != undefined) {
_local2.leftColor = _root.transformToColor;
}
if (_root.transformToShape != undefined) {
_local2.leftShape = _root.transformToShape;
}
} else {
if (_root.transformToColor != undefined) {
_local2.rightColor = _root.transformToColor;
}
if (_root.transformToShape != undefined) {
_local2.rightShape = _root.transformToShape;
}
}
_root.mainTable.setCard(idx, undefined);
if (_root.mainTable.illegalPlacement(idx, _local2, -1)) {
_root.mainTable.setCard(idx, _local3);
playSound("Illegal Click");
return(false);
}
var _local4 = _root.mainTable.setCard(idx, _local2);
if (left) {
if (_root.transformToColor != undefined) {
_root.setFadein(_local4.leftColor, 4);
}
if (_root.transformToShape != undefined) {
_root.setFadein(_local4.leftShape, 4);
}
} else {
if (_root.transformToColor != undefined) {
_root.setFadein(_local4.rightColor, 4);
}
if (_root.transformToShape != undefined) {
_root.setFadein(_local4.rightShape, 4);
}
}
return(true);
}
function transformDeckTile(idx, left) {
var _local4 = _root.mainDeck.getCard(idx).cardval;
var _local2 = new cardObj(_local4.leftColor, _local4.leftShape, _local4.rightColor, _local4.rightShape);
if (left) {
if (_root.transformToColor != undefined) {
_local2.leftColor = _root.transformToColor;
}
if (_root.transformToShape != undefined) {
_local2.leftShape = _root.transformToShape;
}
} else {
if (_root.transformToColor != undefined) {
_local2.rightColor = _root.transformToColor;
}
if (_root.transformToShape != undefined) {
_local2.rightShape = _root.transformToShape;
}
}
var _local3 = _root.mainDeck.setCard(idx, _local2);
if (left) {
if (_root.transformToColor != undefined) {
_root.setFadein(_local3.leftColor, 4);
}
if (_root.transformToShape != undefined) {
_root.setFadein(_local3.leftShape, 4);
}
} else {
if (_root.transformToColor != undefined) {
_root.setFadein(_local3.rightColor, 4);
}
if (_root.transformToShape != undefined) {
_root.setFadein(_local3.rightShape, 4);
}
}
return(true);
}
function extrablue_transformClick() {
transformClick(this, "blue", undefined);
}
function extragreen_transformClick() {
transformClick(this, "green", undefined);
}
function extrared_transformClick() {
transformClick(this, "red", undefined);
}
function extrayellow_transformClick() {
transformClick(this, "yellow", undefined);
}
function extraluna_transformClick() {
transformClick(this, undefined, "luna");
}
function extraterra_transformClick() {
transformClick(this, undefined, "terra");
}
function extrasol_transformClick() {
transformClick(this, undefined, "sol");
}
function extrastella_transformClick() {
transformClick(this, undefined, "stella");
}
function extrasAddTip(name) {
_root.extra_tip_mc = _root.getReggedStageMC();
with (_root.extra_tip_mc) {
attachMovie(name + "_tip_mc", "dummy", 10000);
_x = 320;
_y = 60;
}
}
function extrasRemoveTip() {
removeMovieClip(_root.extra_tip_mc);
}
function getRandomTip() {
return(tips[int(Math.random() * tips.length)]);
}
function getInstruction(idx) {
if (instructions.length <= idx) {
return(undefined);
}
return(instructions[idx]);
}
function rpnInit() {
var _local3 = new TextFormat();
_local3.font = "AndalusNumbers";
_local3.bold = true;
_local3.size = 18;
var _local2 = _root.points_txt;
_local3.color = 7623171 /* 0x745203 */;
_local2.setNewTextFormat(_local3);
_local2.setTextFormat(_local3);
_local2.sharpness = 0;
_local2.antiAliasType = "advanced";
_local2.selectable = false;
_local2.embedFonts = true;
_local2 = _root.level_txt;
_local3.color = 4203023 /* 0x40220F */;
_local2.setNewTextFormat(_local3);
_local2.setTextFormat(_local3);
_local2.sharpness = 0;
_local2.antiAliasType = "advanced";
_local2.selectable = false;
_local2.embedFonts = true;
_local2 = _root.total_points_txt;
_local3.color = 7672066 /* 0x751102 */;
_local2.setNewTextFormat(_local3);
_local2.setTextFormat(_local3);
_local2.sharpness = 0;
_local2.antiAliasType = "advanced";
_local2.selectable = false;
_local2.embedFonts = true;
_local2 = _root.instructions_txt;
_local3.font = "Calligraphic";
_local3.size = 14;
_local3.color = 7672066 /* 0x751102 */;
_local3.align = "left";
_local2.setNewTextFormat(_local3);
_local2.setTextFormat(_local3);
_local2.sharpness = 0;
_local2.antiAliasType = "advanced";
_local2.selectable = false;
_local2.embedFonts = true;
var _local4 = new Array(185, 185, 195, 205, 220);
var _local5 = new Array(368, 388, 408, 428, 448);
_root.mainExtras = new rpnExtraDeals(47, 350, _local4, _local5);
}
function rpnGameOver() {
return((_root.mainTable.isFull() || (_root.mainDeck.isEmpty())) || ((_root.mainTimer != undefined) && (_root.mainTimer.isTimeElapsed())));
}
function rpnGameWon() {
return(_root.rpnGameOver() && (_root.mainTable.getScore() == 48));
}
function rpnGameLost() {
return(_root.rpnGameOver() && (!_root.rpnGameWon()));
}
function rpnNewGame(level, baseScore, from_quest) {
if ((level == 1) && (from_quest != false)) {
from_quest = true;
}
if (level > 0) {
_root.kongregateStats.submit("Level", level);
}
if (from_quest) {
_root.levelDone = false;
}
_root.onMouseDown = undefined;
_root.onMouseUp = undefined;
_root.level_txt.text = level;
_root.currentLevel = level;
_root.baseScore = baseScore;
_root.bonusesGiven = false;
_root.roundBonusPoints = 0;
if (from_quest) {
_root.clearStage();
}
if (!_root.isTutorialRunning()) {
_root.tutorial_txt.text = "";
} else {
_root.tutorial_text_bg_mc = _root.getReggedStageMC();
_root.tutorial_text_bg_mc.swapDepths(_root.tutorial_txt);
tutorial_text_bg_mc.attachMovie("tutorial_text_bg_mc", "bg_mc", 10000);
tutorial_text_bg_mc._x = 38;
tutorial_text_bg_mc._y = 376;
}
_root.mainExtras.activate();
_root.mainExtras.refresh();
_root.lastDealWarningIssued = false;
_root.highScoresUpdated = false;
if (level == 1) {
_root.kongregateServices.connect();
}
if (((from_quest != true) && (!_root.isTutorialRunning())) && (_root.currentLevel <= 30)) {
rpnLoadQuestScreen();
return(undefined);
}
_root.levelUpdated = false;
inGame = true;
_root.game_bg_mc2 = _root.getReggedStageMC();
_root.game_bg_mc2.swapDepths(-16383);
_root.game_bg_mc2._alpha = 100;
var _local5 = int((level - 1) / 10) + 1;
if (_local5 > 3) {
_local5 = 3;
}
if (_root.isTutorialRunning()) {
_local5 = 0;
}
_root.game_bg_mc2.attachMovie(("game_bg" + _local5) + "_mc", "bg", -5000);
_root.game_bg_mc2._x = 0;
_root.game_bg_mc2._y = 0;
if (_root.currentLevel <= 30) {
_root.dragon_mc = _root.getReggedStageMC();
_root.dragon_mc.attachMovie("dragon_fire_bad_mc", "movie", _root.getNextDepth());
_root.dragon_mc._x = -2;
_root.dragon_mc._y = 0;
_root.dragon_mc.movie.gotoAndStop(1);
} else {
_root.dragon_mc.removeMovieClip("movie");
}
_root.victory_mc = _root.getReggedStageMC();
_root.victory_mc.attachMovie("Star Burst", "movie", _root.getNextDepth());
_root.victory_mc._x = 0;
_root.victory_mc._y = 0;
_root.victory_mc.movie.gotoAndStop("start");
_root.wizard_wand_mc = _root.getReggedStageMC();
_root.wizard_wand_mc.swapDepths(1000);
_root.wizard_wand_mc.attachMovie("Wand", "movie", 1000);
_root.wizard_wand_mc._x = 0;
_root.wizard_wand_mc._y = 0;
_root.wizard_wand_mc.movie.onlyOnce = true;
_root.wizard_wand_mc.movie.gotoAndStop("prestart");
_root.text_highlight_mc = _root.getReggedStageMC();
_root.text_highlight_mc.attachMovie("Text Highlight", "movie", _root.getNextDepth());
_root.text_highlight_mc._x = -8;
_root.text_highlight_mc._y = -6;
_root.text_highlight_mc.movie.gotoAndStart("start");
if (_root.gameMode == "survival") {
rpnInitTimer();
} else {
_root.mainTimer = undefined;
}
_root.resetTableAndDeck();
rpnStopSynergies(false);
_root.won_this_round_txt._visible = false;
_root.setSynergy();
var _local4 = _root.generateConstraints(_root.level_txt.text, _root.mainTable.mSlotsNum);
var _local2 = 0;
while (_local2 < _local4.length) {
_root.mainTable.setConstraint(_local4[_local2].idx, _local4[_local2].cnstr);
_local2++;
}
_root.rpnPlayBGMusic(undefined);
_root.playSequencedSound("StartGame", _root.moveToGameMusic);
_root.addExtrasByLevel(level);
_root.instructions_txt.text = "";
_root.hasBonuses = false;
_root.currInstructionIdx = 0;
if (!_root.isTutorialRunning()) {
_root.setInstructionsColor(1399040, 14);
_root.rpnSetTextMessage(("Level " + level) + " begins!\n");
if (level == 1) {
_root.setInstructionsColor(7672066, 14);
_root.currInstructionIdx = 1;
_root.textIsInstruction = true;
_root.rpnAddTextMessage("1. " + _root.getInstruction(0));
}
if (level == 2) {
_root.setInstructionsColor(7672066, 14, true, -0.5);
_root.rpnAddTextMessage("The triangle in the inner circle is a \"limiter\". The two tiles you put next to it have to match the way the limiter shows. This limiter is a \"color\" limiter - the two tiles must have matching colors.\n");
}
if (level == 4) {
_root.setInstructionsColor(7672066, 14);
_root.rpnAddTextMessage("Every synergic match you create this round will get you special bonuses. You can see the synergic couple on the right, above the level box.");
}
if (level == 10) {
_root.setInstructionsColor(7672066, 14);
_root.rpnAddTextMessage("From now on, you will get special power-ups every 5 levels - \"transform tools\". These tools can change one color or one symbol to another.");
}
}
_root.loadMouse();
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
DeactivateDeal();
_root.menu_mc.onRelease = undefined;
_root.menu_mc.enabled = false;
_root.deal_mc.enabled = false;
_root.tip_btn.enabled = false;
if (!(((((((level == 1) || (level == 10)) || (level == 15)) || (level == 20)) || (level == 25)) || (level == 30)) || (level > 30))) {
_root.rpnNotifyExtrasAdded();
}
if (level != 0) {
_root.lastGameWasTutorial = false;
}
}
function resetTableAndDeck() {
var tableSlots = Array();
tableSlots.push("dummy");
var i = 1;
while (i <= 8) {
tableSlots.push(eval (("_root.circleSlot" + i) + "_mc"));
i++;
}
_root.mainDeck.unsetExtras();
delete _root.mainTable;
_root.mainTable = new rpnTable(8, tableSlots);
delete _root.mainDeck;
_root.mainDeck = new rpnDeck(4);
}
function rpnReset() {
_root.mainExtras.reset();
_root.mainTable.reset();
_root.mainDeck.reset();
inGame = false;
}
function rpnPlayBGMusic(name) {
if (_root.bgmusic_on != name) {
_root.bgmusic_sound.stop();
delete _root.bgmusic_sound;
_root.bgmusic_sound = new Sound();
_root.bgmusic_sound.attachSound(name);
if (_root.bgMusicEnabled) {
_root.bgmusic_sound.start(0, 100000);
}
_root.bgmusic_on = name;
}
}
function rpnEnableBGMusic() {
_root.bgMusicEnabled = true;
_root.bgmusic_sound.start(0, 100000);
}
function rpnDisableBGMusic() {
_root.bgMusicEnabled = false;
_root.bgmusic_sound.stop();
}
function rpnEnableSounds() {
_root.bgSoundsEnabled = true;
}
function rpnDisableSounds() {
_root.bgSoundsEnabled = false;
}
function rpnHandleGameWon() {
inGame = false;
_root.endTutorial();
_root.mainDeck.unsetExtras();
_root.mainTimer.suspendTimer();
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
_root.DeactivateDeal();
_root.menu_mc.onRelease = undefined;
_root.menu_mc.enabled = false;
_root.tip_btn.enabled = false;
if (_root.currentLevel <= 30) {
_root.dragon_mc.removeMovieClip("movie");
_root.dragon_mc = _root.getReggedStageMC();
_root.dragon_mc.swapDepths(20499);
_root.dragon_mc.attachMovie("dragon_fire_good_mc", "movie", _root.getNextDepth());
_root.dragon_mc._x = -2;
_root.dragon_mc._y = 0;
_root.dragon_mc.movie.gotoAndPlay(1);
} else {
_root.raiseGameWonSign();
}
}
function rpnHandleBonuses() {
var _local5 = false;
var _local2 = getHarmonicPoints();
if (_local2 != undefined) {
_root.addExtraDeals(2, _local2.D2);
_root.addExtraDeals(3, _local2.D3);
_root.addExtraDeals(4, _local2.D4);
_root.addExtraBonuses("red_bomb", _local2.RB);
_root.addExtraBonuses("switch", _local2.SW);
_root.addExtraBonuses("joker", _local2.JO);
_root.addExtraBonuses("blue_bomb", _local2.BB);
if (((((((_local2.D2 > 0) || (_local2.D3 > 0)) || (_local2.D4 > 0)) || (_local2.RB > 0)) || (_local2.SW > 0)) || (_local2.JO > 0)) || (_local2.BB > 0)) {
_local5 = true;
}
_root.roundBonusPoints = _root.roundBonusPoints + Number(_local2.points);
}
var _local3 = getPoolPoints();
_root.addExtraDeals(2, _local3.D2);
_root.addExtraDeals(3, _local3.D3);
_root.addExtraDeals(4, _local3.D4);
_root.addExtraBonuses("red_bomb", _local3.RB);
_root.addExtraBonuses("switch", _local3.SW);
_root.addExtraBonuses("joker", _local3.JO);
_root.addExtraBonuses("blue_bomb", _local3.BB);
if (((((((_local3.D2 > 0) || (_local3.D3 > 0)) || (_local3.D4 > 0)) || (_local3.RB > 0)) || (_local3.SW > 0)) || (_local3.JO > 0)) || (_local3.BB > 0)) {
_local5 = true;
}
_root.roundBonusPoints = _root.roundBonusPoints + Number(_local3.points);
var _local7 = _root.hasBonuses;
var _local4 = getSynergyPoints();
_root.addExtraDeals(2, _local4.D2);
_root.addExtraDeals(3, _local4.D3);
_root.addExtraDeals(4, _local4.D4);
if (((_local4.D2 > 0) || (_local4.D3 > 0)) || (_local4.D4 > 0)) {
_local5 = true;
}
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
if (_root.mainTimer != undefined) {
var _local6 = int(_root.mainTimer.remainingSeconds()) * 2;
if (_local6 > 0) {
_root.addSpecialSetsMsg("Survival time bonus, ", _local6, 0, 0, 0, 0, 0, 0, 0);
}
_root.roundBonusPoints = _root.roundBonusPoints + _local6;
}
if (!_local7) {
_root.setInstructionsColor(1510, 14);
_root.rpnAddTextMessage("Don't forget: creating special sets will get you special bonuses!\n");
}
_root.setInstructionsColor(617, 16, false);
_root.rpnAddTextMessage("Click anywhere to continue\n");
if (!_local5) {
_root.rpnNotifyExtrasAdded();
}
clearInterval(_root.bonusIntervalId);
_root.bonusesGiven = true;
}
function dragonDefeatedAfterEffect() {
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("end_game_mc", "dummy", 15000);
_local2.swapDepths(15000);
_local2._x = -23.6;
_local2._y = -52.1;
}
function rpnInitTimer() {
_root.timer_green_bg_mc = _root.getReggedStageMC();
_root.timer_green_bg_mc.swapDepths(18702);
with (_root.timer_green_bg_mc) {
attachMovie("timer_green_bg_mc", "movie", 18702);
_x = 503;
_y = 63;
}
_root.timer_mask_mc = _root.getReggedStageMC();
_root.timer_mask_mc.swapDepths(18701);
with (_root.timer_mask_mc) {
attachMovie("timer_mask_mc", "movie", 18701);
_x = 503;
_y = 63;
}
_root.timer_green_bg_mc.setMask(_root.timer_mask_mc);
_root.mainTimer = new cpiTimer(_root.timer_mask_mc);
var timerLength = (Math.min(120 + (4 * _root.currentLevel), 240) * 1000);
_root.mainTimer.startTimer(timerLength);
_root.mainTimer.suspendTimer();
_root.timer_mc = _root.getReggedStageMC();
_root.timer_mc.swapDepths(18700);
with (_root.timer_mc) {
attachMovie("timer_bg_mc", "movie", 18700);
_x = 503;
_y = 63;
}
}
function rpnHandleGameLost() {
inGame = false;
_root.endTutorial();
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
DeactivateDeal();
_root.menu_mc.onRelease = undefined;
_root.menu_mc.enabled = false;
_root.mainDeck.unsetExtras();
_root.mainTimer.suspendTimer();
_root.rpnPlayBGMusic(undefined);
_root.dragon_mc.swapDepths(22000);
if (_root.currentLevel <= 30) {
_root.dragon_mc.movie.gotoAndPlay(2);
} else {
_root.raiseGameOverSign();
}
}
function raiseGameOverSign() {
_root.playSequencedSound("Game Over", _root.moveToBGMusic);
if (_root.currentLevel <= 30) {
_root.setInstructionsColor(7672066, 14);
_root.rpnSetTextMessage("The ring was not strong enough to stop the dragon and you have been incinerated...\n");
_root.playSound("New Message");
}
_root.setInstructionsColor(1510, 30);
_root.rpnAddTextMessage("Game Over\n");
_root.setInstructionsColor(1510, 14);
_root.rpnAddTextMessage("Click anywhere to continue\n");
_root.onMouseUp = rpnLostClick;
}
function raiseGameWonSign() {
_root.victory_mc.movie.play();
_root.playSound("Ring Complete");
_root.instructions_txt.text = "";
_root.instructions_txt.filters = filter;
_root.setInstructionsColor(622336, 18, true);
_root.rpnSetTextMessage(newline);
_root.setWonColor();
_root.won_this_round_txt._visible = true;
_root.playSound("New Message");
if (!_root.lastGameWasTutorial) {
_root.bonusIntervalId = setInterval(rpnHandleBonuses, 1000);
} else {
trace("No bonuses for tutorial");
_root.rpnNotifyExtrasAdded();
_root.bonusesGiven = true;
}
}
function moveToBGMusic() {
_root.rpnPlayBGMusic("background_music");
}
function moveToGameMusic() {
_root.rpnPlayBGMusic("game_music");
}
function rpnDealClicked() {
_root.playSound("button1.wav");
_root.tutorialNotifyDealClicked();
if (!_root.rpnGameOver()) {
_root.handleDealClickGameNotOver();
return(undefined);
}
if (_root.lastGameWasTutorial) {
_root.mainExtras.reset();
_root.rpnNewGame(1, 0, false);
return(undefined);
}
if (_root.rpnGameWon()) {
_root.baseScore = _root.baseScore + Number(_root.points_txt.text);
_root.currentLevel++;
_root.rpnNewGame(_root.currentLevel, _root.baseScore);
return(undefined);
}
if (!_root.highScoresUpdated) {
if (_root.handleHighScoresUpdate()) {
return(undefined);
}
}
_root.mainExtras.reset();
_root.jumpToEntry();
}
function setInstructionsColor(color, size, isBold, letterSpacing) {
if (isBold == undefined) {
isBold = true;
}
if (letterSpacing == undefined) {
letterSpacing = 0;
}
var _local2 = new TextFormat();
_local2.font = "Calligraphic";
_local2.bold = isBold;
_local2.size = size;
_local2.letterSpacing = letterSpacing;
var _local3 = _root.instructions_txt;
_local2.color = color;
_local3.setNewTextFormat(_local2);
_local3.sharpness = 0;
_local3.antiAliasType = "advanced";
_local3.selectable = false;
_local3.embedFonts = true;
}
function setWonColor() {
color = 622336 /* 0x097F00 */;
size = 18;
bold = true;
if (isBold == undefined) {
isBold = true;
}
if (letterSpacing == undefined) {
letterSpacing = 0;
}
var _local2 = new TextFormat();
_local2.font = "Calligraphic";
_local2.bold = isBold;
_local2.size = size;
_local2.letterSpacing = letterSpacing;
var _local3 = _root.instructions_txt;
_local2.color = color;
_local3.setNewTextFormat(_local2);
_local3.sharpness = 0;
_local3.antiAliasType = "advanced";
_local3.selectable = false;
_local3.embedFonts = true;
}
function setTipColor(color, size) {
var _local2 = new TextFormat();
_local2.font = "Calligraphic";
_local2.bold = true;
_local2.size = size;
_local2.letterSpacing = 0;
var _local3 = _root.tips_box.movie.tip_txt;
_local2.color = color;
_local3.setNewTextFormat(_local2);
_local3.sharpness = 0;
_local3.antiAliasType = "advanced";
_local3.selectable = false;
_local3.embedFonts = true;
}
function rpnAddTextMessage(msg) {
if (_root.currentLevel == 0) {
return(undefined);
}
_root.textIsIntstruction = false;
_root.instructions_txt.replaceText(10000, 10000, msg);
}
function rpnSetTextMessage(msg) {
if (_root.currentLevel == 0) {
return(undefined);
}
_root.textIsInstruction = false;
_root.instructions_txt.text = msg;
}
function rpnSetInstructionTextMessage(msg) {
if (_root.currentLevel == 0) {
return(undefined);
}
_root.textIsInstruction = true;
_root.instructions_txt.text = msg;
}
function updateInstructionInWindow() {
if (!_root.textIsInstruction) {
_root.currInstructionIdx = 0;
}
var _local2 = _root.currInstructionIdx + 1;
var _local3 = _root.getInstruction(_local2 - 1);
if (_local3 == undefined) {
_root.currInstructionIdx = 0;
updateInstructionInWindow();
return(undefined);
}
_root.setInstructionsColor(7672066, 14);
rpnSetInstructionTextMessage((_local2 + ". ") + _local3);
_root.currInstructionIdx++;
}
function DeactivateDeal() {
_root.deal_mc.onPress = undefined;
}
function ActivateDeal() {
_root.deal_mc.onPress = _root.rpnDealClicked;
}
function rpnNotifyExtrasAdded() {
if (_root.rpnGameOver()) {
if (_root.currentLevel == 30) {
var _local2 = _root.getReggedStageMC();
_local2.attachMovie("end_game_mc", "dummy", 15000);
_local2.swapDepths(15000);
_local2._x = -25.5;
_local2._y = -51;
}
_root.deal_mc.onPress = undefined;
if (_root.currentLevel < 30) {
_root.onMouseUp = _root.rpnDealClicked;
} else {
_root.onMouseUp = _root.rpnNextRoundAfter30;
}
} else {
_root.mainTable.activate();
_root.mainDeck.activate();
_root.mainExtras.activate();
_root.mainTimer.resumeTimer();
_root.menu_mc.onRelease = rpnMenuReleased;
_root.menu_mc.enabled = true;
_root.deal_mc.enabled = true;
_root.tip_btn.enabled = true;
ActivateDeal();
}
}
function rpnLoadQuestScreen(level) {
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
_root.tip_btn.enabled = false;
if (level == undefined) {
level = _root.currentLevel;
}
_root.quest_screen_mc = _root.getReggedStageMC();
_root.quest_screen_mc.attachMovie("quest_screen_mc", "dummy", 23000);
_root.quest_screen_mc.swapDepths(23000);
_root.quest_screen_mc._x = 0;
_root.quest_screen_mc._y = 0;
var _local7 = 106;
var _local9 = 320;
var _local8 = 214;
var _local2 = 1;
while (_local2 <= 30) {
var _local3 = _root.quest_screen_mc.attachMovie("circle_mc", "sand_circle" + _local2, 23000 + _local2);
var _local5 = 0.190399554763018;
var _local4 = _local2 * _local5;
if (_local2 > 10) {
_local4 = _local4 + _local5;
}
if (_local2 > 20) {
_local4 = _local4 + _local5;
}
_local3._x = _local9 + (_local7 * Math.sin(_local4));
_local3._y = _local8 - (_local7 * Math.cos(_local4));
if (_local2 < level) {
_local3.gotoAndStop("big");
}
if (_local2 > level) {
_local3.gotoAndStop("small");
}
if (_local2 == level) {
_local3.gotoAndPlay("small");
}
_local2++;
}
var _local10 = new mx.transitions.Tween(_root.quest_screen_mc, "_alpha", mx.transitions.easing.Regular.easeIn, 0, 100, 1, 1);
_local10.onMotionFinished = function () {
_root.quest_screen_mc.dummy.next_quest_txt.text = _root.quest_screen_mc.next_txt;
};
}
function rpnNextRound() {
rpnNewGame(_root.currentLevel, _root.baseScore, true);
}
function rpnNextRoundAfter30() {
_root.baseScore = _root.baseScore + Number(_root.points_txt.text);
_root.currentLevel++;
rpnNextRound();
}
function rpnLostClick() {
_root.onMouseUp = undefined;
_root.rpnDealClicked();
}
function rpnStopSynergies(remove) {
var i = 1;
while (i <= 8) {
var li = ((i == 8) ? 1 : (i + 1));
var synergyName = ((("synergy" + i) + li) + "_mc");
var synergy = eval ("_root." + synergyName);
synergy.gotoAndStop(1);
synergy.running = false;
var barName = ((("bar" + i) + li) + "_mc");
var bar = eval ("_root." + barName);
bar.gotoAndStop(1);
bar.running = false;
bar._visible = false;
if (remove == true) {
removeMovieClip(synergy);
removeMovieClip(bar);
}
i++;
}
}
function rpnMenuReleased() {
if (_root.gameMenu_mc != undefined) {
return(undefined);
}
_root.playSound("button1.wav");
if (_root.rpnGameOver()) {
if (_root.handleHighScoresUpdate()) {
return(undefined);
}
}
_root.inGameMenuDisabled = false;
_root.mainTable.deactivate();
_root.mainDeck.deactivate();
_root.mainExtras.deactivate();
_root.DeactivateDeal();
_root.mainTimer.suspendTimer();
_root.menu_mc.enabled = false;
_root.deal_mc.enabled = false;
_root.tip_btn.enabled = false;
_root.gameMenu_mc = _root.getReggedStageMC();
var _local2 = _root.gameMenu_mc;
_local2.swapDepths(21000);
_local2.attachMovie("inGameMenu_mc", "movie", 21000);
_local2._x = 0;
_local2._y = 0;
_root.setFadein(_local2, 10);
}
function getHarmonicPoints() {
var _local2 = new Object();
var _local6 = _root.mainTable.countTiles();
_local2.points = 0;
_local2.D2 = 0;
_local2.D3 = 0;
_local2.D4 = 0;
_local2.RB = 0;
_local2.SW = 0;
_local2.JO = 0;
_local2.BB = 0;
var _local3 = getHarmonicPointsDouble(_local6);
var _local5 = getHarmonicPointsSingleSymbol(_local6);
var _local4 = getHarmonicPointsSingleColor(_local6);
if (_local3.len > 1) {
_local2.points = _local2.points + _local3.points;
_local2.D2 = _local2.D2 + _local3.D2;
_local2.D3 = _local2.D3 + _local3.D3;
_local2.D4 = _local2.D4 + _local3.D4;
_local2.RB = _local2.RB + _local3.RB;
_local2.SW = _local2.SW + _local3.SW;
_local2.JO = _local2.JO + _local3.JO;
_local2.BB = _local2.BB + _local3.BB;
var _local7 = ((_local3.len == 2) ? "Doubles Harmony, " : (((_local3.len == 3) ? "Double Triples Harmony, " : "Full Harmony, ")));
_root.addSpecialSetsMsg(_local7, _local3.points, _local3.D2, _local3.D3, _local3.D4, _local3.RB, _local3.SW, _local3.JO, _local3.BB);
}
if (_local5.len > _local3.len) {
_local2.points = _local2.points + _local5.points;
_local2.D2 = _local2.D2 + _local5.D2;
_local2.D3 = _local2.D3 + _local5.D3;
_local2.D4 = _local2.D4 + _local5.D4;
_local2.RB = _local2.RB + _local5.RB;
_local2.SW = _local2.SW + _local5.SW;
_local2.JO = _local2.JO + _local5.JO;
_local2.BB = _local2.BB + _local5.BB;
var _local7 = ((_local5.len == 2) ? "Symbols Harmony, " : (((_local5.len == 3) ? "Symbol Triples Harmony, " : "Symbol Quadruples Harmony, ")));
_root.addSpecialSetsMsg(_local7, _local5.points, _local5.D2, _local5.D3, _local5.D4, _local5.RB, _local5.SW, _local5.JO, _local5.BB);
}
if (_local4.len > _local3.len) {
_local2.points = _local2.points + _local4.points;
_local2.D2 = _local2.D2 + _local4.D2;
_local2.D3 = _local2.D3 + _local4.D3;
_local2.D4 = _local2.D4 + _local4.D4;
_local2.RB = _local2.RB + _local4.RB;
_local2.SW = _local2.SW + _local4.SW;
_local2.JO = _local2.JO + _local4.JO;
_local2.BB = _local2.BB + _local4.BB;
var _local7 = ((_local4.len == 2) ? "Colors Harmony, " : (((_local4.len == 3) ? "Color Triples Harmony, " : "Color Quadruples Harmony, ")));
_root.addSpecialSetsMsg(_local7, _local4.points, _local4.D2, _local4.D3, _local4.D4, _local4.RB, _local4.SW, _local4.JO, _local4.BB);
}
return(_local2);
}
function getHarmonicPointsDouble(tilesCnt) {
var _local5 = new Array(2, 3, 4);
var _local13 = new Array(30, 400, 2000);
var _local12 = new Array(0, 0, 0);
var _local11 = new Array(0, 1, 0);
var _local10 = new Array(0, 0, 4);
var _local8 = new Array(0, 0, 1);
var _local6 = new Array(0, 0, 1);
var _local7 = new Array(0, 0, 1);
var _local9 = new Array(0, 1, 1);
var _local2 = new Object();
_local2.len = 0;
var _local1 = _local5.length - 1;
while (_local1 >= 0) {
var _local4 = _local5[_local1];
if ((Math.min(Math.min(tilesCnt.sol, tilesCnt.luna), Math.min(tilesCnt.terra, tilesCnt.stella)) >= _local4) && (Math.min(Math.min(tilesCnt.red, tilesCnt.green), Math.min(tilesCnt.yellow, tilesCnt.blue)) >= _local4)) {
_local2.len = _local4;
_local2.points = _local13[_local1];
_local2.D2 = _local12[_local1];
_local2.D3 = _local11[_local1];
_local2.D4 = _local10[_local1];
_local2.RB = _local8[_local1];
_local2.SW = _local6[_local1];
_local2.JO = _local7[_local1];
_local2.BB = _local9[_local1];
break;
}
_local1--;
}
return(_local2);
}
function getHarmonicPointsSingleSymbol(tilesCnt) {
var _local5 = new Array(3, 4);
var _local13 = new Array(160, 1000);
var _local12 = new Array(0, 0);
var _local11 = new Array(0, 2);
var _local10 = new Array(0, 1);
var _local8 = new Array(0, 0);
var _local6 = new Array(0, 0);
var _local7 = new Array(0, 1);
var _local9 = new Array(0, 0);
var _local2 = new Object();
_local2.len = 0;
var _local1 = _local5.length - 1;
while (_local1 >= 0) {
var _local4 = _local5[_local1];
if (Math.min(Math.min(tilesCnt.sol, tilesCnt.luna), Math.min(tilesCnt.terra, tilesCnt.stella)) >= _local4) {
_local2.len = _local4;
_local2.points = _local13[_local1];
_local2.D2 = _local12[_local1];
_local2.D3 = _local11[_local1];
_local2.D4 = _local10[_local1];
_local2.RB = _local8[_local1];
_local2.SW = _local6[_local1];
_local2.JO = _local7[_local1];
_local2.BB = _local9[_local1];
break;
}
_local1--;
}
return(_local2);
}
function getHarmonicPointsSingleColor(tilesCnt) {
var _local5 = new Array(3, 4);
var _local13 = new Array(120, 900);
var _local12 = new Array(0, 1);
var _local11 = new Array(0, 1);
var _local10 = new Array(0, 1);
var _local8 = new Array(0, 0);
var _local6 = new Array(0, 0);
var _local7 = new Array(0, 1);
var _local9 = new Array(0, 0);
var _local2 = new Object();
_local2.len = 0;
var _local1 = _local5.length - 1;
while (_local1 >= 0) {
var _local4 = _local5[_local1];
if (Math.min(Math.min(tilesCnt.red, tilesCnt.blue), Math.min(tilesCnt.green, tilesCnt.yellow)) >= _local4) {
_local2.len = _local4;
_local2.points = _local13[_local1];
_local2.D2 = _local12[_local1];
_local2.D3 = _local11[_local1];
_local2.D4 = _local10[_local1];
_local2.RB = _local8[_local1];
_local2.SW = _local6[_local1];
_local2.JO = _local7[_local1];
_local2.BB = _local9[_local1];
break;
}
_local1--;
}
return(_local2);
}
function getPoolPoints() {
var tilesCnt = _root.mainTable.countTiles();
var reqs = new Array(8, 9, 10, 11, 12, 13, 14, 15, 16);
var pts = new Array(30, 60, 120, 250, 400, 800, 1300, 1800, 2500);
var d2 = new Array(0, 1, 0, 1, 0, 1, 0, 0, 0);
var d3 = new Array(0, 0, 1, 0, 0, 1, 0, 0, 0);
var d4 = new Array(0, 0, 0, 1, 2, 1, 3, 4, 5);
var rb_bonus = new Array(0, 0, 1, 1, 1, 1, 2, 2, 3);
var s_bonus = new Array(1, 1, 1, 1, 2, 2, 2, 3, 3);
var j_bonus = new Array(0, 1, 1, 1, 1, 1, 2, 2, 3);
var bb_bonus = new Array(0, 1, 1, 1, 1, 2, 2, 3, 3);
var possiblePools = new Array();
var octColorPts = getDoubleOctColorPts(tilesCnt);
var octShapePts = getDoubleOctShapePts(tilesCnt);
var ptsObj = new Object();
ptsObj.points = 0;
ptsObj.D2 = 0;
ptsObj.D3 = 0;
ptsObj.D4 = 0;
ptsObj.RB = 0;
ptsObj.SW = 0;
ptsObj.JO = 0;
ptsObj.BB = 0;
if ((octColorPts != undefined) && (octShapePts != undefined)) {
ptsObj.points = 1600;
ptsObj.D4 = 3;
ptsObj.RB = 1;
ptsObj.JO = 1;
var msg = "Minor Full Harmony, ";
_root.addSpecialSetsMsg(msg, ptsObj.points, ptsObj.D2, ptsObj.D3, ptsObj.D4, ptsObj.RB, ptsObj.SW, ptsObj.JO, ptsObj.BB);
return(ptsObj);
}
if (octColorPts != undefined) {
ptsObj.points = ptsObj.points + octColorPts.points;
ptsObj.D2 = ptsObj.D2 + octColorPts.D2;
ptsObj.D3 = ptsObj.D3 + octColorPts.D3;
ptsObj.D4 = ptsObj.D4 + octColorPts.D4;
ptsObj.RB = ptsObj.RB + octColorPts.RB;
ptsObj.SW = ptsObj.SW + octColorPts.SW;
ptsObj.JO = ptsObj.JO + octColorPts.JO;
ptsObj.BB = ptsObj.BB + octColorPts.BB;
var msg = "Two Colors Harmony, ";
_root.addSpecialSetsMsg(msg, octColorPts.points, octColorPts.D2, octColorPts.D3, octColorPts.D4, octColorPts.RB, octColorPts.SW, octColorsPts.JO, octColorPts.BB);
} else {
possiblePools.push("red");
possiblePools.push("blue");
possiblePools.push("green");
possiblePools.push("yellow");
}
if (octShapePts != undefined) {
ptsObj.points = ptsObj.points + octShapePts.points;
ptsObj.D2 = ptsObj.D2 + octShapePts.D2;
ptsObj.D3 = ptsObj.D3 + octShapePts.D3;
ptsObj.D4 = ptsObj.D4 + octShapePts.D4;
ptsObj.RB = ptsObj.RB + octColorPts.RB;
ptsObj.SW = ptsObj.SW + octColorPts.SW;
ptsObj.JO = ptsObj.JO + octColorPts.JO;
ptsObj.BB = ptsObj.BB + octColorPts.BB;
var msg = "Two Symbols Harmony, ";
_root.addSpecialSetsMsg(msg, octShapePts.points, octShapePts.D2, octShapePts.D3, octShapePts.D4, octShapePts.RB, octShapePts.SW, octShapePts.JO, octShapePts.BB);
} else {
possiblePools.push("luna");
possiblePools.push("terra");
possiblePools.push("sol");
possiblePools.push("stella");
}
for (var elem in possiblePools) {
var type = possiblePools[elem];
var tilesNum = eval ("tilesCnt." + type);
var i = (reqs.length - 1);
while (i >= 0) {
var k = (_root.isColor(type) ? (i + 1) : (i));
if (k >= reqs.length) {
} else if (tilesNum < reqs[k]) {
} else {
var msg = (type.charAt(0).toUpperCase() + type.substr(1, type.length - 1));
msg = msg + ((" " + reqs[k]) + " Pool, ");
var RB = (((type == "sol") || (type == "red")) ? (rb_bonus[i]) : 0);
var SW = (((type == "luna") || (type == "yellow")) ? (s_bonus[i]) : 0);
var JO = (((type == "terra") || (type == "green")) ? (j_bonus[i]) : 0);
var BB = (((type == "stella") || (type == "blue")) ? (bb_bonus[i]) : 0);
_root.addSpecialSetsMsg(msg, pts[i], d2[i], d3[i], d4[i], RB, SW, JO, BB);
ptsObj.points = ptsObj.points + pts[k];
ptsObj.D2 = ptsObj.D2 + d2[i];
ptsObj.D3 = ptsObj.D3 + d3[i];
ptsObj.D4 = ptsObj.D4 + d4[i];
ptsObj.RB = ptsObj.RB + RB;
ptsObj.SW = ptsObj.SW + SW;
ptsObj.JO = JO;
ptsObj.BB = ptsObj.BB + BB;
break;
}
i--;
}
}
return(ptsObj);
}
function getDoubleOctColorPts(tilesCnt) {
var eights = 0;
var colors = new Array("red", "blue", "green", "yellow");
for (idx in colors) {
var c = colors[idx];
var cnt = eval ("tilesCnt." + c);
if (cnt == 8) {
eights++;
}
}
if (eights == 2) {
var retVal = new Object();
retVal.points = 600;
retVal.D2 = 1;
retVal.D3 = 0;
retVal.D4 = 1;
retVal.RB = 1;
retVal.SW = 0;
retVal.JO = 0;
retVal.BB = 0;
return(retVal);
}
return(undefined);
}
function getSynergyPoints() {
var _local2 = new Object();
_local2.D2 = 0;
_local2.D3 = 0;
_local2.D4 = 0;
_local2.points = _root.getSynergyScore();
var _local3 = countSynergies();
if (_local3 < 2) {
return(_local2);
}
if (_local3 >= 2) {
_local2.D3 = 1;
}
if (_local3 > 2) {
_local2.D4 = _local3 - 2;
}
_root.addSpecialSetsMsg("Synergy pairs, ", _local2.points, _local2.D2, _local2.D3, _local2.D4, 0, 0, 0, 0);
return(_local2);
}
function getSynergyScore() {
var _local1 = countSynergies();
if (_local1 == 0) {
return(0);
}
if (_local1 == 1) {
return(50);
}
if (_local1 == 2) {
return(150);
}
if (_local1 == 3) {
return(500);
}
if (_local1 >= 4) {
return(500 + (1000 * (_local1 - 3)));
}
return(0);
}
function countSynergies() {
var _local2 = 0;
var _local1 = 1;
while (_local1 <= 8) {
if (checkSynergy(_local1)) {
_local2++;
}
_local1++;
}
return(_local2);
}
function checkSynergy(i) {
var _local3 = _root.mainTable.getCard(i);
var _local4 = ((i == 8) ? 1 : (i + 1));
if ((i == _root.mainTable.liftedIdx) || (_local4 == _root.mainTable.liftedIdx)) {
return(false);
}
var _local2 = _root.mainTable.getCard(_local4);
if ((_local3 == undefined) || (_local2 == undefined)) {
return(false);
}
if (!_root.mainTable.cardsMatch(_local2, _local3)) {
return(false);
}
if (((_local2.rightColor == _root.synergy1) || (_local2.rightShape == _root.synergy1)) && ((_local3.leftColor == _root.synergy2) || (_local3.leftShape == _root.synergy2))) {
return(true);
}
if (((_local2.rightColor == _root.synergy2) || (_local2.rightShape == _root.synergy2)) && ((_local3.leftColor == _root.synergy1) || (_local3.leftShape == _root.synergy1))) {
return(true);
}
return(false);
}
function getDoubleOctShapePts(tilesCnt) {
var eights = 0;
var shapes = new Array("sol", "luna", "terra", "stella");
for (idx in shapes) {
var s = shapes[idx];
var cnt = eval ("tilesCnt." + s);
if (cnt == 8) {
eights++;
}
}
if (eights == 2) {
var retVal = new Object();
retVal.points = 700;
retVal.D2 = 0;
retVal.D3 = 1;
retVal.D4 = 1;
retVal.RB = 0;
retVal.SW = 1;
retVal.JO = 0;
retVal.BB = 0;
return(retVal);
}
return(undefined);
}
function getTextColor() {
return(9830480);
}
function getBonusColor() {
return(25610);
}
function setTextColor() {
_root.setInstructionsColor(getTextColor(), 14, false);
}
function setBonusColor() {
_root.setInstructionsColor(getBonusColor(), 14, true);
}
function addSpecialSetsMsg(msg, points, d2, d3, d4, red_bombs, switchs, jokers, blue_bombs) {
if (_root.hasBonuses == false) {
_root.setInstructionsColor(617, 14, false);
appendGeneralMsg("Special sets you have created:\n");
}
_root.hasBonuses = true;
setTextColor();
appendGeneralMsg(msg);
if (points == undefined) {
return(undefined);
}
if (points != 0) {
setBonusColor();
appendGeneralMsg(points);
setTextColor();
appendGeneralMsg(" pts");
}
var _local2 = ((2 * d2) + (3 * d3)) + (4 * d4);
appendBonusMsg(_local2, "tile");
appendBonusMsg(red_bombs, "red bomb");
appendBonusMsg(switchs, "switch");
appendBonusMsg(jokers, "joker");
appendBonusMsg(blue_bombs, "blue bomb");
appendGeneralMsg(newline);
}
function appendGeneralMsg(msg) {
if (_root.currentLevel == 0) {
return(undefined);
}
_root.instructions_txt.replaceText(10000, 10000, msg);
}
function appendBonusMsg(amount, type) {
if (amount != 0) {
setTextColor();
appendGeneralMsg(", ");
setBonusColor();
appendGeneralMsg(amount + " ");
setTextColor();
if (amount != 1) {
appendGeneralMsg(type + "s");
} else {
appendGeneralMsg(type);
}
}
}
function frameRefresh() {
Mouse.hide();
if (_root.levelUpdated) {
return(undefined);
}
handleOutOfBounds();
_root.mainTimer.updateTime();
_root.mainTable.applyNewBars();
_root.applyNewSynergies();
_root.mainTable.updateBrightMatchs();
var _local4 = _root.isTutorialRunning();
if (_local4) {
_root.advanceTutorial();
}
if (isNaN(_root.baseScore)) {
_root.baseScore = 0;
}
var _local3 = _root.getSynergyScore();
if (_root.currentLevel == 0) {
_root.points_txt.text = "";
_root.total_points_txt.text = "";
} else {
_root.points_txt.text = (_root.mainTable.getScore() + _local3) + _root.roundBonusPoints;
var _local5 = _root.total_points_txt.text;
var _local2 = ((_root.mainTable.getScore() + _root.baseScore) + _local3) + _root.roundBonusPoints;
if (_local5 != _local2) {
_root.kongregateStats.submit("Score", _local2);
}
_root.total_points_txt.text = _local2;
}
if (_root.levelDone) {
if (_root.bonusesGiven) {
_root.levelUpdated = true;
}
return(undefined);
}
if ((!_root.rpnGameOver()) && (!_root.rpnGameWon())) {
return(undefined);
}
_root.mainDeck.deactivate();
_root.mainTable.deactivate();
_root.mainExtras.deactivate();
if (levelDone) {
return(undefined);
}
if (_root.rpnGameWon()) {
_root.rpnHandleGameWon();
}
if (_root.rpnGameLost()) {
_root.rpnHandleGameLost();
}
levelDone = true;
}
function jumpToEntry() {
_root.inGame = false;
_root.mainDeck.clear();
_root.tutorial_txt.text = "";
_root.resetTableAndDeck();
_root.rpnStopSynergies(true);
gotoAndStop (1);
_root.clearStage();
_root.mainTable.reset();
_root.mainDeck.clear();
}
function jumpToScores() {
_root.inGame = false;
_root.mainDeck.clear();
_root.resetTableAndDeck();
_root.rpnStopSynergies(true);
gotoAndStop ("highscore");
_root.clearStage();
_root.mainTable.reset();
_root.mainDeck.clear();
}
function handleOutOfBounds() {
if (!stageArea_mc.hitTest(_root._xmouse, _root._ymouse)) {
var _local2 = _root.currentTile();
}
if (_local2 != undefined) {
_local2.onRelease();
}
}
function reshuffleCardsAfterCrack() {
_root.playSound("deal.wav", _root.mainDeck.activeSlots());
}
var nextAvailableDepth;
var nonReggedMCs;
var genColorPerLevel = new Array(0, 1, 0, 1, 2, 0, 0, 1, 1, 0, 1, 1, 1, 2, 1, 0, 1, 0, 0, 1, 2, 1, 1, 0, 2, 2, 1, 2, 1, 2);
var genShapePerLevel = new Array(0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 2, 0, 1, 1, 2, 2, 2, 3, 1, 2, 2);
var spcColorPerLevel = new Array(0, 0, 0, 0, 0, 1, 1, 1, 0, 2, 0, 1, 2, 0, 2, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2);
var spcShapePerLevel = new Array(0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 2, 1, 0, 2, 1, 2, 2, 2, 3, 1, 2, 2, 3, 3, 1, 2, 2, 2, 3, 2);
var advGenColorPerLevel = new Array(1, 1, 0, 1, 1, 1, 1, 2, 1, 1, 0, 2, 1, 0, 1, 0, 0, 2, 1, 2, 1, 0, 3, 2, 2, 1, 1, 3, 2, 2);
var advGenShapePerLevel = new Array(1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 2, 2, 1, 2, 2);
var advSpcColorPerLevel = new Array(1, 0, 2, 0, 1, 1, 2, 0, 2, 1, 1, 2, 1, 1, 3, 2, 1, 2, 1, 2, 1, 1, 2, 1, 3, 2, 1, 3, 3, 2);
var advSpcShapePerLevel = new Array(0, 1, 0, 2, 1, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 2, 3, 1, 2, 2, 3, 3, 1, 2, 1, 2, 3, 1, 1, 2);
var colorsArray = new Array("yellow", "green", "blue", "red");
var shapesArray = new Array("stella", "luna", "sol", "terra");
var synergiesSet;
var tileOriginalLocation = new Object();
var cardPressTime = undefined;
var tips = new Array("One ping means the tile you used fits an adjacent tile.", "Two pings mean the tile you used fits the tiles on both sides.", "If you put a tile next to another and see smoke comes out - the tiles don't fit.", "Extra deals differ in size. You can get a 2 cards, a 3 cards or a 4 cards extra deal.", "You can place together two tiles that don't fit, but make sure everything fits when you put the last tile in the ring.", "Color quadruples harmonic set is a set where there's an equal number of each color in the ring.", "Double double harmonic set is a set where there are at least two of each color and two of each symbol.", "Double triples harmonic set is a set where there are at least three of each color and three of each symbol.", "Symbol quadruples harmonic set is a set where there's an equal number of each symbol in the ring.", "Starting in level 10 you get transform tools every 5 levels. These tools allow you to change tiles to a specific color or symbol.", "When you complete the 30th ring you defeat the dragon. You can go on playing for a personal record.", "After level 30 you get one random transform tool each level.");
var instructions = new Array("Try to fit the tiles in the ring matching either color or symbol and complete a full magic circle.", "Use the cards that were dealt to the four slots on your left. Press \"deal\" when you can't use the ones already in the slots.", "After exhausting the 4 standard deals you have in one round try using the extra deals to survive a tricky ring.", "Once a tile is inside the ring you can not drag it back to the slot.", "You can move a tile that is already in the ring to another place in the ring, unless a Limiter is preventing this.", "A cracked slot can not contain cards (not including extra deals).", "Eight tiles make a set - a complete magic ring that can prevent the dragon from burning you.", "Each tile has two sides - left and right. Each side has one color and one symbol.", "There are four symbols: Luna (moon), Terra (earth), Sol (sun) and Stella (star), and four colors: Red, Green, Yellow and Blue.", "Creating special combinations of tiles will get you bonus points and bonus tools.", "\"Harmonic sets\" are special combinations of tiles, where all colors or all symbols are equally represented.", "\"Pool sets\" are sets with large amounts of one color or symbol.", "The first Limiter appears in the second round. it looks like a pizza Limiter with the word \"Color\" on it.", "The \"Color\" Limiter prevents you from matching next to it two tiles that don't have a matching color.", "As you advance in level, the number of Limiters grows and they become more specific.");
var mainTable;
var mainDeck;
var mainExtras;
var tileOriginalLocation;
var inGame = false;
var dragon_mc;
var victory_mc;
var wizard_wand_mc;
var text_highlight_mc;
var tips_box;
var lastDealWarningIssued = false;
var tileOriginalLocation;
var currentLevel = 1;
var baseScore = 0;
var onStage = true;
var levelDone = false;
var highScoresUpdated = false;
var roundBonusPoints;
var levelUpdated;
var bonusesGiven;
var lastGameWasTutorial;
_root.inGameMenuDisabled = true;
_root.inGameScene = true;
var firstLevel = 1;
if (_root.tutorialAlreadyPlayed == undefined) {
_root.tutorialAlreadyPlayed = true;
if (_root.gameMode == "basic") {
_root.startTutorial();
firstLevel = 0;
}
}
if (_root.specialDebugMode != undefined) {
firstLevel = _root.specialDebugMode;
_root.endTutorial();
}
rpnInit();
rpnNewGame(firstLevel, 0);
_root.onEnterFrame = frameRefresh;
stop();
Symbol 103 MovieClip [dragon_fire_good_mc] Frame 2
_root.playSound("Dragon");
Symbol 103 MovieClip [dragon_fire_good_mc] Frame 57
stop();
_root.raiseGameWonSign();
Symbol 180 MovieClip [dragon_fire_bad_mc] Frame 2
_root.playSound("Dragon");
Symbol 180 MovieClip [dragon_fire_bad_mc] Frame 57
stop();
_root.raiseGameOverSign();
Symbol 210 MovieClip [stella_terra_synergy_mc] Frame 116
stop();
Symbol 226 MovieClip [stella_sol_synergy_mc] Frame 116
stop();
Symbol 240 MovieClip [sol_terra_synergy_mc] Frame 116
stop();
Symbol 259 MovieClip [luna_terra_synergy_mc] Frame 116
stop();
Symbol 273 MovieClip [luna_sol_synergy_mc] Frame 116
stop();
Symbol 287 MovieClip [stella_luna_synergy_mc] Frame 116
stop();
Symbol 304 MovieClip [sol_yellow_synergy_mc] Frame 116
stop();
Symbol 321 MovieClip [terra_red_synergy_mc] Frame 116
stop();
Symbol 335 MovieClip [terra_yellow_synergy_mc] Frame 116
stop();
Symbol 352 MovieClip [terra_green_synergy_mc] Frame 116
stop();
Symbol 369 MovieClip [terra_blue_synergy_mc] Frame 116
stop();
Symbol 383 MovieClip [stella_yellow_synergy_mc] Frame 116
stop();
Symbol 397 MovieClip [stella_red_synergy_mc] Frame 116
stop();
Symbol 411 MovieClip [stella_green_synergy_mc] Frame 116
stop();
Symbol 425 MovieClip [stella_blue_synergy_mc] Frame 116
stop();
Symbol 439 MovieClip [sol_red_synergy_mc] Frame 116
stop();
Symbol 453 MovieClip [sol_blue_synergy_mc] Frame 116
stop();
Symbol 467 MovieClip [sol_green_synergy_mc] Frame 116
stop();
Symbol 481 MovieClip [luna_yellow_synergy_mc] Frame 116
stop();
Symbol 497 MovieClip [yellow_red_synergy_mc] Frame 116
stop();
Symbol 513 MovieClip [yellow_blue_synergy_mc] Frame 116
stop();
Symbol 529 MovieClip [yellow_green_synergy_mc] Frame 116
stop();
Symbol 543 MovieClip [luna_green_synergy_mc] Frame 116
stop();
Symbol 557 MovieClip [luna_red_synergy_mc] Frame 116
stop();
Symbol 571 MovieClip [green_red_synergy_mc] Frame 116
stop();
Symbol 585 MovieClip [green_blue_synergy_mc] Frame 116
stop();
Symbol 600 MovieClip [blue_red_synergy_mc] Frame 116
stop();
Symbol 614 MovieClip [luna_blue_synergy_mc] Frame 116
stop();
Symbol 621 MovieClip Frame 20
stop();
Symbol 625 MovieClip Frame 20
stop();
Symbol 632 MovieClip Frame 20
stop();
Symbol 633 MovieClip [yellow_transform_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 637 MovieClip Frame 20
stop();
Symbol 641 MovieClip Frame 20
stop();
Symbol 646 MovieClip Frame 20
stop();
Symbol 647 MovieClip [green_transform_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 651 MovieClip Frame 20
stop();
Symbol 655 MovieClip Frame 20
stop();
Symbol 660 MovieClip Frame 20
stop();
Symbol 661 MovieClip [red_transform_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 665 MovieClip Frame 20
stop();
Symbol 669 MovieClip Frame 20
stop();
Symbol 670 MovieClip [blue_transform_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 678 MovieClip Frame 40
stop();
Symbol 684 MovieClip Frame 40
stop();
Symbol 685 MovieClip [blue_bomb_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 689 MovieClip Frame 40
stop();
Symbol 695 MovieClip Frame 40
stop();
Symbol 696 MovieClip [red_bomb_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 701 MovieClip Frame 20
stop();
Symbol 705 MovieClip Frame 20
stop();
Symbol 707 MovieClip [d2_extradeal] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 712 MovieClip Frame 20
stop();
Symbol 716 MovieClip Frame 20
stop();
Symbol 717 MovieClip [d3_extradeal] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 722 MovieClip Frame 20
stop();
Symbol 726 MovieClip Frame 20
stop();
Symbol 727 MovieClip [d4_extradeal] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 730 MovieClip [red_mc] Frame 1
stop();
Symbol 733 MovieClip [yellow_mc] Frame 1
stop();
Symbol 736 MovieClip [green_mc] Frame 1
stop();
Symbol 739 MovieClip [blue_mc] Frame 1
stop();
Symbol 809 Button
on (press) {
_root.highScoresUpdated = true;
_root.playSound("button1.wav");
this._parent.unloadMovie();
_root.backtohighscores = true;
_root.jumpToEntry();
}
Symbol 812 Button
on (press) {
this.handleSubmitPress();
}
Symbol 813 MovieClip [highscore_mc] Frame 1
function handleSubmitPress() {
_root.addRecordScore("RPN", "basic_scores", this.playerName.text, this.points, this.level);
_root.addRecordScore("RPN", "basic_levels", this.playerName.text, this.level, this.points);
_root.highScoresUpdated = true;
_root.playSound("button1.wav");
_root.newHighscore = false;
_root.updateHighScores();
var _local3 = new mx.transitions.Tween(this, "_alpha", mx.transitions.easing.Regular.easeOut, 100, 0, 0.8, 1);
Key.removeListener(this);
_local3.parent = this;
_local3.onMotionFinished = function () {
this.parent.unloadMovie();
};
}
Symbol 845 Button
on (release) {
this.musicEnabled_mc = _root.optionsMenu_mc.musicEnabled_mc;
_root.playSound("button1.wav");
if (_root.bgMusicEnabled) {
_root.rpnDisableBGMusic();
this.musicEnabled_mc._alpha = 0;
} else {
_root.rpnEnableBGMusic();
this.musicEnabled_mc._alpha = 100;
}
}
Symbol 850 Button
on (release) {
_root.playSound("button1.wav");
_root.menusDisabled = false;
_root.inGameMenuDisabled = false;
_root.optionsMenu_mc.unloadMovie();
}
Symbol 853 Button
on (release) {
this.soundEnabled_mc = _root.optionsMenu_mc.soundEnabled_mc;
if (_root.bgSoundsEnabled) {
_root.rpnDisableSounds();
this.soundEnabled_mc._alpha = 0;
} else {
_root.rpnEnableSounds();
this.soundEnabled_mc._alpha = 100;
}
_root.playSound("button1.wav");
}
Symbol 870 Button
on (release) {
if (_root.inGameMenuDisabled) {
return(undefined);
}
_root.inGameMenuDisabled = true;
_root.playSound("button1.wav");
_root.optionsMenu_mc = _root.getReggedStageMC();
_root.optionsMenu_mc.swapDepths(21001);
_root.optionsMenu_mc.attachMovie("optionsMenu_mc", "movie", _root.getNextDepth());
_root.optionsMenu_mc._x = 322;
_root.optionsMenu_mc._y = 25;
_root.optionsMenu_mc = _root.optionsMenu_mc.movie;
_root.optionsMenu_mc.soundEnabled_mc._alpha = (_root.bgSoundsEnabled ? 100 : 0);
_root.optionsMenu_mc.musicEnabled_mc._alpha = (_root.bgMusicEnabled ? 100 : 0);
_root.optionsMenu_mc.fullscreenEnabled_mc._alpha = (_root.fullscreenEnabled ? 100 : 0);
}
Symbol 872 Button
on (release) {
if (_root.inGameMenuDisabled) {
return(undefined);
}
_root.inGameMenuDisabled = true;
_root.playSound("button1.wav");
var are_you_sure_mc = _root.getReggedStageMC();
are_you_sure_mc.swapDepths(21001);
are_you_sure_mc.attachMovie("are_you_sure_mc", "movie", _root.getNextDepth());
are_you_sure_mc._x = 291.4;
are_you_sure_mc._y = 50;
var kl = new Object();
kl.parent = are_you_sure_mc;
kl.onKeyDown = function () {
var _local3 = Key.getCode();
if (_local3 == 89) {
_root.playSound("button1.wav");
_root.inGameMenuDisabled = false;
Key.removeListener(this);
this.yesClickedHook();
this._parent.unloadMovie();
}
if (_local3 == 78) {
_root.playSound("button1.wav");
_root.inGameMenuDisabled = false;
Key.removeListener(this);
this.noClickedHook();
this._parent.unloadMovie();
}
};
kl.yesClickedHook = function () {
_root.gameMenu_mc = undefined;
_root.endTutorial();
_root.jumpToEntry();
};
kl.noClickedHook = function () {
};
are_you_sure_mc.movie.kl = kl;
Key.addListener(kl);
}
Symbol 874 Button
on (release) {
if (_root.inGameMenuDisabled) {
return(undefined);
}
_root.inGameMenuDisabled = true;
_root.playSound("button1.wav");
var are_you_sure_mc = _root.getReggedStageMC();
are_you_sure_mc.swapDepths(21001);
are_you_sure_mc.attachMovie("are_you_sure_mc", "movie", _root.getNextDepth());
are_you_sure_mc._x = 291.4;
are_you_sure_mc._y = 50;
var kl = new Object();
kl.parent = are_you_sure_mc;
kl.onKeyDown = function () {
var _local3 = Key.getCode();
if (_local3 == 89) {
_root.playSound("button1.wav");
_root.inGameMenuDisabled = false;
Key.removeListener(this);
this.yesClickedHook();
this.parent.unloadMovie();
}
if (_local3 == 78) {
_root.playSound("button1.wav");
_root.inGameMenuDisabled = false;
Key.removeListener(this);
this.noClickedHook();
this.parent.unloadMovie();
}
};
kl.yesClickedHook = function () {
fscommand ("quit");
};
kl.noClickedHook = function () {
};
are_you_sure_mc.movie.kl = kl;
Key.addListener(kl);
}
Symbol 876 Button
on (release) {
if (_root.inGameMenuDisabled) {
return(undefined);
}
_root.playSound("button1.wav");
_root.mainTable.activate();
_root.mainDeck.activate();
_root.mainExtras.activate();
_root.ActivateDeal();
_root.mainTimer.resumeTimer();
_root.menu_mc.enabled = true;
_root.deal_mc.enabled = true;
_root.tip_btn.enabled = true;
_root.gameMenu_mc.unloadMovie();
_root.gameMenu_mc = undefined;
}
Instance of Symbol 864 MovieClip "continue_mc" in Symbol 877 MovieClip [inGameMenu_mc] Frame 1
on (release) {
if (_root.inGameMenuDisabled) {
return(undefined);
}
_root.playSound("button1.wav");
_root.mainTable.activate();
_root.mainDeck.activate();
_root.mainExtras.activate();
_root.ActivateDeal();
_root.mainTimer.resumeTimer();
_root.gameMenu_mc.unloadMovie();
_root.gameMenu_mc = undefined;
}
Instance of Symbol 881 MovieClip in Symbol 882 MovieClip [are_you_sure_mc] Frame 1
on (release) {
_root.playSound("button1.wav");
_root.inGameMenuDisabled = false;
this._parent.kl.yesClickedHook();
Key.removeListener(this._parent.kl);
this._parent.unloadMovie();
}
Instance of Symbol 881 MovieClip in Symbol 882 MovieClip [are_you_sure_mc] Frame 1
on (release) {
_root.playSound("button1.wav");
_root.inGameMenuDisabled = false;
this._parent.kl.noClickedHook();
Key.removeListener(this._parent.kl);
this._parent.unloadMovie();
}
Symbol 914 MovieClip [blue_bomb_effect] Frame 12
this.unloadMovie();
Symbol 937 MovieClip [red_bomb_effect] Frame 11
this.unloadMovie();
Symbol 971 MovieClip Frame 20
stop();
Symbol 975 MovieClip Frame 20
stop();
Symbol 985 MovieClip Frame 20
stop();
Symbol 986 MovieClip [joker_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 990 MovieClip Frame 20
stop();
Symbol 993 MovieClip Frame 20
stop();
Symbol 997 MovieClip Frame 20
stop();
Symbol 1007 MovieClip Frame 20
stop();
Symbol 1008 MovieClip [switch_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 1012 MovieClip Frame 20
stop();
Symbol 1015 MovieClip Frame 20
stop();
Symbol 1020 MovieClip Frame 20
stop();
Symbol 1021 MovieClip [stella_transform_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 1024 MovieClip Frame 20
stop();
Symbol 1027 MovieClip Frame 20
stop();
Symbol 1031 MovieClip Frame 20
stop();
Symbol 1032 MovieClip [terra_transform_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 1035 MovieClip Frame 20
stop();
Symbol 1038 MovieClip Frame 20
stop();
Symbol 1042 MovieClip Frame 20
stop();
Symbol 1043 MovieClip [luna_transform_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 1046 MovieClip Frame 20
stop();
Symbol 1049 MovieClip Frame 20
stop();
Symbol 1053 MovieClip Frame 20
stop();
Symbol 1054 MovieClip [sol_transform_mc] Frame 40
stop();
_root.mainExtras.addNext();
Symbol 1063 Button
on (release) {
_root.playSequencedSound("button1.wav", _root.tutorialStartGame);
}
Symbol 1079 Button
on (release) {
_root.removeMovieClip("quest_screen_mc");
if (!_root.inGameScene) {
_root.playSequencedSound("button1.wav", _root.jumpToGame);
} else {
_root.playSequencedSound("button1.wav", _root.rpnNextRound);
}
}
Symbol 1080 MovieClip [quest_screen_mc] Frame 1
_root.onMouseUp = undefined;
if (_root.currentLevel == undefined) {
_root.currentLevel = 1;
}
var numcount2String = new Array("first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eight", "ninth", "tenth");
var numsTextFormat = new TextFormat();
numsTextFormat.font = "Calligraphic";
numsTextFormat.bold = false;
numsTextFormat.size = 20;
numsTextFormat.letterSpacing = 0;
numsTextFormat.align = "center";
_root.rpnPlayBGMusic("Quest BG");
var tg_txt = _root.quest_screen_mc.dummy.next_quest_txt;
numsTextFormat.color = 14810955 /* 0xE1FF4B */;
tg_txt.setNewTextFormat(numsTextFormat);
tg_txt.sharpness = 0;
tg_txt.antiAliasType = "advanced";
tg_txt.selectable = false;
tg_txt.embedFonts = true;
var level = _root.currentLevel;
var sorcererType = "Sand";
if (_root.currentLevel > 10) {
sorcererType = "Ocean";
}
if (_root.currentLevel > 20) {
sorcererType = "Flame";
}
while (level > 10) {
level = level - 10;
}
_root.quest_screen_mc.dummy.next_quest_txt.text = "";
_root.quest_screen_mc.next_txt = ((("Next: The " + numcount2String[level - 1]) + " ring of the ") + sorcererType) + " Sorcerer";
var tip = _root.getRandomTip();
tg_txt = tip_txt;
numsTextFormat.font = "Calligraphic";
numsTextFormat.size = 14;
numsTextFormat.bold = true;
numsTextFormat.color = 16763904 /* 0xFFCC00 */;
numsTextFormat.align = "center";
tg_txt.setNewTextFormat(numsTextFormat);
tg_txt.setTextFormat(numsTextFormat);
tg_txt.sharpness = 0;
tg_txt.antiAliasType = "advanced";
tg_txt.selectable = false;
tg_txt.embedFonts = true;
tg_txt.text = "Tip: " + tip;
Symbol 1085 Button
on (release) {
_root.playSound("button1.wav");
_root.tutorialOKClicked();
}
Symbol 1102 MovieClip [circle_mc] Frame 100
stop();
stop();
stop();
Symbol 1141 MovieClip [sol_mc] Frame 1
stop();
Symbol 1143 MovieClip [stella_mc] Frame 1
stop();
Symbol 1145 MovieClip [luna_mc] Frame 1
stop();
Symbol 1147 MovieClip [terra_mc] Frame 1
stop();
Symbol 1148 MovieClip [luna_flipped_mc] Frame 1
stop();
Symbol 1149 MovieClip [terra_flipped_mc] Frame 1
stop();
Symbol 1163 MovieClip [Wand] Frame 1
if (this.fadeIn == true) {
_root.setFadein(this, 5.5);
}
Symbol 1163 MovieClip [Wand] Frame 42
if (this.fadeOut == true) {
_root.setFadeout(this, 5.5);
}
Symbol 1163 MovieClip [Wand] Frame 60
if (this.onlyOnce == true) {
gotoAndStop ("prestart");
} else {
gotoAndPlay ("start");
}
Symbol 1163 MovieClip [Wand] Frame 61
stop();
Symbol 1179 MovieClip [Synergy Effect] Frame 61
stop();
Symbol 1185 MovieClip Frame 15
stop();
Symbol 1186 MovieClip Frame 45
stop();
Symbol 1187 MovieClip [Smoke Effect] Frame 20
stop();
this._parent.unloadMovie("movie");
Symbol 1193 Button
on (release) {
if (_root.menusDisabled) {
return(undefined);
}
_root.playSound("button1.wav");
fscommand ("quit");
}
Symbol 1196 Button
on (release) {
if (_root.menusDisabled) {
return(undefined);
}
_root.menu_text_highlight_mc.unloadMovie();
_root.playSound("button1.wav");
_root.gotoAndStop("instructions");
}
Symbol 1199 Button
on (release) {
if (_root.menusDisabled) {
return(undefined);
}
_root.menu_text_highlight_mc.unloadMovie();
_root.playSound("button1.wav");
_root.gotoAndStop("powerups");
}
Symbol 1202 Button
on (release) {
if (_root.menusDisabled) {
return(undefined);
}
_root.menusDisabled = true;
_root.playSound("button1.wav");
_root.optionsMenu_mc = _root.getReggedStageMC();
_root.optionsMenu_mc.attachMovie("optionsMenu_mc", "movie", _root.getNextDepth());
_root.optionsMenu_mc._x = 90;
_root.optionsMenu_mc._y = 228.3;
_root.optionsMenu_mc = _root.optionsMenu_mc.movie;
_root.optionsMenu_mc.soundEnabled_mc._alpha = (_root.bgSoundsEnabled ? 100 : 0);
_root.optionsMenu_mc.musicEnabled_mc._alpha = (_root.bgMusicEnabled ? 100 : 0);
}
Symbol 1205 Button
on (release) {
if (_root.menusDisabled) {
return(undefined);
}
_root.menu_text_highlight_mc.unloadMovie();
_root.playSound("button1.wav");
_root.gotoAndStop("highscore");
}
Symbol 1208 Button
on (release) {
if (_root.menusDisabled) {
return(undefined);
}
_root.menu_text_highlight_mc.unloadMovie();
_root.playSound("button1.wav");
_root.gotoAndStop("credits");
}
Symbol 1212 Button
on (release) {
_root.classic_btn.enabled = false;
_root.survival_btn.enabled = false;
_root.instructions_btn.enabled = false;
_root.powerups_btn.enabled = false;
_root.options_btn.enabled = false;
_root.highscores_btn.enabled = false;
_root.credits_btn.enabled = false;
_root.quit_btn.enabled = false;
_root.specialDebugMode = undefined;
_root.gameMode = "basic";
if (_root.tutorialPlayed == undefined) {
_root.tutorialPlayed = true;
_root.playSequencedSound("button1.wav", _root.jumpToGame);
} else {
_root.rpnLoadQuestScreen(1);
}
}
Symbol 1216 Button
on (release) {
_root.classic_btn.enabled = false;
_root.survival_btn.enabled = false;
_root.instructions_btn.enabled = false;
_root.powerups_btn.enabled = false;
_root.options_btn.enabled = false;
_root.highscores_btn.enabled = false;
_root.credits_btn.enabled = false;
_root.quit_btn.enabled = false;
_root.specialDebugMode = undefined;
_root.gameMode = "survival";
_root.playSound("button1.wav");
_root.rpnLoadQuestScreen(1);
}
Symbol 1267 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 1268 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 1269 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 1270 MovieClip [__Packages.mx.transitions.easing.Regular] Frame 0
class mx.transitions.easing.Regular
{
function Regular () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((c * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = t / d;
return((((-c) * t) * (t - 2)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
static var version = "1.1.0.52";
}
Symbol 1271 MovieClip [__Packages.rpnExtraDeals] Frame 0
class rpnExtraDeals
{
var mX, mY, mWidth, mHeight, mRightBounds, mRowBounds, mNextExtra, mDeals, mNextAdds, mActive;
function rpnExtraDeals (basex, basey, right_bounds, row_bounds) {
mX = basex;
mY = basey;
mWidth = 16;
mHeight = 16;
mRightBounds = right_bounds;
mRowBounds = row_bounds;
mNextExtra = 0;
mDeals = new Array();
mNextAdds = new Array();
mActive = true;
}
function addNext(dontShift) {
if (dontShift != true) {
mNextAdds.shift();
}
if (mNextAdds.length == 0) {
_root.rpnNotifyExtrasAdded();
return(undefined);
}
var _local3 = mNextAdds[0];
add(_local3.type, 1, _local3.onPressAction, _local3.tip, _local3.extraInfo, true);
}
function add(type, times, onPressAction, tip, extraInfo, force) {
var _local11 = mNextAdds.length > 0;
while (times > 0) {
if (force != true) {
var _local4 = new Object();
_local4.type = type;
_local4.onPressAction = onPressAction;
_local4.tip = tip;
_local4.extraInfo = extraInfo;
mNextAdds.push(_local4);
times--;
continue;
}
var _local3 = new Object();
_local3.icon = _root.getReggedStageMC();
_local3.icon.swapDepths(15500);
_local3.icon.attachMovie(type, "nm" + mNextExtra, _root.getNextDepth());
_local3.idx = mDeals.length;
_local3.type = type;
_local3.tip = tip;
_local3.extraInfo = extraInfo;
_local3.onPressAction = onPressAction;
_local3.icon.idx = _local3.idx;
_local3.icon.tip = _local3.tip;
_local3.icon.onPress = undefined;
_local3.icon.onRollOver = undefined;
_local3.icon.onRollOut = undefined;
_root.playSound("Bonus Ping");
setLocation(_local3);
mDeals.push(_local3);
mNextExtra++;
times--;
}
if (!_local11) {
addNext(true);
}
}
function refresh() {
var _local4 = 0;
while (_local4 < mDeals.length) {
var _local3 = mDeals[_local4];
_local3.icon = _root.getReggedStageMC();
_local3.icon.attachMovie(_local3.type, "nm" + mNextExtra, _root.getNextDepth());
_local3.icon.idx = _local3.idx;
_local3.icon.tip = _local3.tip;
_local3.icon.onPress = _local3.onPressAction;
_local3.icon.onRollOver = _root.extraDealMO;
_local3.icon.onRollOut = _root.extraDealMOut;
_local3.icon["nm" + mNextExtra].gotoAndStop(_local3.icon["nm" + mNextExtra]._totalframes);
setLocation(_local3);
mNextExtra++;
_local4++;
}
}
function reset() {
while (mDeals.length > 0) {
remove(mDeals.length - 1);
}
}
function deactivate() {
mActive = false;
var _local3 = 0;
while (_local3 < mDeals.length) {
var _local2 = mDeals[_local3];
_local2.icon.onPress = undefined;
_local2.icon.onRollOver = undefined;
_local2.icon.onRollOut = undefined;
_local3++;
}
}
function activate() {
mActive = true;
var _local4 = 0;
while (_local4 < mDeals.length) {
var _local3 = mDeals[_local4];
_local3.icon.onPress = _local3.onPressAction;
_local3.icon.onRollOver = _root.extraDealMO;
_local3.icon.onRollOut = _root.extraDealMOut;
_local4++;
}
}
function remove(idx) {
var _local4 = new Array();
var _local3 = 0;
while (_local3 < mDeals.length) {
var _local2 = mDeals[_local3];
if (_local3 == idx) {
_local2.icon.removeMovieClip();
} else {
_local2.idx = _local4.length;
_local2.icon.idx = _local2.idx;
setLocation(_local2);
_local4.push(_local2);
}
_local3++;
}
mDeals = _local4;
}
function setLocation(new_mc) {
var _local3 = new_mc.idx;
var _local2 = 0;
var _local5 = new_mc.icon;
var _local4 = mWidth + 2;
while ((mX + ((mWidth + 2) * (_local3 + 1))) > mRightBounds[_local2]) {
if (mRightBounds.length <= (_local2 + 1)) {
break;
}
_local3 = _local3 - Math.floor((mRightBounds[_local2] - mX) / _local4);
_local2++;
}
_local5._y = mRowBounds[_local2];
_local5._x = mX + (_local4 * _local3);
}
function getExtraInfo(idx) {
return(mDeals[idx].extraInfo);
}
}
Symbol 1272 MovieClip [__Packages.cpiTimer] Frame 0
class cpiTimer
{
var mTimerMask_mc, mOrigTimerHeight, mOrigTimerY, mTotalTime, mRemainingTime, mTimeElapsed, mLastSampledTime, mStopped;
function cpiTimer (timer_mask_mc) {
mTimerMask_mc = timer_mask_mc;
mOrigTimerHeight = mTimerMask_mc._height;
mOrigTimerY = mTimerMask_mc._y;
}
function startTimer(time) {
mTotalTime = time;
mRemainingTime = time;
mTimeElapsed = 0;
mLastSampledTime = getTimer();
mStopped = false;
updateTime();
}
function suspendTimer() {
mStopped = true;
}
function resumeTimer() {
mStopped = false;
}
function updateTime() {
if (mStopped) {
mLastSampledTime = getTimer();
return(undefined);
}
var _local3 = getTimer();
var _local4 = _local3 - mLastSampledTime;
if (((mTotalTime - mTimeElapsed) > 10000) && (((mTotalTime - mTimeElapsed) - _local4) <= 10000)) {
_root.rpnPlayBGMusic("Timer");
}
mTimeElapsed = mTimeElapsed + _local4;
mLastSampledTime = _local3;
mTimerMask_mc._height = mOrigTimerHeight * (1 - (mTimeElapsed / mTotalTime));
mTimerMask_mc._y = (mOrigTimerY + mOrigTimerHeight) - mTimerMask_mc._height;
}
function isTimeElapsed() {
return(mTimeElapsed >= mTotalTime);
}
function remainingSeconds() {
return(Math.max((mTotalTime - mTimeElapsed) / 1000, 0));
}
}
Symbol 1273 MovieClip [__Packages.rpnDeck] Frame 0
class rpnDeck
{
var mSlotsNum, mActiveSlots, mLastActiveSlots, mExtraDeal, mSlotMCs;
function rpnDeck (slotsNum) {
mSlotsNum = slotsNum;
mActiveSlots = mSlotsNum;
mLastActiveSlots = 0;
mExtraDeal = false;
reset();
}
function unsetExtras() {
var _local2 = 0;
while (_local2 < mSlotsNum) {
unsetExtraDealCard(_local2);
_local2++;
}
}
function reset() {
unsetExtras();
mActiveSlots = mSlotsNum;
mLastActiveSlots = 0;
mExtraDeal = false;
delete mSlotMCs;
mSlotMCs = new Array();
shuffleCards();
var i = (mSlotsNum - 1);
while (i >= 0) {
var deckCard = eval (("_root.deckCard" + (i + 1)) + "_mc");
deckCard.duplicateMovieClip("newDeckCard" + i, _root.getNextDepth());
deckCard.swapDepths(-1000 + i);
var newDeckCard = eval ("newDeckCard" + i);
_root.registerStageMC(newDeckCard);
mSlotMCs.push(newDeckCard);
i--;
}
shuffleCards();
var i = 0;
while (i < mSlotsNum) {
var currCard = mSlotMCs[i];
currCard.isOccupied = true;
currCard.onPress = _root.deckCardOnPress;
currCard.onRelease = _root.deckCardOnRelease;
eval (("_root.card" + (i + 1)) + "_crack_mc").gotoAndStop("unused");
i++;
}
}
function clear() {
unsetExtras();
var _local3 = 0;
while (_local3 < mSlotsNum) {
_root.setCard(mSlotMCs[_local3], undefined);
_local3++;
}
}
function deal() {
unsetExtras();
if (mExtraDeal) {
var _local2 = mLastActiveSlots - 1;
while (mActiveSlots > _local2) {
if (mActiveSlots != mLastActiveSlots) {
silentRemoveCard();
} else {
removeCard();
}
}
mLastActiveSlots = 0;
mExtraDeal = false;
shuffleCards();
} else {
removeCard();
}
}
function setExtraDeal(howmanyCards) {
unsetExtras();
if (!mExtraDeal) {
mLastActiveSlots = mActiveSlots;
}
while (mActiveSlots > howmanyCards) {
silentRemoveCard();
}
mActiveSlots = howmanyCards;
mExtraDeal = true;
shuffleCards();
}
function removeCard() {
silentRemoveCard();
eval (("_root.card" + (mActiveSlots + 1)) + "_crack_mc").swapDepths(-500 + mActiveSlots);
eval (("_root.card" + (mActiveSlots + 1)) + "_crack_mc").gotoAndPlay("start");
shuffleCards();
_root.playSound("crack.wav");
}
function silentRemoveCard() {
mActiveSlots--;
mSlotMCs[mActiveSlots].isOccupied = false;
_root.setCard(mSlotMCs[mActiveSlots], undefined);
}
function getSlotIdxFromCursor() {
var _local3 = 0;
while (_local3 < mActiveSlots) {
mSlotMCs[_local3].isOccupied = true;
if (mSlotMCs[_local3].hitTest(_root._xmouse, _root._ymouse, true)) {
return(_local3);
}
_local3++;
}
return(undefined);
}
function getSlotIdxAndSideFromCursor() {
var _local3 = 0;
while (_local3 < mActiveSlots) {
mSlotMCs[_local3].isOccupied = true;
if (mSlotMCs[_local3].hitTest(_root._xmouse, _root._ymouse, true)) {
var _local4 = new Object();
_local4.idx = _local3;
if (mSlotMCs[_local3].leftColor.hitTest(_root._xmouse, _root._ymouse, true)) {
_local4.leftSide = true;
} else {
_local4.leftSide = false;
}
return(_local4);
}
_local3++;
}
return(undefined);
}
function getCard(idx) {
return(mSlotMCs[idx]);
}
function setCard(idx, val) {
_root.setCard(mSlotMCs[idx], val);
return(mSlotMCs[idx]);
}
function setJoker(idx) {
_root.setJoker(mSlotMCs[idx]);
}
function setExtraDealCard(idx) {
_root.setExtraDealCard(mSlotMCs[idx]);
}
function unsetExtraDealCard(idx) {
_root.unsetExtraDealCard(mSlotMCs[idx]);
}
function shuffleCards() {
var _local3 = 0;
while (_local3 < mActiveSlots) {
unsetExtraDealCard(_local3);
mSlotMCs[_local3].isOccupied = true;
setCard(_local3, _root.newRandomCard());
_root.setFadein(mSlotMCs[_local3], 4);
if (mExtraDeal) {
setExtraDealCard(_local3);
} else {
unsetExtraDealCard(_local3);
}
_local3++;
}
}
function deactivate() {
var _local2 = 0;
while (_local2 < mActiveSlots) {
mSlotMCs[_local2].onPress = undefined;
mSlotMCs[_local2].onRelease = undefined;
_local2++;
}
}
function activate() {
var _local3 = 0;
while (_local3 < mActiveSlots) {
mSlotMCs[_local3].onPress = _root.deckCardOnPress;
mSlotMCs[_local3].onRelease = _root.deckCardOnRelease;
_local3++;
}
}
function isEmpty() {
return(mActiveSlots == 0);
}
function activeSlots() {
return(mActiveSlots);
}
function noMoreDeals() {
if (mActiveSlots == 1) {
return(true);
}
var _local2 = mLastActiveSlots - 1;
if (mExtraDeal && (_local2 == 0)) {
return(true);
}
return(false);
}
}
Symbol 1274 MovieClip [__Packages.cardObj] Frame 0
class cardObj
{
var leftColor, leftShape, rightColor, rightShape, isJoker;
function cardObj (leftCol, leftShp, rightCol, rightShp) {
leftColor = leftCol;
leftShape = leftShp;
rightColor = rightCol;
rightShape = rightShp;
isJoker = false;
}
}
Symbol 1275 MovieClip [__Packages.mx.transitions.easing.None] Frame 0
class mx.transitions.easing.None
{
function None () {
}
static function easeNone(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeIn(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeInOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static var version = "1.1.0.52";
}
Symbol 1276 MovieClip [__Packages.rpnTable] Frame 0
class rpnTable
{
var mSlotsNum, mSlots, mSlotLocations, mOccupiedSlots, mConstraints, liftedIdx;
function rpnTable (slotsNum, slotLocations) {
mSlotsNum = slotsNum;
mSlots = new Array(mSlotsNum);
mSlotLocations = slotLocations;
mOccupiedSlots = 0;
mConstraints = new Array(slotsNum);
liftedIdx = undefined;
reset();
}
function setCard(idx, card) {
mSlots[idx] = card;
if (card == undefined) {
if (mSlotLocations[idx].isOccupied) {
mOccupiedSlots--;
}
mSlotLocations[idx].isOccupied = false;
var removedCard = eval (("duplicatedSlot" + idx) + "_mc");
removedCard.removeMovieClip();
return(undefined);
}
var currCard = getDuplicatedSlot(idx);
mSlotLocations[idx].isOccupied = true;
mOccupiedSlots++;
_root.setCard(currCard, card);
currCard.onPress = ((card == undefined) ? undefined : (_root.tableCardOnPress));
currCard.onRelease = ((card == undefined) ? undefined : (_root.tableCardOnRelease));
currCard.idx = idx;
return(currCard);
}
function setJoker(idx) {
var jokeredCard = eval (("duplicatedSlot" + idx) + "_mc");
_root.setJoker(jokeredCard);
}
function illegalPlacement(idx, card, origIdx) {
var _local3 = ((idx == 8) ? 1 : (idx + 1));
var _local5 = ((idx == 1) ? 8 : (idx - 1));
if (card.joker) {
return(false);
}
return((illegalGeneralPlacement(card, _local3, idx, _local5, origIdx) || (illegalLeftPlacement(card, getConstraint(_local3, idx)))) || (illegalRightPlacement(card, getConstraint(idx, _local5))));
}
function illegalGeneralPlacement(card, lidx, idx, ridx, origIdx) {
var _local4 = getConstraint(lidx, idx);
var _local7 = getConstraint(idx, ridx);
var _local6 = getCard(lidx);
var _local3 = getCard(ridx);
if (((origIdx != lidx) && (illegalGeneralConstraint(_local6, card, _local4))) || ((origIdx != ridx) && (illegalGeneralConstraint(card, _local3, _local7)))) {
return(true);
}
return(false);
}
function illegalGeneralConstraint(lcard, rcard, cnstr) {
if ((cnstr == undefined) || ((cnstr != "color") && (cnstr != "shape"))) {
return(false);
}
if ((lcard == undefined) || (rcard == undefined)) {
return(false);
}
if (cnstr == "color") {
return(lcard.rightColor != rcard.leftColor);
}
return(lcard.rightShape != rcard.leftShape);
}
function illegalLeftPlacement(card, constraint) {
if (((constraint == undefined) || (constraint == "shape")) || (constraint == "color")) {
return(false);
}
if ((card.leftShape != constraint) && (card.leftColor != constraint)) {
return(true);
}
return(false);
}
function illegalRightPlacement(card, constraint) {
if (((constraint == undefined) || (constraint == "shape")) || (constraint == "color")) {
return(false);
}
if ((card.rightShape != constraint) && (card.rightColor != constraint)) {
return(true);
}
return(false);
}
function getCard(idx) {
return(mSlots[idx]);
}
function getScore() {
var _local6 = 0;
var _local2 = 1;
while (_local2 <= mSlotsNum) {
var _local5 = ((_local2 == 8) ? 1 : (_local2 + 1));
var _local3 = getCard(_local2);
var _local4 = getCard(_local5);
if (cardsMatch(_local4, _local3)) {
_local6 = _local6 + 6;
}
_local2++;
}
return(_local6);
}
function updateBrightMatchs() {
var i = 1;
while (i <= 8) {
var left = ((i == 8) ? 1 : (i + 1));
var currCard = getCard(i);
var leftCard = getCard(left);
var currSlot = eval (("duplicatedSlot" + i) + "_mc");
var leftSlot = eval (("duplicatedSlot" + left) + "_mc");
if (!cardsMatch(leftCard, currCard)) {
currSlot.leftRunning = false;
} else if (currSlot.leftRunning) {
} else {
currSlot.leftRunning = true;
if (leftCard.rightColor == currCard.leftColor) {
leftSlot.rightColor.rightCol_mc.gotoAndPlay(1);
currSlot.leftColor.leftCol_mc.gotoAndPlay(1);
}
if (leftCard.rightShape == currCard.leftShape) {
leftSlot.rightShape.rightShp_mc.gotoAndPlay(1);
currSlot.leftShape.leftShp_mc.gotoAndPlay(1);
}
}
i++;
}
}
function applyNewBars() {
var idx = 1;
while (idx <= 8) {
var left = ((idx == 8) ? 1 : (idx + 1));
var currCard = getCard(idx);
var leftCard = getCard(left);
var lidx = left;
var hasSynergy = cardsMatch(leftCard, currCard);
var s_mc = eval (((("_root.bar" + idx) + "") + lidx) + "_mc");
if (((!hasSynergy) || (idx == liftedIdx)) || (lidx == liftedIdx)) {
s_mc._visible = false;
s_mc.gotoAndStop(1);
s_mc.running = false;
} else if (hasSynergy && ((!s_mc.running) || (s_mc.running == undefined))) {
s_mc.gotoAndPlay(1);
s_mc._visible = true;
s_mc.swapDepths(300 + idx);
s_mc.running = true;
}
idx++;
}
}
function removeAllBars() {
var idx = 1;
while (idx <= 8) {
var lidx = ((idx == 8) ? 1 : (idx + 1));
var s_mc = eval (((("_root.bar" + idx) + "") + lidx) + "_mc");
s_mc._visible = false;
s_mc.gotoAndStop(1);
s_mc.running = false;
idx++;
}
}
function applyNewSmoke(idx) {
var lidx = ((idx == 8) ? 1 : (idx + 1));
var ridx = ((idx == 1) ? 8 : (idx - 1));
var lcard = getCard(lidx);
var card = getCard(idx);
var rcard = getCard(ridx);
var newSmokeApplied = false;
if ((lcard != undefined) && (!cardsMatch(lcard, card))) {
var s_mc = eval (((("_root.smoke" + idx) + "") + lidx) + "_mc");
s_mc.attachMovie("Smoke Effect", "movie", 16020 + idx);
s_mc.movie.gotoAndPlay(1);
s_mc.swapDepths(16020 + idx);
newSmokeApplied = true;
}
if ((rcard != undefined) && (!cardsMatch(card, rcard))) {
var s_mc = eval (((("_root.smoke" + ridx) + "") + idx) + "_mc");
s_mc.attachMovie("Smoke Effect", "movie", 16030 + idx);
s_mc.movie.gotoAndPlay(1);
s_mc.swapDepths(16030 + idx);
newSmokeApplied = true;
}
if (newSmokeApplied) {
_root.playSound("Tile Mismatch");
}
}
function countTiles() {
var _local4 = new Object();
_local4.sol = 0;
_local4.terra = 0;
_local4.stella = 0;
_local4.luna = 0;
_local4.red = 0;
_local4.yellow = 0;
_local4.green = 0;
_local4.blue = 0;
var _local2 = 1;
while (_local2 <= mSlotsNum) {
var _local3 = getCard(_local2);
countCard(_local4, _local3);
_local2++;
}
return(_local4);
}
function countCard(tiles, card) {
countColor(tiles, card.leftColor);
countColor(tiles, card.rightColor);
countShape(tiles, card.leftShape);
countShape(tiles, card.rightShape);
}
function countColor(tiles, color) {
var orig = eval ("tiles." + color);
Set("tiles." + color, orig + 1);
return(tiles);
}
function countShape(tiles, shape) {
var orig = eval ("tiles." + shape);
Set("tiles." + shape, orig + 1);
return(tiles);
}
function cardsMatch(lcard, rcard) {
if ((lcard == undefined) || (rcard == undefined)) {
return(false);
}
if (lcard.joker || (rcard.joker)) {
return(true);
}
if ((lcard.rightColor == rcard.leftColor) || (lcard.rightShape == rcard.leftShape)) {
return(true);
}
return(false);
}
function isFull() {
return(mOccupiedSlots == mSlotsNum);
}
function isEmpty() {
return(mOccupiedSlots == 0);
}
function filledSlotsNum() {
return(mOccupiedSlots);
}
function reset() {
initSlots();
}
function activate() {
var i = 1;
while (i <= mSlotsNum) {
eval (("duplicatedSlot" + i) + "_mc").onPress = _root.tableCardOnPress;
eval (("duplicatedSlot" + i) + "_mc").onRelease = _root.tableCardOnRelease;
i++;
}
}
function deactivate() {
var i = 1;
while (i <= mSlotsNum) {
eval (("duplicatedSlot" + i) + "_mc").onPress = undefined;
eval (("duplicatedSlot" + i) + "_mc").onRelease = undefined;
i++;
}
}
function initSlots() {
var _local2 = 1;
while (_local2 <= mSlotsNum) {
mSlotLocations[_local2].idx = _local2;
mSlotLocations[_local2].isOccupied = false;
_local2++;
}
mOccupiedSlots = 0;
}
function setConstraint(ridx, constraint) {
mConstraints[ridx] = constraint;
var lidx = ((ridx == 8) ? 1 : (ridx + 1));
var slice = eval ((("_root.slice" + ridx) + lidx) + "_mc");
if (constraint == undefined) {
slice.mc.removeMovieClip();
} else {
slice.attachMovie(constraint + "_constraint", "mc", _root.getNextDepth());
_root.registerStageMC(slice.mc);
}
}
function getConstraint(lidx, ridx) {
var _local2 = ((lidx == 1) ? 8 : (lidx - 1));
return(mConstraints[_local2]);
}
function getConstraintIdxFromCursor() {
var ridx = 1;
while (ridx <= mSlotsNum) {
var lidx = ((ridx == 8) ? 1 : (ridx + 1));
var slice = eval ((("_root.slice" + ridx) + lidx) + "_mc");
if (slice.hitTest(_root._xmouse, _root._ymouse, true)) {
return(ridx);
}
ridx++;
}
return(undefined);
}
function getSlotFromCursor() {
var _local3 = 1;
while (_local3 <= mSlotsNum) {
if (mSlotLocations[_local3].hitTest(_root._xmouse, _root._ymouse, true)) {
return(mSlotLocations[_local3]);
}
_local3++;
}
return(undefined);
}
function getSlotIdxFromCursor() {
var _local3 = 1;
while (_local3 <= mSlotsNum) {
if (mSlotLocations[_local3].hitTest(_root._xmouse, _root._ymouse, true)) {
return(_local3);
}
_local3++;
}
return(undefined);
}
function getSlotIdxAndSideFromCursor() {
var _local3 = 1;
while (_local3 <= mSlotsNum) {
if (mSlotLocations[_local3].hitTest(_root._xmouse, _root._ymouse, true)) {
var _local4 = new Object();
_local4.idx = _local3;
if (mSlotLocations[_local3].leftColor.hitTest(_root._xmouse, _root._ymouse, true)) {
_local4.leftSide = true;
} else {
_local4.leftSide = false;
}
return(_local4);
}
_local3++;
}
return(undefined);
}
function getDuplicatedSlot(idx) {
_root.mainDeck.mSlotMCs[0].duplicateMovieClip(("duplicatedSlot" + idx) + "_mc", _root.getNextDepth());
var newSlot = eval (("duplicatedSlot" + idx) + "_mc");
newSlot._x = mSlotLocations[idx]._x;
newSlot._y = mSlotLocations[idx]._y;
newSlot._rotation = mSlotLocations[idx]._rotation;
newSlot._alpha = 100;
_root.registerStageMC(newSlot);
return(newSlot);
}
function hasConstraints() {
var _local2 = 0;
while (_local2 < mConstraints.length) {
if (mConstraints[_local2] != undefined) {
return(true);
}
_local2++;
}
return(false);
}
function getLeftEffectCoords(idx) {
return(mSlotLocations[idx].leftEffectCoords);
}
function getRightEffectCoords(idx) {
return(mSlotLocations[idx].rightEffectCoords);
}
function getSliceEffectCoords(ridx) {
var lidx = ((ridx == 8) ? 1 : (ridx + 1));
var slice = eval ((("_root.slice" + ridx) + lidx) + "_mc");
return(slice);
}
function getTileEffectCoords(idx) {
return(mSlotLocations[idx]);
}
}
Symbol 1221 Button
on (release) {
_root.playSound("button1.wav");
_root.clearStage();
_root.gotoAndStop("menu");
}
Symbol 1230 MovieClip Frame 23
stop();
Symbol 1245 MovieClip Frame 1
gotoAndStop ("unused");
Symbol 1245 MovieClip Frame 14
if (this.onEnd != undefined) {
this.onEnd();
}
stop();
Symbol 1245 MovieClip Frame 15
stop();
Symbol 1262 Button
on (release) {
_root.playSound("button1.wav");
_root.playSound("New Message");
_root.updateInstructionInWindow();
}