Deukhoofd 97868ab4c6
All checks were successful
Build / Build (push) Successful in 48s
More abilities
2025-06-09 13:44:26 +02:00

26 lines
804 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "topsy_turvy")]
public class TopsyTurvy : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId batchId = new();
var hasChanged = false;
foreach (Statistic stat in Enum.GetValues(typeof(Statistic)))
{
var statBoost = target.StatBoost.GetStatistic(stat);
if (statBoost == 0)
continue;
hasChanged = true;
var newStatBoost = -statBoost;
target.ChangeStatBoost(stat, (sbyte)newStatBoost, target == move.User, true, batchId);
}
if (!hasChanged)
{
move.GetHitData(target, hit).Fail();
}
}
}