Implements several more moves
This commit is contained in:
24
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Copycat.cs
Normal file
24
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Copycat.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Linq;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "copycat")]
|
||||
public class Copycat : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var lastMove = choice.User.BattleData?.Battle.PreviousTurnChoices
|
||||
.SelectMany(x => x)
|
||||
.OfType<IMoveChoice>()
|
||||
.LastOrDefault();
|
||||
if (lastMove == null || !lastMove.ChosenMove.MoveData.CanCopyMove())
|
||||
{
|
||||
choice.Fail();
|
||||
return;
|
||||
}
|
||||
moveName = lastMove.ChosenMove.MoveData.Name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user