24 lines
815 B
C#
24 lines
815 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Tangling Hair is an ability that lowers the Speed of attackers making contact.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Tangling_Hair_(Ability)">Bulbapedia - Tangling Hair</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "tangling_hair")]
|
|
public class TanglingHair : Script, IScriptOnIncomingHit
|
|
{
|
|
/// <inheritdoc />
|
|
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
|
{
|
|
if (!move.GetHitData(target, hit).IsContact)
|
|
return;
|
|
|
|
EventBatchId batchId = new();
|
|
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target)
|
|
{
|
|
BatchId = batchId,
|
|
});
|
|
move.User.ChangeStatBoost(Statistic.Speed, -1, false, false, batchId);
|
|
}
|
|
} |