namespace Gen7 { [Ability effect=Berserk] class Berserk : PkmnScript { void OnDamage(Pokemon@ pokemon, DamageSource, uint old, uint new) override { if (float(old) / pokemon.MaxHealth >= 0.5f && float(new) / pokemon.MaxHealth < 0.5f) { pokemon.ChangeStatBoost(Statistic::SpecialDefense, 1, true); } } } }