From 681b9dab4efabb95cec4e519e812827494eaecd8 Mon Sep 17 00:00:00 2001 From: Mashy Date: Tue, 4 Dec 2018 20:26:17 +1000 Subject: [PATCH] remove team check fixed scene swap --- client/src/events.js | 24 +++++++++++++----------- client/src/scenes/combat.js | 5 +---- client/src/scenes/cryp.list.js | 8 +++++++- client/src/scenes/statsheet.js | 2 ++ 4 files changed, 23 insertions(+), 16 deletions(-) mode change 100644 => 100755 client/src/events.js diff --git a/client/src/events.js b/client/src/events.js old mode 100644 new mode 100755 index f554ebe5..9029738a --- a/client/src/events.js +++ b/client/src/events.js @@ -42,20 +42,22 @@ function registerEvents(registry, events) { events.on('SEND_ACTIVE_SKILL', function skillActive(cryp) { const activeSkill = registry.get('activeSkill'); const game = registry.get('game'); + const ws = registry.get('ws'); if (activeSkill) { - const target = activeSkill.cryp.account === cryp.account; - if (!target) { - const ws = registry.get('ws'); - if (game.phase === 'Skill') { - ws.sendGameSkill(game.id, activeSkill.cryp.id, cryp.account, activeSkill.skill.skill); - } else if (game.phase === 'Target') { - ws.sendGameTarget(game.id, cryp.id, activeSkill.skill.id); - } - activeSkill.setTint(0xff0000); - } else { - activeSkill.clearTint(); + // const friendlyTarget = activeSkill.cryp.account === cryp.account; + // if (!friendlyTarget) { + if (game.phase === 'Skill') { + ws.sendGameSkill(game.id, activeSkill.cryp.id, cryp.account, activeSkill.skill.skill); + } else if (game.phase === 'Target') { + ws.sendGameTarget(game.id, cryp.id, activeSkill.skill.id); } + activeSkill.setTint(0xff0000); registry.set('activeSkill', null); + // } else if (friendlyTarget && activeSkill.skill.self_targeting) { + // ws.sendGameSkill(game.id, activeSkill.cryp.id, null, activeSkill.skill.skill); + // } else { + // activeSkill.clearTint(); + // } } }); diff --git a/client/src/scenes/combat.js b/client/src/scenes/combat.js index 8a4e4fdb..4471fc1f 100755 --- a/client/src/scenes/combat.js +++ b/client/src/scenes/combat.js @@ -104,10 +104,7 @@ class Combat extends Phaser.Scene { } // update log // shallow copy because reverse mutates - const content = Array.from(game.log).reverse().join('\n'); - // this.log.setText(Array.from(game.log).reverse()); - console.log(this.log); - this.log.setText(content); + this.log.setText(Array.from(game.log).reverse()); // has the phase changed? const phaseChange = (this.registry.get('gamePhase') === game.phase); if (phaseChange) return false; diff --git a/client/src/scenes/cryp.list.js b/client/src/scenes/cryp.list.js index 77431da5..2dae4def 100755 --- a/client/src/scenes/cryp.list.js +++ b/client/src/scenes/cryp.list.js @@ -11,8 +11,14 @@ class CrypList extends Phaser.Scene { } create() { + this.registry.events.off('changedata', this.updateData, this); + this.registry.events.off('setdata', this.updateData, this); this.registry.events.on('changedata', this.updateData, this); this.registry.events.on('setdata', this.updateData, this); + if (this.registry.get('cryps')) { + this.renderList(); + this.renderGameList(); + } return true; } @@ -60,7 +66,7 @@ class CrypList extends Phaser.Scene { if (cryp) { this.scene.add('StatSheet', StatSheet); this.scene.run('StatSheet', { cryp }); - this.scene.sleep(); + this.scene.stop(); } return true; } diff --git a/client/src/scenes/statsheet.js b/client/src/scenes/statsheet.js index 89f42311..71fc66be 100755 --- a/client/src/scenes/statsheet.js +++ b/client/src/scenes/statsheet.js @@ -20,6 +20,8 @@ class StatSheet extends Phaser.Scene { this.cryp = cryp; this.stats = new Stats(this, cryp); this.addControls(cryp); + this.addSkills(cryp); + this.skills = true; } addControls(cryp) {