text: /*! For license information please see main.bundle.js.LICENSE.txt */
  (()=>{var e,t={228:(e,t,s)=>{"use strict";function a(e,t){let s=Le.get().plugins.get("rexHSLAdjustPipeline");s.remove(t),s.add(t,{hueRotate:e.hue,satAdjust:e.sat,lumAdjust:e.lum})}s(260);class i{constructor(e,t,s){this.updateBackgrounds=Array(),this.backgrounds=Array(),this.currentLevel=1,this.scene=e,this.createPanels(),this.createBg()}createPanels(){let e=new Phaser.GameObjects.Sprite(this.scene,0,0,"BnPanels");this.scene.add.existing(e),e.originX=0,e.originY=0,e.setDepth(-4),e.setX(129),e.setY(137)}createBg(){this.scene.anims.create({key:"background1anim",frameRate:3,frames:this.scene.anims.generateFrameNumbers("Background",{frames:[0,1,2,3,4,5,6,7]}),repeat:-1});for(let e=0;e<5;e++)for(let t=0;t<4;t++){let s=new Phaser.GameObjects.Sprite(this.scene,0,0,"Background");this.scene.add.existing(s),s.originX=0,s.originY=0,s.setDepth(-5),s.setX(64*e+20),s.setY(64*t+20),s.play("background1anim"),this.backgrounds.push(s)}}adjustBackground(e){let t=this.updateBackgrounds[this.updateBackgrounds.length-1];2==e?a({hue:.2,sat:1,lum:.5},t):3==e?a({hue:.4,sat:1,lum:.5},t):4==e&&a({hue:.6,sat:1,lum:.5},t),this.updateBackgrounds.pop(),0!=this.updateBackgrounds.length&&this.scene.time.delayedCall(20,(()=>{this.adjustBackground(e)}))}updateBackground(e){this.currentLevel!=e&&(this.backgrounds.forEach((e=>{this.updateBackgrounds.push(e)})),this.scene.time.delayedCall(20,(()=>{this.adjustBackground(e)})))}}let r=40,n=25;class h{constructor(e,t,s,a){this.adjustX=6,this.adjustY=10,this.digits=new Array;for(let s=0;s<4;s++){let i=new Phaser.GameObjects.Sprite(a,e+this.adjustX+7*s,t+this.adjustY,"Numbers");this.digits.push(i),i.setDepth(t+1),a.add.existing(i)}this.setDigits(s)}update(e,t,s){let a=0;this.digits.forEach((i=>{i.setPosition(e+this.adjustX+7*a,t+this.adjustY),i.setDepth(s),a++}))}destroy(){this.digits.forEach((e=>{e.destroy()}))}tint(e){e?this.digits.forEach((e=>{e.setTint(9211020)})):this.digits.forEach((e=>{e.clearTint()}))}setDigits(e){this.value=e,e>9999&&(e=9999);let t=String(e);const s=Array.from(t);let a=0;for(;a<4;)a<s.length?(this.digits[a].setFrame(parseInt(s[a])),this.digits[a].setVisible(!0)):this.digits[a].setVisible(!1),a++}}class o extends Phaser.GameObjects.Sprite{constructor(e,t,s,a){super(e,t,s,a),this.scene=e,this.blocked=!1,this.xpos=t,this.ypos=s,this.currentHue=0,this.currentSat=1,this.currentLum=.5,this.passable=!1,this.damageable=!1,e.add.existing(this),this.on("pointerdown",this.moveSprite,this),this.moveListeners=[],this.x=this.xpos*r+8,this.y=this.ypos*n+97,this.delay=this.scene.time.now+this.delayTime,this.depth=this.ypos}getBoardXPos(){return Math.round(this.xpos)}getBoardYPos(){return Math.round(this.ypos)}setText(e){this.damageable&&(this.text=new h(this.x,this.y,this.hp,this.scene),this.text.depth=this.ypos+1)}adjustHue(e){this.currentHue=e}adjustSaturation(e){this.currentSat=e}adjustLum(e){this.currentLum=e}readjust(){a({hue:this.currentHue,sat:this.currentSat,lum:this.currentLum},this)}moveTo(e,t){this.xpos=e,this.ypos=t,this.x=this.xpos*r+8,this.y=this.ypos*n+97,this.text&&"Megaman"!=this.name&&this.text.update(this.x,this.y,this.ypos+1),this.moveListeners.forEach((e=>{e.onEntityMove(this)})),this.depth=this.ypos}addMoveListener(e){this.moveListeners.push(e)}moveInDirection(e,t){2!=e&&3!=e&&1!=e||(this.ypos-=t),5!=e&&7!=e&&6!=e||(this.ypos+=t),0!=e&&1!=e&&7!=e||(this.xpos-=t),4!=e&&6!=e&&3!=e||(this.xpos+=t),this.xpos=parseFloat(this.xpos.toFixed(2)),this.ypos=parseFloat(this.ypos.toFixed(2)),this.x=this.xpos*r+8,this.y=this.ypos*n+97,this.text&&(this.text.update(this.x,this.y,this.ypos+1),this.text.depth=this.ypos+1),this.depth=this.ypos}setGrid(e,t){this.xpos=e,this.ypos=t}setDelayed(){this.delay=this.scene.time.now+this.delayTime}setHP(e){this.hp=e,this.damageable&&(null==this.text?this.setText(!0):this.text.setDigits(this.hp))}setDamageable(e){this.damageable=e}update(){this.scene.time.now>this.invincibilityExpire&&(this.invincible=!1)}cleanup(){}afterAttack(){}setDelayTime(e){e==1/0&&(e=500),this.delay=0,this.delayTime=e,this.setDelayed()}moveSprite(){Fe.e=this,console.log(this.name+"selected.."),console.log("X:"+this.originX+", Y:"+this.originY)}damage(e,t){}}class m extends o{constructor(e,t,s,a,i=!0){super(e,t,s,"Blast"),this.passable=!0,this.setOrigin(0,0),this.removeAfterDone=!0,e.anims.create({key:"Blast",frameRate:19,frames:this.anims.generateFrameNumbers("Blast",{start:0,end:5}),repeat:0}),e.anims.create({key:"MeteorEffect",frameRate:15,frames:this.anims.generateFrameNumbers("Meteor",{start:0,end:6}),repeat:0}),e.anims.create({key:"AttackBounce",frameRate:15,frames:this.anims.generateFrameNumbers("AttackBounce",{start:0,end:4}),repeat:0}),e.anims.create({key:"GregarBreath",frameRate:15,frames:e.anims.generateFrameNumbers("GregarBreath",{frames:[0,1]}),repeat:10}),e.anims.create({key:"guardAnimation",frameRate:12,frames:this.anims.generateFrameNumbers("GuardEffect",{frames:[5,5,5,5,4,3,2,1,0]}),repeat:0}),e.anims.create({key:"LifeSwordSlash",frameRate:10,frames:this.anims.generateFrameNumbers("LifeSwordSlash",{start:0,end:3}),repeat:0}),e.anims.create({key:"ScreenDiv",frameRate:15,frames:this.anims.generateFrameNumbers("ScreenDiv",{start:0,end:4}),repeat:0}),e.anims.create({key:"WideSlash",frameRate:10,frames:this.anims.generateFrameNumbers("WideSlash",{start:0,end:3}),repeat:0}),e.anims.create({key:"HeroSlash",frameRate:10,frames:this.anims.generateFrameNumbers("HeroSlash",{start:0,end:3}),repeat:0}),i?this.play(a):this.setVisible(!1),this.animation=a,this.onAnimationLoopDone=()=>{},this.on("animationcomplete",(()=>{this.cycles>0?(this.play(this.animation),this.cycles--):(this.removeAfterDone&&this.destroy(),this.onAnimationLoopDone())}))}onEntityMove(e){this.moveTo(e.xpos,e.ypos),this.setDepth(e.depth+1)}setOnAnimationComplete(e){this.on("animationcomplete",e)}playEffect(){this.play(this.animation)}}class l{constructor(e,t,s,a){this.adjustX=6,this.adjustY=10,this.characters=new Array;for(let s=0;s<24;s++){let i=new Phaser.GameObjects.Sprite(a,e+this.adjustX+8*s,t+this.adjustY,"Letters");this.characters.push(i),i.setDepth(t+1),a.add.existing(i)}this.setText(s)}update(e,t,s){let a=0;this.characters.forEach((i=>{i.setPosition(e+this.adjustX+7*a,t+this.adjustY),i.setDepth(s),a++}))}destroy(){this.characters.forEach((e=>{e.destroy()}))}animate(){let e=this;e.characters.forEach((e=>{e.setTint(5297259)})),Le.get().time.delayedCall(200,(()=>{e.characters.forEach((e=>{e.clearTint()}))}))}setInteractive(e){this.characters.length,this.interactiveRect=new Phaser.GameObjects.Rectangle(e,this.characters[0].x,this.characters[0].y,100,18,9079434),this.interactiveRect.setOrigin(.1,.5),this.interactiveRect.setDepth(20),this.interactiveRect.setInteractive(),e.add.existing(this.interactiveRect)}on(e,t){this.interactiveRect&&this.interactiveRect.on(e,t)}setText(e){e.includes("DS")&&(e=e.replace("DS",String.fromCharCode(263)));const t=Array.from(e);let s=0;for(;s<24;){if(s<t.length){let e=t[s].charCodeAt(0),a=0;a=32==e?71:e>200?e-200:e>96?e-61:e>58?e-55:e-48,this.characters[s].setFrame(a),this.characters[s].setVisible(!0)}else this.characters[s].setVisible(!1);s++}}}class c{static shuffle(e){for(var t,s,a=e.length;0!==a;)s=Math.floor(Math.random()*a),t=e[a-=1],e[a]=e[s],e[s]=t;return e}static getRandomInteger(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e))+e}static createText(e,t,s,a){let i=new l(e,t,s,a);return i.depth=1,i}}class d extends o{constructor(e,t,s){super(e,t,s,"Target"),this.passable=!0,this.setOrigin(0,0)}setOwner(e){this.owner=e}update(){null!=this.owner&&(this.moveTo(this.owner.getBoardXPos(),this.owner.getBoardYPos()),this.setDepth(this.owner.depth-1))}}class p extends o{constructor(e,t,s,a,i,r,n=400){super(e,a,i,"BusterRake"),e.anims.create({key:"BusterRake",frameRate:10,frames:this.anims.generateFrameNumbers("BusterRake",{start:0,end:3}),repeat:0}),this.delayTime=n,this.target=new d(this.scene,this.xpos,this.ypos),this.target.setOwner(this),this.passable=!0,this.target.setDepth(-1),this.target.update(),this.setDelayed(),this.setVisible(!1),this.setOrigin(.2,.5),this.on("animationcomplete",(()=>{le.getInstance().removeGameObjectFromGame(this.target),le.getInstance().removeGameObjectFromGame(this)}))}update(){this.scene.time.now>this.delay&&!this.animStarted&&(this.play("BusterRake"),this.scene.sound.play("sfx:gun"),this.setVisible(!0),le.getInstance().damageEntityAt(this.xpos,this.ypos,20,-1,30),this.animStarted=!0)}}class g{constructor(e,t,s){this.soundEffect="none";let a=v.createTarget(Le.get(),-1,e[0],e[1],null);a.play("TargetFlash"),s.setDepth(e[1]+1),this.effect=s,this.target=a,Le.get().time.delayedCall(t,(()=>{s.setVisible(!0),s.playEffect(),le.getInstance().removeGameObjectFromGame(a),"none"!=this.soundEffect&&Le.get().sound.play(this.soundEffect),null!=this.updateFunction&&Ee.add(this)}))}setOnComplete(e){this.effect.setOnAnimationComplete(e)}setSoundEffect(e){this.soundEffect=e}setUpdateFunction(e,t){this.updateFunction=e,this.delayTime=t,this.delay=0}update(){null!=this.updateFunction&&Le.get().time.now>this.delay&&(this.updateFunction(),this.delay=Le.get().time.now+this.delayTime)}cleanup(){}destroy(){}}class u extends o{constructor(e,t,s,a,i,r){super(e.scene,s,a,"ColSlash1"),this.damage=r,this.battlefieldSide=i,this.targets=t,1==i?(this.setFlipX(!0),this.setOrigin(.5,.3)):this.setOrigin(0,.3),this.setVisible(!1),e.once("animationcomplete",(()=>{this.scene.sound.play("sfx:colSlash"),this.setVisible(!0),this.play("colSlash1"),e.play(e.slashAnimation),e.setState(2),this.targets.list().forEach((e=>{le.getInstance().damageEntityAt(e.xpos,e.ypos,r,this.battlefieldSide,30),le.getInstance().removeGameObjectFromGame(e)})),e.targets.clearTargets()})),this.once("animationcomplete",(()=>{le.getInstance().removeGameObjectFromGame(this)}))}}class f extends o{constructor(e,t,s,a,i){super(e,a,i,"Shockwave"),this.name="Shockwave",this.level=s,this.sfx="sfx:shockwave",this.setDelayTime(400/s),this.passable=!0,this.animation="shockwaveAnim",this.moveLogic=this.shockwaveMoveLogic,this.play(this.animation),this.target=new d(this.scene,this.xpos,this.ypos),this.target.setOwner(this),this.damageAmount=10*this.level,this.target.setDepth(-1),this.target.update(),this.setOrigin(0,.5),this.owner=t}flipSprite(){1==this.direction&&(this.setScale(-1,1),this.setOrigin(.76,.53))}setDamageAmount(e){this.damageAmount=e}setDirection(e){this.direction=e}setAnimation(e){this.animation=e,this.play(this.animation)}getSfx(){return"sfx:shockwave"}setSfx(e){this.sfx=e}update(){this.scene.time.now>this.delay&&this.moveLogic(),le.getInstance().damageEntityAt(this.getBoardXPos(),this.getBoardYPos(),this.damageAmount,this.direction,400)&&null!=this.onHit&&this.onHit(this)}remove(){this.owner.afterAttack(),le.getInstance().removeGameObjectFromGame(this),this.destroy(),this.target.destroy()}setOnHit(e){this.onHit=e}setMoveLogic(e){this.moveLogic=e}shockwaveMoveLogic(){Te||(this.xpos>0&&this.xpos<5?(this.moveTo(this.xpos+this.direction,this.ypos),this.damaged=!1,"none"!=this.sfx&&this.scene.sound.play(this.sfx),this.setDelayed(),this.target.update()):("none"!=this.sfx&&this.scene.sound.play(this.sfx),this.remove()))}decimalMoveLogic(){Te||(this.xpos>0&&this.xpos<5?(this.moveInDirection(0,.2),this.damaged=!1,"none"!=this.sfx&&this.scene.sound.play(this.sfx),this.setDelayed(),this.target.update()):("none"!=this.sfx&&this.scene.sound.play(this.sfx),this.owner.defeated||(this.owner.state=1),this.remove(),this.destroy(),this.target.destroy()))}}class y extends f{constructor(e,t,s,a,i){super(e,t,s,a,i),this.setTexture("WideSlash"),this.anims.stop(),this.setMoveLogic(this.sonicBoomLogic),this.setDelayTime(20),this.damageAmount=80}update(){this.scene.time.now>this.delay&&this.moveLogic();let e=le.getInstance().damageEntityAt(this.getBoardXPos(),this.getBoardYPos(),this.damageAmount,this.direction,400),t=le.getInstance().damageEntityAt(this.getBoardXPos(),this.getBoardYPos()+1,this.damageAmount,this.direction,400),s=le.getInstance().damageEntityAt(this.getBoardXPos(),this.getBoardYPos()-1,this.damageAmount,this.direction,400);(e||t||s)&&this.remove()}sonicBoomLogic(){Te||(this.xpos>-1&&this.xpos<5?(this.moveInDirection(4,.2),this.damaged=!1,this.setDelayed(),this.target.update()):(this.owner.defeated||(this.owner.state=1),this.remove(),this.destroy(),this.target.destroy()))}}class v{static lifeSwordSlash(e,t,s=20){let a=e.xpos+1,i=1;0==t&&(a=e.xpos-1,i=-1),le.getInstance().damageEntityAt(a,e.ypos,s,i,50),le.getInstance().damageEntityAt(a,e.ypos+1,s,i,50),le.getInstance().damageEntityAt(a,e.ypos-1,s,i,50),le.getInstance().damageEntityAt(a+i,e.ypos,s,i,50),le.getInstance().damageEntityAt(a+i,e.ypos+1,s,i,50),le.getInstance().damageEntityAt(a+i,e.ypos-1,s,i,50),e.state=2,e.play(e.recoverAnimation),e.scene.sound.play("sfx:lifesword")}static swordSlash(e,t,s=20){let a=e.xpos+1,i=-1;0==t&&(a=e.xpos-1),"Megaman"==e.name&&(i=1),le.getInstance().damageEntityAt(a,e.ypos,s,i,50),le.getInstance().damageEntityAt(a,e.ypos+1,s,i,50),le.getInstance().damageEntityAt(a,e.ypos-1,s,i,50),e.state=2,e.play(e.recoverAnimation),e.scene.sound.play("sfx:swordswing")}static heroSwordSlash(e,t,s=20){let a=e.xpos+1,i=-1;0==t&&(a=e.xpos-1),"Megaman"==e.name&&(i=1),le.getInstance().damageEntityAt(a,e.ypos,s,i,50),le.getInstance().damageEntityAt(a+1,e.ypos,s,i,50),le.getInstance().damageEntityAt(a+2,e.ypos,s,i,50),e.state=2,e.play(e.recoverAnimation),e.scene.sound.play("sfx:swordswing")}static sonicBoom(e,t,s=20,a){let i=new y(e.scene,e,2,a[0],a[1]);return Ee.add(i),e.play(e.recoverAnimation),i}static createShockwaveAttack(e,t,s,a){let i=new a(e.scene,e,s,t[0],t[1]);return Ee.add(i),i}static createTarget(e,t,s,a,i){let r=new d(e,s,a);return r.setOwner(i),Ee.add(r),r}static busterRake(e,t,s){0==s.length&&(s=[0,1,2,3,4,5,6,7,8],s=c.shuffle(s));let a=le.panelNumberToBoardPosition(s[s.length-1]),i=a.x,r=a.y,n=new p(e,t,3,i,r,-1,475);return Ee.add(n),s.pop(),s}static colonelSlash(e,t,s,a,i,r,n){n.addTarget(-1,s,a),n.addTarget(-1,s-i,a+1),n.addTarget(-1,s-i,a-1),new u(t,n,s,a,i,r),t.play(t.prepareSlashAnimation)}static gregarBreath(e,t){let s=[[e.getBoardXPos()-1,e.getBoardYPos()],[e.getBoardXPos()-2,e.getBoardYPos()],[e.getBoardXPos()-2,e.getBoardYPos()-1],[e.getBoardXPos()-2,e.getBoardYPos()+1],[e.getBoardXPos()-3,e.getBoardYPos()],[e.getBoardXPos()-3,e.getBoardYPos()+1],[e.getBoardXPos()-3,e.getBoardYPos()-1]],a=!0;s.forEach((s=>{let i=new m(e.scene,s[0],s[1],"GregarBreath",!1);i.setOrigin(.2,.6);let r=new g(s,700,i);r.setUpdateFunction((()=>{le.getInstance().damageEntityAt(s[0],s[1],20,-1,800)}),20),r.setOnComplete((()=>{le.getInstance().removeGameObjectFromGame(r)})),a&&(r.setSoundEffect("sfx:flame"),r.setOnComplete((()=>{e.setState(1),t(),le.getInstance().removeGameObjectFromGame(r)})),a=!1)}))}}class w{entityDefeated(e,t){if(t.entityType===E.other)return;Le.get().debug||"Bass"!==t.name||e.backToMenu();let s=le.getInstance();s.setEnemyCount(s.getEnemyCount()-1),0==s.getEnemyCount()&&(s.setRoundCount(s.getRoundCount()+1),e.clearEnemyDisplays(),e.addTopRightDisplay("Battle "+s.getRoundCount()),e.animateTopRightDisplay(),w.bossRound?(e.sound.stopByKey("music:battle"),Re.play("enemyDeletedBanner"),e.sound.play("sfx:win"),e.time.delayedCall(2500,(()=>e.fadeOutScene()))):s.prepareNextRound(e))}}w.bossRound=!1;let k,x=0,S={musicMuted:!1};function b(){S.musicMuted||(Le.get().sound.stopAll(),Le.get().sound.play("music:battle",{loop:!0}))}let A=!1;class T extends Phaser.Events.EventEmitter{constructor(){super()}static getInstance(){return null==k&&(k=new T),k}register(e){let t=new w;A||(this.on("entity_defeated",(s=>{t.entityDefeated(e,s)})),this.on("entity_spawned",(e=>{!function(e){"GospelBoss"===e&&(Le.get().sound.stopAll(),Le.get().sound.play("music:finalBoss",{loop:!0}))}(e)})),this.on("ui_event",(e=>{console.log("Recieved some data:"+e)})),A=!0)}}class D{move(e){}}class B{move(e){e.scene.time.now>e.delay&&1==e.state&&(e.ypos<Be.ypos?(le.getInstance().isEnemyAt(e.xpos,e.ypos+1)||e.moveTo(e.xpos,e.ypos+1),e.setDelayed()):e.ypos>Be.ypos?(le.getInstance().isEnemyAt(e.xpos,e.ypos-1)||e.moveTo(e.xpos,e.ypos-1),e.setDelayed()):(e.state=1)&&(e.attack(),e.state=0),e.delay=e.scene.time.now+e.delayTime)}}class C{constructor(e){this.stepsBeforeAttack=e}move(e){if(e.scene.time.now>e.delay&&1==e.state){if(e.steps<this.stepsBeforeAttack){let t=le.getInstance().pickRandomAvailablePanel();null==t||e.shadow||e.moveTo(t.x,t.y),e.steps++}else e.steps==this.stepsBeforeAttack&&e.attack();e.setDelayed()}}}class P{constructor(e,t){this.attacked=!1,e.delay=e.scene.time.now+800,this.scene=t,this.entity=e,this.scene.time.delayedCall(1e3,(()=>{this.entity.defeated||(this.entity.attack(),this.attacked=!0)}))}move(e){1==e.state&&this.attacked&&e.removeIfShadow()}}var F;!function(e){e[e.NO_DAMAGE=0]="NO_DAMAGE",e[e.DAMAGED=1]="DAMAGED",e[e.DEFEATED=2]="DEFEATED"}(F||(F={}));let R={Boomer:[.28,.55],Cannon:[.4,.65],Fishy:[-.06,.62],Metfire:[.16,.75],Mettaur:[.2,.5],Nightmare:[.3,.7],Piranha:[.16,.7],Pulsebulb:[.16,.65],Sensor:[-.03,.68],Spikey:[.2,.5],Swordy:[.37,.77],Volgear:[.2,.5],Bugtank:[.31,.59],Scuttle:[.05,.5],Gutsman:[.26,.64],AirMan:[.37,.77],Colonel:[.43,.82],MegamanDS:[-.05,.7],Shademan:[.33,.66],Bass:[.3,.7]};function I(e){return null==R[e]?[.5,.5]:R[e]}const E={enemy:1,boss:2,other:3},L=[1,1.5,2,3];class H extends o{constructor({scene:e,x:t,y:s,name:a}){super(e,t,s,a),this.textUpdateDelay=0,this.name=a,this.hurtFrame=-1,this.playDefeatSound=!0,this.damageable=!0,this.level=0,this.state=1,this.steps=0,this.setInteractive(),this.setHP(10),this.setOrigin(...I(this.name)),this.setDelayTime(400),this.moveLogic=new D,this.entityType=E.enemy}setMoveLogic(e){this.moveLogic=e}setLevel(e){this.applyBaseProperties(e)}applyBaseProperties(e){this.level=e,this.setDelayTime(this.properties.baseDelayTime/L[e-1]),this.setHP(this.properties.baseHP*L[e-1]),e>1&&(this.adjustHue(this.properties.levelHues[e-2]),this.adjustSaturation(this.properties.levelSats[e-2]),this.adjustLum(this.properties.levelLums[e-2])),this.readjust(),this.properties.custom&&this.properties.custom.bind(this)()}attack(){}removeIfShadow(){this.shadow&&(le.getInstance().removeGameObjectFromGame(this),this.owner.defeated||this.owner.onMinionRemoved())}update(){this.defeated||(super.update(),this.moveLogic.move(this),this.text.value>this.hp&&this.scene.time.now>this.textUpdateDelay&&(this.text.tint(!0),this.text.setDigits(this.text.value-5),this.text.value==this.hp&&this.text.tint(!1),this.textUpdateDelay=this.scene.time.now+50))}setShadow(){this.adjustSaturation(0),this.adjustLum(.4),this.readjust(),this.setHP(200),this.setMoveLogic(new P(this,Le.get())),this.shadow=!0}damage(e,t,s=!1){let a=this;this.aura&&!a.invincible&&(this.aura.damage(e),le.getInstance().createBlast(a.xpos,a.ypos),a.invincible=!0,a.invincibilityExpire=a.scene.time.now+t);let i=function(e,t,s){return!e.invincible&&!e.guard||s?(e.hp=e.hp-t,e.hp>0?F.DAMAGED:F.DEFEATED):F.NO_DAMAGE}(this,e,s);i==F.NO_DAMAGE?a.guard&&!a.invincible&&(new m(a.scene,a.xpos,a.ypos,"AttackBounce").setOrigin(.2,.5),a.scene.sound.play("sfx:attackbounce"),a.invincible=!0,a.invincibilityExpire=a.scene.time.now+t):i==F.DAMAGED?(le.getInstance().createBlast(a.xpos,a.ypos),a.shadow&&a.owner.damage(e,t,!0),0!=t&&(a.invincible=!0,a.invincibilityExpire=a.scene.time.now+t)):i==F.DEFEATED&&(a.playDefeatSound?(le.getInstance().createDefeatBlast(a),this.setDefeated()):(le.getInstance().createBlast(a.xpos,a.ypos),this.removeEntityFromGame()))}setDefeated(){this.defeated=!0,Ee.delete(this),this.cleanup(),this.anims.pause(),this.hurtFrame>=0&&this.setFrame(this.hurtFrame),this.removeText()}removeEntityFromGame(){le.getInstance().removeGameObjectFromGame(this),this.removeIfShadow(),T.getInstance().emit("entity_defeated",this)}afterAttack(){!this.defeated&&this.state&&(this.state=1)}removeText(){null!=this.text&&this.text.destroy()}remove(){le.getInstance().removeGameObjectFromGame(this)}}class M extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Mettaur"}),this.attackAnimation="mettaur1Attack",this.idleAnimation=null,this.recoverAnimation="mettaur1Recover",this.setMoveLogic(new B),this.on("animationcomplete",(()=>{0==this.state?this.createAttack():2==this.state&&null!=this.idleAnimation&&this.play(this.idleAnimation)})),this.properties={baseHP:40,baseDelayTime:800,levelHues:[.1,.6,.1],levelSats:[1,1,.1],levelLums:[.5,.5,.5]}}update(){super.update()}createAttack(){let e=[this.xpos-1,this.ypos];v.createShockwaveAttack(this,e,this.level,f).setDirection(-1),this.play(this.recoverAnimation),this.setState(2),this.steps=0}attack(){this.moveTo(this.xpos,Be.getBoardYPos()),this.play(this.attackAnimation),this.setState(0)}}class G extends o{constructor(e,t,s,a,i){super(e,a,i,"CannonTarget"),this.setDelayTime(300/s),this.cannon=t,this.found=!1,this.name="CannonTarget",this.setOrigin(.2,.5),this.setDepth(5),this.passable=!0,this.level=s,this.on("animationcomplete",(()=>{Ee.delete(this),this.destroy(),t.defeated||this.cannon.cannonAttack(this)})),e.anims.create({key:"lockon",frameRate:10,frames:this.anims.generateFrameNumbers("CannonTarget",{frames:[1,2,3,4]}),repeat:0})}update(){if(this.scene.time.now>this.delay&&!this.found)if(this.xpos>0)this.moveTo(this.xpos-1,this.ypos),this.setDelayed();else{if(this.cannon.hp<=0)return void le.getInstance().removeGameObjectFromGame(this);this.moveTo(this.cannon.getBoardXPos()-1,this.cannon.getBoardYPos()),this.setDelayed()}this.found||this.xpos!=Be.xpos||this.ypos!=Be.ypos||(this.play("lockon"),this.found=!0)}}class O extends f{constructor(e,t,s,a,i,r){super(e,t,s,a,i),this.sfx="sfx:flame",this.moveLogic=this.flameLogic,e.anims.create({key:"flameAnim",frameRate:15,frames:this.anims.generateFrameNumbers("Flame",{frames:[0,1,2,3,4,3,2,3,4,3,2,3,4,3,2,1,0]}),repeat:0}),this.on("animationcomplete",(()=>{this.remove()})),this.delayTime=500/(s/2),this.setOrigin(-.1,.65),this.animation="flameAnim",this.setDelayed(),this.play(this.animation),this.scene.sound.play(this.sfx)}getSfx(){return"sfx:flame"}remove(){0==this.xpos&&this.owner.afterAttack(),le.getInstance().removeGameObjectFromGame(this),this.destroy(),this.target.destroy()}flameLogic(){if(!Te&&!this.spread&&this.xpos>0&&this.xpos<5){let e=this.ypos;this.ypos<Be.getBoardYPos()?e++:this.ypos>Be.getBoardYPos()&&e--;let t=[this.xpos+this.direction,e];if(this.owner.defeated)return;v.createShockwaveAttack(this.owner,t,this.level,O).setDirection(-1),this.spread=!0,this.damaged=!1,this.setDelayed(),this.target.update()}}}class N{constructor(){this.targets=[]}clearTargets(){this.targets.forEach((e=>{le.getInstance().removeGameObjectFromGame(e)})),this.targets=[]}addTarget(e,t,s){this.targets.push(v.createTarget(Le.get(),e,t,s,null))}list(){return this.targets}flash(){this.targets.forEach((e=>{e.play("TargetFlash")}))}}class j extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Swordy"}),this.steps=0,this.name="Swordy",this.state=1,this.targets=new N,this.setFrame("idle.png"),this.recoverAnimation="swordyrecover",this.slashAnimation="swordyslash",this.idleAnimation="swordyidle",this.setMoveLogic(new C(3)),this.on("animationcomplete",(()=>{0==this.state?this.attackDamageLogic():2==this.state&&this.postAttackLogic()}),this),this.properties={baseHP:70,baseDelayTime:800,levelHues:[.5,.2,1.3],levelSats:[1,1,.6],levelLums:[.5,.5,.2]}}attackDamageLogic(){v.swordSlash(this,0)}update(){super.update()}cleanup(){this.targets.clearTargets()}attack(){this.showTargets(Be.xpos+1,Be.ypos),this.steps++,this.moveTo(Be.xpos+1,Be.ypos),this.play({key:this.slashAnimation,frameRate:10+2*(this.level-1)}),this.state=0}showTargets(e,t){this.targets.addTarget(-1,e-1,t),this.targets.addTarget(-1,e-1,t+1),this.targets.addTarget(-1,e-1,t-1),this.targets.flash()}postAttackLogic(){this.state=1,this.steps=0,this.play(this.idleAnimation),this.targets.clearTargets()}}class W extends f{constructor(e,t,s,a,i){super(e,t,s,a,i),this.animation="boomerangAnim",this.return=!1,this.side=-1,e.anims.create({key:"boomerangAnim",frameRate:20,frames:this.anims.generateFrameNumbers("Boomerang",{start:0,end:3}),repeat:0}),this.on("animationcomplete",(()=>{this.play(this.animation)})),this.setOrigin(.21,.61),this.play(this.animation),-1==this.side&&(this.direction=0),this.setDelayTime(40/this.level)}getSfx(){return"sfx:shockwave"}boomerangMoveLogic(){if(!Te){if(0==this.direction&&this.xpos<=0?2==this.getBoardYPos()?this.direction=2:0==this.getBoardYPos()?this.direction=5:this.direction=4:(2==this.direction&&this.ypos<=0||5==this.direction&&this.ypos>=2)&&(this.direction=4),this.getBoardXPos()==this.owner.xpos&&this.getBoardYPos()==this.owner.ypos)return this.remove(),void le.getInstance().removeGameObjectFromGame(this.target);4==this.direction&&5==this.getBoardXPos()?(this.remove(),le.getInstance().removeGameObjectFromGame(this.target)):(this.moveInDirection(this.direction,.2),this.setDelayed(),this.target.update())}}update(){this.scene.time.now>this.delay&&this.boomerangMoveLogic(),le.getInstance().damageEntityAt(this.getBoardXPos(),this.getBoardYPos(),20*this.level,this.side,500)}}class X{constructor(){this.rowTarget=0}move(e){e.scene.time.now>e.delay&&1==e.state&&(e.ypos<this.rowTarget?(le.getInstance().isEnemyAt(e.xpos,e.ypos+1)?(e.attack(),e.state=0):e.moveInDirection(5,.05),e.setDelayed()):e.ypos>this.rowTarget?(le.getInstance().isEnemyAt(e.xpos,e.ypos-1)?(e.attack(),e.state=0):e.moveInDirection(2,.05),e.setDelayed()):(e.state=1)&&(e.attack(),e.state=0,0==this.rowTarget?this.rowTarget=2:this.rowTarget=0),e.delay=e.scene.time.now+e.delayTime/15)}}class Y extends f{constructor(e,t,s,a,i,r){super(e,t,s,a,i),this.sfx="none",this.moveLogic=this.gospelMoveLogic,this.animation="gospelAnimation",this.attackStarted=!1,this.on("animationcomplete",(()=>{})),this.setOrigin(-.1,.65),this.setDelayed(),this.setTexture("Gospel")}getSfx(){return"none"}gospelMoveLogic(){this.xpos>3?this.decimalMoveLogic():this.attackStarted||(this.attackStarted=!0,v.gregarBreath(this,(()=>{this.remove()})))}}class U{constructor(e){this.auraEffect=new m(e.scene,e.xpos,e.ypos,"AuraAnim"),this.auraEffect.setOrigin(.2,.5),this.auraEffect.setDepth(e.depth-1),this.hits=3,this.entity=e,e.scene.sound.play("sfx:guard"),e.aura=this,e.addMoveListener(this)}onEntityMove(e){this.auraEffect.moveTo(e.xpos,e.ypos),this.auraEffect.setDepth(e.depth-2)}damage(e){this.hits--,this.hits<=0&&(this.entity.aura=void 0,this.auraEffect.destroy())}}class V extends o{constructor(e,t,s,a,i,r,n=400){super(e,a,i,"SensorLaser"),this.effects=[],this.name="SensorLaser",this.level=s,this.direction=r,this.sfx="sfx:laser",this.setDelayTime(50),this.passable=!0,this.animation="SensorLaserAnim",this.play(this.animation),this.scene.sound.play(this.sfx),this.setOrigin(-.35,.81),this.owner=t,this.owner.play("SensorAttack"),1==this.direction&&(this.owner.state=0,this.setScale(-1,1),this.setOrigin(.76,.53))}setAnimation(e){this.animation=e,this.play(this.animation)}getSfx(){return"sfx:shockwave"}setSfx(e){this.sfx=e}update(){this.scene.time.now>this.delay&&this.continueLogic();for(let e=this.owner.xpos;e>=this.xpos;e--)le.getInstance().damageEntityAt(e,this.getBoardYPos(),5*this.level,this.direction,150)}continueLogic(){if(!Te)if(this.xpos>0&&this.xpos<5){let e=new m(this.scene,this.xpos,this.ypos,"SensorLaserAnim");e.setOrigin(-.35,.81),this.moveTo(this.xpos+this.direction,this.ypos),this.damaged=!1,this.setDelayed(),this.effects.push(e)}else this.end||(this.end=!0,this.scene.time.delayedCall(750,(()=>{this.owner.defeated||(this.owner.state=1,this.owner.cannonTarget=null),le.getInstance().removeGameObjectFromGame(this),this.destroy(),this.effects.forEach((e=>{le.getInstance().removeGameObjectFromGame(e)}))})))}}class z{constructor(e,t,s){let a=v.createTarget(Le.get(),-1,e[0],e[1],null);this.meteorEffect=new m(Le.get(),a.getBoardXPos(),-5,"MeteorEffect",!1),this.side=s,this.meteorEffect.setTexture("Meteor"),this.meteorEffect.setVisible(!0),this.meteorEffect.setOrigin(.1,.6),this.target=a,this.target.play("TargetFlash"),Ee.add(this),this.speed=t,this.delay=Le.get().time.now+t,this.damage=30}setDamage(e){this.damage=e}update(){Le.get().time.now>this.delay&&(this.meteorEffect.moveInDirection(5,.5),this.delay=Le.get().time.now+this.speed,this.meteorEffect.ypos>=this.target.getBoardYPos()&&(this.meteorEffect.playEffect(),Le.get().sound.play("sfx:meteorhit"),le.getInstance().damageEntityAt(this.target.getBoardXPos(),this.target.getBoardYPos(),this.damage,this.side,100),le.getInstance().removeGameObjectFromGame(this),le.getInstance().removeGameObjectFromGame(this.target)))}destroy(){}cleanup(){}}class _ extends H{constructor(e,t,s,a,i,r){super({scene:e,x:a,y:i,name:"ColonelSoldier"}),this.owner=t,this.playDefeatSound=!1,this.setOrigin(.09,.72),this.setDamageable(!0),this.setHP(40*s),this.currentX=2,this.entityType=E.other,this.damageAmount=30,this.setDelayTime(20),this.setOrigin(.5,.5),this.name="IceCube",this.animation="ColonelSoldierAppear",this.setDelayed(),this.scene.sound.play("sfx:appear"),this.play(this.animation),this.setFlipX(!0),this.on("animationcomplete",(()=>{if(1==this.state)this.animationComplete=!0;else if(0==this.state){let e=new p(this.scene,this,this.level,this.currentX,this.ypos,-1,s);Ee.add(e),this.currentX--,this.play("ColonelSoldierAttack"),this.currentX<0&&(this.play("ColonelSoldierRetreat"),this.state=2)}else this.remove()}))}getSfx(){return"sfx:flame"}cleanup(){this.owner.afterAttack()}update(){super.update(),this.scene.time.now>this.delay&&!Te&&this.animationComplete&&1==this.state&&(this.state=0,this.play("ColonelSoldierAttack"))}}class K{constructor(){this.moves=new Array}pickRandomMove(){let e=this.moves[c.getRandomInteger(0,this.moves.length)];return this.lastAttack=e,e}getLastAttack(){return this.lastAttack}}class J extends H{constructor(e,t,s,a,i,r){super({scene:e,x:a,y:i,name:"Bat"}),this.playDefeatSound=!1,this.setOrigin(.09,.72),this.setDamageable(!0),this.setHP(40*s),this.target=new d(this.scene,this.xpos,this.ypos),this.target.setOwner(this),this.damageAmount=30,this.entityType=E.other,this.setDelayTime(80),this.setOrigin(-.1,.65),this.name="Bat",this.animation="bat",this.setDelayed(),this.play(this.animation)}getSfx(){return"sfx:flame"}cleanup(){le.getInstance().removeGameObjectFromGame(this.target)}update(){this.scene.time.now>this.delay&&(Te||(this.xpos>0&&this.xpos<5?(this.moveInDirection(0,.2),this.setDelayed(),this.target.update()):(this.remove(),le.getInstance().removeGameObjectFromGame(this.target)))),le.getInstance().damageEntityAt(this.getBoardXPos(),this.getBoardYPos(),this.damageAmount,-1,800)}}class Z extends H{constructor(e,t,s,a,i,r){super({scene:e,x:a,y:i,name:"IceCube"}),this.owner=t,this.playDefeatSound=!1,this.setOrigin(.09,.72),this.setDamageable(!0),this.setHP(60),this.target=new d(this.scene,this.xpos,this.ypos),this.target.setOwner(this),this.entityType=E.other,this.damageAmount=30,this.setDelayTime(30),this.setOrigin(-.17,.5),this.name="IceCube",this.animation="formIceCube",this.setDelayed(),this.scene.sound.play("sfx:appear"),this.play(this.animation),this.on("animationcomplete",(()=>{this.animationComplete=!0}))}getSfx(){return"sfx:flame"}cleanup(){le.getInstance().removeGameObjectFromGame(this.target),this.owner.afterAttack()}update(){super.update(),this.scene.time.now>this.delay&&!Te&&this.animationComplete&&(this.xpos>0&&this.xpos<5?(this.moveInDirection(0,.3),this.setDelayed(),this.target.update()):(this.remove(),le.getInstance().removeGameObjectFromGame(this.target))),le.getInstance().damageEntityAt(this.getBoardXPos(),this.getBoardYPos(),this.damageAmount,-1,800)}}class q{constructor(e,t,s,a){this.targets=new N,this.targets.addTarget(-1,e[0],0),this.targets.addTarget(-1,e[0],1),this.targets.addTarget(-1,e[0],2),this.distTraveled=0,this.totaldist=a.xpos-e[0],this.height=a.ypos-e[1]+1,this.horizontalVelocity=this.totaldist/20,this.verticalVelocity=.1*(this.height-.5),this.sprite=new m(Le.get(),a.getBoardXPos(),a.getBoardYPos()-1,"BugshotAnim",!0),this.side=s,this.sprite.setVisible(!0),Ee.add(this),this.speed=t,this.delay=Le.get().time.now+t,this.damage=30}setDamage(e){this.damage=e}update(){Le.get().time.now>this.delay&&(this.sprite.moveInDirection(0,this.horizontalVelocity),this.distTraveled+=.1,this.sprite.moveInDirection(2,this.verticalVelocity),this.verticalVelocity-=.01,this.delay=Le.get().time.now+this.speed,this.sprite.xpos<=this.targets.list()[0].getBoardXPos()&&(Le.get().sound.play("sfx:meteorhit"),this.targets.list().forEach((e=>{le.getInstance().createBlast(e.getBoardXPos(),e.getBoardYPos())})),le.getInstance().damageEntityAtCol(this.targets.list()[0].getBoardXPos(),this.damage,this.side,100),le.getInstance().removeGameObjectFromGame(this),this.targets.clearTargets()))}destroy(){}cleanup(){le.getInstance().removeGameObjectFromGame(this.sprite)}}const Q=["Mettaur","Cannon","Volgear","Swordy","Boomer","Bugtank","Sensor","Nightmare","Piranha","Metfire","Spikey","Pulsebulb","Fishy","Scuttle","Gutsman","AirMan","Colonel","MegamanDS","Shademan","Bass"],$={Mettaur:M,Cannon:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Cannon"}),this.setState(1),this.aimX=2,this.aimY=this.ypos,this.attackAnimation="cannonAttack",this.properties={baseHP:60,baseDelayTime:800,levelHues:[.7,.2,.8],levelSats:[1,1,.5],levelLums:[.5,.5,.5]},this.on("animationcomplete",(()=>{this.animationCompleteCallback()}),this)}animationCompleteCallback(){this.state=1}cannonAttack(e){this.play(this.attackAnimation),this.scene.sound.play("sfx:cannon"),le.getInstance().damageEntityAt(e.xpos,e.ypos,25*this.level,-1)}update(){if(super.update(),1==this.state){let e=new G(this.scene,this,this.level,this.xpos-1,this.ypos);Ee.add(e),this.delay=this.scene.time.now+this.delayTime,this.state=0}}},Volgear:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Volgear"}),this.play("volgearIdle"),this.on("animationcomplete",(()=>{if(0==this.state){this.state=2,this.play("volgearAttackFinish");let e=[this.xpos-1,this.ypos];v.createShockwaveAttack(this,e,this.level,O).setDirection(-1)}else 2==this.state&&(this.state,this.play("volgearIdle"))}),this),this.properties={baseHP:60,baseDelayTime:1e3,levelHues:[.7,.3,.1],levelSats:[1,1,.5],levelLums:[.5,.5,.3]}}update(){super.update(),this.volgearMoveLogic()}afterAttack(){this.steps=0,this.state=1}volgearMoveLogic(){if(this.scene.time.now>this.delay&&1==this.state){let e=[0,1,2];const t=e.indexOf(this.ypos);t>-1&&e.splice(t,1);let s=e[c.getRandomInteger(0,2)];le.getInstance().isEnemyAt(this.xpos,s)||this.moveTo(this.xpos,s),this.setDelayed(),this.steps++,this.steps>=6&&1==this.state&&(this.play("volgearAttack"),this.state=0),this.delay=this.scene.time.now+this.delayTime}}},Swordy:j,Boomer:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Boomer"}),this.setFrame(0),this.guard=!0,this.setMoveLogic(new X),this.on("animationcomplete",this.animationCompleteHandler),this.properties={baseHP:60,baseDelayTime:800,levelHues:[.3,.2,.4],levelSats:[1,1,1],levelLums:[.5,.5,.5]}}animationCompleteHandler(){if(0==this.state){let e=[this.xpos-1,this.ypos];v.createShockwaveAttack(this,e,this.level,W),this.state=2,this.scene.sound.play("sfx:throw"),this.guard=!1}else 2==this.state&&(this.state=1,this.setDelayed())}update(){super.update()}remove(){super.remove()}attack(){this.steps++,this.play("boomerAttack"),this.state=0}afterAttack(){this.defeated||(this.state=2,this.play("boomerRecover"),this.guard=!0)}},Bugtank:class extends H{constructor({scene:e,x:t,y:s,level:a}){super({scene:e,x:t,y:s,name:"Bugtank"}),this.attacktype=0,this.shots=1,this.setMoveLogic(new C(3)),this.setHP(100),this.setName("Metfire"),this.play("BugtankIdle"),this.on("animationcomplete",(()=>{0==this.state&&this.attackDamageLogic()})),this.properties={baseHP:80,baseDelayTime:800,levelHues:[.6,.3,.2],levelSats:[1,1,.7],levelLums:[.5,.5,.4]}}attack(){this.play("BugtankAttack"),this.shots=this.level,this.state=0,this.scene.sound.play("sfx:cannon")}update(){super.update(),1==this.state&&this.moveLogic.move(this)}attackDamageLogic(){new q([Be.getBoardXPos(),1],80/this.level,-1,this),this.delay=this.scene.time.now+500,this.shots--,0==this.shots?(this.shots=this.level,this.setState(1),this.steps=0,this.play("BugtankAttackComplete")):(this.play("BugtankAttack"),this.scene.sound.play("sfx:cannon"))}},Sensor:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Sensor"}),this.attackAnimation="SensorAttack",this.setName("Sensor"),this.on("animationcomplete",(()=>{this.play("SensorIdle")})),this.play("SensorIdle"),this.properties={baseHP:70,baseDelayTime:2e3,levelHues:[.2,.6,.6],levelSats:[1,1,.8],levelLums:[.5,.5,.4],custom:this.sensorMoveLogic}}animationCompleteCallback(){}cannonAttack(){let e=new V(this.scene,this,this.level,this.xpos-1,this.ypos,-1,200);Ee.add(e)}sensorMoveLogic(){this.level>3&&(this.moveLogic=new X)}update(){super.update(),this.cannonTarget||(this.cannonTarget=new G(this.scene,this,this.level,this.getBoardXPos()-1,this.getBoardYPos()),Ee.add(this.cannonTarget),this.delay=this.scene.time.now+this.delayTime)}},Nightmare:class extends j{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s}),this.recoverAnimation="nightmarerecover",this.slashAnimation="nightmareslash",this.idleAnimation="nightmareidle",this.play(this.idleAnimation),this.setOrigin(...I(this.name))}attack(){Be.xpos>0?(this.showTargets(Be.xpos+1,Be.ypos),this.steps++,this.setScale(-1,1),this.setOrigin(.76,.7),this.moveTo(Be.xpos-1,Be.ypos),this.direction=4):(this.showTargets(Be.xpos+1,Be.ypos),this.moveTo(Be.xpos+1,Be.ypos),this.direction=0),this.play(this.slashAnimation),this.state=0}attackDamageLogic(){v.swordSlash(this,this.direction),this.state=2,this.play(this.recoverAnimation),this.scene.sound.play("sfx:swordswing")}postAttackLogic(){this.state=1,this.steps=0,this.play(this.idleAnimation),this.targets.clearTargets(),this.setScale(1,1),this.setOrigin(.3,.7)}},Piranha:class extends M{constructor({scene:e,x:t,y:s,level:a}){super({scene:e,x:t,y:s}),this.name="Piranha",this.attackAnimation="PiranhaAttack",this.idleAnimation="PiranhaIdle",this.play("PiranhaIdle"),this.setMoveLogic(new B),this.setOrigin(...I(this.name)),this.properties={baseHP:70,baseDelayTime:800,levelHues:[.1,.6,.3],levelSats:[1,1,1],levelLums:[.5,.5,.5]}}createAttack(){let e=[this.xpos-1,this.ypos],t=v.createShockwaveAttack(this,e,1,f);t.stop(),t.setTexture("PiranhaArrow"),t.setOrigin(-.1,2.3),t.setDelayTime(100),t.setDirection(-1),t.setSfx("none"),this.play("PiranhaRecover"),this.setState(2)}},Metfire:class extends H{constructor({scene:e,x:t,y:s,level:a}){super({scene:e,x:t,y:s,name:"Metfire"}),this.attacktype=0,this.meteors=8,this.setMoveLogic(new C(6)),this.setHP(100),this.setName("Metfire"),this.play("metfireIdle"),this.properties={baseHP:70,baseDelayTime:800,levelHues:[.5,.2,.3],levelSats:[1,1,.7],levelLums:[.5,.5,.4]}}attack(){this.play("metfireAttack"),this.state=0}update(){super.update(),1==this.state?this.moveLogic.move(this):0==this.state&&this.attackDamageLogic()}attackDamageLogic(){this.scene.time.now>this.delay&&(this.scene.sound.play("sfx:meteor"),new z([Be.getBoardXPos(),Be.getBoardYPos()],40/this.level,-1),this.delay=this.scene.time.now+800/(this.level/2),this.meteors--,0==this.meteors&&(this.meteors=9,this.setState(1),this.steps=0,this.play("metfireIdle")))}},Spikey:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Spikey"}),this.attackAnimation="SpikeyAttack",this.idleAnimation="SpikeyIdle",this.setOrigin(.2,.5),this.setMoveLogic(new C(3)),this.on("animationcomplete",(()=>{0==this.state?(this.createAttack(),this.play(this.idleAnimation)):2==this.state&&this.idleAnimation})),this.play(this.idleAnimation),this.properties={baseHP:60,baseDelayTime:1e3,levelHues:[.7,.1,.5],levelSats:[1,.1,1.2],levelLums:[.5,.5,.5]}}update(){super.update()}createAttack(){let e=[this.xpos-1,this.ypos];this.scene.sound.play("sfx:roar");let t=v.createShockwaveAttack(this,e,this.level,f);t.setAnimation("fireballAnim"),t.setOrigin(-.04,.63),t.setMoveLogic(t.decimalMoveLogic),t.setSfx("none"),t.setDirection(-1),t.setDelayTime(60/this.level),this.setState(2),this.steps=0}attack(){this.moveTo(this.xpos,Be.getBoardYPos()),this.play(this.attackAnimation),this.setState(0)}},Pulsebulb:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Pulsebulb"}),this.targets=[],this.guard=!0,this.play("pulseBulbIdle"),this.setMoveLogic(new C(4)),this.on("animationcomplete",this.animationHandler),this.properties={baseHP:70,baseDelayTime:800,levelHues:[.9,.7,.6],levelSats:[1,1,1],levelLums:[.5,.5,.5]}}animationHandler(){if(0==this.state){let e=[this.xpos-1,this.ypos],t=new m(this.scene,e[0],e[1],"elecPulseAnim",!0);t.setOrigin(.5,.65),this.targets.forEach((e=>{le.getInstance().damageEntityAt(e.xpos,e.ypos,30*this.level,-1,30)})),t.setOnAnimationComplete((()=>{this.defeated||this.play("pulseBulbReturn"),this.targets.forEach((e=>{le.getInstance().removeGameObjectFromGame(e)})),this.targets=[]})),this.state=2,this.scene.sound.play("sfx:pulse"),this.guard=!1}else 1!=this.state&&2!=this.state||(this.play("pulseBulbIdle"),this.state=1,this.guard=!0,this.steps=0)}update(){super.update()}remove(){this.targets.forEach((e=>{le.getInstance().removeGameObjectFromGame(e)})),super.remove()}attack(){this.steps++,le.getInstance().tryMoveTo(this,Be.xpos+2,Be.ypos)||le.getInstance().tryMoveTo(this,Be.xpos+1,Be.ypos)?this.doAttack():this.steps--}doAttack(){this.targets.push(v.createTarget(this.scene,-1,this.xpos-1,this.ypos,null)),this.targets.push(v.createTarget(this.scene,-1,this.xpos-2,this.ypos,null)),this.targets.push(v.createTarget(this.scene,-1,this.xpos-2,this.ypos+1,null)),this.targets.push(v.createTarget(this.scene,-1,this.xpos-2,this.ypos-1,null)),this.play("pulseBulbAttack"),this.state=0}},Fishy:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Fishy"}),this.name="Fishy",this.setTexture("Fishy"),this.on("animationcomplete",(()=>{this.setTexture("Fishy")})),this.setOrigin(-.06,.62),this.setMoveLogic(new B),this.properties={baseHP:60,baseDelayTime:800,levelHues:[.2,1.09,1.7],levelSats:[1,1,.8],levelLums:[.5,.5,.4]}}update(){0!==this.state?super.update():(this.damageAmount=20*this.level,le.getInstance().damageEntityAt(this.getBoardXPos(),this.getBoardYPos(),this.damageAmount,-1,400),this.moveInDirection(0,.1+this.level/60),this.getBoardXPos()<-2&&(this.state=1,this.moveTo(this.returnPosition.x,this.returnPosition.y),this.stop(),this.setFrame(0),this.setDelayed()))}attack(){this.scene.sound.play("sfx:fishyfly"),this.play("fishyfly"),this.returnPosition={x:this.xpos,y:this.ypos},this.setState(0)}},Scuttle:class extends M{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s}),e.anims.create({key:"scuttleIdle",frameRate:10,frames:this.anims.generateFrameNumbers("Scuttle",{frames:[6,7,8,9,10]}),repeat:-1}),e.anims.create({key:"scuttleAttack",frameRate:14,frames:this.anims.generateFrameNumbers("Scuttle",{frames:[5,4,3,2]}),repeat:0}),e.anims.create({key:"scuttleRecover",frameRate:10,frames:this.anims.generateFrameNumbers("Scuttle",{frames:[1,0,0,0,0,0]}),repeat:0}),this.steps=0,this.state=1,this.name="Scuttle",this.attackAnimation="scuttleAttack",this.idleAnimation="scuttleIdle",this.recoverAnimation="scuttleRecover",this.setOrigin(.2,.5),this.setTexture("Scuttle"),this.setMoveLogic(new B),this.setOrigin(...I(this.name)),new U(this),this.on("animationcomplete",(()=>{0==this.state?this.createAttack():1==this.state&&null!=this.idleAnimation&&this.play(this.idleAnimation)})),this.properties={baseHP:90,baseDelayTime:800,levelHues:[.5,.9,.1],levelSats:[1,1,.1],levelLums:[.5,.5,.5]}}createAttack(){this.play(this.recoverAnimation),this.setState(2);let e=[this.xpos-1,this.ypos];1==this.level?this.createFlameAttack(e):2==this.level?this.createIceCubeAttack(e):this.createThunderAttack(e),this.steps=0}createIceCubeAttack(e){v.createShockwaveAttack(this,e,this.level+1,Z)}createFlameAttack(e){v.createShockwaveAttack(this,e,this.level+1,O).setDirection(-1)}createThunderAttack(e){let t=v.createShockwaveAttack(this,e,this.level+1,f);t.setDirection(-1),t.setAnimation("ThunderAnim"),t.setMoveLogic(t.decimalMoveLogic),t.setDelayTime(60/this.level),t.setSfx("none"),this.scene.sound.play("sfx:laser")}afterAttack(){!this.defeated&&this.state&&(this.state=1)}},Gutsman:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Gutsman"}),this.zpunches=0,this.punchAnimation="GutsPunch",this.hammerAnimation="GutsHammer",this.hurtFrame=7,this.setMoveLogic(new C(3)),this.on("animationcomplete",(()=>{this.state=1,this.createAttack()})),this.setFlipX(!0),this.setTexture("Gutsman"),this.properties={baseHP:300,baseDelayTime:1e3,levelHues:[.05,.07,.09],levelSats:[1,1,1],levelLums:[.5,.5,.4]},this.movepool=new K,this.movepool.moves.push(this.gutspunch),this.movepool.moves.push(this.gutshammer),this.movepool.moves.push(this.zpunch)}update(){super.update()}gutspunch(){this.scene.sound.play("sfx:gutsshoot"),this.setState(0),this.zpunches<1?this.play(this.punchAnimation):(this.play({key:this.punchAnimation,frameRate:20}),this.delay=this.delay+this.delayTime/2),this.createAttack=this.createPunch.bind(this)}afterAttack(){this.defeated||(this.zpunches<1&&super.afterAttack(),this.setTexture("Gutsman"))}gutshammer(){this.play(this.hammerAnimation),this.setState(0),this.createAttack=this.createShockwave.bind(this)}zpunch(){this.zpunches=10}createShockwave(){this.scene.sound.play("sfx:hammer");let e=[this.xpos-1,this.ypos];v.createShockwaveAttack(this,e,this.level,f).setDirection(-1),this.setState(2),this.steps=0}createPunch(){let e=[this.xpos-1,this.ypos],t=v.createShockwaveAttack(this,e,this.level,f);t.setTexture("GutsPunch"),t.setOrigin(-.04,.63),t.setMoveLogic(t.decimalMoveLogic),t.setSfx("none"),t.stop(),t.setDirection(-1),t.setDelayTime(60/this.level),t.setOnHit((()=>{le.getInstance().pushBackAt(t.getBoardXPos(),t.getBoardYPos(),-1)})),this.setState(2),this.zpunches<1?this.steps=0:(this.steps=2,this.setState(1))}attack(){if(this.zpunches>0)return this.zpunches--,void this.gutspunch();this.movepool.pickRandomMove().bind(this)()}},AirMan:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"AirMan"}),this.steps=0,this.name="AirMan",this.state=1,this.entityType=E.boss,this.setFrame(5),this.hurtFrame=6,this.setOrigin(.37,.77),this.setMoveLogic(new C(3)),this.on("animationcomplete",(()=>{0==this.state?(0==c.getRandomInteger(0,2)?this.attack1():this.attack2(),this.scene.sound.play("sfx:tornado"),this.play("airmanCooldown"),this.state=2):(this.setFrame(5),this.steps=0)}),this),this.properties={baseHP:300,baseDelayTime:700,levelHues:[.1,.2,.3],levelSats:[1.2,1.4,1.5],levelLums:[.5,.4,.3]}}update(){super.update()}attack1(){let e=[this.xpos-1,this.ypos],t=v.createShockwaveAttack(this,e,1,f);t.setDirection(-1),t.setAnimation("bigtornado"),t.setOrigin(.09,.72),t.setDelayTime(200)}attack2(){let e=new Array;for(let t=0;t<3;t++){let s=[4.5,t],a=v.createShockwaveAttack(this,s,this.level,f);a.setAnimation("smalltornado"),a.setOrigin(.09,.72),a.setMoveLogic(a.decimalMoveLogic),a.setSfx("none"),a.setDirection(-1),e.push(a)}c.shuffle(e);let t=35;e.forEach((e=>{e.setDelayTime(t),t*=1.8}))}remove(){super.remove()}attack(){this.steps++,this.play("airmanAttack"),this.state=0}},Colonel:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Colonel"}),this.ColonelAttackType={ColSlash1:0,ScreenDiv:1},this.selectedAttack=-1,this.prepareSlashAnimation="colonelPrepareAttack",this.steps=0,this.name="Colonel",this.state=1,this.targets=new N,this.entityType=E.boss,this.setFrame(7),this.hurtFrame=8,this.slashAnimation="colonelSlash",this.setOrigin(.43,.82),this.on("animationcomplete",(()=>{0==this.state?this.selectedAttack!=this.ColonelAttackType.ColSlash1&&(this.play("colonelSlash"),this.attack1()):2==this.state&&(this.setFrame(7),this.setState(1),this.steps=0)}),this),this.properties={baseHP:400,baseDelayTime:700,levelHues:[.1,.7,.9],levelSats:[1.2,1.4,1.5],levelLums:[.5,.4,.3],custom:this.colonelCustom}}update(){super.update()}moveTo(e,t){if(super.moveTo(e,t),this.xpos>4){le.getInstance().pickRandomAvailablePanel();let e=new _(this.scene,this,this.level,this.xpos-1,this.ypos,-1);Ee.add(e)}}colonelCustom(){this.setMoveLogic(new C(Math.max(5-this.level,1)))}attack1(){this.scene.sound.play("sfx:colSlash"),this.slashEffect.setVisible(!0),this.slashEffect.playEffect(),this.setState(2),this.targets.list().forEach((e=>{le.getInstance().damageEntityAt(e.xpos,e.ypos,20*this.level,-1,30),le.getInstance().removeGameObjectFromGame(e)})),this.targets.clearTargets()}cleanup(){this.targets.clearTargets()}attack(){this.selectedAttack=c.getRandomInteger(0,2),this.selectedAttack==this.ColonelAttackType.ColSlash1?(this.state=0,v.colonelSlash(this.scene,this,Be.xpos,Be.ypos,-1,20*this.level,this.targets)):this.selectedAttack==this.ColonelAttackType.ScreenDiv&&(this.slashEffect=new m(this.scene,1,1,"ScreenDiv",!1),this.slashEffect.setOrigin(.3,.4),this.state=0,this.play("colonelPrepareAttack"),this.showTargets(Be.xpos,Be.ypos,this.selectedAttack))}showTargets(e,t,s){this.targets.addTarget(-1,0,0),this.targets.addTarget(-1,1,0),this.targets.addTarget(-1,2,0),this.targets.addTarget(-1,1,1),this.targets.addTarget(-1,0,2),this.targets.addTarget(-1,1,2),this.targets.addTarget(-1,2,2)}},MegamanDS:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"MegamanDS"}),this.steps=0,this.hurtFrame=9,this.name="MegamanDS",this.state=1,this.targets=new N,this.setTexture("Megaman"),this.recoverAnimation="slash",this.slashAnimation="darkmegamanSword",this.idleAnimation="swordyidle",this.flipSprite(),this.adjustLum(.4),e.anims.create({key:"darkmegamanSword",frameRate:15,frames:this.anims.generateFrameNumbers("Megaman",{frames:[0,0,0,0,14,15]}),repeat:0}),this.setMoveLogic(new C(3)),this.on("animationcomplete",(()=>{0==this.state?this.attackDamageLogic():2==this.state&&(this.postAttackLogic(),this.setTexture("Megaman"))}),this),this.movepool=new K,this.movepool.moves.push(this.lifesword),this.movepool.moves.push(this.cannon)}flipSprite(){this.setScale(-1,1),this.setOrigin(.4,.7)}setLevel(e){let t=450+200*(e-1),s=550/(e/2);this.level=e,this.setHP(t),this.setDelayTime(s),2==e?this.adjustLum(.3):3==e?this.adjustLum(.1):e>3&&this.adjustSaturation(0),this.readjust()}attackDamageLogic(){if(this.movepool.getLastAttack()===this.lifesword){let e=new m(this.scene,this.getBoardXPos()-2,this.getBoardYPos()-2,"LifeSwordSlash");e.setFlip(!0,!1),this.scene.add.existing(e),v.lifeSwordSlash(this,0)}else this.postAttackLogic()}update(){super.update()}cleanup(){this.targets.clearTargets()}lifesword(){this.showTargets(Be.xpos+1,Be.ypos),this.steps++,this.moveTo(Be.xpos+1,Be.ypos),this.play({key:this.slashAnimation,frameRate:9+2*(this.level-1)}),this.state=0}cannon(){this.play("cannon"),this.scene.sound.play("sfx:cannon");let e=[this.xpos-1,this.ypos],t=v.createShockwaveAttack(this,e,this.level,f);t.setAnimation("fireballAnim"),t.setOrigin(-.04,.63),t.setMoveLogic(t.decimalMoveLogic),t.setSfx("none"),t.setDirection(-1),t.setDelayTime(60/this.level),this.state=0,this.setDelayed()}attack(){this.movepool.pickRandomMove().bind(this)()}showTargets(e,t){this.targets.addTarget(-1,e-1,t),this.targets.addTarget(-1,e-1,t+1),this.targets.addTarget(-1,e-1,t-1),this.targets.addTarget(-1,e-2,t),this.targets.addTarget(-1,e-2,t+1),this.targets.addTarget(-1,e-2,t-1),this.targets.flash()}postAttackLogic(){this.state=1,this.steps=0,this.targets.clearTargets()}},Shademan:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Shademan"}),this.steps=0,this.name="Shademan",this.state=1,this.targets=new N,this.recoverAnimation="shademanrecover",this.slashAnimation="shademanslash",this.idleAnimation="shademanidle",this.attackAnimation="shademanattack",this.hurtFrame=11,this.setOrigin(.33,.66),this.movepool=new K,this.movepool.moves.push(this.slash),this.movepool.moves.push(this.pulse),this.setMoveLogic(new C(4)),this.on("animationcomplete",(()=>{0==this.state?this.movepool.getLastAttack()===this.pulse&&this.completePulse():2==this.state?this.postAttackLogic():1==this.state&&this.play(this.idleAnimation)}),this),this.play(this.idleAnimation),this.properties={baseHP:350,baseDelayTime:700,levelHues:[-.1,.2,.3],levelSats:[1,1,.2],levelLums:[.5,.5,.3]}}moveTo(e,t){super.moveTo(e,t),5==this.xpos&&this.summonBat()}attack(){this.movepool.pickRandomMove().bind(this)()}update(){super.update()}cleanup(){this.targets.clearTargets()}slash(){this.showTargets(Be.xpos+1,Be.ypos),this.steps++,this.moveTo(Be.xpos+1,Be.ypos),this.play({key:this.slashAnimation,frameRate:12+2*(this.level-1)}),this.state=2}showTargets(e,t){this.targets.addTarget(-1,e-1,t),this.targets.addTarget(-1,e-1,t+1),this.targets.addTarget(-1,e-1,t-1),this.targets.flash()}summonBat(){let e=[this.xpos-1,this.ypos];v.createShockwaveAttack(this,e,1,J),this.scene.sound.play("sfx:hellzrolling"),this.state=1}pulse(){this.steps++,this.moveTo(Be.xpos+2,Be.ypos),this.targets.addTarget(-1,this.xpos-1,this.ypos),this.targets.addTarget(-1,this.xpos-2,this.ypos),this.targets.addTarget(-1,this.xpos-2,this.ypos+1),this.targets.addTarget(-1,this.xpos-2,this.ypos-1),this.play("shademanattack"),this.state=0}completePulse(){let e=[this.xpos-1,this.ypos];new m(this.scene,e[0],e[1],"elecPulseAnim",!0).setOrigin(.5,.65),this.targets.list().forEach((e=>{le.getInstance().damageEntityAt(e.xpos,e.ypos,30*this.level,-1,30)})),this.defeated||this.play("shademanpulsecomplete"),this.targets.clearTargets(),this.state=1,this.scene.sound.play("sfx:pulse"),this.steps=0,this.setDelayed()}postAttackLogic(){v.swordSlash(this,0),this.state=1,this.steps=0,this.play(this.recoverAnimation),this.delay=this.delay+200,this.targets.clearTargets()}},Bass:class extends H{constructor({scene:e,x:t,y:s}){super({scene:e,x:t,y:s,name:"Bass"}),this.steps=0,this.hurtFrame=14,this.name="Bass",this.state=1,this.targets=[],this.entityType=E.boss,this.setFrame(5),this.shotPanels=[],this.setFlipX(!0),this.setOrigin(.3,.7),new U(this).auraEffect.setOrigin(.2,.8),this.setTexture("Bass2"),this.setFrame(0),this.setMoveLogic(new C(6)),this.on("animationcomplete",(()=>{0==this.state&&(0==this.selectedAttack?(this.state=1,this.idle(),this.steps=0,this.attack1()):1==this.selectedAttack?this.busterShots>0?Te?(this.idle(),this.steps=0,this.state=1):(this.attack2(),this.play({key:"bassAttack2",frameRate:7+2*(this.level-1)}),this.busterShots--):(this.idle(),this.steps=0,this.state=1):2==this.selectedAttack&&(this.attack3(),this.steps=0))}),this)}idle(){this.play("bassIdle")}attack3(){this.level<=1?v.gregarBreath(this,(e=>this.bassCompleteGregarBreath(this))):(this.play("bassAttack1"),this.gospel(),this.steps=0,this.state=1,this.idle())}bassCompleteGregarBreath(e){e.steps=0,e.defeated||e.idle()}setLevel(e){this.level=e,this.setDelayTime(800/e),this.setHP((e+1)/2*800),2==e?this.adjustHue(.1):3==e?this.adjustHue(.7):e>3&&(this.adjustHue(.3),this.adjustSaturation(.3),this.adjustLum(.4)),this.readjust()}update(){super.update()}attack1(){this.shockwave()}shockwave(){let e=[this.xpos-1,this.ypos],t=v.createShockwaveAttack(this,e,1,f);t.setDirection(-1),this.scene.sound.play("sfx:hellzrolling"),t.setAnimation("DarkWheel"),t.setDelayTime(200),t.setSfx("none")}attack2(){this.shotPanels=v.busterRake(this.scene,this,this.shotPanels)}gospel(){let e=[this.xpos-1,this.ypos],t=v.createShockwaveAttack(this,e,1,Y);t.setDirection(-1),this.scene.sound.play("sfx:hellzrolling"),t.setAnimation("gospelAnimation"),t.setOrigin(.09,.72),t.setDelayTime(80),t.setSfx("none")}remove(){this.targets.forEach((e=>{le.getInstance().removeGameObjectFromGame(e)})),super.remove()}attack(){this.steps=0,this.selectedAttack=c.getRandomInteger(0,3),0==this.selectedAttack?this.play("bassAttack1"):1==this.selectedAttack?(this.busterShots=9*this.level,this.play("bassAttack2")):(this.level<=1?this.moveTo(3,1):this.moveTo(5,1),this.scene.sound.play("sfx:darkcharge"),this.play("bassCharge")),this.state=0}showTargets(e,t){this.targets.push(v.createTarget(this.scene,-1,e-1,t,null)),this.targets.push(v.createTarget(this.scene,-1,e-1,t+1,null)),this.targets.push(v.createTarget(this.scene,-1,e-1,t-1,null))}}},ee=["AirMan","Gutsman","Shademan","MegamanDS","Colonel","Bass"];class te{static createEnemy(e,t){const s=$[e];return T.getInstance().emit("entity_spawned",e),new s(t)}}let se,ae=0,ie=1,re=3,ne=0,he=1;class oe{constructor(e,t){this.x=e,this.y=t}}let me={0:new oe(0,0),1:new oe(1,0),2:new oe(2,0),3:new oe(0,1),4:new oe(1,1),5:new oe(2,1),6:new oe(0,2),7:new oe(1,2),8:new oe(2,2)};class le{static destroyAllEnemies(){for(let e=3;e<6;e++)for(let t=0;t<3;t++)le.getInstance().damageEntityAt(e,t,2e3,1)}getEnemyCount(){return ae}getRoundCount(){return ie}setRoundCount(e){ie=e}setEnemyCount(e){ae=e}getGameLevel(){return he}setGameLevel(e){he=e}cleanupBoard(){Ee.forEach((e=>{this.removeGameObjectFromGame(e)})),w.bossRound=!1,ae=0,ie=1,ne=0,re=3}static getInstance(){return null==se&&(se=new le),se}incrementGameLevel(){this.setGameLevel(++he)}isEnemyAt(e,t){let s=!1;return Ee.forEach((a=>{a instanceof o&&a.xpos==e&&a.ypos==t&&!a.passable&&(s=!0)})),s}tryMoveTo(e,t,s){return!this.isEnemyAt(t,s)&&(e.moveTo(t,s),!0)}isMegamanAt(e,t){return Be.xpos==e&&Be.ypos==t}damageEntityAtCol(e,t,s,a){for(let t=0;t<3;t++)le.getInstance().damageEntityAt(e,t,20,s,50)}damageEntityAt(e,t,s,a,i=0){let r;if(-1==a){if(e==Be.xpos&&t==Be.ypos&&!Be.passable)return Be.damage(s,i),!0}else Ee.forEach((a=>{if(a instanceof o&&"Megaman"!=a.name&&e==a.getBoardXPos()&&t==a.getBoardYPos()&&a.damageable)return a.damage(s,i),r=!0,!0}));return r}pushBackAt(e,t,s){if(-1==s&&e==Be.xpos&&t==Be.ypos&&!Be.passable)return Be.xpos>0&&Be.moveTo(Be.getBoardXPos()-1,Be.getBoardYPos()),!0}createBlast(e,t){new m(Be.scene,e,t,"Blast").setOrigin(.2,.5)}createDefeatBlast(e){const t=new m(Be.scene,e.xpos,e.ypos,"Blast");t.cycles=2,t.onAnimationLoopDone=()=>{e.removeEntityFromGame()},t.setOnAnimationComplete((()=>{Le.get().time.now>x&&(Le.get().sound.play("sfx:blast"),x=Le.get().time.now+200)})),t.setOrigin(.2,.5)}spawnRandomAmount(e,t){let s=1,a=[3,4,5],i=[0,1,2];c.shuffle(a),c.shuffle(i);for(let r=0;r<t;r++){if(e.time.delayedCall(100+200*s,(()=>{this.spawnRandom(a[r],i[r],1,e),e.sound.play("sfx:appear")})),s==t){ae+=t;break}s++}}spawnRandom(e,t,s,a){let i=c.getRandomInteger(0,Q.length-ee.length),r=te.createEnemy(Q[i],{scene:a,x:e,y:t});return r.setLevel(he),Ee.add(r),r.name}static getPanelSet(){let e=new Map;for(let t=3;t<6;t++)for(let s=0;s<3;s++)e.set(t+""+s,new oe(t,s));return e}static panelNumberToBoardPosition(e){return me[e]}pickRandomAvailablePanel(){let e=le.getPanelSet();Ee.forEach((t=>{t instanceof o&&e.delete(t.xpos+""+t.ypos)}));let t=Array.from(e.keys()),s=t[Math.floor(Math.random()*t.length)];return e.get(s)}prepareNextRound(e){let t=le.getInstance();Ie.updateBackground(he),w.bossRound&&(w.bossRound=!1,e.sound.stopByKey("music:boss"),b(),Be.setHP(Be.hp+100)),re<=0?(this.spawnBoss(ee[ne++]),re=he/2*3):(t.getRoundCount()*t.getGameLevel()<=10?t.spawnRandomAmount(e,2):t.spawnRandomAmount(e,3),re--)}spawnBoss(e){Le.get().addTopRightDisplay(e+String.fromCharCode(263+le.getInstance().getGameLevel()));let t=Le.get(),s=le.getInstance(),a=te.createEnemy(e,{scene:t,x:3,y:1});a.setLevel(s.getGameLevel()),Ee.add(a),s.setEnemyCount(1),t.sound.stopByKey("music:battle"),S.musicMuted||(Le.get().sound.stopAll(),Le.get().sound.play("music:boss",{loop:!0})),w.bossRound=!0}removeGameObjectFromGame(e){null!=e.text&&e.text.destroy(),e.cleanup(),Ee.delete(e),e.destroy()}}class ce{constructor(e,t,s){this.chipSprite=new Phaser.GameObjects.Sprite(s,e,t,"Chips"),this.chipSprite.setDepth(5),s.add.existing(this.chipSprite),this.chipSprite.setFrame(0)}update(e,t){let s=e*r+34,a=t*n+60;this.chipSprite.setPosition(s,a)}dim(e){a({hue:0,sat:0,lum:.2},this.chipSprite),this.chipSprite.scene.time.delayedCall(e,(()=>{a({hue:0,sat:1,lum:.5},this.chipSprite)}))}destroy(){this.chipSprite.destroy()}setChip(e){this.chipSprite.setFrame(e)}}class de{}de.WideSword={name:"WideSword",basedamage:80,id:3},de.Cannon={name:"Cannon",basedamage:60,id:0},de.Shockwave={name:"Shockwave",basedamage:50,id:1},de.Meteors={name:"Meteors",basedamage:80,id:2},de.LifeSword={name:"LifeSword",basedamage:60,id:4},de.ElecPulse={name:"ElecPulse",basedamage:70,id:5},de.ColSlash={name:"ColSlash",basedamage:80,id:6},de.StepSword={name:"StepSword",basedamage:80,id:7},de.StepClaw={name:"StepClaw",basedamage:100,id:8},de.HeroSword={name:"HeroSword",basedamage:80,id:9},de.SonicBoom={name:"SonicBoom",basedamage:80,id:26},de.Guard={name:"SonicBoom",basedamage:80,id:11},de.Tornado={name:"Tornado",basedamage:70,id:20};class pe extends o{constructor(e,t,s,a,i){super(e,t,s,"Megaman"),this.defendCooldown=0,this.attackCooldown=0,this.damageable=!0,this.animations=i,this.recoverAnimation=i.recoverAnimation,this.slashAnimation=i.slashAnimation,this.prepareSlashAnimation=i.prepareSlashAnimation,this.setHP(100),this.setDelayTime(150),this.xpos=t,this.ypos=s,this.return=-1,this.debugMode=a,this.scene=e,this.alive=!0,this.state=1,this.chipFolder=i.chipFolder,this.name="Megaman",this.invincible=!1,this.chipIndex=0,this.selectedChip=this.chipFolder[0],this.shots=0,this.targets=new N,this.setTexture(i.texture),this.setOrigin(i.originX,i.originY),this.text.update(42,3,2),this.animations.flip&&this.setFlipX(!0),this.on("animationcomplete",(()=>{99==this.lastUsedChip?0!=this.shots?(this.shots--,this.vulcanShot()):this.state=1:0==this.lastUsedChip||2==this.lastUsedChip||6==this.lastUsedChip?this.state=1:0==this.state?3==this.lastUsedChip?(v.swordSlash(this,4,80),this.setState(1),this.attackCooldown=this.scene.time.now+200):4==this.lastUsedChip?(v.lifeSwordSlash(this,4,60),this.setState(1),this.attackCooldown=this.scene.time.now+650/le.getInstance().getGameLevel()):this.lastUsedChip==de.StepSword.id?(v.swordSlash(this,4,80),this.state=2,this.attackCooldown=this.scene.time.now+800):this.lastUsedChip==de.HeroSword.id?(v.heroSwordSlash(this,4,80),this.setState(1),this.attackCooldown=this.scene.time.now+200):this.lastUsedChip==de.SonicBoom.id?(this.scene.sound.play("sfx:swordswing"),v.sonicBoom(this,4,80,[this.xpos,this.ypos]).setDirection(1),this.setState(1),this.selectedChip=this.chipFolder[this.chipIndex]):this.lastUsedChip==de.StepClaw.id&&(v.swordSlash(this,4,80),this.scene.sound.play("sfx:swordswing"),this.setState(1),this.selectedChip=this.chipFolder[this.chipIndex]):2==this.state&&(this.state=1)})),this.x=this.xpos*r+8,this.y=this.ypos*n+97,this.chipDisplay=new ce(20,185,e),this.defendChipDisplay=new ce(180,185,e),this.defendChipDisplay.setChip(i.defendChip.id),this.chipDisplay.setChip(this.selectedChip.id);let h=this.chipFolder[this.chipIndex].name.padEnd(12)+this.chipFolder[this.chipIndex].basedamage;this.textDisplay=new l(40,175,h,this.scene)}move(e){let t=this.xpos,s=this.ypos;1==e?this.xpos>0&&(t-=1):2==e?this.xpos<2&&(t+=1):3==e?this.ypos>0&&(s-=1):4==e&&this.ypos<2&&(s+=1),le.getInstance().isEnemyAt(t,s)||(this.moveTo(t,s),this.depth=s,this.setDelayed())}damage(e,t=0){if(super.damage(e,t),4==this.state&&this.defendAttack(),!this.invincible&&this.alive)if(this.hp=this.hp-e,0!=t&&(this.invincible=!0,this.invincibilityExpire=this.scene.time.now+t),this.hp>0){this.text.setDigits(this.hp);let e=new m(this.scene,this.xpos,this.ypos,"Blast");e.setScale(.7,.7),e.setOrigin(-.1,.5),this.play(this.animations.hurtAnimation),this.scene.sound.play("sfx:hurt"),this.setState(1)}else this.alive=!1,this.text.setDigits(0),this.scene.sound.play("sfx:blast"),Ee.delete(this),le.getInstance().setGameLevel(1),new m(this.scene,this.xpos,this.ypos,"Blast").setOrigin(.2,.5),this.setVisible(!1),Re.play("megamanDeletedBanner"),this.scene.backToMenu()}nextChip(){this.chipIndex++,this.chipIndex>=this.chipFolder.length&&(this.chipIndex=0),this.selectedChip=this.chipFolder[this.chipIndex],this.chipDisplay.setChip(this.selectedChip.id);let e=this.selectedChip.name.padEnd(12)+this.selectedChip.basedamage;this.textDisplay.setText(e),this.setDelayed()}defendAttack(){let e=[this.xpos+1,this.ypos];if(this.scene.sound.play("sfx:attackbounce"),this.invincible=!0,this.invincibilityExpire=this.scene.time.now+1500,this.state=5,new m(this.scene,this.xpos,this.ypos,"AttackBounce").setOrigin(.2,.5),"Protoman"===this.animations.texture)return this.selectedChip=de.SonicBoom,void this.prepareSlash();let t=v.createShockwaveAttack(this,e,3,f);t.setDamageAmount(20*le.getInstance().getGameLevel()),t.setDelayTime(100),t.setDirection(1),t.flipSprite()}update(){super.update(),this.return<=0&&this.scene.handleInput(this),this.return>0&&this.scene.time.now>this.return&&(this.moveTo(this.xpos-2,this.ypos),this.return=-1)}attack(){if(1==this.state&&this.scene.time.now>this.attackCooldown)switch(this.selectedChip.id){case 0:this.cannonAttack();break;case 1:this.shockwaveAttack();break;case 2:this.meteorsAttack();break;case 3:case 4:case 9:this.prepareSlash();break;case 5:this.elecPulse();break;case 6:this.setState(0),v.colonelSlash(this.scene,this,this.xpos+3,this.ypos,1,de.ColSlash.basedamage,this.targets),this.lastUsedChip=6,this.attackCooldown=this.scene.time.now+1200;break;case 7:case 8:this.stepSword();break;case 20:this.tornado()}}prepareSlash(){if(this.setState(0),this.play(this.animations.prepareSlashAnimation),4==this.selectedChip.id){this.lastUsedChip=4;let e=new m(this.scene,this.getBoardXPos(),this.getBoardYPos()-2,"LifeSwordSlash");this.scene.add.existing(e)}else 3==this.selectedChip.id?(new m(this.scene,this.getBoardXPos()+1,this.getBoardYPos(),"WideSlash").setOrigin(.1,.5),this.lastUsedChip=3):this.selectedChip.id==de.StepSword.id?(new m(this.scene,this.getBoardXPos()+1,this.getBoardYPos(),"WideSlash").setOrigin(.1,.5),this.lastUsedChip=de.StepSword.id):this.selectedChip.id==de.HeroSword.id?(new m(this.scene,this.getBoardXPos()+1,this.getBoardYPos(),"HeroSlash").setOrigin(.1,.2),this.lastUsedChip=de.HeroSword.id):this.selectedChip.id==de.StepClaw.id?this.lastUsedChip=de.StepClaw.id:this.lastUsedChip=de.SonicBoom.id;this.delay=this.scene.time.now+400}stepSword(){le.getInstance().isEnemyAt(this.xpos+2,this.ypos)||(this.moveTo(this.xpos+2,this.ypos),this.return=this.scene.time.now+600,this.prepareSlash())}elecPulse(){this.play(this.animations.swipeAnimation),this.scene.sound.play("sfx:pulse");let e=[this.xpos,this.ypos];this.targets.addTarget(-1,this.xpos+1,this.ypos),this.targets.addTarget(-1,this.xpos+2,this.ypos),this.targets.addTarget(-1,this.xpos+2,this.ypos+1),this.targets.addTarget(-1,this.xpos+2,this.ypos-1);let t=new m(this.scene,e[0],e[1],"elecPulseAnim",!0);t.setFlipX(!0),t.setOrigin(-.5,.6),this.targets.list().forEach((e=>{let t=de.ElecPulse.basedamage;le.getInstance().damageEntityAt(e.xpos,e.ypos,t,1,30)})),t.setOnAnimationComplete((()=>{this.targets.clearTargets()})),this.delay=this.scene.time.now+400,this.attackCooldown=this.scene.time.now+1200}meteorsAttack(){this.play(this.animations.swipeAnimation);for(let e=0;e<3;e++)new z([this.xpos+3,e],10,1).setDamage(de.Meteors.basedamage);this.lastUsedChip=2,this.state=2,this.scene.sound.play("sfx:meteor"),this.attackCooldown=this.scene.time.now+1e3}cannonAttack(){this.play(this.animations.cannonAnimation),this.scene.sound.play("sfx:cannon");for(let e=this.xpos+1;e<6&&!le.getInstance().damageEntityAt(e,this.ypos,de.Cannon.basedamage,1,20);e++);this.state=0,this.lastUsedChip=0,this.setDelayed()}shockwaveAttack(){this.play(this.animations.swipeAnimation);let e=[this.xpos+1,this.ypos],t=v.createShockwaveAttack(this,e,1,f);t.setDamageAmount(de.Shockwave.basedamage),t.setDelayTime(150/(le.getInstance().getGameLevel()/2)),t.setDirection(1),t.flipSprite(),this.lastUsedChip=1,this.state=2,this.attackCooldown=this.scene.time.now+600}tornado(){this.play(this.animations.swipeAnimation);let e=[this.xpos+1,this.ypos];this.scene.sound.play("sfx:tornado");let t=v.createShockwaveAttack(this,e,1,f);t.setDirection(1),t.setAnimation("bigtornado"),t.setOrigin(.09,.72),t.setDamageAmount(de.Tornado.basedamage),t.setDelayTime(200),this.state=2,this.attackCooldown=this.scene.time.now+600}defend(){if(this.scene.time.now>this.defendCooldown){this.scene.sound.play("sfx:guard"),this.state=4;let e=new m(this.scene,this.xpos,this.ypos,"guardAnimation");e.setOrigin(-1,.6),this.defendChipDisplay.dim(1500),this.defendCooldown=this.scene.time.now+1500,this.setDelayed(),e.setOnAnimationComplete((()=>{4==this.state&&(this.state=1)}))}}afterAttack(){this.hp>0&&4!=this.state&&(this.state=1)}vulcanShot(){this.play("vulcan"),this.scene.sound.play("sfx:gun"),this.setDelayed()}}class ge{loadSpriteSheets(e){e.load.spritesheet("AirMan","assets/img/AirMan.png",{frameWidth:80,frameHeight:80}),e.load.spritesheet("Airhoc","assets/img/Airhoc.png",{frameWidth:32,frameHeight:19}),e.load.spritesheet("Aura","assets/img/Aura.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("AttackBounce","assets/img/AttackBounce.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Background","assets/img/Background.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Banners","assets/img/Banners.png",{frameWidth:152,frameHeight:16}),e.load.spritesheet("BnPanels","assets/img/BnPanels.png",{frameWidth:240,frameHeight:78}),e.load.spritesheet("Bass","assets/img/Bass.png",{frameWidth:100,frameHeight:100}),e.load.spritesheet("Bass2","assets/img/Bass2.png",{frameWidth:100,frameHeight:100}),e.load.spritesheet("Bat","assets/img/Bat.png",{frameWidth:34,frameHeight:48}),e.load.spritesheet("BigTornado","assets/img/BigTornado.png",{frameWidth:50,frameHeight:72}),e.load.spritesheet("Blast","assets/img/Blast.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Boomer","assets/img/Boomer.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Boomerang","assets/img/Boomerang.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Bugshot","assets/img/Bugshot.png",{frameWidth:15,frameHeight:13}),e.load.spritesheet("Bugtank","assets/img/Bugtank.png",{frameWidth:58,frameHeight:52}),e.load.spritesheet("BusterRake","assets/img/BusterRake.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Cannon","assets/img/Cannon.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("CannonTarget","assets/img/CannonTarget.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Charge","assets/img/Charge.png",{frameWidth:44,frameHeight:44}),e.load.spritesheet("Colonel","assets/img/Colonel.png",{frameWidth:100,frameHeight:107}),e.load.spritesheet("ColSlash1","assets/img/ColSlash1.png",{frameWidth:68,frameHeight:53}),e.load.spritesheet("ColonelSoldier","assets/img/ColonelSoldier.png",{frameWidth:66,frameHeight:34}),e.load.spritesheet("Chips","assets/img/Chips.png",{frameWidth:14,frameHeight:14}),e.load.spritesheet("DarkWheel","assets/img/DarkWheel.png",{frameWidth:49,frameHeight:48}),e.load.spritesheet("Elecpulse","assets/img/Elecpulse.png",{frameWidth:85,frameHeight:80}),e.load.spritesheet("Fireball","assets/img/Fireball.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Fishy","assets/img/Fishy.png",{frameWidth:51,frameHeight:46}),e.load.spritesheet("Flame","assets/img/Flame.png",{frameWidth:32,frameHeight:64}),e.load.spritesheet("Gospel","assets/img/Gospel.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("GregarBreath","assets/img/GregarBreath.png",{frameWidth:50,frameHeight:50}),e.load.spritesheet("GuardEffect","assets/img/GuardEffect.png",{frameWidth:27,frameHeight:50}),e.load.spritesheet("GospelBoss","assets/img/GospelBoss.png",{frameWidth:93,frameHeight:125}),e.load.spritesheet("GuiIcons","assets/img/GuiIcons.png",{frameWidth:14,frameHeight:14}),e.load.spritesheet("Gutsman","assets/img/Gutsman.png",{frameWidth:88,frameHeight:68}),e.load.spritesheet("GutsPunch","assets/img/GutsPunch.png",{frameWidth:42,frameHeight:42}),e.load.spritesheet("HeroSlash","assets/img/HeroSlash.png",{frameWidth:117,frameHeight:45}),e.load.spritesheet("IceCube","assets/img/IceCube.png",{frameWidth:32,frameHeight:40}),e.load.spritesheet("Letters","assets/img/Letters.png",{frameWidth:8,frameHeight:13}),e.load.spritesheet("LifeSwordSlash","assets/img/LifeSwordSlash.png",{frameWidth:110,frameHeight:110}),e.load.spritesheet("Mettaur","assets/img/Mettaur.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("Meteor","assets/img/Meteor.png",{frameWidth:57,frameHeight:55}),e.load.spritesheet("Metfire","assets/img/Metfire.png",{frameWidth:54,frameHeight:64}),e.load.spritesheet("Megaman","assets/img/Megaman.png",{frameWidth:90,frameHeight:58}),e.load.spritesheet("Nightmare","assets/img/Nightmare.png",{frameWidth:80,frameHeight:80}),e.load.spritesheet("Numbers","assets/img/Numbers.png",{frameWidth:7,frameHeight:11}),e.load.spritesheet("Piranha","assets/img/Piranha.png",{frameWidth:50,frameHeight:54}),e.load.spritesheet("PiranhaArrow","assets/img/PiranhaArrow.png",{frameWidth:29,frameHeight:7}),e.load.spritesheet("Protoman","assets/img/Protoman.png",{frameWidth:78,frameHeight:65}),e.load.spritesheet("Pulsebulb","assets/img/Pulsebulb.png",{frameWidth:62,frameHeight:74}),e.load.spritesheet("ScreenDiv","assets/img/ScreenDiv.png",{frameWidth:126,frameHeight:80}),e.load.spritesheet("Scuttle","assets/img/Scuttle.png",{frameWidth:48,frameHeight:40}),e.load.spritesheet("Shademan","assets/img/Shademan.png",{frameWidth:124,frameHeight:117}),e.load.spritesheet("Spikey","assets/img/Spikey.png",{frameWidth:70,frameHeight:54}),e.load.spritesheet("Sensor","assets/img/Sensor.png",{frameWidth:40,frameHeight:53}),e.load.spritesheet("SensorLaser","assets/img/SensorLaser.png",{frameWidth:22,frameHeight:22}),e.load.spritesheet("Shockwave","assets/img/Shockwave.png",{frameWidth:64,frameHeight:64}),e.load.spritesheet("SmallTornado","assets/img/SmallTornado.png",{frameWidth:40,frameHeight:44}),e.load.spritesheet("Target","assets/img/Target.png",{frameWidth:40,frameHeight:25}),e.load.spritesheet("Thunder","assets/img/Thunder.png",{frameWidth:30,frameHeight:32}),e.load.spritesheet("Volgear","assets/img/Volgear.png",{frameWidth:58,frameHeight:44}),e.load.spritesheet("Warp","assets/img/Warp.png",{frameWidth:30,frameHeight:40}),e.load.spritesheet("WideSlash","assets/img/WideSlash.png",{frameWidth:37,frameHeight:71})}}class ue{loadSounds(e){e.load.audio("sfx:shockwave","assets/audio/shockwave.m4a"),e.load.audio("sfx:tornado","assets/audio/tornado.m4a"),e.load.audio("sfx:hurt","assets/audio/hurt.m4a"),e.load.audio("sfx:blast","assets/audio/blast.m4a"),e.load.audio("sfx:appear","assets/audio/appear.m4a"),e.load.audio("sfx:guard","assets/audio/guard.m4a"),e.load.audio("sfx:pause","assets/audio/pause.m4a"),e.load.audio("sfx:pulse","assets/audio/pulse.m4a"),e.load.audio("sfx:roar","assets/audio/roar.m4a"),e.load.audio("sfx:meteor","assets/audio/Meteor.m4a"),e.load.audio("sfx:meteorhit","assets/audio/MeteorHit.m4a"),e.load.audio("sfx:darkcharge","assets/audio/DarkCharge.m4a"),e.load.audio("sfx:hellzrolling","assets/audio/HellzRolling.m4a"),e.load.audio("sfx:cannon","assets/audio/cannon.m4a"),e.load.audio("sfx:attackbounce","assets/audio/attackbounce.m4a"),e.load.audio("sfx:gun","assets/audio/gun.m4a"),e.load.audio("sfx:flame","assets/audio/burn.m4a"),e.load.audio("sfx:swordswing","assets/audio/swordswing.m4a"),e.load.audio("sfx:lifesword","assets/audio/lifesword.m4a"),e.load.audio("sfx:airhoc","assets/audio/airhoc.m4a"),e.load.audio("sfx:colSlash","assets/audio/ColonelSlash.m4a"),e.load.audio("sfx:throw","assets/audio/throw.m4a"),e.load.audio("sfx:laser","assets/audio/sensor.m4a"),e.load.audio("sfx:win","assets/audio/win.m4a"),e.load.audio("sfx:fishyfly","assets/audio/fishyfly.m4a"),e.load.audio("sfx:gutsshoot","assets/audio/GutsShoot.m4a"),e.load.audio("sfx:charge","assets/audio/charge.m4a"),e.load.audio("sfx:chargecomplete","assets/audio/chargecomplete.m4a"),e.load.audio("sfx:hammer","assets/audio/Hammer.m4a"),e.load.audio("music:boss","assets/music/GreatBattleFinal.m4a"),e.load.audio("music:finalBoss","assets/music/AlphaLoop.m4a")}}class fe{loadAnimations(e){(class{static createAnimations(e){e.anims.create({key:"shockwaveAnim",frameRate:10,frames:e.anims.generateFrameNumbers("Shockwave",{start:1,end:3}),repeat:-1}),e.anims.create({key:"swordyidle",frameRate:1,frames:[{key:"Swordy",frame:"idle.png"}],repeat:0}),e.anims.create({key:"swordyslash",frames:[{key:"Swordy",frame:"slash1.png"},{key:"Swordy",frame:"slash2.png"},{key:"Swordy",frame:"slash3.png"},{key:"Swordy",frame:"slash4.png"},{key:"Swordy",frame:"slash5.png"},{key:"Swordy",frame:"slash6.png"}],repeat:0}),e.anims.create({key:"swordyrecover",frameRate:18,frames:[{key:"Swordy",frame:"slash7.png"},{key:"Swordy",frame:"slash8.png"},{key:"Swordy",frame:"slash9.png"},{key:"Swordy",frame:"slash9.png"},{key:"Swordy",frame:"slash9.png"},{key:"Swordy",frame:"slash9.png"},{key:"Swordy",frame:"idle.png"}],repeat:0}),e.anims.create({key:"swordyswipe",frameRate:18,frames:[{key:"Swordy",frame:"slash1.png"},{key:"Swordy",frame:"slash2.png"},{key:"Swordy",frame:"slash3.png"},{key:"Swordy",frame:"slash4.png"},{key:"Swordy",frame:"slash5.png"},{key:"Swordy",frame:"slash6.png"},{key:"Swordy",frame:"slash7.png"},{key:"Swordy",frame:"slash8.png"},{key:"Swordy",frame:"slash9.png"},{key:"Swordy",frame:"slash9.png"},{key:"Swordy",frame:"slash9.png"},{key:"Swordy",frame:"slash9.png"},{key:"Swordy",frame:"idle.png"}],repeat:0}),e.anims.create({key:"airmanAttack",frameRate:15,frames:e.anims.generateFrameNumbers("AirMan",{frames:[4,3,2,1]}),repeat:0}),e.anims.create({key:"airmanSwipe",frameRate:15,frames:e.anims.generateFrameNumbers("AirMan",{frames:[4,3,2,1,1,1,5]}),repeat:0}),e.anims.create({key:"airmanRecover",frameRate:15,frames:e.anims.generateFrameNumbers("AirMan",{frames:[1,0]}),repeat:0}),e.anims.create({key:"airmanHurt",frameRate:10,frames:e.anims.generateFrameNumbers("AirMan",{frames:[6,6,5]}),repeat:0}),e.anims.create({key:"airmanCooldown",frameRate:5,frames:e.anims.generateFrameNumbers("AirMan",{frames:[0,0,0]}),repeat:0}),e.anims.create({key:"bat",frameRate:9,frames:e.anims.generateFrameNumbers("Bat",{frames:[0,1,2,3]}),repeat:-1}),e.anims.create({key:"bassAttack1",frameRate:15,frames:e.anims.generateFrameNumbers("Bass",{frames:[4,5,6,7,8]}),repeat:0}),e.anims.create({key:"bassAttack2",frameRate:15,frames:e.anims.generateFrameNumbers("Bass",{frames:[9,10]}),repeat:0}),e.anims.create({key:"bassIdle",frameRate:5,frames:e.anims.generateFrameNumbers("Bass",{frames:[0,1,2,3]}),repeat:-1}),e.anims.create({key:"bassCharge",frameRate:10,frames:e.anims.generateFrameNumbers("Bass",{frames:[11,12,11,12,13]}),repeat:0}),e.anims.create({key:"bigtornado",frameRate:9,frames:e.anims.generateFrameNumbers("BigTornado",{frames:[0,1,2]}),repeat:-1}),e.anims.create({key:"smalltornado",frameRate:9,frames:e.anims.generateFrameNumbers("SmallTornado",{frames:[0,1,2,3]}),repeat:-1}),e.anims.create({key:"fireballAnim",frameRate:4,frames:e.anims.generateFrameNumbers("Fireball",{frames:[0,1,2]}),repeat:-1}),e.anims.create({key:"elecPulseAnim",frameRate:10,frames:e.anims.generateFrameNumbers("Elecpulse",{frames:[0,1,2]}),repeat:3}),e.anims.create({key:"SensorLaserAnim",frameRate:9,frames:e.anims.generateFrameNumbers("SensorLaser",{frames:[0,1,2,3]}),repeat:-1}),e.anims.create({key:"colonelPrepareAttack",frameRate:12,frames:e.anims.generateFrameNumbers("Colonel",{frames:[6,6,6,6,5,4]})}),e.anims.create({key:"colonelSlash",frameRate:15,frames:e.anims.generateFrameNumbers("Colonel",{frames:[3,2,1]})}),e.anims.create({key:"gospelAnimation",frameRate:15,frames:e.anims.generateFrameNumbers("Gospel",{frames:[0]})}),e.anims.create({key:"shademanidle",frameRate:6,frames:e.anims.generateFrameNumbers("Shademan",{frames:[0,1,2,1]}),repeat:-1}),e.anims.create({key:"shademanslash",frameRate:10,frames:e.anims.generateFrameNumbers("Shademan",{frames:[0,1,6,6,7]}),repeat:0}),e.anims.create({key:"shademanrecover",frameRate:10,frames:e.anims.generateFrameNumbers("Shademan",{frames:[8,9,10,0,1,2]}),repeat:0}),e.anims.create({key:"shademanpulsecomplete",frameRate:10,frames:e.anims.generateFrameNumbers("Shademan",{frames:[5,5,5,0,1,2]}),repeat:0}),e.anims.create({key:"shademanattack",frameRate:8,frames:e.anims.generateFrameNumbers("Shademan",{frames:[3,3,4,5]}),repeat:0}),e.anims.create({key:"shademanhurt",frameRate:8,frames:e.anims.generateFrameNumbers("Shademan",{frames:[11,11,0]}),repeat:0}),e.anims.create({key:"colSlash1",frameRate:12,frames:e.anims.generateFrameNumbers("ColSlash1",{start:0,end:2}),repeat:0}),e.anims.create({key:"battleStartBanner",frameRate:10,frames:e.anims.generateFrameNumbers("Banners",{frames:[2,1,0,0,0,0,0,0,0,0,0,0,1,2]}),repeat:0}),e.anims.create({key:"enemyDeletedBanner",frameRate:10,frames:e.anims.generateFrameNumbers("Banners",{frames:[5,4,3,3,3,3,3,3,3,3,3,3,4,5]}),repeat:0}),e.anims.create({key:"megamanDeletedBanner",frameRate:10,frames:e.anims.generateFrameNumbers("Banners",{frames:[8,7,6,6,6,6,6,6,6,6,6,6,7,8]}),repeat:0}),e.anims.create({key:"fishyfly",frameRate:9,frames:e.anims.generateFrameNumbers("Fishy",{frames:[4,5,6]}),repeat:-1}),e.anims.create({key:"formIceCube",frameRate:15,frames:e.anims.generateFrameNumbers("IceCube",{frames:[0,1,2,3,4,5]}),repeat:0}),e.anims.create({key:"cannonAttack",frameRate:10,frames:e.anims.generateFrameNumbers("Cannon",{frames:[1,2,3,4,0]}),repeat:0}),e.anims.create({key:"volgearIdle",frameRate:10,frames:e.anims.generateFrameNumbers("Volgear",{frames:[0,1,2,3]}),repeat:-1}),e.anims.create({key:"volgearAttack",frameRate:12,frames:e.anims.generateFrameNumbers("Volgear",{frames:[4,5,6,5,6]}),repeat:0}),e.anims.create({key:"volgearAttackFinish",frameRate:12,frames:e.anims.generateFrameNumbers("Volgear",{frames:[5,6,5,6,7,8,9]}),repeat:0}),e.anims.create({key:"boomerAttack",frameRate:16,frames:e.anims.generateFrameNumbers("Boomer",{start:0,end:2}),repeat:0}),e.anims.create({key:"boomerRecover",frameRate:16,frames:e.anims.generateFrameNumbers("Boomer",{start:2,end:0}),repeat:0}),e.anims.create({key:"SensorIdle",frameRate:3,frames:e.anims.generateFrameNumbers("Sensor",{frames:[5,4,3,2,3,4,5]}),repeat:-1}),e.anims.create({key:"SensorAttack",frameRate:5,frames:e.anims.generateFrameNumbers("Sensor",{frames:[0,1]}),repeat:0}),e.anims.create({key:"pulseBulbIdle",frameRate:8,frames:e.anims.generateFrameNumbers("Pulsebulb",{start:0,end:4}),repeat:-1}),e.anims.create({key:"pulseBulbAttack",frameRate:10,frames:e.anims.generateFrameNumbers("Pulsebulb",{frames:[4,4,4,5,6,7]}),repeat:0}),e.anims.create({key:"pulseBulbReturn",frameRate:16,frames:e.anims.generateFrameNumbers("Pulsebulb",{start:7,end:5}),repeat:0}),e.anims.create({key:"PiranhaIdle",frameRate:10,frames:e.anims.generateFrameNumbers("Piranha",{frames:[9,8,7,6]}),repeat:-1}),e.anims.create({key:"PiranhaAttack",frameRate:10,frames:e.anims.generateFrameNumbers("Piranha",{frames:[3,2]}),repeat:0}),e.anims.create({key:"PiranhaRecover",frameRate:10,frames:e.anims.generateFrameNumbers("Piranha",{frames:[1,0]}),repeat:0}),e.anims.create({key:"nightmarerecover",frameRate:10,frames:e.anims.generateFrameNumbers("Nightmare",{frames:[0,5,4,3]}),repeat:0}),e.anims.create({key:"nightmareslash",frameRate:10,frames:e.anims.generateFrameNumbers("Nightmare",{frames:[2,2,2,2,1]}),repeat:0}),e.anims.create({key:"nightmareidle",frameRate:5,frames:e.anims.generateFrameNumbers("Nightmare",{frames:[3,4,5]}),repeat:-1}),e.anims.create({key:"metfireIdle",frameRate:10,frames:e.anims.generateFrameNumbers("Metfire",{frames:[2,3,4,5]}),repeat:-1}),e.anims.create({key:"metfireAttack",frameRate:5,frames:e.anims.generateFrameNumbers("Metfire",{frames:[0,1]}),repeat:-1}),e.anims.create({key:"SpikeyIdle",frameRate:5,frames:e.anims.generateFrameNumbers("Spikey",{frames:[0,1,2,3]}),repeat:-1}),e.anims.create({key:"SpikeyAttack",frameRate:15,frames:e.anims.generateFrameNumbers("Spikey",{frames:[4,5,6]}),repeat:0}),e.anims.create({key:"GutsPunch",frameRate:12,frames:e.anims.generateFrameNumbers("Gutsman",{frames:[1,2,3]}),repeat:0}),e.anims.create({key:"GutsHammer",frameRate:12,frames:e.anims.generateFrameNumbers("Gutsman",{frames:[4,5,6]}),repeat:0}),e.anims.create({key:"AuraAnim",frameRate:8,frames:e.anims.generateFrameNumbers("Aura",{frames:[0,1,2]}),repeat:-1}),e.anims.create({key:"BugtankIdle",frameRate:8,frames:e.anims.generateFrameNumbers("Bugtank",{frames:[0,1,2]}),repeat:-1}),e.anims.create({key:"BugtankAttack",frameRate:8,frames:e.anims.generateFrameNumbers("Bugtank",{frames:[3,4,5]}),repeat:0}),e.anims.create({key:"BugtankAttackComplete",frameRate:8,frames:e.anims.generateFrameNumbers("Bugtank",{frames:[6,7,0]}),repeat:0}),e.anims.create({key:"BugshotAnim",frameRate:8,frames:e.anims.generateFrameNumbers("Bugshot",{frames:[0,1,2,3]}),repeat:-1}),e.anims.create({key:"ColonelSoldierAppear",frameRate:8,frames:e.anims.generateFrameNumbers("ColonelSoldier",{frames:[0,1,2,3]}),repeat:0}),e.anims.create({key:"ColonelSoldierAttack",frameRate:8,frames:e.anims.generateFrameNumbers("ColonelSoldier",{frames:[4,5]}),repeat:0}),e.anims.create({key:"ColonelSoldierRetreat",frameRate:8,frames:e.anims.generateFrameNumbers("ColonelSoldier",{frames:[2,1,0]}),repeat:0}),e.anims.create({key:"ThunderAnim",frameRate:12,frames:e.anims.generateFrameNumbers("Thunder",{frames:[0,1,2,3,4,5,6,7,8]}),repeat:-1}),e.anims.create({key:"TargetFlash",frameRate:6,frames:e.anims.generateFrameNumbers("Target",{frames:[0,1]}),repeat:-1}),e.anims.create({key:"DarkWheel",frameRate:12,frames:e.anims.generateFrameNumbers("DarkWheel",{frames:[2,1,0]}),repeat:-1}),e.anims.create({key:"Charge",frameRate:10,frames:e.anims.generateFrameNumbers("Charge",{frames:[0,1,2]}),repeat:3}),e.anims.create({key:"ChargeComplete",frameRate:10,frames:e.anims.generateFrameNumbers("Charge",{frames:[3,4,5,6]}),repeat:-1}),e.anims.create({key:"hurt",frameRate:9,frames:e.anims.generateFrameNumbers("Megaman",{frames:[8,9,10,0]}),repeat:0}),e.anims.create({key:"cannon",frameRate:20,frames:e.anims.generateFrameNumbers("Megaman",{frames:[1,2,3,4,5,6,7,0]}),repeat:0}),e.anims.create({key:"swordwindup",frameRate:15,frames:e.anims.generateFrameNumbers("Megaman",{frames:[14,15]}),repeat:0}),e.anims.create({key:"slash",frameRate:15,frames:e.anims.generateFrameNumbers("Megaman",{frames:[16,17,18,0]}),repeat:0}),e.anims.create({key:"swipe",frameRate:15,frames:e.anims.generateFrameNumbers("Megaman",{frames:[11,12,13,13,13,0]}),repeat:0}),e.anims.create({key:"vulcan",frameRate:25,frames:e.anims.generateFrameNumbers("Megaman",{frames:[20,21,22,23]}),repeat:0}),e.anims.create({key:"protoslash",frameRate:15,frames:e.anims.generateFrameNumbers("Protoman",{frames:[3,4,5,6,0]}),repeat:0}),e.anims.create({key:"protowindup",frameRate:15,frames:e.anims.generateFrameNumbers("Protoman",{frames:[1,2]}),repeat:0}),e.anims.create({key:"protorecover",frameRate:15,frames:e.anims.generateFrameNumbers("Protoman",{frames:[3,4,5,6,0]}),repeat:0}),e.anims.create({key:"protohurt",frameRate:10,frames:e.anims.generateFrameNumbers("Protoman",{frames:[7,7,7,8,9,10,0]}),repeat:0})}}).createAnimations(e),function(e){e.anims.create({key:"mettaur1Attack",frameRate:16,frames:e.anims.generateFrameNumbers("Mettaur",{start:1,end:5}),repeat:0}),e.anims.create({key:"mettaur1Recover",frameRate:16,frames:e.anims.generateFrameNumbers("Mettaur",{frames:[6,7,0]}),repeat:0}),e.anims.create({key:"mettaur1Swipe",frameRate:16,frames:e.anims.generateFrameNumbers("Mettaur",{frames:[1,2,3,4,5,6,7,0]}),repeat:0})}(e)}}class ye extends Phaser.GameObjects.Sprite{constructor(e){super(e,138,90,"Banners"),this.scene.add.existing(this),this.setDepth(10),this.on("animationcomplete",(()=>{this.setVisible(!1)})),this.on("animationstart",(()=>{this.setVisible(!0)}))}}class ve extends Phaser.GameObjects.Sprite{constructor(e,t,s){let a=0,i=0;t<6&&(a=20+60*t,i=65);let r=s;super(e,a,i,r),"MegamanDS"===r&&this.setTexture("Megaman");let n=I(s);this.setOrigin(...n),this.boundRect=new Phaser.GameObjects.Rectangle(e,a+20,i,50,60,10724259,.4),this.boundRect.setDepth(-1),this.boundRect.setInteractive(),this.boundRect.on("pointerdown",(()=>{let t=te.createEnemy(r,{scene:e,x:4,y:1});t.setLevel(1),Ee.add(t)})),e.add.existing(this.boundRect),e.add.existing(this)}remove(){this.boundRect.destroy(),this.destroy()}}class we{constructor(e){this.page=0,this.pageSize=4,this.spawnEnemyButtons=Array(),this.scene=e,this.prepareUi()}prepareUi(){let e=0;this.spawnEnemyButtons.length>1&&(this.spawnEnemyButtons.forEach((e=>{e.remove()})),this.spawnEnemyButtons.length=0),Q.slice(this.page*this.pageSize,(this.page+1)*this.pageSize).forEach((t=>{let s=new ve(this.scene,e,t);this.spawnEnemyButtons.push(s),e++}))}}const ke={slashAnimation:"slash",recoverAnimation:"slash",swipeAnimation:"swipe",prepareSlashAnimation:"swordwindup",hurtAnimation:"hurt",texture:"Megaman",cannonAnimation:"cannon",originX:-.05,originY:.7,defendChip:de.Guard,chipFolder:[de.Cannon,de.LifeSword,de.Shockwave]},xe={slashAnimation:"protoslash",recoverAnimation:"protorecover",swipeAnimation:"protoslash",prepareSlashAnimation:"protowindup",hurtAnimation:"protohurt",texture:"Protoman",cannonAnimation:"protoslash",originX:.1,originY:.7,defendChip:de.SonicBoom,chipFolder:[de.WideSword,de.HeroSword,de.StepSword]},Se={slashAnimation:"airmanAttack",recoverAnimation:"airmanRecover",swipeAnimation:"airmanSwipe",prepareSlashAnimation:"airmanAttack",hurtAnimation:"airmanHurt",texture:"AirMan",cannonAnimation:"airmanAttack",originX:.1,originY:.7,flip:!0,defendChip:de.Guard,chipFolder:[de.Tornado]},be={slashAnimation:"shademanslash",recoverAnimation:"shademanrecover",swipeAnimation:"shademanattack",prepareSlashAnimation:"shademanslash",hurtAnimation:"shademanhurt",texture:"Shademan",cannonAnimation:"shademanattack",originX:.32,originY:.7,flip:!0,defendChip:de.Guard,chipFolder:[de.ElecPulse,de.StepClaw,de.Shockwave]};var Ae;let Te,De,Be,Ce=0,Pe=Array();class Fe{}let Re,Ie,Ee=new Set;class Le extends Phaser.Scene{constructor(){super({key:"MainScene"}),Le.mainScene=this}backToMenu(){this.time.delayedCall(3e3,(()=>{this.sound.stopAll(),le.getInstance().cleanupBoard(),this.clearEnemyDisplays(),this.scene.start("MenuScene")}))}static get(){return Le.mainScene}preload(){console.log("Loading assets.");let e=new ge,t=new ue;e.loadSpriteSheets(this),t.loadSounds(this)}create(e){(new fe).loadAnimations(this),Ie=new i(this,0,0),Re=new ye(this),this.debug=e.debug,this.presses=0,this.cameras.main.on("camerafadeoutcomplete",(()=>this.fadein())),this.cameras.main.on("camerafadeincomplete",(()=>le.getInstance().prepareNextRound(this))),this.sys.game.device.os.desktop||this.createTouchScreenControls(),new l(200,175,"Defend",this),0==e.debug?(this.addTopRightDisplay("Battle 1"),le.getInstance().setGameLevel(e.startLevel),le.getInstance().prepareNextRound(this),this.sound.stopByKey("music:battle"),this.time.delayedCall(300,(()=>{b()}))):(this.sound.stopByKey("music:battle"),le.getInstance().setEnemyCount(-9999),De=new we(this),this.time.delayedCall(300,(()=>{b()})));var t=new Phaser.GameObjects.Sprite(this,40,13,"mmbnface");t.setFrame(e.character),this.add.existing(t),Be=1==e.character?new pe(this,1,1,e.debug,xe):2==e.character?new pe(this,1,1,e.debug,Se):3==e.character?new pe(this,1,1,e.debug,be):new pe(this,1,1,e.debug,ke),Ee.add(Be),Re.play("battleStartBanner"),Be.setHP(Be.hp+100*(le.getInstance().getGameLevel()-1)),Ae=this.input.keyboard.addKeys("left,right,up,down,enter,shift,c,z,x,d,s,h,l,n,m"),this.game.events.on("blur",(()=>{Te=!0,this.anims.pauseAll()})),this.game.events.on("hidden",(()=>{Te=!0,this.anims.pauseAll()})),T.getInstance().register(this)}addTopRightDisplay(e){let t=Pe.length,s=new l(180,13*t,e,this);Pe.push(s)}animateTopRightDisplay(){Pe.forEach((e=>{e.animate()}))}clearEnemyDisplays(){Pe.forEach((e=>{e.destroy()})),Pe=[]}update(){Te?this.moveDebugSprite():Ee.forEach((e=>{e.update(),Ae.s.isDown&&this.debug&&this.time.now>Ce&&(le.destroyAllEnemies(),Ce=this.time.now+500)})),Ae.enter.isDown&&this.time.now>Ce&&(Te=!Te,this.sound.play("sfx:pause"),Te?this.anims.pauseAll():this.anims.resumeAll(),Ce=this.time.now+500)}handleInput(e){0!=e.state&&4!=e.state&&this.time.now>e.delay&&this.megamanActions()}moveDebugSprite(){if(Fe.e&&Fe.e.active)if(Ae.d.isDown)Ae.left.isDown?Fe.e.setOrigin(Fe.e.originX-.01,Fe.e.originY):Ae.right.isDown?Fe.e.setOrigin(Fe.e.originX+.01,Fe.e.originY):Ae.up.isDown?Fe.e.setOrigin(Fe.e.originX,Fe.e.originY-.01):Ae.down.isDown&&Fe.e.setOrigin(Fe.e.originX,Fe.e.originY+.01);else if(Ae.h.isDown&&this.time.now>Ce){Ae.up.isDown?Fe.e.adjustHue(Fe.e.currentHue+.1):Ae.down.isDown?Fe.e.adjustHue(Fe.e.currentHue-.1):Ae.left.isDown?Fe.e.adjustSaturation(Fe.e.currentSat+.1):Ae.right.isDown&&Fe.e.adjustSaturation(Fe.e.currentSat-.1),Fe.e.readjust();let e=Fe.e;console.log("HUE: "+e.currentHue),Ce=this.time.now+100}else if(Ae.l.isDown&&this.time.now>Ce){if(Fe.e instanceof H){let e=Fe.e;Ae.up.isDown?e.setLevel(e.level+1):Ae.down.isDown&&e.setLevel(e.level-1)}Ce=this.time.now+100}Ae.n.isDown&&this.time.now>Ce?(De.page--,De.prepareUi(),Ce=this.time.now+100):Ae.m.isDown&&this.time.now>Ce&&(De.page++,De.prepareUi(),Ce=this.time.now+100)}megamanActions(){Ae.left.isDown?Be.move(1):Ae.right.isDown?Be.move(2):Ae.up.isDown?Be.move(3):Ae.down.isDown?Be.move(4):Ae.z.isDown?Be.attack():Ae.x.isDown?Be.nextChip():Ae.c.isDown&&Be.defend()}createTouchScreenControls(){for(let e=0;e<3;e++)for(let t=0;t<3;t++){let s=new Phaser.GameObjects.Rectangle(this,29+e*r,109+t*n,r,n);this.add.existing(s),s.setInteractive(),s.on("pointerdown",(()=>{le.getInstance().isEnemyAt(e,t)||Be.moveTo(e,t)})),s.setDepth(10)}let e=new Phaser.GameObjects.Rectangle(this,189,134,120,75);e.setDepth(10),e.setInteractive(),e.on("pointerdown",(()=>{Be.attack()})),this.add.existing(e);let t=new Phaser.GameObjects.Rectangle(this,80,187,150,20,4304959,.4);t.setDepth(10),t.setInteractive(),t.on("pointerdown",(()=>{Be.nextChip()})),this.add.existing(t);let s=new Phaser.GameObjects.Rectangle(this,220,187,65,20,12893997,.4);s.setDepth(10),s.setInteractive(),s.on("pointerdown",(()=>{Be.defend()})),this.add.existing(s)}fadeOutScene(){this.cameras.main.fadeOut(600)}fadein(){this.sound.play("sfx:woosh",{volume:1}),this.cameras.main.fadeIn(500,0,0,0)}}class He extends Phaser.Scene{constructor(){super({key:"MenuScene"}),this.selectedCharacter=0}create(){var e;let t=null!==(e=localStorage.getItem("character"))&&void 0!==e?e:"0";this.selectedCharacter=parseInt(t);let s=new Phaser.GameObjects.Sprite(this,128,94,"menubackground");this.add.existing(s);let a=c.createText(10,120,"Easy",this);this.createSoundSettingsButton(),a.setInteractive(this),a.on("pointerdown",(()=>{this.play(!1,1)}));let i=c.createText(150,120,"Normal",this);i.setInteractive(this),i.on("pointerdown",(()=>{this.play(!1,2)}));let r=c.createText(10,160,"Hard",this);r.setInteractive(this),r.on("pointerdown",(()=>{this.play(!1,3)}));let n=c.createText(150,160,"Practice",this);n.setInteractive(this),n.on("pointerdown",(()=>{this.play(!0,1)}));let h=new Phaser.GameObjects.Sprite(this,40,10,"mmbnface");h.setInteractive(new Phaser.Geom.Rectangle(0,0,h.width,h.height),Phaser.Geom.Rectangle.Contains),h.setFrame(this.selectedCharacter),h.on("pointerdown",(()=>{this.selectedCharacter+=1,this.selectedCharacter>3&&(this.selectedCharacter=0),this.sound.play("sfx:select"),localStorage.setItem("character",this.selectedCharacter+""),h.setFrame(this.selectedCharacter)})),this.add.existing(h),this.sound.play("music:battle",{loop:!0}),this.input.keyboard.addKeys("left,right,up,down,enter,z,d,s")}createSoundSettingsButton(){let e=new Phaser.GameObjects.Sprite(this,245,10,"GuiIcons");e.setFrame(0),e.setInteractive(new Phaser.Geom.Rectangle(0,0,e.width,e.height),Phaser.Geom.Rectangle.Contains),this.add.existing(e),e.on("pointerdown",(()=>{this.sound.stopByKey("music:battle"),S.musicMuted=!0,e.setFrame(1)}))}unhighlight(e){e.setColor("white")}highlight(e){e.setColor("lightblue")}play(e,t){this.sound.play("sfx:woosh",{volume:1}),this.sound.stopByKey("music:battle"),this.scene.start("MainScene",{debug:e,startLevel:t,character:this.selectedCharacter})}}class Me extends Phaser.Scene{constructor(){super({key:"PreloadScene"})}preload(){const e=s(682);this.load.image("phaser-logo","assets/img/phaser-logo.png"),this.load.image("menubackground","assets/img/menubg.png"),this.load.spritesheet("mmbnface","assets/img/MMBNFace.png",{frameWidth:80,frameHeight:16}),this.load.spritesheet("GuiIcons","assets/img/GuiIcons.png",{frameWidth:14,frameHeight:14}),this.load.atlas("Swordy","assets/img/swordy.png","assets/img/swordy.json"),this.load.audio("music:battle",e.battleTrack),this.load.spritesheet("Letters","assets/img/Letters.png",{frameWidth:8,frameHeight:13}),this.load.audio("sfx:select","assets/audio/select.m4a"),this.load.audio("sfx:woosh","assets/audio/woosh.m4a"),this.game.sound.volume=.5}create(){this.scene.start("MenuScene")}}var Ge=s(79);const Oe={type:Phaser.WEBGL,backgroundColor:"#000000",pixelArt:!0,autoCenter:Phaser.Scale.CENTER_BOTH,scale:{parent:"phaser-game",mode:Phaser.Scale.FIT,width:256,height:200},scene:[Me,He,Le],plugins:{global:[{key:"rexHSLAdjustPipeline",plugin:Ge.Z,start:!0}]}};window.addEventListener("load",(()=>{new Phaser.Game(Oe)}))},204:()=>{console.log("%c %c %c %c %c Built using phaser-project-template %c https://github.com/yandeu/phaser-project-template","background: #ff0000","background: #ffff00","background: #00ff00","background: #00ffff","color: #fff; background: #000000;","background: none")},682:e=>{"use strict";e.exports=JSON.parse('{"battleTrack":"assets/music/RegBattle6.m4a"}')}},s={};function a(e){var i=s[e];if(void 0!==i)return i.exports;var r=s[e]={exports:{}};return t[e].call(r.exports,r,r.exports,a),r.exports}a.m=t,e=[],a.O=(t,s,i,r)=>{if(!s){var n=1/0;for(l=0;l<e.length;l++){for(var[s,i,r]=e[l],h=!0,o=0;o<s.length;o++)(!1&r||n>=r)&&Object.keys(a.O).every((e=>a.O[e](s[o])))?s.splice(o--,1):(h=!1,r<n&&(n=r));if(h){e.splice(l--,1);var m=i();void 0!==m&&(t=m)}}return t}r=r||0;for(var l=e.length;l>0&&e[l-1][2]>r;l--)e[l]=e[l-1];e[l]=[s,i,r]},a.d=(e,t)=>{for(var s in t)a.o(t,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={179:0};a.O.j=t=>0===e[t];var t=(t,s)=>{var i,r,[n,h,o]=s,m=0;if(n.some((t=>0!==e[t]))){for(i in h)a.o(h,i)&&(a.m[i]=h[i]);if(o)var l=o(a)}for(t&&t(s);m<n.length;m++)r=n[m],a.o(e,r)&&e[r]&&e[r][0](),e[n[m]]=0;return a.O(l)},s=self.webpackChunkphaser_project_template=self.webpackChunkphaser_project_template||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})(),a.O(void 0,[216],(()=>a(228)));var i=a.O(void 0,[216],(()=>a(204)));i=a.O(i)})();