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