namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// /// Defiant is an ability that raises the Pokémon's Attack by two stages whenever any of its stats are lowered. /// This includes stat drops from moves, abilities, or items. The ability will not activate if the stat drop is self-inflicted. /// /// Bulbapedia - Defiant /// [Script(ScriptCategory.Ability, "defiant")] public class Defiant : Script, IScriptOnAfterStatBoostChange { /// /// public void OnAfterStatBoostChange(IPokemon pokemon, Statistic stat, bool selfInflicted, sbyte change) { if (change >= 0) return; if (selfInflicted) return; EventBatchId batchId = new(); pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon) { BatchId = batchId, }); pokemon.ChangeStatBoost(Statistic.Attack, 2, true, false, batchId); } }