20 lines
816 B
C#
20 lines
816 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
|
|
{
|
|
/// <inheritdoc />
|
|
public override 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));
|
|
}
|
|
} |