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

@@ -8,14 +8,14 @@ public class FairyLockEffect : Script, IScriptOnEndTurn, IScriptPreventSelfRunAw
/// <inheritdoc />
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent)
{
if (choice.User.Types.All(x => x.Name != "ghost"))
if (choice.User.Types.All(x => x.Name != TypeNames.Ghost))
prevent = true;
}
/// <inheritdoc />
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent)
{
if (choice.User.Types.All(x => x.Name != "ghost"))
if (choice.User.Types.All(x => x.Name != TypeNames.Ghost))
prevent = true;
}

View File

@@ -12,7 +12,7 @@ public class Gravity : Script, IScriptFailIncomingMove, IScriptOnEndTurn, IScrip
{
var typeLibrary = target.Library.StaticLibrary.Types;
if (executingMove.UseMove.MoveType.Name != "ground")
if (executingMove.UseMove.MoveType.Name != TypeNames.Ground)
return;
// Remove all types that are immune to ground moves
types.RemoveAll(x => typeLibrary.GetSingleEffectiveness(executingMove.UseMove.MoveType, x) == 0);

View File

@@ -6,8 +6,8 @@ public class IonDelugeEffect : Script, IScriptChangeMoveType, IScriptOnEndTurn
/// <inheritdoc />
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? moveType)
{
if (moveType?.Name == "normal" &&
target.Library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType))
if (moveType?.Name == TypeNames.Normal &&
target.Library.StaticLibrary.Types.TryGetTypeIdentifier(TypeNames.Electric, out var electricType))
{
moveType = electricType;
}

View File

@@ -8,7 +8,7 @@ public class MudSportEffect : Script, IScriptChangeBasePower, IScriptOnEndTurn
/// <inheritdoc />
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.UseMove.MoveType.Name == "electric")
if (move.UseMove.MoveType.Name == TypeNames.Electric)
{
basePower = basePower.MultiplyOrMax(1352 / 4096f);
}

View File

@@ -32,7 +32,7 @@ public class UproarEffect : Script, IScriptOnBeforeTurnStart, IScriptOnSecondary
/// <inheritdoc />
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (move.User == _placer && move.UseMove.Name == "uproar")
if (move.User == _placer && move.UseMove.Name == MoveNames.Uproar)
_hasUsedUproar = true;
}

View File

@@ -8,7 +8,7 @@ public class WaterSportEffect : Script, IScriptChangeMoveDamage, IScriptOnSwitch
/// <inheritdoc />
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
if (move.UseMove.MoveType.Name == "fire")
if (move.UseMove.MoveType.Name == TypeNames.Fire)
{
damage = damage / 2;
}