This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user