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,34 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Species;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Cute Charm is an ability that has a 30% chance to infatuate the opponent when hit by a contact move.
/// Infatuation prevents the affected Pokémon from attacking 50% of the time.
/// This ability only works on Pokémon of the opposite gender.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cute_Charm_(Ability)">Bulbapedia - Cute Charm</see>
/// </summary>
[Script(ScriptCategory.Ability, "cute_charm")]
public class CuteCharm : Script
{
/// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
// Only trigger on contact moves
if (!move.UseMove.HasFlag("contact"))
return;
// 30% chance to infatuate
if (move.Battle.Random.GetFloat() > 0.3f)
return;
if (target.Gender == move.User.Gender || target.Gender == Gender.Genderless ||
move.User.Gender == Gender.Genderless)
return;
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
move.User.Volatile.Add(new Infatuated());
}
}