Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Normalize.cs

24 lines
1016 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Normalize is an ability that changes all moves used by the Pokémon to Normal type.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Normalize_(Ability)">Bulbapedia - Normalize</see>
/// </summary>
[Script(ScriptCategory.Ability, "normalize")]
public class Normalize : Script, IScriptChangeMoveType, IScriptChangeBasePower
{
/// <inheritdoc />
public void ChangeMoveType(IExecutingMove move, IBattlePokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
{
if (move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier(TypeNames.Normal, out var normalType))
typeIdentifier = normalType;
}
/// <inheritdoc />
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
{
if (move.GetHitData(target, hit).Type?.Name == TypeNames.Normal)
basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%
}
}