mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-23 08:16:16 -05:00
Imprison should not hide targetable disabled moves
This commit is contained in:
parent
0e01387ba1
commit
9b73eae8b7
|
|
@ -561,15 +561,7 @@ BattlePokemon = (() => {
|
|||
let hasValidMove = false;
|
||||
for (let i = 0; i < this.moveset.length; i++) {
|
||||
let moveEntry = this.moveset[i];
|
||||
let disabled = moveEntry.disabled;
|
||||
if (disabled === 'hidden' && restrictData) {
|
||||
disabled = false;
|
||||
} else if (moveEntry.pp <= 0) {
|
||||
disabled = true;
|
||||
}
|
||||
if (!disabled) {
|
||||
hasValidMove = true;
|
||||
}
|
||||
|
||||
let moveName = moveEntry.move;
|
||||
if (moveEntry.id === 'hiddenpower') {
|
||||
moveName = 'Hidden Power ' + this.hpType;
|
||||
|
|
@ -585,6 +577,15 @@ BattlePokemon = (() => {
|
|||
target = this.battle.getMove('curse').nonGhostTarget || moveEntry.target;
|
||||
}
|
||||
}
|
||||
let disabled = moveEntry.disabled;
|
||||
if (disabled && this.battle.targetTypeChoices(target) || moveEntry.pp <= 0) {
|
||||
disabled = true;
|
||||
} else if (disabled === 'hidden' && restrictData) {
|
||||
disabled = false;
|
||||
}
|
||||
if (!disabled) {
|
||||
hasValidMove = true;
|
||||
}
|
||||
moves.push({
|
||||
move: moveName,
|
||||
id: moveEntry.id,
|
||||
|
|
@ -1532,7 +1533,6 @@ BattleSide = (() => {
|
|||
};
|
||||
BattleSide.prototype.chooseMove = function (data, targetLoc, willMega) {
|
||||
if (!targetLoc) targetLoc = 0;
|
||||
const choosableTargets = {normal:1, any:1, adjacentAlly:1, adjacentAllyOrSelf:1, adjacentFoe:1};
|
||||
const activePokemon = this.active[this.choiceData.choices.length];
|
||||
|
||||
/**
|
||||
|
|
@ -1550,7 +1550,7 @@ BattleSide = (() => {
|
|||
return false;
|
||||
}
|
||||
moveid = requestMoves[moveIndex].id;
|
||||
if (!targetLoc && this.active.length > 1 && requestMoves[moveIndex].target in choosableTargets) {
|
||||
if (!targetLoc && this.active.length > 1 && this.battle.targetTypeChoices(requestMoves[moveIndex].target)) {
|
||||
this.battle.debug("Can't use the move without a target");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1564,7 +1564,7 @@ BattleSide = (() => {
|
|||
let isValidMove = false;
|
||||
for (let i = 0; i < requestMoves.length; i++) {
|
||||
if (requestMoves[i].id !== moveid) continue;
|
||||
if (!targetLoc && this.active.length > 1 && requestMoves[i].target in choosableTargets) {
|
||||
if (!targetLoc && this.active.length > 1 && this.battle.targetTypeChoices(requestMoves[i].target)) {
|
||||
this.battle.debug("Can't use the move without a target");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const CHOOSABLE_TARGETS = new Set(['normal', 'any', 'adjacentAlly', 'adjacentAllyOrSelf', 'adjacentFoe']);
|
||||
|
||||
exports.BattleScripts = {
|
||||
gen: 6,
|
||||
runMove: function (move, pokemon, target, sourceEffect) {
|
||||
|
|
@ -649,6 +651,11 @@ exports.BattleScripts = {
|
|||
if (pokemon1.side === pokemon2.side) return Math.abs(pokemon1.position - pokemon2.position) === 1;
|
||||
return Math.abs(pokemon1.position + pokemon2.position + 1 - pokemon1.side.active.length) <= 1;
|
||||
},
|
||||
|
||||
targetTypeChoices: function (targetType) {
|
||||
return CHOOSABLE_TARGETS.has(targetType);
|
||||
},
|
||||
|
||||
checkAbilities: function (selectedAbilities, defaultAbilities) {
|
||||
if (!selectedAbilities.length) return true;
|
||||
let selectedAbility = selectedAbilities.pop();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user