Correct Weakness Policy mechanics

And added relevant Burning Jealousy tests.
This commit is contained in:
The Immortal 2020-09-26 00:56:41 +04:00
parent b9df40c5af
commit 2b0c77939f
2 changed files with 44 additions and 6 deletions

View File

@ -6658,12 +6658,8 @@ export const Items: {[itemid: string]: ItemData} = {
fling: {
basePower: 80,
},
onHitPriority: 1,
onHit(target, source, move) {
if (
target.hp && move.category !== 'Status' && !move.damage &&
!move.damageCallback && target.getMoveHitData(move).typeMod > 0
) {
onDamagingHit(damage, target, source, move) {
if (!move.damage && !move.damageCallback && target.getMoveHitData(move).typeMod > 0) {
target.useItem();
}
},

View File

@ -0,0 +1,42 @@
'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Burning Jealousy', function () {
afterEach(function () {
battle.destroy();
});
it(`should burn a target whose stats were raised this turn`, function () {
battle = common.createBattle([[
{species: "Mew", moves: ['dragondance']},
], [
{species: "Torkoal", moves: ['burningjealousy']},
]]);
battle.makeChoices('move dragondance', 'move burningjealousy');
assert.equal(battle.p1.active[0].status, 'brn');
});
it(`should not burn a target whose stats were raised after the attack`, function () {
battle = common.createBattle([[
{species: "Ninetales", moves: ['burningjealousy']},
], [
{species: "Magearna", item: 'weaknesspolicy', moves: ['imprison']},
]]);
battle.makeChoices('move burningjealousy', 'move imprison');
assert.equal(battle.p2.active[0].status, '');
});
it(`should be affected by Sheer Force`, function () {
battle = common.createBattle([[
{species: "Cobalion", moves: ['swordsdance']},
], [
{species: "Darmanitan", ability: 'sheerforce', item: 'kingsrock', moves: ['burningjealousy']},
]]);
battle.makeChoices('move swordsdance', 'move burningjealousy');
assert.equal(battle.p1.active[0].status, '');
});
});