@pkmn/data 0.6.3 → 0.7.0
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/README.md +11 -11
- package/build/index.d.ts +37 -32
- package/build/index.js +568 -633
- package/build/index.js.map +1 -1
- package/build/index.min.js +1 -0
- package/build/index.mjs +582 -0
- package/build/index.mjs.map +1 -0
- package/package.json +13 -14
- package/build/production.min.js +0 -1
- package/build/production.min.js.map +0 -7
- package/build/production.min.js.old +0 -1
- package/index.ts +0 -841
package/package.json
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pkmn/data",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "build/index.js",
|
|
5
|
-
"types": "build/index.d.ts",
|
|
6
|
-
"unpkg": "build/production.min.js",
|
|
3
|
+
"version": "0.7.0",
|
|
7
4
|
"description": "A forked implementation of the Pokémon Showdown client's data layer",
|
|
8
5
|
"repository": "github:pkmn/ps",
|
|
9
6
|
"license": "MIT",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "build/index.js",
|
|
9
|
+
"module": "build/index.mjs",
|
|
10
|
+
"types": "build/index.d.ts",
|
|
11
|
+
"unpkg": "build/index.min.js",
|
|
10
12
|
"publishConfig": {
|
|
11
13
|
"access": "public"
|
|
12
14
|
},
|
|
13
15
|
"files": [
|
|
14
|
-
"build"
|
|
15
|
-
"!build/*.test.*",
|
|
16
|
-
"index.ts"
|
|
16
|
+
"build"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@pkmn/dex-types": "^0.
|
|
19
|
+
"@pkmn/dex-types": "^0.7.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@pkmn/dex": "^0.
|
|
23
|
-
"@pkmn/mods": "^0.
|
|
24
|
-
"@pkmn/sim": "^0.
|
|
25
|
-
"@smogon/calc": "^0.
|
|
22
|
+
"@pkmn/dex": "^0.7.0",
|
|
23
|
+
"@pkmn/mods": "^0.7.0",
|
|
24
|
+
"@pkmn/sim": "^0.7.0",
|
|
25
|
+
"@smogon/calc": "^0.7.0"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"lint": "eslint --cache *.ts",
|
|
29
29
|
"fix": "eslint --fix *.ts",
|
|
30
30
|
"compile": "tsc -p .",
|
|
31
|
-
"
|
|
32
|
-
"build": "npm run compile && npm run bundle",
|
|
31
|
+
"build": "npm run compile && node ../build index.ts --minify",
|
|
33
32
|
"test": "jest",
|
|
34
33
|
"pretest": "npm run build",
|
|
35
34
|
"posttest": "npm run lint"
|
package/build/production.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _this=this;function _defineProperties(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,e,i){return e&&_defineProperties(t.prototype,e),i&&_defineProperties(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}!function(){"use strict";var t={},e=_this&&_this.__await||function(t){return this instanceof e?(this.v=t,this):new e(t)},i=_this&&_this.__asyncGenerator||function(t,i,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s,r=n.apply(t,i||[]),o=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(t){r[t]&&(s[t]=function(e){return new Promise((function(i,n){o.push([t,e,i,n])>1||h(t,e)}))})}function h(t,i){try{(n=r[t](i)).value instanceof e?Promise.resolve(n.value.v).then(c,u):d(o[0][2],n)}catch(t){d(o[0][3],t)}var n}function c(t){h("next",t)}function u(t){h("throw",t)}function d(t,e){t(e),o.shift(),o.length&&h(o[0][0],o[0][1])}},n=_this&&_this.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,i=t[Symbol.asyncIterator];return i?i.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(i){e[i]=t[i]&&function(e){return new Promise((function(n,s){(function(t,e,i,n){Promise.resolve(n).then((function(e){t({value:e,done:i})}),e)})(n,s,(e=t[i](e)).done,e.value)}))}}};t.Stats=t.Learnsets=t.Type=t.Types=t.Natures=t.Conditions=t.Specie=t.Species=t.Moves=t.Items=t.Abilities=t.Generation=t.Generations=t.toID=void 0;var s=function(t){return!!t.exists&&((!("isNonstandard"in t)||!t.isNonstandard)&&(("Ability"!==t.kind||"noability"!==t.id)&&!("tier"in t&&["Illegal","Unreleased"].includes(t.tier))))},r=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e?(t>>>0)%2**e:t>>>0};function o(t,e,i){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&!i.has(n)&&(t[n]=e[n]);return t}function a(t){return(null==t?void 0:t.id)&&(t=t.id),"string"!=typeof t&&"number"!=typeof t?"":(""+t).toLowerCase().replace(/[^a-z0-9]+/g,"")}t.toID=a;var h=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DEFAULT_EXISTS;this.cache=Object.create(null),this.dex=t,this.exists=i}var i=e.prototype;return i.get=function(t){var e=this;if(isNaN(+t))throw new Error("Invalid gen "+t);var i=t;return this.cache[i]?this.cache[i]:this.cache[i]=new c(this.dex.forGen(i),(function(t){return e.exists(t,i)}))},i[t]=function*(){for(var t=1;t<=8;t++)yield this.get(t)},e}(Symbol.iterator);t.Generations=h,h.DEFAULT_EXISTS=s;var c=function(){function t(t,e){this.dex=t,this.exists=e,this.abilities=new u(this.dex,this.exists),this.items=new d(this.dex,this.exists),this.moves=new f(this.dex,this.exists),this.species=new l(this.dex,this.exists),this.natures=new g(this.dex,this.exists),this.types=new x(this.dex,this.exists),this.learnsets=new D(this,this.dex,this.exists),this.conditions=new p(this.dex,this.exists),this.stats=new I(this.dex)}t.get=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s;return new h(t,i).get(e)};var e=t.prototype;return e.toString=function(){return"[Generation:"+this.num+"]"},e.toJSON=function(){return this.toString()},_createClass(t,[{key:"num",get:function(){return this.dex.gen}}]),t}();t.Generation=c;var u=function(t){function e(t,e){this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){var e=this.dex.abilities.get(t);return this.exists(e)?e:void 0},i[t]=function*(){for(var t in this.dex.data.Abilities){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Abilities=u;var d=function(t){function e(t,e){this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){var e=this.dex.items.get(t);return this.exists(e)?e:void 0},i[t]=function*(){for(var t in this.dex.data.Items){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Items=d;var f=function(t){function e(t,e){this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){var e=this.dex.moves.get(t);return this.exists(e)?e:void 0},i[t]=function*(){for(var t in this.dex.data.Moves){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Moves=f;var l=function(t){function e(t,e){this.cache=Object.create(null),this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){var e=this.dex.species.get(t);if(this.exists(e)){var i=e.speciesid||e.id,n=this.cache[i];return n||(this.cache[i]=new v(this.dex,this.exists,e))}},i[t]=function*(){for(var t in this.dex.data.Species){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Species=l;var v=function(){function t(e,i,n){var s,r,a,h,c,u,d,f,l,v=this;o(this,n,t.EXCLUDE),this.dex=e,this.dex.gen>=2?(this.gender=n.gender,this.genderRatio=n.genderRatio):this.genderRatio={M:0,F:0},this.dex.gen>=3?(this.abilities={0:n.abilities[0]},n.abilities[1]&&this.dex.abilities.get(n.abilities[1]).gen<=this.dex.gen&&(this.abilities[1]=n.abilities[1]),this.dex.gen>=5&&n.abilities.H&&(this.abilities.H=n.abilities.H),this.dex.gen>=7&&n.abilities.S&&(this.abilities.S=n.abilities.S)):this.abilities={0:""},this.evos=null===(s=n.evos)||void 0===s?void 0:s.filter((function(t){return i(v.dex.species.get(t))})),this.nfe=!!(null===(r=this.evos)||void 0===r?void 0:r.length),this.nfe||(this.evos=void 0),this.cosmeticFormes=null===(a=n.cosmeticFormes)||void 0===a?void 0:a.filter((function(t){return i(v.dex.species.get(t))})),(null===(h=this.cosmeticFormes)||void 0===h?void 0:h.length)||(this.cosmeticFormes=void 0),this.otherFormes=null===(c=n.otherFormes)||void 0===c?void 0:c.filter((function(t){return i(v.dex.species.get(t))})),(null===(u=this.otherFormes)||void 0===u?void 0:u.length)||(this.otherFormes=void 0),this.formeOrder=null===(d=n.formeOrder)||void 0===d?void 0:d.filter((function(t){return i(v.dex.species.get(t))})),(null===(f=this.formeOrder)||void 0===f?void 0:f.length)||(this.formeOrder=void 0),this.formes=null===(l=this.formeOrder)||void 0===l?void 0:l.filter((function(t){return"Gigantamax"!==v.dex.species.get(t).isNonstandard})),this.prevo=n.prevo&&i(this.dex.species.get(n.prevo))?n.prevo:void 0}var e=t.prototype;return e.toString=function(){return this.name},e.toJSON=function(){return o({},this,new Set(["dex"]))},_createClass(t,[{key:"formeNum",get:function(){var t=this;return this.baseSpecies===this.name?this.formeOrder?this.formeOrder.findIndex((function(e){return e===t.name})):0:this.dex.species.get(this.baseSpecies).formeOrder.findIndex((function(e){return e===("Gigantamax"===t.isNonstandard?t.baseSpecies:t.name)}))}}]),t}();t.Specie=v,v.EXCLUDE=new Set(["abilities","cosmeticFormes","evos","gender","genderRatio","nfe","otherFormes","prevo"]);var p=function(){function t(t,e){this.dex=t,this.exists=e}return t.prototype.get=function(t){var e=this.dex.conditions.get(t);return this.exists(e)?e:void 0},t}();t.Conditions=p;var g=function(t){function e(t,e){this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){if(!(this.dex.gen<3)){var e=this.dex.natures.get(t);return this.exists(e)?e:void 0}},i[t]=function*(){for(var t in this.dex.data.Natures){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Natures=g;var y={"-3":.125,"-2":.25,"-1":.5,0:1,1:2,2:4,3:8},x=function(t){function e(t,e){this.cache=Object.create(null),this.dex=t,this.exists=e,this.unknown=new b({effectType:"Type",kind:"Type",id:"",name:"???",exists:t.gen<=4,gen:1,damageTaken:{},HPivs:{},HPdvs:{}},t,this)}var i=e.prototype;return i.get=function(t){if("???"===t)return this.unknown;var e=this.dex.types.get(t);if(this.exists(e)){var i=this.cache[e.id];return i||(this.cache[e.id]=new b(e,this.dex,this))}},i[t]=function*(){for(var t in this.dex.data.Types){var e=this.get(t);e&&(yield e)}this.dex.gen>=2&&this.dex.gen<=4&&(yield this.unknown)},i.getHiddenPower=function(t){return this.dex.getHiddenPower(t)},i.canDamage=function(t,e){return this.dex.getImmunity(t,e)},i.totalEffectiveness=function(t,e){if(!this.canDamage(t,e))return 0;var i=""+this.dex.getEffectiveness(t,e);return y[i]},e}(Symbol.iterator);t.Types=x;var m=[1,2,.5,0],S=["Fire","Water","Grass","Electric","Ice","Psychic","Dark","Dragon"],b=function(){function t(t,e,i){for(var n in Object.assign(this,t),this.types=i,this.category="Fairy"===this.name?void 0:S.includes(this.name)?"Special":"Physical",this.effectiveness={"???":1},e.data.Types){var s=n.charAt(0).toUpperCase()+n.slice(1);this.effectiveness[s]=m[e.data.Types[n].damageTaken[this.name]||0]}}var e=t.prototype;return e.canDamage=function(t){return this.types.canDamage(this.name,t)},e.totalEffectiveness=function(t){return this.types.totalEffectiveness(this.name,t)},e.toString=function(){return this.name},e.toJSON=function(){return o({},this,new Set(["types"]))},t}();t.Type=b;var w=new Set(["cut","fly","surf","strength","flash","rocksmash","waterfall","dive"]),k=new Set(["cut","fly","surf","strength","rocksmash","waterfall","rockclimb"]),D=function(t){function s(t,e,i){this.cache=Object.create(null),this.gen=t,this.dex=e,this.exists=i}var r=s.prototype;return r.get=async function(t){var e=await this.dex.learnsets.get(a(t));return this.exists(e)?e:void 0},r[t]=function(){return i(this,arguments,(function*(){for(var t in this.dex.data.Learnsets||(yield e(this.dex.learnsets.get("LOAD"))),this.dex.data.Learnsets){var i=yield e(this.get(t));i&&(yield yield e(i))}}))},r.all=function(t){return i(this,arguments,(function*(){var i=t.id,n=yield e(this.get(i));for(n||(i="string"==typeof t.battleOnly&&t.battleOnly!==t.baseSpecies?a(t.battleOnly):a(t.baseSpecies),n=yield e(this.get(i)));n&&(yield yield e(n),i="lycanrocdusk"===i||"rockruff"===t.id&&"rockruff"===i?"rockruffdusk":"gastrodoneast"===t.id?"gastrodon":"pumpkaboosuper"===t.id?"pumpkaboo":a(t.battleOnly||t.changesFrom||t.prevo));){var s=this.gen.species.get(i);if(!s)break;t=s,n=yield e(this.get(i))}}))},r.learnable=async function(t,e){var i,s,r=this,o=this.gen.species.get(t);if(o){if(!e){var a=this.cache[o.id];if(a)return a}var h={};try{for(var c,u=n(this.all(o));!(c=await u.next()).done;){var d=c.value;if(d.learnset)for(var f in d.learnset){var l=this.gen.moves.get(f);if(l){var v=d.learnset[f];if(this.isLegal(l,v,e||this.gen)){var p=v.filter((function(t){return+t.charAt(0)<=r.gen.num}));if(!p.length)continue;if(h[l.id]){var g,y=[];t:for(var x=0;x<p.length;x++){for(var m=p[x],S=m.slice(0,2),b=0,w=h[l.id];b<w.length;b++){if(w[b].startsWith(S))continue t}y.push(m)}(g=h[l.id]).push.apply(g,y)}else h[l.id]=p}}}}}catch(t){i={error:t}}finally{try{c&&!c.done&&(s=u.return)&&await s.call(u)}finally{if(i)throw i.error}}return e||(this.cache[o.id]=h),h}},r.canLearn=async function(t,e,i){var s,r,o,a=this.gen.species.get(t);if(!a)return!1;if("string"==typeof(e="string"==typeof e&&this.gen.moves.get(e)||e))return!1;try{for(var h,c=n(this.all(a));!(h=await c.next()).done;){var u=h.value;if(this.isLegal(e,null===(o=u.learnset)||void 0===o?void 0:o[e.id],i||this.gen))return!0}}catch(t){s={error:t}}finally{try{h&&!h.done&&(r=c.return)&&await r.call(c)}finally{if(s)throw s.error}}return!1},r.isLegal=function(t,e,i){if(e){var n=e.map((function(t){return Number(t[0])})),s=Math.min.apply(Math,n),r=7===s&&e.every((function(t){return"7"!==t[0]||"7V"===t}))||8===s&&e.every((function(t){return"8"!==t[0]||"8V"===t}));if("Pentagon"===i)return n.includes(6);if("Plus"===i)return n.includes(7)&&!r;if("Galar"===i)return n.includes(8)&&!r;if(this.gen.num>=3&&s<=4&&(w.has(t.id)||k.has(t.id))){var o="",a=!1;3===s&&(o+="3",a=!0),a&&(a=!w.has(t.id)),(a||n.includes(4))&&(o+="4",a=!0),a&&(a=!k.has(t.id));var h=a?5:Math.min.apply(Math,n.filter((function(t){return t>4})));return(o+="012345678".slice(h)).includes(""+i.num)}return"012345678".slice(s).includes(""+i.num)}},s}(Symbol.iterator);t.Learnsets=D;var O=["hp","atk","def","spe","spa","spd"],_={HP:"hp",hp:"hp",Attack:"atk",Atk:"atk",atk:"atk",Defense:"def",Def:"def",def:"def","Special Attack":"spa",SpA:"spa",SAtk:"spa",SpAtk:"spa",spa:"spa",Special:"spa",spc:"spa",Spc:"spa","Special Defense":"spd",SpD:"spd",SDef:"spd",SpDef:"spd",spd:"spd",Speed:"spe",Spe:"spe",Spd:"spe",spe:"spe"},P={hp:["HP","HP"],atk:["Atk","Attack"],def:["Def","Defense"],spa:["SpA","Special Attack"],spd:["SpD","Special Defense"],spe:["Spe","Speed"],spc:["Spc","Special"]},I=function(t){function e(t){this.dex=t}var i=e.prototype;return i.calc=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:31,n=arguments.length>3?arguments[3]:void 0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:100,o=arguments.length>5?arguments[5]:void 0;if(void 0===n&&(n=this.dex.gen<3?252:0),this.dex.gen<3&&(i=2*this.toDV(i),o=void 0),"hp"===t)return 1===e?e:r(r(2*e+i+r(n/4)+100)*s/100+10);var a=r(r(2*e+i+r(n/4))*s/100+5);if(void 0!==o){if(o.plus===t)return r(r(110*a,16)/100);if(o.minus===t)return r(r(90*a,16)/100)}return a},i.get=function(t){return _[t]},i.display=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=_[t];return void 0===i?t:(1===this.dex.gen&&"spa"===i&&(i="spc"),P[i][+e])},i.fill=function(t,e){for(var i=0;i<O.length;i++){var n=O[i];n in t||(t[n]=e)}return t},i.getHPDV=function(t){return this.toDV(void 0===t.atk?31:t.atk)%2*8+this.toDV(void 0===t.def?31:t.def)%2*4+this.toDV(void 0===t.spe?31:t.spe)%2*2+this.toDV(void 0===t.spa?31:t.spa)%2},i[t]=function*(){for(var t=0;t<O.length;t++){var e=O[t];yield e}},i.toDV=function(t){return Math.floor(t/2)},i.toIV=function(t){return 2*t+1},e}(Symbol.iterator);t.Stats=I,window.Generations=t.Generations}();
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../index.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n AbilityName,\n Condition,\n Data,\n Dex,\n EggGroup,\n EvoType,\n FormeName,\n GenderName,\n GenerationNum,\n ID,\n ItemName,\n Move,\n MoveCategory,\n MoveName,\n MoveSource,\n Nature,\n Nonstandard,\n Species as DexSpecies,\n SpeciesAbility,\n SpeciesName,\n SpeciesTag,\n StatID,\n StatsTable,\n Tier,\n Type as DexType,\n TypeName,\n} from '@pkmn/dex-types';\n\nconst DEFAULT_EXISTS = (d: Data) => {\n if (!d.exists) return false;\n if ('isNonstandard' in d && d.isNonstandard) return false;\n if (d.kind === 'Ability' && d.id === 'noability') return false;\n return !('tier' in d && ['Illegal', 'Unreleased'].includes(d.tier));\n};\n\nconst tr = (num: number, bits = 0) => bits ? (num >>> 0) % (2 ** bits) : num >>> 0;\n\nexport type ExistsFn = (d: Data, g: GenerationNum) => boolean;\ntype BoundExistsFn = (d: Data) => boolean;\n\nfunction assignWithout(a: {[key: string]: any}, b: {[key: string]: any}, exclude: Set<string>) {\n for (const key in b) {\n if (Object.prototype.hasOwnProperty.call(b, key) && !exclude.has(key)) {\n a[key] = b[key];\n }\n }\n return a;\n}\n\nexport function toID(text: any): ID {\n if (text?.id) text = text.id;\n if (typeof text !== 'string' && typeof text !== 'number') return '';\n return ('' + text).toLowerCase().replace(/[^a-z0-9]+/g, '') as ID;\n}\n\nexport class Generations {\n private readonly cache = Object.create(null) as {[num: number]: Generation};\n\n private readonly dex: Dex;\n private readonly exists: ExistsFn;\n\n static DEFAULT_EXISTS = DEFAULT_EXISTS;\n\n constructor(dex: Dex, exists = Generations.DEFAULT_EXISTS) {\n this.dex = dex;\n this.exists = exists;\n }\n\n get(gen: GenerationNum) {\n if (this.cache[gen]) return this.cache[gen];\n return (this.cache[gen] = new Generation(this.dex.forGen(gen), d => this.exists(d, gen)));\n }\n\n *[Symbol.iterator]() {\n for (let gen = 1; gen <= 8; gen++) {\n yield this.get(gen as GenerationNum);\n }\n }\n}\n\nexport class Generation {\n readonly abilities: Abilities;\n readonly items: Items;\n readonly moves: Moves;\n readonly species: Species;\n readonly types: Types;\n readonly natures: Natures;\n readonly learnsets: Learnsets;\n readonly conditions: Conditions;\n readonly stats: Stats;\n\n readonly dex: Dex;\n\n private readonly exists: BoundExistsFn;\n\n constructor(dex: Dex, exists: BoundExistsFn) {\n this.dex = dex;\n this.exists = exists;\n\n this.abilities = new Abilities(this.dex, this.exists);\n this.items = new Items(this.dex, this.exists);\n this.moves = new Moves(this.dex, this.exists);\n this.species = new Species(this.dex, this.exists);\n this.natures = new Natures(this.dex, this.exists);\n this.types = new Types(this.dex, this.exists);\n this.learnsets = new Learnsets(this, this.dex, this.exists);\n this.conditions = new Conditions(this.dex, this.exists);\n this.stats = new Stats(this.dex);\n }\n\n get num() {\n return this.dex.gen;\n }\n\n toString() {\n return `[Generation:${this.num}]`;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nexport class Abilities {\n private readonly dex: Dex;\n private readonly exists: BoundExistsFn;\n\n constructor(dex: Dex, exists: BoundExistsFn) {\n this.dex = dex;\n this.exists = exists;\n }\n\n get(name: string) {\n const ability = this.dex.abilities.get(name);\n return this.exists(ability) ? ability : undefined;\n }\n\n *[Symbol.iterator]() {\n for (const ability in this.dex.data.Abilities) {\n const a = this.get(ability);\n if (a) yield a;\n }\n }\n}\n\nexport class Items {\n private readonly dex: Dex;\n private readonly exists: BoundExistsFn;\n\n constructor(dex: Dex, exists: BoundExistsFn) {\n this.dex = dex;\n this.exists = exists;\n }\n\n get(name: string) {\n const item = this.dex.items.get(name);\n return this.exists(item) ? item : undefined;\n }\n\n *[Symbol.iterator]() {\n for (const item in this.dex.data.Items) {\n const i = this.get(item);\n if (i) yield i;\n }\n }\n}\n\nexport class Moves {\n private readonly dex: Dex;\n private readonly exists: BoundExistsFn;\n\n constructor(dex: Dex, exists: BoundExistsFn) {\n this.dex = dex;\n this.exists = exists;\n }\n\n get(name: string) {\n const move = this.dex.moves.get(name);\n return this.exists(move) ? move : undefined;\n }\n\n *[Symbol.iterator]() {\n for (const move in this.dex.data.Moves) {\n const m = this.get(move);\n if (m) yield m;\n }\n }\n}\n\nexport class Species {\n private readonly cache = Object.create(null) as { [id: string]: Specie };\n\n private readonly dex: Dex;\n private readonly exists: BoundExistsFn;\n\n constructor(dex: Dex, exists: BoundExistsFn) {\n this.dex = dex;\n this.exists = exists;\n }\n\n get(name: string) {\n const species = this.dex.species.get(name);\n if (!this.exists(species)) return undefined;\n const id = (species as any).speciesid || species.id; // FIXME Event-only ability hack\n const cached = this.cache[id];\n if (cached) return cached;\n return (this.cache[id] = new Specie(this.dex, this.exists, species));\n }\n\n *[Symbol.iterator]() {\n for (const species in this.dex.data.Species) {\n const s = this.get(species);\n if (s) yield s;\n }\n }\n}\n\nexport class Specie implements DexSpecies {\n readonly id!: ID;\n readonly name!: SpeciesName;\n readonly fullname!: string;\n readonly exists!: boolean;\n readonly num!: number;\n readonly gen!: GenerationNum;\n readonly shortDesc!: string;\n readonly desc!: string;\n readonly isNonstandard!: Nonstandard | null;\n readonly duration?: number;\n\n readonly effectType!: 'Pokemon';\n readonly kind!: 'Species';\n readonly baseStats!: StatsTable;\n readonly baseSpecies!: SpeciesName;\n readonly baseForme!: FormeName | '';\n readonly forme!: FormeName | '';\n readonly abilities!: SpeciesAbility<AbilityName | ''>;\n readonly types!: [TypeName] | [TypeName, TypeName];\n readonly prevo?: SpeciesName | '';\n readonly evos?: SpeciesName[];\n readonly nfe: boolean;\n readonly eggGroups!: EggGroup[];\n readonly weightkg!: number;\n readonly weighthg!: number;\n readonly tags!: SpeciesTag[];\n readonly unreleasedHidden!: boolean | 'Past';\n readonly maleOnlyHidden!: boolean;\n readonly inheritsFrom!: ID;\n readonly tier!: Tier.Singles | Tier.Other;\n readonly doublesTier!: Tier.Doubles;\n\n readonly evoMove?: MoveName;\n readonly changesFrom?: SpeciesName;\n readonly cosmeticFormes?: SpeciesName[];\n readonly otherFormes?: SpeciesName[];\n readonly formeOrder?: SpeciesName[];\n readonly formes?: SpeciesName[];\n readonly genderRatio: { M: number; F: number };\n readonly isMega?: boolean;\n readonly isPrimal?: boolean;\n readonly battleOnly?: SpeciesName | SpeciesName[];\n readonly isGigantamax?: MoveName;\n readonly requiredAbility?: AbilityName;\n readonly requiredItem?: ItemName;\n readonly requiredItems?: ItemName[];\n readonly requiredMove?: MoveName;\n readonly gender?: GenderName;\n readonly maxHP?: number;\n readonly evoLevel?: number;\n readonly evoCondition?: string;\n readonly evoItem?: string;\n readonly evoType?: EvoType;\n readonly condition?: Partial<Condition>;\n readonly canHatch!: boolean;\n\n private readonly dex: Dex;\n\n private static readonly EXCLUDE = new Set([\n 'abilities',\n 'cosmeticFormes',\n 'evos',\n 'gender',\n 'genderRatio',\n 'nfe',\n 'otherFormes',\n 'prevo',\n ]);\n\n constructor(dex: Dex, exists: BoundExistsFn, species: DexSpecies) {\n assignWithout(this, species, Specie.EXCLUDE);\n this.dex = dex;\n if (this.dex.gen >= 2) {\n this.gender = species.gender;\n this.genderRatio = species.genderRatio;\n } else {\n this.genderRatio = {M: 0, F: 0};\n }\n if (this.dex.gen >= 3) {\n this.abilities = {0: species.abilities[0]};\n // \"because PS\", Pokemon have the abilities that were added in Gen 4 in Gen 3 :bigthonk:\n if (species.abilities[1] &&\n this.dex.abilities.get(species.abilities[1]).gen <= this.dex.gen) {\n this.abilities[1] = species.abilities[1];\n }\n if (this.dex.gen >= 5 && species.abilities.H) this.abilities.H = species.abilities.H;\n if (this.dex.gen >= 7 && species.abilities.S) this.abilities.S = species.abilities.S;\n } else {\n this.abilities = {0: ''};\n }\n this.evos = species.evos?.filter(s => exists(this.dex.species.get(s)));\n this.nfe = !!this.evos?.length;\n if (!this.nfe) this.evos = undefined;\n this.cosmeticFormes = species.cosmeticFormes?.filter(s => exists(this.dex.species.get(s)));\n if (!this.cosmeticFormes?.length) this.cosmeticFormes = undefined;\n this.otherFormes = species.otherFormes?.filter(s => exists(this.dex.species.get(s)));\n if (!this.otherFormes?.length) this.otherFormes = undefined;\n this.formeOrder = species.formeOrder?.filter(s => exists(this.dex.species.get(s)));\n if (!this.formeOrder?.length) this.formeOrder = undefined;\n this.formes = this.formeOrder?.filter(s => !this.dex.species.get(s).isGigantamax);\n this.prevo =\n species.prevo && exists(this.dex.species.get(species.prevo)) ? species.prevo : undefined;\n }\n\n get formeNum() {\n return (this.baseSpecies === this.name\n ? this.formeOrder ? this.formeOrder.findIndex(name => name === this.name) : 0\n : this.dex.species.get(this.baseSpecies).formeOrder!.findIndex(\n name => name === (this.isGigantamax ? this.baseSpecies : this.name)\n ));\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return assignWithout({}, this, new Set(['dex']));\n }\n}\n\nexport class Conditions {\n private readonly dex: Dex;\n private readonly exists: BoundExistsFn;\n\n constructor(dex: Dex, exists: BoundExistsFn) {\n this.dex = dex;\n this.exists = exists;\n }\n\n get(name: string) {\n const condition = this.dex.conditions.get(name);\n return this.exists(condition) ? condition : undefined;\n }\n}\n\nexport class Natures {\n private readonly dex: Dex;\n private readonly exists: BoundExistsFn;\n\n constructor(dex: Dex, exists: BoundExistsFn) {\n this.dex = dex;\n this.exists = exists;\n }\n\n get(name: string) {\n if (this.dex.gen < 3) return undefined;\n const nature = this.dex.natures.get(name);\n return this.exists(nature) ? nature : undefined;\n }\n\n *[Symbol.iterator]() {\n for (const nature in this.dex.data.Natures) {\n const n = this.get(nature);\n if (n) yield n;\n }\n }\n}\n\nconst EFFECTIVENESS = {\n '-3': 0.125,\n '-2': 0.25,\n '-1': 0.5,\n '0': 1,\n '1': 2,\n '2': 4,\n '3': 8,\n};\n\ntype TypeTarget = { getTypes: () => TypeName[] } | { types: TypeName[] } | TypeName[] | TypeName;\n\nexport class Types {\n private readonly cache = Object.create(null) as { [id: string]: Type };\n\n private readonly unknown: Type;\n private readonly dex: Dex;\n private readonly exists: BoundExistsFn;\n\n constructor(dex: Dex, exists: BoundExistsFn) {\n this.dex = dex;\n this.exists = exists;\n // PS doesn't contain data for the '???' type\n this.unknown = new Type({\n effectType: 'Type',\n kind: 'Type',\n // Regrettably PS ID's can't represent '???'\n id: '',\n name: '???',\n // Technically this only exists as a true type in Gens 2-4, but there are moves dealing\n // typeless damage in Gen 1 so we include it there.\n exists: dex.gen <= 4,\n gen: 1,\n // This gets filled in for us by Type's constructor\n damageTaken: {} as { [t in Exclude<TypeName, '???'>]: number },\n HPivs: {},\n HPdvs: {},\n }, dex, this);\n }\n\n get(name: string) {\n if (name === '???') return this.unknown;\n const type = this.dex.types.get(name);\n if (!this.exists(type)) return undefined;\n const cached = this.cache[type.id];\n if (cached) return cached;\n return (this.cache[type.id] = new Type(type, this.dex, this));\n }\n\n *[Symbol.iterator]() {\n for (const type in this.dex.data.Types) {\n const t = this.get(type);\n if (t) yield t;\n }\n if (this.dex.gen >= 2 && this.dex.gen <= 4) {\n yield this.unknown;\n }\n }\n\n getHiddenPower(ivs: StatsTable) {\n return this.dex.getHiddenPower(ivs);\n }\n\n canDamage(source: { type: TypeName } | TypeName, target: TypeTarget) {\n return this.dex.getImmunity(source, target);\n }\n\n totalEffectiveness(source: { type: TypeName } | TypeName, target: TypeTarget) {\n if (!this.canDamage(source, target)) return 0;\n const e = `${this.dex.getEffectiveness(source, target)}`;\n // convert from PS's ridiculous encoding to something usable\n return EFFECTIVENESS[e as keyof typeof EFFECTIVENESS];\n }\n}\n\nexport type TypeEffectiveness = 0 | 0.5 | 1 | 2;\n\nconst DAMAGE_TAKEN = [1, 2, 0.5, 0] as TypeEffectiveness[];\nconst SPECIAL = ['Fire', 'Water', 'Grass', 'Electric', 'Ice', 'Psychic', 'Dark', 'Dragon'];\n\nexport class Type {\n readonly id!: ID;\n readonly name!: TypeName;\n readonly effectType!: 'Type';\n readonly kind!: 'Type';\n readonly exists!: boolean;\n readonly gen!: GenerationNum;\n readonly effectiveness: { [t in TypeName]: TypeEffectiveness };\n readonly HPivs!: Partial<StatsTable>;\n readonly HPdvs!: Partial<StatsTable>;\n readonly category?: Exclude<MoveCategory, 'Status'>;\n\n private readonly types: Types;\n\n constructor(type: DexType, dex: Dex, types: Types) {\n Object.assign(this, type);\n this.types = types;\n this.category =\n this.name === 'Fairy' ? undefined : SPECIAL.includes(this.name) ? 'Special' : 'Physical';\n // convert from PS's ridiculous encoding to something usable (plus damage taken -> dealt)\n this.effectiveness = {'???': 1} as { [t in TypeName]: TypeEffectiveness };\n for (const k in dex.data.Types) {\n const t = k.charAt(0).toUpperCase() + k.slice(1) as Exclude<TypeName, '???'>;\n this.effectiveness[t] = DAMAGE_TAKEN[dex.data.Types[k].damageTaken[this.name] || 0];\n }\n }\n\n canDamage(target: TypeTarget) {\n return this.types.canDamage(this.name, target);\n }\n\n totalEffectiveness(target: TypeTarget) {\n return this.types.totalEffectiveness(this.name, target);\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return assignWithout({}, this, new Set(['types']));\n }\n}\n\nconst GEN3_HMS =\n new Set(['cut', 'fly', 'surf', 'strength', 'flash', 'rocksmash', 'waterfall', 'dive'] as ID[]);\n// NOTE: Whirlpool and Defog are Gen 4 HMs but the HMs differ in DPPt vs. HGSS\nconst GEN4_HMS =\n new Set(['cut', 'fly', 'surf', 'strength', 'rocksmash', 'waterfall', 'rockclimb'] as ID[]);\n\ntype Restriction = 'Pentagon' | 'Plus' | 'Galar';\n\nexport class Learnsets {\n private readonly cache = Object.create(null) as {\n [speciesid: string]: {[moveid: string]: MoveSource[]};\n };\n\n private readonly gen: Generation;\n private readonly dex: Dex;\n private readonly exists: BoundExistsFn;\n\n constructor(gen: Generation, dex: Dex, exists: BoundExistsFn) {\n this.gen = gen;\n this.dex = dex;\n this.exists = exists;\n }\n\n async get(name: string) {\n const learnset = await this.dex.learnsets.get(toID(name));\n return this.exists(learnset) ? learnset : undefined;\n }\n\n async *[Symbol.iterator]() {\n if (!this.dex.data.Learnsets) await this.dex.learnsets.get('LOAD' as ID);\n for (const id in this.dex.data.Learnsets) {\n const l = await this.get(id);\n if (l) yield l;\n }\n }\n\n async* all(species: Specie) {\n let id = species.id;\n let learnset = await this.get(id);\n if (!learnset) {\n id = typeof species.battleOnly === 'string' && species.battleOnly !== species.baseSpecies\n ? toID(species.battleOnly)\n : toID(species.baseSpecies);\n learnset = await this.get(id);\n }\n\n while (learnset) {\n yield learnset;\n\n if (id === 'lycanrocdusk' || (species.id === 'rockruff' && id === 'rockruff')) {\n id = 'rockruffdusk' as ID;\n } else if (species.id === 'gastrodoneast') {\n id = 'gastrodon' as ID;\n } else if (species.id === 'pumpkaboosuper') {\n id = 'pumpkaboo' as ID;\n } else {\n id = toID(species.battleOnly || species.changesFrom || species.prevo);\n }\n\n if (!id) break;\n const s = this.gen.species.get(id);\n if (!s) break;\n species = s;\n learnset = await this.get(id);\n }\n }\n\n // BUG: this only covers what Pok\u00E9mon Showdown deems \"teambuilder legality\" - proper legality\n // checks/restriction enforcement requires @pkmn/sim's TeamValidator.\n async learnable(name: string, restriction?: Restriction) {\n const species = this.gen.species.get(name);\n if (!species) return undefined;\n\n if (!restriction) {\n const cached = this.cache[species.id];\n if (cached) return cached;\n }\n\n const moves: {[moveid: string]: MoveSource[]} = {};\n\n for await (const learnset of this.all(species)) {\n if (learnset.learnset) {\n for (const moveid in learnset.learnset) {\n const move = this.gen.moves.get(moveid);\n if (move) {\n const sources = learnset.learnset[moveid];\n if (this.isLegal(move, sources, restriction || this.gen)) {\n moves[move.id] = sources.filter(s => +s.charAt(0) <= this.gen.num);\n }\n }\n }\n }\n }\n\n if (!restriction) this.cache[species.id] = moves;\n return moves;\n }\n\n // BUG: this only covers what Pok\u00E9mon Showdown deems \"teambuilder legality\" - proper legality\n // checks/restriction enforcement requires @pkmn/sim's TeamValidator.\n async canLearn(name: string, move: Move | string, restriction?: Restriction) {\n const species = this.gen.species.get(name);\n if (!species) return false;\n\n move = typeof move === 'string' && this.gen.moves.get(move) || move;\n if (typeof move === 'string') return false;\n\n for await (const learnset of this.all(species)) {\n if (this.isLegal(move, learnset.learnset?.[move.id], restriction || this.gen)) {\n return true;\n }\n }\n\n return false;\n }\n\n // BUG: this only covers what Pok\u00E9mon Showdown deems \"teambuilder legality\" - proper legality\n // checks/restriction enforcement requires @pkmn/sim's TeamValidator.\n isLegal(move: Move, sources: MoveSource[] | undefined, gen: Generation | Restriction) {\n if (!sources) return undefined;\n\n const gens = sources.map(x => Number(x[0]));\n const minGen = Math.min(...gens);\n const vcOnly = (\n minGen === 7 && sources.every(x => x[0] !== '7' || x === '7V') ||\n minGen === 8 && sources.every(x => x[0] !== '8' || x === '8V')\n );\n\n if (gen === 'Pentagon') return gens.includes(6);\n if (gen === 'Plus') return gens.includes(7) && !vcOnly;\n if (gen === 'Galar') return gens.includes(8) && !vcOnly;\n\n if (this.gen.num >= 3 && minGen <= 4 && (GEN3_HMS.has(move.id) || GEN4_HMS.has(move.id))) {\n let legalGens = '';\n let available = false;\n\n if (minGen === 3) {\n legalGens += '3';\n available = true;\n }\n if (available) available = !GEN3_HMS.has(move.id);\n\n if (available || gens.includes(4)) {\n legalGens += '4';\n available = true;\n }\n if (available) available = !GEN4_HMS.has(move.id);\n\n const minUpperGen = available ? 5 : Math.min(...gens.filter(g => g > 4));\n legalGens += '012345678'.slice(minUpperGen);\n return legalGens.includes(`${gen.num}`);\n } else {\n return '012345678'.slice(minGen).includes(`${gen.num}`);\n }\n }\n}\n\nconst STATS = ['hp', 'atk', 'def', 'spe', 'spa', 'spd'] as const;\n\nconst NAMES: Readonly<{ [name: string]: StatID }> = {\n HP: 'hp', hp: 'hp',\n Attack: 'atk', Atk: 'atk', atk: 'atk',\n Defense: 'def', Def: 'def', def: 'def',\n 'Special Attack': 'spa', SpA: 'spa', SAtk: 'spa', SpAtk: 'spa', spa: 'spa',\n Special: 'spa', spc: 'spa', Spc: 'spa',\n 'Special Defense': 'spd', SpD: 'spd', SDef: 'spd', SpDef: 'spd', spd: 'spd',\n Speed: 'spe', Spe: 'spe', Spd: 'spe', spe: 'spe',\n};\n\nconst DISPLAY: Readonly<{ [stat: string]: Readonly<[string, string]> }> = {\n hp: ['HP', 'HP'],\n atk: ['Atk', 'Attack'],\n def: ['Def', 'Defense'],\n spa: ['SpA', 'Special Attack'],\n spd: ['SpD', 'Special Defense'],\n spe: ['Spe', 'Speed'],\n spc: ['Spc', 'Special'],\n};\n\nexport class Stats {\n private readonly dex: Dex;\n constructor(dex: Dex) {\n this.dex = dex;\n }\n\n calc(stat: StatID, base: number, iv = 31, ev?: number, level = 100, nature?: Nature) {\n if (ev === undefined) ev = this.dex.gen < 3 ? 252 : 0;\n if (this.dex.gen < 3) {\n iv = this.toDV(iv) * 2;\n nature = undefined;\n }\n if (stat === 'hp') {\n return base === 1 ? base : tr(tr(2 * base + iv + tr(ev / 4) + 100) * level / 100 + 10);\n } else {\n const val = tr(tr(2 * base + iv + tr(ev / 4)) * level / 100 + 5);\n if (nature !== undefined) {\n if (nature.plus === stat) return tr(tr(val * 110, 16) / 100);\n if (nature.minus === stat) return tr(tr(val * 90, 16) / 100);\n }\n return val;\n }\n }\n\n get(s: string): StatID | undefined {\n return NAMES[s];\n }\n\n display(str: string, full = false): string {\n let s: StatID | 'spc' | undefined = NAMES[str];\n if (s === undefined) return str;\n if (this.dex.gen === 1 && s === 'spa') s = 'spc';\n return DISPLAY[s][+full];\n }\n\n fill<T>(stats: Partial<StatsTable<T>>, val: T): StatsTable<T> {\n for (const stat of STATS) {\n if (!(stat in stats)) stats[stat] = val;\n }\n return stats as StatsTable<T>;\n }\n\n getHPDV(ivs: Partial<StatsTable>): number {\n return (\n (this.toDV(ivs.atk === undefined ? 31 : ivs.atk) % 2) * 8 +\n (this.toDV(ivs.def === undefined ? 31 : ivs.def) % 2) * 4 +\n (this.toDV(ivs.spe === undefined ? 31 : ivs.spe) % 2) * 2 +\n (this.toDV(ivs.spa === undefined ? 31 : ivs.spa) % 2)\n );\n }\n\n *[Symbol.iterator](): IterableIterator<StatID> {\n for (const s of STATS) {\n yield s;\n }\n }\n\n toDV(iv: number): number {\n return Math.floor(iv / 2);\n }\n\n toIV(dv: number): number {\n return dv * 2 + 1;\n }\n}\n\nexport {\n ID,\n As,\n Weather,\n FieldCondition,\n SideCondition,\n GenerationNum,\n GenderName,\n StatID,\n StatsTable,\n BoostID,\n BoostsTable,\n MoveCategory,\n MoveTarget,\n Nonstandard,\n EvoType,\n EggGroup,\n SideID,\n Player,\n GameType,\n HPColor,\n StatusName,\n NatureName,\n TypeName,\n HPTypeName,\n Tier,\n PokemonSet,\n AbilityName,\n ItemName,\n MoveName,\n SpeciesName,\n FormeName,\n EffectType,\n Effect,\n DataKind,\n Data,\n EffectData,\n HitEffect,\n SecondaryEffect,\n ConditionData,\n AbilityData,\n ItemData,\n MoveData,\n SpeciesData,\n MoveSource,\n EventInfoData,\n LearnsetData,\n TypeData,\n NatureData,\n BasicEffect,\n Condition,\n Ability,\n Item,\n Move,\n // Species,\n EventInfo,\n Learnset,\n // Type,\n Nature,\n GenID,\n Dex,\n} from '@pkmn/dex-types';\n"],
|
|
5
|
-
"mappings": "uSA2uBA,MA6DO,qBA3wBD,EAAiB,AAAC,GAClB,CAAC,EA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,OAAkB,EACxB,MAAK,IAAI,MAAQ,GAAK,IAAM,OAAO,GAAI,OACpC,EAAQ,GAAG,CAAC,GACrB,CAEA,KAAQ,EAA+B,EAAuB,CAC5D,OAAW,KAAQ,GACjB,AAAM,IAAQ,IAAQ,GAAM,GAAQ,GAEtC,MAAO,EACT,CAEA,QAAQ,EAAkC,CACxC,MACG,MAAK,KAAK,EAAI,MAAQ,OAAY,GAAK,EAAI,GAAG,EAAI,EAAK,EACvD,KAAK,KAAK,EAAI,MAAQ,OAAY,GAAK,EAAI,GAAG,EAAI,EAAK,EACvD,KAAK,KAAK,EAAI,MAAQ,OAAY,GAAK,EAAI,GAAG,EAAI,EAAK,EACvD,KAAK,KAAK,EAAI,MAAQ,OAAY,GAAK,EAAI,GAAG,EAAI,CAEvD,GAEE,OAAO,WAAsC,CAC7C,OAAW,KAAK,GACd,KAAM,EAEV,CAEA,KAAK,EAAoB,CACvB,MAAO,MAAK,MAAM,EAAK,CAAC,CAC1B,CAEA,KAAK,EAAoB,CACvB,MAAO,GAAK,EAAI,CAClB,CACF",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _this=this;function _defineProperties(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,e,i){return e&&_defineProperties(t.prototype,e),i&&_defineProperties(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}!function(){"use strict";var t={},e=_this&&_this.__await||function(t){return this instanceof e?(this.v=t,this):new e(t)},i=_this&&_this.__asyncGenerator||function(t,i,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s,r=n.apply(t,i||[]),o=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(t){r[t]&&(s[t]=function(e){return new Promise((function(i,n){o.push([t,e,i,n])>1||h(t,e)}))})}function h(t,i){try{(n=r[t](i)).value instanceof e?Promise.resolve(n.value.v).then(c,u):d(o[0][2],n)}catch(t){d(o[0][3],t)}var n}function c(t){h("next",t)}function u(t){h("throw",t)}function d(t,e){t(e),o.shift(),o.length&&h(o[0][0],o[0][1])}},n=_this&&_this.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,i=t[Symbol.asyncIterator];return i?i.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(i){e[i]=t[i]&&function(e){return new Promise((function(n,s){(function(t,e,i,n){Promise.resolve(n).then((function(e){t({value:e,done:i})}),e)})(n,s,(e=t[i](e)).done,e.value)}))}}};t.Stats=t.Learnsets=t.Type=t.Types=t.Natures=t.Conditions=t.Specie=t.Species=t.Moves=t.Items=t.Abilities=t.Generation=t.Generations=t.toID=void 0;var s=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e?(t>>>0)%2**e:t>>>0};function r(t,e,i){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&!i.has(n)&&(t[n]=e[n]);return t}function o(t){return(null==t?void 0:t.id)&&(t=t.id),"string"!=typeof t&&"number"!=typeof t?"":(""+t).toLowerCase().replace(/[^a-z0-9]+/g,"")}t.toID=o;var a=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DEFAULT_EXISTS;this.cache=Object.create(null),this.dex=t,this.exists=i}var i=e.prototype;return i.get=function(t){var e=this;return this.cache[t]?this.cache[t]:this.cache[t]=new h(this.dex.forGen(t),(function(i){return e.exists(i,t)}))},i[t]=function*(){for(var t=1;t<=8;t++)yield this.get(t)},e}(Symbol.iterator);t.Generations=a,a.DEFAULT_EXISTS=function(t){return!!t.exists&&((!("isNonstandard"in t)||!t.isNonstandard)&&(("Ability"!==t.kind||"noability"!==t.id)&&!("tier"in t&&["Illegal","Unreleased"].includes(t.tier))))};var h=function(){function t(t,e){this.dex=t,this.exists=e,this.abilities=new c(this.dex,this.exists),this.items=new u(this.dex,this.exists),this.moves=new d(this.dex,this.exists),this.species=new f(this.dex,this.exists),this.natures=new p(this.dex,this.exists),this.types=new y(this.dex,this.exists),this.learnsets=new k(this,this.dex,this.exists),this.conditions=new v(this.dex,this.exists),this.stats=new P(this.dex)}var e=t.prototype;return e.toString=function(){return"[Generation:"+this.num+"]"},e.toJSON=function(){return this.toString()},_createClass(t,[{key:"num",get:function(){return this.dex.gen}}]),t}();t.Generation=h;var c=function(t){function e(t,e){this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){var e=this.dex.abilities.get(t);return this.exists(e)?e:void 0},i[t]=function*(){for(var t in this.dex.data.Abilities){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Abilities=c;var u=function(t){function e(t,e){this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){var e=this.dex.items.get(t);return this.exists(e)?e:void 0},i[t]=function*(){for(var t in this.dex.data.Items){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Items=u;var d=function(t){function e(t,e){this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){var e=this.dex.moves.get(t);return this.exists(e)?e:void 0},i[t]=function*(){for(var t in this.dex.data.Moves){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Moves=d;var f=function(t){function e(t,e){this.cache=Object.create(null),this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){var e=this.dex.species.get(t);if(this.exists(e)){var i=e.speciesid||e.id,n=this.cache[i];return n||(this.cache[i]=new l(this.dex,this.exists,e))}},i[t]=function*(){for(var t in this.dex.data.Species){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Species=f;var l=function(){function t(e,i,n){var s,o,a,h,c,u,d,f,l,v=this;r(this,n,t.EXCLUDE),this.dex=e,this.dex.gen>=2?(this.gender=n.gender,this.genderRatio=n.genderRatio):this.genderRatio={M:0,F:0},this.dex.gen>=3?(this.abilities={0:n.abilities[0]},n.abilities[1]&&this.dex.abilities.get(n.abilities[1]).gen<=this.dex.gen&&(this.abilities[1]=n.abilities[1]),this.dex.gen>=5&&n.abilities.H&&(this.abilities.H=n.abilities.H),this.dex.gen>=7&&n.abilities.S&&(this.abilities.S=n.abilities.S)):this.abilities={0:""},this.evos=null===(s=n.evos)||void 0===s?void 0:s.filter((function(t){return i(v.dex.species.get(t))})),this.nfe=!!(null===(o=this.evos)||void 0===o?void 0:o.length),this.nfe||(this.evos=void 0),this.cosmeticFormes=null===(a=n.cosmeticFormes)||void 0===a?void 0:a.filter((function(t){return i(v.dex.species.get(t))})),(null===(h=this.cosmeticFormes)||void 0===h?void 0:h.length)||(this.cosmeticFormes=void 0),this.otherFormes=null===(c=n.otherFormes)||void 0===c?void 0:c.filter((function(t){return i(v.dex.species.get(t))})),(null===(u=this.otherFormes)||void 0===u?void 0:u.length)||(this.otherFormes=void 0),this.formeOrder=null===(d=n.formeOrder)||void 0===d?void 0:d.filter((function(t){return i(v.dex.species.get(t))})),(null===(f=this.formeOrder)||void 0===f?void 0:f.length)||(this.formeOrder=void 0),this.formes=null===(l=this.formeOrder)||void 0===l?void 0:l.filter((function(t){return!v.dex.species.get(t).isGigantamax})),this.prevo=n.prevo&&i(this.dex.species.get(n.prevo))?n.prevo:void 0}var e=t.prototype;return e.toString=function(){return this.name},e.toJSON=function(){return r({},this,new Set(["dex"]))},_createClass(t,[{key:"formeNum",get:function(){var t=this;return this.baseSpecies===this.name?this.formeOrder?this.formeOrder.findIndex((function(e){return e===t.name})):0:this.dex.species.get(this.baseSpecies).formeOrder.findIndex((function(e){return e===(t.isGigantamax?t.baseSpecies:t.name)}))}}]),t}();t.Specie=l,l.EXCLUDE=new Set(["abilities","cosmeticFormes","evos","gender","genderRatio","nfe","otherFormes","prevo"]);var v=function(){function t(t,e){this.dex=t,this.exists=e}return t.prototype.get=function(t){var e=this.dex.conditions.get(t);return this.exists(e)?e:void 0},t}();t.Conditions=v;var p=function(t){function e(t,e){this.dex=t,this.exists=e}var i=e.prototype;return i.get=function(t){if(!(this.dex.gen<3)){var e=this.dex.natures.get(t);return this.exists(e)?e:void 0}},i[t]=function*(){for(var t in this.dex.data.Natures){var e=this.get(t);e&&(yield e)}},e}(Symbol.iterator);t.Natures=p;var g={"-3":.125,"-2":.25,"-1":.5,0:1,1:2,2:4,3:8},y=function(t){function e(t,e){this.cache=Object.create(null),this.dex=t,this.exists=e,this.unknown=new S({effectType:"Type",kind:"Type",id:"",name:"???",exists:t.gen<=4,gen:1,damageTaken:{},HPivs:{},HPdvs:{}},t,this)}var i=e.prototype;return i.get=function(t){if("???"===t)return this.unknown;var e=this.dex.types.get(t);if(this.exists(e)){var i=this.cache[e.id];return i||(this.cache[e.id]=new S(e,this.dex,this))}},i[t]=function*(){for(var t in this.dex.data.Types){var e=this.get(t);e&&(yield e)}this.dex.gen>=2&&this.dex.gen<=4&&(yield this.unknown)},i.getHiddenPower=function(t){return this.dex.getHiddenPower(t)},i.canDamage=function(t,e){return this.dex.getImmunity(t,e)},i.totalEffectiveness=function(t,e){if(!this.canDamage(t,e))return 0;var i=""+this.dex.getEffectiveness(t,e);return g[i]},e}(Symbol.iterator);t.Types=y;var x=[1,2,.5,0],m=["Fire","Water","Grass","Electric","Ice","Psychic","Dark","Dragon"],S=function(){function t(t,e,i){for(var n in Object.assign(this,t),this.types=i,this.category="Fairy"===this.name?void 0:m.includes(this.name)?"Special":"Physical",this.effectiveness={"???":1},e.data.Types){var s=n.charAt(0).toUpperCase()+n.slice(1);this.effectiveness[s]=x[e.data.Types[n].damageTaken[this.name]||0]}}var e=t.prototype;return e.canDamage=function(t){return this.types.canDamage(this.name,t)},e.totalEffectiveness=function(t){return this.types.totalEffectiveness(this.name,t)},e.toString=function(){return this.name},e.toJSON=function(){return r({},this,new Set(["types"]))},t}();t.Type=S;var b=new Set(["cut","fly","surf","strength","flash","rocksmash","waterfall","dive"]),w=new Set(["cut","fly","surf","strength","rocksmash","waterfall","rockclimb"]),k=function(t){function s(t,e,i){this.cache=Object.create(null),this.gen=t,this.dex=e,this.exists=i}var r=s.prototype;return r.get=async function(t){var e=await this.dex.learnsets.get(o(t));return this.exists(e)?e:void 0},r[t]=function(){return i(this,arguments,(function*(){for(var t in this.dex.data.Learnsets||(yield e(this.dex.learnsets.get("LOAD"))),this.dex.data.Learnsets){var i=yield e(this.get(t));i&&(yield yield e(i))}}))},r.all=function(t){return i(this,arguments,(function*(){var i=t.id,n=yield e(this.get(i));for(n||(i="string"==typeof t.battleOnly&&t.battleOnly!==t.baseSpecies?o(t.battleOnly):o(t.baseSpecies),n=yield e(this.get(i)));n&&(yield yield e(n),i="lycanrocdusk"===i||"rockruff"===t.id&&"rockruff"===i?"rockruffdusk":"gastrodoneast"===t.id?"gastrodon":"pumpkaboosuper"===t.id?"pumpkaboo":o(t.battleOnly||t.changesFrom||t.prevo));){var s=this.gen.species.get(i);if(!s)break;t=s,n=yield e(this.get(i))}}))},r.learnable=async function(t,e){var i,s,r=this,o=this.gen.species.get(t);if(o){if(!e){var a=this.cache[o.id];if(a)return a}var h={};try{for(var c,u=n(this.all(o));!(c=await u.next()).done;){var d=c.value;if(d.learnset)for(var f in d.learnset){var l=this.gen.moves.get(f);if(l){var v=d.learnset[f];this.isLegal(l,v,e||this.gen)&&(h[l.id]=v.filter((function(t){return+t.charAt(0)<=r.gen.num})))}}}}catch(t){i={error:t}}finally{try{c&&!c.done&&(s=u.return)&&await s.call(u)}finally{if(i)throw i.error}}return e||(this.cache[o.id]=h),h}},r.canLearn=async function(t,e,i){var s,r,o,a=this.gen.species.get(t);if(!a)return!1;if("string"==typeof(e="string"==typeof e&&this.gen.moves.get(e)||e))return!1;try{for(var h,c=n(this.all(a));!(h=await c.next()).done;){var u=h.value;if(this.isLegal(e,null===(o=u.learnset)||void 0===o?void 0:o[e.id],i||this.gen))return!0}}catch(t){s={error:t}}finally{try{h&&!h.done&&(r=c.return)&&await r.call(c)}finally{if(s)throw s.error}}return!1},r.isLegal=function(t,e,i){if(e){var n=e.map((function(t){return Number(t[0])})),s=Math.min.apply(Math,n),r=7===s&&e.every((function(t){return"7"!==t[0]||"7V"===t}))||8===s&&e.every((function(t){return"8"!==t[0]||"8V"===t}));if("Pentagon"===i)return n.includes(6);if("Plus"===i)return n.includes(7)&&!r;if("Galar"===i)return n.includes(8)&&!r;if(this.gen.num>=3&&s<=4&&(b.has(t.id)||w.has(t.id))){var o="",a=!1;3===s&&(o+="3",a=!0),a&&(a=!b.has(t.id)),(a||n.includes(4))&&(o+="4",a=!0),a&&(a=!w.has(t.id));var h=a?5:Math.min.apply(Math,n.filter((function(t){return t>4})));return(o+="012345678".slice(h)).includes(""+i.num)}return"012345678".slice(s).includes(""+i.num)}},s}(Symbol.iterator);t.Learnsets=k;var D=["hp","atk","def","spe","spa","spd"],O={HP:"hp",hp:"hp",Attack:"atk",Atk:"atk",atk:"atk",Defense:"def",Def:"def",def:"def","Special Attack":"spa",SpA:"spa",SAtk:"spa",SpAtk:"spa",spa:"spa",Special:"spa",spc:"spa",Spc:"spa","Special Defense":"spd",SpD:"spd",SDef:"spd",SpDef:"spd",spd:"spd",Speed:"spe",Spe:"spe",Spd:"spe",spe:"spe"},_={hp:["HP","HP"],atk:["Atk","Attack"],def:["Def","Defense"],spa:["SpA","Special Attack"],spd:["SpD","Special Defense"],spe:["Spe","Speed"],spc:["Spc","Special"]},P=function(t){function e(t){this.dex=t}var i=e.prototype;return i.calc=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:31,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:100,o=arguments.length>5?arguments[5]:void 0;if(void 0===n&&(n=this.dex.gen<3?252:0),this.dex.gen<3&&(i=2*this.toDV(i),o=void 0),"hp"===t)return 1===e?e:s(s(2*e+i+s(n/4)+100)*r/100+10);var a=s(s(2*e+i+s(n/4))*r/100+5);if(void 0!==o){if(o.plus===t)return s(s(110*a,16)/100);if(o.minus===t)return s(s(90*a,16)/100)}return a},i.get=function(t){return O[t]},i.display=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=O[t];return void 0===i?t:(1===this.dex.gen&&"spa"===i&&(i="spc"),_[i][+e])},i.fill=function(t,e){for(var i=0;i<D.length;i++){var n=D[i];n in t||(t[n]=e)}return t},i.getHPDV=function(t){return this.toDV(void 0===t.atk?31:t.atk)%2*8+this.toDV(void 0===t.def?31:t.def)%2*4+this.toDV(void 0===t.spe?31:t.spe)%2*2+this.toDV(void 0===t.spa?31:t.spa)%2},i[t]=function*(){for(var t=0;t<D.length;t++){var e=D[t];yield e}},i.toDV=function(t){return Math.floor(t/2)},i.toIV=function(t){return 2*t+1},e}(Symbol.iterator);t.Stats=P,window.Generations=t.Generations}();
|