mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-06-02 22:09:20 -05:00
Merge pull request #574 from hvk3/master
Added gem-boosted powers to move description
This commit is contained in:
commit
8afb0d78f2
|
|
@ -15,7 +15,7 @@ module.exports = {
|
|||
"fs": false, "gui": false, "ga": false, "macgap": false, "nwWindow": false, "webkitNotifications": false,
|
||||
|
||||
// Battle stuff
|
||||
"Battle": true, "Pokemon": true, "BattleSound": true,
|
||||
"Battle": true, "Pokemon": true, "BattleSound": true, "BattleTooltips": true,
|
||||
"BattleAbilities": false, "BattleAliases": false, "BattleBackdrops": false, "BattleBackdropsFour": false, "BattleBackdropsThree": false, "BattleEffects": false,
|
||||
"BattleFormats": false, "BattleFormatsData": false, "BattleLearnsets": false, "BattleItems": false, "BattleMoveAnims": false, "BattleMovedex": false, "BattleNatures": false,
|
||||
"BattleOtherAnims": false, "BattlePokedex": false,"BattlePokemonSprites": false, "BattlePokemonSpritesBW": false, "BattleSearchCountIndex": false, "BattleSearchIndex": false,
|
||||
|
|
|
|||
81
js/client-battle-tooltips.js
Normal file
81
js/client-battle-tooltips.js
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
var BattleTooltips = (function () {
|
||||
function BattleTooltips() {}
|
||||
BattleTooltips.prototype.boostBasePower = function (BattleRoom, move, pokemon, target, basePower, basePowerComment) {
|
||||
var myPokemon = BattleRoom.myPokemon[pokemon.slot];
|
||||
var ability = Tools.getAbility(myPokemon.baseAbility).name;
|
||||
var thereIsWeather = (BattleRoom.battle.weather in {'sunnyday': 1, 'desolateland': 1, 'raindance': 1, 'primordialsea': 1, 'sandstorm': 1, 'hail':1});
|
||||
if (!BattleRoom.battle.hasPseudoWeather('Magic Room') && (!pokemon.volatiles || !pokemon.volatiles['embargo'])) {
|
||||
var item = Tools.getItem(myPokemon.item);
|
||||
var pos = BattleRoom.choice.choices.length;
|
||||
var moveType = BattleRoom.getMoveType(move, BattleRoom.battle.mySide.active[pos]);
|
||||
var splitItemName = item.name.split(' ');
|
||||
var moveName = move.name;
|
||||
if (basePower) {
|
||||
// Gems
|
||||
if (splitItemName[1] == 'Gem' && moveType == splitItemName[0] && (moveName != 'Struggle' || moveName != 'Water Pledge' || moveName != 'Grass Pledge' || moveName != 'Fire Pledge' || moveName != 'Fling')) {
|
||||
basePower *= BattleRoom.battle.gen >= 6 ? 1.3 : 1.5;
|
||||
basePowerComment += ' (Boosted by ' + item.name + ')';
|
||||
}
|
||||
// Plates
|
||||
if (splitItemName[1] == 'Plate' && item.onPlate && moveType == item.onPlate) {
|
||||
basePower *= 1.2;
|
||||
basePowerComment += ' (Boosted by ' + item.name + ')';
|
||||
}
|
||||
// Type-enhancing items
|
||||
if (item.name == 'Black Belt' && moveType == 'Fighting' || item.name == 'Black Glasses' && moveType == 'Dark' || item.name == 'Charcoal' && moveType == 'Fire' || item.name == 'Dragon Fang' && moveType == 'Dragon' || item.name == 'Hard Stone' && moveType == 'Rock' || item.name == 'Magnet' && moveType == 'Electric' || item.name == 'Metal Coat' && moveType == 'Steel' || item.name == 'Miracle Seed' && moveType == 'Grass' || item.name == 'Mystic Water' && moveType == 'Water' || item.name == 'Never-Melt Ice' && moveType == 'Ice' || item.name == 'Poison Barb' && moveType == 'Poison' || item.name == 'Sharp Beak' && moveType == 'Flying' || item.name == 'Silk Scarf' && moveType == 'Normal' || item.name == 'SilverPowder' && moveType == 'Bug' || item.name == 'Soft Sand' && moveType == 'Ground' || item.name == 'Spell Tag' && moveType == 'Ghost' || item.name == 'TwistedSpoon' && moveType == 'Psychic') {
|
||||
basePower *= BattleRoom.battle.gen >= 4 ? 1.2 : 1.1;
|
||||
basePowerComment += ' (Boosted by ' + item.name + ')';
|
||||
}
|
||||
// Incenses
|
||||
if ((item.name == 'Wave Incense' || item.name == 'Sea Incense') && moveType == 'Water' || item.name == 'Rose Incense' && moveType == 'Grass' || item.name == 'Rock Incense' && moveType == 'Rock' || item.name == 'Odd Incense' && moveType == 'Psychic') {
|
||||
basePower *= 1.2;
|
||||
basePowerComment += ' (Boosted by ' + item.name + ')';
|
||||
}
|
||||
}
|
||||
basePower = Math.floor(basePower);
|
||||
return basePower == 0 ? basePowerComment : basePower + basePowerComment;
|
||||
}
|
||||
};
|
||||
BattleTooltips.prototype.boostBasePower_Ball = function (BattleRoom, move, pokemon, target, basePower, basePowerComment, min, max) {
|
||||
var myPokemon = BattleRoom.myPokemon[pokemon.slot];
|
||||
var ability = Tools.getAbility(myPokemon.baseAbility).name;
|
||||
var item = Tools.getItem(myPokemon.item);
|
||||
var pos = BattleRoom.choice.choices.length;
|
||||
var moveType = BattleRoom.getMoveType(move, BattleRoom.battle.mySide.active[pos]);
|
||||
var splitItemName = item.name.split(' ');
|
||||
var moveName = move.name;
|
||||
var itemCheck = false;
|
||||
if (!BattleRoom.battle.hasPseudoWeather('Magic Room') && (!pokemon.volatiles || !pokemon.volatiles['embargo'])) {
|
||||
if (splitItemName[1] == 'Gem' && moveType == splitItemName[0]) {
|
||||
min *= BattleRoom.battle.gen >= 6 ? 1.3 : 1.5;
|
||||
max *= BattleRoom.battle.gen >= 6 ? 1.3 : 1.5;
|
||||
itemCheck = true;
|
||||
}
|
||||
if (splitItemName[1] == 'Plate' && item.onPlate && moveType == item.onPlate) {
|
||||
min *= 1.2;
|
||||
max *= 1.2;
|
||||
itemCheck = true;
|
||||
}
|
||||
if (item.name == 'Magnet' && moveType == 'Electric' || item.name == 'Metal Coat' && moveType == 'Steel') {
|
||||
min *= BattleRoom.battle.gen >= 4 ? 1.2 : 1.1;
|
||||
max *= BattleRoom.battle.gen >= 4 ? 1.2 : 1.1;
|
||||
itemCheck = true;
|
||||
}
|
||||
if (ability === 'Technician') {
|
||||
if (min <= 60) min *= 1.5;
|
||||
if (max <= 60) max *= 1.5;
|
||||
basePowerComment += '' + ((min === max) ? Math.floor(max) : Math.floor(min) + ' to ' + Math.floor(max)) + ' (Technician boosted)';
|
||||
if (itemCheck) {
|
||||
basePowerComment += ' (Boosted by ' + item.name + ')';
|
||||
}
|
||||
} else {
|
||||
basePowerComment += (min === max) ? Math.floor(max) : Math.floor(min) + ' to ' + Math.floor(max);
|
||||
if (itemCheck) {
|
||||
basePowerComment += ' (Boosted by ' + item.name + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
return basePowerComment;
|
||||
};
|
||||
return BattleTooltips;
|
||||
})();
|
||||
|
|
@ -1331,6 +1331,7 @@
|
|||
var ability = Tools.getAbility(myPokemon.baseAbility).name;
|
||||
var basePower = move.basePower;
|
||||
var basePowerComment = '';
|
||||
var Tooltips = new BattleTooltips();
|
||||
var thereIsWeather = (this.battle.weather in {'sunnyday': 1, 'desolateland': 1, 'raindance': 1, 'primordialsea': 1, 'sandstorm': 1, 'hail':1});
|
||||
if (move.id === 'acrobatics') {
|
||||
if (!myPokemon.item) {
|
||||
|
|
@ -1416,8 +1417,8 @@
|
|||
var min = 0;
|
||||
var max = 0;
|
||||
if (target.volatiles && target.volatiles.formechange) template = Tools.getTemplate(target.volatiles.formechange[2]);
|
||||
var minRatio = (myPokemon.stats['spe'] / this.getTemplateMinSpeed(template, target.level));
|
||||
var maxRatio = (myPokemon.stats['spe'] / this.getTemplateMaxSpeed(template, target.level));
|
||||
var minRatio = (myPokemon.stats['spe'] / this.getTemplateMaxSpeed(template, target.level));
|
||||
var maxRatio = (myPokemon.stats['spe'] / this.getTemplateMinSpeed(template, target.level));
|
||||
if (minRatio >= 4) min = 150;
|
||||
else if (minRatio >= 3) min = 120;
|
||||
else if (minRatio >= 2) min = 80;
|
||||
|
|
@ -1430,12 +1431,16 @@
|
|||
else max = 40;
|
||||
// Special case due to being a range. Other moves are checked by technician below.
|
||||
basePower = 0;
|
||||
if (ability === 'Technician') {
|
||||
if (min <= 60) min *= 1.5;
|
||||
if (max <= 60) max *= 1.5;
|
||||
basePowerComment = '' + ((min === max) ? max : min + ' to ' + max) + ' (Technician boosted)';
|
||||
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 {
|
||||
basePowerComment = (min === max) ? max : min + ' to ' + max;
|
||||
return Tooltips.boostBasePower_Ball(this, move, pokemon, target, basePower, basePowerComment, min, max);
|
||||
}
|
||||
}
|
||||
if (move.id === 'gyroball') {
|
||||
|
|
@ -1447,12 +1452,16 @@
|
|||
if (max > 150) max = 150;
|
||||
// Special case due to range as well.
|
||||
basePower = 0;
|
||||
if (ability === 'Technician') {
|
||||
if (min <= 60) min *= 1.5;
|
||||
if (max <= 60) max = Math.max(max * 1.5, 90);
|
||||
basePowerComment = '' + ((min === max) ? max : min + ' to ' + max) + ' (Technician boosted)';
|
||||
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 {
|
||||
basePowerComment = (min === max) ? max : min + ' to ' + max;
|
||||
return Tooltips.boostBasePower_Ball(this, move, pokemon, target, basePower, basePowerComment, min, max);
|
||||
}
|
||||
}
|
||||
// Movements which have base power changed due to items.
|
||||
|
|
@ -1504,7 +1513,11 @@
|
|||
basePowerComment = ' (' + ability + ' boosted)';
|
||||
}
|
||||
}
|
||||
return basePower + basePowerComment;
|
||||
if (myPokemon.item) {
|
||||
return Tooltips.boostBasePower(this, move, pokemon, target, basePower, basePowerComment);
|
||||
} else {
|
||||
return basePower == 0 ? basePowerComment : basePower + basePowerComment;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@
|
|||
<script src="js/client-ladder.js"></script>
|
||||
<script src="js/client-chat.js"></script>
|
||||
<script src="js/client-chat-tournament.js"></script>
|
||||
<script src="js/client-battle-tooltips.js"></script>
|
||||
<script src="js/client-battle.js"></script>
|
||||
<script src="js/client-rooms.js"></script>
|
||||
<script src="js/storage.js"></script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user