More abilities, refactor custom triggers to be typed.
All checks were successful
Build / Build (push) Successful in 48s
All checks were successful
Build / Build (push) Successful in 48s
This commit is contained in:
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Magician.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Magician.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Magician is an ability that steals the held item of a Pokémon it hits with a move.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magician_(Ability)">Bulbapedia - Magician</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "magician")]
|
||||
public class Magician : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.UseMove.Category is MoveCategory.Status)
|
||||
return;
|
||||
|
||||
if (move.User.HeldItem is not null || target.HeldItem is null)
|
||||
return;
|
||||
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User));
|
||||
_ = move.User.SetHeldItem(target.RemoveHeldItemForBattle());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user