Serialization of Pokemon, general fixes
This commit is contained in:
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Acupressure.cs
Normal file
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Acupressure.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Linq;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
||||
|
||||
/// <summary>
|
||||
/// The user applies pressure to stress points, sharply boosting one of its or its allies' stats.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Move, "acupressure")]
|
||||
public class Acupressure : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user