More abilities, refactor stealing held items
All checks were successful
Build / Build (push) Successful in 50s
All checks were successful
Build / Build (push) Successful in 50s
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Stance Change is an ability that changes Aegislash's form depending on the move used.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stance_Change_(Ability)">Bulbapedia - Stance Change</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "stance_change")]
|
||||
public class StanceChange : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override 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.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user