diff --git a/Assets/Battle/BattleHero.cs b/Assets/Battle/BattleHero.cs index 8e537fa..4f88519 100644 --- a/Assets/Battle/BattleHero.cs +++ b/Assets/Battle/BattleHero.cs @@ -16,11 +16,11 @@ public class BattleHero: BattleParticipant break; case HeroId.Brute: this.displayName = "Brian"; - this.maxHP = 10; + this.maxHP = 12; break; case HeroId.Shaman: this.displayName = "Slug"; - this.maxHP = 12; + this.maxHP = 10; break; default: throw new System.ArgumentException("HeroId unknown", "id"); diff --git a/Assets/Battle/CardsMonsters/VampireFangsMCard.cs b/Assets/Battle/CardsMonsters/VampireFangsMCard.cs index b243e1b..184e812 100644 --- a/Assets/Battle/CardsMonsters/VampireFangsMCard.cs +++ b/Assets/Battle/CardsMonsters/VampireFangsMCard.cs @@ -21,6 +21,19 @@ public class VampireFangsMCard : MonsterCard } private BattleParticipant DetermineTarget(MonsterViewpoint monsterViewpoint) { - return monsterViewpoint.Heroes[0]; + return GetHeroWithHighestHP(monsterViewpoint); + } + + private BattleHero GetHeroWithHighestHP(MonsterViewpoint monsterViewpoint) { + int highestHPHeroIndex = -1; + int highestHP = -1; + for (int i = 0; i < monsterViewpoint.Heroes.Length; i++) { + int heroHP = monsterViewpoint.Heroes[i].GetHP(); + if (heroHP > highestHP) { + highestHPHeroIndex = i; + highestHP = heroHP; + } + } + return monsterViewpoint.Heroes[highestHPHeroIndex]; } } diff --git a/TODO.txt b/TODO.txt index 60d663e..ee6b3a1 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,4 +1,4 @@ - Make API of IBattleEffectResolver take in effects instead of params -- Make VampireFangs hit hero with highest HP - Control flow of battle with state machine or coroutines - Make battle end +- Do not allow dead heroes to act \ No newline at end of file