using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Weak Armor is an ability that lowers Defense and raises Speed when hit by a physical move.
///
/// Bulbapedia - Weak Armor
///
[Script(ScriptCategory.Ability, "weak_armor")]
public class WeakArmor : Script
{
///
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
if (move.UseMove.Category != MoveCategory.Physical)
return;
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
target.ChangeStatBoost(Statistic.Defense, -1, true, false);
target.ChangeStatBoost(Statistic.Speed, 1, true, false);
}
}