Merge pull request #1678 from ascriptmaster/move-fixes

Refactor Unaware to use ModifyBoost
This commit is contained in:
Guangcong Luo 2015-03-27 13:16:55 -05:00
commit c331f2d440
3 changed files with 18 additions and 12 deletions

View File

@ -3097,10 +3097,8 @@ Battle = (function () {
ignorePositiveDefensive = true;
}
// Check for abilities to see if defenses or offenses are negated (Unaware, Mold Breaker, etc.)
var targetAbilityIgnoreOffensive = !target.ignore['Ability'] && target.getAbility().ignoreOffensive;
var pokemonAbilityIgnoreDefensive = !pokemon.ignore['Ability'] && pokemon.getAbility().ignoreDefensive;
var ignoreOffensive = !!(move.ignoreOffensive || targetAbilityIgnoreOffensive || (ignoreNegativeOffensive && atkBoosts < 0));
var ignoreDefensive = !!(move.ignoreDefensive || pokemonAbilityIgnoreDefensive || (ignorePositiveDefensive && defBoosts > 0));
var ignoreOffensive = !!(move.ignoreOffensive || (ignoreNegativeOffensive && atkBoosts < 0));
var ignoreDefensive = !!(move.ignoreDefensive || (ignorePositiveDefensive && defBoosts > 0));
if (ignoreOffensive) {
this.debug('Negating (sp)atk boost/penalty.');

View File

@ -2994,10 +2994,20 @@ exports.BattleAbilities = {
shortDesc: "This Pokemon ignores other Pokemon's stat stages when taking or doing damage.",
id: "unaware",
name: "Unaware",
ignoreEvasion: true,
ignoreDefensive: true,
ignoreAccuracy: true,
ignoreOffensive: true,
onAnyModifyBoost: function (boosts, target) {
var source = this.effectData.target;
if (source === target) return;
if (source === this.activePokemon && target === this.activeTarget) {
boosts['def'] = 0;
boosts['spd'] = 0;
boosts['evasion'] = 0;
}
if (target === this.activePokemon && source === this.activeTarget) {
boosts['atk'] = 0;
boosts['spa'] = 0;
boosts['accuracy'] = 0;
}
},
rating: 3,
num: 109
},

View File

@ -229,8 +229,7 @@ exports.BattleScripts = {
var accuracy = move.accuracy;
var boosts, boost;
if (accuracy !== true) {
var targetAbilityIgnoreAccuracy = !target.ignore['Ability'] && target.getAbility().ignoreAccuracy;
if (!move.ignoreAccuracy && !targetAbilityIgnoreAccuracy) {
if (!move.ignoreAccuracy) {
boosts = this.runEvent('ModifyBoost', pokemon, null, null, Object.clone(this.boosts));
boost = this.clampIntRange(boosts['accuracy'], -6, 6);
if (boost > 0) {
@ -239,8 +238,7 @@ exports.BattleScripts = {
accuracy /= boostTable[-boost];
}
}
var pokemonAbilityIgnoreEvasion = !pokemon.ignore['Ability'] && pokemon.getAbility().ignoreEvasion;
if (!move.ignoreEvasion && !pokemonAbilityIgnoreEvasion) {
if (!move.ignoreEvasion) {
boosts = this.runEvent('ModifyBoost', pokemon, null, null, Object.clone(this.boosts));
boost = this.clampIntRange(boosts['evasion'], -6, 6);
if (boost > 0) {