Implement GolemFist
This commit is contained in:
parent
4ca7b7537a
commit
d1af817bc6
11 changed files with 106 additions and 19 deletions
|
|
@ -5,12 +5,12 @@ using UnityEngine;
|
|||
public class VampireFangsMCard : MonsterCard
|
||||
{
|
||||
public VampireFangsMCard(BattleParticipant owner)
|
||||
: base(owner, MCardId.VampireFangs, "VampireFangs", 2, CardType.Attack,
|
||||
: base(owner, MCardId.VampireFangs, "Vampire Fangs", 2, CardType.Attack,
|
||||
"Steals 2 HP from target. Target: highest HP hero.") {
|
||||
}
|
||||
|
||||
public override IEnumerator Use(IBattleEffectApplier effectApplier, MonsterViewpoint monsterViewpoint) {
|
||||
BattleParticipant target = DetermineTarget(monsterViewpoint);
|
||||
BattleParticipant target = AIUtils.GetHeroWithHighestHP(monsterViewpoint);
|
||||
DealDamageEffect damageEffect = new DealDamageEffect(target, 2);
|
||||
effectApplier.Apply(damageEffect);
|
||||
if (damageEffect.AmountDealt > 0) {
|
||||
|
|
@ -19,21 +19,4 @@ public class VampireFangsMCard : MonsterCard
|
|||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
private BattleParticipant DetermineTarget(MonsterViewpoint monsterViewpoint) {
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue