namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// /// Intimidate is an ability that lowers the opposing Pokémon's Attack stat when the Pokémon enters battle. /// /// Bulbapedia - Intimidate /// [Script(ScriptCategory.Ability, "intimidate")] public class Intimidate : Script { /// public override void OnSwitchIn(IPokemon pokemon, byte position) { var battle = pokemon.BattleData?.Battle; if (battle is null) return; var opponents = battle.Sides.Where(side => side != pokemon.BattleData?.BattleSide) .SelectMany(side => side.Pokemon).WhereNotNull().Where(opponent => opponent.IsUsable); EventBatchId batchId = new(); battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)); foreach (var opponent in opponents) { opponent.ChangeStatBoost(Statistic.Attack, -1, true, true, batchId); } } }