@pkmn/sim 0.5.13 → 0.5.16
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 +151 -145
- package/build/config/formats.js.map +1 -1
- package/build/data/aliases.js +2 -2
- package/build/data/aliases.js.map +1 -1
- package/build/data/conditions.js +4 -1
- package/build/data/conditions.js.map +1 -1
- package/build/data/formats-data.js +3 -3
- package/build/data/formats-data.js.map +1 -1
- package/build/data/items.js +4 -2
- package/build/data/items.js.map +1 -1
- package/build/data/learnsets.js +5 -4
- package/build/data/learnsets.js.map +1 -1
- package/build/data/mods/gen1/formats-data.js +32 -32
- package/build/data/mods/gen1/formats-data.js.map +1 -1
- package/build/data/mods/gen1/scripts.js +1 -1
- package/build/data/mods/gen1/scripts.js.map +1 -1
- package/build/data/mods/gen2/items.js +28 -0
- package/build/data/mods/gen2/items.js.map +1 -1
- package/build/data/mods/gen2/moves.js +2 -5
- package/build/data/mods/gen2/moves.js.map +1 -1
- package/build/data/mods/gen3/items.js +28 -0
- package/build/data/mods/gen3/items.js.map +1 -1
- package/build/data/mods/gen3/moves.js +0 -3
- package/build/data/mods/gen3/moves.js.map +1 -1
- package/build/data/mods/gen4/abilities.js +20 -0
- package/build/data/mods/gen4/abilities.js.map +1 -1
- package/build/data/mods/gen4/items.js +28 -0
- package/build/data/mods/gen4/items.js.map +1 -1
- package/build/data/mods/gen4/moves.js +16 -9
- package/build/data/mods/gen4/moves.js.map +1 -1
- package/build/data/mods/gen5/items.js +0 -4
- package/build/data/mods/gen5/items.js.map +1 -1
- package/build/data/mods/gen6/items.js +24 -0
- package/build/data/mods/gen6/items.js.map +1 -1
- package/build/data/mods/gen7/abilities.js +31 -0
- package/build/data/mods/gen7/abilities.js.map +1 -1
- package/build/data/mods/gen7/items.js +12 -0
- package/build/data/mods/gen7/items.js.map +1 -1
- package/build/data/mods/gen7/moves.js +14 -0
- package/build/data/mods/gen7/moves.js.map +1 -1
- package/build/data/moves.js +45 -20
- package/build/data/moves.js.map +1 -1
- package/build/data/rulesets.js +71 -0
- package/build/data/rulesets.js.map +1 -1
- package/build/data/tags.js +3 -3
- package/build/data/tags.js.map +1 -1
- package/build/data/text/moves.js +8 -8
- package/build/data/text/moves.js.map +1 -1
- package/build/sim/battle-actions.js +3 -3
- package/build/sim/battle-actions.js.map +1 -1
- package/build/sim/battle-queue.d.ts +2 -2
- package/build/sim/battle-queue.js +8 -0
- package/build/sim/battle-queue.js.map +1 -1
- package/build/sim/battle.js +46 -6
- package/build/sim/battle.js.map +1 -1
- package/build/sim/dex-conditions.d.ts +2 -2
- package/build/sim/dex-conditions.js.map +1 -1
- package/build/sim/dex-data.js +0 -1
- package/build/sim/dex-data.js.map +1 -1
- package/build/sim/dex-moves.d.ts +2 -1
- package/build/sim/dex-moves.js.map +1 -1
- package/build/sim/pokemon.js +18 -5
- package/build/sim/pokemon.js.map +1 -1
- package/build/sim/team-validator.js +1 -1
- package/build/sim/team-validator.js.map +1 -1
- package/config/formats.ts +156 -150
- package/data/aliases.ts +2 -2
- package/data/conditions.ts +4 -1
- package/data/formats-data.ts +3 -3
- package/data/items.ts +4 -2
- package/data/learnsets.ts +5 -4
- package/data/mods/gen1/formats-data.ts +32 -32
- package/data/mods/gen1/scripts.ts +1 -1
- package/data/mods/gen2/items.ts +28 -0
- package/data/mods/gen2/moves.ts +2 -5
- package/data/mods/gen3/items.ts +28 -0
- package/data/mods/gen3/moves.ts +0 -3
- package/data/mods/gen4/abilities.ts +20 -0
- package/data/mods/gen4/items.ts +28 -0
- package/data/mods/gen4/moves.ts +15 -10
- package/data/mods/gen5/items.ts +0 -4
- package/data/mods/gen6/items.ts +24 -0
- package/data/mods/gen7/abilities.ts +31 -0
- package/data/mods/gen7/items.ts +12 -0
- package/data/mods/gen7/moves.ts +14 -0
- package/data/moves.ts +45 -19
- package/data/rulesets.ts +70 -0
- package/data/tags.ts +3 -3
- package/data/text/moves.ts +8 -8
- package/package.json +2 -2
- package/sim/battle-actions.ts +3 -4
- package/sim/battle-queue.ts +10 -2
- package/sim/battle.ts +43 -6
- package/sim/dex-conditions.ts +6 -2
- package/sim/dex-data.ts +0 -1
- package/sim/dex-moves.ts +2 -1
- package/sim/pokemon.ts +19 -7
- package/sim/team-validator.ts +1 -1
package/sim/dex-data.ts
CHANGED
|
@@ -117,7 +117,6 @@ export class BasicEffect implements EffectData {
|
|
|
117
117
|
|
|
118
118
|
constructor(data: AnyObject) {
|
|
119
119
|
this.exists = true;
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
121
120
|
Object.assign(this, data);
|
|
122
121
|
|
|
123
122
|
this.name = Utils.getString(data.name).trim();
|
package/sim/dex-moves.ts
CHANGED
|
@@ -105,6 +105,7 @@ export interface MoveEventMethods {
|
|
|
105
105
|
beforeMoveCallback?: (this: Battle, pokemon: Pokemon, target: Pokemon | null, move: ActiveMove) => boolean | void;
|
|
106
106
|
beforeTurnCallback?: (this: Battle, pokemon: Pokemon, target: Pokemon) => void;
|
|
107
107
|
damageCallback?: (this: Battle, pokemon: Pokemon, target: Pokemon) => number | false;
|
|
108
|
+
priorityChargeCallback?: (this: Battle, pokemon: Pokemon) => void;
|
|
108
109
|
|
|
109
110
|
onAfterHit?: CommonHandlers['VoidSourceMove'];
|
|
110
111
|
onAfterSubDamage?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, move: ActiveMove) => void;
|
|
@@ -195,7 +196,7 @@ export interface MoveData extends EffectData, MoveEventMethods, HitEffect {
|
|
|
195
196
|
forceSwitch?: boolean;
|
|
196
197
|
selfSwitch?: string | boolean;
|
|
197
198
|
selfBoost?: {boosts?: SparseBoostsTable};
|
|
198
|
-
selfdestruct?:
|
|
199
|
+
selfdestruct?: 'always' | 'ifHit' | boolean;
|
|
199
200
|
breaksProtect?: boolean;
|
|
200
201
|
/**
|
|
201
202
|
* Note that this is only "true" recoil. Other self-damage, like Struggle,
|
package/sim/pokemon.ts
CHANGED
|
@@ -809,9 +809,12 @@ export class Pokemon {
|
|
|
809
809
|
}
|
|
810
810
|
|
|
811
811
|
ignoringItem() {
|
|
812
|
-
return !!(
|
|
812
|
+
return !!(
|
|
813
|
+
this.itemState.knockedOff || // Gen 3-4
|
|
814
|
+
(this.battle.gen >= 5 && !this.isActive) ||
|
|
813
815
|
(this.hasAbility('klutz') && !this.getItem().ignoreKlutz) ||
|
|
814
|
-
this.volatiles['embargo'] || this.battle.field.pseudoWeather['magicroom']
|
|
816
|
+
this.volatiles['embargo'] || this.battle.field.pseudoWeather['magicroom']
|
|
817
|
+
);
|
|
815
818
|
}
|
|
816
819
|
|
|
817
820
|
deductPP(move: string | Move, amount?: number | null, target?: Pokemon | null | false) {
|
|
@@ -1198,7 +1201,15 @@ export class Pokemon {
|
|
|
1198
1201
|
}
|
|
1199
1202
|
let boostName: BoostID;
|
|
1200
1203
|
for (boostName in pokemon.boosts) {
|
|
1201
|
-
this.boosts[boostName] = pokemon.boosts[boostName]
|
|
1204
|
+
this.boosts[boostName] = pokemon.boosts[boostName];
|
|
1205
|
+
if (this.battle.gen <= 1) {
|
|
1206
|
+
if (boostName === 'evasion' || boostName === 'accuracy') continue;
|
|
1207
|
+
if (this.boosts[boostName] >= 0) {
|
|
1208
|
+
this.modifyStat!(boostName, [1, 1.5, 2, 2.5, 3, 3.5, 4][this.boosts[boostName]]);
|
|
1209
|
+
} else {
|
|
1210
|
+
this.modifyStat!(boostName, [100, 66, 50, 40, 33, 28, 25][-this.boosts[boostName]] / 100);
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1202
1213
|
}
|
|
1203
1214
|
if (this.battle.gen >= 6) {
|
|
1204
1215
|
const volatilesToCopy = ['focusenergy', 'gmaxchistrike', 'laserfocus'];
|
|
@@ -1596,7 +1607,7 @@ export class Pokemon {
|
|
|
1596
1607
|
}
|
|
1597
1608
|
|
|
1598
1609
|
eatItem(force?: boolean, source?: Pokemon, sourceEffect?: Effect) {
|
|
1599
|
-
if (!this.item) return false;
|
|
1610
|
+
if (!this.item || this.itemState.knockedOff) return false;
|
|
1600
1611
|
if ((!this.hp && this.item !== 'jabocaberry' && this.item !== 'rowapberry') || !this.isActive) return false;
|
|
1601
1612
|
|
|
1602
1613
|
if (!sourceEffect && this.battle.effect) sourceEffect = this.battle.effect;
|
|
@@ -1636,7 +1647,7 @@ export class Pokemon {
|
|
|
1636
1647
|
|
|
1637
1648
|
useItem(source?: Pokemon, sourceEffect?: Effect) {
|
|
1638
1649
|
if ((!this.hp && !this.getItem().isGem) || !this.isActive) return false;
|
|
1639
|
-
if (!this.item) return false;
|
|
1650
|
+
if (!this.item || this.itemState.knockedOff) return false;
|
|
1640
1651
|
|
|
1641
1652
|
if (!sourceEffect && this.battle.effect) sourceEffect = this.battle.effect;
|
|
1642
1653
|
if (!source && this.battle.event && this.battle.event.target) source = this.battle.event.target;
|
|
@@ -1672,11 +1683,11 @@ export class Pokemon {
|
|
|
1672
1683
|
|
|
1673
1684
|
takeItem(source?: Pokemon) {
|
|
1674
1685
|
if (!this.isActive) return false;
|
|
1675
|
-
if (!this.item) return false;
|
|
1686
|
+
if (!this.item || this.itemState.knockedOff) return false;
|
|
1676
1687
|
if (!source) source = this;
|
|
1677
1688
|
if (this.battle.gen === 4) {
|
|
1678
1689
|
if (toID(this.ability) === 'multitype') return false;
|
|
1679
|
-
if (
|
|
1690
|
+
if (toID(source.ability) === 'multitype') return false;
|
|
1680
1691
|
}
|
|
1681
1692
|
const item = this.getItem();
|
|
1682
1693
|
if (this.battle.runEvent('TakeItem', this, source, null, item)) {
|
|
@@ -1690,6 +1701,7 @@ export class Pokemon {
|
|
|
1690
1701
|
|
|
1691
1702
|
setItem(item: string | Item, source?: Pokemon, effect?: Effect) {
|
|
1692
1703
|
if (!this.hp || !this.isActive) return false;
|
|
1704
|
+
if (this.itemState.knockedOff) return false;
|
|
1693
1705
|
if (typeof item === 'string') item = this.battle.dex.items.get(item);
|
|
1694
1706
|
|
|
1695
1707
|
const effectid = this.battle.effect ? this.battle.effect.id : '';
|
package/sim/team-validator.ts
CHANGED
|
@@ -1564,7 +1564,7 @@ export class TeamValidator {
|
|
|
1564
1564
|
|
|
1565
1565
|
setHas['ability:' + ability.id] = true;
|
|
1566
1566
|
|
|
1567
|
-
if (this.format.id
|
|
1567
|
+
if (this.format.id.startsWith('gen8pokebilities')) {
|
|
1568
1568
|
const species = dex.species.get(set.species);
|
|
1569
1569
|
const unSeenAbilities = Object.keys(species.abilities)
|
|
1570
1570
|
.filter(key => key !== 'S' && (key !== 'H' || !species.unreleasedHidden))
|