25 lines
762 B
C#
25 lines
762 B
C#
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "encore")]
|
|
public class Encore : Script, IScriptOnSecondaryEffect
|
|
{
|
|
/// <inheritdoc />
|
|
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
|
{
|
|
var battle = target.BattleData?.Battle;
|
|
if (battle == null)
|
|
return;
|
|
|
|
var lastMove = target.BattleData?.LastMoveChoice;
|
|
if (lastMove == null || battle.Library.MiscLibrary.IsReplacementChoice(lastMove))
|
|
{
|
|
move.GetHitData(target, hit).Fail();
|
|
return;
|
|
}
|
|
|
|
var effect = new EncoreEffect(target, lastMove.ChosenMove.MoveData.Name, 3);
|
|
target.Volatile.Add(effect);
|
|
}
|
|
} |