using PkmnLib.Static.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// /// Stance Change is an ability that changes Aegislash's form depending on the move used. /// /// Bulbapedia - Stance Change /// [Script(ScriptCategory.Ability, "stance_change")] public class StanceChange : Script, IScriptOnBeforeMove { /// public void OnBeforeMove(IExecutingMove move) { if (move.User.Species.Name != "aegislash") return; if (move.UseMove.Category is not (MoveCategory.Physical or MoveCategory.Special) || move.User.Form.Name == "blade" || !move.User.Species.TryGetForm("blade", out var bladeForm)) return; EventBatchId batchId = new(); move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User) { BatchId = batchId, }); move.User.ChangeForm(bladeForm, batchId); // Kings shield is handled in the move script. } }