Deukhoofd 97868ab4c6
All checks were successful
Build / Build (push) Successful in 48s
More abilities
2025-06-09 13:44:26 +02:00

25 lines
934 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Flame Body is an ability that has a 30% chance of burning the attacker when hit by a contact move.
/// This ability is similar to Effect Spore and Static, but inflicts burn instead of other status conditions.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flame_Body_(Ability)">Bulbapedia - Flame Body</see>
/// </summary>
[Script(ScriptCategory.Ability, "flame_body")]
public class FlameBody : Script
{
/// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
if (!move.UseMove.HasFlag("contact"))
return;
var rng = move.Battle.Random;
if (rng.GetInt(0, 100) >= 30) // 30% chance
return;
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
move.User.SetStatus(ScriptUtils.ResolveName<Status.Burned>(), false);
}
}