Adds a lot more move effects

This commit is contained in:
Deukhoofd 2025-01-26 11:55:13 +01:00
parent 802481c1f5
commit 549b92048a
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
75 changed files with 563 additions and 230 deletions

View File

@ -163,30 +163,13 @@ public static class TurnRunner
var battleData = user.BattleData; var battleData = user.BattleData;
if (battleData == null) if (battleData == null)
return; return;
if (!battle.Library.ScriptResolver.TryResolveBattleItemScript(itemChoice.Item, out var itemScript))
{
return;
}
if (!itemScript.IsItemUsable)
return;
itemScript.OnInitialize(itemChoice.Item.BattleEffect!.Parameters);
IPokemon? target = null; IPokemon? target = null;
if (itemChoice is { TargetSide: not null, TargetPosition: not null }) if (itemChoice is { TargetSide: not null, TargetPosition: not null })
{ {
var side = battle.Sides[itemChoice.TargetSide.Value]; var side = battle.Sides[itemChoice.TargetSide.Value];
target = side.Pokemon[itemChoice.TargetPosition.Value]; target = side.Pokemon[itemChoice.TargetPosition.Value];
} }
itemChoice.Item.RunItemScript(battle.Library.ScriptResolver, target ?? user);
var requiresTarget = itemScript.RequiresTarget;
if (requiresTarget)
{
target ??= user;
itemScript.OnUseWithTarget(target);
}
else
{
itemScript.OnUse();
}
} }
} }

View File

@ -313,6 +313,10 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// </summary> /// </summary>
void LearnMove(StringKey moveName, MoveLearnMethod method, byte index); void LearnMove(StringKey moveName, MoveLearnMethod method, byte index);
/// <summary>
/// Checks whether the Pokémon has a specific non-volatile status.
/// </summary>
bool HasStatus(StringKey status);
/// <summary> /// <summary>
/// Adds a non-volatile status to the Pokemon. /// Adds a non-volatile status to the Pokemon.
/// </summary> /// </summary>
@ -347,6 +351,17 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// Marks a Pokemon as seen in the battle. /// Marks a Pokemon as seen in the battle.
/// </summary> /// </summary>
void MarkOpponentAsSeen(IPokemon pokemon); void MarkOpponentAsSeen(IPokemon pokemon);
/// <summary>
/// Removes a type from the Pokémon. Returns whether the type was removed.
/// </summary>
bool RemoveType(TypeIdentifier type);
/// <summary>
/// Adds a type to the Pokémon. Returns whether the type was added. It will not add the type if
/// the Pokémon already has it.
/// </summary>
bool AddType(TypeIdentifier type);
/// <summary> /// <summary>
/// Converts the data structure to a serializable format. /// Converts the data structure to a serializable format.
@ -639,8 +654,10 @@ public class PokemonImpl : ScriptSource, IPokemon
/// <inheritdoc /> /// <inheritdoc />
public bool AllowedExperience { get; set; } public bool AllowedExperience { get; set; }
private List<TypeIdentifier> _types = new();
/// <inheritdoc /> /// <inheritdoc />
public IReadOnlyList<TypeIdentifier> Types { get; private set; } public IReadOnlyList<TypeIdentifier> Types { get => _types; private set => _types = value.ToList(); }
/// <inheritdoc /> /// <inheritdoc />
public bool IsEgg { get; private set; } public bool IsEgg { get; private set; }
@ -940,6 +957,9 @@ public class PokemonImpl : ScriptSource, IPokemon
_learnedMoves[index] = new LearnedMoveImpl(move, method); _learnedMoves[index] = new LearnedMoveImpl(move, method);
} }
/// <inheritdoc />
public bool HasStatus(StringKey status) => StatusScript.Script?.Name == status;
/// <inheritdoc /> /// <inheritdoc />
public void SetStatus(StringKey status) public void SetStatus(StringKey status)
{ {
@ -1000,6 +1020,18 @@ public class PokemonImpl : ScriptSource, IPokemon
/// <inheritdoc /> /// <inheritdoc />
public void MarkOpponentAsSeen(IPokemon pokemon) => BattleData?.MarkOpponentAsSeen(pokemon); public void MarkOpponentAsSeen(IPokemon pokemon) => BattleData?.MarkOpponentAsSeen(pokemon);
/// <inheritdoc />
public bool RemoveType(TypeIdentifier type) => _types.Remove(type);
/// <inheritdoc />
public bool AddType(TypeIdentifier type)
{
if (_types.Contains(type))
return false;
_types.Add(type);
return true;
}
/// <inheritdoc /> /// <inheritdoc />
public SerializedPokemon Serialize() => new(this); public SerializedPokemon Serialize() => new(this);

View File

@ -1,4 +1,6 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using PkmnLib.Dynamic.Models;
using PkmnLib.Static;
namespace PkmnLib.Dynamic.ScriptHandling; namespace PkmnLib.Dynamic.ScriptHandling;
@ -42,4 +44,27 @@ public static class ScriptExecution
} }
} }
public static void RunItemScript(this IItem item, ScriptResolver scriptResolver, IPokemon? target)
{
if (!scriptResolver.TryResolveBattleItemScript(item, out var itemScript))
{
return;
}
if (!itemScript.IsItemUsable)
return;
itemScript.OnInitialize(item.BattleEffect!.Parameters);
var requiresTarget = itemScript.RequiresTarget;
if (requiresTarget)
{
if (target == null)
throw new ArgumentNullException(nameof(target), "Item script requires a target.");
itemScript.OnUseWithTarget(target);
}
else
{
itemScript.OnUse();
}
}
} }

View File

@ -32,7 +32,7 @@ public interface IScriptSet : IEnumerable<ScriptContainer>
/// Gets a script from the set using its type. /// Gets a script from the set using its type.
/// </summary> /// </summary>
T? Get<T>() where T : Script; T? Get<T>() where T : Script;
/// <summary> /// <summary>
/// Removes a script from the set using its unique name. /// Removes a script from the set using its unique name.
/// </summary> /// </summary>
@ -43,6 +43,11 @@ public interface IScriptSet : IEnumerable<ScriptContainer>
/// </summary> /// </summary>
void Clear(); void Clear();
/// <summary>
/// Checks if the set has a script with the given type.
/// </summary>
bool Contains<T>() where T : Script => Contains(ScriptUtils.ResolveName<T>());
/// <summary> /// <summary>
/// Checks if the set has a script with the given name. /// Checks if the set has a script with the given name.
/// </summary> /// </summary>

View File

@ -864,7 +864,11 @@
"protect", "protect",
"mirror", "mirror",
"bite" "bite"
] ],
"effect": {
"name": "flinch",
"chance": 30
}
}, },
{ {
"name": "black_hole_eclipse__physical", "name": "black_hole_eclipse__physical",
@ -901,7 +905,10 @@
"recharge", "recharge",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "requires_recharge"
}
}, },
{ {
"name": "blaze_kick", "name": "blaze_kick",
@ -916,7 +923,14 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "set_status",
"chance": 10,
"parameters": {
"status": "burned"
}
}
}, },
{ {
"name": "blizzard", "name": "blizzard",
@ -930,7 +944,14 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "set_status",
"chance": 10,
"parameters": {
"status": "frozen"
}
}
}, },
{ {
"name": "block", "name": "block",
@ -944,7 +965,10 @@
"flags": [ "flags": [
"reflectable", "reflectable",
"mirror" "mirror"
] ],
"effect": {
"name": "block"
}
}, },
{ {
"name": "bloom_doom__physical", "name": "bloom_doom__physical",
@ -980,7 +1004,14 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "set_status",
"chance": 20,
"parameters": {
"status": "burned"
}
}
}, },
{ {
"name": "body_slam", "name": "body_slam",
@ -996,7 +1027,14 @@
"protect", "protect",
"mirror", "mirror",
"nonskybattle" "nonskybattle"
] ],
"effect": {
"name": "set_status",
"chance": 30,
"parameters": {
"status": "paralyzed"
}
}
}, },
{ {
"name": "bolt_strike", "name": "bolt_strike",
@ -1011,7 +1049,14 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "set_status",
"chance": 20,
"parameters": {
"status": "paralyzed"
}
}
}, },
{ {
"name": "bone_club", "name": "bone_club",
@ -1025,7 +1070,11 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "flinch",
"chance": 10
}
}, },
{ {
"name": "bone_rush", "name": "bone_rush",
@ -1039,7 +1088,10 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "2_5_hit_move"
}
}, },
{ {
"name": "bonemerang", "name": "bonemerang",
@ -1053,7 +1105,10 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "2_hit_move"
}
}, },
{ {
"name": "boomburst", "name": "boomburst",
@ -1087,7 +1142,10 @@
"mirror", "mirror",
"gravity", "gravity",
"distance" "distance"
] ],
"effect": {
"name": "bounce"
}
}, },
{ {
"name": "brave_bird", "name": "brave_bird",
@ -1103,7 +1161,13 @@
"protect", "protect",
"mirror", "mirror",
"distance" "distance"
] ],
"effect": {
"name": "recoil",
"parameters": {
"amount": 0.33333
}
}
}, },
{ {
"name": "breakneck_blitz__physical", "name": "breakneck_blitz__physical",
@ -1140,7 +1204,10 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "brick_break"
}
}, },
{ {
"name": "brine", "name": "brine",
@ -1154,7 +1221,10 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "brine"
}
}, },
{ {
"name": "brutal_swing", "name": "brutal_swing",
@ -1183,7 +1253,14 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "change_target_speed",
"chance": 10,
"parameters": {
"amount": -1
}
}
}, },
{ {
"name": "bubble_beam", "name": "bubble_beam",
@ -1197,7 +1274,14 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "change_target_speed",
"chance": 10,
"parameters": {
"amount": -1
}
}
}, },
{ {
"name": "bug_bite", "name": "bug_bite",
@ -1212,7 +1296,10 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "bug_bite"
}
}, },
{ {
"name": "bug_buzz", "name": "bug_buzz",
@ -1228,7 +1315,14 @@
"mirror", "mirror",
"sound", "sound",
"ignore-substitute" "ignore-substitute"
] ],
"effect": {
"name": "change_target_special_defense",
"chance": 10,
"parameters": {
"amount": -1
}
}
}, },
{ {
"name": "bulk_up", "name": "bulk_up",
@ -1241,7 +1335,10 @@
"category": "status", "category": "status",
"flags": [ "flags": [
"snatch" "snatch"
] ],
"effect": {
"name": "bulk_up"
}
}, },
{ {
"name": "bulldoze", "name": "bulldoze",
@ -1256,7 +1353,13 @@
"protect", "protect",
"mirror", "mirror",
"nonskybattle" "nonskybattle"
] ],
"effect": {
"name": "change_target_speed",
"parameters": {
"amount": -1
}
}
}, },
{ {
"name": "bullet_punch", "name": "bullet_punch",
@ -1287,7 +1390,10 @@
"protect", "protect",
"mirror", "mirror",
"ballistics" "ballistics"
] ],
"effect": {
"name": "2_5_hit_move"
}
}, },
{ {
"name": "burn_up", "name": "burn_up",
@ -1302,7 +1408,10 @@
"protect", "protect",
"mirror", "mirror",
"defrost" "defrost"
] ],
"effect": {
"name": "burn_up"
}
}, },
{ {
"name": "calm_mind", "name": "calm_mind",
@ -3957,7 +4066,9 @@
"flags": [ "flags": [
"protect", "protect",
"mirror", "mirror",
"distance" "distance",
"hit_flying",
"effective_against_fly"
] ]
}, },
{ {
@ -8165,7 +8276,8 @@
"contact", "contact",
"protect", "protect",
"mirror", "mirror",
"punch" "punch",
"hit_flying"
] ]
}, },
{ {
@ -8295,7 +8407,8 @@
"flags": [ "flags": [
"protect", "protect",
"mirror", "mirror",
"nonskybattle" "nonskybattle",
"hit_flying"
] ]
}, },
{ {
@ -9537,7 +9650,8 @@
"category": "special", "category": "special",
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror",
"hit_flying"
] ]
}, },
{ {
@ -9866,7 +9980,9 @@
"category": "special", "category": "special",
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror",
"hit_flying",
"effective_against_fly"
] ]
}, },
{ {

View File

@ -1,4 +1,3 @@
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Libraries; using PkmnLib.Plugin.Gen7.Libraries;
namespace PkmnLib.Plugin.Gen7; namespace PkmnLib.Plugin.Gen7;

View File

@ -0,0 +1,5 @@
global using PkmnLib.Dynamic.ScriptHandling;
global using PkmnLib.Dynamic.ScriptHandling.Registry;
global using PkmnLib.Dynamic.Events;
global using PkmnLib.Dynamic.Models;
global using PkmnLib.Dynamic.Models.Choices;

View File

@ -1,7 +1,5 @@
using System; using System;
using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Libraries;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static; using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Libraries; namespace PkmnLib.Plugin.Gen7.Libraries;

View File

@ -1,8 +1,5 @@
using System; using System;
using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Libraries;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Libraries; namespace PkmnLib.Plugin.Gen7.Libraries;

View File

@ -1,8 +1,6 @@
using System; using System;
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Libraries;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static; using PkmnLib.Static;
using PkmnLib.Static.Moves; using PkmnLib.Static.Moves;

View File

@ -2,8 +2,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using PkmnLib.Dynamic; using PkmnLib.Dynamic;
using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Libraries;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Static; using PkmnLib.Static;
using PkmnLib.Static.Moves; using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -1,7 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -1,7 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Moves; namespace PkmnLib.Plugin.Gen7.Moves;

View File

@ -1,7 +1,4 @@
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Moves; namespace PkmnLib.Plugin.Gen7.Moves;

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Moves; namespace PkmnLib.Plugin.Gen7.Moves;
/// <summary> /// <summary>

View File

@ -1,9 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Utils; using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Moves; using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Species; using PkmnLib.Static.Species;

View File

@ -1,7 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts; using PkmnLib.Plugin.Gen7.Scripts;
using PkmnLib.Plugin.Gen7.Scripts.Side; using PkmnLib.Plugin.Gen7.Scripts.Side;
using PkmnLib.Plugin.Gen7.Scripts.Weather; using PkmnLib.Plugin.Gen7.Scripts.Weather;

View File

@ -1,8 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Events;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Moves; namespace PkmnLib.Plugin.Gen7.Moves;

View File

@ -1,5 +1,3 @@
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,8 +1,5 @@
using System; using System;
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -1,9 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Events;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,9 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,6 +1,4 @@
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static; using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Events;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bestow")] [Script(ScriptCategory.Move, "bestow")]

View File

@ -1,7 +1,4 @@
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,7 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -0,0 +1,13 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "block")]
public class Block : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.Volatile.Add(new BlockEffect());
}
}

View File

@ -0,0 +1,36 @@
using System.Collections.Generic;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bounce")]
public class Bounce : Script
{
/// <inheritdoc />
public override void PreventMove(IExecutingMove move, ref bool prevent)
{
if (move.User.Volatile.Contains<ChargeBounceEffect>())
return;
move.User.Volatile.Add(new ChargeBounceEffect(move.User));
move.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("bounce_charge", new Dictionary<string, object>()
{
{ "user", move.User }
}));
prevent = true;
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battle = move.User.BattleData?.Battle;
if (battle == null)
return;
var random = battle.Random;
if (random.EffectChance(30, move, target, hit))
{
target.SetStatus("paralyzed");
}
move.User.Volatile.Remove(ScriptUtils.ResolveName<ChargeBounceEffect>());
}
}

View File

@ -0,0 +1,22 @@
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "brick_break")]
public class BrickBreak : Script
{
/// <inheritdoc />
public override void OnBeforeMove(IExecutingMove move)
{
var sides = move.User.BattleData?.Battle.Sides;
if (sides == null)
return;
foreach (var side in sides)
{
side.VolatileScripts.Remove(ScriptUtils.ResolveName<ReflectEffect>());
side.VolatileScripts.Remove(ScriptUtils.ResolveName<LightScreenEffect>());
side.VolatileScripts.Remove(ScriptUtils.ResolveName<AuroraVeilEffect>());
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "brine")]
public class Brine : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
{
if (target.CurrentHealth <= target.BoostedStats.Hp / 2)
{
basePower = basePower.MultiplyOrMax(2);
}
}
}

View File

@ -0,0 +1,26 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bug_bite")]
public class BugBite : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var user = move.User;
var battleData = user.BattleData;
if (battleData == null)
return;
var targetHeldItem = target.HeldItem;
if (targetHeldItem is not { Category: ItemCategory.Berry })
{
move.GetHitData(target, hit).Fail();
return;
}
_ = target.SetHeldItem(null);
targetHeldItem.RunItemScript(battleData.Battle.Library.ScriptResolver, user);
}
}

View File

@ -0,0 +1,14 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bulk_up")]
public class BulkUp : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
move.User.ChangeStatBoost(Statistic.Attack, 1, true);
move.User.ChangeStatBoost(Statistic.Defense, 1, true);
}
}

View File

@ -0,0 +1,27 @@
using System.Linq;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "burn_up")]
public class BurnUp : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = move.User.BattleData;
if (battleData == null)
return;
var typeLibrary = battleData.Battle.Library.StaticLibrary.Types;
if (!typeLibrary.TryGetTypeIdentifier("fire", out var fireType))
return;
if (!move.User.Types.Contains(fireType))
{
move.GetHitData(target, hit).Fail();
return;
}
if (move.User.HasStatus("frozen"))
move.User.ClearStatus();
move.User.RemoveType(fireType);
}
}

View File

@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -1,7 +1,4 @@
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -0,0 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "2_hit_move")]
public class DoubleHitMove : Script
{
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
{
numberOfHits = 2;
}
}

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Side; using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,7 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,7 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "increased_critical_stage")] [Script(ScriptCategory.Move, "increased_critical_stage")]

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "2_5_hit_move")] [Script(ScriptCategory.Move, "2_5_hit_move")]

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -1,6 +1,4 @@
using System; using System;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@ -0,0 +1,30 @@
using System.Collections.Generic;
using PkmnLib.Dynamic.Models.BattleFlow;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "recoil")]
public class Recoil : Script
{
private float _recoilPercentage;
/// <inheritdoc />
public override void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
{
if (parameters == null)
return;
if (parameters.TryGetValue("recoil_percentage", out var recoilPercentage))
_recoilPercentage = recoilPercentage as float? ?? 0f;
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (_recoilPercentage <= 0)
return;
var hitData = move.GetHitData(target, hit);
var recoilDamage = (uint)(hitData.Damage * _recoilPercentage);
move.User.Damage(recoilDamage, DamageSource.Misc);
}
}

View File

@ -0,0 +1,13 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "requires_recharge")]
public class RequiresRecharge : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
move.User.Volatile.Add(new RequiresRechargeEffect(move.User));
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "set_status")]
public class SetStatus : Script
{
private string? _status;
/// <inheritdoc />
public override void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
{
if (parameters?.TryGetValue("status", out var s) != true)
throw new Exception("Missing required parameter 'status'");
_status = s as string ?? throw new Exception("Missing required parameter 'status'");
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (_status == null)
throw new Exception("Missing required parameter 'status'");
target.SetStatus(_status);
}
}

View File

@ -1,8 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "struggle")] [Script(ScriptCategory.Move, "struggle")]

View File

@ -1,4 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Static.Moves; using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "beak_blast_effect")] [Script(ScriptCategory.Pokemon, "beak_blast_effect")]

View File

@ -1,10 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Models; using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
@ -54,16 +51,7 @@ public class BideEffect : Script
choice = _choice; choice = _choice;
return; return;
} }
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
var bideMove = _owner.Moves.FirstOrDefault(x => x?.MoveData.Name == "bide"); choice = TurnChoiceHelper.CreateMoveChoice(_owner, "bide", opposingSideIndex, position);
if (bideMove == null)
{
if (!_owner.Library.StaticLibrary.Moves.TryGet("bide", out var moveData))
throw new Exception("Move 'bide' not found in move library.");
bideMove = new LearnedMoveImpl(moveData, MoveLearnMethod.Unknown);
}
choice = _choice = new MoveChoice(_owner, bideMove, sideIndex, position);
} }
} }

View File

@ -1,8 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "bind")] [Script(ScriptCategory.Pokemon, "bind")]

View File

@ -0,0 +1,11 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "block")]
public class BlockEffect : Script
{
/// <inheritdoc />
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
/// <inheritdoc />
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
}

View File

@ -0,0 +1,35 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "charge_bounce")]
public class ChargeBounceEffect : Script
{
private readonly IPokemon _owner;
public ChargeBounceEffect(IPokemon owner)
{
_owner = owner;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "bounce", opposingSideIndex, position);
}
/// <inheritdoc />
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
if (!executingMove.UseMove.HasFlag("hit_flying"))
block = true;
}
/// <inheritdoc />
public override void ChangeIncomingDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (!move.UseMove.HasFlag("effective_against_fly"))
damage *= 2;
}
}

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "flinch_effect")] [Script(ScriptCategory.Pokemon, "flinch_effect")]

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "heal_each_end_of_turn_effect")] [Script(ScriptCategory.Pokemon, "heal_each_end_of_turn_effect")]

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
/// <summary> /// <summary>

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "prevent_foes_exit_effect")] [Script(ScriptCategory.Pokemon, "prevent_foes_exit_effect")]

View File

@ -1,7 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public abstract class ProtectionEffectScript : Script public abstract class ProtectionEffectScript : Script

View File

@ -1,8 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
/// <summary> /// <summary>

View File

@ -0,0 +1,31 @@
using System.Collections.Generic;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "requires_recharge")]
public class RequiresRechargeEffect : Script
{
private readonly IPokemon _owner;
public RequiresRechargeEffect(IPokemon owner)
{
_owner = owner;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{
choice = new PassChoice(_owner);
}
/// <inheritdoc />
public override void OnBeforeTurnStart(ITurnChoice choice)
{
RemoveSelf();
_owner.BattleData?.Battle.EventHook.Invoke(new DialogEvent("pokemon_must_recharge",
new Dictionary<string, object>()
{
{ "pokemon", _owner }
}));
}
}

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static.Moves; using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Side; namespace PkmnLib.Plugin.Gen7.Scripts.Side;

View File

@ -1,7 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Side; namespace PkmnLib.Plugin.Gen7.Scripts.Side;

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Side; namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "light_screen")] [Script(ScriptCategory.Side, "light_screen")]

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Side; namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "reflect")] [Script(ScriptCategory.Side, "reflect")]

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Status; namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "burned")] [Script(ScriptCategory.Status, "burned")]

View File

@ -0,0 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "frozen")]
public class Frozen : Script
{
// TODO: Implement the Frozen status effect.
}

View File

@ -0,0 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "paralyzed")]
public class Paralyzed : Script
{
// TODO: Implement the Paralyzed status effect.
}

View File

@ -1,6 +1,3 @@
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
namespace PkmnLib.Plugin.Gen7.Scripts.Status; namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "poisoned")] [Script(ScriptCategory.Status, "poisoned")]

View File

@ -0,0 +1,20 @@
using System;
using System.Linq;
namespace PkmnLib.Plugin.Gen7.Scripts.Utils;
public static class TurnChoiceHelper
{
public static IMoveChoice CreateMoveChoice(IPokemon owner, string moveName, byte targetSide, byte targetPosition)
{
var move = owner.Moves.FirstOrDefault(x => x?.MoveData.Name == moveName);
if (move == null)
{
if (!owner.Library.StaticLibrary.Moves.TryGet(moveName, out var moveData))
throw new Exception($"Move '{moveName}' not found in move library.");
move = new LearnedMoveImpl(moveData, MoveLearnMethod.Unknown);
}
return new MoveChoice(owner, move, targetSide, targetPosition);
}
}

View File

@ -1,9 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using PkmnLib.Dynamic.Events;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static; using PkmnLib.Static;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;