Finish the A moves
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-10-30 18:45:42 +02:00
parent cb2f53a239
commit afe091eefa
14 changed files with 213 additions and 10 deletions

View File

@@ -3,16 +3,36 @@ namespace Gen7 {
shared class HealEachEndOfTurnEffect : PkmnScript {
float _factor;
void OnEndTurn(Pokemon@ pokemon) override {
auto healAmount = pokemon.MaxHealth * _factor;
if (pokemon.HasHeldItem("big_root")){
void OnEndTurn() override {
auto target = cast<Pokemon@>(GetOwner());
if (target is null){
throw("target was null");
}
auto healAmount = target.MaxHealth * _factor;
if (target.HasHeldItem("big_root")){
healAmount *= 1.3;
}
pokemon.Heal(uint(healAmount));
target.Heal(uint(healAmount));
}
void SetBaseHealAmount(float factor){
_factor = factor;
}
}
}
}
#if TESTS
[Test name="Heal Each End Of Turn effect: Heals on end of turn"]
void HealEachEndOfTurn_HealsOnEndOfTurn(){
auto battle = CreateSimpleBattle(0, "charizard", "venusaur", 100);
auto mon = battle.GetParty(0).Party.GetAtIndex(0);
mon.Damage(100, DamageSource::AttackDamage);
auto effect = cast<Gen7::HealEachEndOfTurnEffect@>(mon.AddVolatile("HealEachEndOfTurn"));
effect.SetBaseHealAmount(0.0625);
effect.OnEndTurn();
RequireEquals(215, mon.CurrentHealth);
}
#endif