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

Overhaul 'SwitchIn' event for more accurate effect resolution order #10766

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c5e4827
Mirror Herb: Copy simultaneous boosts from Howl, etc.
pyuk-bot Dec 18, 2024
d95b679
Actually send End single events for Items on switch out
pyuk-bot Dec 18, 2024
d2a78a1
Overhaul 'SwitchIn' event for more accurate effect resolution order
pyuk-bot Dec 26, 2024
8481063
Unskip a passing Eject Pack test
pyuk-bot Dec 26, 2024
e112313
Keep speed tie resolution consistent across the SwitchIn event
pyuk-bot Dec 27, 2024
ea7433a
Actually pre-sort by speed for better PRNG usage
pyuk-bot Dec 27, 2024
212fb74
Split failing Commander switch out test and band-aid-fix Commander + …
pyuk-bot Dec 27, 2024
fcbe2a9
Don't break Commander and Booster Energy if onStart is skipped
pyuk-bot Jan 2, 2025
7980cc0
Minimize risk of event depth overflow crashes
pyuk-bot Jan 2, 2025
918ebde
Fix unintended changes to speed ties in other events
pyuk-bot Jan 3, 2025
ce522f8
Fix serialization
pyuk-bot Jan 3, 2025
fe0e77b
Fix White Herb timing when holder is not the one switching in
pyuk-bot Jan 19, 2025
a460633
Fix Commander/Pastel Veil when holder is not the one switching in
pyuk-bot Jan 19, 2025
c387934
Move EffectState initialization handling to Battle functions
pyuk-bot Jan 20, 2025
e38cd95
Improve Primal Orb immunity to negation
pyuk-bot Jan 21, 2025
7b5183f
Some simplifications (#73)
andrebastosdias Jan 21, 2025
fb28665
Fix onSwitchInPriority for OMs and healreplacement Z-power
pyuk-bot Jan 22, 2025
6fac206
Give Klutz an onSwitchInPriority
pyuk-bot Jan 22, 2025
899f325
Update Perish Body's subOrder
pyuk-bot Jan 22, 2025
a3371bb
Update tests
pyuk-bot Jan 22, 2025
84578f9
Don't activate Commander early if only Dondozo is switching in
pyuk-bot Jan 22, 2025
d79da78
Fix Klutz comment typo
pyuk-bot Jan 22, 2025
ce0a966
Very minor changes
pyuk-bot Jan 23, 2025
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
22 changes: 11 additions & 11 deletions config/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,15 +638,15 @@ export const Formats: import('../sim/dex-formats').FormatList = [
const itemTable = new Set<ID>();
for (const set of team) {
const item = this.dex.items.get(set.item);
if (!item.megaStone && !item.onPrimal && !item.forcedForme?.endsWith('Origin') &&
if (!item.megaStone && !item.isPrimalOrb && !item.forcedForme?.endsWith('Origin') &&
!item.name.startsWith('Rusted') && !item.name.endsWith('Mask')) continue;
const natdex = this.ruleTable.has('standardnatdex');
if (natdex && item.id !== 'ultranecroziumz') continue;
const species = this.dex.species.get(set.species);
if (species.isNonstandard && !this.ruleTable.has(`+pokemontag:${this.toID(species.isNonstandard)}`)) {
return [`${species.baseSpecies} does not exist in gen 9.`];
}
if ((item.itemUser?.includes(species.name) && !item.megaStone && !item.onPrimal) ||
if ((item.itemUser?.includes(species.name) && !item.megaStone && !item.isPrimalOrb) ||
(natdex && species.name.startsWith('Necrozma-') && item.id === 'ultranecroziumz')) {
continue;
}
Expand Down Expand Up @@ -728,12 +728,12 @@ export const Formats: import('../sim/dex-formats').FormatList = [
if (!format.getSharedPower) format = this.dex.formats.get('gen9sharedpower');
for (const ability of format.getSharedPower!(pokemon)) {
const effect = 'ability:' + ability;
pokemon.volatiles[effect] = {id: this.toID(effect), target: pokemon};
pokemon.volatiles[effect] = this.initEffectState({id: this.toID(effect), target: pokemon});
if (!pokemon.m.abils) pokemon.m.abils = [];
if (!pokemon.m.abils.includes(effect)) pokemon.m.abils.push(effect);
}
},
onSwitchInPriority: 2,
onSwitchInPriority: 100,
onSwitchIn(pokemon) {
let format = this.format;
if (!format.getSharedPower) format = this.dex.formats.get('gen9sharedpower');
Expand Down Expand Up @@ -1462,14 +1462,14 @@ export const Formats: import('../sim/dex-formats').FormatList = [
if (!pokemon.m.innate && !BAD_ABILITIES.includes(this.toID(ally.ability))) {
pokemon.m.innate = 'ability:' + ally.ability;
if (!ngas || ally.getAbility().flags['cantsuppress'] || pokemon.hasItem('Ability Shield')) {
pokemon.volatiles[pokemon.m.innate] = {id: pokemon.m.innate, target: pokemon};
pokemon.volatiles[pokemon.m.innate] = this.initEffectState({id: pokemon.m.innate, target: pokemon});
pokemon.m.startVolatile = true;
}
}
if (!ally.m.innate && !BAD_ABILITIES.includes(this.toID(pokemon.ability))) {
ally.m.innate = 'ability:' + pokemon.ability;
if (!ngas || pokemon.getAbility().flags['cantsuppress'] || ally.hasItem('Ability Shield')) {
ally.volatiles[ally.m.innate] = {id: ally.m.innate, target: ally};
ally.volatiles[ally.m.innate] = this.initEffectState({id: ally.m.innate, target: ally});
ally.m.startVolatile = true;
}
}
Expand Down Expand Up @@ -1568,7 +1568,7 @@ export const Formats: import('../sim/dex-formats').FormatList = [
}
}
},
onSwitchInPriority: 2,
onSwitchInPriority: 100,
onSwitchIn(pokemon) {
if (pokemon.m.innates) {
for (const innate of pokemon.m.innates) {
Expand Down Expand Up @@ -1767,12 +1767,12 @@ export const Formats: import('../sim/dex-formats').FormatList = [
for (const item of format.getSharedItems!(pokemon)) {
if (pokemon.m.sharedItemsUsed.includes(item)) continue;
const effect = 'item:' + item;
pokemon.volatiles[effect] = {id: this.toID(effect), target: pokemon};
pokemon.volatiles[effect] = this.initEffectState({id: this.toID(effect), target: pokemon});
if (!pokemon.m.items) pokemon.m.items = [];
if (!pokemon.m.items.includes(effect)) pokemon.m.items.push(effect);
}
},
onSwitchInPriority: 2,
onSwitchInPriority: 100,
onSwitchIn(pokemon) {
let format = this.format;
if (!format.getSharedItems) format = this.dex.formats.get('gen9sharingiscaring');
Expand Down Expand Up @@ -2585,12 +2585,12 @@ export const Formats: import('../sim/dex-formats').FormatList = [
if (!format.getSharedPower) format = this.dex.formats.get('gen9sharedpower');
for (const ability of format.getSharedPower!(pokemon)) {
const effect = 'ability:' + ability;
pokemon.volatiles[effect] = {id: this.toID(effect), target: pokemon};
pokemon.volatiles[effect] = this.initEffectState({id: this.toID(effect), target: pokemon});
if (!pokemon.m.abils) pokemon.m.abils = [];
if (!pokemon.m.abils.includes(effect)) pokemon.m.abils.push(effect);
}
},
onSwitchInPriority: 2,
onSwitchInPriority: 100,
onSwitchIn(pokemon) {
let format = this.format;
if (!format.getSharedPower) format = this.dex.formats.get('gen9sharedpower');
Expand Down
Loading
Loading