Slight cleanup, do some TODOs
All checks were successful
Build / Build (push) Successful in 51s

This commit is contained in:
2025-06-22 10:42:25 +02:00
parent e305cfaef6
commit 2533512eda
114 changed files with 218 additions and 168 deletions

View File

@@ -1,7 +1,6 @@
using PkmnLib.Dynamic;
using PkmnLib.Dynamic.Libraries;
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Libraries.Battling;

View File

@@ -1,4 +1,3 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "gravity")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "mud_sport")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "uproar_effect")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Items;
[ItemScript("healing_item")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Items;
/// <summary>

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "bypass_sleep")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "me_first")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "round")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// <summary>

View File

@@ -1,6 +1,5 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,6 +1,5 @@
using PkmnLib.Plugin.Gen7.Scripts.Side;
using PkmnLib.Plugin.Gen7.Scripts.Weather;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "beat_up")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "brine")]

View File

@@ -1,7 +1,44 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "camouflage")]
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,
};
}
}

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "change_all_target_stats")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "change_multiple_target_stat_boosts")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "change_multiple_user_stat_boosts")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public abstract class ChangeTargetStats : Script

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public abstract class ChangeUserStats : Script

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "conversion")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "conversion_2")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "core_enforcer")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "cure_party_status")]

View File

@@ -1,6 +1,5 @@
using JetBrains.Annotations;
using PkmnLib.Plugin.Gen7.Scripts.Side;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "facade")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "flame_burst")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "flame_wheel")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "gear_up")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "grudge")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "heal_percent")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "hex")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "last_resort")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Side;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "magnetic_flux")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Weather;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "natural_gift")]

View File

@@ -1,7 +1,52 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "nature_power")]
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;
}
}

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "one_hit_ko")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// <summary>

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "power_trip")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "psywave")]

View File

@@ -13,16 +13,15 @@ public class RapidSpin : Script
move.User.Volatile.Remove<BindEffect>();
move.User.Volatile.Remove<FireSpinEffect>();
move.User.Volatile.Remove<MagmaStormEffect>();
// TODO: Whirlpool effect removal
// TODO: Wrap effect removal
move.User.Volatile.Remove<WhirlpoolEffect>();
var battleData = move.User.BattleData;
if (battleData != null)
{
battleData.BattleSide.VolatileScripts.Remove<SpikesEffect>();
battleData.BattleSide.VolatileScripts.Remove<StickyWebEffect>();
// TODO: Remove Toxic Spikes
// TODO: Remove Stealth Rock
battleData.BattleSide.VolatileScripts.Remove<ToxicSpikesEffect>();
battleData.BattleSide.VolatileScripts.Remove<StealthRockEffect>();
}
}
}

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "reflect")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "retaliate")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "rototiller")]

View File

@@ -1,7 +1,46 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "secret_power")]
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;
}
}
}

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "set_status")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "set_weather")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "sketch")]

View File

@@ -1,6 +1,5 @@
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "static_damage")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "stomping_tantrum")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "synchronoise")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Battle;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "wake_up_slap")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "weather_ball")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "disable")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Static.Libraries;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public class RequireChargeEffect(IPokemon owner, StringKey moveName) : BaseChargeEffect(owner, moveName);

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public class HelpingHandEffect : Script

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "imprison")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "ingrain")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Dynamic.BattleFlow;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "roost_effect")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "smack_down")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Move, "thousand_arrows")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Side;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "sleep")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Utils;

View File

@@ -0,0 +1,43 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Utils;
public static class EnvironmentHelper
{
public enum EnvironmentCategory
{
Electric,
Fairy,
Grass,
Psychic,
Rock,
Ground,
Ice,
Water,
Normal,
}
public static EnvironmentCategory GetEnvironmentCategory(this IBattle battle)
{
var terrainName = battle.TerrainName;
if (terrainName == ScriptUtils.ResolveName<Terrain.ElectricTerrain>())
return EnvironmentCategory.Electric;
if (terrainName == ScriptUtils.ResolveName<Terrain.MistyTerrain>())
return EnvironmentCategory.Fairy;
if (terrainName == ScriptUtils.ResolveName<Terrain.GrassyTerrain>())
return EnvironmentCategory.Grass;
if (terrainName == ScriptUtils.ResolveName<Terrain.PsychicTerrain>())
return EnvironmentCategory.Psychic;
var environment = battle.EnvironmentName;
if (environment.Contains("cave"))
return EnvironmentCategory.Rock;
if (environment.Contains("mountain") || environment.Contains("beach"))
return EnvironmentCategory.Ground;
if (environment.Contains("snow"))
return EnvironmentCategory.Ice;
if (environment.Contains("sea") || environment.Contains("lake") || environment.Contains("river"))
return EnvironmentCategory.Water;
if (environment.Contains("forest") || environment.Contains("field"))
return EnvironmentCategory.Normal;
return EnvironmentCategory.Normal; // Default case if no specific environment is matched
}
}