status text

This commit is contained in:
ntr 2018-12-31 17:07:17 +11:00
parent 19c23c4f97
commit d7f4400a1b
2 changed files with 8 additions and 19 deletions

View File

@ -44,16 +44,10 @@ function registerEvents(registry, events, tutorial) {
registry.set('crypStatusUpdate', { id, skill, target }); 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'); const ws = registry.get('ws');
ws.sendGameSkill(gameId, crypId, targetTeamId, skill); ws.sendGameSkill(gameId, crypId, targetCrypId, skill);
setCrypStatusUpdate(crypId, skill, targetTeamId); setCrypStatusUpdate(crypId, skill, targetCrypId);
});
events.on('SEND_TARGET', function skillActive(gameId, crypId, skill) {
const ws = registry.get('ws');
ws.sendGameTarget(gameId, crypId, skill.id);
setCrypStatusUpdate(crypId, skill, null);
}); });
events.on('CRYP_ACTIVE', function crypActiveCb(cryp) { events.on('CRYP_ACTIVE', function crypActiveCb(cryp) {

View File

@ -248,19 +248,14 @@ class CombatCryps extends Phaser.Scene {
} }
updateCrypStatus(status) { updateCrypStatus(status) {
const targetCryp = this.cryps.children.entries const sourceCryp = this.cryps.children.entries
.find(c => c.cryp.id === status.id); .find(c => c.cryp.id === status.id);
if (this.phase === 'Skill') { const targetCryp = this.cryps.children.entries
targetCryp.statusText.text = status.target === targetCryp.cryp.account .find(c => c.cryp.id === status.target);
? `${status.skill} on ally team`
: `${status.skill} on enemy team`;
}
if (this.phase === 'Target') { if (this.phase === 'Skill') {
const sourceCryp = this.cryps.children.entries sourceCryp.statusText.text = `${status.skill} on ${targetCryp.cryp.name}`;
.find(c => c.cryp.id === status.skill.source_cryp_id);
targetCryp.statusText.text = `${sourceCryp.cryp.name} ${status.skill.skill} ${targetCryp.cryp.name}`;
} }
} }