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
All checks were successful
Build / Build (push) Successful in 2m21s
This commit is contained in:
@@ -313,9 +313,9 @@ public partial class ExplicitAI : PokemonAI, IExplicitAI
|
||||
}
|
||||
|
||||
// Primal weather
|
||||
if (battle.WeatherName == "primordial_sea" && aiMove.Move.MoveType.Name == "fire")
|
||||
if (battle.WeatherName == PrimordialSeaName && aiMove.Move.MoveType.Name == FireName)
|
||||
return true;
|
||||
if (battle.WeatherName == "desolate_lands" && aiMove.Move.MoveType.Name == "water")
|
||||
if (battle.WeatherName == DesolateLandsName && aiMove.Move.MoveType.Name == WaterName)
|
||||
return true;
|
||||
|
||||
// Check if the move will fail based on the handlers
|
||||
@@ -453,13 +453,16 @@ public partial class ExplicitAI : PokemonAI, IExplicitAI
|
||||
return true;
|
||||
}
|
||||
|
||||
private static readonly StringKey TruantName = "truant";
|
||||
private static readonly StringKey TruantEffectName = "truant_effect";
|
||||
|
||||
private static bool CanAttack(IPokemon pokemon)
|
||||
{
|
||||
if (pokemon.Volatile.Contains("requires_recharge"))
|
||||
return false;
|
||||
if (pokemon.HasStatus("frozen") || pokemon.HasStatus("sleep"))
|
||||
return false;
|
||||
if (pokemon.ActiveAbility?.Name == "truant" && pokemon.Volatile.Contains("truant_effect"))
|
||||
if (pokemon.ActiveAbility?.Name == TruantName && pokemon.Volatile.Contains(TruantEffectName))
|
||||
return false;
|
||||
if (pokemon.Volatile.Contains("flinch_effect"))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user