Adds more abilities
This commit is contained in:
35
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/DarkAura.cs
Normal file
35
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/DarkAura.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user