Fix interaction of Ruin Abilities with themselves (#9328)

This commit is contained in:
Hisuian Zoroark 2023-01-14 21:43:54 -05:00 committed by GitHub
parent 0d4f6bea69
commit 32bbb77687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 6 deletions

View File

@ -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');

View 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]);
});
});