Frame 1
function update() {
var _local1 = Math.floor(mcState.mcProgress._totalframes * (nFakePc / 100));
mcState.txtPercent.text = nFakePc + "%";
}
Stage.showMenu = false;
_focusrect = false;
var MAX_LOAD_SPEED = 2;
var TARGET_LABEL = "Loaded";
var nFakePc = 0;
var nPc;
var sPc;
var nFrame;
this.onEnterFrame = function () {
var _local2 = getBytesLoaded() / getBytesTotal();
nPc = Math.floor(_local2 * 100);
nFakePc = nFakePc + MAX_LOAD_SPEED;
if (nFakePc > nPc) {
nFakePc = nPc;
}
update();
if (nFakePc == 100) {
delete this.onEnterFrame;
gotoAndStop(TARGET_LABEL);
}
};
stop();
Frame 10
nextFrame();
Frame 11
new Main(this);
Symbol 3 MovieClip [SarbakanLibrary] Frame 1
#initclip 1
Object.registerClass("SarbakanLibrary", LibCompileHookComponent);
#endinitclip
Symbol 70 Button
on (keyPress "<Left>") {
return(undefined);
}
on (keyPress "<Right>") {
return(undefined);
}
on (keyPress "<Up>") {
return(undefined);
}
on (keyPress "<Down>") {
return(undefined);
}
Symbol 76 MovieClip Frame 1
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doAddHouse(this);
Symbol 78 MovieClip Frame 1
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doAddStartingPosition(this);
Symbol 81 MovieClip Frame 1
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doAddKrustyKrab(this);
Symbol 84 MovieClip Frame 1
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doAddChumBucket(this);
Symbol 111 MovieClip Frame 1
stop();
Symbol 127 MovieClip Frame 1
stop();
Symbol 751 MovieClip Frame 1
stop();
Symbol 757 MovieClip Frame 6
stop();
Symbol 763 MovieClip Frame 6
stop();
Symbol 769 MovieClip Frame 6
stop();
Symbol 775 MovieClip Frame 6
stop();
Symbol 779 MovieClip Frame 6
stop();
Symbol 781 MovieClip Frame 1
this.swapDepths(666);
this.removeMovieClip();
Symbol 16 MovieClip [__Packages.Library.DispatcherBase] Frame 0
class Library.DispatcherBase
{
var bPaused, aListeners;
function DispatcherBase () {
bPaused = false;
aListeners = new Array();
}
function doEnterFrame() {
if (!bPaused) {
doDispatchMessage("doEnterFrame");
}
}
function doAddListener(_oRef) {
aListeners.push(_oRef);
}
function doRemoveListener(_oRef) {
for (var _local2 in aListeners) {
if (aListeners[_local2] == _oRef) {
delete aListeners[_local2];
aListeners.splice(Number(_local2), 1);
}
}
}
function doPause() {
bPaused = true;
doDispatchMessage("doPause");
}
function doResume() {
bPaused = false;
doDispatchMessage("doResume");
}
function doDestroy() {
delete aListeners;
}
function doDispatchMessage(_sMessage) {
for (var _local3 in aListeners) {
aListeners[_local3][_sMessage]();
}
}
}
Symbol 21 MovieClip [__Packages.Main] Frame 0
class Main extends Library.DispatcherBase
{
static var oCtrl;
var mcRef, oTransition, doAddListener, bHSScrolling, bSubmitScoreAuto, bHighScoresFromTitle, oHS, nHSScrollChange, sTargetSection, oMusicPack, oGameCtrl, nLatestScore, sCurrentSection;
function Main (_mcRef) {
super();
mcRef = _mcRef;
oCtrl = this;
mcRef.onEnterFrame = Library.Utils.Delegate.create(this, doEnterFrame);
oTransition = new Library.Transition(mcRef.mcTransition);
oTransition.__set__Listener(this);
doAddListener(oTransition);
var _local3 = mcRef.createEmptyMovieClip("mcSounds", nSOUND_MC_DEPTH);
Library.Sound.SoundManager.doInit(_local3);
Library.Sound.SoundManager.setCategoryVolume(sSOUND_CAT_MUSIC, nSOUND_VOLUME_MUSIC);
Library.Sound.SoundManager.setCategoryVolume(sSOUND_CAT_SOUND, nSOUND_VOLUME_SOUND);
bHSScrolling = false;
bSubmitScoreAuto = false;
bHighScoresFromTitle = false;
oHS = new NickHS("sb_blast", true, false);
doTransitionTo(sSECTION_TITLE);
}
function doEnterFrame() {
super.doEnterFrame();
if (bHSScrolling) {
mcRef.mcState.mcHS.txtHSName.scroll = mcRef.mcState.mcHS.txtHSName.scroll + nHSScrollChange;
mcRef.mcState.mcHS.txtHSScore.scroll = mcRef.mcState.mcHS.txtHSScore.scroll + nHSScrollChange;
}
}
function onPlayerLose() {
doTransitionTo(sSECTION_LOSE);
}
function onPlayerWon() {
doTransitionTo(sSECTION_WIN);
}
function doButtonClick() {
var _local1 = Library.Sound.SoundManager.isSoundPlaying("Click.mp3").oSound.doStop();
Library.Sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, "Click.mp3", nVOLUME_BUTTONS_CLICK);
}
function doButtonRoll() {
var _local1 = Library.Sound.SoundManager.isSoundPlaying("Rollover.mp3").oSound.doStop();
Library.Sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, "Rollover.mp3", nVOLUME_BUTTONS_ROLL);
}
function onBtnClickTitlePlay() {
doTransitionTo(sSECTION_GAME);
}
function onBtnClickPlayAgain() {
doTransitionTo(sSECTION_TITLE);
}
function doViewHSFromWinLose() {
bHighScoresFromTitle = false;
doTransitionTo(sSECTION_HIGHSCORES);
}
function doSubmitFromWinLose() {
bHighScoresFromTitle = false;
bSubmitScoreAuto = true;
doTransitionTo(sSECTION_HIGHSCORES);
}
function onBtnClickTitleHelp() {
doTransitionTo(sSECTION_HELP);
}
function onBtnClickTitleHS() {
bHighScoresFromTitle = true;
doTransitionTo(sSECTION_HIGHSCORES);
}
function onBtnClickTitleStory() {
doTransitionTo(sSECTION_STORY);
}
function onBtnClickBackStory() {
doTransitionTo(sSECTION_TITLE);
}
function onBtnClickHSPlayAgain() {
doTransitionTo(sSECTION_TITLE);
}
function onBtnClickSubmitHS() {
bHighScoresFromTitle = false;
doSubmitScore();
doTransitionTo(sSECTION_HIGHSCORES);
}
function onBtnClickHSBack() {
doTransitionTo(sSECTION_TITLE);
}
function onBtnClickHelpPlay() {
doTransitionTo(sSECTION_GAME);
}
function onBtnClickHelpNext() {
mcRef.mcState.nextFrame();
doUpdateHelpButton();
}
function onBtnClickHelpBack() {
mcRef.mcState.prevFrame();
doUpdateHelpButton();
}
function doApplyRollSoundOn(_btnAffect) {
_btnAffect.onRollOver = Library.Utils.Delegate.create(this, doButtonRoll);
}
function doApplyClickSoundOn(_btnAffect) {
_btnAffect.onPress = Library.Utils.Delegate.create(this, doButtonClick);
}
function doStartScrollHsList(_nChange) {
bHSScrolling = true;
nHSScrollChange = _nChange;
}
function doStopScrollHsList() {
bHSScrolling = false;
}
function onTransitionEvent(_nEvent, _oTransition) {
switch (_nEvent) {
case Library.Transition.TRANSITION_SCREEN_COVERED :
setSection(sTargetSection);
break;
case Library.Transition.TRANSITION_COMPLETE :
}
}
function doSoundEvent(_nEvent, _oSound) {
if (_nEvent == Library.Sound.SoundManager.nEVENT_SOUND_COMPLETE) {
if (_oSound == oMusicPack) {
delete oMusicPack;
}
}
}
function doCreateButton(_btnRef, _fAction) {
_btnRef.onRelease = Library.Utils.Delegate.create(this, _fAction);
doApplyRollSoundOn(_btnRef);
doApplyClickSoundOn(_btnRef);
}
function get GameCtrl() {
return(oGameCtrl);
}
static function get Instance() {
return(oCtrl);
}
function doUnloadGame() {
nLatestScore = oGameCtrl.Score;
delete oGameCtrl;
}
function doStartGame() {
oGameCtrl = new Game(mcRef.mcState);
}
function doSubmitScore() {
oHS.submitScore(nLatestScore);
}
function doSetUpScreenHS() {
oHS.G_NameTxtField = mcRef.mcState.mcHS.txtHSName;
oHS.G_ScoreTxtField = mcRef.mcState.mcHS.txtHSScore;
var _local2 = true;
if (bHighScoresFromTitle) {
mcRef.mcState.mcButtons.gotoAndStop("Back");
doCreateButton(mcRef.mcState.mcButtons.btnBack, onBtnClickHSBack);
doApplyRollSoundOn(mcRef.mcState.mcButtons.btnBack);
mcRef.mcState.mcScore._visible = false;
} else {
mcRef.mcState.mcScore.txtScore.text = Library.Utils.Tools.getFormatedNumber(nLatestScore, 0);
mcRef.mcState.mcButtons.gotoAndStop("PlayAgain");
doCreateButton(mcRef.mcState.mcButtons.btnPlayAgain, onBtnClickHSPlayAgain);
doCreateButton(mcRef.mcState.mcButtons.btnSubmitHS, onBtnClickSubmitHS);
doApplyRollSoundOn(mcRef.mcState.mcButtons.btnPlayAgain);
doApplyRollSoundOn(mcRef.mcState.mcButtons.btnBack);
doApplyRollSoundOn(mcRef.mcState.mcButtons.btnSubmitHS);
if (!oHS.getIsLoggedIn()) {
mcRef.mcState.mcButtons.btnSubmitHS._visible = false;
}
if (bSubmitScoreAuto) {
doSubmitScore();
_local2 = false;
mcRef.mcState.mcButtons.btnSubmitHS._visible = false;
}
}
if (_local2) {
oHS.getScores();
}
mcRef.mcState.btnHaut.onPress = Library.Utils.Delegate.create(this, doStartScrollHsList, -1);
mcRef.mcState.btnBas.onPress = Library.Utils.Delegate.create(this, doStartScrollHsList, 1);
mcRef.mcState.btnHaut.onRelease = Library.Utils.Delegate.create(this, doStopScrollHsList);
mcRef.mcState.btnHaut.onReleaseOutside = Library.Utils.Delegate.create(this, doStopScrollHsList);
mcRef.mcState.btnHaut.onRollOut = Library.Utils.Delegate.create(this, doStopScrollHsList);
mcRef.mcState.btnBas.onRelease = Library.Utils.Delegate.create(this, doStopScrollHsList);
mcRef.mcState.btnBas.onReleaseOutside = Library.Utils.Delegate.create(this, doStopScrollHsList);
mcRef.mcState.btnBas.onRollOut = Library.Utils.Delegate.create(this, doStopScrollHsList);
doApplyRollSoundOn(mcRef.mcState.btnHaut);
doApplyRollSoundOn(mcRef.mcState.btnBas);
}
function doSetUpScreenHelp() {
doCreateButton(mcRef.mcState.btnNext, onBtnClickHelpNext);
doCreateButton(mcRef.mcState.btnPlay, onBtnClickHelpPlay);
mcRef.mcState.btnResume._visible = false;
}
function doSetUpScreenTitle() {
doCreateButton(mcRef.mcState.btnPlay, onBtnClickTitlePlay);
doCreateButton(mcRef.mcState.btnInstructions, onBtnClickTitleHelp);
doCreateButton(mcRef.mcState.btnViewHS, onBtnClickTitleHS);
doCreateButton(mcRef.mcState.btnStory, onBtnClickTitleStory);
doApplyRollSoundOn(mcRef.mcState.btnPlay);
doApplyRollSoundOn(mcRef.mcState.btnInstructions);
doApplyRollSoundOn(mcRef.mcState.btnViewHS);
doApplyRollSoundOn(mcRef.mcState.btnStory);
}
function doSetUpStory() {
doCreateButton(mcRef.mcState.btnBack, onBtnClickBackStory);
doApplyRollSoundOn(mcRef.mcState.btnBack);
}
function doSetUpWin() {
doSetUpWinLoseShared();
}
function doSetUpLose() {
doSetUpWinLoseShared();
}
function doSetUpWinLoseShared() {
mcRef.mcState.mcScore.txtScore.text = Library.Utils.Tools.getFormatedNumber(nLatestScore, 0);
if (oHS.getIsLoggedIn() && (oHS.bHSAvailable)) {
doCreateButton(mcRef.mcState.btnSubmitHS, doSubmitFromWinLose);
} else {
mcRef.mcState.btnSubmitHS._visible = false;
}
doCreateButton(mcRef.mcState.btnViewHS, doViewHSFromWinLose);
doCreateButton(mcRef.mcState.btnPlayAgain, onBtnClickPlayAgain);
doApplyRollSoundOn(mcRef.mcState.btnSubmitHS);
doApplyRollSoundOn(mcRef.mcState.btnViewHS);
doApplyRollSoundOn(mcRef.mcState.btnPlay);
}
function doStopPackMusic() {
oMusicPack.doFadeTo(0);
}
function doStartPackMusic() {
if (oMusicPack == undefined) {
oMusicPack = Library.Sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_MUSIC, "Music_Pack.wav", 0, 999999999);
oMusicPack.doAddListener(this);
}
oMusicPack.doFadeTo(100);
}
function setSection(_sSection) {
doUnloadSection(sCurrentSection);
sCurrentSection = _sSection;
mcRef.gotoAndStop(sCurrentSection);
doLoadSection();
}
function doLoadSection() {
switch (sCurrentSection) {
case sSECTION_TITLE :
doSetUpScreenTitle();
doStartPackMusic();
break;
case sSECTION_HELP :
doSetUpScreenHelp();
doStartPackMusic();
break;
case sSECTION_GAME :
doStartGame();
doStopPackMusic();
break;
case sSECTION_HIGHSCORES :
doSetUpScreenHS();
doStartPackMusic();
break;
case sSECTION_LOSE :
doSetUpLose();
doStartPackMusic();
break;
case sSECTION_WIN :
doSetUpWin();
doStartPackMusic();
break;
case sSECTION_STORY :
doSetUpStory();
}
}
function doUnloadSection(_sSection) {
if (!(_sSection === sSECTION_GAME)) {
} else {
doUnloadGame();
}
}
function doTransitionTo(_sSection) {
if ((_sSection != sTargetSection) && (oTransition.__get__CurrentState() == Library.Transition.sSTATE_HIDDEN)) {
sTargetSection = _sSection;
oTransition.doStart();
Library.Sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, "Transition.mp3");
}
}
function doUpdateHelpButton() {
doCreateButton(mcRef.mcState.btnNext, onBtnClickHelpNext);
doCreateButton(mcRef.mcState.btnBack, onBtnClickHelpBack);
}
static var sSOUND_CAT_SOUND = "Sfx";
static var sSOUND_CAT_MUSIC = "Music";
static var nSOUND_VOLUME_MUSIC = 45;
static var nSOUND_VOLUME_SOUND = 100;
static var sSECTION_TITLE = "Title";
static var sSECTION_HELP = "Instructions";
static var sSECTION_GAME = "Game";
static var sSECTION_WIN = "Win";
static var sSECTION_LOSE = "Lose";
static var sSECTION_HIGHSCORES = "HighScore";
static var sSECTION_STORY = "Story";
static var nSOUND_MC_DEPTH = 10;
static var nVOLUME_BUTTONS_CLICK = 75;
static var nVOLUME_BUTTONS_ROLL = 100;
}
Symbol 14 MovieClip [__Packages.Library.State] Frame 0
class Library.State
{
var mcRef, bStateLocked, bPaused, sState, nStateTotalFrame;
function State (_mcRef) {
mcRef = _mcRef;
bStateLocked = false;
bPaused = false;
}
function doEnterFrame() {
this["do" + sState]();
}
function doPause() {
bPaused = true;
mcRef.mcState.stop();
}
function doResume() {
bPaused = false;
mcRef.mcState.play();
}
function setState(_sState) {
if (!bStateLocked) {
doForcedSetState(_sState);
}
}
function doForcedSetState(_sState) {
if (sState != _sState) {
doUnLoadStateAction(sState);
sState = _sState;
mcRef.gotoAndStop(sState);
nStateTotalFrame = mcRef.mcState._totalframes;
doLoadStateAction(sState);
}
}
function doDestroy() {
delete mcRef;
}
function get Paused() {
return(bPaused);
}
function get CurrentState() {
return(sState);
}
function doLoadStateAction() {
}
function doUnLoadStateAction() {
}
function doLockState() {
bStateLocked = true;
}
function doUnlockState() {
bStateLocked = false;
}
function isStateComplete() {
var _local2 = false;
if (mcRef.mcState._currentframe == nStateTotalFrame) {
_local2 = true;
}
return(_local2);
}
function isStateStarting() {
var _local2 = false;
if (mcRef.mcState._currentframe == 1) {
_local2 = true;
}
return(_local2);
}
}
Symbol 17 MovieClip [__Packages.Library.Transition] Frame 0
class Library.Transition extends Library.State
{
var setState, isStateComplete, oListener, __get__Listener, mcRef;
function Transition (_mcRef) {
super(_mcRef);
setState(sSTATE_HIDDEN);
}
function doStart() {
setState(sSTATE_IN);
}
function doDestroy() {
}
function doIn() {
if (isStateComplete()) {
oListener.onTransitionEvent(TRANSITION_SCREEN_COVERED, this);
setState(sSTATE_OUT);
}
}
function doOut() {
if (isStateComplete()) {
oListener.onTransitionEvent(TRANSITION_COMPLETE, this);
setState(sSTATE_HIDDEN);
}
}
function set Listener(_o) {
oListener = _o;
//return(__get__Listener());
}
function doLoadStateAction() {
mcRef.mcState.btnBlock.useHandCursor = false;
}
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_IN = "In";
static var sSTATE_OUT = "Out";
static var TRANSITION_SCREEN_COVERED = 1;
static var TRANSITION_COMPLETE = 2;
}
Symbol 19 MovieClip [__Packages.NickHS] Frame 0
class NickHS
{
static var oNickHS;
var bHSAvailable, G_TestHighScore, bSubmitHS, bGetHS, G_GameID, mcHSZone, G_NoTxtField, G_NameTxtField, G_ScoreTxtField;
function NickHS (_sGameID, _bHSAvailable, _bTestHighScore) {
bHSAvailable = _bHSAvailable;
G_TestHighScore = _bTestHighScore;
bSubmitHS = false;
bGetHS = false;
G_GameID = _sGameID;
mcHSZone = undefined;
initHiScores();
if (G_TestHighScore == true) {
_global.gProxyObj.setServer("www.nick.com");
_global.gProxyObj.setScreenName("Sbk");
_global.gProxyObj.setIsLoggedIn(true);
}
oNickHS = this;
}
function doHSInit() {
initHiScores();
}
function doSubmitHS() {
bSubmitHS = true;
}
function doViewHS() {
bGetHS = true;
}
function setHSBoard(_mcRef) {
mcHSZone = _mcRef;
G_NoTxtField = mcHSZone.txtHSNumber;
G_NameTxtField = mcHSZone.txtHSName;
G_ScoreTxtField = mcHSZone.txtHSScore;
}
static function get Instance() {
return(oNickHS);
}
function getIsLoggedIn() {
var _local2 = false;
if (_global.gProxyObj != undefined) {
_local2 = _global.gProxyObj.getIsLoggedIn();
}
return(_local2);
}
function getScores() {
if (_global.gProxyObj == undefined) {
listScores();
} else {
_global.gProxyObj.getScores(cbFunc2);
}
}
function submitScore(theScore) {
G_NoTxtField.text = "";
G_NameTxtField.text = "The high score list is updating!";
G_ScoreTxtField.text = "";
_global.gProxyObj.submitScore(theScore, cbFunc);
}
function initHiScores() {
_global.gProxyObj.setGame_Id(G_GameID);
}
function getScoreString() {
var _local11 = "Oops! The high score list is not available right now!";
if (_global.gProxyObj != undefined) {
var _local7 = _global.gProxyObj.getScoreCount();
if (_local7 > 0) {
var _local3;
var _local4;
var _local5;
var _local6;
_local11 = "";
var _local10 = "";
var _local9 = "";
var _local8 = "";
_local3 = 0;
while (_local3 < _local7) {
_local4 = _global.gProxyObj.getScoreItem(_local3);
_local5 = _local4[0];
_local6 = Library.Utils.Tools.returnFormatedNumber(_local4[1]);
_local10 = _local10 + ((_local3 + 1) + newline);
_local9 = _local9 + (_local5 + newline);
_local8 = _local8 + (_local6 + newline);
_local3++;
}
G_NoTxtField.text = _local10;
G_NameTxtField.text = _local9;
G_ScoreTxtField.text = _local8;
} else {
G_NameTxtField.text = "Oops! The high score list is not available right now!";
}
} else {
G_NameTxtField.text = "Oops! The high score list is not available right now!";
}
return(_local11);
}
function listScores() {
getScoreString();
}
function cbFunc(thisBool) {
if (thisBool) {
Instance.listScores();
} else {
Instance.G_NameTxtField.text = "Oops! The high score list is not available right now!";
}
}
function cbFunc2(thisBool) {
if (thisBool) {
Instance.listScores();
} else {
Instance.G_NameTxtField.text = "Oops! The high score list is not available right now!";
}
}
}
Symbol 12 MovieClip [__Packages.Library.Utils.Tools] Frame 0
class Library.Utils.Tools
{
function Tools () {
}
static function isItemInArray(_aArray, _oItem) {
var _local2 = false;
for (var _local4 in _aArray) {
if (_aArray[_local4] == _oItem) {
_local2 = true;
}
}
return(_local2);
}
static function doCopyArray(_aArraySource) {
var _local3 = new Array();
var _local1 = 0;
_local1 = 0;
while (_local1 < _aArraySource.length) {
if (_aArraySource[_local1] instanceof Array) {
_local3.push(doCopyArray(_aArraySource[_local1]));
} else {
_local3.push(_aArraySource[_local1]);
}
_local1++;
}
return(_local3);
}
static function getFormatedNumber(_nNumber, _nMinimumChar) {
return(returnFormatedNumber(_nNumber, _nMinimumChar));
}
static function returnFormatedNumber(_nNumber, _nMinimumChar) {
var _local1 = String(_nNumber);
while (_local1.length < _nMinimumChar) {
_local1 = "0" + _local1;
}
var _local3 = new Array();
var _local6 = _local1.length - 1;
var _local2;
_local2 = 0;
while (_local2 <= _local6) {
var _local5 = _local1.charAt(_local2);
_local3.push(_local5);
_local2++;
}
_local1 = "";
var _local4 = 0;
_local2 = _local3.length - 1;
while (_local2 >= 0) {
if (((_local4 % 3) == 0) && (_local4 != 0)) {
_local1 = " " + _local1;
}
_local1 = _local3[_local2] + _local1;
_local4++;
_local2--;
}
return(_local1);
}
static function getFormatedTime(_nTime, _bIncludeMilliseconds) {
if (_bIncludeMilliseconds == undefined) {
_bIncludeMilliseconds = false;
}
var _local6 = false;
if (_nTime < 0) {
_local6 = true;
_nTime = Math.abs(_nTime);
}
var _local4 = Math.floor(_nTime / 1000);
var _local3;
if (_bIncludeMilliseconds) {
var _local5;
if (_nTime >= 1000) {
_local5 = _nTime % (_local4 * 1000);
} else {
_local5 = _nTime;
}
_local3 = String(_local5).substr(0, 2);
if (_local3.length <= 1) {
_local3 = "0" + _local3;
}
}
var _local7 = Math.floor(_local4 / 60);
var _local8 = Math.floor(_local4 % 60);
var _local11 = "";
var _local9 = "";
if (_local8 < 10) {
_local9 = "0";
}
if (_local7 < 10) {
_local11 = "0";
}
var _local2 = String((((_local11 + _local7) + ":") + _local9) + _local8);
if (_bIncludeMilliseconds) {
_local2 = _local2 + (":" + _local3);
}
if (_local6) {
_local2 = "-" + _local2;
}
return(_local2);
}
static function getTrimmedString(_sStr) {
while (_sStr.charAt(0) == " ") {
_sStr = _sStr.substring(1, _sStr.length);
}
while (_sStr.charAt(_sStr.length - 1) == " ") {
_sStr = _sStr.substring(0, _sStr.length - 1);
}
return(_sStr);
}
}
Symbol 46 MovieClip [__Packages.Game] Frame 0
class Game extends Library.DispatcherBase
{
var nScore, mcRef, bPlayerWon, bWathCountdown, bNPCinit, aScorePlayers, oPopMenu, doAddListener, oPopMenuConfirm, oPopLevelTransition, oPopHelp, oTransition, oPlayerChoose, oStatus, nPlayer, sCurrentSection, sTargetSection, oLevelManagement, nCurrentLevel, doRemoveListener, oMusicGame;
function Game (_mcRef, _nPlayer) {
super();
nScore = 0;
mcRef = _mcRef;
bPlayerWon = false;
bWathCountdown = false;
bNPCinit = false;
aScorePlayers = new Array();
oPopMenu = new Library.BasicPopUp(mcRef.mcPopups.mcMenu, false);
oPopMenu.__set__Listener(this);
doAddListener(oPopMenu);
oPopMenuConfirm = new Library.BasicPopUp(mcRef.mcPopups.mcConfirm, false);
oPopMenuConfirm.__set__Listener(this);
doAddListener(oPopMenuConfirm);
oPopLevelTransition = new Library.BasicPopUp(mcRef.mcPopups.mcLevelPop, false);
oPopLevelTransition.__set__Listener(this);
doAddListener(oPopLevelTransition);
oPopHelp = new Library.BasicPopUp(mcRef.mcPopups.mcHelp, false);
oPopHelp.__set__Listener(this);
doAddListener(oPopHelp);
oTransition = new Library.Transition(mcRef.mcTransition, false);
oTransition.__set__Listener(this);
doAddListener(oTransition);
oPlayerChoose = new PlayerChooser(mcRef);
oStatus = new GameStatus();
Main.__get__Instance().doAddListener(this);
doStartGameMusic();
}
function doStartGame(_nPlayer) {
nPlayer = _nPlayer;
aScorePlayers = new Array();
mcRef.gotoAndStop(sLABEL_GAME);
sCurrentSection = sLABEL_GAME;
sTargetSection = undefined;
mcRef.mcCountDown.stop();
bNPCinit = false;
var _local2 = 0;
while (_local2 < LD.nMAX_PLAYER) {
aScorePlayers.push(new BasicScoreHUD(getPlayerScoreHud(_local2 + 1)));
_local2++;
}
doCreateButton(mcRef.mcScreen.mcHud.btnMenu, onBtnClickMenuHUD);
oLevelManagement = new LevelManager(mcRef.mcScreen.mcLevelHolder, nPlayer);
doStartCountdown();
}
function doStartFirstGame(_nChoosenPlayer) {
nPlayer = _nChoosenPlayer;
doTransitionTo(sLABEL_GAME);
}
function doNPCinit() {
bNPCinit = true;
}
function getNPCstatus() {
return(bNPCinit);
}
function doEndGame(_nCurrentLevel, _nPlayerScore, _bPlayerWon) {
nCurrentLevel = _nCurrentLevel;
nScore = nScore + _nPlayerScore;
bPlayerWon = _bPlayerWon;
oPopLevelTransition.doOpen();
}
function doEnterFrame() {
super.doEnterFrame();
if (bWathCountdown) {
doCheckCountdown();
}
}
function onBtnClickMenuResume() {
if (bWathCountdown) {
mcRef.mcCountDown.play();
} else {
oLevelManagement.doResume();
}
oPopMenu.doClose();
}
function onBtnClickMenuQuit() {
oPopMenuConfirm.doOpen();
}
function onBtnClickMenuConfirmYes() {
oPopMenuConfirm.doClose();
oPopMenu.doClose();
oLevelManagement.doGameOver();
}
function onBtnClickMenuConfirmNo() {
oPopMenuConfirm.doClose();
}
function onBtnClickHelp() {
oPopHelp.doOpen();
}
function onBtnClickHelpNext() {
oPopHelp.__get__Ref().nextFrame();
oPopHelp.setCurrentPage(1);
doUpdatePopHelp();
}
function onBtnClickHelpBack() {
oPopHelp.__get__Ref().prevFrame();
oPopHelp.setCurrentPage(-1);
doUpdatePopHelp();
}
function onBtnClickHelpResume() {
oPopHelp.doClose();
}
function onBtnClickHelpPlay() {
oPopHelp.doClose();
oLevelManagement.doResume();
}
function onBtnClickMenuHUD() {
if (bWathCountdown) {
mcRef.mcCountDown.stop();
}
oPopMenu.doOpen();
oLevelManagement.doPause();
}
function onBtnClickSFXToggle() {
if (Library.Sound.SoundManager.isCategoryMuted(Main.sSOUND_CAT_SOUND)) {
oPopMenu.__get__Ref().mcSoundToggle.gotoAndStop(sLABEL_ON);
doCreateButton(oPopMenu.__get__Ref().mcSoundToggle.btnToggle, onBtnClickSFXToggle);
Library.Sound.SoundManager.doUnMuteCategory(Main.sSOUND_CAT_SOUND);
} else {
oPopMenu.__get__Ref().mcSoundToggle.gotoAndStop(sLABEL_OFF);
doCreateButton(oPopMenu.__get__Ref().mcSoundToggle.btnToggle, onBtnClickSFXToggle);
Library.Sound.SoundManager.doMuteCategory(Main.sSOUND_CAT_SOUND);
}
}
function onBtnClickMusicToggle() {
if (Library.Sound.SoundManager.isCategoryMuted(Main.sSOUND_CAT_MUSIC)) {
oPopMenu.__get__Ref().mcMusicToggle.gotoAndStop(sLABEL_ON);
doCreateButton(oPopMenu.__get__Ref().mcMusicToggle.btnToggle, onBtnClickMusicToggle);
Library.Sound.SoundManager.doUnMuteCategory(Main.sSOUND_CAT_MUSIC);
} else {
oPopMenu.__get__Ref().mcMusicToggle.gotoAndStop(sLABEL_OFF);
doCreateButton(oPopMenu.__get__Ref().mcMusicToggle.btnToggle, onBtnClickMusicToggle);
Library.Sound.SoundManager.doMuteCategory(Main.sSOUND_CAT_MUSIC);
}
}
function onBtnClickLevelTransitionNext() {
if (!bPlayerWon) {
doStopGameMusic();
Main.__get__Instance().onPlayerLose();
oPopLevelTransition.doClose();
} else {
oPopLevelTransition.doClose();
if (!oStatus.__get__GameOver()) {
doTransitionTo(sLABEL_NEXTLEVEL);
} else {
Main.__get__Instance().onPlayerWon();
doStopGameMusic();
}
}
}
function onPopUpEvent(_nEvent, _oPop) {
if (!(_nEvent === Library.BasicPopUp.NEED_UPDATE)) {
} else {
switch (_oPop) {
case oPopMenu :
doUpdatePopMenu();
break;
case oPopMenuConfirm :
doUpdatePopMenuConfirm();
break;
case oPopHelp :
doUpdatePopHelp();
break;
case oPopLevelTransition :
doUpdatePopLevelTransition();
}
}
}
function onTransitionEvent(_nEvent, _oTransition) {
switch (_nEvent) {
case Library.Transition.TRANSITION_SCREEN_COVERED :
setSection(sTargetSection);
break;
case Library.Transition.TRANSITION_COMPLETE :
}
}
function setTimer(_sTime) {
mcRef.mcScreen.mcHud.txtTimer.text = _sTime;
}
function setScore(_aScores, _aOwnedTiles, _aOwnedHouses, _aOwnedCommercials) {
var _local2 = 0;
while (_local2 < LD.nMAX_PLAYER) {
if (aScorePlayers[_local2].Score != _aScores[_local2]) {
aScorePlayers[_local2].setOwnedHouses(_aOwnedHouses[_local2]);
aScorePlayers[_local2].setOwnedTiles(_aOwnedTiles[_local2]);
aScorePlayers[_local2].setOwnedCommercials(_aOwnedCommercials[_local2]);
aScorePlayers[_local2].setNewScore(_aScores[_local2]);
}
_local2++;
}
}
function doDestroy() {
Main.__get__Instance().doRemoveListener(this);
doRemoveListener(oPopMenu);
oPopMenu.doDestroy();
delete oPopMenu;
doRemoveListener(oPopMenuConfirm);
oPopMenuConfirm.doDestroy();
delete oPopMenuConfirm;
doRemoveListener(oPopHelp);
oPopHelp.doDestroy();
delete oPopHelp;
doRemoveListener(oPopLevelTransition);
oPopLevelTransition.doDestroy();
delete oPopLevelTransition;
doRemoveListener(oTransition);
oTransition.doDestroy();
delete oTransition;
oLevelManagement.doDestroy();
delete oLevelManagement;
oPlayerChoose.doDestroy();
delete oPlayerChoose;
delete oStatus;
var _local3 = 0;
while (_local3 < aScorePlayers.length) {
aScorePlayers[_local3].doDestroy();
delete aScorePlayers[_local3];
_local3++;
}
delete aScorePlayers;
super.doDestroy();
}
function get Score() {
return(nScore);
}
function get BaseLevel() {
return(oStatus);
}
function get LevelManagement() {
return(oLevelManagement);
}
function get Ref() {
return(mcRef);
}
function setSection(_sSection) {
sCurrentSection = _sSection;
doLoadSection();
}
function doLoadSection() {
switch (sCurrentSection) {
case sLABEL_GAME :
doStartGame(nPlayer);
break;
case sLABEL_NEXTLEVEL :
mcRef.gotoAndStop(sLABEL_NEXTLEVEL);
oLevelManagement.doDestroy();
doStartGame(nPlayer);
}
}
function doStartCountdown() {
mcRef.mcCountDown.play();
bWathCountdown = true;
}
function doUpdatePopMenu() {
doCreateButton(oPopMenu.__get__Ref().btnResume, onBtnClickMenuResume);
doCreateButton(oPopMenu.__get__Ref().btnQuit, onBtnClickMenuQuit);
doCreateButton(oPopMenu.__get__Ref().btnHelp, onBtnClickHelp);
if (!Library.Sound.SoundManager.isCategoryMuted(Main.sSOUND_CAT_MUSIC)) {
oPopMenu.__get__Ref().mcSoundToggle.gotoAndStop(sLABEL_ON);
doCreateButton(oPopMenu.__get__Ref().mcSoundToggle.btnToggle, onBtnClickSFXToggle);
} else {
oPopMenu.__get__Ref().mcSoundToggle.gotoAndStop(sLABEL_OFF);
doCreateButton(oPopMenu.__get__Ref().mcSoundToggle.btnToggle, onBtnClickSFXToggle);
}
if (!Library.Sound.SoundManager.isCategoryMuted(Main.sSOUND_CAT_SOUND)) {
oPopMenu.__get__Ref().mcMusicToggle.gotoAndStop(sLABEL_ON);
doCreateButton(oPopMenu.__get__Ref().mcMusicToggle.btnToggle, onBtnClickMusicToggle);
} else {
oPopMenu.__get__Ref().mcMusicToggle.gotoAndStop(sLABEL_OFF);
doCreateButton(oPopMenu.__get__Ref().mcMusicToggle.btnToggle, onBtnClickMusicToggle);
}
}
function doUpdatePopMenuConfirm() {
doCreateButton(oPopMenuConfirm.__get__Ref().mcBox.btnYes, onBtnClickMenuConfirmYes);
doCreateButton(oPopMenuConfirm.__get__Ref().mcBox.btnNo, onBtnClickMenuConfirmNo);
}
function doUpdatePopHelp() {
doCreateButton(oPopHelp.__get__Ref().btnNext, onBtnClickHelpNext);
doCreateButton(oPopHelp.__get__Ref().btnBack, onBtnClickHelpBack);
doCreateButton(oPopHelp.__get__Ref().btnResume, onBtnClickHelpResume);
oPopHelp.__get__Ref().btnPlay._visible = false;
}
function doUpdatePopLevelTransition() {
doCreateButton(oPopLevelTransition.__get__Ref().btnNext, onBtnClickLevelTransitionNext);
oPopLevelTransition.__get__Ref().txtLevel.text = "Level " + nCurrentLevel;
oPopLevelTransition.__get__Ref().txtHouse1.text = aScorePlayers[0].OwnedHouse + aScorePlayers[0].OwnedCommercials;
oPopLevelTransition.__get__Ref().txtTiles1.text = aScorePlayers[0].OwnedTiles;
oPopLevelTransition.__get__Ref().txtTotal1.text = aScorePlayers[0].Score;
oPopLevelTransition.__get__Ref().txtHouse2.text = aScorePlayers[1].OwnedHouse + aScorePlayers[1].OwnedCommercials;
oPopLevelTransition.__get__Ref().txtTiles2.text = aScorePlayers[1].OwnedTiles;
oPopLevelTransition.__get__Ref().txtTotal2.text = aScorePlayers[1].Score;
oPopLevelTransition.__get__Ref().txtHouse3.text = aScorePlayers[2].OwnedHouse + aScorePlayers[2].OwnedCommercials;
oPopLevelTransition.__get__Ref().txtTiles3.text = aScorePlayers[2].OwnedTiles;
oPopLevelTransition.__get__Ref().txtTotal3.text = aScorePlayers[2].Score;
oPopLevelTransition.__get__Ref().txtHouse4.text = aScorePlayers[3].OwnedHouse + aScorePlayers[3].OwnedCommercials;
oPopLevelTransition.__get__Ref().txtTiles4.text = aScorePlayers[3].OwnedTiles;
oPopLevelTransition.__get__Ref().txtTotal4.text = aScorePlayers[3].Score;
}
function doTransitionTo(_sSection) {
if ((_sSection != sTargetSection) && (oTransition.__get__CurrentState() == Library.Transition.sSTATE_HIDDEN)) {
sTargetSection = _sSection;
oTransition.doStart();
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "Transition.mp3");
}
}
function doCreateButton(_btnRef, _fAction) {
_btnRef.onRelease = Library.Utils.Delegate.create(this, _fAction);
Main.__get__Instance().doApplyClickSoundOn(_btnRef);
Main.__get__Instance().doApplyRollSoundOn(_btnRef);
}
function getPlayerScoreHud(_nPlayer) {
var _local2;
switch (_nPlayer) {
case 1 :
_local2 = mcRef.mcScreen.mcHud.mcScorePlayer1;
break;
case 2 :
_local2 = mcRef.mcScreen.mcHud.mcScorePlayer2;
break;
case 3 :
_local2 = mcRef.mcScreen.mcHud.mcScorePlayer3;
break;
case 4 :
_local2 = mcRef.mcScreen.mcHud.mcScorePlayer4;
}
return(_local2);
}
function doStartGameMusic() {
if (oMusicGame == undefined) {
oMusicGame = Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_MUSIC, "Music_Game.wav", 0, 999999999);
oMusicGame.doAddListener(this);
}
oMusicGame.doFadeTo(100);
}
function doStopGameMusic() {
oMusicGame.doFadeTo(0);
}
function doCheckCountdown() {
if (mcRef.mcCountDown._currentframe == (mcRef.mcCountDown._totalframes - 10)) {
oLevelManagement.doStartGame();
} else if (mcRef.mcCountDown._currentframe == mcRef.mcCountDown._totalframes) {
bWathCountdown = false;
mcRef.mcCountDown.gotoAndStop(1);
}
}
var sLABEL_CHOOSER = "ChoosePlayer";
var sLABEL_GAME = "Game";
var sLABEL_NEXTLEVEL = "NextLevel";
var sLABEL_ON = "On";
var sLABEL_OFF = "Off";
}
Symbol 22 MovieClip [__Packages.PlayerChooser] Frame 0
class PlayerChooser
{
var mcRef, nChoosenPlayerNumber;
function PlayerChooser (_mcRef) {
mcRef = _mcRef;
nChoosenPlayerNumber = 0;
doCreateChooserButtons();
}
function doSelectPlayer(_nPlayer) {
nChoosenPlayerNumber = _nPlayer;
doCreateChooserButtons();
doActivateButton(_nPlayer);
}
function onBtnClickPlay() {
if (nChoosenPlayerNumber > 0) {
Main.__get__Instance().__get__GameCtrl().doStartFirstGame(nChoosenPlayerNumber);
}
}
function doDestroy() {
doDestroy();
}
function doCreateChooserButtons() {
doDesactivateAllButtonContainers();
doCreateButton(mcRef.mcScreen.mcChoose.mcPlayer1.btnPlayer1, doSelectPlayer, 1);
doCreateButton(mcRef.mcScreen.mcChoose.mcPlayer2.btnPlayer2, doSelectPlayer, 2);
doCreateButton(mcRef.mcScreen.mcChoose.mcPlayer3.btnPlayer3, doSelectPlayer, 3);
doCreateButton(mcRef.mcScreen.mcChoose.mcPlayer4.btnPlayer4, doSelectPlayer, 4);
doCreateButton(mcRef.mcScreen.mcChoose.btnPlay, onBtnClickPlay);
}
function doCreateButton(_btnRef, _fAction, _nArg) {
_btnRef.onRelease = Library.Utils.Delegate.create(this, _fAction, _nArg);
Main.__get__Instance().doApplyClickSoundOn(_btnRef);
Main.__get__Instance().doApplyRollSoundOn(_btnRef);
}
function doDesactivateAllButtonContainers() {
mcRef.mcScreen.mcChoose.mcPlayer1.gotoAndStop(sLABEL_OFF);
mcRef.mcScreen.mcChoose.mcPlayer2.gotoAndStop(sLABEL_OFF);
mcRef.mcScreen.mcChoose.mcPlayer3.gotoAndStop(sLABEL_OFF);
mcRef.mcScreen.mcChoose.mcPlayer4.gotoAndStop(sLABEL_OFF);
}
function doActivateButton(_nPlayerNumber) {
switch (_nPlayerNumber) {
case 1 :
mcRef.mcScreen.mcChoose.mcPlayer1.gotoAndStop(sLABEL_ON);
break;
case 2 :
mcRef.mcScreen.mcChoose.mcPlayer2.gotoAndStop(sLABEL_ON);
break;
case 3 :
mcRef.mcScreen.mcChoose.mcPlayer3.gotoAndStop(sLABEL_ON);
break;
case 4 :
mcRef.mcScreen.mcChoose.mcPlayer4.gotoAndStop(sLABEL_ON);
}
}
var sLABEL_ON = "On";
var sLABEL_OFF = "Off";
}
Symbol 4 MovieClip [__Packages.Library.Utils.Delegate] Frame 0
class Library.Utils.Delegate extends Object
{
var func;
function Delegate () {
super();
}
function DelegateArgs(f) {
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local3 = arguments.callee.target;
func = arguments.callee.func;
var _local2 = arguments.callee.arg;
_local2 = _local2.concat(arguments);
return(func.apply(_local3, _local2));
};
_local2.target = obj;
_local2.func = func;
_local2.arg = arguments.slice(2);
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 15 MovieClip [__Packages.Library.BasicPopUp] Frame 0
class Library.BasicPopUp extends Library.State
{
var nCurrentPage, bComplexAnim, setState, __get__CurrentState, oListener, mcRef, __get__Listener, isStateComplete;
function BasicPopUp (_mcRef, _bComplexAnim) {
super(_mcRef);
nCurrentPage = 1;
if (_bComplexAnim == undefined) {
_bComplexAnim = false;
}
bComplexAnim = _bComplexAnim;
setState(sSTATE_HIDDEN);
}
function doHide() {
setState(sSTATE_HIDDEN);
}
function doClose() {
if (__get__CurrentState() == sSTATE_IDLE) {
setState(sSTATE_OUT);
}
}
function doOpen() {
setState(sSTATE_IN);
}
function doDestroy() {
delete oListener;
delete mcRef;
}
function get Ref() {
if (bComplexAnim) {
return(mcRef.mcState);
}
return(mcRef.mcState.mcBox);
}
function set Listener(_o) {
oListener = _o;
//return(__get__Listener());
}
function setCurrentPage(_nPageShift) {
nCurrentPage = nCurrentPage + _nPageShift;
}
function doIn() {
if (isStateComplete()) {
setState(sSTATE_IDLE);
}
}
function doOut() {
if (isStateComplete()) {
setState(sSTATE_HIDDEN);
nCurrentPage = 1;
}
}
function doLoadStateAction() {
mcRef.mcState.btnBlock.onRelease = function () {
};
mcRef.mcState.btnBlock.useHandCursor = false;
if (__get__CurrentState() != sSTATE_HIDDEN) {
oListener.onPopUpEvent(NEED_UPDATE, this);
}
if (__get__CurrentState() == sSTATE_OUT) {
Ref.gotoAndStop(nCurrentPage);
}
}
static var NEED_UPDATE = 1;
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_IDLE = "Idle";
static var sSTATE_IN = "In";
static var sSTATE_OUT = "Out";
}
Symbol 41 MovieClip [__Packages.LevelManager] Frame 0
class LevelManager extends Library.DispatcherBase
{
var mcRef, bEaster, bAddingPowerups, oDepthManager, nHumanPlayer, aStartingPositions, aHouses, aKrustyKrabs, aChumBuckets, aPumpkins, aPlayers, aBombs, aPowerUps, aOwnedTiles, aOwnedHouses, aOwnedCommercial, aPlayersScores, oLevel, oGameTimer, doAddListener, oGridManager, bGameInitialised, bPaused, doPause, doResume, oHumanPlayer, oCpuPlayer1, oCpuPlayer2, oCpuPlayer3, nNextPowerUpAddition;
function LevelManager (_mcRef, _nPlayer) {
super();
mcRef = _mcRef;
mcRef._x = mcRef._x + 90;
mcRef._y = mcRef._y + 20;
bEaster = false;
bAddingPowerups = false;
oDepthManager = new DepthManager();
nHumanPlayer = _nPlayer;
aStartingPositions = new Array();
aHouses = new Array();
aKrustyKrabs = new Array();
aChumBuckets = new Array();
aPumpkins = new Array();
aPlayers = new Array();
aBombs = new Array();
aPowerUps = new Array();
aOwnedTiles = new Array();
aOwnedHouses = new Array();
aOwnedCommercial = new Array();
aPlayersScores = new Array();
var _local3 = 0;
while (_local3 < (LD.nMAX_PLAYER + 1)) {
aOwnedTiles[_local3 - 1] = 0;
aOwnedHouses[_local3 - 1] = 0;
aOwnedCommercial[_local3 - 1] = 0;
_local3++;
}
oLevel = Main.__get__Instance().__get__GameCtrl().__get__BaseLevel().getNextLevel();
oGameTimer = new Library.Utils.Timer();
doAddListener(oGameTimer);
oGameTimer.setTime(oLevel.__get__Duration());
oGameTimer.__set__Method(-1);
oGameTimer.doStartTimer();
var _local4 = mcRef.mcContainer.attachMovie(oLevel.__get__LevelLinkage(), oLevel.__get__LevelLinkage(), 2);
mcRef.mcFrame.swapDepths(1);
oGridManager = new GridManager(_local4);
bGameInitialised = false;
Main.__get__Instance().doAddListener(this);
init();
}
function init() {
}
function doEnterFrame() {
if (!bPaused) {
super.doEnterFrame();
Main.__get__Instance().__get__GameCtrl().setTimer(Library.Utils.Tools.getFormatedTime(oGameTimer.__get__Time(), false));
if (bGameInitialised) {
bGameInitialised = false;
doAddPlayers();
oGridManager.doSetAvaibleTiles();
doAddPumpkins(oLevel.__get__PumpkinsNeeded());
doPause();
}
if (oGameTimer.__get__Time() == 0) {
doGameOver();
}
doCheckPowerUpsLeft();
}
}
function doStartGame() {
doResume();
}
function doAddPowerupRandomly() {
var _local2 = getAvaibleTiles();
var _local3 = Math.floor(Math.random() * _local2.length);
addPowerUp(LD.nPU_SPEED, _local2[_local3].xCoord, _local2[_local3].yCoord);
_local2.splice(_local3, 1);
_local3 = Math.floor(Math.random() * _local2.length);
addPowerUp(LD.nPU_STOCK, _local2[_local3].xCoord, _local2[_local3].yCoord);
_local2.splice(_local3, 1);
_local3 = Math.floor(Math.random() * _local2.length);
addPowerUp(LD.nPU_RANGE, _local2[_local3].xCoord, _local2[_local3].yCoord);
}
function getAvaibleTiles() {
oGridManager.doSetAvaibleTilesForAI();
return(oGridManager.__get__FreeCells());
}
function getSingleCell(xCoord, yCoord) {
var _local2 = oGridManager.getCellOfTile(xCoord, yCoord);
return(_local2);
}
function doAddStartingPosition(_mcRef) {
var _local7 = _mcRef._x;
var _local6 = _mcRef._y;
var _local5 = Math.floor(_mcRef._x / LD.nCELL_HEIGHT);
var _local4 = Math.floor(_mcRef._y / LD.nCELL_WIDTH);
var _local2 = new Object();
_local2.xCoord = _local5;
_local2.yCoord = _local4;
aStartingPositions.push(_local2);
doRemoveFromStage(_mcRef);
bGameInitialised = true;
}
function doAddHouse(_mcRef) {
var _local6 = _mcRef._x;
var _local5 = _mcRef._y;
var _local7 = Math.floor(_mcRef._x / LD.nCELL_WIDTH);
var _local3 = Math.floor(_mcRef._y / LD.nCELL_HEIGHT);
var _local4 = oDepthManager.getNewStaticDepth(_local3, LD.nHOUSE);
aHouses.push(new House(mcRef.attachMovie(LD.sHOUSE_LINKAGE, LD.sHOUSE_LINKAGE + _local4, _local4), _local7, _local3));
aHouses[aHouses.length - 1].mcRef._x = _local6;
aHouses[aHouses.length - 1].mcRef._y = _local5;
oGridManager.doPlaceItem(aHouses[aHouses.length - 1].mcRef, LD.nHOUSE);
doRemoveFromStage(_mcRef);
}
function doAddChumBucket(_mcRef) {
var _local6 = _mcRef._x;
var _local5 = _mcRef._y;
var _local7 = Math.floor(_mcRef._x / LD.nCELL_WIDTH);
var _local3 = Math.floor(_mcRef._y / LD.nCELL_HEIGHT);
var _local4 = oDepthManager.getNewStaticDepth(_local3, LD.nCHUM_BUCKET);
aChumBuckets.push(new ChumBucket(mcRef.attachMovie(LD.sCHUM_BUCKET_LINKAGE, LD.sCHUM_BUCKET_LINKAGE + _local4, _local4), _local7, _local3));
aChumBuckets[aChumBuckets.length - 1].mcRef._x = _local6;
aChumBuckets[aChumBuckets.length - 1].mcRef._y = _local5;
oGridManager.doPlaceItem(aChumBuckets[aChumBuckets.length - 1].mcRef, LD.nCHUM_BUCKET);
doRemoveFromStage(_mcRef);
}
function doAddKrustyKrab(_mcRef) {
var _local6 = _mcRef._x;
var _local5 = _mcRef._y;
var _local7 = Math.floor(_mcRef._x / LD.nCELL_WIDTH);
var _local3 = Math.floor(_mcRef._y / LD.nCELL_HEIGHT);
var _local4 = oDepthManager.getNewStaticDepth(_local3, LD.nKRUSTY_KRAB);
aKrustyKrabs.push(new KrustyKrab(mcRef.attachMovie(LD.sKRUSTY_KRAB_LINKAGE, LD.sKRUSTY_KRAB_LINKAGE + _local4, _local4), _local7, _local3));
aKrustyKrabs[aKrustyKrabs.length - 1].mcRef._x = _local6;
aKrustyKrabs[aKrustyKrabs.length - 1].mcRef._y = _local5;
oGridManager.doPlaceItem(aKrustyKrabs[aKrustyKrabs.length - 1].mcRef, LD.nKRUSTY_KRAB);
doRemoveFromStage(_mcRef);
}
function doAddRock(_mcRef) {
var _local7 = _mcRef._x;
var _local6 = _mcRef._y;
var _local5 = Math.floor(_mcRef._x / LD.nCELL_WIDTH);
var _local4 = Math.floor(_mcRef._y / LD.nCELL_HEIGHT);
var _local2 = new Object();
_local2.xCoord = _local5;
_local2.yCoord = _local4;
aStartingPositions.push(_local2);
doRemoveFromStage(_mcRef);
}
function doRemoveFromStage(_mc) {
_mc.swapDepths(oDepthManager.getNewSwapperDepth());
_mc.removeMovieClip();
}
function isObjectMoveLegal(_nXtarget, _nYtarget, _nXorigin, _nYorigin, _nOccupier, _mcRef) {
var _local3 = false;
var _local2 = oGridManager.getCellOfTile(_nXtarget, _nYtarget);
var _local5 = oGridManager.getCellOfTile(_nXorigin, _nYorigin);
if ((!_local2.isObstructed()) && (_local2 != undefined)) {
_local3 = true;
_local5.doRemoveOccupier(_nOccupier);
_local2.doAddOccupier(_nOccupier);
oDepthManager.setNewDepth(_mcRef, _local2.yCoord, _nOccupier);
}
return(_local3);
}
function doAddBomb(_nPlayer, _nBombLevel, _bKamikaze, _nBombStock, _sDirection) {
var _local16 = true;
var _local4 = oGridManager.getCellOfOccupier(_nPlayer);
var _local3 = _local4.nXcoord;
var _local2 = _local4.nYcoord;
var _local10 = LD.nCELL_WIDTH * _local3;
var _local11 = LD.nCELL_HEIGHT * _local2;
var _local5 = 0;
while (_local5 < aBombs.length) {
if ((aBombs[_local5].xCoord == _local3) && (aBombs[_local5].yCoord == _local2)) {
_local16 = false;
}
_local5++;
}
if (_local16) {
var _local9 = 0;
var _local7 = oDepthManager.getNewStaticDepth(_local2, LD.nBOMB);
var _local8 = new Bomb(mcRef.attachMovie(LD.sBOMB_LINKAGE, LD.sBOMB_LINKAGE + _local7, _local7, {_x:_local10, _y:_local11 + 1}), _nPlayer, _nBombLevel, _local3, _local2);
oGridManager.doPlaceItem(_local8.mcRef, LD.nBOMB);
aBombs.push(_local8);
_local9++;
if (_bKamikaze) {
_local5 = 1;
while (_local5 < (_nBombStock + 1)) {
switch (_sDirection) {
case LD.sDIRECTION_DOWN :
_local3 = _local4.nXcoord;
_local2 = _local4.nYcoord + _local5;
break;
case LD.sDIRECTION_UP :
_local3 = _local4.nXcoord;
_local2 = _local4.nYcoord - _local5;
break;
case LD.sDIRECTION_LEFT :
_local3 = _local4.nXcoord - _local5;
_local2 = _local4.nYcoord;
break;
case LD.sDIRECTION_RIGHT :
_local3 = _local4.nXcoord + _local5;
_local2 = _local4.nYcoord;
}
var _local6 = oGridManager.getCellOfTile(_local3, _local2);
if ((!_local6.isObstructed()) && (_local6 != undefined)) {
_local10 = LD.nCELL_WIDTH * _local3;
_local11 = LD.nCELL_HEIGHT * _local2;
_local7 = oDepthManager.getNewStaticDepth(_local2, LD.nBOMB);
_local8 = new Bomb(mcRef.attachMovie(LD.sBOMB_LINKAGE, LD.sBOMB_LINKAGE + _local7, _local7, {_x:_local10, _y:_local11 + 1}), _nPlayer, _nBombLevel, _local3, _local2);
oGridManager.doPlaceItem(_local8.mcRef, LD.nBOMB);
aBombs.push(_local8);
_local9++;
} else {
_local5 = _nBombStock;
}
_local5++;
}
}
_local5 = 0;
while (_local5 < aPlayers.length) {
if (aPlayers[_local5].PlayerNumber == _nPlayer) {
aPlayers[_local5].doOwnerBombPosed(_local9);
}
_local5++;
}
}
}
function doExplosion(_nPlayer, _nLevel, _nXorigin, _nYorigin) {
var _local8 = oGridManager.getCellOfTile(_nXorigin, _nYorigin);
_local8.doRemoveOccupier(LD.nBOMB);
var _local5 = getExplodedCells(_nPlayer, _nLevel, _nXorigin, _nYorigin);
var _local4 = 0;
while (_local4 < _local5.length) {
if (_local5[_local4] != undefined) {
var _local3 = _local5[_local4].xCoord;
var _local2 = _local5[_local4].yCoord;
doBlastBombs(_local3, _local2);
doBlastPumpkins(_local3, _local2);
doBlastPlayers(_local3, _local2);
doBlastPowerUps(_local3, _local2);
}
_local4++;
}
_local4 = 0;
while (_local4 < aPlayers.length) {
if (aPlayers[_local4].PlayerNumber == _nPlayer) {
aPlayers[_local4].doOwnerBombExploded(1);
}
_local4++;
}
doCheckHouseOwnership(_nXorigin, _nYorigin, _nLevel);
if (aChumBuckets.length > 0) {
doCheckChumBucketOwnership();
}
if (aKrustyKrabs.length > 0) {
doCheckKrustyKrabOwnership();
}
}
function doPlayerTouched(_nTouchedPlayer) {
var _local3 = oGridManager.__get__AllCells();
var _local4 = 0;
while (_local4 < _local3.length) {
var _local2 = 0;
while (_local2 < _local3[_local4].length) {
if (_local3[_local4][_local2].getOwnership() == _nTouchedPlayer) {
_local3[_local4][_local2].doChangeOwnership(LD.nMAX_PLAYER + 1);
}
_local2++;
}
_local4++;
}
_local4 = 0;
while (_local4 < aHouses.length) {
if (aHouses[_local4].getOwnership() == _nTouchedPlayer) {
aHouses[_local4].doChangeOwnership(LD.nMAX_PLAYER + 1);
}
_local4++;
}
_local4 = 0;
while (_local4 < aKrustyKrabs.length) {
if (aKrustyKrabs[_local4].getOwnership() == _nTouchedPlayer) {
aKrustyKrabs[_local4].doChangeOwnership(LD.nMAX_PLAYER + 1);
}
_local4++;
}
_local4 = 0;
while (_local4 < aChumBuckets.length) {
if (aChumBuckets[_local4].getOwnership() == _nTouchedPlayer) {
aChumBuckets[_local4].doChangeOwnership(LD.nMAX_PLAYER + 1);
}
_local4++;
}
aOwnedTiles[_nTouchedPlayer - 1] = 0;
aOwnedHouses[_nTouchedPlayer - 1] = 0;
aOwnedCommercial[_nTouchedPlayer - 1] = 0;
doUpdateScore();
}
function addPowerUp(_nPowerUpNumber, xCoord, yCoord) {
var _local3 = LD.getPowerUpLinkage(_nPowerUpNumber);
var _local4 = oDepthManager.getNewStaticDepth(yCoord, _nPowerUpNumber);
var _local2 = mcRef.attachMovie(_local3, _local3 + _local4, _local4);
aPowerUps.push(new PowerUp(_local2, xCoord, yCoord, _nPowerUpNumber));
_local2._x = xCoord * LD.nCELL_WIDTH;
_local2._y = yCoord * LD.nCELL_HEIGHT;
oGridManager.doPlaceItem(_local2, _nPowerUpNumber);
}
function doRemoveBomb(_oBomb) {
var _local2 = 0;
while (_local2 < aBombs.length) {
if (aBombs[_local2] == _oBomb) {
aBombs.splice(_local2, 1);
}
_local2++;
}
}
function doRemovePowerup(_oPowerup) {
var _local2 = 0;
while (_local2 < aPowerUps.length) {
if (aPowerUps[_local2] == _oPowerup) {
aPowerUps.splice(_local2, 1);
}
_local2++;
}
}
function doRemovePumpkin(_oPumpkin) {
var _local2 = 0;
while (_local2 < aPumpkins.length) {
if (aPumpkins[_local2] == _oPumpkin) {
aPumpkins.splice(_local2, 1);
}
_local2++;
}
}
function doRemoveHouse(_oHouse) {
var _local2 = 0;
while (_local2 < aHouses.length) {
if (aHouses[_local2] == _oHouse) {
aHouses.splice(_local2, 1);
}
_local2++;
}
}
function doRemovePlayer(_oPlayer) {
var _local2 = 0;
while (_local2 < aPlayers.length) {
if (aPlayers[_local2] == _oPlayer) {
aPlayers.splice(_local2, 1);
}
_local2++;
}
}
function doPlayerKick(_nX, _nY, _sPlayerDirection) {
var _local2 = 0;
while (_local2 < aBombs.length) {
if ((aBombs[_local2].xCoord == _nX) && (aBombs[_local2].yCoord == _nY)) {
aBombs[_local2].doKicked(_sPlayerDirection);
}
_local2++;
}
}
function isCellValid(_nXcoord, _nYcoord) {
var _local3 = true;
var _local2 = oGridManager.getCellOfTile(_nXcoord, _nYcoord);
if (_local2.isObstructed() || (_local2 == undefined)) {
_local3 = false;
}
return(_local3);
}
function getHouses() {
var _local2 = Library.Utils.Tools.doCopyArray(aHouses);
return(_local2);
}
function getPumpkins() {
var _local2 = Library.Utils.Tools.doCopyArray(aPumpkins);
return(_local2);
}
function getPowerups() {
var _local2 = Library.Utils.Tools.doCopyArray(aPowerUps);
return(_local2);
}
function getBombs() {
var _local2 = Library.Utils.Tools.doCopyArray(aBombs);
return(_local2);
}
function doGainHouse(_nPlayer, nBuildingID) {
if (nBuildingID == LD.nHOUSE) {
aOwnedHouses[_nPlayer - 1]++;
} else if ((nBuildingID == LD.nCHUM_BUCKET) || (nBuildingID == LD.nKRUSTY_KRAB)) {
aOwnedCommercial[_nPlayer - 1]++;
}
}
function doLoseHouse(_nPlayer, nBuildingID) {
if (nBuildingID == LD.nHOUSE) {
aOwnedHouses[_nPlayer - 1]--;
} else if ((nBuildingID == LD.nCHUM_BUCKET) || (nBuildingID == LD.nKRUSTY_KRAB)) {
aOwnedCommercial[_nPlayer - 1]--;
}
}
function doGainTile(_nPlayer) {
aOwnedTiles[_nPlayer - 1]++;
}
function doLoseTile(_nPlayer) {
aOwnedTiles[_nPlayer - 1]--;
}
function doGameOver() {
var _local4 = aPlayersScores[oHumanPlayer.__get__PlayerNumber() - 1];
var _local3 = true;
if (oGameTimer.__get__Time() > 0) {
_local3 = false;
} else {
_local3 = true;
var _local2 = 0;
while (_local2 < aPlayersScores.length) {
if (_local4 < aPlayersScores[_local2]) {
_local3 = false;
}
_local2++;
}
}
doPause();
Main.__get__Instance().__get__GameCtrl().doEndGame(oLevel.__get__LevelNumber(), _local4, _local3);
}
function doActiveEaster() {
if (!bEaster) {
var _local2 = Library.Sound.SoundManager.isSoundPlaying("EasterEgg.mp3").oSound.doStop();
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "EasterEgg.mp3", 20);
bEaster = true;
}
}
function getAllTilesBetween(_nXmax, _nYmax, _nXmin, _nYmin) {
var _local5 = new Array();
var _local9 = _nXmax - _nXmin;
var _local6 = _nYmax - _nYmin;
var _local4 = 0;
while (_local4 < _local9) {
var _local3 = 0;
while (_local3 < _local6) {
var _local2 = getSingleCell(_local4 + _nXmin, _local3 + _nYmin);
if (isCellValid(_local2.__get__xCoord(), _local2.__get__yCoord())) {
_local5.push(_local2);
}
_local3++;
}
_local4++;
}
return(_local5);
}
function getSurroundingTiles(_xCoord, _yCoord) {
var _local5 = new Array();
var _local2;
if (isCellValid(_xCoord + 1, _yCoord)) {
_local2 = oGridManager.getCellOfTile(_xCoord + 1, _yCoord);
_local5.push(_local2);
}
if (isCellValid(_xCoord - 1, _yCoord)) {
_local2 = oGridManager.getCellOfTile(_xCoord - 1, _yCoord);
_local5.push(_local2);
}
if (isCellValid(_xCoord, _yCoord + 1)) {
_local2 = oGridManager.getCellOfTile(_xCoord, _yCoord + 1);
_local5.push(_local2);
}
if (isCellValid(_xCoord, _yCoord - 1)) {
_local2 = oGridManager.getCellOfTile(_xCoord, _yCoord - 1);
_local5.push(_local2);
}
if (isCellValid(_xCoord + 1, _yCoord + 1)) {
_local2 = oGridManager.getCellOfTile(_xCoord + 1, _yCoord + 1);
_local5.push(_local2);
}
if (isCellValid(_xCoord - 1, _yCoord - 1)) {
_local2 = oGridManager.getCellOfTile(_xCoord - 1, _yCoord - 1);
_local5.push(_local2);
}
if (isCellValid(_xCoord + 1, _yCoord - 1)) {
_local2 = oGridManager.getCellOfTile(_xCoord + 1, _yCoord - 1);
_local5.push(_local2);
}
if (isCellValid(_xCoord - 1, _yCoord + 1)) {
_local2 = oGridManager.getCellOfTile(_xCoord - 1, _yCoord + 1);
_local5.push(_local2);
}
return(_local5);
}
function doDestroy() {
Main.__get__Instance().doRemoveListener(this);
oGridManager.doDestroy();
delete oGridManager;
delete oGameTimer;
oHumanPlayer.doDestroy();
delete oHumanPlayer;
oCpuPlayer1.doDestroy();
delete oCpuPlayer1;
oCpuPlayer2.doDestroy();
delete oCpuPlayer2;
oCpuPlayer3.doDestroy();
delete oCpuPlayer3;
delete oLevel;
oDepthManager.doDestroy();
delete oDepthManager;
aStartingPositions = new Array();
delete aStartingPositions;
aHouses = new Array();
delete aHouses;
aPumpkins = new Array();
delete aPumpkins;
aPlayers = new Array();
delete aPlayers;
aBombs = new Array();
delete aBombs;
aPowerUps = new Array();
delete aPowerUps;
aOwnedTiles = new Array();
delete aOwnedTiles;
aOwnedHouses = new Array();
delete aOwnedHouses;
aOwnedCommercial = new Array();
delete aOwnedCommercial;
aPlayersScores = new Array();
delete aPlayersScores;
aChumBuckets = new Array();
delete aChumBuckets;
aKrustyKrabs = new Array();
delete aKrustyKrabs;
mcRef.removeMovieClip();
delete mcRef;
super.doDestroy();
}
function get Player() {
return(oHumanPlayer);
}
function get Easter() {
return(bEaster);
}
function doAddPlayers() {
var _local13 = Math.floor(Math.random() * aStartingPositions.length);
var _local12 = aStartingPositions[_local13].xCoord * LD.nCELL_WIDTH;
var _local10 = aStartingPositions[_local13].yCoord * LD.nCELL_HEIGHT;
var _local11 = Math.floor(_local10 / LD.nCELL_HEIGHT);
var _local9 = oDepthManager.getNewStaticDepth(_local11, nHumanPlayer);
var _local2 = mcRef.attachMovie(LD.getPlayerLinkage(nHumanPlayer), LD.getPlayerLinkage(nHumanPlayer) + _local9, _local9);
_local2._x = _local12;
_local2._y = _local10;
oGridManager.doPlaceItem(_local2, nHumanPlayer);
oHumanPlayer = new HumanPlayer(_local2, nHumanPlayer, aStartingPositions[_local13].xCoord, aStartingPositions[_local13].yCoord);
aStartingPositions.splice(_local13, 1);
aPlayers.push(oHumanPlayer);
var _local5 = [LD.nPLAYER1, LD.nPLAYER2, LD.nPLAYER3, LD.nPLAYER4];
var _local6 = 0;
while (_local6 < _local5.length) {
if (_local5[_local6] == nHumanPlayer) {
_local5.splice(_local6, 1);
_local6 = _local5.length;
}
_local6++;
}
_local6 = 0;
while (_local6 < (LD.nMAX_PLAYER - 1)) {
var _local3 = _local5.shift();
var _local7 = LD.getPlayerLinkage(_local3);
var _local4 = aStartingPositions.shift();
_local12 = _local4.xCoord * LD.nCELL_WIDTH;
_local10 = _local4.yCoord * LD.nCELL_HEIGHT;
_local11 = Math.floor(_local10 / LD.nCELL_HEIGHT);
_local9 = oDepthManager.getNewStaticDepth(_local11, _local3);
_local2 = mcRef.attachMovie(_local7, _local7 + _local9, _local9);
_local2._x = _local12;
_local2._y = _local10;
oGridManager.doPlaceItem(_local2, _local3);
var _local8 = getComputerPlayer(_local6);
_local8 = new ComputerPlayer(_local2, _local3, _local4.xCoord, _local4.yCoord);
aPlayers.push(_local8);
_local6++;
}
}
function doAddPumpkins(_nNumber) {
var _local2 = oGridManager.__get__FreeCells();
var _local5 = 0;
while (_local5 < _nNumber) {
if (_local2.length > 0) {
var _local4 = Library.Utils.MoreMath.getRandomRange(0, _local2.length - 1);
var _local6 = _local2[_local4].xCoord;
var _local3 = _local2[_local4].yCoord;
var _local7 = oDepthManager.getNewStaticDepth(_local3, LD.nPUMPKIN);
aPumpkins.push(new Pumpkin(mcRef.attachMovie(LD.sPUMPKINS_LINKAGE, LD.sPUMPKINS_LINKAGE + _local7, _local7), _local6, _local3, 1));
aPumpkins[aPumpkins.length - 1].mcRef._x = _local6 * LD.nCELL_WIDTH;
aPumpkins[aPumpkins.length - 1].mcRef._y = (_local3 * LD.nCELL_HEIGHT) + 1;
oGridManager.doPlaceItem(aPumpkins[aPumpkins.length - 1].mcRef, LD.nPUMPKIN);
_local2.splice(_local4, 1);
} else {
_local5 = _nNumber;
}
_local5++;
}
doAddPowerUps();
}
function doAddPowerUps() {
var _local6 = Library.Utils.Tools.doCopyArray(aPumpkins);
var _local3 = new Array();
var _local8 = oLevel.getPowerUp(LD.nPU_SPEED);
var _local10 = oLevel.getPowerUp(LD.nPU_STOCK);
var _local9 = oLevel.getPowerUp(LD.nPU_RANGE);
var _local11 = oLevel.getPowerUp(LD.nPU_KICK);
var _local7 = oLevel.getPowerUp(LD.nPU_KAMIKAZE);
var _local12 = oLevel.__get__TotalPowerups();
var _local5 = 0;
while (_local5 < _local12) {
var _local4 = Math.floor(Math.random() * _local6.length);
_local3.push(_local6[_local4]);
_local6.splice(_local4, 1);
_local5++;
}
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local8 > 0) {
_local8--;
_local3[_local2].setContainedPowerup(LD.nPU_SPEED);
} else if (_local10 > 0) {
_local10--;
_local3[_local2].setContainedPowerup(LD.nPU_STOCK);
} else if (_local9 > 0) {
_local9--;
_local3[_local2].setContainedPowerup(LD.nPU_RANGE);
} else if (_local11 > 0) {
_local11--;
_local3[_local2].setContainedPowerup(LD.nPU_KICK);
} else if (_local7 > 0) {
_local7--;
_local3[_local2].setContainedPowerup(LD.nPU_KAMIKAZE);
}
_local2++;
}
}
function getExplodedCells(_nPlayer, _nLevel, _nXorigin, _nYorigin) {
var _local3 = new Array();
var _local15 = new Array();
var _local14 = new Array();
var _local17 = new Array();
var _local16 = new Array();
_local3.push(oGridManager.getCellOfTile(_nXorigin, _nYorigin));
var _local8 = true;
var _local9 = true;
var _local11 = true;
var _local10 = true;
var _local2 = 1;
while (_local2 < (_nLevel + 1)) {
if (_local11) {
var _local7 = oGridManager.getCellOfTile(_nXorigin, _nYorigin - _local2);
_local3.push(_local7);
if (_local7.isObstructed()) {
_local11 = false;
}
}
if (_local8) {
var _local7 = oGridManager.getCellOfTile(_nXorigin - _local2, _nYorigin);
_local3.push(_local7);
if (_local7.isObstructed()) {
_local8 = false;
}
}
if (_local10) {
var _local7 = oGridManager.getCellOfTile(_nXorigin, _nYorigin + _local2);
_local3.push(_local7);
if (_local7.isObstructed()) {
_local10 = false;
}
}
if (_local9) {
var _local7 = oGridManager.getCellOfTile(_nXorigin + _local2, _nYorigin);
_local3.push(_local7);
if (_local7.isObstructed()) {
_local9 = false;
}
}
_local2++;
}
var _local4 = 0;
while (_local4 < _local3.length) {
var _local7 = _local3[_local4];
_local7.doBombed(_nPlayer);
_local4++;
}
doUpdateScore();
return(_local3);
}
function doCheckHouseOwnership(_nBlastX, _nBlastY, _nBlastLevel) {
var _local4 = oGridManager.__get__AllCells();
var _local7 = 0;
while (_local7 < aHouses.length) {
var _local2 = aHouses[_local7].xCoord;
var _local3 = aHouses[_local7].yCoord;
if (isInRadius(_nBlastX, _nBlastY, _nBlastLevel, _local2, _local3)) {
var _local5;
var _local13;
var _local9;
var _local14;
var _local11;
var _local10;
var _local15;
var _local12;
var _local8;
if (GridCell(_local4[_local2][_local3 - 1]) != null) {
if (!GridCell(_local4[_local2][_local3 - 1]).isObstructedByHouse()) {
_local13 = GridCell(_local4[_local2][_local3 - 1]).getOwnership();
_local5 = _local13;
} else {
_local13 = null;
}
} else {
_local13 = null;
}
if (GridCell(_local4[_local2][_local3 + 1]) != null) {
if (!GridCell(_local4[_local2][_local3 + 1]).isObstructedByHouse()) {
_local9 = GridCell(_local4[_local2][_local3 + 1]).getOwnership();
_local5 = _local9;
} else {
_local9 = null;
}
} else {
_local9 = null;
}
if (GridCell(_local4[_local2 - 1][_local3]) != null) {
if (!GridCell(_local4[_local2 - 1][_local3]).isObstructedByHouse()) {
_local14 = GridCell(_local4[_local2 - 1][_local3]).getOwnership();
_local5 = _local14;
} else {
_local14 = null;
}
} else {
_local14 = null;
}
if (GridCell(_local4[_local2 + 1][_local3]) != null) {
if (!GridCell(_local4[_local2 + 1][_local3]).isObstructedByHouse()) {
_local11 = GridCell(_local4[_local2 + 1][_local3]).getOwnership();
_local5 = _local11;
} else {
_local11 = null;
}
} else {
_local11 = null;
}
if (GridCell(_local4[_local2 - 1][_local3 - 1]) != null) {
if (!GridCell(_local4[_local2 - 1][_local3 - 1]).isObstructedByHouse()) {
_local10 = GridCell(_local4[_local2 - 1][_local3 - 1]).getOwnership();
_local5 = _local10;
} else {
_local10 = null;
}
} else {
_local10 = null;
}
if (GridCell(_local4[_local2 + 1][_local3 - 1]) != null) {
if (!GridCell(_local4[_local2 + 1][_local3 - 1]).isObstructedByHouse()) {
_local15 = GridCell(_local4[_local2 + 1][_local3 - 1]).getOwnership();
_local5 = _local15;
} else {
_local15 = null;
}
} else {
_local15 = null;
}
if (GridCell(_local4[_local2 - 1][_local3 + 1]) != null) {
if (!GridCell(_local4[_local2 - 1][_local3 + 1]).isObstructedByHouse()) {
_local12 = GridCell(_local4[_local2 - 1][_local3 + 1]).getOwnership();
_local5 = _local12;
} else {
_local12 = null;
}
} else {
_local12 = null;
}
if (GridCell(_local4[_local2 + 1][_local3 + 1]) != null) {
if (!GridCell(_local4[_local2 + 1][_local3 + 1]).isObstructedByHouse()) {
_local8 = GridCell(_local4[_local2 + 1][_local3 + 1]).getOwnership();
_local5 = _local8;
} else {
_local8 = null;
}
} else {
_local8 = null;
}
var _local6 = [_local13, _local9, _local14, _local11, _local10, _local15, _local12, _local8];
var _local16 = false;
if (_local5 != 0) {
if ((_local6[0] == _local5) || (_local6[0] == null)) {
if ((_local6[1] == _local5) || (_local6[1] == null)) {
if ((_local6[2] == _local5) || (_local6[2] == null)) {
if ((_local6[3] == _local5) || (_local6[3] == null)) {
if ((_local6[4] == _local5) || (_local6[4] == null)) {
if ((_local6[5] == _local5) || (_local6[5] == null)) {
if ((_local6[6] == _local5) || (_local6[6] == null)) {
if ((_local6[7] == _local5) || (_local6[7] == null)) {
aHouses[_local7].doChangeOwnership(_local5);
_local4[_local2][_local3].doChangeOwnership(_local5);
doUpdateScore();
_local16 = true;
}
}
}
}
}
}
}
}
}
if (!_local16) {
aHouses[_local7].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local2][_local3].doChangeOwnership(LD.nMAX_PLAYER + 1);
}
}
_local7++;
}
}
function doCheckChumBucketOwnership(_nBlastX, _nBlastY, _nBlastLevel) {
var _local4 = oGridManager.__get__AllCells();
var _local7 = 0;
while (_local7 < aChumBuckets.length) {
var _local2 = aChumBuckets[_local7].xCoord;
var _local3 = aChumBuckets[_local7].yCoord;
var _local5;
var _local14;
var _local9;
var _local10;
var _local15;
var _local16;
var _local12;
var _local11;
var _local17;
var _local13;
var _local8;
if (GridCell(_local4[_local2][_local3 - 2]) != null) {
if (!GridCell(_local4[_local2][_local3 - 2]).isObstructedByHouse()) {
_local14 = GridCell(_local4[_local2][_local3 - 2]).getOwnership();
_local5 = _local14;
} else {
_local14 = null;
}
} else {
_local14 = null;
}
if (GridCell(_local4[_local2 + 1][_local3 - 2]) != null) {
if (!GridCell(_local4[_local2 + 1][_local3 - 2]).isObstructedByHouse()) {
_local9 = GridCell(_local4[_local2 + 1][_local3 - 2]).getOwnership();
_local5 = _local9;
} else {
_local9 = null;
}
} else {
_local9 = null;
}
if (GridCell(_local4[_local2][_local3 + 1]) != null) {
if (!GridCell(_local4[_local2][_local3 + 1]).isObstructedByHouse()) {
_local10 = GridCell(_local4[_local2][_local3 + 1]).getOwnership();
_local5 = _local10;
} else {
_local10 = null;
}
} else {
_local10 = null;
}
if (GridCell(_local4[_local2 + 1][_local3 + 1]) != null) {
if (!GridCell(_local4[_local2 + 1][_local3 + 1]).isObstructedByHouse()) {
_local15 = GridCell(_local4[_local2 + 1][_local3 + 1]).getOwnership();
_local5 = _local15;
} else {
_local15 = null;
}
} else {
_local15 = null;
}
if (GridCell(_local4[_local2 - 1][_local3]) != null) {
if (!GridCell(_local4[_local2 - 1][_local3]).isObstructedByHouse()) {
_local16 = GridCell(_local4[_local2 - 1][_local3]).getOwnership();
_local5 = _local16;
} else {
_local16 = null;
}
} else {
_local16 = null;
}
if (GridCell(_local4[_local2 + 2][_local3]) != null) {
if (!GridCell(_local4[_local2 + 2][_local3]).isObstructedByHouse()) {
_local12 = GridCell(_local4[_local2 + 2][_local3]).getOwnership();
_local5 = _local12;
} else {
_local12 = null;
}
} else {
_local12 = null;
}
if (GridCell(_local4[_local2 - 1][_local3 - 1]) != null) {
if (!GridCell(_local4[_local2 - 1][_local3 - 1]).isObstructedByHouse()) {
_local11 = GridCell(_local4[_local2 - 1][_local3 - 1]).getOwnership();
_local5 = _local11;
} else {
_local11 = null;
}
} else {
_local11 = null;
}
if (GridCell(_local4[_local2 + 2][_local3 - 1]) != null) {
if (!GridCell(_local4[_local2 + 2][_local3 - 1]).isObstructedByHouse()) {
_local17 = GridCell(_local4[_local2 + 2][_local3 - 1]).getOwnership();
_local5 = _local17;
} else {
_local17 = null;
}
} else {
_local17 = null;
}
if (GridCell(_local4[_local2 - 1][_local3 + 1]) != null) {
if (!GridCell(_local4[_local2 - 1][_local3 + 1]).isObstructedByHouse()) {
_local13 = GridCell(_local4[_local2 - 1][_local3 + 1]).getOwnership();
_local5 = _local13;
} else {
_local13 = null;
}
} else {
_local13 = null;
}
if (GridCell(_local4[_local2 + 2][_local3 + 1]) != null) {
if (!GridCell(_local4[_local2 + 2][_local3 + 1]).isObstructedByHouse()) {
_local8 = GridCell(_local4[_local2 + 2][_local3 + 1]).getOwnership();
_local5 = _local8;
} else {
_local8 = null;
}
} else {
_local8 = null;
}
var _local6 = [_local14, _local10, _local16, _local12, _local11, _local17, _local13, _local8, _local9, _local15];
var _local18 = false;
if (_local5 != 0) {
if ((_local6[0] == _local5) || (_local6[0] == null)) {
if ((_local6[1] == _local5) || (_local6[1] == null)) {
if ((_local6[2] == _local5) || (_local6[2] == null)) {
if ((_local6[3] == _local5) || (_local6[3] == null)) {
if ((_local6[4] == _local5) || (_local6[4] == null)) {
if ((_local6[5] == _local5) || (_local6[5] == null)) {
if ((_local6[6] == _local5) || (_local6[6] == null)) {
if ((_local6[7] == _local5) || (_local6[7] == null)) {
if ((_local6[8] == _local5) || (_local6[8] == null)) {
if ((_local6[9] == _local5) || (_local6[9] == null)) {
aChumBuckets[_local7].doChangeOwnership(_local5);
_local4[_local2][_local3].doChangeOwnership(_local5);
_local4[_local2 + 1][_local3].doChangeOwnership(_local5);
_local4[_local2][_local3 - 1].doChangeOwnership(_local5);
_local4[_local2 + 1][_local3 - 1].doChangeOwnership(_local5);
doUpdateScore();
_local18 = true;
}
}
}
}
}
}
}
}
}
}
}
if (!_local18) {
aChumBuckets[_local7].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local2][_local3].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local2 + 1][_local3].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local2][_local3 - 1].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local2 + 1][_local3 - 1].doChangeOwnership(LD.nMAX_PLAYER + 1);
}
_local7++;
}
}
function doCheckKrustyKrabOwnership(_nBlastX, _nBlastY, _nBlastLevel) {
var _local4 = oGridManager.__get__AllCells();
var _local7 = 0;
while (_local7 < aKrustyKrabs.length) {
var _local3 = aKrustyKrabs[_local7].xCoord;
var _local2 = aKrustyKrabs[_local7].yCoord;
var _local5;
var _local14;
var _local9;
var _local10;
var _local15;
var _local16;
var _local12;
var _local11;
var _local17;
var _local13;
var _local8;
if (GridCell(_local4[_local3][_local2 - 2]) != null) {
if (!GridCell(_local4[_local3][_local2 - 2]).isObstructedByHouse()) {
_local14 = GridCell(_local4[_local3][_local2 - 2]).getOwnership();
_local5 = _local14;
} else {
_local14 = null;
}
} else {
_local14 = null;
}
if (GridCell(_local4[_local3 + 1][_local2 - 2]) != null) {
if (!GridCell(_local4[_local3 + 1][_local2 - 2]).isObstructedByHouse()) {
_local9 = GridCell(_local4[_local3 + 1][_local2 - 2]).getOwnership();
_local5 = _local9;
} else {
_local9 = null;
}
} else {
_local9 = null;
}
if (GridCell(_local4[_local3][_local2 + 1]) != null) {
if (!GridCell(_local4[_local3][_local2 + 1]).isObstructedByHouse()) {
_local10 = GridCell(_local4[_local3][_local2 + 1]).getOwnership();
_local5 = _local10;
} else {
_local10 = null;
}
} else {
_local10 = null;
}
if (GridCell(_local4[_local3 + 1][_local2 + 1]) != null) {
if (!GridCell(_local4[_local3 + 1][_local2 + 1]).isObstructedByHouse()) {
_local15 = GridCell(_local4[_local3 + 1][_local2 + 1]).getOwnership();
_local5 = _local15;
} else {
_local15 = null;
}
} else {
_local15 = null;
}
if (GridCell(_local4[_local3 - 1][_local2]) != null) {
if (!GridCell(_local4[_local3 - 1][_local2]).isObstructedByHouse()) {
_local16 = GridCell(_local4[_local3 - 1][_local2]).getOwnership();
_local5 = _local16;
} else {
_local16 = null;
}
} else {
_local16 = null;
}
if (GridCell(_local4[_local3 + 2][_local2]) != null) {
if (!GridCell(_local4[_local3 + 2][_local2]).isObstructedByHouse()) {
_local12 = GridCell(_local4[_local3 + 2][_local2]).getOwnership();
_local5 = _local12;
} else {
_local12 = null;
}
} else {
_local12 = null;
}
if (GridCell(_local4[_local3 - 1][_local2 - 1]) != null) {
if (!GridCell(_local4[_local3 - 1][_local2 - 1]).isObstructedByHouse()) {
_local11 = GridCell(_local4[_local3 - 1][_local2 - 1]).getOwnership();
_local5 = _local11;
} else {
_local11 = null;
}
} else {
_local11 = null;
}
if (GridCell(_local4[_local3 + 2][_local2 - 1]) != null) {
if (!GridCell(_local4[_local3 + 2][_local2 - 1]).isObstructedByHouse()) {
_local17 = GridCell(_local4[_local3 + 2][_local2 - 1]).getOwnership();
_local5 = _local17;
} else {
_local17 = null;
}
} else {
_local17 = null;
}
if (GridCell(_local4[_local3 - 1][_local2 + 1]) != null) {
if (!GridCell(_local4[_local3 - 1][_local2 + 1]).isObstructedByHouse()) {
_local13 = GridCell(_local4[_local3 - 1][_local2 + 1]).getOwnership();
_local5 = _local13;
} else {
_local13 = null;
}
} else {
_local13 = null;
}
if (GridCell(_local4[_local3 + 2][_local2 + 1]) != null) {
if (!GridCell(_local4[_local3 + 2][_local2 + 1]).isObstructedByHouse()) {
_local8 = GridCell(_local4[_local3 + 2][_local2 + 1]).getOwnership();
_local5 = _local8;
} else {
_local8 = null;
}
} else {
_local8 = null;
}
var _local6 = [_local14, _local10, _local16, _local12, _local11, _local17, _local13, _local8, _local9, _local15];
var _local18 = false;
if (_local5 != 0) {
if ((_local6[0] == _local5) || (_local6[0] == null)) {
if ((_local6[1] == _local5) || (_local6[1] == null)) {
if ((_local6[2] == _local5) || (_local6[2] == null)) {
if ((_local6[3] == _local5) || (_local6[3] == null)) {
if ((_local6[4] == _local5) || (_local6[4] == null)) {
if ((_local6[5] == _local5) || (_local6[5] == null)) {
if ((_local6[6] == _local5) || (_local6[6] == null)) {
if ((_local6[7] == _local5) || (_local6[7] == null)) {
if ((_local6[8] == _local5) || (_local6[8] == null)) {
if ((_local6[9] == _local5) || (_local6[9] == null)) {
aKrustyKrabs[_local7].doChangeOwnership(_local5);
_local4[_local3][_local2].doChangeOwnership(_local5);
_local4[_local3 + 1][_local2].doChangeOwnership(_local5);
_local4[_local3][_local2 - 1].doChangeOwnership(_local5);
_local4[_local3 + 1][_local2 - 1].doChangeOwnership(_local5);
doUpdateScore();
_local18 = true;
}
}
}
}
}
}
}
}
}
}
}
if (!_local18) {
aKrustyKrabs[_local7].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local3][_local2].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local3 + 1][_local2].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local3][_local2 - 1].doChangeOwnership(LD.nMAX_PLAYER + 1);
_local4[_local3 + 1][_local2 - 1].doChangeOwnership(LD.nMAX_PLAYER + 1);
}
_local7++;
}
}
function isInRadius(_nBlastX, _nBlastY, _nBlastLevel, _xHouseCoord, _yHouseCoord) {
var _local2 = false;
var _local6 = _nBlastX - _nBlastLevel;
var _local4 = _nBlastX + _nBlastLevel;
var _local5 = _nBlastY - _nBlastLevel;
var _local3 = _nBlastY + _nBlastLevel;
if (((_yHouseCoord + _nBlastLevel) >= _local5) && ((_yHouseCoord - _nBlastLevel) <= _local3)) {
if (((_xHouseCoord + _nBlastLevel) >= _local6) && ((_xHouseCoord - _nBlastLevel) <= _local4)) {
_local2 = true;
}
}
return(_local2);
}
function doBlastBombs(_nAffectedX, _nAffectedY) {
var _local2 = 0;
while (_local2 < aBombs.length) {
if ((aBombs[_local2].xCoord == _nAffectedX) && (aBombs[_local2].yCoord == _nAffectedY)) {
aBombs[_local2].doBombed();
}
_local2++;
}
}
function doBlastHouses(_nAffectedX, _nAffectedY) {
var _local2 = 0;
while (_local2 < aHouses.length) {
if ((aHouses[_local2].xCoord == _nAffectedX) && (aHouses[_local2].yCoord == _nAffectedY)) {
aHouses[_local2].doBombed();
}
_local2++;
}
}
function doBlastPumpkins(_nAffectedX, _nAffectedY) {
var _local2 = 0;
while (_local2 < aPumpkins.length) {
if ((aPumpkins[_local2].xCoord == _nAffectedX) && (aPumpkins[_local2].yCoord == _nAffectedY)) {
aPumpkins[_local2].doBombed();
}
_local2++;
}
}
function doBlastPlayers(_nAffectedX, _nAffectedY) {
var _local2 = 0;
while (_local2 < aPlayers.length) {
if ((aPlayers[_local2].xCoord == _nAffectedX) && (aPlayers[_local2].yCoord == _nAffectedY)) {
aPlayers[_local2].doBombed();
}
_local2++;
}
}
function doBlastPowerUps(_nAffectedX, _nAffectedY) {
var _local2 = 0;
while (_local2 < aPowerUps.length) {
if ((aPowerUps[_local2].xCoord == _nAffectedX) && (aPowerUps[_local2].yCoord == _nAffectedY)) {
aPowerUps[_local2].doBombed();
}
_local2++;
}
}
function doCheckPowerup(_nPlayer, _nXCoord, _nYCoord) {
var _local3 = 0;
while (_local3 < aPowerUps.length) {
if ((aPowerUps[_local3].xCoord == _nXCoord) && (aPowerUps[_local3].yCoord == _nYCoord)) {
var _local4 = aPowerUps[_local3].ObjectType;
var _local2 = 0;
while (_local2 < aPlayers.length) {
if (aPlayers[_local2].PlayerNumber == _nPlayer) {
aPowerUps[_local3].doTaken();
aPlayers[_local2].setPowerup(_local4);
}
_local2++;
}
}
_local3++;
}
}
function getComputerPlayer(_nPlayer) {
var _local2;
switch (_nPlayer) {
case 1 :
_local2 = oCpuPlayer1;
break;
case 2 :
_local2 = oCpuPlayer2;
break;
case 3 :
_local2 = oCpuPlayer3;
}
return(_local2);
}
function doUpdateScore() {
var _local2 = 0;
while (_local2 < (LD.nMAX_PLAYER + 1)) {
aPlayersScores[_local2 - 1] = ((aOwnedHouses[_local2 - 1] * LD.nSCORE_HOUSE) + (aOwnedTiles[_local2 - 1] * LD.nSCORE_CELL)) + (aOwnedCommercial[_local2 - 1] * LD.nSCORE_COMMERCIAL);
_local2++;
}
Main.__get__Instance().__get__GameCtrl().setScore(aPlayersScores, aOwnedTiles, aOwnedHouses, aOwnedCommercial);
}
function doDepthSwap(_nYcoord) {
}
function doCheckPowerUpsLeft() {
if ((aPumpkins.length <= nMIN_PUMPKINS_ADDING_POWERUPS) && (!bAddingPowerups)) {
bAddingPowerups = true;
nNextPowerUpAddition = oGameTimer.__get__Time() - nDELAY_POWERUPS;
} else if (bAddingPowerups && (oGameTimer.__get__Time() == nNextPowerUpAddition)) {
nNextPowerUpAddition = oGameTimer.__get__Time() - nDELAY_POWERUPS;
doAddPowerupRandomly();
}
}
var nMIN_PUMPKINS_ADDING_POWERUPS = 4;
var nDELAY_POWERUPS = 30000;
}
Symbol 26 MovieClip [__Packages.GridManager] Frame 0
class GridManager
{
var mcRef, aAllCells, aFreeCells, aBannedCells, nCellWidth, nCellHeigth, nAttachedMC;
function GridManager (_mcRef) {
mcRef = _mcRef;
aAllCells = new Array();
aFreeCells = new Array();
aBannedCells = new Array();
nCellWidth = mcRef._width / LD.nGRID_WIDTH;
nCellHeigth = mcRef._height / LD.nGRID_HEIGTH;
LD.nCELL_WIDTH = nCellWidth;
LD.nCELL_HEIGHT = nCellHeigth;
var _local5 = 0;
var _local2 = 0;
var _local6 = new Array();
nAttachedMC = 0;
var _local4 = 0;
while (_local4 < (LD.nGRID_HEIGTH * LD.nGRID_WIDTH)) {
var _local3 = mcRef.mcEmpty.attachMovie(LD.sTILES_LINKAGE, LD.sTILES_LINKAGE + nAttachedMC, nAttachedMC);
_local3._x = (_local5 * nCellWidth) + (nCellWidth / 2);
_local3._y = (_local2 * nCellHeigth) + nCellHeigth;
_local6.push(new GridCell(_local3, _local5, _local2));
nAttachedMC++;
_local2++;
if (_local2 >= LD.nGRID_HEIGTH) {
_local2 = 0;
_local5++;
aAllCells.push(_local6);
_local6 = new Array();
}
_local4++;
}
}
function doPlaceItem(_mcRef, _nType) {
var _local3 = Math.floor(_mcRef._x / nCellWidth);
var _local2 = Math.floor(_mcRef._y / nCellHeigth);
_mcRef._x = (_local3 * nCellWidth) + (nCellWidth / 2);
_mcRef._y = (_local2 * nCellHeigth) + nCellHeigth;
if (_nType != null) {
aAllCells[_local3][_local2].doAddOccupier(_nType);
}
if ((_nType == LD.nCHUM_BUCKET) || (_nType == LD.nKRUSTY_KRAB)) {
aAllCells[_local3 + 1][_local2].doAddOccupier(_nType);
aAllCells[_local3 + 1][_local2 - 1].doAddOccupier(_nType);
aAllCells[_local3][_local2 - 1].doAddOccupier(_nType);
}
}
function doSetAvaibleTiles() {
aFreeCells = new Array();
var _local5 = 1;
while (_local5 <= LD.nMAX_PLAYER) {
var _local3 = getCellOfOccupier(LD.getPlayerNumberID(_local5));
var _local2 = new Object();
_local2.xCoord = _local3.xCoord - 1;
_local2.yCoord = _local3.yCoord;
aBannedCells.push(_local2);
_local2 = new Object();
_local2.xCoord = _local3.xCoord - 2;
_local2.yCoord = _local3.yCoord;
aBannedCells.push(_local2);
_local2 = new Object();
_local2.xCoord = _local3.xCoord + 1;
_local2.yCoord = _local3.yCoord;
aBannedCells.push(_local2);
_local2 = new Object();
_local2.xCoord = _local3.xCoord + 2;
_local2.yCoord = _local3.yCoord;
aBannedCells.push(_local2);
_local2 = new Object();
_local2.xCoord = _local3.xCoord;
_local2.yCoord = _local3.yCoord - 1;
aBannedCells.push(_local2);
_local2 = new Object();
_local2.xCoord = _local3.xCoord;
_local2.yCoord = _local3.yCoord - 2;
aBannedCells.push(_local2);
_local2 = new Object();
_local2.xCoord = _local3.xCoord;
_local2.yCoord = _local3.yCoord + 1;
aBannedCells.push(_local2);
_local2 = new Object();
_local2.xCoord = _local3.xCoord;
_local2.yCoord = _local3.yCoord + 2;
aBannedCells.push(_local2);
_local5++;
}
_local5 = 0;
while (_local5 < aAllCells.length) {
var _local4 = 0;
while (_local4 < aAllCells[_local5].length) {
if (aAllCells[_local5][_local4].getNumberOccupiers() == 0) {
var _local6 = new Object();
_local6.xCoord = _local5;
_local6.yCoord = _local4;
if (!isCellBanned(_local6)) {
aFreeCells.push(aAllCells[_local5][_local4]);
}
}
_local4++;
}
_local5++;
}
}
function doSetAvaibleTilesForAI() {
aFreeCells = new Array();
var _local3 = 0;
while (_local3 < aAllCells.length) {
var _local2 = 0;
while (_local2 < aAllCells[_local3].length) {
if (aAllCells[_local3][_local2].getNumberOccupiers() == 0) {
var _local4 = new Object();
_local4.xCoord = _local3;
_local4.yCoord = _local2;
if (!isCellBanned(_local4)) {
aFreeCells.push(aAllCells[_local3][_local2]);
}
}
_local2++;
}
_local3++;
}
}
function getCellOfTile(_xCoord, _yCoord) {
return(aAllCells[_xCoord][_yCoord]);
}
function getCellOfOccupier(_nOccupier) {
var _local5 = new Object();
var _local3 = 0;
while (_local3 < aAllCells.length) {
var _local2 = 0;
while (_local2 < aAllCells[_local3].length) {
var _local4 = aAllCells[_local3][_local2].getOccupiersArray();
if (Library.Utils.Tools.isItemInArray(_local4, _nOccupier)) {
_local5 = aAllCells[_local3][_local2];
}
_local2++;
}
_local3++;
}
return(_local5);
}
function isOccupierInCell(_nX, _nY, _nOccupier) {
var _local4 = _nOccupier;
var _local2 = false;
var _local3 = aAllCells[_nX][_nX].getOccupiersArray();
if (Library.Utils.Tools.isItemInArray(_local3, _local4)) {
_local2 = true;
}
return(_local2);
}
function doDestroy() {
mcRef.removeMovieClip();
delete mcRef;
var _local3 = 0;
while (_local3 < aAllCells.length) {
aAllCells[_local3].doDestroy();
delete aAllCells[_local3];
_local3++;
}
delete aAllCells;
_local3 = 0;
while (_local3 < aFreeCells.length) {
aFreeCells[_local3].doDestroy();
delete aFreeCells[_local3];
_local3++;
}
delete aFreeCells;
_local3 = 0;
while (_local3 < aBannedCells.length) {
aBannedCells[_local3].doDestroy();
delete aBannedCells[_local3];
_local3++;
}
delete aBannedCells;
super.doDestroy();
}
function get FreeCells() {
return(Library.Utils.Tools.doCopyArray(aFreeCells));
}
function get AllCells() {
return(aAllCells);
}
function isCellBanned(_oCoords) {
var _local4 = false;
var _local2 = 0;
while (_local2 < aBannedCells.length) {
if ((aBannedCells[_local2].xCoord == _oCoords.xCoord) && (aBannedCells[_local2].yCoord == _oCoords.yCoord)) {
_local4 = true;
}
_local2++;
}
return(_local4);
}
}
Symbol 23 MovieClip [__Packages.LD] Frame 0
class LD
{
function LD () {
}
static function getPlayerLinkage(_nPlayerNumber) {
var _local1;
switch (_nPlayerNumber) {
case nPLAYER1 :
_local1 = sPLAYER_1_LINKAGE;
break;
case nPLAYER2 :
_local1 = sPLAYER_2_LINKAGE;
break;
case nPLAYER3 :
_local1 = sPLAYER_3_LINKAGE;
break;
case nPLAYER4 :
_local1 = sPLAYER_4_LINKAGE;
}
return(_local1);
}
static function getPlayerNumberID(_nPlayerNumber) {
var _local1;
switch (_nPlayerNumber) {
case 1 :
_local1 = nPLAYER1;
break;
case 2 :
_local1 = nPLAYER2;
break;
case 3 :
_local1 = nPLAYER3;
break;
case 4 :
_local1 = nPLAYER4;
}
return(_local1);
}
static function getPowerUpLinkage(_nPowerUp) {
var _local1;
switch (_nPowerUp) {
case nPU_SPEED :
_local1 = sUP_SPEED_LINKAGE;
break;
case nPU_RANGE :
_local1 = sUP_RANGE_LINKAGE;
break;
case nPU_STOCK :
_local1 = sUP_STOCK_LINKAGE;
break;
case nPU_KICK :
_local1 = sUP_KICK_LINKAGE;
break;
case nPU_KAMIKAZE :
_local1 = sUP_KAMIKAZE_LINKAGE;
}
return(_local1);
}
static var nMAX_PLAYER = 4;
static var nSCORE_CELL = 50;
static var nSCORE_HOUSE = 500;
static var nSCORE_COMMERCIAL = 2000;
static var nTIMER_BOMB = 75;
static var nMAX_PATHFIND_RANGE = 5;
static var nGRID_WIDTH = 11;
static var nGRID_HEIGTH = 8;
static var nCELL_WIDTH = 50;
static var nCELL_HEIGHT = 50;
static var sPUMPKINS_LINKAGE = "mcPumpkins";
static var sHOUSE_LINKAGE = "mcHouse";
static var sKRUSTY_KRAB_LINKAGE = "mcKrusty";
static var sCHUM_BUCKET_LINKAGE = "mcChum";
static var sPLAYER_1_LINKAGE = "mcPlayer1";
static var sPLAYER_2_LINKAGE = "mcPlayer2";
static var sPLAYER_3_LINKAGE = "mcPlayer3";
static var sPLAYER_4_LINKAGE = "mcPlayer4";
static var sBOMB_LINKAGE = "mcBomb";
static var sTILES_LINKAGE = "mcTile";
static var sUP_SPEED_LINKAGE = "mcPowerSpeed";
static var sUP_STOCK_LINKAGE = "mcPowerStock";
static var sUP_RANGE_LINKAGE = "mcPowerLevel";
static var sUP_KICK_LINKAGE = "mcPowerKick";
static var sUP_KAMIKAZE_LINKAGE = "mcPowerKamikaze";
static var sDIRECTION_UP = "Up";
static var sDIRECTION_DOWN = "Down";
static var sDIRECTION_LEFT = "Left";
static var sDIRECTION_RIGHT = "Right";
static var sDIRECTION_ON = "On";
static var nSTARTING_TRIES = 1;
static var nPLAYER1 = 1;
static var nPLAYER2 = 2;
static var nPLAYER3 = 3;
static var nPLAYER4 = 4;
static var nBOMB = 5;
static var nPUMPKIN = 6;
static var nHOUSE = 7;
static var nCOMMERCIAL = 8;
static var nSTART_POSITION = 9;
static var nPU_STOCK = 9;
static var nPU_RANGE = 10;
static var nPU_SPEED = 11;
static var nPU_KICK = 12;
static var nPU_KAMIKAZE = 13;
static var nEXPLOSION = 14;
static var nROCKS = 15;
static var nKRUSTY_KRAB = 16;
static var nCHUM_BUCKET = 17;
static var nDEFAULT_SPEED = 3;
static var nMAX_SPEED = 8;
static var nDEFAULT_LIFE = 1;
static var nMAX_LIFE = 7;
static var nDEFAULT_BOMB_STOCK = 1;
static var nMAX_BOMB_STOCK = 7;
static var nDEFAULT_BOMB_RANGE = 1;
static var nMAX_BOMB_RANGE = 7;
}
Symbol 24 MovieClip [__Packages.CellObject] Frame 0
class CellObject extends Library.State
{
var nXcoord, nYcoord, nObjectType, mcRef;
function CellObject (_mcRef, _nXcoord, _nYcoord, _nObjectType) {
super(_mcRef);
nXcoord = _nXcoord;
nYcoord = _nYcoord;
nObjectType = _nObjectType;
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doAddListener(this);
}
function setXcoord(_nCoord) {
nXcoord = _nCoord;
}
function setYcoord(_nCoord) {
nYcoord = _nCoord;
}
function doDestroy() {
super.doDestroy();
mcRef.removeMovieClip();
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doRemoveListener(this);
delete mcRef;
}
function get xCoord() {
return(nXcoord);
}
function get yCoord() {
return(nYcoord);
}
function get ObjectType() {
return(nObjectType);
}
}
Symbol 25 MovieClip [__Packages.GridCell] Frame 0
class GridCell extends CellObject
{
var mcRef, aCurrentOccupiers, nOwnership;
function GridCell (_mcRef, _xCoord, _yCoord) {
super(_mcRef, _xCoord, _yCoord);
mcRef.gotoAndStop(mcRef._totalframes);
aCurrentOccupiers = new Array();
nOwnership = 0;
}
function doEnterFrame() {
super.doEnterFrame();
}
function doAddOccupier(_nOccupier) {
aCurrentOccupiers.push(_nOccupier);
}
function doChangeOwnership(_nPlayer) {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doLoseTile(getOwnership());
nOwnership = _nPlayer;
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doGainTile(getOwnership());
mcRef.gotoAndStop(_nPlayer);
}
function doBombed(_nPlayer) {
if (((!Library.Utils.Tools.isItemInArray(aCurrentOccupiers, LD.nHOUSE)) && (!Library.Utils.Tools.isItemInArray(aCurrentOccupiers, LD.nCHUM_BUCKET))) && (!Library.Utils.Tools.isItemInArray(aCurrentOccupiers, LD.nKRUSTY_KRAB))) {
doChangeOwnership(_nPlayer);
}
if (Library.Utils.Tools.isItemInArray(aCurrentOccupiers, LD.nPUMPKIN)) {
doRemoveOccupier(LD.nPUMPKIN);
}
}
function doRemoveOccupier(_nOccupier) {
var _local2 = 0;
while (_local2 < aCurrentOccupiers.length) {
if (aCurrentOccupiers[_local2] == _nOccupier) {
aCurrentOccupiers.splice(_local2, 1);
}
_local2++;
}
}
function getNumberOccupiers() {
return(aCurrentOccupiers.length);
}
function getOccupiersArray() {
return(aCurrentOccupiers);
}
function getOwnership() {
return(nOwnership);
}
function isObstructed() {
var _local3 = false;
var _local2 = 0;
while (_local2 < aCurrentOccupiers.length) {
if (((((aCurrentOccupiers[_local2] == LD.nHOUSE) || (aCurrentOccupiers[_local2] == LD.nPUMPKIN)) || (aCurrentOccupiers[_local2] == LD.nBOMB)) || (aCurrentOccupiers[_local2] == LD.nCHUM_BUCKET)) || (aCurrentOccupiers[_local2] == LD.nKRUSTY_KRAB)) {
_local3 = true;
}
_local2++;
}
return(_local3);
}
function isObstructedByHouse() {
var _local3 = false;
var _local2 = 0;
while (_local2 < aCurrentOccupiers.length) {
if (aCurrentOccupiers[_local2] == LD.nHOUSE) {
_local3 = true;
}
_local2++;
}
return(_local3);
}
function doDestroy() {
super.doDestroy();
}
}
Symbol 18 MovieClip [__Packages.Library.Utils.Timer] Frame 0
class Library.Utils.Timer
{
var nTimeSpent, nMethod, nFrameRate, bTimerActive, __get__Method, __get__FrameRate;
function Timer () {
nTimeSpent = 0;
nMethod = TIMER_COUNT_UP;
nFrameRate = BASE_FRAMERATE;
bTimerActive = false;
}
function doEnterFrame() {
if (bTimerActive) {
nTimeSpent = nTimeSpent + nMethod;
}
}
function doStartTimer() {
bTimerActive = true;
}
function doStopTimer() {
bTimerActive = false;
}
function setTime(__nTime) {
nTimeSpent = __nTime * (nFrameRate / 1000);
}
function doResetTime() {
nTimeSpent = 0;
}
function get Time() {
return(Math.round(nTimeSpent / (nFrameRate / 1000)));
}
function get Frames() {
return(nTimeSpent);
}
function set Method(__n) {
nMethod = __n;
//return(__get__Method());
}
function set FrameRate(__n) {
nFrameRate = __n;
//return(__get__FrameRate());
}
static var TIMER_COUNT_UP = 1;
static var TIMER_COUNT_DOWN = -1;
static var BASE_FRAMERATE = 30;
}
Symbol 27 MovieClip [__Packages.MovingObject] Frame 0
class MovingObject extends CellObject
{
var bNeedMouvement, nObject, nFinalX, mcRef, nFinalY, __get__xCoord, __get__yCoord, nMovingSpeed, setXcoord, setYcoord, nObjectType, __get__CurrentState;
function MovingObject (_mcRef, _nXcoord, _nYcoord, _nObjectType) {
super(_mcRef, _nXcoord, _nYcoord, _nObjectType);
bNeedMouvement = false;
}
function doEnterFrame() {
super.doEnterFrame();
if (bNeedMouvement) {
doMouvement();
}
}
function doMove(_nX, _nY, _nSpeed, _nObject) {
var _local4 = false;
nObject = _nObject;
nFinalX = mcRef._x;
nFinalY = mcRef._y;
setBlockInput(true);
if (isAbleMoving()) {
if (Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().isObjectMoveLegal(__get__xCoord() + _nX, __get__yCoord() + _nY, __get__xCoord(), __get__yCoord(), _nObject, mcRef)) {
if (_nX > 0) {
nFinalX = mcRef._x + LD.nCELL_WIDTH;
} else if (_nX < 0) {
nFinalX = mcRef._x - LD.nCELL_WIDTH;
}
if (_nY > 0) {
nFinalY = mcRef._y + LD.nCELL_HEIGHT;
} else if (_nY < 0) {
nFinalY = mcRef._y - LD.nCELL_HEIGHT;
}
nMovingSpeed = _nSpeed;
bNeedMouvement = true;
_local4 = true;
setXcoord(__get__xCoord() + _nX);
setYcoord(__get__yCoord() + _nY);
} else {
doBlocked(_nX, _nY);
}
}
return(_local4);
}
function doDestroy() {
super.doDestroy();
}
function setBlockInput(_bBlock) {
}
function doBlocked() {
}
function doMouvement() {
if ((mcRef._x != nFinalX) || (mcRef._y != nFinalY)) {
setBlockInput(true);
if (isAbleMoving()) {
setPlayerState("Walk");
if ((mcRef._x + nMovingSpeed) < nFinalX) {
mcRef._x = mcRef._x + nMovingSpeed;
} else if ((mcRef._x - nMovingSpeed) > nFinalX) {
mcRef._x = mcRef._x - nMovingSpeed;
} else {
mcRef._x = nFinalX;
}
if ((mcRef._y + nMovingSpeed) < nFinalY) {
mcRef._y = mcRef._y + nMovingSpeed;
} else if ((mcRef._y - nMovingSpeed) > nFinalY) {
mcRef._y = mcRef._y - nMovingSpeed;
} else {
mcRef._y = nFinalY;
}
}
} else {
setBlockInput(false);
bNeedMouvement = false;
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doCheckPowerup(nObjectType, __get__xCoord(), __get__yCoord());
}
}
function setPlayerState() {
}
function isAbleMoving() {
var _local2 = true;
if ((((__get__CurrentState() == "BlastedUp") || (__get__CurrentState() == "BlastedDown")) || (__get__CurrentState() == "BlastedLeft")) || (__get__CurrentState() == "BlastedRight")) {
_local2 = false;
}
if ((((__get__CurrentState() == "PowerUp") || (__get__CurrentState() == "PowerDown")) || (__get__CurrentState() == "PowerLeft")) || (__get__CurrentState() == "PowerRight")) {
_local2 = false;
}
return(_local2);
}
}
Symbol 28 MovieClip [__Packages.Player] Frame 0
class Player extends MovingObject
{
var bBlockInput, nBombStock, nBombRange, nSpeed, bKamikaze, bKick, nDroppedBombs, sPlayerDirection, setState, __get__xCoord, __get__yCoord, nPlayerNumber, mcRef, isStateComplete;
function Player (_mcRef, _xCoord, _yCoord, _nObjectType) {
super(_mcRef, _xCoord, _yCoord, _nObjectType);
bBlockInput = false;
nBombStock = LD.nDEFAULT_BOMB_STOCK - 1;
nBombRange = LD.nDEFAULT_BOMB_RANGE;
nSpeed = LD.nDEFAULT_SPEED;
bKamikaze = false;
bKick = false;
nDroppedBombs = 0;
setDirection(LD.sDIRECTION_RIGHT);
setPlayerState(sSTATE_IDLE);
}
function setBlockInput(_bBlock) {
if (_bBlock) {
bBlockInput = true;
} else {
bBlockInput = false;
setPlayerState(sSTATE_IDLE);
}
}
function setDirection(_sDirection) {
sPlayerDirection = _sDirection;
}
function setPathFind(_aNewPath) {
}
function setPlayerState(_sState) {
setState(_sState + sPlayerDirection);
}
function doBlocked(_nX, _nY) {
if (bKick) {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doPlayerKick(__get__xCoord() + _nX, __get__yCoord() + _nY, sPlayerDirection);
setPlayerState(sSTATE_KICK);
} else {
setPlayerState(sSTATE_IDLE);
setBlockInput(false);
}
}
function doBombed() {
setPlayerState(sSTATE_BLASTED);
setPlayerBombStock(LD.nDEFAULT_BOMB_STOCK - 1);
setPlayerSpeed(LD.nDEFAULT_SPEED);
setBombRange(LD.nDEFAULT_BOMB_RANGE);
setPlayerKick(false);
setPlayerKamikaze(false);
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doPlayerTouched(nPlayerNumber);
var _local2 = Math.ceil(Math.random() * 2);
switch (nPlayerNumber) {
case 1 :
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "BobTouched2.mp3", 70);
break;
case 2 :
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "PatrickTouched.mp3");
break;
case 3 :
if (_local2 == 1) {
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "SandyTouched.mp3", 60);
} else {
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "SandyTouched2.mp3", 70);
}
break;
case 4 :
if (_local2 == 1) {
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "SquidwardTouched.mp3");
} else {
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "SquidwardTouched2.mp3", 70);
}
}
}
function setPowerup(_nPowerType) {
doPlayPowerupSound(_nPowerType);
setPlayerState(sSTATE_POWER_UP);
switch (_nPowerType) {
case LD.nPU_SPEED :
doChangePlayerSpeed(1);
break;
case LD.nPU_STOCK :
doChangePlayerBombStock(1);
break;
case LD.nPU_RANGE :
doChangePlayerBombRange(1);
break;
case LD.nPU_KICK :
setPlayerKick(true);
break;
case LD.nPU_KAMIKAZE :
setPlayerKamikaze(true);
}
}
function doOwnerBombExploded(_nRemovedBomb) {
nDroppedBombs = nDroppedBombs - _nRemovedBomb;
}
function doOwnerBombPosed(_nAddedBombs) {
nDroppedBombs = nDroppedBombs + _nAddedBombs;
}
function doDestroy() {
super.doDestroy();
}
function get PlayerNumber() {
return(nPlayerNumber);
}
function get Ref() {
return(mcRef);
}
function doIdleUp() {
doFakeIdle();
}
function doIdleDown() {
doFakeIdle();
}
function doIdleLeft() {
doFakeIdle();
}
function doIdleRight() {
doFakeIdle();
}
function doFakeIdle() {
}
function doWalkUp() {
doFakeWalk();
}
function doWalkDown() {
doFakeWalk();
}
function doWalkLeft() {
doFakeWalk();
}
function doWalkRight() {
doFakeWalk();
}
function doFakeWalk() {
}
function doKickUp() {
doFakeKick();
}
function doKickDown() {
doFakeKick();
}
function doKickLeft() {
doFakeKick();
}
function doKickRight() {
doFakeKick();
}
function doFakeKick() {
if (isStateComplete()) {
setPlayerState(sSTATE_IDLE);
setBlockInput(false);
}
}
function doBlastedUp() {
doFakeBlasted();
}
function doBlastedDown() {
doFakeBlasted();
}
function doBlastedLeft() {
doFakeBlasted();
}
function doBlastedRight() {
doFakeBlasted();
}
function doFakeBlasted() {
setBlockInput(true);
if (isStateComplete()) {
setPlayerState(sSTATE_IDLE);
setBlockInput(false);
}
}
function doPowerUp() {
doFakePower();
}
function doPowerDown() {
doFakePower();
}
function doPowerLeft() {
doFakePower();
}
function doPowerRight() {
doFakePower();
}
function doFakePower() {
if (isStateComplete()) {
setPlayerState(sSTATE_IDLE);
setBlockInput(false);
}
}
function doKamikazeUp() {
doFakeKamikaze();
}
function doKamikazeDown() {
doFakeKamikaze();
}
function doKamikazeLeft() {
doFakeKamikaze();
}
function doKamikazeRight() {
doFakeKamikaze();
}
function doFakeKamikaze() {
setBlockInput(true);
if (isStateComplete()) {
setPlayerState(sSTATE_IDLE);
setBlockInput(false);
}
}
function doAddBomb() {
if (nDroppedBombs <= nBombStock) {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doAddBomb(nPlayerNumber, nBombRange, bKamikaze, nBombStock - nDroppedBombs, sPlayerDirection);
}
}
function doChangePlayerSpeed(_nSpeedChange) {
nSpeed = nSpeed + _nSpeedChange;
if (nSpeed > LD.nMAX_SPEED) {
nSpeed = LD.nMAX_SPEED;
}
}
function setPlayerSpeed(_nSpeed) {
nSpeed = _nSpeed;
}
function doChangePlayerBombRange(_nRangeChange) {
nBombRange = nBombRange + _nRangeChange;
if (nBombRange > LD.nMAX_BOMB_RANGE) {
nBombRange = LD.nMAX_BOMB_RANGE;
}
}
function setBombRange(_nRange) {
nBombRange = _nRange;
}
function doChangePlayerBombStock(_nStockChange) {
nBombStock = nBombStock + _nStockChange;
if (nBombStock > LD.nMAX_BOMB_STOCK) {
nBombStock = LD.nMAX_BOMB_STOCK;
}
}
function setPlayerBombStock(_nStock) {
nBombStock = _nStock;
}
function setPlayerKick(_bKick) {
bKick = _bKick;
}
function setPlayerKamikaze(_bKamikaze) {
bKamikaze = _bKamikaze;
}
function doPlayPowerupSound(_nPowerUpID) {
}
var sSTATE_IDLE = "Idle";
var sSTATE_WALKING = "Walk";
var sSTATE_BLASTED = "Blasted";
var sSTATE_POWER_UP = "Power";
var sSTATE_KICK = "Kick";
var sSTATE_KAMIKAZE = "Kamikaze";
}
Symbol 8 MovieClip [__Packages.Library.Sound.SoundManager] Frame 0
class Library.Sound.SoundManager
{
static var aSounds, mcAttach, nSoundNum, aSoundCategories, nMasterVolume, oEnterFrameListener;
function SoundManager () {
}
static function doPlaySound(_sLinkage, _nVolume, _nLoop, _bUnique) {
return(doPlaySoundInCat(sDEFAULT_CATEGORY, _sLinkage, _nVolume, _nLoop, _bUnique));
}
static function doPlaySoundInCat(_sCategoryName, _sLinkage, _nVolume, _nLoop, _bUnique) {
doCheckInit();
var _local1;
if (NewSoundAllowed) {
if (_nVolume == undefined) {
_nVolume = 100;
}
if (_nLoop == undefined) {
_nLoop = 1;
}
if (_bUnique == undefined) {
_bUnique = false;
}
var _local2;
if (_bUnique) {
var _local4 = isSoundPlaying(_sLinkage);
if (_local4.bPlaying) {
_local2 = false;
_local1 = _local4.oSound;
} else {
_local2 = true;
}
} else {
_local2 = true;
}
if (_local2) {
doManageCategory(_sCategoryName);
var _local5 = getMCForSound();
var _local3 = new Sound(_local5);
_local3.attachSound(_sLinkage);
if (_local3.duration != undefined) {
_local1 = new Library.Sound.SoundItem(_local3, _sLinkage, _nVolume, _nLoop, _sCategoryName, _local5);
}
_local1.doAddListener(Library.Sound.SoundManager);
aSounds.push(_local1);
}
}
return(_local1);
}
static function isSoundPlaying(_sLinkageName) {
var _local1 = new Object();
_local1.bPlaying = false;
_local1.oSound = undefined;
for (var _local3 in aSounds) {
if (aSounds[_local3].LinkageName == _sLinkageName) {
_local1.oSound = aSounds[_local3];
_local1.bPlaying = true;
}
}
return(_local1);
}
static function doManageExternalSound(_oSound) {
doCheckInit();
doManageCategory(_oSound.__get__Category());
_oSound.doAddListener(Library.Sound.SoundManager);
aSounds.push(_oSound);
}
static function getMCForSound() {
var _local1 = getNextDepth();
var _local2 = mcAttach.createEmptyMovieClip("Snd" + _local1, _local1);
return(_local2);
}
static function getNextDepth() {
nSoundNum++;
return(nSoundNum);
}
static function doInit(_mcAttach) {
if (!bInited) {
mcAttach = _mcAttach;
bInited = true;
nSoundNum = 0;
aSounds = new Array();
aSoundCategories = new Array();
nMasterVolume = 100;
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = Library.Utils.Delegate.create(Library.Sound.SoundManager, doEnterFrame);
MovieClip.addListener(oEnterFrameListener);
}
}
static function doEnterFrame() {
for (var _local1 in aSounds) {
aSounds[_local1].doEnterFrame();
}
}
static function setCategoryVolume(_sCategoryName, _nVol) {
doManageCategory(_sCategoryName);
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == _sCategoryName) {
aSoundCategories[_local3].nVolume = _nVol;
}
}
doUpdateAllSoundsVolume();
}
static function getCategoryVolume(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local1;
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == _sCategoryName) {
_local1 = aSoundCategories[_local3].nVolume;
}
}
return(_local1);
}
static function isCategoryMuted(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local1;
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == _sCategoryName) {
_local1 = aSoundCategories[_local3].bMuted;
}
}
return(_local1);
}
static function doSoundEvent(_nEvent, _oSound) {
if (!(_nEvent === nEVENT_SOUND_COMPLETE)) {
} else {
var _local1 = false;
for (var _local3 in aSounds) {
if (!_local1) {
if (aSounds[_local3] == _oSound) {
_local1 = true;
delete aSounds[_local3];
aSounds.splice(Number(_local3), 1);
}
}
}
}
}
static function doMuteCategory(_sCategoryName) {
for (var _local1 in aSoundCategories) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
aSoundCategories[_local1].bMuted = true;
}
}
doUpdateAllSoundsVolume();
}
static function doUnMuteCategory(_sCategoryName) {
for (var _local1 in aSoundCategories) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
aSoundCategories[_local1].bMuted = false;
}
}
doUpdateAllSoundsVolume();
}
static function setMasterVolume(_nVol) {
nMasterVolume = _nVol;
doUpdateAllSoundsVolume();
}
static function get NewSoundAllowed() {
return(aSounds.length < nMAX_SOUNDS_PLAYING);
}
static function get MasterVolume() {
return(nMasterVolume);
}
static function doRemoveListenerFromAllSounds(_oListener) {
for (var _local1 in aSounds) {
aSounds[_local1].doRemoveListener(_oListener);
}
}
static function doDestroy() {
doRemoveListenerFromAllSounds();
for (var _local1 in aSounds) {
aSounds[_local1].doDestroy();
}
mcAttach.removeMovieClip();
delete mcAttach;
nSoundNum = 0;
bInited = false;
nMasterVolume = 100;
delete aSounds;
delete aSoundCategories;
delete oEnterFrameListener;
}
static function get Inited() {
return(bInited);
}
static function doUpdateAllSoundsVolume() {
for (var _local1 in aSounds) {
aSounds[_local1].doUpdateSound();
}
}
static function doCheckInit() {
if (!bInited) {
}
}
static function doManageCategory(_sCategoryName) {
doCheckInit();
var _local1 = false;
for (var _local4 in aSoundCategories) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
_local1 = true;
}
}
if (!_local1) {
var _local3 = new Object();
_local3.sName = _sCategoryName;
_local3.nVolume = 100;
_local3.bMuted = false;
aSoundCategories.push(_local3);
}
}
static var nEVENT_SOUND_COMPLETE = 1;
static var sDEFAULT_CATEGORY = "SFX";
static var nMAX_SOUNDS_PLAYING = 8;
static var bInited = false;
}
Symbol 5 MovieClip [__Packages.Library.Sound.SoundItem] Frame 0
class Library.Sound.SoundItem
{
var sndObj, sLinkage, mcRef, nRemainingLoop, nCurrentVolume, nTargetVolume, nFadeRate, sCategory, bFadeAtEnd, bMuted, bPaused, bNeedFreshStart, nCurrentTime, aEventListeners, bStopAfterFade;
function SoundItem (_sndObject, _sLinkage, _nVolume, _nLoop, _sCategory, _mc) {
sndObj = _sndObject;
sLinkage = _sLinkage;
mcRef = _mc;
nRemainingLoop = _nLoop;
nCurrentVolume = _nVolume;
nTargetVolume = _nVolume;
nFadeRate = nFADE_RATE;
sCategory = _sCategory;
bFadeAtEnd = false;
bMuted = false;
bPaused = false;
bNeedFreshStart = false;
sndObj.onSoundComplete = Library.Utils.Delegate.create(this, doSoundComplete);
doStart(_nLoop);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
nCurrentTime = 0;
aEventListeners = new Array();
}
function doEnterFrame() {
if (!bPaused) {
if (nCurrentTime > sndObj.position) {
nRemainingLoop--;
}
nCurrentTime = sndObj.position;
}
doCheckFadeAtEnd();
doManageFade();
}
function doAddListener(_oListener) {
aEventListeners.push(_oListener);
}
function doRemoveListener(_oListener) {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
if (aEventListeners[_local2] == _oListener) {
delete aEventListeners[_local2];
aEventListeners.splice(_local2, 1);
}
_local2++;
}
}
function doSoundComplete() {
if (bNeedFreshStart && (nRemainingLoop > 1)) {
sndObj.start(0, nRemainingLoop - 1);
} else {
doManageEndEvent();
}
}
function doUpdateSound() {
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
function doMute() {
bMuted = true;
doUpdateSound();
}
function doUnMute() {
bMuted = false;
doUpdateSound();
}
function doPause() {
sndObj.stop();
bPaused = true;
}
function doResume() {
bPaused = false;
bNeedFreshStart = true;
sndObj.start(nCurrentTime / 1000, 1);
}
function doStart(_nLoop) {
if (_nLoop == undefined) {
_nLoop = 1;
}
if (sLinkage.indexOf(".mp3") != -1) {
sndObj.start(0.015, _nLoop);
} else {
sndObj.start(0, _nLoop);
}
}
function doStop() {
sndObj.stop();
doManageEndEvent();
}
function doFadeTo(_nVolume, _bStopAndDelete) {
if (_bStopAndDelete == undefined) {
_bStopAndDelete = true;
}
bStopAfterFade = _bStopAndDelete;
nTargetVolume = _nVolume;
}
function setFadeRate(_nRate) {
if (_nRate == undefined) {
_nRate = nFADE_RATE;
}
nFadeRate = _nRate;
}
function setFadeAtEnd(_bFadeAtEnd) {
bFadeAtEnd = true;
}
function setPan(_nPan) {
sndObj.setPan(_nPan);
}
function get Category() {
return(sCategory);
}
function get LinkageName() {
return(sLinkage);
}
function doDestroy() {
sndObj.stop();
delete sndObj;
mcRef.removeMovieClip();
}
function doCheckFadeAtEnd() {
if (bFadeAtEnd) {
if (nRemainingLoop == 1) {
if ((sndObj.duration - nCurrentTime) <= nFADE_AT_END_TIME) {
doFadeTo(0);
}
}
}
}
function doManageEndEvent() {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
aEventListeners[_local2].doSoundEvent(Library.Sound.SoundManager.nEVENT_SOUND_COMPLETE, this);
_local2++;
}
aEventListeners = new Array();
mcRef.removeMovieClip();
delete mcRef;
delete aEventListeners;
delete sndObj.onSoundComplete;
delete sndObj;
}
function doManageFade() {
if (nCurrentVolume != nTargetVolume) {
nCurrentVolume = Library.Utils.MoreMath.getReachNum(nCurrentVolume, nTargetVolume, nFadeRate);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
if ((nCurrentVolume <= 0) && (bStopAfterFade)) {
sndObj.stop();
doManageEndEvent();
}
}
function returnComputedVolume(_nVolume) {
var _local2;
if ((!bMuted) && (!Library.Sound.SoundManager.isCategoryMuted(sCategory))) {
var _local3 = Library.Sound.SoundManager.__get__MasterVolume() / 100;
var _local4 = Library.Sound.SoundManager.getCategoryVolume(sCategory) / 100;
_local2 = _nVolume;
_local2 = _local2 * _local4;
_local2 = _local2 * _local3;
} else {
_local2 = 0;
}
return(_local2);
}
static var nFADE_RATE = 8;
static var nFADE_AT_END_TIME = 800;
}
Symbol 29 MovieClip [__Packages.HumanPlayer] Frame 0
class HumanPlayer extends Player
{
var nPlayerNumber, nDelayBeforePlaying, nLastPowerupID, doPause, setPlayerState, sSTATE_BLASTED, bBlockInput, doAddBomb, setDirection, doMove, nSpeed, sSTATE_WALKING;
function HumanPlayer (_mcRef, _nNumber, _nXcoord, _nYcoord) {
super(_mcRef, _nXcoord, _nYcoord, _nNumber);
nPlayerNumber = _nNumber;
nDelayBeforePlaying = 0;
nLastPowerupID = 0;
doPause();
}
function doEnterFrame() {
super.doEnterFrame();
if (Main.__get__Instance().__get__GameCtrl().getNPCstatus()) {
doCheckKeys();
}
if (nDelayBeforePlaying > 0) {
nDelayBeforePlaying--;
if (nDelayBeforePlaying == 0) {
doPlayDelayedPowerupSound();
}
}
}
function doExplode() {
setPlayerState(sSTATE_BLASTED);
}
function doDestroy() {
if (nDelayBeforePlaying > 0) {
doPlayDelayedPowerupSound();
}
super.doDestroy();
}
function get PlayerNumber() {
return(nPlayerNumber);
}
function doCheckKeys() {
if (Key.isDown(String("H").charCodeAt(0))) {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doActiveEaster();
}
if (!bBlockInput) {
if (Key.isDown(32)) {
doAddBomb();
}
if (Key.isDown(37)) {
setDirection(LD.sDIRECTION_LEFT);
if (doMove(-1, 0, nSpeed, nPlayerNumber)) {
setPlayerState(sSTATE_WALKING);
}
} else if (Key.isDown(39)) {
setDirection(LD.sDIRECTION_RIGHT);
if (doMove(1, 0, nSpeed, nPlayerNumber)) {
setPlayerState(sSTATE_WALKING);
}
} else if (Key.isDown(38)) {
setDirection(LD.sDIRECTION_UP);
if (doMove(0, -1, nSpeed, nPlayerNumber)) {
setPlayerState(sSTATE_WALKING);
}
} else if (Key.isDown(40)) {
setDirection(LD.sDIRECTION_DOWN);
if (doMove(0, 1, nSpeed, nPlayerNumber)) {
setPlayerState(sSTATE_WALKING);
}
}
}
}
function doPlayPowerupSound(_nPowerUpID) {
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "PowerUp.mp3");
nLastPowerupID = _nPowerUpID;
nDelayBeforePlaying = nDELAY_SOUND;
}
function doPlayDelayedPowerupSound() {
switch (nLastPowerupID) {
case LD.nPU_SPEED :
break;
case LD.nPU_STOCK :
break;
case LD.nPU_RANGE :
break;
case LD.nPU_KICK :
break;
case LD.nPU_KAMIKAZE :
}
}
var nDELAY_SOUND = 30;
}
Symbol 36 MovieClip [__Packages.ComputerPlayer] Frame 0
class ComputerPlayer extends Player
{
var aPathNodes, aActions, aBannedTiles, aTilesToConquer, nPlayerNumber, oPathFinder, bInMouvement, bInit, nReflexTimer, oTileBomb, oTargetHouse, oTargetPumpkin, oTargetCell, oTargetBomb, oTargetPowerup, isStateComplete, setPlayerState, sSTATE_IDLE, __get__CurrentState, __get__xCoord, doMove, nSpeed, setDirection, sSTATE_WALKING, __get__yCoord, doAddBomb, nHouseCaptureTries;
function ComputerPlayer (_mcRef, _nNumber, _nXcoord, _nYcoord) {
super(_mcRef, _nXcoord, _nYcoord, _nNumber);
aPathNodes = new Array();
aActions = new Array();
aBannedTiles = new Array();
aTilesToConquer = new Array();
nPlayerNumber = _nNumber;
oPathFinder = new Pathfinding.PathFinding(this);
bInMouvement = false;
bInit = false;
nReflexTimer = 1;
oTileBomb = new Object();
oTargetHouse = null;
oTargetPumpkin = null;
oTargetCell = null;
oTargetBomb = null;
oTargetPowerup = null;
}
function doEnterFrame() {
super.doEnterFrame();
doCheckSucess();
doCheckReflexCycle();
doCheckActionArray();
doCheckMouvement();
}
function doCheckActionArray() {
if (aActions.length > 0) {
var _local2 = aActions[0];
aActions.splice(0, 1);
this[_local2]();
}
}
function doCheckReflexCycle() {
nReflexTimer--;
if (nReflexTimer == 0) {
doResetReflexTimer();
getAction();
}
}
function setPathFind(_aNewPath, _bPathFound) {
if ((!_bPathFound) && (aTilesToConquer.length > 1)) {
aTilesToConquer.splice(0, 1);
getNewPath();
} else {
aPathNodes = _aNewPath;
aPathNodes.splice(aPathNodes.length - 1, 1);
oPathFinder.doAddBannedCells(aBannedTiles);
aBannedTiles = new Array();
}
}
function doDestroy() {
super.doDestroy();
}
function doFakeBlasted() {
setBlockInput(true);
aPathNodes = new Array();
if (isStateComplete()) {
setPlayerState(sSTATE_IDLE);
setBlockInput(false);
doResetAI();
}
}
function doCheckMouvement() {
if (aPathNodes.length > 0) {
if (!bInit) {
bInit = true;
Main.__get__Instance().__get__GameCtrl().doNPCinit();
}
if (((((!bInMouvement) && (__get__CurrentState() != "doBlastedUp")) && (__get__CurrentState() != "doBlastedDown")) && (__get__CurrentState() != "doBlastedLeft")) && (__get__CurrentState() != "doBlastedRight")) {
var _local2 = aPathNodes.length - 1;
if (__get__xCoord() > aPathNodes[_local2].xCoord) {
if (doMove(-1, 0, nSpeed, nPlayerNumber)) {
setDirection(LD.sDIRECTION_LEFT);
setPlayerState(sSTATE_WALKING);
aPathNodes.splice(_local2, 1);
bInMouvement = true;
} else {
doResetAI();
}
} else if (__get__xCoord() < aPathNodes[_local2].xCoord) {
if (doMove(1, 0, nSpeed, nPlayerNumber)) {
setDirection(LD.sDIRECTION_RIGHT);
setPlayerState(sSTATE_WALKING);
aPathNodes.splice(_local2, 1);
bInMouvement = true;
} else {
doResetAI();
}
}
if (__get__yCoord() > aPathNodes[_local2].yCoord) {
if (doMove(0, -1, nSpeed, nPlayerNumber)) {
setDirection(LD.sDIRECTION_UP);
setPlayerState(sSTATE_WALKING);
aPathNodes.splice(_local2, 1);
bInMouvement = true;
} else {
doResetAI();
}
} else if (__get__yCoord() < aPathNodes[_local2].yCoord) {
if (doMove(0, 1, nSpeed, nPlayerNumber)) {
setDirection(LD.sDIRECTION_DOWN);
setPlayerState(sSTATE_WALKING);
aPathNodes.splice(_local2, 1);
bInMouvement = true;
} else {
doResetAI();
}
}
}
}
}
function doCheckTilesToConquere() {
var _local2 = 0;
while (_local2 < aTilesToConquer.length) {
if (aTilesToConquer[_local2].getOwnership() == nPlayerNumber) {
if (!isCellClosePumpkin(aTilesToConquer[_local2])) {
aTilesToConquer.splice(_local2, 1);
}
}
_local2++;
}
}
function isCellClosePumpkin(_oCell) {
var _local2 = false;
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_oCell.__get__xCoord(), _oCell.__get__yCoord() - 1);
var _local5 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_oCell.__get__xCoord(), _oCell.__get__yCoord() + 1);
var _local6 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_oCell.__get__xCoord() - 1, _oCell.__get__yCoord());
var _local4 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_oCell.__get__xCoord() + 1, _oCell.__get__yCoord());
if (((Library.Utils.Tools.isItemInArray(_local3.getOccupiersArray(), LD.nPUMPKIN) || (Library.Utils.Tools.isItemInArray(_local5.getOccupiersArray(), LD.nPUMPKIN))) || (Library.Utils.Tools.isItemInArray(_local6.getOccupiersArray(), LD.nPUMPKIN))) || (Library.Utils.Tools.isItemInArray(_local4.getOccupiersArray(), LD.nPUMPKIN))) {
_local2 = true;
}
return(_local2);
}
function getNewPath() {
aPathNodes = new Array();
bInMouvement = false;
oPathFinder.doStartPathfinding(__get__xCoord(), __get__yCoord(), aTilesToConquer[0].xCoord, aTilesToConquer[0].yCoord);
}
function setBlockInput(_bBlock) {
bInMouvement = _bBlock;
if (!_bBlock) {
setPlayerState(sSTATE_IDLE);
if ((__get__xCoord() == oTileBomb.xCoord) && (__get__yCoord() == oTileBomb.yCoord)) {
doAddBomb();
doEscapeBomb();
aTilesToConquer.splice(0, 1);
nHouseCaptureTries++;
}
}
}
function doResetReflexTimer() {
nReflexTimer = nREFLEX_TIME + Math.floor(Math.random() * (nREFLEX_TIME / 2));
}
function isCloseToPowerup() {
var _local5 = false;
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getPowerups();
if (_local3.length > 0) {
var _local2 = 0;
while (_local2 < _local3.length) {
var _local4 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
if (_local4 <= nCLOSE_RANGE) {
_local5 = true;
break;
}
_local2++;
}
}
return(_local5);
}
function isCloseToPumpkin() {
var _local5 = false;
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getPumpkins();
if (_local3.length > 0) {
var _local2 = 0;
while (_local2 < _local3.length) {
var _local4 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
if (_local4 <= nCLOSE_RANGE) {
_local5 = true;
break;
}
_local2++;
}
}
return(_local5);
}
function getClosestPowerup() {
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getPowerups();
var _local5;
var _local6;
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local2 == 0) {
_local5 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
_local6 = _local2;
}
var _local4 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
if (_local4 < _local5) {
_local6 = _local2;
_local5 = _local4;
}
_local2++;
}
return(_local3[_local6]);
}
function isCloseToBomb() {
var _local4 = false;
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getBombs();
var _local2 = 0;
while (_local2 < _local3.length) {
if ((((((_local3[_local2].xCoord == (__get__xCoord() + 1)) && (_local3[_local2].yCoord == __get__yCoord())) || ((_local3[_local2].xCoord == (__get__xCoord() - 1)) && (_local3[_local2].yCoord == __get__yCoord()))) || ((_local3[_local2].xCoord == __get__xCoord()) && (_local3[_local2].yCoord == (__get__yCoord() + 1)))) || ((_local3[_local2].xCoord == __get__xCoord()) && (_local3[_local2].yCoord == (__get__yCoord() - 1)))) || ((_local3[_local2].xCoord == __get__xCoord()) && (_local3[_local2].yCoord == __get__yCoord()))) {
_local4 = true;
break;
}
if (((((_local3[_local2].xCoord == (__get__xCoord() + 2)) && (_local3[_local2].yCoord == __get__yCoord())) || ((_local3[_local2].xCoord == (__get__xCoord() - 2)) && (_local3[_local2].yCoord == __get__yCoord()))) || ((_local3[_local2].xCoord == __get__xCoord()) && (_local3[_local2].yCoord == (__get__yCoord() + 2)))) || ((_local3[_local2].xCoord == __get__xCoord()) && (_local3[_local2].yCoord == (__get__yCoord() - 2)))) {
_local4 = true;
break;
}
_local2++;
}
return(_local4);
}
function getClosestBomb() {
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getBombs();
var _local5;
var _local6;
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local2 == 0) {
_local5 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
_local6 = _local2;
}
var _local4 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
if (_local4 < _local5) {
_local6 = _local2;
_local5 = _local4;
}
_local2++;
}
return(_local3[_local6]);
}
function getClosestPumpkin() {
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getPumpkins();
var _local5;
var _local6;
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local2 == 0) {
_local5 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
_local6 = _local2;
}
var _local4 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
if (_local4 < _local5) {
_local6 = _local2;
_local5 = _local4;
}
_local2++;
}
return(_local3[_local6]);
}
function isCloseToHouse() {
var _local5 = false;
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getHouses();
if (_local3.length > 0) {
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local3[_local2].getOwnership() != nPlayerNumber) {
var _local4 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
if (_local4 <= nCLOSE_RANGE) {
_local5 = true;
break;
}
}
_local2++;
}
}
return(_local5);
}
function getClosestHouse() {
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getHouses();
var _local5;
var _local6;
_local5 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[0].xCoord, _local3[0].yCoord);
_local6 = 0;
var _local2 = 0;
while (_local2 < _local3.length) {
if ((_local3[_local2].getOwnership() != nPlayerNumber) && (_local3[_local2] != oTargetHouse)) {
var _local4 = Library.Utils.MoreMath.getManhattanDistance(__get__xCoord(), __get__yCoord(), _local3[_local2].xCoord, _local3[_local2].yCoord);
if (_local4 < _local5) {
_local5 = _local4;
_local6 = _local2;
}
} else {
_local3.splice(_local2, 1);
}
_local2++;
}
return(_local3[_local6]);
}
function doCaptureRandomTarget() {
var _local2 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getAvaibleTiles();
var _local3 = Library.Utils.MoreMath.getRandomRange(0, _local2.length - 1);
var _local5 = _local2[_local3].xCoord;
var _local4 = _local2[_local3].yCoord;
oPathFinder.doStartPathfinding(__get__xCoord(), __get__yCoord(), _local5, _local4);
}
function doCaptureTile() {
doCheckTilesToConquere();
var _local2 = aTilesToConquer[0];
if ((_local2.__get__xCoord() == __get__xCoord()) && (_local2.__get__yCoord() == __get__yCoord())) {
nHouseCaptureTries++;
doAddBomb();
doEscapeBomb();
} else {
oPathFinder.doStartPathfinding(__get__xCoord(), __get__yCoord(), _local2.__get__xCoord(), _local2.__get__yCoord());
oTileBomb.xCoord = aTilesToConquer[0].xCoord;
oTileBomb.yCoord = aTilesToConquer[0].yCoord;
}
}
function getAction() {
aActions = new Array();
if (isCloseToBomb()) {
aActions.push(sESCAPE_BOMB);
} else if (isCloseToPowerup()) {
aActions.push(sGET_POWERUP);
} else if (aTilesToConquer.length > 0) {
aActions.push(sCAPTURE_TILE);
} else if (isCloseToHouse()) {
aActions.push(sCAPTURE_HOUSE);
} else {
aActions.push(sCAPTURE_RANDOM_TARGET);
}
}
function doGetPowerup() {
var _local2 = getClosestPowerup();
oTargetPowerup = _local2;
oPathFinder.doStartPathfinding(__get__xCoord(), __get__yCoord(), _local2.__get__xCoord(), _local2.__get__yCoord());
}
function doCapturePumpkin() {
var _local4 = getClosestPumpkin();
oTargetPumpkin = _local4;
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSurroundingTiles(_local4.__get__xCoord(), _local4.__get__yCoord());
var _local2 = 0;
while (_local2 < _local3.length) {
aTilesToConquer.push(_local3[_local2]);
_local2++;
}
}
function doCaptureHouse() {
if ((oTargetHouse == null) || (nHouseCaptureTries > nMAX_TRIES)) {
var _local4 = getClosestHouse();
oTargetHouse = _local4;
nHouseCaptureTries = 0;
}
var _local3 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSurroundingTiles(oTargetHouse.__get__xCoord(), oTargetHouse.__get__yCoord());
var _local2 = 0;
while (_local2 < _local3.length) {
aTilesToConquer.push(_local3[_local2]);
_local2++;
}
}
function doEscapeBomb() {
var _local2 = getClosestBomb();
oTargetBomb = _local2;
var _local7 = _local2.__get__Level();
var _local6 = new Array();
aBannedTiles.push(Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(oTargetBomb.__get__xCoord(), oTargetBomb.__get__yCoord()));
var _local3 = 0;
while (_local3 < (_local7 + 1)) {
if (_local3 > 0) {
aBannedTiles.push(Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_local2.__get__xCoord() + _local3, _local2.__get__yCoord()));
aBannedTiles.push(Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_local2.__get__xCoord() - _local3, _local2.__get__yCoord()));
aBannedTiles.push(Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_local2.__get__xCoord(), _local2.__get__yCoord() + _local3));
aBannedTiles.push(Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_local2.__get__xCoord(), _local2.__get__yCoord() - _local3));
}
_local3++;
}
var _local11 = (__get__xCoord() + nRANGE_SEARCH) + 1;
var _local10 = (__get__yCoord() + nRANGE_SEARCH) + 1;
var _local13 = __get__xCoord() - nRANGE_SEARCH;
var _local12 = __get__yCoord() - nRANGE_SEARCH;
var _local5 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getAllTilesBetween(_local11, _local10, _local13, _local12);
_local3 = 0;
while (_local3 < _local5.length) {
var _local4 = _local5[_local3];
if (!Library.Utils.Tools.isItemInArray(aBannedTiles, _local4)) {
_local6.push(_local4);
}
_local3++;
}
var _local9 = _local6.length;
if (_local9 > 0) {
var _local8 = Math.floor(Math.random() * _local9);
oPathFinder.doStartPathfinding(__get__xCoord(), __get__yCoord(), _local6[_local8].xCoord, _local6[_local8].yCoord);
}
}
function doCheckSucess() {
if (oTargetHouse.getOwnership() == nPlayerNumber) {
oTargetHouse = null;
doResetAI();
}
if (oTargetPumpkin.__get__CurrentState() == "Blasted") {
oTargetPumpkin = null;
doResetAI();
}
if (oTargetBomb.__get__CurrentState() == "Blasted") {
oTargetBomb = null;
doResetAI();
}
if (oTargetPowerup.__get__CurrentState() == "Disappear") {
oTargetPowerup = null;
doResetAI();
}
}
function doResetAI() {
oPathFinder.doRemoveBannedCells();
aPathNodes = new Array();
aBannedTiles = new Array();
aTilesToConquer = new Array();
doResetReflexTimer();
getAction();
}
function isCellPathFindable(_oCell) {
var _local2 = true;
if (!oPathFinder.isCellPathfindable(__get__xCoord(), __get__yCoord(), _oCell.__get__xCoord(), _oCell.__get__yCoord())) {
_local2 = false;
}
return(_local2);
}
var nREFLEX_TIME = 15;
var nCLOSE_RANGE = 6;
var nRANGE_SEARCH = 2;
var nMAX_TRIES = 5;
var sESCAPE_BOMB = "doEscapeBomb";
var sGET_POWERUP = "doGetPowerup";
var sCAPTURE_PUMPKIN = "doCapturePumpkin";
var sCAPTURE_TILE = "doCaptureTile";
var sCAPTURE_HOUSE = "doCaptureHouse";
var sCAPTURE_RANDOM_TARGET = "doCaptureRandomTarget";
}
Symbol 31 MovieClip [__Packages.Pathfinding.PathFinding] Frame 0
class Pathfinding.PathFinding
{
var oOwner, aOpenList, aClosedList, aBannedCells, bCoordsReached, nXtarget, nYtarget, nTries, oLastNode;
function PathFinding (_oCreator) {
oOwner = _oCreator;
aOpenList = new Array();
aClosedList = new Array();
aBannedCells = new Array();
bCoordsReached = false;
nXtarget = 0;
nYtarget = 0;
nTries = 0;
init();
}
function init() {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doAddListener(this);
}
function doEnterFrame() {
doCheckOpenList();
}
function doStartPathfinding(_nXOri, _nYOri, _nXFinal, _nYFinal) {
var _local4 = true;
if (isValidCell(_nXFinal, _nYFinal)) {
nXtarget = _nXFinal;
nYtarget = _nYFinal;
bCoordsReached = false;
var _local2 = new Pathfinding.PathNode(_nXOri, _nYOri, null);
aOpenList.push(_local2);
}
}
function doAddBannedCells(_aCells) {
var _local2 = 0;
while (_local2 < _aCells.length) {
aBannedCells.push(_aCells[_local2]);
_local2++;
}
}
function doRemoveBannedCells(_aCells) {
aBannedCells = new Array();
}
function isCellPathfindable(_nX1, _nY1, _nX2, _nY2) {
var _local1 = true;
return(_local1);
}
function doDestroy() {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doRemoveListener(this);
delete aOpenList;
delete aClosedList;
}
function doCheckOpenList() {
if (!bCoordsReached) {
if (aOpenList.length == 1) {
doCloseCell(aOpenList[0]);
aOpenList.splice(0, 1);
} else if ((aOpenList.length > 1) && (nTries < nMAX_TRIES)) {
var _local2 = 0;
while (_local2 < aOpenList.length) {
var _local5 = Library.Utils.MoreMath.getManhattanDistance(aOpenList[_local2].xCoord, aOpenList[_local2].yCoord, nXtarget, nYtarget);
aOpenList[_local2].setManhattan(_local5);
_local2++;
}
var _local4 = aOpenList[0].Manhattan;
_local2 = 0;
while (_local2 < aOpenList.length) {
if (aOpenList[_local2].Manhattan < _local4) {
_local4 = aOpenList[_local2].Manhattan;
}
_local2++;
}
_local2 = 0;
while (_local2 < aOpenList.length) {
if (aOpenList[_local2].Manhattan == _local4) {
doCloseCell(aOpenList[_local2]);
aOpenList.splice(_local2, 1);
}
_local2++;
}
nTries++;
} else if ((aOpenList.length == 0) || (nTries >= nMAX_TRIES)) {
var _local6 = new Array();
_local6.push(oLastNode);
var _local3 = oLastNode;
while (_local3.__get__Parent() != null) {
_local3 = _local3.Parent;
_local6.push(_local3);
}
oOwner.setPathFind(_local6, false);
bCoordsReached = true;
doDestroyNodes();
}
}
}
function doCloseCell(_oClosingNode) {
oLastNode = _oClosingNode;
aClosedList.push(_oClosingNode);
if ((_oClosingNode.__get__xCoord() == nXtarget) && (_oClosingNode.__get__yCoord() == nYtarget)) {
var _local4 = new Array();
_local4.push(_oClosingNode);
var _local3 = _oClosingNode;
while (_local3.__get__Parent() != null) {
_local3 = _local3.Parent;
_local4.push(_local3);
}
oOwner.setPathFind(_local4, true);
bCoordsReached = true;
doDestroyNodes();
} else {
var _local5;
if (isValidCell(_oClosingNode.__get__xCoord(), _oClosingNode.__get__yCoord() - 1)) {
_local5 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_oClosingNode.__get__xCoord(), _oClosingNode.__get__yCoord() - 1);
if (!Library.Utils.Tools.isItemInArray(aBannedCells, _local5)) {
var _local9 = new Pathfinding.PathNode(_oClosingNode.__get__xCoord(), _oClosingNode.__get__yCoord() - 1, _oClosingNode);
aOpenList.push(_local9);
}
}
if (isValidCell(_oClosingNode.__get__xCoord(), _oClosingNode.__get__yCoord() + 1)) {
_local5 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_oClosingNode.__get__xCoord(), _oClosingNode.__get__yCoord() + 1);
if (!Library.Utils.Tools.isItemInArray(aBannedCells, _local5)) {
var _local8 = new Pathfinding.PathNode(_oClosingNode.__get__xCoord(), _oClosingNode.__get__yCoord() + 1, _oClosingNode);
aOpenList.push(_local8);
}
}
if (isValidCell(_oClosingNode.__get__xCoord() - 1, _oClosingNode.__get__yCoord())) {
_local5 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_oClosingNode.__get__xCoord() - 1, _oClosingNode.__get__yCoord());
if (!Library.Utils.Tools.isItemInArray(aBannedCells, _local5)) {
var _local7 = new Pathfinding.PathNode(_oClosingNode.__get__xCoord() - 1, _oClosingNode.__get__yCoord(), _oClosingNode);
aOpenList.push(_local7);
}
}
if (isValidCell(_oClosingNode.__get__xCoord() + 1, _oClosingNode.__get__yCoord())) {
_local5 = Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().getSingleCell(_oClosingNode.__get__xCoord() + 1, _oClosingNode.__get__yCoord());
if (!Library.Utils.Tools.isItemInArray(aBannedCells, _local5)) {
var _local6 = new Pathfinding.PathNode(_oClosingNode.__get__xCoord() + 1, _oClosingNode.__get__yCoord(), _oClosingNode);
aOpenList.push(_local6);
}
}
}
}
function isValidCell(_nXCoord, _nYCoord) {
var _local3 = true;
if (!Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().isCellValid(_nXCoord, _nYCoord)) {
_local3 = false;
}
var _local2 = 0;
while (_local2 < aClosedList.length) {
if ((aClosedList[_local2].xCoord == _nXCoord) && (aClosedList[_local2].yCoord == _nYCoord)) {
_local3 = false;
}
_local2++;
}
return(_local3);
}
function doDestroyNodes() {
var _local2 = 0;
while (_local2 < aOpenList.length) {
aOpenList[_local2].doDestroy();
delete aOpenList[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < aClosedList.length) {
aClosedList[_local2].doDestroy();
delete aClosedList[_local2];
_local2++;
}
aOpenList = new Array();
aClosedList = new Array();
nTries = 0;
}
var nMAX_TRIES = 10;
}
Symbol 30 MovieClip [__Packages.Pathfinding.PathNode] Frame 0
class Pathfinding.PathNode
{
var oParentNode, nXCoord, nYCoord, nManhattan;
function PathNode (_xCoord, _yCoord, _oParent) {
oParentNode = _oParent;
nXCoord = _xCoord;
nYCoord = _yCoord;
nManhattan = 0;
}
function setManhattan(_nManhattan) {
nManhattan = _nManhattan;
}
function doDestroy() {
delete oParentNode;
}
function get Parent() {
return(oParentNode);
}
function get xCoord() {
return(nXCoord);
}
function get yCoord() {
return(nYCoord);
}
function get Manhattan() {
return(nManhattan);
}
}
Symbol 9 MovieClip [__Packages.Library.Utils.MoreMath] Frame 0
class Library.Utils.MoreMath
{
function MoreMath () {
}
static function getRandomRange(__nMin, __nMax) {
return(Math.floor(Math.random() * ((__nMax + 1) - __nMin)) + __nMin);
}
static function getPolarity(__nNum) {
var _local1 = 0;
if (__nNum < 0) {
_local1 = -1;
} else if (__nNum > 0) {
_local1 = 1;
}
return(_local1);
}
static function getReachZero(__nNum, __nReducer) {
return(getReachNum(__nNum, 0, __nReducer));
}
static function getReachNum(__nNum, __nTargetNum, __nReducer) {
var _local1 = __nNum;
if (_local1 != __nTargetNum) {
if (_local1 < __nTargetNum) {
_local1 = _local1 + __nReducer;
if (_local1 > __nTargetNum) {
_local1 = __nTargetNum;
}
} else {
_local1 = _local1 - __nReducer;
if (_local1 < __nTargetNum) {
_local1 = __nTargetNum;
}
}
}
return(_local1);
}
static function getDistance(__nX1, __nY1, __nX2, __nY2) {
return(Math.sqrt(Math.pow(Math.abs(__nX2 - __nX1), 2) + Math.pow(Math.abs(__nY2 - __nY1), 2)));
}
static function getManhattanDistance(_x1, _y1, _x2, _y2) {
return(Math.abs(_x1 - _x2) + Math.abs(_y1 - _y2));
}
static function getHypotenuse(__nDX, __nDY) {
return(Math.sqrt(Math.pow(__nDX, 2) + Math.pow(__nDY, 2)));
}
static function getAngle(__nX1, __nY1, __nX2, __nY2) {
var _local2;
var _local1;
var _local4;
var _local3;
_local2 = __nX2 - __nX1;
_local1 = __nY2 - __nY1;
_local4 = Math.atan2(_local1, _local2);
_local3 = getDegreeFromRadius(_local4);
return(_local3);
}
static function getDegreeFromRadius(__nRadius) {
var _local1 = (__nRadius / MATH_PI) * 180;
return(_local1);
}
static function getRadianFromDegree(__nDegree) {
var _local1 = __nDegree * (MATH_PI / 180);
return(_local1);
}
static function getBoundsCenter(_oBox) {
var _local3 = (_oBox.xMin + _oBox.xMax) / 2;
var _local2 = (_oBox.yMin + _oBox.yMax) / 2;
return({x:_local3, y:_local2});
}
static var MATH_PI = Math.PI;
}
Symbol 32 MovieClip [__Packages.House] Frame 0
class House extends CellObject
{
var nOwner, mcRef;
function House (_mcRef, _nXCoord, _nYCoord) {
super(_mcRef, _nXCoord, _nYCoord, LD.nHOUSE);
nOwner = LD.nMAX_PLAYER + 1;
mcRef.gotoAndStop(nOwner);
}
function doEnterFrame() {
super.doEnterFrame();
}
function doChangeOwnership(_nPlayer) {
if (nOwner != _nPlayer) {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doLoseHouse(getOwnership(), LD.nHOUSE);
nOwner = _nPlayer;
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doGainHouse(getOwnership(), LD.nHOUSE);
mcRef.gotoAndStop(nOwner);
mcRef.mcStars.play();
var _local2 = Library.Sound.SoundManager.isSoundPlaying("HouseTaken.mp3");
if (_local2.bPlaying) {
_local2.oSound.doStop();
}
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "HouseTaken.mp3", 70);
}
}
function getOwnership() {
return(nOwner);
}
function doBombed() {
}
function doDestroy() {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doRemoveHouse(this);
super.doDestroy();
}
}
Symbol 33 MovieClip [__Packages.Pumpkin] Frame 0
class Pumpkin extends CellObject
{
var setState, nContainedPowerUp, mcRef, isStateComplete, __get__xCoord, __get__yCoord;
function Pumpkin (_mcRef, _nXCoord, _nYCoord) {
super(_mcRef, _nXCoord, _nYCoord, LD.nPUMPKIN);
setState(sSTATE_IDLE);
nContainedPowerUp = null;
mcRef.mcEasterEgg._visible = false;
}
function doEnterFrame() {
super.doEnterFrame();
if (Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().Easter) {
mcRef.mcEasterEgg._visible = true;
} else {
mcRef.mcEasterEgg._visible = false;
}
}
function doBombed() {
setState(sSTATE_BLASTED);
}
function setContainedPowerup(_nPowerUp) {
nContainedPowerUp = _nPowerUp;
}
function doDestroy() {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doRemovePumpkin(this);
super.doDestroy();
}
function doIdle() {
}
function doBlasted() {
if (isStateComplete()) {
mcRef.removeMovieClip();
if (nContainedPowerUp != null) {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().addPowerUp(nContainedPowerUp, __get__xCoord(), __get__yCoord());
}
doDestroy();
}
}
var sSTATE_IDLE = "Idle";
var sSTATE_BLASTED = "Blasted";
}
Symbol 34 MovieClip [__Packages.Bomb] Frame 0
class Bomb extends MovingObject
{
var nOwner, nLevel, nSpeed, nTimer, setState, doMove, isStateComplete, mcRef, __get__CurrentState, nXcoord, nYcoord;
function Bomb (_mcRef, _nOwner, _nLevel, _nXcoord, _nYcoord) {
super(_mcRef, _nXcoord, _nYcoord);
nOwner = _nOwner;
nLevel = _nLevel;
nSpeed = nMOVING_SPEED;
nTimer = LD.nTIMER_BOMB;
setState(sSTATE_IDLE);
}
function doEnterFrame() {
super.doEnterFrame();
doCheckTimer();
}
function doBombed() {
doExplode();
}
function doKicked(_sDirection) {
switch (_sDirection) {
case LD.sDIRECTION_UP :
doMove(0, 1, nSpeed, LD.nBOMB);
break;
case LD.sDIRECTION_DOWN :
doMove(0, -1, nSpeed, LD.nBOMB);
break;
case LD.sDIRECTION_LEFT :
doMove(1, 0, nSpeed, LD.nBOMB);
break;
case LD.sDIRECTION_RIGHT :
doMove(-1, 0, nSpeed, LD.nBOMB);
}
}
function doDestroy() {
super.doDestroy();
}
function get Level() {
return(nLevel);
}
function doIdle() {
if (isStateComplete()) {
mcRef.mcState.stop();
}
}
function doBlasted() {
if (isStateComplete()) {
mcRef.removeMovieClip();
doDestroy();
}
}
function doCheckTimer() {
if (__get__CurrentState() != sSTATE_BLASTED) {
if (nTimer > 0) {
nTimer--;
} else if (nTimer == 0) {
doExplode();
}
}
}
function doExplode() {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doRemoveBomb(this);
var _local2 = Library.Sound.SoundManager.isSoundPlaying("BombExplose.mp3");
if (_local2.bPlaying) {
_local2.oSound.doStop();
}
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "BombExplose.mp3");
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doExplosion(nOwner, nLevel, nXcoord, nYcoord);
setState(sSTATE_BLASTED);
nTimer = -1;
}
function setBlockInput() {
}
var sSTATE_IDLE = "Idle";
var sSTATE_BLASTED = "Blasted";
var nMOVING_SPEED = 5;
}
Symbol 35 MovieClip [__Packages.PowerUp] Frame 0
class PowerUp extends CellObject
{
var setState, isStateComplete, mcRef, sState;
function PowerUp (_mcRef, _nXCoord, _nYCoord, _nPowerUpType) {
super(_mcRef, _nXCoord, _nYCoord, _nPowerUpType);
setState(sSTATE_APPEAR);
}
function doEnterFrame() {
super.doEnterFrame();
}
function doBombed() {
setState(sSTATE_DISAPPEAR);
}
function doTaken() {
setState(sSTATE_DISAPPEAR);
}
function doDestroy() {
super.doDestroy();
}
function doAppear() {
if (isStateComplete()) {
setState(sSTATE_IDLE);
}
}
function doIdle() {
}
function doDisappear() {
if (isStateComplete()) {
mcRef.removeMovieClip();
doDestroy();
}
}
function doLoadStateAction() {
if (!(sState === sSTATE_DISAPPEAR)) {
} else {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doRemovePowerup(this);
}
}
var sSTATE_APPEAR = "Appear";
var sSTATE_IDLE = "Idle";
var sSTATE_DISAPPEAR = "Disappear";
}
Symbol 37 MovieClip [__Packages.BaseLevel] Frame 0
class BaseLevel
{
var nLevelNumber, sLevelLinkage, nPumpkins, nPowerUp_Ratio_Speed, nPowerUp_Ratio_Stock, nPowerUp_Ratio_Range, nPowerUp_Ratio_Kick, nPowerUp_Ratio_Kamikaze, nLevelDuration, nPowerUp_Speed, nPowerUp_Stock, nPowerUp_Range, nPowerUp_Kick, nPowerUp_Kamikaze, nPowerUp_Total;
function BaseLevel () {
nLevelNumber = 0;
sLevelLinkage = "";
nPumpkins = 0;
nPowerUp_Ratio_Speed = 0;
nPowerUp_Ratio_Stock = 0;
nPowerUp_Ratio_Range = 0;
nPowerUp_Ratio_Kick = 0;
nPowerUp_Ratio_Kamikaze = 0;
nLevelDuration = 0;
}
function init() {
doCheckSums();
}
function getPowerUp(_nPowerUp) {
var _local2 = 0;
switch (_nPowerUp) {
case LD.nPU_SPEED :
_local2 = nPowerUp_Speed;
break;
case LD.nPU_STOCK :
_local2 = nPowerUp_Stock;
break;
case LD.nPU_RANGE :
_local2 = nPowerUp_Range;
break;
case LD.nPU_KICK :
_local2 = nPowerUp_Kick;
break;
case LD.nPU_KAMIKAZE :
_local2 = nPowerUp_Kamikaze;
}
return(_local2);
}
function get LevelNumber() {
return(nLevelNumber);
}
function get LevelLinkage() {
return(sLevelLinkage);
}
function get PumpkinsNeeded() {
return(nPumpkins);
}
function get TotalPowerups() {
return(nPowerUp_Total);
}
function get Duration() {
return(nLevelDuration);
}
function doCheckSums() {
var _local2 = 0;
var _local3 = (((nPowerUp_Ratio_Speed + nPowerUp_Ratio_Stock) + nPowerUp_Ratio_Range) + nPowerUp_Ratio_Kick) + nPowerUp_Ratio_Kamikaze;
if (_local3 != 100) {
if (_local3 < 100) {
_local2 = 100 - _local3;
nPowerUp_Ratio_Speed = nPowerUp_Ratio_Speed + _local2;
} else {
_local2 = _local3 - 100;
nPowerUp_Ratio_Speed = nPowerUp_Ratio_Speed - _local2;
}
}
nPowerUp_Speed = Math.ceil((nPowerUp_Ratio_Speed * nPowerUp_Total) / 100);
nPowerUp_Stock = Math.ceil((nPowerUp_Ratio_Stock * nPowerUp_Total) / 100);
nPowerUp_Range = Math.ceil((nPowerUp_Ratio_Range * nPowerUp_Total) / 100);
nPowerUp_Kick = Math.ceil((nPowerUp_Ratio_Kick * nPowerUp_Total) / 100);
nPowerUp_Kamikaze = Math.ceil((nPowerUp_Ratio_Kamikaze * nPowerUp_Total) / 100);
nPowerUp_Total = (((nPowerUp_Speed + nPowerUp_Stock) + nPowerUp_Range) + nPowerUp_Kick) + nPowerUp_Kamikaze;
}
}
Symbol 38 MovieClip [__Packages.DepthManager] Frame 0
class DepthManager
{
var nAttached, nSwapper;
function DepthManager () {
nAttached = nSTARTING_DEPTH;
nSwapper = nDEFAULT_SWAPPER;
}
function doDestroy() {
aDEPTH_PRIORITIES = new Array();
delete aDEPTH_PRIORITIES;
}
function getNewStaticDepth(_nYcoord, _nObjectID) {
nAttached++;
var _local4 = getIndexOf(_nObjectID) * nDECAL_PRIORITIES;
var _local2 = _nYcoord * nDECAL_ROWS_DEPTHS;
var _local3 = (_local4 + _local2) + nAttached;
return(_local3);
}
function getNewSwapperDepth() {
nSwapper++;
if (nSwapper >= nSTARTING_DEPTH) {
nSwapper = nDEFAULT_SWAPPER;
}
return(nSwapper);
}
function setNewDepth(_mcRef, _nYCoord, _nObjectID) {
var _local2 = getNewStaticDepth(_nYCoord, _nObjectID);
_mcRef.swapDepths(_local2);
}
function getIndexOf(_nObjectID) {
var _local3 = -1;
var _local2 = 0;
while (_local2 < aDEPTH_PRIORITIES.length) {
if (aDEPTH_PRIORITIES[_local2] == _nObjectID) {
_local3 = _local2;
break;
}
_local2++;
}
return(_local3);
}
var nDEFAULT_SWAPPER = 90000;
var nSTARTING_DEPTH = 500;
var nDECAL_ROWS_DEPTHS = 5000;
var nDECAL_PRIORITIES = 300;
var aDEPTH_PRIORITIES = [LD.nBOMB, LD.nPUMPKIN, LD.nPU_STOCK, LD.nPU_RANGE, LD.nPU_SPEED, LD.nPU_KICK, LD.nPU_KAMIKAZE, LD.nPLAYER4, LD.nPLAYER2, LD.nPLAYER1, LD.nPLAYER3];
}
Symbol 39 MovieClip [__Packages.ChumBucket] Frame 0
class ChumBucket extends CellObject
{
var nOwner, mcRef;
function ChumBucket (_mcRef, _nXCoord, _nYCoord) {
super(_mcRef, _nXCoord, _nYCoord, LD.nHOUSE);
nOwner = LD.nMAX_PLAYER + 1;
mcRef.gotoAndStop(nOwner);
}
function doEnterFrame() {
super.doEnterFrame();
}
function doChangeOwnership(_nPlayer) {
if (nOwner != _nPlayer) {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doLoseHouse(getOwnership(), LD.nCHUM_BUCKET);
nOwner = _nPlayer;
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doGainHouse(getOwnership(), LD.nCHUM_BUCKET);
mcRef.gotoAndStop(nOwner);
mcRef.mcStars.play();
var _local2 = Library.Sound.SoundManager.isSoundPlaying("HouseTaken.mp3");
if (_local2.bPlaying) {
_local2.oSound.doStop();
}
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "HouseTaken.mp3", 70);
}
}
function getOwnership() {
return(nOwner);
}
function doBombed() {
}
function doDestroy() {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doRemoveHouse(this);
super.doDestroy();
}
}
Symbol 40 MovieClip [__Packages.KrustyKrab] Frame 0
class KrustyKrab extends CellObject
{
var nOwner, mcRef;
function KrustyKrab (_mcRef, _nXCoord, _nYCoord) {
super(_mcRef, _nXCoord, _nYCoord, LD.nHOUSE);
nOwner = LD.nMAX_PLAYER + 1;
mcRef.gotoAndStop(nOwner);
}
function doEnterFrame() {
super.doEnterFrame();
}
function doChangeOwnership(_nPlayer) {
if (nOwner != _nPlayer) {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doLoseHouse(getOwnership(), LD.nKRUSTY_KRAB);
nOwner = _nPlayer;
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doGainHouse(getOwnership(), LD.nKRUSTY_KRAB);
mcRef.gotoAndStop(nOwner);
mcRef.mcStars.play();
var _local2 = Library.Sound.SoundManager.isSoundPlaying("HouseTaken.mp3");
if (_local2.bPlaying) {
_local2.oSound.doStop();
}
Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND, "HouseTaken.mp3", 70);
}
}
function getOwnership() {
return(nOwner);
}
function doBombed() {
}
function doDestroy() {
Main.__get__Instance().__get__GameCtrl().__get__LevelManagement().doRemoveHouse(this);
super.doDestroy();
}
}
Symbol 45 MovieClip [__Packages.GameStatus] Frame 0
class GameStatus
{
var aLevels;
function GameStatus () {
doGenerateNewLevels();
}
function getNextLevel() {
var _local2 = BaseLevel(aLevels.shift());
return(_local2);
}
function doDestroy() {
aLevels = new Array();
delete aLevels;
}
function get GameOver() {
return(aLevels.length <= 0);
}
function doGenerateNewLevels() {
aLevels = new Array();
aLevels.push(new Levels.Level_01(), new Levels.Level_02(), new Levels.Level_03());
}
}
Symbol 42 MovieClip [__Packages.Levels.Level_01] Frame 0
class Levels.Level_01 extends BaseLevel
{
var nLevelNumber, sLevelLinkage, nPumpkins, nPowerUp_Total, nPowerUp_Ratio_Speed, nPowerUp_Ratio_Stock, nPowerUp_Ratio_Range, nPowerUp_Ratio_Kick, nPowerUp_Ratio_Kamikaze, nLevelDuration;
function Level_01 () {
super();
nLevelNumber = 1;
sLevelLinkage = "mcLevel_01";
nPumpkins = 30;
nPowerUp_Total = 20;
nPowerUp_Ratio_Speed = 33;
nPowerUp_Ratio_Stock = 32;
nPowerUp_Ratio_Range = 33;
nPowerUp_Ratio_Kick = 1;
nPowerUp_Ratio_Kamikaze = 1;
nLevelDuration = 120000 /* 0x01D4C0 */;
super.init();
}
}
Symbol 43 MovieClip [__Packages.Levels.Level_02] Frame 0
class Levels.Level_02 extends BaseLevel
{
var nLevelNumber, sLevelLinkage, nPumpkins, nPowerUp_Total, nPowerUp_Ratio_Speed, nPowerUp_Ratio_Stock, nPowerUp_Ratio_Range, nPowerUp_Ratio_Kick, nPowerUp_Ratio_Kamikaze, nLevelDuration;
function Level_02 () {
super();
nLevelNumber = 2;
sLevelLinkage = "mcLevel_02";
nPumpkins = 35;
nPowerUp_Total = 10;
nPowerUp_Ratio_Speed = 33;
nPowerUp_Ratio_Stock = 32;
nPowerUp_Ratio_Range = 33;
nPowerUp_Ratio_Kick = 1;
nPowerUp_Ratio_Kamikaze = 1;
nLevelDuration = 120000 /* 0x01D4C0 */;
super.init();
}
}
Symbol 44 MovieClip [__Packages.Levels.Level_03] Frame 0
class Levels.Level_03 extends BaseLevel
{
var nLevelNumber, sLevelLinkage, nPumpkins, nPowerUp_Total, nPowerUp_Ratio_Speed, nPowerUp_Ratio_Stock, nPowerUp_Ratio_Range, nPowerUp_Ratio_Kick, nPowerUp_Ratio_Kamikaze, nLevelDuration;
function Level_03 () {
super();
nLevelNumber = 3;
sLevelLinkage = "mcLevel_03";
nPumpkins = 40;
nPowerUp_Total = 5;
nPowerUp_Ratio_Speed = 33;
nPowerUp_Ratio_Stock = 32;
nPowerUp_Ratio_Range = 33;
nPowerUp_Ratio_Kick = 1;
nPowerUp_Ratio_Kamikaze = 1;
nLevelDuration = 120000 /* 0x01D4C0 */;
super.init();
}
}
Symbol 20 MovieClip [__Packages.BasicScoreHUD] Frame 0
class BasicScoreHUD extends Library.State
{
var nCurrentScore, nNewScore, nDifference, nTilesOwned, nHouseOwned, nCommercialOwned, setState, isStateComplete, sState, mcRef;
function BasicScoreHUD (_mcRef) {
super(_mcRef);
nCurrentScore = 0;
nNewScore = 0;
nDifference = 0;
nTilesOwned = 0;
nHouseOwned = 0;
nCommercialOwned = 0;
setState(sSTATE_IDLE);
Main.__get__Instance().__get__GameCtrl().doAddListener(this);
}
function doEnterFrame() {
super.doEnterFrame();
if (nNewScore != nCurrentScore) {
doChangeScore(nNewScore);
nNewScore = nCurrentScore;
}
}
function setNewScore(_nChangingScore) {
nNewScore = _nChangingScore;
}
function setOwnedTiles(_nTiles) {
nTilesOwned = _nTiles;
}
function setOwnedCommercials(_nCommercials) {
nCommercialOwned = _nCommercials;
}
function setOwnedHouses(_nHouses) {
nHouseOwned = _nHouses;
}
function doDestroy() {
Main.__get__Instance().__get__GameCtrl().doRemoveListener(this);
}
function get Score() {
return(nCurrentScore);
}
function get OwnedHouse() {
return(nHouseOwned);
}
function get OwnedTiles() {
return(nTilesOwned);
}
function get OwnedCommercials() {
return(nCommercialOwned);
}
function doIdle() {
}
function doIn() {
if (isStateComplete()) {
setState(sSTATE_IDLE);
}
}
function doLoadStateAction() {
switch (sState) {
case sSTATE_IDLE :
mcRef.mcState.txtScore.text = nCurrentScore;
break;
case sSTATE_IN :
mcRef.mcState.mcScore.txtScore.text = nCurrentScore;
if (nDifference > 0) {
mcRef.mcState.mcScoreChange.txtDifference.text = "+" + nDifference;
} else {
mcRef.mcState.mcScoreChange.txtDifference.text = nDifference;
}
}
}
function doChangeScore(_nScore) {
nDifference = (nCurrentScore - nNewScore) * -1;
nCurrentScore = nNewScore;
setState(sSTATE_IN);
}
var sSTATE_IDLE = "Idle";
var sSTATE_IN = "In";
}
Symbol 1 MovieClip [__Packages.LibCompileHookComponent] Frame 0
class LibCompileHookComponent extends MovieClip
{
function LibCompileHookComponent () {
super();
}
function LibCompileHook() {
}
}
Symbol 6 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 7 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");
};
}
}
}
Symbol 10 MovieClip [__Packages.Library.Utils.Debug] Frame 0
class Library.Utils.Debug
{
static var lc;
function Debug () {
}
static function clear() {
lc = new LocalConnection();
lc.send("trace", "clear");
}
static function setLevel(pLvl) {
level = pLvl;
}
static function trace(pMsg, pLvl) {
var _local1;
if (pLvl != undefined) {
_local1 = pLvl;
} else {
_local1 = level;
}
lc = new LocalConnection();
lc.send("trace", "trace", pMsg, _local1);
}
static function traceObject(o, pRecurseDepth, pLvl, pIndent) {
var _local7;
var _local5;
var _local6;
if (pLvl != undefined) {
_local6 = pLvl;
} else {
_local6 = level;
}
if (pRecurseDepth == undefined) {
_local7 = 0;
} else {
_local7 = pRecurseDepth;
}
if (pIndent == undefined) {
_local5 = 0;
} else {
_local5 = pIndent;
}
for (var _local8 in o) {
var _local3 = "";
var _local1 = 0;
while (_local1 < _local5) {
_local3 = _local3 + " ";
_local1++;
}
var _local2 = o[_local8].toString();
if (o[_local8] instanceof Array) {
_local2 = "[Array]";
}
if (_local2 == "[object Object]") {
_local2 = "[Object]";
}
trace(((_local3 + _local8) + ": ") + _local2, _local6);
if (_local7 > 0) {
traceObject(o[_local8], _local7 - 1, _local6, _local5 + 1);
}
}
}
static var level = 0;
static var DEBUG = 0;
static var INFO = 1;
static var WARN = 2;
static var ERROR = 3;
static var FATAL = 4;
}
Symbol 11 MovieClip [__Packages.Library.Utils.KeysManager] Frame 0
class Library.Utils.KeysManager
{
var aKeys, oEnterFrameListener;
function KeysManager () {
aKeys = new Array();
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = Library.Utils.Delegate.create(this, doEnterFrame);
MovieClip.addListener(oEnterFrameListener);
}
function setListenerForKey(__oListener, __nKeyCode) {
var _local2 = false;
for (var _local6 in aKeys) {
if (aKeys[_local6].nCode == __nKeyCode) {
aKeys[_local6].aListeners.push(__oListener);
_local2 = true;
}
}
if (!_local2) {
var _local3 = new Object();
_local3.bPressed = false;
_local3.nCode = __nKeyCode;
_local3.aListeners = new Array();
_local3.aListeners.push(__oListener);
aKeys.push(_local3);
}
}
function doEnterFrame() {
for (var _local5 in aKeys) {
var _local3 = Key.isDown(aKeys[_local5].nCode);
if (aKeys[_local5].bPressed != _local3) {
aKeys[_local5].bPressed = _local3;
for (var _local4 in aKeys[_local5].aListeners) {
var _local2;
if (_local3) {
_local2 = EVENT_KEY_DOWN;
} else {
_local2 = EVENT_KEY_UP;
}
aKeys[_local5].aListeners[_local4].onKeyManagerEvent(_local2, aKeys[_local5].nCode);
}
}
}
}
function isKeyDown(__nKeyCode) {
return(Key.isDown(__nKeyCode));
}
function doDestroy() {
for (var _local3 in aKeys) {
for (var _local2 in aKeys[_local3].aListeners) {
delete aKeys[_local3].aListeners[_local2];
}
aKeys[_local3].aListeners = new Array();
delete aKeys[_local3].aListeners;
}
aKeys = new Array();
delete aKeys;
MovieClip.removeListener(this);
}
static var EVENT_KEY_DOWN = 1;
static var EVENT_KEY_UP = 2;
}
Symbol 13 MovieClip [__Packages.Library.Utils.XmlTool] Frame 0
class Library.Utils.XmlTool
{
var xmlData, sXmlFileName, bNoLoad, oListener;
function XmlTool (_sXmlName) {
if (_sXmlName.length != undefined) {
xmlData = new XML();
sXmlFileName = _sXmlName;
xmlData.ignoreWhite = true;
xmlData.onLoad = Library.Utils.Delegate.create(this, doInformListener);
xmlData.load(sXmlFileName);
bNoLoad = false;
} else {
bNoLoad = true;
}
}
function doSetListener(__oListener) {
oListener = __oListener;
}
function doInformListener(__bSuccess) {
oListener.onXMLLoadComplete(this, __bSuccess);
}
function isLoaded() {
var _local2 = false;
if (bNoLoad || ((xmlData.getBytesLoaded() >= xmlData.getBytesTotal()) && (xmlData.getBytesTotal() > 2))) {
_local2 = true;
}
return(_local2);
}
function getSubXml(_sNodeName, _xmlRef) {
var _local2 = new XMLNode();
if (isLoaded()) {
var _local5 = xmlData;
if (_xmlRef != undefined) {
_local5 = _xmlRef;
}
var _local3 = 0;
_local2 = _local5.firstChild;
while ((((_local2.nodeName != _sNodeName) && (_local2.hasChildNodes())) && (_local2 != undefined)) && (_local3 < 256)) {
_local2 = _local2.firstChild;
_local3++;
}
}
return(_local2);
}
function getLevelNode(_sNodeName, _xmlRef) {
var _local4 = new XMLNode();
if (isLoaded()) {
var _local3 = xmlData.firstChild;
if (_xmlRef != undefined) {
_local3 = _xmlRef;
}
var _local2 = 0;
while (_local2 < _local3.childNodes.length) {
if (_local3.childNodes[_local2].nodeName == _sNodeName) {
_local4 = _local3.childNodes[_local2];
_local2 = _local3.childNodes.length;
}
_local2++;
}
}
return(_local4);
}
function getLevelNodeData(_sNodeName, _xmlRef) {
var _local4 = new String();
if (isLoaded()) {
var _local2 = 0;
while (_local2 < _xmlRef.childNodes.length) {
if (_xmlRef.childNodes[_local2].nodeName == _sNodeName) {
_local4 = _xmlRef.childNodes[_local2].childNodes[0].nodeValue;
_local2 = _xmlRef.childNodes.length;
}
_local2++;
}
}
return(_local4);
}
function getLevelNodeAttribute(_sNodeName, _sAttributeName, _xmlRef) {
var _local4 = new String();
if (isLoaded()) {
var _local2 = 0;
while (_local2 < _xmlRef.childNodes.length) {
if (_xmlRef.childNodes[_local2].nodeName == _sNodeName) {
_local4 = _xmlRef.childNodes[_local2].attributes[_sAttributeName];
_local2 = _xmlRef.childNodes.length;
}
_local2++;
}
}
return(_local4);
}
function doDestroy() {
delete oListener;
delete xmlData;
}
function valueOf() {
return(xmlData.toString());
}
}
Symbol 856 MovieClip Frame 1
stop();
Symbol 924 MovieClip Frame 1
stop();
Symbol 998 MovieClip Frame 1
stop();
Symbol 1017 MovieClip Frame 1
stop();
Symbol 1075 MovieClip Frame 1
stop();
Symbol 1080 MovieClip Frame 1
stop();
Symbol 1156 MovieClip Frame 1
stop();