VampireFangs targets hero with highest HP
This commit is contained in:
parent
c34b065ff5
commit
8b539e1b5c
3 changed files with 17 additions and 4 deletions
|
|
@ -16,11 +16,11 @@ public class BattleHero: BattleParticipant
|
||||||
break;
|
break;
|
||||||
case HeroId.Brute:
|
case HeroId.Brute:
|
||||||
this.displayName = "Brian";
|
this.displayName = "Brian";
|
||||||
this.maxHP = 10;
|
this.maxHP = 12;
|
||||||
break;
|
break;
|
||||||
case HeroId.Shaman:
|
case HeroId.Shaman:
|
||||||
this.displayName = "Slug";
|
this.displayName = "Slug";
|
||||||
this.maxHP = 12;
|
this.maxHP = 10;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new System.ArgumentException("HeroId unknown", "id");
|
throw new System.ArgumentException("HeroId unknown", "id");
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,19 @@ public class VampireFangsMCard : MonsterCard
|
||||||
}
|
}
|
||||||
|
|
||||||
private BattleParticipant DetermineTarget(MonsterViewpoint monsterViewpoint) {
|
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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
TODO.txt
2
TODO.txt
|
|
@ -1,4 +1,4 @@
|
||||||
- Make API of IBattleEffectResolver take in effects instead of params
|
- 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
|
- Control flow of battle with state machine or coroutines
|
||||||
- Make battle end
|
- Make battle end
|
||||||
|
- Do not allow dead heroes to act
|
||||||
Loading…
Add table
Add a link
Reference in a new issue