From f141a705c2b261d2a94c6311d6898c447d697851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Mon, 23 Jan 2017 17:33:13 +0100 Subject: [PATCH] Fixed effect marker not being removed on ship list --- TODO | 1 + src/game/Ship.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index c736aa1..f1e8046 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,7 @@ * Mobile: display tooltips larger and on the side of screen where the finger is not * Mobile: targetting in two times, using a draggable target indicator * AI: apply safety distances to move actions +* AI: bully AI crashes when winning a battle (trying to move toward null ship!) * Add a defeat screen (game over for now) * Add a victory screen, with loot display * Add retreat from battle diff --git a/src/game/Ship.ts b/src/game/Ship.ts index fd92bb0..ae4d81a 100644 --- a/src/game/Ship.ts +++ b/src/game/Ship.ts @@ -252,18 +252,20 @@ module SpaceTac.Game { this.recoverActionPoints(); // Decrement sticky effects duration + let removed_effects: EffectRemovedEvent[] = []; this.temporary_effects = this.temporary_effects.filter((effect: TemporaryEffect): boolean => { if (effect.duration <= 1) { - this.addBattleEvent(new EffectRemovedEvent(this, effect)); + removed_effects.push(new EffectRemovedEvent(this, effect)); return false; } else { return true; } }); - this.temporary_effects.forEach((effect: TemporaryEffect) => { + this.temporary_effects.forEach(effect => { effect.duration -= 1; this.addBattleEvent(new EffectDurationChangedEvent(this, effect, effect.duration + 1)); }); + removed_effects.forEach(effect => this.addBattleEvent(effect)); } // Add a temporary effect