Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test and fix gen 7 onSwitchInPriority #10851

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions data/mods/gen7/moves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
inherit: true,
condition: {
duration: 2,
onSwitchInPriority: 1,
onSwitchIn(target) {
if (!target.fainted) {
target.heal(target.maxhp);
Expand Down Expand Up @@ -610,7 +609,6 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
inherit: true,
condition: {
duration: 2,
onSwitchInPriority: 1,
onSwitchIn(target) {
if (!target.fainted) {
target.heal(target.maxhp);
Expand Down
14 changes: 6 additions & 8 deletions sim/battle-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,12 @@ export class BattleQueue {
beforeTurnMove: 5,
revivalblessing: 6,

runSwitch: 101,
switch: 103,
megaEvo: 104,
megaEvoX: 104,
megaEvoY: 104,
runDynamax: 105,
terastallize: 106,
priorityChargeMove: 107,
runSwitch: 100,
switch: 101,
megaEvo: 102, megaEvoX: 102, megaEvoY: 102,
runDynamax: 103,
terastallize: 104,
priorityChargeMove: 105,

shift: 200,
// default is 200 (for moves)
Expand Down
3 changes: 2 additions & 1 deletion sim/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ export class Battle {
// https://www.smogon.com/forums/threads/sword-shield-battle-mechanics-research.3655528/page-59#post-8685465
const effectTypeOrder: {[k in EffectType]?: number} = {
// Z-Move: 1,
Move: 2,
Condition: 2,
// Slot Condition: 3,
// Side Condition: 4,
Expand Down Expand Up @@ -948,7 +949,7 @@ export class Battle {
handler.subOrder = 5;
}
} else if (handler.effect.effectType === 'Ability') {
if (handler.effect.name === 'Poison Touch' || handler.effect.name === 'Perish Body') {
if (['Perish Body', 'Poison Touch'].includes(handler.effect.name)) {
handler.subOrder = 6;
} else if (handler.effect.name === 'Stall') {
handler.subOrder = 9;
Expand Down
10 changes: 10 additions & 0 deletions test/sim/abilities/magician.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ describe('Magician', function () {
battle.makeChoices();
assert.false.holdsItem(battle.p1.active[0], 'Klefki should not have stolen Weakness Policy.');
});

it(`should not steal an item on the turn Throat Spray activates`, function () {
battle = common.createBattle([[
{species: 'klefki', ability: 'magician', item: 'throatspray', moves: ['psychicnoise']},
], [
{species: 'hatterene', item: 'tr69', moves: ['sleeptalk']},
]]);
battle.makeChoices();
assert.false.holdsItem(battle.p1.active[0], 'Klefki should not have stolen an item.');
});
});