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:
@@ -11,7 +11,8 @@ public class Sandstorm : Script, IScriptChangeBasePower, IScriptChangeDefensiveS
|
||||
{
|
||||
if (!pokemon.IsUsable)
|
||||
continue;
|
||||
if (pokemon.Types.Any(x => x.Name == "rock" || x.Name == "ground" || x.Name == "steel"))
|
||||
if (pokemon.Types.Any(x =>
|
||||
x.Name == TypeNames.Rock || x.Name == TypeNames.Ground || x.Name == TypeNames.Steel))
|
||||
{
|
||||
// Rock, Ground, and Steel types are immune to Sandstorm damage.
|
||||
continue;
|
||||
@@ -30,21 +31,21 @@ public class Sandstorm : Script, IScriptChangeBasePower, IScriptChangeDefensiveS
|
||||
public void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if (stat == Statistic.SpecialDefense && target.Types.Any(x => x.Name == "rock"))
|
||||
if (stat == Statistic.SpecialDefense && target.Types.Any(x => x.Name == TypeNames.Rock))
|
||||
value = value.MultiplyOrMax(1.5f);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
if (move.UseMove.Name == "solar_beam")
|
||||
if (move.UseMove.Name == MoveNames.SolarBeam)
|
||||
basePower /= 2;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ExpectedEndOfTurnDamage(IPokemon pokemon, ref int damage)
|
||||
{
|
||||
if (pokemon.Types.Any(x => x.Name == "rock" || x.Name == "ground" || x.Name == "steel"))
|
||||
if (pokemon.Types.Any(x => x.Name == TypeNames.Rock || x.Name == TypeNames.Ground || x.Name == TypeNames.Steel))
|
||||
return; // Rock, Ground, and Steel types are immune to Sandstorm damage.
|
||||
damage += (int)(pokemon.MaxHealth / 16f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user