27 lines
1.2 KiB
C#
27 lines
1.2 KiB
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Fairy Aura is an ability that increases the power of Fairy-type moves by 33% for all Pokémon on the field.
|
|
/// The effect can be modified by other abilities (such as Aura Break) via a custom script hook.
|
|
/// This ability is exclusive to Xerneas.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fairy_Aura_(Ability)">Bulbapedia - Fairy Aura</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "fairy_aura")]
|
|
public class FairyAura : Script, IScriptChangeDamageModifier
|
|
{
|
|
/// <inheritdoc />
|
|
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
|
{
|
|
if (move.GetHitData(target, hit).Type?.Name == "fairy")
|
|
{
|
|
var auraModifier = 5448f / 4096f;
|
|
var args = new CustomTriggers.ModifyAuraEffectArgs(move, target, hit, auraModifier);
|
|
move.Battle.Sides.SelectMany(side => side.Pokemon).WhereNotNull()
|
|
.RunScriptHook<IScriptCustomTrigger>(x => x.CustomTrigger(CustomTriggers.ModifyAuraEffect, args));
|
|
auraModifier = args.AuraEffect;
|
|
modifier *= auraModifier;
|
|
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User));
|
|
}
|
|
}
|
|
} |