28 lines
903 B
C#
28 lines
903 B
C#
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));
|
|
}
|
|
} |