Skip to content

Commit 3c03db4

Browse files
Fixed using previouslySwitchedIn
1 parent c1b3306 commit 3c03db4

File tree

2 files changed

+12
-37
lines changed

2 files changed

+12
-37
lines changed

data/abilities.ts

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,59 +1167,47 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
11671167
},
11681168
embodyaspectcornerstone: {
11691169
onStart(pokemon) {
1170-
if (pokemon.baseSpecies.name === 'Ogerpon-Cornerstone-Tera' && !this.effectState.embodied) {
1171-
this.effectState.embodied = true;
1170+
if (pokemon.baseSpecies.name === 'Ogerpon-Cornerstone-Tera' && this.effectState.embodied !== pokemon.previouslySwitchedIn) {
1171+
this.effectState.embodied = pokemon.previouslySwitchedIn;
11721172
this.boost({def: 1}, pokemon);
11731173
}
11741174
},
1175-
onSwitchIn() {
1176-
delete this.effectState.embodied;
1177-
},
11781175
flags: {failroleplay: 1, noreceiver: 1, noentrain: 1, notrace: 1, failskillswap: 1, notransform: 1},
11791176
name: "Embody Aspect (Cornerstone)",
11801177
rating: 3.5,
11811178
num: 304,
11821179
},
11831180
embodyaspecthearthflame: {
11841181
onStart(pokemon) {
1185-
if (pokemon.baseSpecies.name === 'Ogerpon-Hearthflame-Tera' && !this.effectState.embodied) {
1186-
this.effectState.embodied = true;
1182+
if (pokemon.baseSpecies.name === 'Ogerpon-Hearthflame-Tera' && this.effectState.embodied !== pokemon.previouslySwitchedIn) {
1183+
this.effectState.embodied = pokemon.previouslySwitchedIn;
11871184
this.boost({atk: 1}, pokemon);
11881185
}
11891186
},
1190-
onSwitchIn() {
1191-
delete this.effectState.embodied;
1192-
},
11931187
flags: {failroleplay: 1, noreceiver: 1, noentrain: 1, notrace: 1, failskillswap: 1, notransform: 1},
11941188
name: "Embody Aspect (Hearthflame)",
11951189
rating: 3.5,
11961190
num: 303,
11971191
},
11981192
embodyaspectteal: {
11991193
onStart(pokemon) {
1200-
if (pokemon.baseSpecies.name === 'Ogerpon-Teal-Tera' && !this.effectState.embodied) {
1201-
this.effectState.embodied = true;
1194+
if (pokemon.baseSpecies.name === 'Ogerpon-Teal-Tera' && this.effectState.embodied !== pokemon.previouslySwitchedIn) {
1195+
this.effectState.embodied = pokemon.previouslySwitchedIn;
12021196
this.boost({spe: 1}, pokemon);
12031197
}
12041198
},
1205-
onSwitchIn() {
1206-
delete this.effectState.embodied;
1207-
},
12081199
flags: {failroleplay: 1, noreceiver: 1, noentrain: 1, notrace: 1, failskillswap: 1, notransform: 1},
12091200
name: "Embody Aspect (Teal)",
12101201
rating: 3.5,
12111202
num: 301,
12121203
},
12131204
embodyaspectwellspring: {
12141205
onStart(pokemon) {
1215-
if (pokemon.baseSpecies.name === 'Ogerpon-Wellspring-Tera' && !this.effectState.embodied) {
1216-
this.effectState.embodied = true;
1206+
if (pokemon.baseSpecies.name === 'Ogerpon-Wellspring-Tera' && this.effectState.embodied !== pokemon.previouslySwitchedIn) {
1207+
this.effectState.embodied = pokemon.previouslySwitchedIn;
12171208
this.boost({spd: 1}, pokemon);
12181209
}
12191210
},
1220-
onSwitchIn() {
1221-
delete this.effectState.embodied;
1222-
},
12231211
flags: {failroleplay: 1, noreceiver: 1, noentrain: 1, notrace: 1, failskillswap: 1, notransform: 1},
12241212
name: "Embody Aspect (Wellspring)",
12251213
rating: 3.5,
@@ -2272,18 +2260,15 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
22722260
},
22732261
libero: {
22742262
onPrepareHit(source, target, move) {
2275-
if (this.effectState.protean) return;
2263+
if (this.effectState.libero === source.previouslySwitchedIn) return;
22762264
if (move.hasBounced || move.flags['futuremove'] || move.sourceEffect === 'snatch' || move.callsMove) return;
22772265
const type = move.type;
22782266
if (type && type !== '???' && source.getTypes().join() !== type) {
22792267
if (!source.setType(type)) return;
2280-
this.effectState.protean = true;
2268+
this.effectState.libero = source.previouslySwitchedIn;
22812269
this.add('-start', source, 'typechange', type, '[from] ability: Libero');
22822270
}
22832271
},
2284-
onSwitchIn() {
2285-
delete this.effectState.protean;
2286-
},
22872272
flags: {},
22882273
name: "Libero",
22892274
rating: 4,
@@ -2875,11 +2860,6 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
28752860
}
28762861
}
28772862
},
2878-
onAnySwitchIn(pokemon) {
2879-
if (['libero', 'protean'].includes(pokemon.getAbility().id)) {
2880-
delete pokemon.abilityState.protean;
2881-
}
2882-
},
28832863
onEnd(source) {
28842864
if (source.transformed) return;
28852865
for (const pokemon of this.getAllActive()) {
@@ -3421,18 +3401,15 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
34213401
},
34223402
protean: {
34233403
onPrepareHit(source, target, move) {
3424-
if (this.effectState.protean) return;
3404+
if (this.effectState.protean === source.previouslySwitchedIn) return;
34253405
if (move.hasBounced || move.flags['futuremove'] || move.sourceEffect === 'snatch' || move.callsMove) return;
34263406
const type = move.type;
34273407
if (type && type !== '???' && source.getTypes().join() !== type) {
34283408
if (!source.setType(type)) return;
3429-
this.effectState.protean = true;
3409+
this.effectState.protean = source.previouslySwitchedIn;
34303410
this.add('-start', source, 'typechange', type, '[from] ability: Protean');
34313411
}
34323412
},
3433-
onSwitchIn() {
3434-
delete this.effectState.protean;
3435-
},
34363413
flags: {},
34373414
name: "Protean",
34383415
rating: 4,

data/mods/gen8/abilities.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,6 @@ export const Abilities: import('../../../sim/dex-abilities').ModdedAbilityDataTa
559559
this.add('-start', source, 'typechange', type, '[from] ability: Libero');
560560
}
561561
},
562-
onSwitchIn() {},
563562
rating: 4.5,
564563
},
565564
lightmetal: {
@@ -780,7 +779,6 @@ export const Abilities: import('../../../sim/dex-abilities').ModdedAbilityDataTa
780779
this.add('-start', source, 'typechange', type, '[from] ability: Protean');
781780
}
782781
},
783-
onSwitchIn() {},
784782
rating: 4.5,
785783
},
786784
psychicsurge: {

0 commit comments

Comments
 (0)