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