Deukhoofd 1feb27e826
All checks were successful
Build / Build (push) Successful in 50s
More work on refactor to interfaces
2025-06-29 12:03:51 +02:00

30 lines
853 B
C#

using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
public class WonderRoomEffect : Script, IScriptChangeDefensiveStatValue, IScriptOnEndTurn
{
public int TurnsLeft { get; private set; } = 5;
/// <inheritdoc />
public void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
{
value = move.UseMove.Category switch
{
MoveCategory.Special => targetStats.Defense,
MoveCategory.Physical => targetStats.SpecialDefense,
_ => value,
};
}
/// <inheritdoc />
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
TurnsLeft--;
if (TurnsLeft <= 0)
{
RemoveSelf();
}
}
}