This commit is contained in:
parent
e305cfaef6
commit
2533512eda
@ -1,4 +1,3 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Dynamic.Models;
|
using PkmnLib.Dynamic.Models;
|
||||||
using PkmnLib.Dynamic.Models.Choices;
|
using PkmnLib.Dynamic.Models.Choices;
|
||||||
using PkmnLib.Static.Moves;
|
using PkmnLib.Static.Moves;
|
||||||
|
@ -132,7 +132,7 @@ public static class MoveTurnExecutor
|
|||||||
target.RunScriptHook(x => x.IsInvulnerableToMove(executingMove, target, ref isInvulnerable));
|
target.RunScriptHook(x => x.IsInvulnerableToMove(executingMove, target, ref isInvulnerable));
|
||||||
if (isInvulnerable)
|
if (isInvulnerable)
|
||||||
{
|
{
|
||||||
// TODO: event?
|
battle.EventHook.Invoke(new MoveInvulnerableEvent(executingMove, target));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
|
|
||||||
namespace PkmnLib.Dynamic.Events;
|
namespace PkmnLib.Dynamic.Events;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
18
PkmnLib.Dynamic/Events/MoveInvulnerableEvent.cs
Normal file
18
PkmnLib.Dynamic/Events/MoveInvulnerableEvent.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using PkmnLib.Dynamic.Models;
|
||||||
|
|
||||||
|
namespace PkmnLib.Dynamic.Events;
|
||||||
|
|
||||||
|
public class MoveInvulnerableEvent : IEventData
|
||||||
|
{
|
||||||
|
public IExecutingMove ExecutingMove { get; }
|
||||||
|
public IPokemon Target { get; }
|
||||||
|
|
||||||
|
public MoveInvulnerableEvent(IExecutingMove executingMove, IPokemon target)
|
||||||
|
{
|
||||||
|
ExecutingMove = executingMove;
|
||||||
|
Target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public EventBatchId BatchId { get; init; }
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
global using LevelInt = byte;
|
global using LevelInt = byte;
|
||||||
|
global using JetBrains.Annotations;
|
||||||
|
|
||||||
namespace PkmnLib.Dynamic;
|
namespace PkmnLib.Dynamic;
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Dynamic.Libraries.DataLoaders.Models;
|
using PkmnLib.Dynamic.Libraries.DataLoaders.Models;
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Libraries;
|
using PkmnLib.Static.Libraries;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Dynamic.Libraries.DataLoaders.Models;
|
using PkmnLib.Dynamic.Libraries.DataLoaders.Models;
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Libraries;
|
using PkmnLib.Static.Libraries;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Dynamic.Libraries.DataLoaders.Models;
|
using PkmnLib.Dynamic.Libraries.DataLoaders.Models;
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Libraries;
|
using PkmnLib.Static.Libraries;
|
||||||
|
@ -40,6 +40,13 @@ public interface IBattle : IScriptSource, IDeepCloneable, IDisposable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
byte PositionsPerSide { get; }
|
byte PositionsPerSide { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the environment the battle is taking place in, such as "grass", "cave", etc.
|
||||||
|
/// This is sometimes referred to as the "terrain" in the games, but is not the same as the
|
||||||
|
/// <see cref="TerrainName"/> which is a battle condition that can be set by scripts.
|
||||||
|
/// </summary>
|
||||||
|
StringKey EnvironmentName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this battle is a wild battle. In a wild battle, the player can catch the opposing Pokemon,
|
/// Whether this battle is a wild battle. In a wild battle, the player can catch the opposing Pokemon,
|
||||||
/// and moves like roar will end the battle instead of switching out the Pokemon.
|
/// and moves like roar will end the battle instead of switching out the Pokemon.
|
||||||
@ -173,9 +180,12 @@ public class BattleImpl : ScriptSource, IBattle
|
|||||||
/// <param name="canFlee">Whether Pokémon are allowed to flee from the battle.</param>
|
/// <param name="canFlee">Whether Pokémon are allowed to flee from the battle.</param>
|
||||||
/// <param name="numberOfSides">The number of sides in the battle. Generally 2.</param>
|
/// <param name="numberOfSides">The number of sides in the battle. Generally 2.</param>
|
||||||
/// <param name="positionsPerSide">The number of spots there are on each side for Pokémon. 1 for singles, 2 for doubles, etc.</param>
|
/// <param name="positionsPerSide">The number of spots there are on each side for Pokémon. 1 for singles, 2 for doubles, etc.</param>
|
||||||
|
/// <param name="isWildBattle">Whether this battle is a wild battle. In a wild battle, the player can catch the opposing Pokémon,
|
||||||
|
/// and moves like roar will end the battle instead of switching out the Pokémon.</param>
|
||||||
|
/// <param name="environmentName">The name of the environment the battle is taking place in, such as "grass", "cave", etc.</param>
|
||||||
/// <param name="randomSeed">The seed for the RNG. If null, this uses a time-dependent seed.</param>
|
/// <param name="randomSeed">The seed for the RNG. If null, this uses a time-dependent seed.</param>
|
||||||
public BattleImpl(IDynamicLibrary library, IReadOnlyList<IBattleParty> parties, bool canFlee, byte numberOfSides,
|
public BattleImpl(IDynamicLibrary library, IReadOnlyList<IBattleParty> parties, bool canFlee, byte numberOfSides,
|
||||||
byte positionsPerSide, bool isWildBattle, int? randomSeed = null)
|
byte positionsPerSide, bool isWildBattle, StringKey environmentName, int? randomSeed = null)
|
||||||
{
|
{
|
||||||
Library = library;
|
Library = library;
|
||||||
Parties = parties;
|
Parties = parties;
|
||||||
@ -183,6 +193,7 @@ public class BattleImpl : ScriptSource, IBattle
|
|||||||
NumberOfSides = numberOfSides;
|
NumberOfSides = numberOfSides;
|
||||||
PositionsPerSide = positionsPerSide;
|
PositionsPerSide = positionsPerSide;
|
||||||
IsWildBattle = isWildBattle;
|
IsWildBattle = isWildBattle;
|
||||||
|
EnvironmentName = environmentName;
|
||||||
Volatile = new ScriptSet(this);
|
Volatile = new ScriptSet(this);
|
||||||
var sides = new IBattleSide[numberOfSides];
|
var sides = new IBattleSide[numberOfSides];
|
||||||
for (byte i = 0; i < numberOfSides; i++)
|
for (byte i = 0; i < numberOfSides; i++)
|
||||||
@ -207,6 +218,9 @@ public class BattleImpl : ScriptSource, IBattle
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public byte PositionsPerSide { get; }
|
public byte PositionsPerSide { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public StringKey EnvironmentName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsWildBattle { get; }
|
public bool IsWildBattle { get; }
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Dynamic.ScriptHandling;
|
using PkmnLib.Dynamic.ScriptHandling;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Dynamic.Events;
|
using PkmnLib.Dynamic.Events;
|
||||||
using PkmnLib.Dynamic.Libraries;
|
using PkmnLib.Dynamic.Libraries;
|
||||||
using PkmnLib.Dynamic.Models.Serialized;
|
using PkmnLib.Dynamic.Models.Serialized;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
|
|
||||||
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using PkmnLib.Dynamic.Libraries;
|
using PkmnLib.Dynamic.Libraries;
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
@ -5,11 +5,17 @@ namespace PkmnLib.Dynamic;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class StaticHelpers
|
public static class StaticHelpers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A delegate that provides the current date and time.
|
||||||
|
/// </summary>
|
||||||
|
public delegate DateTimeOffset DateTimeProviderDelegate();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A function to get the current date and time. This can be replaced in cases where the date and time
|
/// A function to get the current date and time. This can be replaced in cases where the date and time
|
||||||
/// may not be the same as the system time.
|
/// may not be the same as the system time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Func<DateTimeOffset> DateTimeProvider { get; set; } = () => DateTimeOffset.Now;
|
[PublicAPI]
|
||||||
|
public static DateTimeProviderDelegate DateTimeProvider { get; set; } = () => DateTimeOffset.Now;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the current date and time.
|
/// Get the current date and time.
|
||||||
|
@ -71,4 +71,6 @@ public readonly record struct StringKey
|
|||||||
|
|
||||||
/// <inheritdoc cref="Equals(StringKey)"/>
|
/// <inheritdoc cref="Equals(StringKey)"/>
|
||||||
public static bool operator !=(StringKey? left, StringKey right) => !(left == right);
|
public static bool operator !=(StringKey? left, StringKey right) => !(left == right);
|
||||||
|
|
||||||
|
public bool Contains(StringKey other) => _key.IndexOf(other._key, StringComparison.InvariantCultureIgnoreCase) >= 0;
|
||||||
}
|
}
|
@ -87,7 +87,8 @@ public class IntegrationTestRunner
|
|||||||
return new BattlePartyImpl(party, x.Indices.Select(y => new ResponsibleIndex(y[0], y[1])).ToArray());
|
return new BattlePartyImpl(party, x.Indices.Select(y => new ResponsibleIndex(y[0], y[1])).ToArray());
|
||||||
}).ProcessOneAtATime().GetResultsAsync();
|
}).ProcessOneAtATime().GetResultsAsync();
|
||||||
using var battle = new BattleImpl(library, parties, test.BattleSetup.CanFlee, test.BattleSetup.NumberOfSides,
|
using var battle = new BattleImpl(library, parties, test.BattleSetup.CanFlee, test.BattleSetup.NumberOfSides,
|
||||||
test.BattleSetup.PositionsPerSide, false, test.BattleSetup.Seed);
|
test.BattleSetup.PositionsPerSide, false, test.BattleSetup.EnvironmentName ?? "grass",
|
||||||
|
test.BattleSetup.Seed);
|
||||||
|
|
||||||
foreach (var action in test.Actions)
|
foreach (var action in test.Actions)
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,7 @@ public class IntegrationTestBattleSetup
|
|||||||
public byte NumberOfSides { get; set; }
|
public byte NumberOfSides { get; set; }
|
||||||
public byte PositionsPerSide { get; set; }
|
public byte PositionsPerSide { get; set; }
|
||||||
public bool HasDamageRandomness { get; set; }
|
public bool HasDamageRandomness { get; set; }
|
||||||
|
public string? EnvironmentName { get; set; }
|
||||||
public IntegrationTestParty[] Parties { get; set; } = null!;
|
public IntegrationTestParty[] Parties { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ public class DeepCloneTests
|
|||||||
new BattlePartyImpl(party1, [new ResponsibleIndex(0, 0)]),
|
new BattlePartyImpl(party1, [new ResponsibleIndex(0, 0)]),
|
||||||
new BattlePartyImpl(party2, [new ResponsibleIndex(1, 0)]),
|
new BattlePartyImpl(party2, [new ResponsibleIndex(1, 0)]),
|
||||||
};
|
};
|
||||||
using var battle = new BattleImpl(library, parties, false, 2, 3, false, 0);
|
using var battle = new BattleImpl(library, parties, false, 2, 3, false, "grass", 0);
|
||||||
battle.Sides[0].SwapPokemon(0, party1[0]);
|
battle.Sides[0].SwapPokemon(0, party1[0]);
|
||||||
battle.Sides[1].SwapPokemon(0, party2[0]);
|
battle.Sides[1].SwapPokemon(0, party2[0]);
|
||||||
party1[0]!.ChangeStatBoost(Statistic.Defense, 2, true, false);
|
party1[0]!.ChangeStatBoost(Statistic.Defense, 2, true, false);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using PkmnLib.Dynamic;
|
using PkmnLib.Dynamic;
|
||||||
using PkmnLib.Dynamic.Libraries;
|
using PkmnLib.Dynamic.Libraries;
|
||||||
using PkmnLib.Static.Moves;
|
using PkmnLib.Static.Moves;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Libraries.Battling;
|
namespace PkmnLib.Plugin.Gen7.Libraries.Battling;
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
|
|
||||||
[Script(ScriptCategory.Battle, "gravity")]
|
[Script(ScriptCategory.Battle, "gravity")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
|
|
||||||
[Script(ScriptCategory.Battle, "mud_sport")]
|
[Script(ScriptCategory.Battle, "mud_sport")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
|
|
||||||
[Script(ScriptCategory.Battle, "uproar_effect")]
|
[Script(ScriptCategory.Battle, "uproar_effect")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Items;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Items;
|
||||||
|
|
||||||
[ItemScript("healing_item")]
|
[ItemScript("healing_item")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Items;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Items;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||||
|
|
||||||
[Script(ScriptCategory.MoveVolatile, "bypass_sleep")]
|
[Script(ScriptCategory.MoveVolatile, "bypass_sleep")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||||
|
|
||||||
[Script(ScriptCategory.MoveVolatile, "me_first")]
|
[Script(ScriptCategory.MoveVolatile, "me_first")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||||
|
|
||||||
[Script(ScriptCategory.MoveVolatile, "round")]
|
[Script(ScriptCategory.MoveVolatile, "round")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Moves;
|
using PkmnLib.Static.Moves;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "beat_up")]
|
[Script(ScriptCategory.Move, "beat_up")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "brine")]
|
[Script(ScriptCategory.Move, "brine")]
|
||||||
|
@ -1,7 +1,44 @@
|
|||||||
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "camouflage")]
|
[Script(ScriptCategory.Move, "camouflage")]
|
||||||
public class Camouflage : Script
|
public class Camouflage : Script
|
||||||
{
|
{
|
||||||
// FIXME: Implement this. How to get the terrain in a sane manner? See also SecretPower.cs
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
var type = GetTypeIdentifier(move.Battle);
|
||||||
|
if (type == null)
|
||||||
|
return;
|
||||||
|
move.User.SetTypes([type.Value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TypeIdentifier? GetTypeIdentifier(IBattle battle)
|
||||||
|
{
|
||||||
|
var typesLibrary = battle.Library.StaticLibrary.Types;
|
||||||
|
var environmentCategory = battle.GetEnvironmentCategory();
|
||||||
|
return environmentCategory switch
|
||||||
|
{
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Electric when typesLibrary.TryGetTypeIdentifier("electric",
|
||||||
|
out var electricType) => electricType,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Fairy when typesLibrary.TryGetTypeIdentifier("fairy",
|
||||||
|
out var fairyType) => fairyType,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Grass when typesLibrary.TryGetTypeIdentifier("grass",
|
||||||
|
out var grassType) => grassType,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Psychic when typesLibrary.TryGetTypeIdentifier("psychic",
|
||||||
|
out var psychicType) => psychicType,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Rock when typesLibrary.TryGetTypeIdentifier("rock", out var rockType)
|
||||||
|
=> rockType,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Ground when typesLibrary.TryGetTypeIdentifier("ground",
|
||||||
|
out var groundType) => groundType,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Ice when typesLibrary.TryGetTypeIdentifier("ice", out var iceType) =>
|
||||||
|
iceType,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Water when typesLibrary.TryGetTypeIdentifier("water",
|
||||||
|
out var waterType) => waterType,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Normal when typesLibrary.TryGetTypeIdentifier("normal",
|
||||||
|
out var normalType) => normalType,
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "change_all_target_stats")]
|
[Script(ScriptCategory.Move, "change_all_target_stats")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "change_multiple_target_stat_boosts")]
|
[Script(ScriptCategory.Move, "change_multiple_target_stat_boosts")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "change_multiple_user_stat_boosts")]
|
[Script(ScriptCategory.Move, "change_multiple_user_stat_boosts")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
public abstract class ChangeTargetStats : Script
|
public abstract class ChangeTargetStats : Script
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
public abstract class ChangeUserStats : Script
|
public abstract class ChangeUserStats : Script
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "conversion")]
|
[Script(ScriptCategory.Move, "conversion")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "conversion_2")]
|
[Script(ScriptCategory.Move, "conversion_2")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "core_enforcer")]
|
[Script(ScriptCategory.Move, "core_enforcer")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "cure_party_status")]
|
[Script(ScriptCategory.Move, "cure_party_status")]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "facade")]
|
[Script(ScriptCategory.Move, "facade")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "flame_burst")]
|
[Script(ScriptCategory.Move, "flame_burst")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "flame_wheel")]
|
[Script(ScriptCategory.Move, "flame_wheel")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "gear_up")]
|
[Script(ScriptCategory.Move, "gear_up")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "grudge")]
|
[Script(ScriptCategory.Move, "grudge")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "heal_percent")]
|
[Script(ScriptCategory.Move, "heal_percent")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "hex")]
|
[Script(ScriptCategory.Move, "hex")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "last_resort")]
|
[Script(ScriptCategory.Move, "last_resort")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "magnetic_flux")]
|
[Script(ScriptCategory.Move, "magnetic_flux")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Static.Moves;
|
using PkmnLib.Static.Moves;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Static.Moves;
|
using PkmnLib.Static.Moves;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "natural_gift")]
|
[Script(ScriptCategory.Move, "natural_gift")]
|
||||||
|
@ -1,7 +1,52 @@
|
|||||||
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
|
using PkmnLib.Static.Moves;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "nature_power")]
|
[Script(ScriptCategory.Move, "nature_power")]
|
||||||
public class NaturePower : Script
|
public class NaturePower : Script
|
||||||
{
|
{
|
||||||
// FIXME: Implement this. How to get the terrain in a sane manner?
|
/// <inheritdoc />
|
||||||
|
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||||
|
{
|
||||||
|
var battleData = choice.User.BattleData;
|
||||||
|
if (battleData is null)
|
||||||
|
return;
|
||||||
|
var newMoveName = GetMoveName(battleData.Battle);
|
||||||
|
if (newMoveName is null)
|
||||||
|
{
|
||||||
|
choice.Fail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
moveName = newMoveName.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static StringKey? GetMoveName(IBattle battle)
|
||||||
|
{
|
||||||
|
var movesLibrary = battle.Library.StaticLibrary.Moves;
|
||||||
|
var environmentCategory = battle.GetEnvironmentCategory();
|
||||||
|
var moveName = environmentCategory switch
|
||||||
|
{
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Electric when movesLibrary.TryGet("thunderbolt",
|
||||||
|
out var thunderboltMove) => (StringKey?)thunderboltMove.Name,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Fairy when movesLibrary.TryGet("moonblast", out var moonblastMove) =>
|
||||||
|
moonblastMove.Name,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Grass when movesLibrary.TryGet("energy_ball", out var energyballMove)
|
||||||
|
=> energyballMove.Name,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Psychic when movesLibrary.TryGet("psychic", out var psychicMove) =>
|
||||||
|
psychicMove.Name,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Rock when movesLibrary.TryGet("power_gem", out var rockMove) =>
|
||||||
|
rockMove.Name,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Ground when movesLibrary.TryGet("earth_power", out var groundMove) =>
|
||||||
|
groundMove.Name,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Ice when movesLibrary.TryGet("ice_beam", out var iceMove) => iceMove
|
||||||
|
.Name,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Water when movesLibrary.TryGet("hydro_pump", out var waterMove) =>
|
||||||
|
waterMove.Name,
|
||||||
|
EnvironmentHelper.EnvironmentCategory.Normal when movesLibrary.TryGet("tri_attack", out var normalMove) =>
|
||||||
|
normalMove.Name,
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
return moveName;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "one_hit_ko")]
|
[Script(ScriptCategory.Move, "one_hit_ko")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "power_trip")]
|
[Script(ScriptCategory.Move, "power_trip")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "psywave")]
|
[Script(ScriptCategory.Move, "psywave")]
|
||||||
|
@ -13,16 +13,15 @@ public class RapidSpin : Script
|
|||||||
move.User.Volatile.Remove<BindEffect>();
|
move.User.Volatile.Remove<BindEffect>();
|
||||||
move.User.Volatile.Remove<FireSpinEffect>();
|
move.User.Volatile.Remove<FireSpinEffect>();
|
||||||
move.User.Volatile.Remove<MagmaStormEffect>();
|
move.User.Volatile.Remove<MagmaStormEffect>();
|
||||||
// TODO: Whirlpool effect removal
|
move.User.Volatile.Remove<WhirlpoolEffect>();
|
||||||
// TODO: Wrap effect removal
|
|
||||||
|
|
||||||
var battleData = move.User.BattleData;
|
var battleData = move.User.BattleData;
|
||||||
if (battleData != null)
|
if (battleData != null)
|
||||||
{
|
{
|
||||||
battleData.BattleSide.VolatileScripts.Remove<SpikesEffect>();
|
battleData.BattleSide.VolatileScripts.Remove<SpikesEffect>();
|
||||||
battleData.BattleSide.VolatileScripts.Remove<StickyWebEffect>();
|
battleData.BattleSide.VolatileScripts.Remove<StickyWebEffect>();
|
||||||
// TODO: Remove Toxic Spikes
|
battleData.BattleSide.VolatileScripts.Remove<ToxicSpikesEffect>();
|
||||||
// TODO: Remove Stealth Rock
|
battleData.BattleSide.VolatileScripts.Remove<StealthRockEffect>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "reflect")]
|
[Script(ScriptCategory.Move, "reflect")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "retaliate")]
|
[Script(ScriptCategory.Move, "retaliate")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "rototiller")]
|
[Script(ScriptCategory.Move, "rototiller")]
|
||||||
|
@ -1,7 +1,46 @@
|
|||||||
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "secret_power")]
|
[Script(ScriptCategory.Move, "secret_power")]
|
||||||
public class SecretPower : Script
|
public class SecretPower : Script
|
||||||
{
|
{
|
||||||
// FIXME: Implement this. How to get the terrain in a sane manner? See also Camouflage.cs
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
var environmentCategory = move.Battle.GetEnvironmentCategory();
|
||||||
|
switch (environmentCategory)
|
||||||
|
{
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Electric:
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Normal:
|
||||||
|
target.SetStatus(ScriptUtils.ResolveName<Status.Paralyzed>(), move.User);
|
||||||
|
break;
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Rock:
|
||||||
|
target.Volatile.Add(new FlinchEffect());
|
||||||
|
break;
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Ground:
|
||||||
|
target.ChangeStatBoost(Statistic.Accuracy, -1, false, false);
|
||||||
|
break;
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Water:
|
||||||
|
target.ChangeStatBoost(Statistic.Attack, -1, false, false);
|
||||||
|
break;
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Ice:
|
||||||
|
target.SetStatus(ScriptUtils.ResolveName<Status.Frozen>(), move.User);
|
||||||
|
break;
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Grass:
|
||||||
|
target.SetStatus(ScriptUtils.ResolveName<Status.Sleep>(), move.User);
|
||||||
|
break;
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Fairy:
|
||||||
|
target.ChangeStatBoost(Statistic.SpecialAttack, -1, false, false);
|
||||||
|
break;
|
||||||
|
case EnvironmentHelper.EnvironmentCategory.Psychic:
|
||||||
|
target.ChangeStatBoost(Statistic.Speed, -1, false, false);
|
||||||
|
break;
|
||||||
|
// ReSharper disable once RedundantEmptySwitchSection
|
||||||
|
default:
|
||||||
|
// No effect for unrecognized environments
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "set_status")]
|
[Script(ScriptCategory.Move, "set_status")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "set_weather")]
|
[Script(ScriptCategory.Move, "set_weather")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "sketch")]
|
[Script(ScriptCategory.Move, "sketch")]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "static_damage")]
|
[Script(ScriptCategory.Move, "static_damage")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "stomping_tantrum")]
|
[Script(ScriptCategory.Move, "stomping_tantrum")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "synchronoise")]
|
[Script(ScriptCategory.Move, "synchronoise")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "wake_up_slap")]
|
[Script(ScriptCategory.Move, "wake_up_slap")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "weather_ball")]
|
[Script(ScriptCategory.Move, "weather_ball")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "disable")]
|
[Script(ScriptCategory.Pokemon, "disable")]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using PkmnLib.Static.Libraries;
|
using PkmnLib.Static.Libraries;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user