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

Glacemons' PMO bugfix #971

Merged
merged 10 commits into from
Mar 22, 2025
6 changes: 5 additions & 1 deletion data/mods/glacemons/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1118,11 +1118,15 @@ export const Items: { [k: string]: ModdedItemData; } = {
parallelmegaorb: {
name: "Parallel Mega Orb",
onTakeItem: false,
onBeforeMega(pokemon) {
pokemon.addVolatile('gastroacid');
},
onAfterMega(pokemon) {
let newAbility = pokemon.set.ability
const oldAbility = pokemon.setAbility(newAbility, pokemon, newAbility, true);
pokemon.removeVolatile('gastroacid');
},
onStart(pokemon) {
onPreStart(pokemon) {
let newAbility = pokemon.set.ability
const oldAbility = pokemon.setAbility(newAbility, pokemon, newAbility, true);
},
Expand Down
2 changes: 2 additions & 0 deletions sim/battle-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,8 @@ export class BattleActions {
const speciesid = pokemon.canMegaEvo || pokemon.canUltraBurst;
if (!speciesid) return false;

this.battle.runEvent('BeforeMega', pokemon);

pokemon.formeChange(speciesid, pokemon.getItem(), true);

// Limit one mega evolution
Expand Down
1 change: 1 addition & 0 deletions sim/dex-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface EventMethods {
onAfterEachBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
onAfterHit?: MoveEventMethods['onAfterHit'];
onAfterMega?: (this: Battle, pokemon: Pokemon) => void;
onBeforeMega?: (this: Battle, pokemon: Pokemon) => void;
onAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;
onAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];
onAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;
Expand Down