Fix Z-move priority interaction

Priority Z-moves exist (namely, Gale Wings Supersonic Skystrike).

Quick Guard now partially protects against priority Z-moves.

Psychic Terrain now fully protects against priority Z-moves.
This commit is contained in:
Guangcong Luo
2017-01-07 22:42:28 -05:00
parent 9d1e153484
commit ef3b4965ea
3 changed files with 10 additions and 3 deletions

View File

@@ -3949,7 +3949,7 @@ class Battle extends Tools.BattleDex {
baseDamage = this.runEvent('ModifyDamage', pokemon, target, move, baseDamage);
// TODO: Find out where this actually goes in the damage calculation
if (move.isZ && (target.volatiles['banefulbunker'] || target.volatiles['kingsshield'] || target.side.sideConditions['matblock'] || target.volatiles['protect'] || target.volatiles['spikyshield'])) {
if (move.isZ && (move.zBrokeProtect || target.volatiles['banefulbunker'] || target.volatiles['kingsshield'] || target.side.sideConditions['matblock'] || target.volatiles['protect'] || target.volatiles['spikyshield'])) {
baseDamage = this.modify(baseDamage, 0.25);
this.add('-message', target.name + " couldn't fully protect itself and got hurt! (placeholder)");
}

View File

@@ -12710,10 +12710,14 @@ exports.BattleMovedex = {
this.add('-singleturn', source, 'Quick Guard');
},
onTryHitPriority: 4,
onTryHit: function (target, source, effect) {
onTryHit: function (target, source, move) {
// Quick Guard blocks moves with positive priority, even those given increased priority by Prankster or Gale Wings.
// (e.g. it blocks 0 priority moves boosted by Prankster or Gale Wings; Quick Claw/Custap Berry do not count)
if (effect && (effect.id === 'feint' || effect.priority <= 0.1 || effect.target === 'self')) {
if (move.id === 'feint' || move.priority <= 0.1 || move.target === 'self') {
return;
}
if (move.isZ) {
move.zBrokeProtect = true;
return;
}
this.add('-activate', target, 'move: Quick Guard');

View File

@@ -17,6 +17,9 @@ exports.BattleScripts = {
move = zMove ? this.getZMoveCopy(move, pokemon) : baseMove;
if (!target && target !== false) target = this.resolveTarget(pokemon, move);
// copy the priority for Quick Guard
if (zMove) move.priority = baseMove.priority;
this.setActiveMove(move, pokemon, target);
/* if (pokemon.moveThisTurn) {