Bunch more moves, changes in how additional information for items works.
This commit is contained in:
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MeFirst.cs
Normal file
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MeFirst.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "me_first")]
|
||||
public class MeFirst : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var battleData = choice.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
var target = battleData.Battle.Sides[choice.TargetSide].Pokemon[choice.TargetPosition];
|
||||
if (target == null)
|
||||
{
|
||||
choice.Fail();
|
||||
return;
|
||||
}
|
||||
if (battleData.Battle.ChoiceQueue?.FirstOrDefault(x => x.User == target) is not IMoveChoice targetMove)
|
||||
{
|
||||
choice.Fail();
|
||||
return;
|
||||
}
|
||||
var targetMoveData = targetMove.ChosenMove.MoveData;
|
||||
moveName = targetMoveData.Name;
|
||||
choice.Volatile.Add(new MeFirstPowerBoost());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user