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);
}
}