using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Static.Species; namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// /// 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. /// /// Bulbapedia - Cute Charm /// [Script(ScriptCategory.Ability, "cute_charm")] public class CuteCharm : Script { /// public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit) { // Only trigger on contact moves if (!move.GetHitData(target, hit).IsContact) 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()); } }