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

20 lines
837 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Contrary is an ability that inverts all stat changes for the Pokémon.
/// When a stat would normally be raised, it is lowered instead, and vice versa.
/// This applies to both self-inflicted stat changes and those caused by other Pokémon.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Contrary_(Ability)">Bulbapedia - Contrary</see>
/// </summary>
[Script(ScriptCategory.Ability, "contrary")]
public class Contrary : Script, IScriptChangeStatBoostChange
{
/// <inheritdoc />
public void ChangeStatBoostChange(IPokemon target, Statistic stat, bool selfInflicted, ref sbyte amount)
{
// Invert the stat change
amount = (sbyte)-amount;
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
}
}