Deukhoofd 1feb27e826
All checks were successful
Build / Build (push) Successful in 50s
More work on refactor to interfaces
2025-06-29 12:03:51 +02:00

28 lines
1.1 KiB
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Galvanize is an ability that turns Normal-type moves into Electric-type moves and boosts their power.
/// This ability is exclusive to Alolan Golem.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Galvanize_(Ability)">Bulbapedia - Galvanize</see>
/// </summary>
[Script(ScriptCategory.Ability, "galvanize")]
public class Galvanize : Script, IScriptChangeMoveType, IScriptChangeDamageModifier
{
/// <inheritdoc />
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
{
if (typeIdentifier?.Name == "normal" &&
move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType))
{
typeIdentifier = electricType;
}
}
/// <inheritdoc />
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
{
if (move.GetHitData(target, hit).Type?.Name == "electric")
modifier *= 1.2f;
}
}