Last couple abilities
This commit is contained in:
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WonderGuard.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WonderGuard.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Wonder Guard is an ability that only allows super-effective moves to hit the Pokémon.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Wonder_Guard_(Ability)">Bulbapedia - Wonder Guard</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "wonder_guard")]
|
||||
public class WonderGuard : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
var effectiveness = executingMove.GetHitData(target, hitIndex).Effectiveness;
|
||||
if (!(effectiveness <= 1.0))
|
||||
return;
|
||||
executingMove.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
block = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user