Adds more abilities

This commit is contained in:
2025-06-07 10:58:58 +02:00
parent 232b94b04c
commit b2ba3d96ba
25 changed files with 429 additions and 16 deletions

View File

@@ -0,0 +1,25 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Cursed Body is an ability that has a 30% chance to disable the last move used against the Pokémon.
/// When triggered, the opponent's move becomes disabled for 4 turns, preventing its use.
/// This ability can be triggered by any damaging move that hits the Pokémon.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cursed_Body_(Ability)">Bulbapedia - Cursed Body</see>
/// </summary>
[Script(ScriptCategory.Ability, "cursed_body")]
public class CursedBody : Script
{
/// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
// 30% chance to disable the move
if (move.Battle.Random.GetFloat() > 0.3f)
return;
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
target.Volatile.Add(new DisableEffect(move.ChosenMove.MoveData.Name));
}
}