namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "slow_start")]
public class SlowStartEffect : Script, IScriptChangeSpeed
{
private int _turnsRemaining = 5;
///
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
{
speed /= 2;
}
///
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
ImmutableStatisticSet targetStats, Statistic stat, ref uint value)
{
if (stat == Statistic.Attack)
value /= 2;
}
///
public override void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_turnsRemaining <= 0)
return;
_turnsRemaining--;
if (_turnsRemaining == 0)
{
RemoveSelf();
}
}
}