Adds more abilities
This commit is contained in:
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/CursedBody.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/CursedBody.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user