More move scripts
This commit is contained in:
29
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Round.cs
Normal file
29
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Round.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Linq;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "round")]
|
||||
public class Round : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user