Skip to content

Commit 4346e3d

Browse files
authored
Add Restricted as a /ds Parameter (#10952)
* added restricted as a param for /ds using the species tags. * comply with max line length.
1 parent 7bf04ad commit 4346e3d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

server/chat-plugins/datasearch.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ function runDexsearch(target: string, cmd: string, canAll: boolean, message: str
698698
let nationalSearch = null;
699699
let unreleasedSearch = null;
700700
let fullyEvolvedSearch = null;
701+
let restrictedSearch = null;
701702
let singleTypeSearch = null;
702703
let randomOutput = 0;
703704
let tierInequalitySearch = false;
@@ -957,6 +958,14 @@ function runDexsearch(target: string, cmd: string, canAll: boolean, message: str
957958
break;
958959
}
959960

961+
if (['restricted legendary', 'restrictedlegendary', 'restricted'].includes(target)) {
962+
if (restrictedSearch === isNotSearch) return { error: "A search cannot include and exclude 'restricted legendary'." };
963+
if (parameters.length > 1) return { error: "The parameter 'restricted legendary' cannot have alternative parameters." };
964+
restrictedSearch = !isNotSearch;
965+
orGroup.skip = true;
966+
break;
967+
}
968+
960969
if (target === 'recovery') {
961970
const recoveryMoves = [
962971
"healorder", "junglehealing", "lifedew", "milkdrink", "moonlight", "morningsun", "recover",
@@ -1130,7 +1139,7 @@ function runDexsearch(target: string, cmd: string, canAll: boolean, message: str
11301139
}
11311140
if (
11321141
showAll && searches.length === 0 && singleTypeSearch === null &&
1133-
megaSearch === null && gmaxSearch === null && fullyEvolvedSearch === null && sort === null
1142+
megaSearch === null && gmaxSearch === null && fullyEvolvedSearch === null && restrictedSearch === null && sort === null
11341143
) {
11351144
return {
11361145
error: "No search parameters other than 'all' were found. Try '/help dexsearch' for more information on this command.",
@@ -1142,6 +1151,8 @@ function runDexsearch(target: string, cmd: string, canAll: boolean, message: str
11421151
const megaSearchResult = megaSearch === null || megaSearch === !!species.isMega;
11431152
const gmaxSearchResult = gmaxSearch === null || gmaxSearch === species.name.endsWith('-Gmax');
11441153
const fullyEvolvedSearchResult = fullyEvolvedSearch === null || fullyEvolvedSearch !== species.nfe;
1154+
const restrictedSearchResult = restrictedSearch === null ||
1155+
restrictedSearch === species.tags.includes('Restricted Legendary');
11451156
if (
11461157
species.gen <= mod.gen &&
11471158
(
@@ -1151,7 +1162,8 @@ function runDexsearch(target: string, cmd: string, canAll: boolean, message: str
11511162
(!species.tier.startsWith("CAP") || capSearch) &&
11521163
megaSearchResult &&
11531164
gmaxSearchResult &&
1154-
fullyEvolvedSearchResult
1165+
fullyEvolvedSearchResult &&
1166+
restrictedSearchResult
11551167
) {
11561168
dex[species.id] = species;
11571169
}

0 commit comments

Comments
 (0)