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

28 lines
1.1 KiB
C#

using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Flash Fire is an ability that makes the Pokémon immune to Fire-type moves.
/// When hit by a Fire-type move, the ability activates and increases the power of the Pokémon's Fire-type moves by 50%.
/// This ability is commonly associated with Ninetales and Arcanine.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flash_Fire_(Ability)">Bulbapedia - Flash Fire</see>
/// </summary>
[Script(ScriptCategory.Ability, "flash_fire")]
public class FlashFire : Script
{
/// <inheritdoc />
public override void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
ref float effectiveness)
{
if (executingMove.GetHitData(target, hitIndex).Type?.Name != "fire")
return;
effectiveness = 0f;
if (target.Volatile.Contains<FlashFireEffect>())
return;
target.Volatile.Add(new FlashFireEffect());
executingMove.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
}
}