mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-26 02:39:38 -05:00
Fix interaction of Ruin Abilities with themselves (#9328)
This commit is contained in:
parent
0d4f6bea69
commit
32bbb77687
|
|
@ -357,9 +357,9 @@ export const Abilities: {[abilityid: string]: AbilityData} = {
|
|||
},
|
||||
onAnyModifySpD(spd, target, source, move) {
|
||||
const abilityHolder = this.effectState.target;
|
||||
if (abilityHolder === target) return;
|
||||
if (target.hasAbility('Beads of Ruin')) return;
|
||||
if (!move.ruinedSpD?.hasAbility('Beads of Ruin')) move.ruinedSpD = abilityHolder;
|
||||
if (move.ruinedSpD !== abilityHolder && move.ruinedSpD !== target) return;
|
||||
if (move.ruinedSpD !== abilityHolder) return;
|
||||
this.debug('Beads of Ruin SpD drop');
|
||||
return this.chainModify(0.75);
|
||||
},
|
||||
|
|
@ -4437,9 +4437,9 @@ export const Abilities: {[abilityid: string]: AbilityData} = {
|
|||
},
|
||||
onAnyModifyDef(def, target, source, move) {
|
||||
const abilityHolder = this.effectState.target;
|
||||
if (abilityHolder === target) return;
|
||||
if (target.hasAbility('Sword of Ruin')) return;
|
||||
if (!move.ruinedDef?.hasAbility('Sword of Ruin')) move.ruinedDef = abilityHolder;
|
||||
if (move.ruinedDef !== abilityHolder && move.ruinedDef !== target) return;
|
||||
if (move.ruinedDef !== abilityHolder) return;
|
||||
this.debug('Sword of Ruin Def drop');
|
||||
// TODO Placeholder
|
||||
return this.chainModify(0.75);
|
||||
|
|
@ -4455,7 +4455,7 @@ export const Abilities: {[abilityid: string]: AbilityData} = {
|
|||
},
|
||||
onAnyModifyAtk(atk, source, target, move) {
|
||||
const abilityHolder = this.effectState.target;
|
||||
if (abilityHolder === source) return;
|
||||
if (source.hasAbility('Tablets of Ruin')) return;
|
||||
if (!move.ruinedAtk) move.ruinedAtk = abilityHolder;
|
||||
if (move.ruinedAtk !== abilityHolder) return;
|
||||
this.debug('Tablets of Ruin Atk drop');
|
||||
|
|
@ -4801,7 +4801,7 @@ export const Abilities: {[abilityid: string]: AbilityData} = {
|
|||
},
|
||||
onAnyModifySpA(spa, source, target, move) {
|
||||
const abilityHolder = this.effectState.target;
|
||||
if (abilityHolder === source) return;
|
||||
if (source.hasAbility('Vessel of Ruin')) return;
|
||||
if (!move.ruinedSpA) move.ruinedSpA = abilityHolder;
|
||||
if (move.ruinedSpA !== abilityHolder) return;
|
||||
this.debug('Vessel of Ruin SpA drop');
|
||||
|
|
|
|||
36
test/sim/abilities/swordofruin.js
Normal file
36
test/sim/abilities/swordofruin.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
const assert = require('./../../assert');
|
||||
const common = require('./../../common');
|
||||
|
||||
let battle;
|
||||
|
||||
describe(`Sword of Ruin`, function () {
|
||||
afterEach(function () {
|
||||
battle.destroy();
|
||||
});
|
||||
|
||||
it(`should lower the Defense of all other Pokemon`, function () {
|
||||
battle = common.createBattle([[
|
||||
{species: 'wynaut', ability: 'shellarmor', moves: ['sleeptalk']},
|
||||
], [
|
||||
{species: 'chienpao', ability: 'swordofruin', moves: ['aerialace']},
|
||||
]]);
|
||||
battle.makeChoices();
|
||||
const wynaut = battle.p1.active[0];
|
||||
const damage = wynaut.maxhp - wynaut.hp;
|
||||
assert.bounded(damage, [120, 142]);
|
||||
});
|
||||
|
||||
it(`should not lower the Defense of other Pokemon with the Sword of Ruin Ability`, function () {
|
||||
battle = common.createBattle({forceRandomChance: false}, [[
|
||||
{species: 'wynaut', ability: 'swordofruin', moves: ['sleeptalk']},
|
||||
], [
|
||||
{species: 'chienpao', ability: 'swordofruin', moves: ['aerialace']},
|
||||
]]);
|
||||
battle.makeChoices();
|
||||
const wynaut = battle.p1.active[0];
|
||||
const damage = wynaut.maxhp - wynaut.hp;
|
||||
assert.bounded(damage, [90, 107]);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user