Fix timing of freeze thaws (#8453)

This commit is contained in:
Leonard Craft III 2021-09-29 19:29:26 -05:00 committed by GitHub
parent f2c9483496
commit 25910ed66d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 5 deletions

View File

@ -101,8 +101,13 @@ export const Conditions: {[k: string]: ConditionData} = {
pokemon.setStatus('');
}
},
onHit(target, source, move) {
if (move.thawsTarget || move.type === 'Fire' && move.category !== 'Status') {
onAfterMoveSecondary(target, source, move) {
if (move.thawsTarget) {
target.cureStatus();
}
},
onDamagingHit(damage, target, source, move) {
if (move.type === 'Fire' && move.category !== 'Status') {
target.cureStatus();
}
},

View File

@ -59,7 +59,7 @@ export const Conditions: {[k: string]: ModdedConditionData} = {
return false;
},
onModifyMove() {},
onHit() {},
onDamagingHit() {},
onAfterMoveSecondary(target, source, move) {
if ((move.secondary && move.secondary.status === 'brn') || move.statusRoll === 'brn') {
target.cureStatus();

View File

@ -38,9 +38,9 @@ export const Conditions: {[k: string]: ModdedConditionData} = {
},
frz: {
inherit: true,
onHit(target, source, move) {
onDamagingHit(damage, target, source, move) {
// don't count Hidden Power or Weather Ball as Fire-type
if (move.thawsTarget || this.dex.moves.get(move.id).type === 'Fire' && move.category !== 'Status') {
if (this.dex.moves.get(move.id).type === 'Fire' && move.category !== 'Status') {
target.cureStatus();
}
},

View File

@ -43,4 +43,30 @@ describe('Sheer Force', function () {
battle.makeChoices('move bodyslam', 'move rest');
assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
});
it(`should not be possible to thaw a frozen target with a Sheer Force-boosted thawsTarget move`, function () {
battle = common.createBattle([[
{species: 'wynaut', ability: 'sheerforce', moves: ['sleeptalk', 'scald']},
], [
{species: 'shuckle', moves: ['meteorassault']},
]]);
battle.makeChoices(); // Use Meteor Assault to force recharge next turn and skip potential thaw
const frozenMon = battle.p2.active[0];
frozenMon.setStatus('frz');
battle.makeChoices('move scald', 'auto');
assert.equal(frozenMon.status, 'frz');
});
it(`should be possible to thaw a frozen target with a Sheer Force-boosted Fire-type move`, function () {
battle = common.createBattle([[
{species: 'wynaut', ability: 'sheerforce', moves: ['sleeptalk', 'flamethrower']},
], [
{species: 'shuckle', moves: ['meteorassault']},
]]);
battle.makeChoices(); // Use Meteor Assault to force recharge next turn and skip potential thaw
const frozenMon = battle.p2.active[0];
frozenMon.setStatus('frz');
battle.makeChoices('move flamethrower', 'auto');
assert.equal(frozenMon.status, '');
});
});

View File

@ -192,6 +192,19 @@ describe('Freeze', function () {
assert.equal(battle.p1.active[0].status, 'frz');
assert.equal(battle.p1.active[0].species.name, 'Shaymin-Sky');
});
it(`should not be possible to burn a frozen target when using a move that thaws that target`, function () {
battle = common.createBattle([[
{species: 'wynaut', ability: 'serenegrace', item: 'widelens', moves: ['sleeptalk', 'sacredfire']},
], [
{species: 'shuckle', moves: ['meteorassault']},
]]);
battle.makeChoices(); // Use Meteor Assault to force recharge next turn and skip potential thaw
const frozenMon = battle.p2.active[0];
frozenMon.setStatus('frz');
battle.makeChoices('move sacredfire', 'auto');
assert.equal(frozenMon.status, '');
});
});
describe('Burn [Gen 6]', function () {