mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-09-14 20:25:36 -05:00
/battlefactory: Fix searching for nonexistent tiers (#7989)
* BF cmd: Fix crash searching for a valid tier not included in a specific gen * Update server/chat-plugins/random-battles.ts * Update server/chat-plugins/random-battles.ts * Update server/chat-plugins/random-battles.ts Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
This commit is contained in:
@@ -102,6 +102,9 @@ function battleFactorySets(species: string | Species, tier: string | null, gen =
|
||||
if (!isBSS) {
|
||||
if (!tier) return {e: `Please provide a valid tier.`};
|
||||
if (!(toID(tier) in TIERS)) return {e: `That tier isn't supported.`};
|
||||
if (['Mono', 'LC'].includes(TIERS[toID(tier)]) && genNum < 7) {
|
||||
return {e: `${TIERS[toID(tier)]} is not included in [Gen ${genNum}] Battle Factory.`};
|
||||
}
|
||||
const t = statsFile[TIERS[toID(tier)]];
|
||||
if (!(species.id in t)) {
|
||||
const formatName = Dex.getFormat(`${gen}battlefactory`).name;
|
||||
|
||||
Reference in New Issue
Block a user