30 lines
853 B
C#
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();
|
|
}
|
|
}
|
|
} |