namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Water Compaction is an ability that sharply raises Defense when hit by a Water-type move.
///
/// Bulbapedia - Water Compaction
///
[Script(ScriptCategory.Ability, "water_compaction")]
public class WaterCompaction : Script, IScriptOnIncomingHit
{
///
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
if (move.GetHitData(target, hit).Type?.Name != "water")
return;
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
target.ChangeStatBoost(Statistic.Defense, 2, true, false);
}
}