Skip to content

Commit 91e3c09

Browse files
Update WeatherChange logic
1 parent 77cf52e commit 91e3c09

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

data/abilities.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -3438,10 +3438,13 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
34383438
// Protosynthesis is not affected by Utility Umbrella
34393439
if (this.field.isWeather('sunnyday')) {
34403440
pokemon.addVolatile('protosynthesis');
3441-
} else if (!pokemon.volatiles['protosynthesis'] && pokemon.hasItem('boosterenergy')) {
3442-
pokemon.useItem();
3443-
} else if (!pokemon.volatiles['protosynthesis']?.fromBooster) {
3444-
pokemon.removeVolatile('protosynthesis');
3441+
} else {
3442+
if (!pokemon.volatiles['protosynthesis']?.fromBooster) {
3443+
pokemon.removeVolatile('protosynthesis');
3444+
}
3445+
if (!pokemon.volatiles['protosynthesis'] && pokemon.hasItem('boosterenergy')) {
3446+
pokemon.useItem();
3447+
}
34453448
}
34463449
},
34473450
onUpdate(pokemon) {
@@ -3584,10 +3587,13 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
35843587
onTerrainChange(pokemon) {
35853588
if (this.field.isTerrain('electricterrain')) {
35863589
pokemon.addVolatile('quarkdrive');
3587-
} else if (!pokemon.volatiles['quarkdrive'] && pokemon.hasItem('boosterenergy')) {
3588-
pokemon.useItem();
3589-
} else if (!pokemon.volatiles['quarkdrive']?.fromBooster) {
3590-
pokemon.removeVolatile('quarkdrive');
3590+
} else {
3591+
if (!pokemon.volatiles['quarkdrive']?.fromBooster) {
3592+
pokemon.removeVolatile('quarkdrive');
3593+
}
3594+
if (!pokemon.volatiles['quarkdrive'] && pokemon.hasItem('boosterenergy')) {
3595+
pokemon.useItem();
3596+
}
35913597
}
35923598
},
35933599
onUpdate(pokemon) {

data/items.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ export const Items: import('../sim/dex-items').ItemDataTable = {
614614
basePower: 30,
615615
},
616616
onUseItem(item, pokemon) {
617-
return ['protosynthesis', 'quarkdrive'].includes(pokemon.ability);
617+
return item.id === 'boosterenergy' && (pokemon.hasAbility('protosynthesis') || pokemon.hasAbility('quarkdrive'));
618618
},
619619
onUse(pokemon) {
620620
pokemon.addVolatile(pokemon.ability);

data/mods/gen9dlc1/abilities.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ export const Abilities: import('../../../sim/dex-abilities').ModdedAbilityDataTa
1313
// Protosynthesis is not affected by Utility Umbrella
1414
if (this.field.isWeather('sunnyday')) {
1515
pokemon.addVolatile('protosynthesis');
16-
} else if (!pokemon.volatiles['protosynthesis'] && pokemon.hasItem('boosterenergy')) {
17-
pokemon.useItem();
18-
} else if (!pokemon.volatiles['protosynthesis']?.fromBooster && this.field.weather !== 'sunnyday') {
19-
// Protosynthesis will not deactivite if Sun is suppressed, hence the direct ID check (isWeather respects supression)
20-
pokemon.removeVolatile('protosynthesis');
16+
} else {
17+
if (!pokemon.volatiles['protosynthesis']?.fromBooster && this.field.weather !== 'sunnyday') {
18+
pokemon.removeVolatile('protosynthesis');
19+
}
20+
if (!pokemon.volatiles['protosynthesis'] && pokemon.hasItem('boosterenergy')) {
21+
pokemon.useItem();
22+
}
2123
}
2224
},
2325
condition: {

0 commit comments

Comments
 (0)