Adds more tests, fixes
All checks were successful
Build / Build (push) Successful in 1m7s

This commit is contained in:
2026-07-04 13:03:54 +02:00
parent 8fbf22a987
commit f9878e76ba
14 changed files with 1564 additions and 8 deletions

View File

@@ -14,15 +14,16 @@ public class Acupressure : Script, IScriptOnSecondaryEffect
/// <inheritdoc />
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var possibleStats = target.StatBoost.Where(x => x.statistic != Statistic.Hp && x.value < 6).ToArray();
// If the target has no stats to raise, the move fails
if (target.StatBoost.All(s => s.value == 6))
if (!possibleStats.Any())
{
move.GetHitData(target, hit).Fail();
return;
}
// Choose a random stat to raise. 0 is HP, so we start at 1.
var stat = (Statistic)move.User.BattleData!.Battle.Random.GetInt(1, (int)Statistic.Speed + 1);
var index = move.User.BattleData!.Battle.Random.GetInt(0, possibleStats.Length);
var stat = possibleStats[index].statistic;
target.ChangeStatBoost(stat, 2, false, false);
}
}

View File

@@ -23,11 +23,10 @@ public class Autotomize : Script, IScriptOnSecondaryEffect
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var user = move.User;
if (!user.ChangeStatBoost(Statistic.Speed, 2, true, false))
return;
var existingEffect = user.Volatile.Get<AutotomizeEffect>();
var stacks = existingEffect?.Stacks ?? 0;
if (!user.ChangeStatBoost(Statistic.Speed, 2, true, false) || !(user.WeightInKg - 100f * stacks >= 0.1f))
if (!(user.WeightInKg > 0.1f))
return;
user.Volatile.StackOrAdd(ScriptUtils.ResolveName<AutotomizeEffect>(), () => new AutotomizeEffect());

View File

@@ -27,6 +27,8 @@ public class Drain : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
target.RunScriptHook<IScriptCustomTrigger>(x => x.CustomTrigger(CustomTriggers.ModifyDrain, args));
invert = args.Invert;
healed = args.Healed;
if (healed == 0)
healed = 1;
if (invert)
{