22 lines
581 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "grudge")]
public class GrudgeEffect : Script, IScriptOnIncomingHit, IScriptOnFaint
{
private ILearnedMove? _lastMove;
/// <inheritdoc />
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
_lastMove = move.ChosenMove;
}
/// <inheritdoc />
public void OnFaint(IPokemon pokemon, DamageSource source)
{
if (_lastMove != null && source == DamageSource.MoveDamage)
{
_lastMove.SetCurrentPP(0);
}
}
}