Replace all raw string comparisons with StringKey, source generator that creates cache keys for all names for Gen7 plugin
All checks were successful
Build / Build (push) Successful in 2m21s

This commit is contained in:
2026-08-27 18:30:57 +02:00
parent 3a58f55bbf
commit 942be8eaeb
160 changed files with 1035 additions and 491 deletions

View File

@@ -18,6 +18,7 @@ public partial class ExplicitAI
private static readonly StringKey ShieldsDownName = "shields_down";
private static readonly StringKey HarshSunlightName = "harsh_sunlight";
private static readonly StringKey DesolateLandsName = "desolate_lands";
private static readonly StringKey PrimordialSeaName = "primordial_sea";
private static readonly StringKey BulletproofName = "bulletproof";
private static readonly StringKey FlashFireName = "flash_fire";
private static readonly StringKey LightningRodName = "lightning_rod";
@@ -33,6 +34,8 @@ public partial class ExplicitAI
private static readonly StringKey FireName = "fire";
private static readonly StringKey ElectricName = "electric";
private static readonly StringKey WaterName = "water";
private static readonly StringKey KomalaName = "komala";
private static readonly StringKey MiniorName = "minior";
private static bool CanBePoisoned(IPokemon pokemon, IBattle battle)
{
@@ -49,9 +52,9 @@ public partial class ExplicitAI
if ((pokemon.ActiveAbility?.Name == LeafGuardName && battle.WeatherName == HarshSunlightName) ||
battle.WeatherName == DesolateLandsName)
return false;
if (pokemon.ActiveAbility?.Name == ComatoseName && pokemon.Species.Name == "komala")
if (pokemon.ActiveAbility?.Name == ComatoseName && pokemon.Species.Name == KomalaName)
return false;
if (pokemon.ActiveAbility?.Name == ShieldsDownName && pokemon.Species.Name == "minior" &&
if (pokemon.ActiveAbility?.Name == ShieldsDownName && pokemon.Species.Name == MiniorName &&
pokemon.Form.Name.Contains("-meteor"))
return false;
return true;