Deukhoofd c795f20e54
All checks were successful
Build / Build (push) Successful in 51s
Implement highest damage AI, further work on AI runner, random fixes
2025-07-05 14:56:25 +02:00

31 lines
907 B
C#

using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "wonder_room_effect")]
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();
}
}
}