More moves

This commit is contained in:
2025-03-21 13:35:12 +01:00
parent 7f5088b763
commit 85b513092a
9 changed files with 149 additions and 11 deletions

View File

@@ -0,0 +1,19 @@
using System.Linq;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "leech_seed")]
public class LeechSeed : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (target.Types.Any(x => x.Name == "grass"))
{
move.GetHitData(target, hit).Fail();
return;
}
target.Volatile.Add(new LeechSeedEffect(target, move.User));
}
}

View 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));
}
}