mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-09-15 04:35:41 -05:00
movesearch: Add support for Z-status effects (#3105)
This commit is contained in:
@@ -425,6 +425,24 @@ function runDexsearch(target, cmd, canAll, message) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (target === 'zrecovery') {
|
||||
if (parameters.length > 1) return {reply: "The parameter 'zrecovery' cannot have alternative parameters"};
|
||||
let recoveryMoves = ["aromatherapy", "bellydrum", "conversion2", "haze", "healbell", "mist", "psychup", "refresh", "spite", "stockpile", "teleport", "transform"];
|
||||
for (let k = 0; k < recoveryMoves.length; k++) {
|
||||
let invalid = validParameter("moves", recoveryMoves[k], isNotSearch, target);
|
||||
if (invalid) return {reply: invalid};
|
||||
if (isNotSearch) {
|
||||
let bufferObj = {moves: {}};
|
||||
bufferObj.moves[recoveryMoves[k]] = false;
|
||||
searches.push(bufferObj);
|
||||
} else {
|
||||
orGroup.moves[recoveryMoves[k]] = true;
|
||||
}
|
||||
}
|
||||
if (isNotSearch) orGroup.skip = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (target === 'priority') {
|
||||
if (parameters.length > 1) return {reply: "The parameter 'priority' cannot have alternative parameters"};
|
||||
for (let move in Tools.data.Movedex) {
|
||||
@@ -743,6 +761,15 @@ function runMovesearch(target, cmd, canAll, message) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (target === 'zrecovery') {
|
||||
if (!searches['zrecovery']) {
|
||||
searches['zrecovery'] = !isNotSearch;
|
||||
} else if ((searches['zrecovery'] && isNotSearch) || (searches['zrecovery'] === false && !isNotSearch)) {
|
||||
return {reply: 'A search cannot both exclude and include z-recovery moves.'};
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
let template = Tools.getTemplate(target);
|
||||
if (template.exists) {
|
||||
if (Object.keys(lsetData).length) return {reply: "A search can only include one Pok\u00e9mon learnset."};
|
||||
@@ -847,6 +874,26 @@ function runMovesearch(target, cmd, canAll, message) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (target.substr(0, 8) === 'zboosts ') {
|
||||
switch (target.substr(8)) {
|
||||
case 'attack': target = 'atk'; break;
|
||||
case 'defense': target = 'def'; break;
|
||||
case 'specialattack': target = 'spa'; break;
|
||||
case 'spatk': target = 'spa'; break;
|
||||
case 'specialdefense': target = 'spd'; break;
|
||||
case 'spdef': target = 'spd'; break;
|
||||
case 'speed': target = 'spe'; break;
|
||||
case 'acc': target = 'accuracy'; break;
|
||||
case 'evasiveness': target = 'evasion'; break;
|
||||
default: target = target.substr(8);
|
||||
}
|
||||
if (!(target in allBoosts)) return {reply: "'" + escapeHTML(target.substr(8)) + "' is not a recognized stat."};
|
||||
if (!searches['boost']) searches['boost'] = {};
|
||||
if ((searches['boost'][target] && isNotSearch) || (searches['boost'][target] === false && !isNotSearch)) return {reply: 'A search cannot both exclude and include a stat boost.'};
|
||||
searches['boost'][target] = !isNotSearch;
|
||||
continue;
|
||||
}
|
||||
|
||||
let oldTarget = target;
|
||||
if (target.charAt(target.length - 1) === 's') target = target.substr(0, target.length - 1);
|
||||
switch (target) {
|
||||
@@ -930,6 +977,13 @@ function runMovesearch(target, cmd, canAll, message) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'zrecovery':
|
||||
for (let move in dex) {
|
||||
let hasRecovery = (dex[move].zMoveEffect === 'heal');
|
||||
if ((!hasRecovery && searches[search]) || (hasRecovery && !searches[search])) delete dex[move];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'property':
|
||||
for (let prop in searches[search]) {
|
||||
for (let move in dex) {
|
||||
@@ -972,6 +1026,18 @@ function runMovesearch(target, cmd, canAll, message) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'zboost':
|
||||
for (let boost in searches[search]) {
|
||||
for (let move in dex) {
|
||||
if (dex[move].zMoveBoost) {
|
||||
if ((dex[move].zMoveBoost[boost] > 0 && searches[search][boost]) ||
|
||||
(dex[move].zMoveBoost[boost] < 1 && !searches[search][boost])) continue;
|
||||
}
|
||||
delete dex[move];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
case 'volatileStatus':
|
||||
for (let searchStatus in searches[search]) {
|
||||
|
||||
Reference in New Issue
Block a user