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 });
}
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) {

View File

@ -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}`;
}
}