This commit is contained in:
26
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/TopsyTurvy.cs
Normal file
26
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/TopsyTurvy.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
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, batchId);
|
||||
}
|
||||
if (!hasChanged)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user