19 lines
727 B
C#
19 lines
727 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Poison Touch is an ability that may poison targets when the Pokémon uses a contact move.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Poison_Touch_(Ability)">Bulbapedia - Poison Touch</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "poison_touch")]
|
|
public class PoisonTouch : Script
|
|
{
|
|
private const int PoisonChance = 30;
|
|
|
|
/// <inheritdoc />
|
|
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
|
{
|
|
if (move.GetHitData(target, hit).IsContact && move.Battle.Random.GetInt(0, 100) < PoisonChance)
|
|
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), target);
|
|
}
|
|
} |