namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
///
/// The user applies pressure to stress points, sharply boosting one of its or its allies' stats.
///
///
/// Acupressure chooses one of the target's stats at random and raises it by two stages. It can raise either the
/// target's Attack, Defense, Special Attack, Special Defense, Speed, accuracy or evasion stat but will not attempt
/// to raise a stat that is already maximized, meaning that the move will fail if all stats are maximized
///
[Script(ScriptCategory.Move, "acupressure")]
public class Acupressure : Script, IScriptOnSecondaryEffect
{
///
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 (!possibleStats.Any())
{
move.GetHitData(target, hit).Fail();
return;
}
var index = move.User.BattleData!.Battle.Random.GetInt(0, possibleStats.Length);
var stat = possibleStats[index].statistic;
target.ChangeStatBoost(stat, 2, false, false);
}
}