2025-06-07 11:03:48 +02:00

20 lines
749 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Defeatist is an ability that halves the Pokémon's Attack and Special Attack when its HP drops below 50%.
/// This reduction applies to all moves used by the Pokémon, making it significantly weaker when damaged.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Defeatist_(Ability)">Bulbapedia - Defeatist</see>
/// </summary>
[Script(ScriptCategory.Ability, "defeatist")]
public class Defeatist : Script
{
/// <inheritdoc />
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
{
if (move.User.CurrentHealth < move.User.MaxHealth / 2)
{
modifier *= 0.5f;
}
}
}