More moves, allow for typeless moves
This commit is contained in:
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Reflect.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Reflect.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "reflect")]
|
||||
public class Reflect : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData is null)
|
||||
return;
|
||||
var numberOfTurns = 5;
|
||||
var dict = new Dictionary<StringKey, object?>
|
||||
{
|
||||
{ "duration", numberOfTurns },
|
||||
};
|
||||
move.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.ReflectNumberOfTurns, dict));
|
||||
numberOfTurns = (int)dict.GetOrDefault("duration", numberOfTurns)!;
|
||||
|
||||
battleData.BattleSide.VolatileScripts.Add(new Side.ReflectEffect(numberOfTurns));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user