Make item boost calculation check for item too, simplifies callers

This commit is contained in:
urkerab 2015-12-29 21:55:06 +00:00
parent 0b22081e7b
commit 99d20f70ed
2 changed files with 6 additions and 32 deletions

View File

@ -2,7 +2,7 @@ var BattleTooltips = (function () {
function BattleTooltips() {}
BattleTooltips.prototype.boostBasePower = function (BattleRoom, move, pokemon, basePower, basePowerComment) {
var myPokemon = BattleRoom.myPokemon[pokemon.slot];
if (!BattleRoom.battle.hasPseudoWeather('Magic Room') && (!pokemon.volatiles || !pokemon.volatiles['embargo'])) {
if (myPokemon.item && !BattleRoom.battle.hasPseudoWeather('Magic Room') && (!pokemon.volatiles || !pokemon.volatiles['embargo'])) {
var item = Tools.getItem(myPokemon.item);
var moveType = BattleRoom.getMoveType(move, pokemon);
var splitItemName = item.name.split(' ');
@ -41,7 +41,7 @@ var BattleTooltips = (function () {
if (max <= 60) max *= 1.5;
}
var itemCheck = false;
if (!BattleRoom.battle.hasPseudoWeather('Magic Room') && (!pokemon.volatiles || !pokemon.volatiles['embargo'])) {
if (myPokemon.item && !BattleRoom.battle.hasPseudoWeather('Magic Room') && (!pokemon.volatiles || !pokemon.volatiles['embargo'])) {
var item = Tools.getItem(myPokemon.item);
var moveType = BattleRoom.getMoveType(move, pokemon);
var splitItemName = item.name.split(' ');

View File

@ -1429,19 +1429,8 @@
else if (maxRatio >= 2) max = 80;
else if (maxRatio >= 1) max = 60;
else max = 40;
// Special case due to being a range. Other moves are checked by technician below.
basePower = 0;
if (!myPokemon.item) {
if (ability === 'Technician') {
if (min <= 60) min *= 1.5;
if (max <= 60) max *= 1.5;
basePowerComment = '' + ((min === max) ? max : min + ' to ' + max) + ' (Technician boosted)';
} else {
basePowerComment = (min === max) ? max : min + ' to ' + max;
}
} else {
return Tooltips.boostBasePower_Ball(this, move, pokemon, min, max);
}
// Special case due to being a range.
return Tooltips.boostBasePower_Ball(this, move, pokemon, min, max);
}
if (move.id === 'gyroball') {
var template = target;
@ -1451,18 +1440,7 @@
if (min > 150) min = 150;
if (max > 150) max = 150;
// Special case due to range as well.
basePower = 0;
if (!myPokemon.item) {
if (ability === 'Technician') {
if (min <= 60) min *= 1.5;
if (max <= 60) max *= 1.5;
basePowerComment = '' + ((min === max) ? max : min + ' to ' + max) + ' (Technician boosted)';
} else {
basePowerComment = (min === max) ? max : min + ' to ' + max;
}
} else {
return Tooltips.boostBasePower_Ball(this, move, pokemon, min, max);
}
return Tooltips.boostBasePower_Ball(this, move, pokemon, min, max);
}
// Movements which have base power changed due to items.
if (myPokemon.item && !this.battle.hasPseudoWeather('Magic Room') && (!pokemon.volatiles || !pokemon.volatiles['embargo'])) {
@ -1513,11 +1491,7 @@
basePowerComment = ' (' + ability + ' boosted)';
}
}
if (myPokemon.item) {
return Tooltips.boostBasePower(this, move, pokemon, basePower, basePowerComment);
} else {
return basePower == 0 ? basePowerComment : basePower + basePowerComment;
}
return Tooltips.boostBasePower(this, move, pokemon, basePower, basePowerComment);
}
});