VampireFangs targets hero with highest HP

This commit is contained in:
henriquenakashima 2020-09-19 23:47:21 -04:00
parent c34b065ff5
commit 8b539e1b5c
3 changed files with 17 additions and 4 deletions

View file

@ -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");

View file

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

View file

@ -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