diff --git a/client/src/scenes/combat.skills.js b/client/src/scenes/combat.skills.js index 2f03dce6..5509948d 100644 --- a/client/src/scenes/combat.skills.js +++ b/client/src/scenes/combat.skills.js @@ -67,10 +67,9 @@ class CombatSkills extends Phaser.Scene { if (!shouldUpdate) return false; + this.phase = game.phase; if (game.phase === 'Skill') return this.renderSkillPhase(game); if (game.phase === 'Target') return this.renderTargetPhase(game); - - return this.scene.sleep(); } renderSkillPhase(game) { @@ -78,8 +77,8 @@ class CombatSkills extends Phaser.Scene { const addSkill = (i, j, skill, cryp) => { const skillTextPos = skillTextPosition(i, j + 2); - const skillObj = new CrypSkill(scene, skillTextPos[0], skillTextPos[1], skill, cryp); - this.add(skillObj); + const skillObj = new CrypSkill(this, skillTextPos[0], skillTextPos[1], skill, cryp); + this.add.existing(skillObj); }; const team = game.teams.find(t => t.id === account.id); @@ -88,7 +87,7 @@ class CombatSkills extends Phaser.Scene { const namePos = skillTextPosition(i, 0); // Draw the cryp name - this.add(new CrypName(scene, namePos[0], namePos[1], cryp)); + this.add.existing(new CrypName(this, namePos[0], namePos[1], cryp)); // return early if KOd if (cryp.hp.base === 0) return true; @@ -112,21 +111,21 @@ class CombatSkills extends Phaser.Scene { // Draw the cryp name const namePos = skillTextPosition(i, 0); - this.add(new CrypName(scene, namePos[0], namePos[1], cryp)); + this.add.existing(new CrypName(this, namePos[0], namePos[1], cryp)); const skillPos = skillTextPosition(i, 2); - const skillObj = new CrypSkill(scene, skillPos[0], skillPos[1], skill, cryp); - this.add(skillObj); + const skillObj = new CrypSkill(this, skillPos[0], skillPos[1], skill, cryp); + this.add.existing(skillObj); }); return true; } - crypKeyHandler(cryp, iter) { - if (CRYP_KEY_MAP[iter]) { - this.input.keyboard.removeListener(CRYP_KEY_MAP[iter]); + crypKeyHandler(cryp, i) { + if (CRYP_KEY_MAP[i]) { + this.input.keyboard.removeListener(CRYP_KEY_MAP[i]); if (cryp.skills.length > 0) { // check there are cryp skills - this.input.keyboard.on(CRYP_KEY_MAP[iter], () => { + this.input.keyboard.on(CRYP_KEY_MAP[i], () => { SKILL_KEY_MAP.forEach(k => this.input.keyboard.removeListener(k)); cryp.skills.forEach((skill, i) => { this.input.keyboard.on(SKILL_KEY_MAP[i], () => {