@pkmn/sim 0.6.3 → 0.6.4
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/config/formats.js +5 -4
- package/build/config/formats.js.map +1 -1
- package/build/data/abilities.js +1 -1
- package/build/data/abilities.js.map +1 -1
- package/build/data/formats-data.js +3 -3
- package/build/data/formats-data.js.map +1 -1
- package/build/data/mods/gen1/moves.js +3 -2
- package/build/data/mods/gen1/moves.js.map +1 -1
- package/build/data/mods/gen1/scripts.js +5 -4
- package/build/data/mods/gen1/scripts.js.map +1 -1
- package/build/data/moves.js +8 -6
- package/build/data/moves.js.map +1 -1
- package/build/data/pokedex.js +5 -0
- package/build/data/pokedex.js.map +1 -1
- package/build/sim/battle-queue.js +4 -3
- package/build/sim/battle-queue.js.map +1 -1
- package/build/sim/dex-species.d.ts +2 -0
- package/build/sim/dex-species.js.map +1 -1
- package/build/sim/team-validator.js +4 -0
- package/build/sim/team-validator.js.map +1 -1
- package/config/formats.ts +5 -4
- package/data/abilities.ts +1 -1
- package/data/formats-data.ts +3 -3
- package/data/mods/gen1/moves.ts +3 -2
- package/data/mods/gen1/scripts.ts +4 -4
- package/data/moves.ts +8 -6
- package/data/pokedex.ts +5 -0
- package/package.json +1 -1
- package/sim/battle-queue.ts +4 -3
- package/sim/dex-species.ts +2 -0
- package/sim/team-validator.ts +5 -0
package/data/mods/gen1/moves.ts
CHANGED
|
@@ -253,7 +253,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
|
|
|
253
253
|
duration: 2,
|
|
254
254
|
onLockMove: 'dig',
|
|
255
255
|
onInvulnerability(target, source, move) {
|
|
256
|
-
if (move.id === 'swift') return true;
|
|
256
|
+
if (move.id === 'swift' || move.id === 'transform') return true;
|
|
257
257
|
this.add('-message', 'The foe ' + target.name + ' can\'t be hit underground!');
|
|
258
258
|
return false;
|
|
259
259
|
},
|
|
@@ -372,7 +372,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
|
|
|
372
372
|
duration: 2,
|
|
373
373
|
onLockMove: 'fly',
|
|
374
374
|
onInvulnerability(target, source, move) {
|
|
375
|
-
if (move.id === 'swift') return true;
|
|
375
|
+
if (move.id === 'swift' || move.id === 'transform') return true;
|
|
376
376
|
this.add('-message', 'The foe ' + target.name + ' can\'t be hit while flying!');
|
|
377
377
|
return false;
|
|
378
378
|
},
|
|
@@ -835,6 +835,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
|
|
|
835
835
|
uncappedDamage = this.runEvent('SubDamage', target, source, move, uncappedDamage);
|
|
836
836
|
if (!uncappedDamage) return uncappedDamage;
|
|
837
837
|
source.lastDamage = uncappedDamage;
|
|
838
|
+
this.lastDamage = uncappedDamage;
|
|
838
839
|
target.volatiles['substitute'].hp -= uncappedDamage > target.volatiles['substitute'].hp ?
|
|
839
840
|
target.volatiles['substitute'].hp : uncappedDamage;
|
|
840
841
|
if (target.volatiles['substitute'].hp <= 0) {
|
|
@@ -242,13 +242,13 @@ export const Scripts: ModdedBattleScriptsData = {
|
|
|
242
242
|
}
|
|
243
243
|
damage = this.tryMoveHit(target, pokemon, move);
|
|
244
244
|
|
|
245
|
-
// Store 0 damage for last damage if move failed
|
|
245
|
+
// Store 0 damage for last damage if move failed.
|
|
246
246
|
// This only happens on moves that don't deal damage but call GetDamageVarsForPlayerAttack (disassembly).
|
|
247
247
|
const neverDamageMoves = [
|
|
248
248
|
'conversion', 'haze', 'mist', 'focusenergy', 'confuseray', 'supersonic', 'transform', 'lightscreen', 'reflect', 'substitute', 'mimic', 'leechseed', 'splash', 'softboiled', 'recover', 'rest',
|
|
249
249
|
];
|
|
250
250
|
if (
|
|
251
|
-
!damage &&
|
|
251
|
+
!damage && damage !== 0 &&
|
|
252
252
|
(move.category !== 'Status' || (move.status && !['psn', 'tox', 'par'].includes(move.status))) &&
|
|
253
253
|
!neverDamageMoves.includes(move.id)
|
|
254
254
|
) {
|
|
@@ -425,7 +425,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|
|
425
425
|
// We get the sub to the target to see if it existed
|
|
426
426
|
const targetSub = (target) ? target.volatiles['substitute'] : false;
|
|
427
427
|
const targetHadSub = (targetSub !== null && targetSub !== false && (typeof targetSub !== 'undefined'));
|
|
428
|
-
let targetHasSub: boolean;
|
|
428
|
+
let targetHasSub: boolean | undefined = undefined;
|
|
429
429
|
|
|
430
430
|
if (target) {
|
|
431
431
|
hitResult = this.battle.singleEvent('TryHit', moveData, {}, target, pokemon, move);
|
|
@@ -588,7 +588,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|
|
588
588
|
return false;
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
|
-
targetHasSub
|
|
591
|
+
if (targetHasSub === undefined) targetHasSub = !!(target?.volatiles['substitute']);
|
|
592
592
|
|
|
593
593
|
// Here's where self effects are applied.
|
|
594
594
|
const doSelf = (targetHadSub && targetHasSub) || !targetHadSub;
|
package/data/moves.ts
CHANGED
|
@@ -11157,9 +11157,10 @@ export const Moves: {[moveid: string]: MoveData} = {
|
|
|
11157
11157
|
priority: 0,
|
|
11158
11158
|
flags: {protect: 1, mirror: 1},
|
|
11159
11159
|
mindBlownRecoil: true,
|
|
11160
|
-
|
|
11161
|
-
|
|
11162
|
-
|
|
11160
|
+
onAfterMoveSecondarySelf(pokemon, target, move) {
|
|
11161
|
+
const maxhp = pokemon.getUndynamaxedHP(pokemon.maxhp);
|
|
11162
|
+
if (pokemon.hp && pokemon.ability === "emergencyexit" && pokemon.getUndynamaxedHP() <= maxhp / 2) {
|
|
11163
|
+
this.runEvent('EmergencyExit', pokemon);
|
|
11163
11164
|
}
|
|
11164
11165
|
},
|
|
11165
11166
|
secondary: null,
|
|
@@ -16768,9 +16769,10 @@ export const Moves: {[moveid: string]: MoveData} = {
|
|
|
16768
16769
|
priority: 0,
|
|
16769
16770
|
flags: {protect: 1, mirror: 1},
|
|
16770
16771
|
mindBlownRecoil: true,
|
|
16771
|
-
|
|
16772
|
-
|
|
16773
|
-
|
|
16772
|
+
onAfterMoveSecondarySelf(pokemon, target, move) {
|
|
16773
|
+
const maxhp = pokemon.getUndynamaxedHP(pokemon.maxhp);
|
|
16774
|
+
if (pokemon.hp && pokemon.ability === "emergencyexit" && pokemon.getUndynamaxedHP() <= maxhp / 2) {
|
|
16775
|
+
this.runEvent('EmergencyExit', pokemon);
|
|
16774
16776
|
}
|
|
16775
16777
|
},
|
|
16776
16778
|
secondary: null,
|
package/data/pokedex.ts
CHANGED
|
@@ -820,6 +820,7 @@ export const Pokedex: {[speciesid: string]: SpeciesData} = {
|
|
|
820
820
|
prevo: "Pikachu",
|
|
821
821
|
evoType: "useItem",
|
|
822
822
|
evoItem: "Thunder Stone",
|
|
823
|
+
evoRegion: "Alola",
|
|
823
824
|
eggGroups: ["Field", "Fairy"],
|
|
824
825
|
},
|
|
825
826
|
sandshrew: {
|
|
@@ -2350,6 +2351,7 @@ export const Pokedex: {[speciesid: string]: SpeciesData} = {
|
|
|
2350
2351
|
prevo: "Exeggcute",
|
|
2351
2352
|
evoType: "useItem",
|
|
2352
2353
|
evoItem: "Leaf Stone",
|
|
2354
|
+
evoRegion: "Alola",
|
|
2353
2355
|
eggGroups: ["Grass"],
|
|
2354
2356
|
},
|
|
2355
2357
|
cubone: {
|
|
@@ -2393,6 +2395,7 @@ export const Pokedex: {[speciesid: string]: SpeciesData} = {
|
|
|
2393
2395
|
prevo: "Cubone",
|
|
2394
2396
|
evoLevel: 28,
|
|
2395
2397
|
evoCondition: "at night",
|
|
2398
|
+
evoRegion: "Alola",
|
|
2396
2399
|
eggGroups: ["Monster"],
|
|
2397
2400
|
},
|
|
2398
2401
|
marowakalolatotem: {
|
|
@@ -2490,6 +2493,7 @@ export const Pokedex: {[speciesid: string]: SpeciesData} = {
|
|
|
2490
2493
|
color: "Gray",
|
|
2491
2494
|
prevo: "Koffing",
|
|
2492
2495
|
evoLevel: 35,
|
|
2496
|
+
evoRegion: "Galar",
|
|
2493
2497
|
eggGroups: ["Amorphous"],
|
|
2494
2498
|
},
|
|
2495
2499
|
rhyhorn: {
|
|
@@ -2687,6 +2691,7 @@ export const Pokedex: {[speciesid: string]: SpeciesData} = {
|
|
|
2687
2691
|
prevo: "Mime Jr.",
|
|
2688
2692
|
evoType: "levelMove",
|
|
2689
2693
|
evoMove: "Mimic",
|
|
2694
|
+
evoRegion: "Galar",
|
|
2690
2695
|
evos: ["Mr. Rime"],
|
|
2691
2696
|
eggGroups: ["Human-Like"],
|
|
2692
2697
|
canHatch: true,
|
package/package.json
CHANGED
package/sim/battle-queue.ts
CHANGED
|
@@ -281,9 +281,10 @@ export class BattleQueue {
|
|
|
281
281
|
for (const choice of choices) {
|
|
282
282
|
const resolvedChoices = this.resolveAction(choice);
|
|
283
283
|
this.list.push(...resolvedChoices);
|
|
284
|
-
const resolvedChoice
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
for (const resolvedChoice of resolvedChoices) {
|
|
285
|
+
if (resolvedChoice && resolvedChoice.choice === 'move' && resolvedChoice.move.id !== 'recharge') {
|
|
286
|
+
resolvedChoice.pokemon.side.lastSelectedMove = resolvedChoice.move.id;
|
|
287
|
+
}
|
|
287
288
|
}
|
|
288
289
|
}
|
|
289
290
|
}
|
package/sim/dex-species.ts
CHANGED
|
@@ -148,6 +148,8 @@ export class Species extends BasicEffect implements Readonly<BasicEffect & Speci
|
|
|
148
148
|
declare readonly evoItem?: string;
|
|
149
149
|
/** Evolution move. falsy if doesn't evolve. */
|
|
150
150
|
readonly evoMove?: string;
|
|
151
|
+
/** Region required to be in for evolution. falsy if doesn't evolve. */
|
|
152
|
+
readonly evoRegion?: 'Alola' | 'Galar';
|
|
151
153
|
/** Evolution level. falsy if doesn't evolve. */
|
|
152
154
|
readonly evoLevel?: number;
|
|
153
155
|
/** Is NFE? True if this Pokemon can evolve (Mega evolution doesn't count). */
|
package/sim/team-validator.ts
CHANGED
|
@@ -2060,6 +2060,11 @@ export class TeamValidator {
|
|
|
2060
2060
|
// redundant
|
|
2061
2061
|
if (learnedGen <= moveSources.sourcesBefore) continue;
|
|
2062
2062
|
|
|
2063
|
+
if (baseSpecies.evoRegion === 'Alola' && checkingPrevo && learnedGen >= 8) {
|
|
2064
|
+
cantLearnReason = `is from a ${species.name} that can't be transferred to USUM to evolve into ${baseSpecies.name}.`;
|
|
2065
|
+
continue;
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2063
2068
|
const canUseAbilityPatch = dex.gen >= 8 && format.mod !== 'gen8dlc1';
|
|
2064
2069
|
if (
|
|
2065
2070
|
learnedGen < 7 && setSources.isHidden && !canUseAbilityPatch &&
|