mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-05 21:17:43 -05:00
commit
8b7963e996
|
|
@ -455,6 +455,10 @@ exports.BattleScripts = {
|
|||
if (moveData.status) {
|
||||
if (!target.status) {
|
||||
hitResult = target.setStatus(moveData.status, pokemon, move);
|
||||
if (!hitResult && move.status) {
|
||||
this.add('-immune', target, '[msg]');
|
||||
return false;
|
||||
}
|
||||
didSomething = didSomething || hitResult;
|
||||
} else if (!isSecondary) {
|
||||
if (target.status === moveData.status) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe('Most status moves', function () {
|
|||
battle.destroy();
|
||||
});
|
||||
|
||||
it('should ignore type immunities', function () {
|
||||
it('should ignore natural type immunities', function () {
|
||||
battle = BattleEngine.Battle.construct();
|
||||
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", ability: 'prankster', item: 'leftovers', moves: ['gastroacid', 'glare', 'confuseray', 'sandattack']}]);
|
||||
battle.join('p2', 'Guest 2', 1, [
|
||||
|
|
@ -32,31 +32,51 @@ describe('Most status moves', function () {
|
|||
assert.strictEqual(battle.p2.active[0].boosts['accuracy'], -1);
|
||||
});
|
||||
|
||||
it('should not ignore type immunities', function () {
|
||||
it('should fail when the opposing Pokemon is immune to the status effect it sets', function () {
|
||||
battle = BattleEngine.Battle.construct();
|
||||
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", ability: 'compoundeyes', item: 'widelens', moves: ['thunderwave', 'willowisp', 'poisongas', 'toxic']}]);
|
||||
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", ability: 'noguard', moves: ['thunderwave', 'willowisp', 'poisongas', 'toxic']}]);
|
||||
battle.join('p2', 'Guest 2', 1, [
|
||||
{species: "Landorus", ability: 'sandforce', moves: ['bulkup']},
|
||||
{species: "Zapdos", ability: 'pressure', moves: ['charge']},
|
||||
{species: "Heatran", ability: 'flashfire', moves: ['sleeptalk']},
|
||||
{species: "Muk", ability: 'stickyhold', moves: ['sleeptalk']}
|
||||
{species: "Emboar", ability: 'blaze', moves: ['sleeptalk']},
|
||||
{species: "Muk", ability: 'stench', moves: ['shadowsneak']}
|
||||
]);
|
||||
battle.commitDecisions();
|
||||
battle.choose('p1', 'move 1');
|
||||
battle.choose('p2', 'move 1');
|
||||
assert.strictEqual(battle.p2.active[0].status, '');
|
||||
battle.choose('p1', 'move 1');
|
||||
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
|
||||
battle.choose('p1', 'move 2');
|
||||
battle.choose('p2', 'switch 2');
|
||||
assert.strictEqual(battle.p2.active[0].status, '');
|
||||
battle.choose('p1', 'move 2');
|
||||
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
|
||||
battle.choose('p1', 'move 3');
|
||||
battle.choose('p2', 'switch 3');
|
||||
assert.strictEqual(battle.p2.active[0].status, '');
|
||||
battle.choose('p1', 'move 3');
|
||||
battle.choose('p2', 'switch 4');
|
||||
assert.strictEqual(battle.p2.active[0].status, '');
|
||||
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
|
||||
battle.choose('p1', 'move 4');
|
||||
battle.choose('p2', 'move 1');
|
||||
battle.commitDecisions();
|
||||
assert.strictEqual(battle.p2.active[0].status, '');
|
||||
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Thunder Wave, poison-inflicting status moves', function () {
|
||||
afterEach(function () {
|
||||
battle.destroy();
|
||||
});
|
||||
|
||||
it('should not ignore type immunities', function () {
|
||||
battle = BattleEngine.Battle.construct();
|
||||
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", ability: 'noguard', moves: ['thunderwave', 'poisongas', 'toxic']}]);
|
||||
battle.join('p2', 'Guest 2', 1, [
|
||||
{species: "Hippowdon", ability: 'sandforce', moves: ['slackoff']},
|
||||
{species: "Registeel", ability: 'clearbody', moves: ['sleeptalk']}
|
||||
]);
|
||||
battle.commitDecisions();
|
||||
assert.strictEqual(battle.p2.active[0].status, '');
|
||||
battle.choose('p1', 'move 2');
|
||||
battle.choose('p2', 'switch 2');
|
||||
assert.strictEqual(battle.p2.active[0].status, '');
|
||||
battle.choose('p1', 'move 2');
|
||||
battle.commitDecisions();
|
||||
assert.strictEqual(battle.p2.active[0].status, '');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,4 +13,26 @@ describe('Stealth Rock', function () {
|
|||
battle.commitDecisions();
|
||||
assert(battle.p2.sideConditions['stealthrock']);
|
||||
});
|
||||
|
||||
it('should deal damage to Pokemon switching in based on their type effectiveness against Rock-type', function () {
|
||||
battle = BattleEngine.Battle.construct();
|
||||
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", moves: ['splash', 'stealthrock']}]);
|
||||
battle.join('p2', 'Guest 2', 1, [
|
||||
{species: "Ninjask", moves: ['protect']},
|
||||
{species: "Volcarona", moves: ['roost']},
|
||||
{species: "Staraptor", moves: ['roost']},
|
||||
{species: "Chansey", moves: ['wish']},
|
||||
{species: "Hitmonchan", moves: ['rest']},
|
||||
{species: "Steelix", moves: ['rest']}
|
||||
]);
|
||||
battle.choose('p1', 'move 2');
|
||||
battle.commitDecisions();
|
||||
var pokemon;
|
||||
for (var i = 2; i <= 6; i++) {
|
||||
battle.choose('p2', 'switch ' + i);
|
||||
battle.commitDecisions();
|
||||
pokemon = battle.p2.active[0];
|
||||
assert.strictEqual(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp * Math.pow(0.5, i - 1)));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user