namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// 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.
///
/// Bulbapedia - Flame Body
///
[Script(ScriptCategory.Ability, "flame_body")]
public class FlameBody : Script, IScriptOnIncomingHit
{
///
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
if (!move.GetHitData(target, hit).IsContact)
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(), move.User);
}
}