Chain Final Modifiers

This commit is contained in:
V4Victini 2013-09-27 23:30:55 -04:00
parent ab8f463809
commit 1c2a9a76c0
4 changed files with 66 additions and 65 deletions

View File

@ -2755,7 +2755,8 @@ var Battle = (function() {
}
// Final modifier. Modifiers that modify damage after min damage check, such as Life Orb.
baseDamage = this.runEvent('ModifyDamage', pokemon, target, move, baseDamage);
var finalMod = 1;
baseDamage = this.modify(baseDamage, this.runEvent('ModifyDamage', pokemon, target, move, finalMod));
return Math.floor(baseDamage);
};

View File

@ -494,10 +494,10 @@ exports.BattleAbilities = {
"filter": {
desc: "This Pokemon receives one-fourth reduced damage from Super Effective attacks.",
shortDesc: "This Pokemon receives 3/4 damage from super effective attacks.",
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (this.getEffectiveness(move.type, target) > 0) {
this.debug('Filter neutralize');
return this.modify(damage, 0.75);
return this.chain(damageMod, 0.75);
}
},
id: "filter",
@ -675,10 +675,10 @@ exports.BattleAbilities = {
shortDesc: "This Pokemon's allies receive 3/4 damage from other Pokemon's attacks.",
id: "friendguard",
name: "Friend Guard",
onAnyModifyDamage: function(damage, source, target, move) {
onAnyModifyDamage: function(damageMod, source, target, move) {
if (target !== this.effectData.target && target.side === this.effectData.target.side) {
this.debug('Friend Guard weaken')
return this.modify(damage, 0.75);
return this.chain(damageMod, 0.75);
}
},
rating: 0,
@ -1350,10 +1350,10 @@ exports.BattleAbilities = {
"multiscale": {
desc: "Lowers damage taken by half when at maximum HP.",
shortDesc: "If this Pokemon is at full HP, it takes half damage from attacks.",
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (target.hp >= target.maxhp) {
this.debug('Multiscale weaken');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
},
id: "multiscale",
@ -2020,10 +2020,10 @@ exports.BattleAbilities = {
"sniper": {
desc: "When this Pokemon lands a Critical Hit, the base power of its attack is tripled rather than doubled.",
shortDesc: "If this Pokemon strikes with a critical hit, the damage is tripled instead of doubled.",
onModifyDamage: function(damage, source, target, move) {
onModifyDamage: function(damageMod, source, target, move) {
if (move.crit) {
this.debug('Sniper boost');
return this.modify(damage, 1.5);
return this.chain(damageMod, 1.5);
}
},
id: "sniper",
@ -2082,10 +2082,10 @@ exports.BattleAbilities = {
"solidrock": {
desc: "This Pokemon receives one-fourth reduced damage from Super Effective attacks.",
shortDesc: "This Pokemon receives 3/4 damage from super effective attacks.",
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (this.getEffectiveness(move.type, target) > 0) {
this.debug('Solid Rock neutralize');
return this.modify(damage, 0.75);
return this.modify(damageMod, 0.75);
}
},
id: "solidrock",
@ -2392,10 +2392,10 @@ exports.BattleAbilities = {
"tintedlens": {
desc: "Doubles the power of moves that are Not Very Effective against opponents.",
shortDesc: "This Pokemon's attacks that are not very effective on a target do double damage.",
onModifyDamage: function(damage, source, target, move) {
onModifyDamage: function(damageMod, source, target, move) {
if (this.getEffectiveness(move.type, target) < 0) {
this.debug('Tinted Lens boost');
return this.modify(damage, 2);
return this.chain(damageMod, 2);
}
},
id: "tintedlens",

View File

@ -150,11 +150,11 @@ exports.BattleItems = {
basePower: 60,
type: "Steel"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Steel' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -375,11 +375,11 @@ exports.BattleItems = {
basePower: 60,
type: "Rock"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Rock' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -451,11 +451,11 @@ exports.BattleItems = {
basePower: 60,
type: "Normal"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Normal' && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -557,11 +557,11 @@ exports.BattleItems = {
basePower: 60,
type: "Fighting"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Fighting' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -590,11 +590,11 @@ exports.BattleItems = {
basePower: 60,
type: "Flying"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Flying' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -612,11 +612,11 @@ exports.BattleItems = {
basePower: 60,
type: "Dark"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Dark' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -1011,9 +1011,9 @@ exports.BattleItems = {
fling: {
basePower: 10
},
onModifyDamage: function(damage, source, target, move) {
onModifyDamage: function(damageMod, source, target, move) {
if (move && this.getEffectiveness(move.type, target) > 0) {
return this.modify(damage, 1.2);
return this.chain(damageMod, 1.2);
}
},
num: 268,
@ -1357,11 +1357,11 @@ exports.BattleItems = {
basePower: 60,
type: "Dragon"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Dragon' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -1587,11 +1587,11 @@ exports.BattleItems = {
basePower: 60,
type: "Ghost"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Ghost' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -1609,11 +1609,11 @@ exports.BattleItems = {
basePower: 60,
type: "Poison"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Poison' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -1803,10 +1803,10 @@ exports.BattleItems = {
fling: {
basePower: 30
},
onModifyDamage: function(damage, source, target, move) {
onModifyDamage: function(damageMod, source, target, move) {
if (damage > 0 && source) {
source.addVolatile('lifeorb');
damage = this.modify(damage, 1.3);
damage = this.chain(damageMod, 1.3);
}
return damage;
},
@ -2112,7 +2112,7 @@ exports.BattleItems = {
pokemon.addVolatile('metronome');
},
effect: {
onModifyDamage: function(damage, source, target, move) {
onModifyDamage: function(damageMod, source, target, move) {
if (source.item !== 'metronome') {
source.removeVolatile('metronome');
return;
@ -2124,7 +2124,7 @@ exports.BattleItems = {
this.effectData.numConsecutive++;
}
var bpMod = [1, 1.2, 1.4, 1.6, 1.8, 2];
return this.modify(damage, bpMod[this.effectData.numConsecutive]);
return this.chain(damageMod, bpMod[this.effectData.numConsecutive]);
}
},
num: 277,
@ -2319,11 +2319,11 @@ exports.BattleItems = {
basePower: 60,
type: "Fire"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Fire' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -2410,11 +2410,11 @@ exports.BattleItems = {
basePower: 60,
type: "Water"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Water' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -2432,11 +2432,11 @@ exports.BattleItems = {
basePower: 60,
type: "Psychic"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Psychic' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -2821,11 +2821,11 @@ exports.BattleItems = {
basePower: 60,
type: "Grass"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Grass' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -3075,11 +3075,11 @@ exports.BattleItems = {
basePower: 60,
type: "Ground"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Ground' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -3415,11 +3415,11 @@ exports.BattleItems = {
basePower: 60,
type: "Bug"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Bug' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -3522,11 +3522,11 @@ exports.BattleItems = {
basePower: 60,
type: "Electric"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Electric' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},
@ -3697,11 +3697,11 @@ exports.BattleItems = {
basePower: 60,
type: "Ice"
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.type === 'Ice' && this.getEffectiveness(move.type, target) > 0 && !target.volatiles['substitute']) {
if (target.eatItem()) {
this.debug('-50% reduction');
return this.modify(damage, 0.5);
return this.chain(damageMod, 0.5);
}
}
},

View File

@ -2310,9 +2310,9 @@ exports.BattleMovedex = {
}
return 0;
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.id === 'earthquake' || move.id === 'magnitude') {
return this.modify(damage, 2);
return this.chain(damageMod, 2);
}
}
},
@ -2439,9 +2439,9 @@ exports.BattleMovedex = {
}
return 0;
},
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.id === 'surf' || move.id === 'whirlpool') {
return this.modify(damage, 2);
return this.chain(damageMod, 2);
}
}
},
@ -6578,12 +6578,12 @@ exports.BattleMovedex = {
}
return 5;
},
onFoeModifyDamage: function(damage, source, target, move) {
onFoeModifyDamage: function(damageMod, source, target, move) {
if (this.getCategory(move) === 'Special' && target.side === this.effectData.target) {
if (!move.crit && source.ability !== 'infiltrator') {
this.debug('Light Screen weaken')
if (source.side.active.length > 1) return this.modify(damage, 0.66);
return this.modify(damage, 0.5);
if (source.side.active.length > 1) return this.chain(damageMod, 0.66);
return this.chain(damageMod, 0.5);
}
}
},
@ -7394,9 +7394,9 @@ exports.BattleMovedex = {
volatileStatus: 'minimize',
effect: {
noCopy: true,
onSourceModifyDamage: function(damage, source, target, move) {
onSourceModifyDamage: function(damageMod, source, target, move) {
if (move.id === 'stomp' || move.id === 'steamroller') {
return this.modify(damage, 2);
return this.chain(damageMod, 2);
}
}
},
@ -9135,12 +9135,12 @@ exports.BattleMovedex = {
}
return 5;
},
onFoeModifyDamage: function(damage, source, target, move) {
onFoeModifyDamage: function(damageMod, source, target, move) {
if (this.getCategory(move) === 'Physical' && target.side === this.effectData.target) {
if (!move.crit && source.ability !== 'infiltrator') {
this.debug('Reflect weaken');
if (source.side.active.length > 1) return this.modify(damage, 0.66);
return this.modify(damage, 0.5);
if (source.side.active.length > 1) return this.chain(damageMod, 0.66);
return this.chain(damageMod, 0.5);
}
}
},