Adds a lot more move effects
This commit is contained in:
parent
802481c1f5
commit
549b92048a
|
@ -163,30 +163,13 @@ public static class TurnRunner
|
|||
var battleData = user.BattleData;
|
||||
if (battleData == null)
|
||||
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;
|
||||
if (itemChoice is { TargetSide: not null, TargetPosition: not null })
|
||||
{
|
||||
var side = battle.Sides[itemChoice.TargetSide.Value];
|
||||
target = side.Pokemon[itemChoice.TargetPosition.Value];
|
||||
}
|
||||
|
||||
var requiresTarget = itemScript.RequiresTarget;
|
||||
if (requiresTarget)
|
||||
{
|
||||
target ??= user;
|
||||
itemScript.OnUseWithTarget(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemScript.OnUse();
|
||||
}
|
||||
itemChoice.Item.RunItemScript(battle.Library.ScriptResolver, target ?? user);
|
||||
}
|
||||
|
||||
}
|
|
@ -313,6 +313,10 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
|||
/// </summary>
|
||||
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>
|
||||
/// Adds a non-volatile status to the Pokemon.
|
||||
/// </summary>
|
||||
|
@ -347,6 +351,17 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
|||
/// Marks a Pokemon as seen in the battle.
|
||||
/// </summary>
|
||||
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>
|
||||
/// Converts the data structure to a serializable format.
|
||||
|
@ -639,8 +654,10 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||
/// <inheritdoc />
|
||||
public bool AllowedExperience { get; set; }
|
||||
|
||||
private List<TypeIdentifier> _types = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<TypeIdentifier> Types { get; private set; }
|
||||
public IReadOnlyList<TypeIdentifier> Types { get => _types; private set => _types = value.ToList(); }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEgg { get; private set; }
|
||||
|
@ -940,6 +957,9 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||
_learnedMoves[index] = new LearnedMoveImpl(move, method);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasStatus(StringKey status) => StatusScript.Script?.Name == status;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetStatus(StringKey status)
|
||||
{
|
||||
|
@ -1000,6 +1020,18 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||
/// <inheritdoc />
|
||||
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 />
|
||||
public SerializedPokemon Serialize() => new(this);
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Static;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -32,7 +32,7 @@ public interface IScriptSet : IEnumerable<ScriptContainer>
|
|||
/// Gets a script from the set using its type.
|
||||
/// </summary>
|
||||
T? Get<T>() where T : Script;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Removes a script from the set using its unique name.
|
||||
/// </summary>
|
||||
|
@ -43,6 +43,11 @@ public interface IScriptSet : IEnumerable<ScriptContainer>
|
|||
/// </summary>
|
||||
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>
|
||||
/// Checks if the set has a script with the given name.
|
||||
/// </summary>
|
||||
|
|
|
@ -864,7 +864,11 @@
|
|||
"protect",
|
||||
"mirror",
|
||||
"bite"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "flinch",
|
||||
"chance": 30
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "black_hole_eclipse__physical",
|
||||
|
@ -901,7 +905,10 @@
|
|||
"recharge",
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "requires_recharge"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "blaze_kick",
|
||||
|
@ -916,7 +923,14 @@
|
|||
"contact",
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "set_status",
|
||||
"chance": 10,
|
||||
"parameters": {
|
||||
"status": "burned"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "blizzard",
|
||||
|
@ -930,7 +944,14 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "set_status",
|
||||
"chance": 10,
|
||||
"parameters": {
|
||||
"status": "frozen"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "block",
|
||||
|
@ -944,7 +965,10 @@
|
|||
"flags": [
|
||||
"reflectable",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "block"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bloom_doom__physical",
|
||||
|
@ -980,7 +1004,14 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "set_status",
|
||||
"chance": 20,
|
||||
"parameters": {
|
||||
"status": "burned"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "body_slam",
|
||||
|
@ -996,7 +1027,14 @@
|
|||
"protect",
|
||||
"mirror",
|
||||
"nonskybattle"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "set_status",
|
||||
"chance": 30,
|
||||
"parameters": {
|
||||
"status": "paralyzed"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bolt_strike",
|
||||
|
@ -1011,7 +1049,14 @@
|
|||
"contact",
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "set_status",
|
||||
"chance": 20,
|
||||
"parameters": {
|
||||
"status": "paralyzed"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bone_club",
|
||||
|
@ -1025,7 +1070,11 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "flinch",
|
||||
"chance": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bone_rush",
|
||||
|
@ -1039,7 +1088,10 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "2_5_hit_move"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bonemerang",
|
||||
|
@ -1053,7 +1105,10 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "2_hit_move"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "boomburst",
|
||||
|
@ -1087,7 +1142,10 @@
|
|||
"mirror",
|
||||
"gravity",
|
||||
"distance"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "bounce"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "brave_bird",
|
||||
|
@ -1103,7 +1161,13 @@
|
|||
"protect",
|
||||
"mirror",
|
||||
"distance"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "recoil",
|
||||
"parameters": {
|
||||
"amount": 0.33333
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "breakneck_blitz__physical",
|
||||
|
@ -1140,7 +1204,10 @@
|
|||
"contact",
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "brick_break"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "brine",
|
||||
|
@ -1154,7 +1221,10 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "brine"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "brutal_swing",
|
||||
|
@ -1183,7 +1253,14 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "change_target_speed",
|
||||
"chance": 10,
|
||||
"parameters": {
|
||||
"amount": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bubble_beam",
|
||||
|
@ -1197,7 +1274,14 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "change_target_speed",
|
||||
"chance": 10,
|
||||
"parameters": {
|
||||
"amount": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bug_bite",
|
||||
|
@ -1212,7 +1296,10 @@
|
|||
"contact",
|
||||
"protect",
|
||||
"mirror"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "bug_bite"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bug_buzz",
|
||||
|
@ -1228,7 +1315,14 @@
|
|||
"mirror",
|
||||
"sound",
|
||||
"ignore-substitute"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "change_target_special_defense",
|
||||
"chance": 10,
|
||||
"parameters": {
|
||||
"amount": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bulk_up",
|
||||
|
@ -1241,7 +1335,10 @@
|
|||
"category": "status",
|
||||
"flags": [
|
||||
"snatch"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "bulk_up"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bulldoze",
|
||||
|
@ -1256,7 +1353,13 @@
|
|||
"protect",
|
||||
"mirror",
|
||||
"nonskybattle"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "change_target_speed",
|
||||
"parameters": {
|
||||
"amount": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bullet_punch",
|
||||
|
@ -1287,7 +1390,10 @@
|
|||
"protect",
|
||||
"mirror",
|
||||
"ballistics"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "2_5_hit_move"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "burn_up",
|
||||
|
@ -1302,7 +1408,10 @@
|
|||
"protect",
|
||||
"mirror",
|
||||
"defrost"
|
||||
]
|
||||
],
|
||||
"effect": {
|
||||
"name": "burn_up"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "calm_mind",
|
||||
|
@ -3957,7 +4066,9 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror",
|
||||
"distance"
|
||||
"distance",
|
||||
"hit_flying",
|
||||
"effective_against_fly"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -8165,7 +8276,8 @@
|
|||
"contact",
|
||||
"protect",
|
||||
"mirror",
|
||||
"punch"
|
||||
"punch",
|
||||
"hit_flying"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -8295,7 +8407,8 @@
|
|||
"flags": [
|
||||
"protect",
|
||||
"mirror",
|
||||
"nonskybattle"
|
||||
"nonskybattle",
|
||||
"hit_flying"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -9537,7 +9650,8 @@
|
|||
"category": "special",
|
||||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
"mirror",
|
||||
"hit_flying"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -9866,7 +9980,9 @@
|
|||
"category": "special",
|
||||
"flags": [
|
||||
"protect",
|
||||
"mirror"
|
||||
"mirror",
|
||||
"hit_flying",
|
||||
"effective_against_fly"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Plugin.Gen7.Libraries;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7;
|
||||
|
|
|
@ -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;
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using PkmnLib.Dynamic.Libraries;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Libraries;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
using System;
|
||||
using PkmnLib.Dynamic.Libraries;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Libraries;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using PkmnLib.Dynamic.Libraries;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using PkmnLib.Dynamic;
|
||||
using PkmnLib.Dynamic.Libraries;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.Models.Choices;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Moves;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.Linq;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
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.Static.Moves;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
|
|
@ -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.Static.Species;
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
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.Side;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using PkmnLib.Dynamic.Events;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
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;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
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;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System.Linq;
|
||||
using PkmnLib.Dynamic.Models.Choices;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Events;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "bestow")]
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.Linq;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
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.Static.Utils;
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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>());
|
||||
}
|
||||
}
|
|
@ -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>());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.Linq;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
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.Static.Utils;
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "increased_critical_stage")]
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models.Choices;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "2_5_hit_move")]
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
[Script(ScriptCategory.Move, "struggle")]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "beak_blast_effect")]
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
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;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
|
@ -54,16 +51,7 @@ public class BideEffect : Script
|
|||
choice = _choice;
|
||||
return;
|
||||
}
|
||||
|
||||
var bideMove = _owner.Moves.FirstOrDefault(x => x?.MoveData.Name == "bide");
|
||||
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);
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "bide", opposingSideIndex, position);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "bind")]
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "flinch_effect")]
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "heal_each_end_of_turn_effect")]
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models.Choices;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "prevent_foes_exit_effect")]
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
public abstract class ProtectionEffectScript : Script
|
||||
|
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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 }
|
||||
}));
|
||||
}
|
||||
}
|
|
@ -1,6 +1,3 @@
|
|||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "light_screen")]
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "reflect")]
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||
|
||||
[Script(ScriptCategory.Status, "burned")]
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||
|
||||
[Script(ScriptCategory.Status, "frozen")]
|
||||
public class Frozen : Script
|
||||
{
|
||||
// TODO: Implement the Frozen status effect.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||
|
||||
[Script(ScriptCategory.Status, "paralyzed")]
|
||||
public class Paralyzed : Script
|
||||
{
|
||||
// TODO: Implement the Paralyzed status effect.
|
||||
}
|
|
@ -1,6 +1,3 @@
|
|||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||
|
||||
[Script(ScriptCategory.Status, "poisoned")]
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -1,9 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
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.Utils;
|
||||
|
||||
|
|
Loading…
Reference in New Issue