mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-24 23:09:10 -05:00
Gen IV: Make Download ignore foes behind substitutes (#10310)
This commit is contained in:
parent
717ef95c32
commit
44ea4080b2
|
|
@ -72,6 +72,23 @@ export const Abilities: {[k: string]: ModdedAbilityData} = {
|
|||
}
|
||||
},
|
||||
},
|
||||
download: {
|
||||
inherit: true,
|
||||
onStart(pokemon) {
|
||||
let totaldef = 0;
|
||||
let totalspd = 0;
|
||||
for (const target of pokemon.foes()) {
|
||||
if (target.volatiles.substitute) continue;
|
||||
totaldef += target.getStat('def', false, true);
|
||||
totalspd += target.getStat('spd', false, true);
|
||||
}
|
||||
if (totaldef && totaldef >= totalspd) {
|
||||
this.boost({spa: 1});
|
||||
} else if (totalspd) {
|
||||
this.boost({atk: 1});
|
||||
}
|
||||
},
|
||||
},
|
||||
effectspore: {
|
||||
inherit: true,
|
||||
onDamagingHit(damage, target, source, move) {
|
||||
|
|
|
|||
92
test/sim/abilities/download.js
Normal file
92
test/sim/abilities/download.js
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
'use strict';
|
||||
|
||||
const assert = require('./../../assert');
|
||||
const common = require('./../../common');
|
||||
|
||||
let battle;
|
||||
|
||||
describe('Download', () => {
|
||||
afterEach(() => battle.destroy());
|
||||
|
||||
it('should boost based on which defensive stat is higher', () => {
|
||||
battle = common.createBattle([[
|
||||
{species: 'porygon', moves: ['sleeptalk'], ability: 'download'},
|
||||
{species: 'furret', moves: ['sleeptalk']},
|
||||
], [
|
||||
{species: 'stonjourner', moves: ['sleeptalk']},
|
||||
{species: 'chansey', moves: ['sleeptalk']},
|
||||
]]);
|
||||
assert.statStage(battle.p1.active[0], 'spa', 1);
|
||||
battle.makeChoices('switch 2', 'switch 2');
|
||||
battle.makeChoices('switch 2', 'auto');
|
||||
assert.statStage(battle.p1.active[0], 'atk', 1);
|
||||
});
|
||||
|
||||
it('should boost Special Attack if both stats are tied', () => {
|
||||
battle = common.createBattle([[
|
||||
{species: 'porygon', moves: ['sleeptalk'], ability: 'download'},
|
||||
], [
|
||||
{species: 'mew', moves: ['sleeptalk']},
|
||||
]]);
|
||||
assert.statStage(battle.p1.active[0], 'spa', 1);
|
||||
assert.statStage(battle.p1.active[0], 'atk', 0);
|
||||
});
|
||||
|
||||
it('should boost based on the total of both foes in a Double Battle', () => {
|
||||
battle = common.createBattle({gameType: 'doubles'}, [[
|
||||
{species: 'porygon', moves: ['sleeptalk'], ability: 'download'},
|
||||
{species: 'blissey', moves: ['sleeptalk']},
|
||||
], [
|
||||
{species: 'blissey', level: 1, moves: ['sleeptalk']},
|
||||
{species: 'stonjourner', moves: ['sleeptalk']},
|
||||
]]);
|
||||
assert.statStage(battle.p1.active[0], 'spa', 1);
|
||||
assert.statStage(battle.p1.active[0], 'atk', 0);
|
||||
});
|
||||
|
||||
it('should trigger even if the foe is behind a Substitute', () => {
|
||||
battle = common.createBattle([[
|
||||
{species: 'furret', moves: ['sleeptalk']},
|
||||
{species: 'porygon', ability: 'download', moves: ['sleeptalk']},
|
||||
], [
|
||||
{species: 'blissey', moves: ['substitute']},
|
||||
]]);
|
||||
battle.makeChoices();
|
||||
battle.makeChoices('switch 2', 'auto');
|
||||
assert.statStage(battle.p1.active[0], 'atk', 1);
|
||||
});
|
||||
|
||||
describe('Gen 4', () => {
|
||||
it('should not trigger if the foe is behind a Substitute', () => {
|
||||
battle = common.gen(4).createBattle([[
|
||||
{species: 'furret', moves: ['sleeptalk']},
|
||||
{species: 'porygon', ability: 'download', moves: ['sleeptalk']},
|
||||
], [
|
||||
{species: 'ampharos', moves: ['substitute']},
|
||||
]]);
|
||||
battle.makeChoices();
|
||||
battle.makeChoices('switch 2', 'auto');
|
||||
assert.statStage(battle.p1.active[0], 'atk', 0);
|
||||
assert.statStage(battle.p1.active[0], 'spa', 0);
|
||||
});
|
||||
|
||||
it('in Double Battles, should only account for foes not behind a Substitute', () => {
|
||||
battle = common.gen(4).createBattle({gameType: 'doubles'}, [[
|
||||
{species: 'furret', moves: ['sleeptalk']},
|
||||
{species: 'ampharos', moves: ['sleeptalk']},
|
||||
{species: 'porygon', ability: 'download', moves: ['sleeptalk']},
|
||||
], [
|
||||
{species: 'blissey', moves: ['substitute']},
|
||||
{species: 'furret', moves: ['sleeptalk', 'substitute']},
|
||||
]]);
|
||||
battle.makeChoices();
|
||||
battle.makeChoices('move 1, switch 3', 'auto');
|
||||
assert.statStage(battle.p1.active[1], 'atk', 0);
|
||||
assert.statStage(battle.p1.active[1], 'spa', 1);
|
||||
battle.makeChoices('move 1, switch 3', 'move 1, move 2');
|
||||
battle.makeChoices('move 1, switch 3', 'auto');
|
||||
assert.statStage(battle.p1.active[1], 'atk', 0);
|
||||
assert.statStage(battle.p1.active[1], 'spa', 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user