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