From d7f4400a1bc10115bb8d25ad2e26769c2b640584 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 31 Dec 2018 17:07:17 +1100 Subject: [PATCH] status text --- client/src/events.js | 12 +++--------- client/src/scenes/combat.cryps.js | 15 +++++---------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/client/src/events.js b/client/src/events.js index c8d6819b..defb0bc3 100644 --- a/client/src/events.js +++ b/client/src/events.js @@ -44,16 +44,10 @@ function registerEvents(registry, events, tutorial) { registry.set('crypStatusUpdate', { id, skill, target }); } - events.on('SEND_SKILL', function skillActive(gameId, crypId, targetTeamId, skill) { + events.on('SEND_SKILL', function skillActive(gameId, crypId, targetCrypId, skill) { const ws = registry.get('ws'); - ws.sendGameSkill(gameId, crypId, targetTeamId, skill); - setCrypStatusUpdate(crypId, skill, targetTeamId); - }); - - events.on('SEND_TARGET', function skillActive(gameId, crypId, skill) { - const ws = registry.get('ws'); - ws.sendGameTarget(gameId, crypId, skill.id); - setCrypStatusUpdate(crypId, skill, null); + ws.sendGameSkill(gameId, crypId, targetCrypId, skill); + setCrypStatusUpdate(crypId, skill, targetCrypId); }); events.on('CRYP_ACTIVE', function crypActiveCb(cryp) { diff --git a/client/src/scenes/combat.cryps.js b/client/src/scenes/combat.cryps.js index 36ef1c14..83f6d2dc 100644 --- a/client/src/scenes/combat.cryps.js +++ b/client/src/scenes/combat.cryps.js @@ -248,19 +248,14 @@ class CombatCryps extends Phaser.Scene { } updateCrypStatus(status) { - const targetCryp = this.cryps.children.entries + const sourceCryp = this.cryps.children.entries .find(c => c.cryp.id === status.id); - if (this.phase === 'Skill') { - targetCryp.statusText.text = status.target === targetCryp.cryp.account - ? `${status.skill} on ally team` - : `${status.skill} on enemy team`; - } + const targetCryp = this.cryps.children.entries + .find(c => c.cryp.id === status.target); - if (this.phase === 'Target') { - const sourceCryp = this.cryps.children.entries - .find(c => c.cryp.id === status.skill.source_cryp_id); - targetCryp.statusText.text = `${sourceCryp.cryp.name} ${status.skill.skill} ${targetCryp.cryp.name}`; + if (this.phase === 'Skill') { + sourceCryp.statusText.text = `${status.skill} on ${targetCryp.cryp.name}`; } }