28 lines
987 B
C#
28 lines
987 B
C#
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "round")]
|
|
public class Round : Script, IScriptOnAfterMove
|
|
{
|
|
/// <inheritdoc />
|
|
public void OnAfterMove(IExecutingMove move)
|
|
{
|
|
var choiceQueue = move.Battle.ChoiceQueue;
|
|
if (choiceQueue is null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var otherRoundMoves = choiceQueue.Where(x => x is IMoveChoice mc && mc.ChosenMove.MoveData.Name == "round")
|
|
.Cast<IMoveChoice>().ToList();
|
|
|
|
// We reverse the order here, as we're constantly pushing the choices to the front of the queue.
|
|
// By reversing the order, we ensure that the first choice is the one that is up next.
|
|
foreach (var otherRoundMove in otherRoundMoves.AsEnumerable().Reverse())
|
|
{
|
|
otherRoundMove.Volatile.Add(new RoundPowerBoost());
|
|
choiceQueue.MovePokemonChoiceNext(otherRoundMove.User);
|
|
}
|
|
}
|
|
} |