@pkmn/sim 0.9.27 → 0.9.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/config/formats.js +51 -51
- package/build/cjs/config/formats.js.map +1 -1
- package/build/cjs/data/abilities.js +83 -84
- package/build/cjs/data/abilities.js.map +1 -1
- package/build/cjs/data/aliases.js +3 -2
- package/build/cjs/data/aliases.js.map +1 -1
- package/build/cjs/data/conditions.js +3 -3
- package/build/cjs/data/conditions.js.map +1 -1
- package/build/cjs/data/formats-data.js +6 -6
- package/build/cjs/data/formats-data.js.map +1 -1
- package/build/cjs/data/items.js +55 -25
- package/build/cjs/data/items.js.map +1 -1
- package/build/cjs/data/legality.js +275 -23
- package/build/cjs/data/legality.js.map +1 -1
- package/build/cjs/data/mods/gen1/moves.js.map +1 -1
- package/build/cjs/data/mods/gen1/scripts.js +2 -0
- package/build/cjs/data/mods/gen1/scripts.js.map +1 -1
- package/build/cjs/data/mods/gen3/abilities.js +0 -2
- package/build/cjs/data/mods/gen3/abilities.js.map +1 -1
- package/build/cjs/data/mods/gen3/moves.js.map +1 -1
- package/build/cjs/data/mods/gen4/abilities.js +1 -1
- package/build/cjs/data/mods/gen4/abilities.js.map +1 -1
- package/build/cjs/data/mods/gen4/moves.js +31 -0
- package/build/cjs/data/mods/gen4/moves.js.map +1 -1
- package/build/cjs/data/mods/gen4/scripts.js +26 -0
- package/build/cjs/data/mods/gen4/scripts.js.map +1 -1
- package/build/cjs/data/mods/gen5/formats-data.js +1 -1
- package/build/cjs/data/mods/gen5/formats-data.js.map +1 -1
- package/build/cjs/data/mods/gen6/moves.js.map +1 -1
- package/build/cjs/data/mods/gen8/moves.js +1 -1
- package/build/cjs/data/mods/gen8/moves.js.map +1 -1
- package/build/cjs/data/moves.js +15 -9
- package/build/cjs/data/moves.js.map +1 -1
- package/build/cjs/data/pokemongo.js +1 -1
- package/build/cjs/data/text/moves.js +1 -1
- package/build/cjs/data/text/moves.js.map +1 -1
- package/build/cjs/lib/utils.d.ts +2 -0
- package/build/cjs/lib/utils.js +1 -1
- package/build/cjs/lib/utils.js.map +1 -1
- package/build/cjs/sim/battle-actions.js +25 -36
- package/build/cjs/sim/battle-actions.js.map +1 -1
- package/build/cjs/sim/battle-queue.d.ts +1 -1
- package/build/cjs/sim/battle-queue.js +0 -2
- package/build/cjs/sim/battle-queue.js.map +1 -1
- package/build/cjs/sim/battle-stream.js +2 -3
- package/build/cjs/sim/battle-stream.js.map +1 -1
- package/build/cjs/sim/battle.d.ts +13 -7
- package/build/cjs/sim/battle.js +185 -60
- package/build/cjs/sim/battle.js.map +1 -1
- package/build/cjs/sim/dex-abilities.d.ts +0 -1
- package/build/cjs/sim/dex-abilities.js +2 -2
- package/build/cjs/sim/dex-abilities.js.map +1 -1
- package/build/cjs/sim/dex-conditions.d.ts +11 -3
- package/build/cjs/sim/dex-conditions.js +2 -2
- package/build/cjs/sim/dex-conditions.js.map +1 -1
- package/build/cjs/sim/dex-data.js +7 -7
- package/build/cjs/sim/dex-data.js.map +1 -1
- package/build/cjs/sim/dex-formats.d.ts +2 -1
- package/build/cjs/sim/dex-formats.js.map +1 -1
- package/build/cjs/sim/dex-items.d.ts +3 -1
- package/build/cjs/sim/dex-items.js +3 -2
- package/build/cjs/sim/dex-items.js.map +1 -1
- package/build/cjs/sim/dex-moves.js +4 -4
- package/build/cjs/sim/dex-moves.js.map +1 -1
- package/build/cjs/sim/exported-global-types.d.ts +6 -0
- package/build/cjs/sim/field.js +9 -9
- package/build/cjs/sim/field.js.map +1 -1
- package/build/cjs/sim/global-types.d.ts +6 -0
- package/build/cjs/sim/pokemon.d.ts +8 -4
- package/build/cjs/sim/pokemon.js +61 -46
- package/build/cjs/sim/pokemon.js.map +1 -1
- package/build/cjs/sim/prng.d.ts +7 -4
- package/build/cjs/sim/prng.js +67 -16
- package/build/cjs/sim/prng.js.map +1 -1
- package/build/cjs/sim/side.js +9 -6
- package/build/cjs/sim/side.js.map +1 -1
- package/build/cjs/sim/team-validator.js +16 -17
- package/build/cjs/sim/team-validator.js.map +1 -1
- package/build/cjs/sim/tools/exhaustive-runner.js +3 -4
- package/build/cjs/sim/tools/exhaustive-runner.js.map +1 -1
- package/build/cjs/sim/tools/random-player-ai.js +1 -1
- package/build/cjs/sim/tools/random-player-ai.js.map +1 -1
- package/build/cjs/sim/tools/runner.js +2 -3
- package/build/cjs/sim/tools/runner.js.map +1 -1
- package/build/esm/config/formats.mjs +51 -51
- package/build/esm/config/formats.mjs.map +1 -1
- package/build/esm/data/abilities.mjs +83 -84
- package/build/esm/data/abilities.mjs.map +1 -1
- package/build/esm/data/aliases.mjs +3 -2
- package/build/esm/data/aliases.mjs.map +1 -1
- package/build/esm/data/conditions.mjs +3 -3
- package/build/esm/data/conditions.mjs.map +1 -1
- package/build/esm/data/formats-data.mjs +6 -6
- package/build/esm/data/formats-data.mjs.map +1 -1
- package/build/esm/data/items.mjs +55 -25
- package/build/esm/data/items.mjs.map +1 -1
- package/build/esm/data/legality.mjs +275 -23
- package/build/esm/data/legality.mjs.map +1 -1
- package/build/esm/data/mods/gen1/moves.mjs.map +1 -1
- package/build/esm/data/mods/gen1/scripts.mjs +2 -0
- package/build/esm/data/mods/gen1/scripts.mjs.map +1 -1
- package/build/esm/data/mods/gen3/abilities.mjs +0 -2
- package/build/esm/data/mods/gen3/abilities.mjs.map +1 -1
- package/build/esm/data/mods/gen3/moves.mjs.map +1 -1
- package/build/esm/data/mods/gen4/abilities.mjs +1 -1
- package/build/esm/data/mods/gen4/abilities.mjs.map +1 -1
- package/build/esm/data/mods/gen4/moves.mjs +31 -0
- package/build/esm/data/mods/gen4/moves.mjs.map +1 -1
- package/build/esm/data/mods/gen4/scripts.mjs +26 -0
- package/build/esm/data/mods/gen4/scripts.mjs.map +1 -1
- package/build/esm/data/mods/gen5/formats-data.mjs +1 -1
- package/build/esm/data/mods/gen5/formats-data.mjs.map +1 -1
- package/build/esm/data/mods/gen6/moves.mjs.map +1 -1
- package/build/esm/data/mods/gen8/moves.mjs +1 -1
- package/build/esm/data/mods/gen8/moves.mjs.map +1 -1
- package/build/esm/data/moves.mjs +15 -9
- package/build/esm/data/moves.mjs.map +1 -1
- package/build/esm/data/pokemongo.mjs +1 -1
- package/build/esm/data/text/moves.mjs +1 -1
- package/build/esm/data/text/moves.mjs.map +1 -1
- package/build/esm/lib/utils.d.mts +2 -0
- package/build/esm/lib/utils.mjs +1 -1
- package/build/esm/lib/utils.mjs.map +1 -1
- package/build/esm/sim/battle-actions.mjs +25 -36
- package/build/esm/sim/battle-actions.mjs.map +1 -1
- package/build/esm/sim/battle-queue.d.mts +1 -1
- package/build/esm/sim/battle-queue.mjs +0 -2
- package/build/esm/sim/battle-queue.mjs.map +1 -1
- package/build/esm/sim/battle-stream.mjs +2 -3
- package/build/esm/sim/battle-stream.mjs.map +1 -1
- package/build/esm/sim/battle.d.mts +13 -7
- package/build/esm/sim/battle.mjs +184 -59
- package/build/esm/sim/battle.mjs.map +1 -1
- package/build/esm/sim/dex-abilities.d.mts +0 -1
- package/build/esm/sim/dex-abilities.mjs +1 -1
- package/build/esm/sim/dex-abilities.mjs.map +1 -1
- package/build/esm/sim/dex-conditions.d.mts +11 -3
- package/build/esm/sim/dex-conditions.mjs +1 -1
- package/build/esm/sim/dex-conditions.mjs.map +1 -1
- package/build/esm/sim/dex-data.mjs +1 -1
- package/build/esm/sim/dex-data.mjs.map +1 -1
- package/build/esm/sim/dex-formats.d.mts +2 -1
- package/build/esm/sim/dex-formats.mjs.map +1 -1
- package/build/esm/sim/dex-items.d.mts +3 -1
- package/build/esm/sim/dex-items.mjs +2 -1
- package/build/esm/sim/dex-items.mjs.map +1 -1
- package/build/esm/sim/dex-moves.mjs +1 -1
- package/build/esm/sim/dex-moves.mjs.map +1 -1
- package/build/esm/sim/exported-global-types.d.mts +6 -0
- package/build/esm/sim/field.mjs +9 -9
- package/build/esm/sim/field.mjs.map +1 -1
- package/build/esm/sim/global-types.d.mts +6 -0
- package/build/esm/sim/pokemon.d.mts +8 -4
- package/build/esm/sim/pokemon.mjs +61 -46
- package/build/esm/sim/pokemon.mjs.map +1 -1
- package/build/esm/sim/prng.d.mts +7 -4
- package/build/esm/sim/prng.mjs +34 -16
- package/build/esm/sim/prng.mjs.map +1 -1
- package/build/esm/sim/side.mjs +8 -5
- package/build/esm/sim/side.mjs.map +1 -1
- package/build/esm/sim/team-validator.mjs +10 -11
- package/build/esm/sim/team-validator.mjs.map +1 -1
- package/build/esm/sim/tools/exhaustive-runner.mjs +3 -4
- package/build/esm/sim/tools/exhaustive-runner.mjs.map +1 -1
- package/build/esm/sim/tools/random-player-ai.mjs +1 -1
- package/build/esm/sim/tools/random-player-ai.mjs.map +1 -1
- package/build/esm/sim/tools/runner.mjs +2 -3
- package/build/esm/sim/tools/runner.mjs.map +1 -1
- package/package.json +2 -2
package/build/cjs/sim/field.js
CHANGED
|
@@ -17,9 +17,9 @@ class Field {
|
|
|
17
17
|
Object.assign(this, fieldScripts);
|
|
18
18
|
this.id = '';
|
|
19
19
|
this.weather = '';
|
|
20
|
-
this.weatherState = { id: '' };
|
|
20
|
+
this.weatherState = this.battle.initEffectState({ id: '' });
|
|
21
21
|
this.terrain = '';
|
|
22
|
-
this.terrainState = { id: '' };
|
|
22
|
+
this.terrainState = this.battle.initEffectState({ id: '' });
|
|
23
23
|
this.pseudoWeather = {};
|
|
24
24
|
}
|
|
25
25
|
toJSON() {
|
|
@@ -60,7 +60,7 @@ class Field {
|
|
|
60
60
|
const prevWeather = this.weather;
|
|
61
61
|
const prevWeatherState = this.weatherState;
|
|
62
62
|
this.weather = status.id;
|
|
63
|
-
this.weatherState = { id: status.id };
|
|
63
|
+
this.weatherState = this.battle.initEffectState({ id: status.id });
|
|
64
64
|
if (source) {
|
|
65
65
|
this.weatherState.source = source;
|
|
66
66
|
this.weatherState.sourceSlot = source.getSlot();
|
|
@@ -87,7 +87,7 @@ class Field {
|
|
|
87
87
|
const prevWeather = this.getWeather();
|
|
88
88
|
this.battle.singleEvent('FieldEnd', prevWeather, this.weatherState, this);
|
|
89
89
|
this.weather = '';
|
|
90
|
-
this.weatherState
|
|
90
|
+
this.battle.clearEffectState(this.weatherState);
|
|
91
91
|
this.battle.eachEvent('WeatherChange');
|
|
92
92
|
return true;
|
|
93
93
|
}
|
|
@@ -132,12 +132,12 @@ class Field {
|
|
|
132
132
|
const prevTerrain = this.terrain;
|
|
133
133
|
const prevTerrainState = this.terrainState;
|
|
134
134
|
this.terrain = status.id;
|
|
135
|
-
this.terrainState = {
|
|
135
|
+
this.terrainState = this.battle.initEffectState({
|
|
136
136
|
id: status.id,
|
|
137
137
|
source,
|
|
138
138
|
sourceSlot: source.getSlot(),
|
|
139
139
|
duration: status.duration,
|
|
140
|
-
};
|
|
140
|
+
});
|
|
141
141
|
if (status.durationCallback) {
|
|
142
142
|
this.terrainState.duration = status.durationCallback.call(this.battle, source, source, sourceEffect);
|
|
143
143
|
}
|
|
@@ -155,7 +155,7 @@ class Field {
|
|
|
155
155
|
const prevTerrain = this.getTerrain();
|
|
156
156
|
this.battle.singleEvent('FieldEnd', prevTerrain, this.terrainState, this);
|
|
157
157
|
this.terrain = '';
|
|
158
|
-
this.terrainState
|
|
158
|
+
this.battle.clearEffectState(this.terrainState);
|
|
159
159
|
this.battle.eachEvent('TerrainChange');
|
|
160
160
|
return true;
|
|
161
161
|
}
|
|
@@ -186,12 +186,12 @@ class Field {
|
|
|
186
186
|
return false;
|
|
187
187
|
return this.battle.singleEvent('FieldRestart', status, state, this, source, sourceEffect);
|
|
188
188
|
}
|
|
189
|
-
state = this.pseudoWeather[status.id] = {
|
|
189
|
+
state = this.pseudoWeather[status.id] = this.battle.initEffectState({
|
|
190
190
|
id: status.id,
|
|
191
191
|
source,
|
|
192
192
|
sourceSlot: source?.getSlot(),
|
|
193
193
|
duration: status.duration,
|
|
194
|
-
};
|
|
194
|
+
});
|
|
195
195
|
if (status.durationCallback) {
|
|
196
196
|
if (!source)
|
|
197
197
|
throw new Error(`setting fieldcond without a source`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../../sim/field.ts"],"names":[],"mappings":";;;AAUA;;;;;GAKG;AAEH,mCAA8B;AAE9B,+BAA2B;AAE3B,MAAa,KAAK;IAUjB,YAAY,MAAc;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACpF,IAAI,YAAY;YAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACpD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAEb,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,EAAC,EAAE,EAAE,EAAE,EAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../../sim/field.ts"],"names":[],"mappings":";;;AAUA;;;;;GAKG;AAEH,mCAA8B;AAE9B,+BAA2B;AAE3B,MAAa,KAAK;IAUjB,YAAY,MAAc;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACpF,IAAI,YAAY;YAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACpD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAEb,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAC,EAAE,EAAE,EAAE,EAAC,CAAC,CAAC;QAC1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AM,CAAC,EAAE,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO;QACN,qBAAqB;QAErB,+CAA+C;QAC9C,IAAY,CAAC,MAAM,GAAG,IAAK,CAAC;IAC9B,CAAC;CACD;AAlOD,sBAkOC"}
|
|
@@ -203,6 +203,8 @@ interface ModdedBattleActions {
|
|
|
203
203
|
getMixedSpecies?: (this: BattleActions, originalName: string, megaName: string, pokemon?: Pokemon) => Species;
|
|
204
204
|
}
|
|
205
205
|
interface ModdedBattleSide {
|
|
206
|
+
inherit?: true;
|
|
207
|
+
allies?: (this: Side, all?: boolean) => Pokemon[];
|
|
206
208
|
canDynamaxNow?: (this: Side) => boolean;
|
|
207
209
|
chooseSwitch?: (this: Side, slotText?: string) => any;
|
|
208
210
|
getChoice?: (this: Side) => string;
|
|
@@ -277,9 +279,11 @@ interface ModdedBattlePokemon {
|
|
|
277
279
|
hasLinkedMove?: (this: Pokemon, moveid: string) => boolean;
|
|
278
280
|
}
|
|
279
281
|
interface ModdedBattleQueue extends Partial<BattleQueue> {
|
|
282
|
+
inherit?: true;
|
|
280
283
|
resolveAction?: (this: BattleQueue, action: ActionChoice, midTurn?: boolean) => Action[];
|
|
281
284
|
}
|
|
282
285
|
interface ModdedField extends Partial<Field> {
|
|
286
|
+
inherit?: true;
|
|
283
287
|
suppressingWeather?: (this: Field) => boolean;
|
|
284
288
|
}
|
|
285
289
|
interface ModdedBattleScriptsData extends Partial<BattleScriptsData> {
|
|
@@ -306,6 +310,8 @@ interface ModdedBattleScriptsData extends Partial<BattleScriptsData> {
|
|
|
306
310
|
tiebreak?: (this: Battle) => boolean;
|
|
307
311
|
checkMoveMakesContact?: (this: Battle, move: ActiveMove, attacker: Pokemon, defender: Pokemon, announcePads?: boolean) => boolean;
|
|
308
312
|
checkWin?: (this: Battle, faintQueue?: Battle['faintQueue'][0]) => true | undefined;
|
|
313
|
+
fieldEvent?: (this: Battle, eventid: string, targets?: Pokemon[]) => void;
|
|
314
|
+
getAllActive?: (this: Battle, includeFainted?: boolean, includeCommanding?: boolean) => Pokemon[];
|
|
309
315
|
}
|
|
310
316
|
type TypeInfo = import('./dex-data').TypeInfo;
|
|
311
317
|
interface PlayerOptions {
|
|
@@ -20,7 +20,9 @@ interface Attacker {
|
|
|
20
20
|
damageValue?: (number | boolean | undefined);
|
|
21
21
|
}
|
|
22
22
|
export interface EffectState {
|
|
23
|
-
|
|
23
|
+
id: string;
|
|
24
|
+
effectOrder: number;
|
|
25
|
+
duration?: number;
|
|
24
26
|
[k: string]: any;
|
|
25
27
|
}
|
|
26
28
|
export declare const RESTORATIVE_BERRIES: Set<ID>;
|
|
@@ -101,6 +103,8 @@ export declare class Pokemon {
|
|
|
101
103
|
fainted: boolean;
|
|
102
104
|
faintQueued: boolean;
|
|
103
105
|
subFainted: boolean | null;
|
|
106
|
+
/** If this Pokemon should revert to its set species when it faints */
|
|
107
|
+
regressionForme: boolean;
|
|
104
108
|
types: string[];
|
|
105
109
|
addedType: string;
|
|
106
110
|
knownType: boolean;
|
|
@@ -213,7 +217,6 @@ export declare class Pokemon {
|
|
|
213
217
|
duringMove: boolean;
|
|
214
218
|
weighthg: number;
|
|
215
219
|
speed: number;
|
|
216
|
-
abilityOrder: number;
|
|
217
220
|
canMegaEvo: string | null | undefined;
|
|
218
221
|
canMegaEvoX: string | null | undefined;
|
|
219
222
|
canMegaEvoY: string | null | undefined;
|
|
@@ -250,7 +253,8 @@ export declare class Pokemon {
|
|
|
250
253
|
get baseMoves(): readonly string[];
|
|
251
254
|
getSlot(): PokemonSlot;
|
|
252
255
|
toString(): string;
|
|
253
|
-
|
|
256
|
+
getUpdatedDetails(level?: number): string;
|
|
257
|
+
getFullDetails: () => {
|
|
254
258
|
side: SideID;
|
|
255
259
|
secret: string;
|
|
256
260
|
shared: string;
|
|
@@ -348,7 +352,7 @@ export declare class Pokemon {
|
|
|
348
352
|
/**
|
|
349
353
|
* Changes this Pokemon's species to the given speciesId (or species).
|
|
350
354
|
* This function only handles changes to stats and type.
|
|
351
|
-
* Use
|
|
355
|
+
* Use formeChange to handle changes to ability and sending client messages.
|
|
352
356
|
*/
|
|
353
357
|
setSpecies(rawSpecies: Species, source?: Effect | null, isTransform?: boolean): any;
|
|
354
358
|
/**
|
package/build/cjs/sim/pokemon.js
CHANGED
|
@@ -16,17 +16,11 @@ exports.RESTORATIVE_BERRIES = new Set([
|
|
|
16
16
|
]);
|
|
17
17
|
class Pokemon {
|
|
18
18
|
constructor(set, side) {
|
|
19
|
-
this.
|
|
19
|
+
this.getFullDetails = () => {
|
|
20
20
|
const health = this.getHealth();
|
|
21
21
|
let details = this.details;
|
|
22
22
|
if (this.illusion) {
|
|
23
|
-
|
|
24
|
-
let displayedSpeciesName = this.illusion.species.name;
|
|
25
|
-
if (displayedSpeciesName === 'Greninja-Bond')
|
|
26
|
-
displayedSpeciesName = 'Greninja';
|
|
27
|
-
const illusionDetails = displayedSpeciesName + (level === 100 ? '' : ', L' + level) +
|
|
28
|
-
(this.illusion.gender === '' ? '' : ', ' + this.illusion.gender) + (this.illusion.set.shiny ? ', shiny' : '');
|
|
29
|
-
details = illusionDetails;
|
|
23
|
+
details = this.illusion.getUpdatedDetails(this.battle.ruleTable.has('illusionlevelmod') ? this.illusion.level : this.level);
|
|
30
24
|
}
|
|
31
25
|
if (this.terastallized)
|
|
32
26
|
details += `, tera:${this.terastallized}`;
|
|
@@ -83,7 +77,7 @@ class Pokemon {
|
|
|
83
77
|
if (set.name === set.species || !set.name) {
|
|
84
78
|
set.name = this.baseSpecies.baseSpecies;
|
|
85
79
|
}
|
|
86
|
-
this.speciesState = { id: this.species.id };
|
|
80
|
+
this.speciesState = this.battle.initEffectState({ id: this.species.id });
|
|
87
81
|
this.name = set.name.substr(0, 20);
|
|
88
82
|
this.fullname = this.side.id + ': ' + this.name;
|
|
89
83
|
set.level = this.battle.clampIntRange(set.adjustLevel || set.level || 100, 1, 9999);
|
|
@@ -125,13 +119,9 @@ class Pokemon {
|
|
|
125
119
|
});
|
|
126
120
|
}
|
|
127
121
|
this.position = 0;
|
|
128
|
-
|
|
129
|
-
if (displayedSpeciesName === 'Greninja-Bond')
|
|
130
|
-
displayedSpeciesName = 'Greninja';
|
|
131
|
-
this.details = displayedSpeciesName + (this.level === 100 ? '' : ', L' + this.level) +
|
|
132
|
-
(this.gender === '' ? '' : ', ' + this.gender) + (this.set.shiny ? ', shiny' : '');
|
|
122
|
+
this.details = this.getUpdatedDetails();
|
|
133
123
|
this.status = '';
|
|
134
|
-
this.statusState = {};
|
|
124
|
+
this.statusState = this.battle.initEffectState({});
|
|
135
125
|
this.volatiles = {};
|
|
136
126
|
this.showCure = undefined;
|
|
137
127
|
if (!this.set.evs) {
|
|
@@ -171,9 +161,9 @@ class Pokemon {
|
|
|
171
161
|
this.boosts = { atk: 0, def: 0, spa: 0, spd: 0, spe: 0, accuracy: 0, evasion: 0 };
|
|
172
162
|
this.baseAbility = (0, dex_1.toID)(set.ability);
|
|
173
163
|
this.ability = this.baseAbility;
|
|
174
|
-
this.abilityState = { id: this.ability };
|
|
164
|
+
this.abilityState = this.battle.initEffectState({ id: this.ability, target: this });
|
|
175
165
|
this.item = (0, dex_1.toID)(set.item);
|
|
176
|
-
this.itemState = { id: this.item };
|
|
166
|
+
this.itemState = this.battle.initEffectState({ id: this.item, target: this });
|
|
177
167
|
this.lastItem = '';
|
|
178
168
|
this.usedItemThisTurn = false;
|
|
179
169
|
this.ateBerry = false;
|
|
@@ -185,6 +175,7 @@ class Pokemon {
|
|
|
185
175
|
this.fainted = false;
|
|
186
176
|
this.faintQueued = false;
|
|
187
177
|
this.subFainted = null;
|
|
178
|
+
this.regressionForme = false;
|
|
188
179
|
this.types = this.baseSpecies.types;
|
|
189
180
|
this.baseTypes = this.types;
|
|
190
181
|
this.addedType = '';
|
|
@@ -224,12 +215,6 @@ class Pokemon {
|
|
|
224
215
|
this.duringMove = false;
|
|
225
216
|
this.weighthg = 1;
|
|
226
217
|
this.speed = 0;
|
|
227
|
-
/**
|
|
228
|
-
* Determines the order in which redirect abilities like Lightning Rod
|
|
229
|
-
* activate if speed tied. Surprisingly not random like every other speed
|
|
230
|
-
* tie, but based on who first switched in or acquired the ability!
|
|
231
|
-
*/
|
|
232
|
-
this.abilityOrder = 0;
|
|
233
218
|
this.canMegaEvo = this.battle.actions.canMegaEvo(this);
|
|
234
219
|
this.canMegaEvoX = this.battle.actions.canMegaEvoX?.(this);
|
|
235
220
|
this.canMegaEvoY = this.battle.actions.canMegaEvoY?.(this);
|
|
@@ -264,6 +249,13 @@ class Pokemon {
|
|
|
264
249
|
const fullname = (this.illusion) ? this.illusion.fullname : this.fullname;
|
|
265
250
|
return this.isActive ? this.getSlot() + fullname.slice(2) : fullname;
|
|
266
251
|
}
|
|
252
|
+
getUpdatedDetails(level = this.level) {
|
|
253
|
+
let name = this.species.name;
|
|
254
|
+
if (name === 'Greninja-Bond')
|
|
255
|
+
name = 'Greninja';
|
|
256
|
+
return name + (level === 100 ? '' : ', L' + level) +
|
|
257
|
+
(this.gender === '' ? '' : ', ' + this.gender) + (this.set.shiny ? ', shiny' : '');
|
|
258
|
+
}
|
|
267
259
|
updateSpeed() {
|
|
268
260
|
this.speed = this.getActionSpeed();
|
|
269
261
|
}
|
|
@@ -570,7 +562,7 @@ class Pokemon {
|
|
|
570
562
|
return false;
|
|
571
563
|
}
|
|
572
564
|
ignoringItem() {
|
|
573
|
-
return !!(this.itemState.knockedOff || // Gen 3-4
|
|
565
|
+
return !this.getItem().isPrimalOrb && !!(this.itemState.knockedOff || // Gen 3-4
|
|
574
566
|
(this.battle.gen >= 5 && !this.isActive) ||
|
|
575
567
|
(!this.getItem().ignoreKlutz && this.hasAbility('klutz')) ||
|
|
576
568
|
this.volatiles['embargo'] || this.battle.field.pseudoWeather['magicroom']);
|
|
@@ -910,7 +902,7 @@ class Pokemon {
|
|
|
910
902
|
if (this.battle.dex.conditions.getByID(i).noCopy)
|
|
911
903
|
continue;
|
|
912
904
|
// shallow clones
|
|
913
|
-
this.volatiles[i] = { ...pokemon.volatiles[i] };
|
|
905
|
+
this.volatiles[i] = this.battle.initEffectState({ ...pokemon.volatiles[i] });
|
|
914
906
|
if (this.volatiles[i].linkedPokemon) {
|
|
915
907
|
delete pokemon.volatiles[i].linkedPokemon;
|
|
916
908
|
delete pokemon.volatiles[i].linkedStatus;
|
|
@@ -1027,16 +1019,14 @@ class Pokemon {
|
|
|
1027
1019
|
}
|
|
1028
1020
|
// Pokemon transformed into Ogerpon cannot Terastallize
|
|
1029
1021
|
// restoring their ability to tera after they untransform is handled ELSEWHERE
|
|
1030
|
-
if (this.species.baseSpecies
|
|
1031
|
-
this.canTerastallize = false;
|
|
1032
|
-
if (this.species.baseSpecies === 'Terapagos' && this.canTerastallize)
|
|
1022
|
+
if (['Ogerpon', 'Terapagos'].includes(this.species.baseSpecies) && this.canTerastallize)
|
|
1033
1023
|
this.canTerastallize = false;
|
|
1034
1024
|
return true;
|
|
1035
1025
|
}
|
|
1036
1026
|
/**
|
|
1037
1027
|
* Changes this Pokemon's species to the given speciesId (or species).
|
|
1038
1028
|
* This function only handles changes to stats and type.
|
|
1039
|
-
* Use
|
|
1029
|
+
* Use formeChange to handle changes to ability and sending client messages.
|
|
1040
1030
|
*/
|
|
1041
1031
|
setSpecies(rawSpecies, source = this.battle.effect, isTransform = false) {
|
|
1042
1032
|
const species = this.battle.runEvent('ModifySpecies', this, null, source, rawSpecies);
|
|
@@ -1089,9 +1079,10 @@ class Pokemon {
|
|
|
1089
1079
|
// The species the opponent sees
|
|
1090
1080
|
const apparentSpecies = this.illusion ? this.illusion.species.name : species.baseSpecies;
|
|
1091
1081
|
if (isPermanent) {
|
|
1082
|
+
if (!this.transformed)
|
|
1083
|
+
this.regressionForme = true;
|
|
1092
1084
|
this.baseSpecies = rawSpecies;
|
|
1093
|
-
this.details =
|
|
1094
|
-
(this.gender === '' ? '' : ', ' + this.gender) + (this.set.shiny ? ', shiny' : '');
|
|
1085
|
+
this.details = this.getUpdatedDetails();
|
|
1095
1086
|
let details = (this.illusion || this).details;
|
|
1096
1087
|
if (this.terastallized)
|
|
1097
1088
|
details += `, tera:${this.terastallized}`;
|
|
@@ -1106,7 +1097,7 @@ class Pokemon {
|
|
|
1106
1097
|
this.battle.add('-burst', this, apparentSpecies, species.requiredItem);
|
|
1107
1098
|
this.moveThisTurnResult = true; // Ultra Burst counts as an action for Truant
|
|
1108
1099
|
}
|
|
1109
|
-
else if (source.
|
|
1100
|
+
else if (source.isPrimalOrb) {
|
|
1110
1101
|
if (this.illusion) {
|
|
1111
1102
|
this.ability = '';
|
|
1112
1103
|
this.battle.add('-primal', this.illusion, species.requiredItem);
|
|
@@ -1203,6 +1194,8 @@ class Pokemon {
|
|
|
1203
1194
|
this.newlySwitched = true;
|
|
1204
1195
|
this.beingCalledBack = false;
|
|
1205
1196
|
this.volatileStaleness = undefined;
|
|
1197
|
+
delete this.abilityState.started;
|
|
1198
|
+
delete this.itemState.started;
|
|
1206
1199
|
this.setSpecies(this.baseSpecies);
|
|
1207
1200
|
}
|
|
1208
1201
|
hasType(type) {
|
|
@@ -1373,7 +1366,7 @@ class Pokemon {
|
|
|
1373
1366
|
}
|
|
1374
1367
|
}
|
|
1375
1368
|
this.status = status.id;
|
|
1376
|
-
this.statusState = { id: status.id, target: this };
|
|
1369
|
+
this.statusState = this.battle.initEffectState({ id: status.id, target: this });
|
|
1377
1370
|
if (source)
|
|
1378
1371
|
this.statusState.source = source;
|
|
1379
1372
|
if (status.duration)
|
|
@@ -1418,6 +1411,10 @@ class Pokemon {
|
|
|
1418
1411
|
if (!source && this.battle.event && this.battle.event.target)
|
|
1419
1412
|
source = this.battle.event.target;
|
|
1420
1413
|
const item = this.getItem();
|
|
1414
|
+
if (sourceEffect?.effectType === 'Item' && this.item !== sourceEffect.id && source === this) {
|
|
1415
|
+
// if an item is telling us to eat it but we aren't holding it, we probably shouldn't eat what we are holding
|
|
1416
|
+
return false;
|
|
1417
|
+
}
|
|
1421
1418
|
if (this.battle.runEvent('UseItem', this, null, null, item) &&
|
|
1422
1419
|
(force || this.battle.runEvent('TryEatItem', this, null, null, item))) {
|
|
1423
1420
|
this.battle.add('-enditem', this, item, '[eat]');
|
|
@@ -1437,7 +1434,7 @@ class Pokemon {
|
|
|
1437
1434
|
}
|
|
1438
1435
|
this.lastItem = this.item;
|
|
1439
1436
|
this.item = '';
|
|
1440
|
-
this.itemState
|
|
1437
|
+
this.battle.clearEffectState(this.itemState);
|
|
1441
1438
|
this.usedItemThisTurn = true;
|
|
1442
1439
|
this.ateBerry = true;
|
|
1443
1440
|
this.battle.runEvent('AfterUseItem', this, null, null, item);
|
|
@@ -1455,6 +1452,10 @@ class Pokemon {
|
|
|
1455
1452
|
if (!source && this.battle.event && this.battle.event.target)
|
|
1456
1453
|
source = this.battle.event.target;
|
|
1457
1454
|
const item = this.getItem();
|
|
1455
|
+
if (sourceEffect?.effectType === 'Item' && this.item !== sourceEffect.id && source === this) {
|
|
1456
|
+
// if an item is telling us to eat it but we aren't holding it, we probably shouldn't eat what we are holding
|
|
1457
|
+
return false;
|
|
1458
|
+
}
|
|
1458
1459
|
if (this.battle.runEvent('UseItem', this, null, null, item)) {
|
|
1459
1460
|
switch (item.id) {
|
|
1460
1461
|
case 'redcard':
|
|
@@ -1475,7 +1476,7 @@ class Pokemon {
|
|
|
1475
1476
|
this.battle.singleEvent('Use', item, this.itemState, this, source, sourceEffect);
|
|
1476
1477
|
this.lastItem = this.item;
|
|
1477
1478
|
this.item = '';
|
|
1478
|
-
this.itemState
|
|
1479
|
+
this.battle.clearEffectState(this.itemState);
|
|
1479
1480
|
this.usedItemThisTurn = true;
|
|
1480
1481
|
this.battle.runEvent('AfterUseItem', this, null, null, item);
|
|
1481
1482
|
return true;
|
|
@@ -1499,7 +1500,7 @@ class Pokemon {
|
|
|
1499
1500
|
if (this.battle.runEvent('TakeItem', this, source, null, item)) {
|
|
1500
1501
|
this.item = '';
|
|
1501
1502
|
const oldItemState = this.itemState;
|
|
1502
|
-
this.itemState
|
|
1503
|
+
this.battle.clearEffectState(this.itemState);
|
|
1503
1504
|
this.pendingStaleness = undefined;
|
|
1504
1505
|
this.battle.singleEvent('End', item, oldItemState, this);
|
|
1505
1506
|
this.battle.runEvent('AfterTakeItem', this, null, null, item);
|
|
@@ -1526,7 +1527,7 @@ class Pokemon {
|
|
|
1526
1527
|
const oldItem = this.getItem();
|
|
1527
1528
|
const oldItemState = this.itemState;
|
|
1528
1529
|
this.item = item.id;
|
|
1529
|
-
this.itemState = { id: item.id, target: this };
|
|
1530
|
+
this.itemState = this.battle.initEffectState({ id: item.id, target: this });
|
|
1530
1531
|
if (oldItem.exists)
|
|
1531
1532
|
this.battle.singleEvent('End', oldItem, oldItemState, this);
|
|
1532
1533
|
if (item.id) {
|
|
@@ -1572,12 +1573,11 @@ class Pokemon {
|
|
|
1572
1573
|
this.battle.dex.moves.get(this.battle.effect.id));
|
|
1573
1574
|
}
|
|
1574
1575
|
this.ability = ability.id;
|
|
1575
|
-
this.abilityState = { id: ability.id, target: this };
|
|
1576
|
+
this.abilityState = this.battle.initEffectState({ id: ability.id, target: this });
|
|
1576
1577
|
if (ability.id && this.battle.gen > 3 &&
|
|
1577
1578
|
(!isTransform || oldAbility !== ability.id || this.battle.gen <= 4)) {
|
|
1578
1579
|
this.battle.singleEvent('Start', ability, this.abilityState, this, source);
|
|
1579
1580
|
}
|
|
1580
|
-
this.abilityOrder = this.battle.abilityOrder++;
|
|
1581
1581
|
return oldAbility;
|
|
1582
1582
|
}
|
|
1583
1583
|
getAbility() {
|
|
@@ -1632,7 +1632,7 @@ class Pokemon {
|
|
|
1632
1632
|
this.battle.debug('add volatile [' + status.id + '] interrupted');
|
|
1633
1633
|
return result;
|
|
1634
1634
|
}
|
|
1635
|
-
this.volatiles[status.id] = { id: status.id, name: status.name, target: this };
|
|
1635
|
+
this.volatiles[status.id] = this.battle.initEffectState({ id: status.id, name: status.name, target: this });
|
|
1636
1636
|
if (source) {
|
|
1637
1637
|
this.volatiles[status.id].source = source;
|
|
1638
1638
|
this.volatiles[status.id].sourceSlot = source.getSlot();
|
|
@@ -1798,13 +1798,28 @@ class Pokemon {
|
|
|
1798
1798
|
return weather;
|
|
1799
1799
|
}
|
|
1800
1800
|
runEffectiveness(move) {
|
|
1801
|
-
if (this.terastallized && move.type === 'Stellar')
|
|
1802
|
-
return 1;
|
|
1803
1801
|
let totalTypeMod = 0;
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1802
|
+
if (this.terastallized && move.type === 'Stellar') {
|
|
1803
|
+
totalTypeMod = 1;
|
|
1804
|
+
}
|
|
1805
|
+
else {
|
|
1806
|
+
for (const type of this.getTypes()) {
|
|
1807
|
+
let typeMod = this.battle.dex.getEffectiveness(move, type);
|
|
1808
|
+
typeMod = this.battle.singleEvent('Effectiveness', move, null, this, type, move, typeMod);
|
|
1809
|
+
totalTypeMod += this.battle.runEvent('Effectiveness', this, type, move, typeMod);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
if (this.species.name === 'Terapagos-Terastal' && this.hasAbility('Tera Shell') &&
|
|
1813
|
+
!this.battle.suppressingAbility(this)) {
|
|
1814
|
+
if (this.abilityState.resisted)
|
|
1815
|
+
return -1; // all hits of multi-hit move should be not very effective
|
|
1816
|
+
if (move.category === 'Status' || move.id === 'struggle' || !this.runImmunity(move.type) ||
|
|
1817
|
+
totalTypeMod < 0 || this.hp < this.maxhp) {
|
|
1818
|
+
return totalTypeMod;
|
|
1819
|
+
}
|
|
1820
|
+
this.battle.add('-activate', this, 'ability: Tera Shell');
|
|
1821
|
+
this.abilityState.resisted = true;
|
|
1822
|
+
return -1;
|
|
1808
1823
|
}
|
|
1809
1824
|
return totalTypeMod;
|
|
1810
1825
|
}
|