Un-hardcode Rock Head in favor of an onDamage handler

Instead of having a hardcode in scripts.js that people needed to
reference, it seemed more intuitive to take advantage of the Damage
event instead, and have Rock Head negate damage within the event.

Fixed a bug in Gen-NEXT Rock Head exhibiting the same behavior that
was causing the original Rock Head + Mummy glitch.
This commit is contained in:
Kevin Lau 2015-05-21 13:51:36 -07:00
parent c919f1504e
commit 17724c59f0
5 changed files with 7 additions and 8 deletions

View File

@ -2151,7 +2151,9 @@ exports.BattleAbilities = {
"rockhead": {
desc: "This Pokemon does not take recoil damage besides Struggle, Life Orb, and crash damage.",
shortDesc: "This Pokemon does not take recoil damage besides Struggle/Life Orb/crash damage.",
// Implemented in scripts.js
onDamage: function (damage, target, source, effect) {
if (effect.id === 'recoil' && this.activeMove.id !== 'struggle') return null;
},
id: "rockhead",
name: "Rock Head",
rating: 3,

View File

@ -13486,7 +13486,7 @@ exports.BattleMovedex = {
} else {
this.add('-activate', target, 'Substitute', '[damage]');
}
if (move.recoil && (!source.hasAbility('rockhead') || move.id === 'struggle')) {
if (move.recoil) {
this.damage(Math.round(damage * move.recoil[0] / move.recoil[1]), source, target, 'recoil');
}
if (move.drain) {

View File

@ -314,7 +314,7 @@ exports.BattleScripts = {
totalDamage = damage;
}
if (move.recoil && (!pokemon.hasAbility('rockhead') || move.id === 'struggle')) {
if (move.recoil) {
this.damage(this.clampIntRange(Math.round(totalDamage * move.recoil[0] / move.recoil[1]), 1), pokemon, target, 'recoil');
}

View File

@ -869,7 +869,7 @@ exports.BattleMovedex = {
} else {
this.add('-activate', target, 'Substitute', '[damage]');
}
if (move.recoil && (!source.hasAbility('rockhead') || move.id === 'struggle')) {
if (move.recoil) {
this.damage(Math.round(damage * move.recoil[0] / move.recoil[1]), source, target, 'recoil');
}
if (move.drain) {

View File

@ -314,11 +314,8 @@ exports.BattleAbilities = {
},
"rockhead": {
inherit: true,
onModifyMove: function (move) {
delete move.recoil;
},
onDamage: function (damage, target, source, effect) {
if (effect && effect.id === 'lifeorb') return false;
if (effect && effect.id in {lifeorb: 1, recoil: 1}) return false;
}
},
"download": {