33 lines
1.4 KiB
C#
33 lines
1.4 KiB
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Dark Aura is an ability that increases the power of Dark-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.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Dark_Aura_(Ability)">Bulbapedia - Dark Aura</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "dark_aura")]
|
|
public class DarkAura : Script
|
|
{
|
|
/// <inheritdoc />
|
|
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
|
{
|
|
if (move.GetHitData(target, hit).Type?.Name == "dark")
|
|
{
|
|
var auraModifier = 5448f / 4096f;
|
|
var parameters = new Dictionary<StringKey, object?>
|
|
{
|
|
["aura_type"] = "dark",
|
|
["modifier"] = auraModifier,
|
|
};
|
|
move.Battle.Sides.SelectMany(side => side.Pokemon).WhereNotNull()
|
|
.RunScriptHook(x => x.CustomTrigger(CustomTriggers.ModifyAuraEffect, parameters));
|
|
if (parameters.TryGetValue("modifier", out var modObj) && modObj is float modValue)
|
|
{
|
|
auraModifier = modValue;
|
|
}
|
|
modifier *= auraModifier;
|
|
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User));
|
|
}
|
|
}
|
|
} |