2025-06-09 17:37:37 +02:00

25 lines
808 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Justified is an ability that raises the Pokémon's Attack stat when hit by a Dark-type move.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Justified_(Ability)">Bulbapedia - Justified</see>
/// </summary>
[Script(ScriptCategory.Ability, "justified")]
public class Justified : Script
{
/// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
if (move.GetHitData(target, hit).Type?.Name != "dark")
return;
EventBatchId batchId = new();
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target)
{
BatchId = batchId,
});
target.ChangeStatBoost(Statistic.Attack, 1, true, false, batchId);
}
}