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:
@@ -37,28 +37,64 @@ public class Forewarn : Script, IScriptOnSwitchIn
|
||||
});
|
||||
}
|
||||
|
||||
private static readonly Dictionary<StringKey, byte> FixedBasePowers = new()
|
||||
{
|
||||
// 150 BP: Specific moves
|
||||
[MoveNames.BlastBurn] = 150,
|
||||
[MoveNames.Eruption] = 150,
|
||||
[MoveNames.WaterSpout] = 150,
|
||||
[MoveNames.Fissure] = 150,
|
||||
[MoveNames.Guillotine] = 150,
|
||||
[MoveNames.HornDrill] = 150,
|
||||
[MoveNames.SheerCold] = 150,
|
||||
// 120 BP: Counter, Metal Burst, Mirror Coat
|
||||
[MoveNames.Counter] = 120,
|
||||
[MoveNames.MetalBurst] = 120,
|
||||
[MoveNames.MirrorCoat] = 120,
|
||||
// 80 BP: List of variable power and fixed-damage moves
|
||||
[MoveNames.CrushGrip] = 80,
|
||||
[MoveNames.DragonRage] = 80,
|
||||
[MoveNames.ElectroBall] = 80,
|
||||
[MoveNames.Endeavor] = 80,
|
||||
[MoveNames.FinalGambit] = 80,
|
||||
[MoveNames.Flail] = 80,
|
||||
[MoveNames.Fling] = 80,
|
||||
[MoveNames.Frustration] = 80,
|
||||
[MoveNames.GrassKnot] = 80,
|
||||
[MoveNames.GuardianOfAlola] = 80,
|
||||
[MoveNames.GyroBall] = 80,
|
||||
[MoveNames.HeatCrash] = 80,
|
||||
[MoveNames.HeavySlam] = 80,
|
||||
[MoveNames.HiddenPower] = 80,
|
||||
[MoveNames.LowKick] = 80,
|
||||
[MoveNames.NaturalGift] = 80,
|
||||
[MoveNames.NaturesMadness] = 80,
|
||||
[MoveNames.NightShade] = 80,
|
||||
[MoveNames.Present] = 80,
|
||||
[MoveNames.Psywave] = 80,
|
||||
[MoveNames.Punishment] = 80,
|
||||
[MoveNames.Return] = 80,
|
||||
[MoveNames.Reversal] = 80,
|
||||
[MoveNames.SeismicToss] = 80,
|
||||
[MoveNames.SonicBoom] = 80,
|
||||
[MoveNames.SpitUp] = 80,
|
||||
[MoveNames.SuperFang] = 80,
|
||||
[MoveNames.TrumpCard] = 80,
|
||||
[MoveNames.WringOut] = 80,
|
||||
// 20 BP: Stored Power, Power Trip
|
||||
[MoveNames.StoredPower] = 20,
|
||||
[MoveNames.PowerTrip] = 20,
|
||||
};
|
||||
|
||||
private static byte GetBasePower(IMoveData moveData)
|
||||
{
|
||||
// OHKO moves (handled by secondary effect)
|
||||
if (moveData.SecondaryEffect?.Name == "one_hit_ko")
|
||||
if (moveData.SecondaryEffect?.Name == MoveEffectNames.OneHitKo)
|
||||
return 150;
|
||||
|
||||
return moveData.Name.ToString() switch
|
||||
{
|
||||
// 150 BP: Specific moves
|
||||
"blast_burn" or "eruption" or "water_spout" or "fissure" or "guillotine" or "horn_drill"
|
||||
or "sheer_cold" => 150,
|
||||
// 120 BP: Counter, Metal Burst, Mirror Coat
|
||||
"counter" or "metal_burst" or "mirror_coat" => 120,
|
||||
// 80 BP: List of variable power and fixed-damage moves
|
||||
"crush_grip" or "dragon_rage" or "electro_ball" or "endeavor" or "final_gambit" or "flail" or "fling"
|
||||
or "frustration" or "grass_knot" or "guardian_of_alola" or "gyro_ball" or "heat_crash" or "heavy_slam"
|
||||
or "hidden_power" or "low_kick" or "natural_gift" or "natures_madness" or "night_shade" or "present"
|
||||
or "psywave" or "punishment" or "return" or "reversal" or "seismic_toss" or "sonic_boom" or "spit_up"
|
||||
or "super_fang" or "trump_card" or "wring_out" => 80,
|
||||
// 20 BP: Stored Power, Power Trip
|
||||
"stored_power" or "power_trip" => 20,
|
||||
_ => moveData.BasePower == 0 ? (byte)1 : moveData.BasePower,
|
||||
};
|
||||
if (FixedBasePowers.TryGetValue(moveData.Name, out var fixedBasePower))
|
||||
return fixedBasePower;
|
||||
|
||||
return moveData.BasePower == 0 ? (byte)1 : moveData.BasePower;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user