using System.Linq;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.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
{
///
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
// If the target has no stats to raise, the move fails
if (target.StatBoost.All(s => s == 6))
{
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);
target.ChangeStatBoost(stat, 2, false);
}
}