namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// /// Rattled is an ability that raises Speed when hit by a Bug-, Ghost-, or Dark-type move. /// /// Bulbapedia - Rattled /// [Script(ScriptCategory.Ability, "rattled")] public class Rattled : Script, IScriptOnIncomingHit { /// public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) { var type = move.GetHitData(target, hit).Type; if (type is null) return; if (type.Value.Name != "bug" && type.Value.Name != "ghost" && type.Value.Name != "dark") return; target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target)); target.ChangeStatBoost(Statistic.Speed, 1, true, false); } }