namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// /// Flower Veil is an ability that prevents Grass-type allies from having their stats lowered or being afflicted by status conditions. /// This ability is exclusive to Florges and its evolutionary line. /// /// Bulbapedia - Flower Veil /// [Script(ScriptCategory.Ability, "flower_veil")] public class FlowerVeil : Script { private IPokemon? _pokemon; /// public override void OnAddedToParent(IScriptSource source) { if (source is not IPokemon pokemon) throw new InvalidOperationException("Flower Veil can only be added to a Pokemon script source."); _pokemon = pokemon; var effect = _pokemon.BattleData?.BattleSide.VolatileScripts.Add(new Side.FlowerVeilEffect()); (effect?.Script as Side.FlowerVeilEffect)?.OnAdded(_pokemon); } /// public override void OnRemove() { if (_pokemon is null) return; if (_pokemon.BattleData?.BattleSide.VolatileScripts.TryGet(out var script) == true) { script.OnRemoved(_pokemon); } } }