koffing 0.4.0 → 1.0.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/dist/koffing.js DELETED
@@ -1,940 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else {
7
- var a = factory();
8
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
- }
10
- })(typeof self !== 'undefined' ? self : this, function() {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // define getter function for harmony exports
47
- /******/ __webpack_require__.d = function(exports, name, getter) {
48
- /******/ if(!__webpack_require__.o(exports, name)) {
49
- /******/ Object.defineProperty(exports, name, {
50
- /******/ configurable: false,
51
- /******/ enumerable: true,
52
- /******/ get: getter
53
- /******/ });
54
- /******/ }
55
- /******/ };
56
- /******/
57
- /******/ // define __esModule on exports
58
- /******/ __webpack_require__.r = function(exports) {
59
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
60
- /******/ };
61
- /******/
62
- /******/ // getDefaultExport function for compatibility with non-harmony modules
63
- /******/ __webpack_require__.n = function(module) {
64
- /******/ var getter = module && module.__esModule ?
65
- /******/ function getDefault() { return module['default']; } :
66
- /******/ function getModuleExports() { return module; };
67
- /******/ __webpack_require__.d(getter, 'a', getter);
68
- /******/ return getter;
69
- /******/ };
70
- /******/
71
- /******/ // Object.prototype.hasOwnProperty.call
72
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
73
- /******/
74
- /******/ // __webpack_public_path__
75
- /******/ __webpack_require__.p = "";
76
- /******/
77
- /******/
78
- /******/ // Load entry module and return exports
79
- /******/ return __webpack_require__(__webpack_require__.s = 4);
80
- /******/ })
81
- /************************************************************************/
82
- /******/ ([
83
- /* 0 */
84
- /***/ (function(module, exports, __webpack_require__) {
85
-
86
- "use strict";
87
-
88
-
89
- Object.defineProperty(exports, "__esModule", {
90
- value: true
91
- });
92
-
93
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
94
-
95
- var _Pokemon = __webpack_require__(1);
96
-
97
- var _Pokemon2 = _interopRequireDefault(_Pokemon);
98
-
99
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
100
-
101
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
102
-
103
- var PokemonTeam = function () {
104
- /**
105
- * @param {string} format
106
- * @param {string} name
107
- * @param {string|undefined} folder
108
- */
109
- function PokemonTeam() {
110
- var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'gen7';
111
- var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Untitled';
112
- var folder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
113
-
114
- _classCallCheck(this, PokemonTeam);
115
-
116
- /**
117
- *
118
- * @type {string}
119
- */
120
- this.name = name;
121
- /**
122
- *
123
- * @type {string}
124
- */
125
- this.format = format;
126
- /**
127
- *
128
- * @type {string|undefined}
129
- */
130
- this.folder = folder;
131
- /**
132
- *
133
- * @type {Pokemon[]}
134
- */
135
- this.pokemon = [];
136
- }
137
-
138
- /**
139
- * @param {object|PokemonTeam} obj
140
- * @returns {PokemonTeam}
141
- */
142
-
143
-
144
- _createClass(PokemonTeam, [{
145
- key: "toJson",
146
-
147
-
148
- /**
149
- * @param {Number} indentation
150
- * @returns {string}
151
- */
152
- value: function toJson() {
153
- var indentation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2;
154
-
155
- return JSON.stringify(this, null, indentation);
156
- }
157
-
158
- /**
159
- * @returns {string}
160
- */
161
-
162
- }, {
163
- key: "toShowdown",
164
- value: function toShowdown() {
165
- var name = this.folder ? this.folder + "/" + this.name : this.name;
166
- var str = "=== [" + this.format + "] " + name + " ===\n\n";
167
-
168
- str += this.pokemon.map(function (p) {
169
- return p.toString();
170
- }).join('\n\n');
171
-
172
- return str.trim();
173
- }
174
-
175
- /**
176
- * @returns {string}
177
- */
178
-
179
- }, {
180
- key: "toString",
181
- value: function toString() {
182
- return this.toShowdown();
183
- }
184
- }], [{
185
- key: "fromObject",
186
- value: function fromObject(obj) {
187
- var team = new PokemonTeam();
188
- team.name = obj.name;
189
- team.format = obj.format;
190
- team.folder = obj.folder;
191
- team.pokemon = obj.pokemon ? obj.pokemon.map(function (pokemon) {
192
- return _Pokemon2.default.fromObject(pokemon);
193
- }) : [];
194
-
195
- return team;
196
- }
197
- }]);
198
-
199
- return PokemonTeam;
200
- }();
201
-
202
- exports.default = PokemonTeam;
203
-
204
- /***/ }),
205
- /* 1 */
206
- /***/ (function(module, exports, __webpack_require__) {
207
-
208
- "use strict";
209
-
210
-
211
- Object.defineProperty(exports, "__esModule", {
212
- value: true
213
- });
214
-
215
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
216
-
217
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
218
-
219
- var Pokemon = function () {
220
- function Pokemon() {
221
- _classCallCheck(this, Pokemon);
222
-
223
- /**
224
- * @type {String}
225
- */
226
- this.name = undefined;
227
- /**
228
- * @type {String}
229
- */
230
- this.nickname = undefined;
231
- /**
232
- * @type {String}
233
- */
234
- this.gender = undefined;
235
- /**
236
- * @type {String}
237
- */
238
- this.item = undefined;
239
- /**
240
- * @type {String}
241
- */
242
- this.ability = undefined;
243
- /**
244
- * @type {Number}
245
- */
246
- this.level = undefined;
247
- /**
248
- * @type {boolean}
249
- */
250
- this.shiny = undefined;
251
- /**
252
- * @type {Number}
253
- */
254
- this.happiness = undefined;
255
- /**
256
- * @type {String}
257
- */
258
- this.nature = undefined;
259
- /**
260
- * @type {{ hp:Number, atk:Number, def: Number, spa: Number, spd: Number, spe: Number}}
261
- */
262
- this.evs = undefined;
263
- /**
264
- * @type {{ hp:Number, atk:Number, def: Number, spa: Number, spd: Number, spe: Number}}
265
- */
266
- this.ivs = undefined;
267
- /**
268
- * @type {String[]}
269
- */
270
- this.moves = [];
271
- }
272
-
273
- /**
274
- * @param {object|Pokemon} obj
275
- * @returns {Pokemon}
276
- */
277
-
278
-
279
- _createClass(Pokemon, [{
280
- key: "toJson",
281
-
282
-
283
- /**
284
- * @param {Number} indentation
285
- * @returns {string}
286
- */
287
- value: function toJson() {
288
- var indentation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2;
289
-
290
- return JSON.stringify(this, null, indentation);
291
- }
292
-
293
- /**
294
- * @returns {string}
295
- */
296
-
297
- }, {
298
- key: "toShowdown",
299
- value: function toShowdown() {
300
- var str = '';
301
-
302
- if (this.nickname) {
303
- str += this.nickname + " (" + this.name + ")";
304
- } else {
305
- str += "" + this.name;
306
- }
307
-
308
- if (this.gender && this.gender.match(/^[MF]$/i)) {
309
- str += " (" + this.gender.toUpperCase() + ")";
310
- }
311
-
312
- if (this.item) {
313
- str += " @ " + this.item;
314
- }
315
-
316
- str += "\n";
317
-
318
- if (!isNaN(this.level)) {
319
- str += "Level: " + this.level + "\n";
320
- }
321
-
322
- if (this.ability) {
323
- str += "Ability: " + this.ability + "\n";
324
- }
325
-
326
- if (this.shiny === true) {
327
- str += "Shiny: Yes\n";
328
- }
329
-
330
- if (!isNaN(this.happiness)) {
331
- str += "Happiness: " + this.happiness + "\n";
332
- }
333
-
334
- if (this.nature) {
335
- str += this.nature + " Nature\n";
336
- }
337
-
338
- if (this.evs) {
339
- var evs = this.evs;
340
- str += "EVs: " + ['HP', 'Atk', 'Def', 'SpA', 'SpD', 'Spe'].filter(function (prop) {
341
- return !isNaN(evs[prop.toLowerCase()]);
342
- }).map(function (prop) {
343
- var val = evs[prop.toLowerCase()];
344
- return val + " " + prop;
345
- }).join(' / ') + '\n';
346
- }
347
-
348
- if (this.ivs) {
349
- var ivs = this.ivs;
350
- str += "IVs: " + ['HP', 'Atk', 'Def', 'SpA', 'SpD', 'Spe'].filter(function (prop) {
351
- return !isNaN(ivs[prop.toLowerCase()]);
352
- }).map(function (prop) {
353
- var val = ivs[prop.toLowerCase()];
354
- return val + " " + prop;
355
- }).join(' / ') + '\n';
356
- }
357
-
358
- if (this.moves) {
359
- str += this.moves.map(function (move) {
360
- return "- " + move;
361
- }).join("\n") + "\n";
362
- }
363
-
364
- return str.trim();
365
- }
366
-
367
- /**
368
- * @returns {string}
369
- */
370
-
371
- }, {
372
- key: "toString",
373
- value: function toString() {
374
- return this.toShowdown();
375
- }
376
- }], [{
377
- key: "fromObject",
378
- value: function fromObject(obj) {
379
- var p = new Pokemon();
380
- p.name = obj.name;
381
- p.nickname = obj.nickname;
382
- p.gender = obj.gender;
383
- p.item = obj.item;
384
- p.ability = obj.ability;
385
- p.level = obj.level;
386
- p.shiny = obj.shiny;
387
- p.happiness = obj.happiness;
388
- p.nature = obj.nature;
389
- p.evs = obj.evs;
390
- p.ivs = obj.ivs;
391
- p.moves = obj.moves;
392
-
393
- return p;
394
- }
395
- }]);
396
-
397
- return Pokemon;
398
- }();
399
-
400
- exports.default = Pokemon;
401
-
402
- /***/ }),
403
- /* 2 */
404
- /***/ (function(module, exports, __webpack_require__) {
405
-
406
- "use strict";
407
-
408
-
409
- Object.defineProperty(exports, "__esModule", {
410
- value: true
411
- });
412
-
413
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
414
-
415
- var _PokemonTeam = __webpack_require__(0);
416
-
417
- var _PokemonTeam2 = _interopRequireDefault(_PokemonTeam);
418
-
419
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
420
-
421
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
422
-
423
- var PokemonTeamSet = function () {
424
- /**
425
- * @param {PokemonTeam[]} teams
426
- */
427
- function PokemonTeamSet() {
428
- var teams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
429
-
430
- _classCallCheck(this, PokemonTeamSet);
431
-
432
- this.teams = teams;
433
- }
434
-
435
- /**
436
- * @param {object|PokemonTeamSet} obj
437
- * @returns {PokemonTeamSet}
438
- */
439
-
440
-
441
- _createClass(PokemonTeamSet, [{
442
- key: "toJson",
443
-
444
-
445
- /**
446
- * @param {Number} indentation
447
- * @returns {string}
448
- */
449
- value: function toJson() {
450
- var indentation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2;
451
-
452
- return JSON.stringify(this, null, indentation);
453
- }
454
-
455
- /**
456
- * @returns {string}
457
- */
458
-
459
- }, {
460
- key: "toShowdown",
461
- value: function toShowdown() {
462
- return this.teams.map(function (p) {
463
- return p.toString();
464
- }).join('\n\n').trim();
465
- }
466
-
467
- /**
468
- * @returns {string}
469
- */
470
-
471
- }, {
472
- key: "toString",
473
- value: function toString() {
474
- return this.toShowdown();
475
- }
476
- }], [{
477
- key: "fromObject",
478
- value: function fromObject(obj) {
479
- var teamSet = new PokemonTeamSet();
480
- teamSet.teams = obj.teams ? obj.teams.map(function (team) {
481
- return _PokemonTeam2.default.fromObject(team);
482
- }) : [];
483
-
484
- return teamSet;
485
- }
486
- }]);
487
-
488
- return PokemonTeamSet;
489
- }();
490
-
491
- exports.default = PokemonTeamSet;
492
-
493
- /***/ }),
494
- /* 3 */
495
- /***/ (function(module, exports, __webpack_require__) {
496
-
497
- "use strict";
498
-
499
-
500
- Object.defineProperty(exports, "__esModule", {
501
- value: true
502
- });
503
-
504
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
505
-
506
- var _Pokemon = __webpack_require__(1);
507
-
508
- var _Pokemon2 = _interopRequireDefault(_Pokemon);
509
-
510
- var _PokemonTeam = __webpack_require__(0);
511
-
512
- var _PokemonTeam2 = _interopRequireDefault(_PokemonTeam);
513
-
514
- var _PokemonTeamSet = __webpack_require__(2);
515
-
516
- var _PokemonTeamSet2 = _interopRequireDefault(_PokemonTeamSet);
517
-
518
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
519
-
520
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
521
-
522
- /**
523
- * Ported from Pokemon Showdown Client's exportTeam/importTeam functions.
524
- *
525
- * @see https://github.com/Zarel/Pokemon-Showdown-Client/blob/8994e9e/js/storage.js
526
- */
527
- var ShowdownParser = function () {
528
- /**
529
- * @param {String} code
530
- */
531
- function ShowdownParser(code) {
532
- _classCallCheck(this, ShowdownParser);
533
-
534
- /**
535
- * @type {String}
536
- */
537
- this.code = code + "";
538
- }
539
-
540
- /**
541
- * @returns {PokemonTeamSet}
542
- */
543
-
544
-
545
- _createClass(ShowdownParser, [{
546
- key: "parse",
547
- value: function parse() {
548
- var regexes = ShowdownParser.regexes;
549
-
550
- /**
551
- * @type {PokemonTeam[]}
552
- */
553
- var teams = [];
554
-
555
- /**
556
- * @type {{team: PokemonTeam, pokemon: Pokemon}}
557
- */
558
- var current = {
559
- team: null,
560
- pokemon: null
561
- };
562
-
563
- /**
564
- * @type {string[]}
565
- */
566
- var lines = this.code.trim().split("\n").map(function (line) {
567
- return line.trim();
568
- });
569
-
570
- var $this = this;
571
-
572
- lines.forEach(function (line) {
573
- // New Team
574
- if (line.match(regexes.team)) {
575
- // Start new team
576
- current.team = new _PokemonTeam2.default();
577
- $this._parseTeam(line, current.team);
578
- teams.push(current.team);
579
- return;
580
- }
581
-
582
- // Separator
583
- if (line === '' || line.match(/^[- ]+$/)) {
584
- // Line break (empty or as dashes separator), previous Pokemon definition ended.
585
- $this._saveCurrent(teams, current);
586
- return;
587
- }
588
-
589
- // New Pokemon + nickname, name, gender and item
590
- if (!current.pokemon) {
591
- current.pokemon = new _Pokemon2.default();
592
- $this._parseNameLine(line, current.pokemon);
593
- return;
594
- }
595
-
596
- // Ability, Level, etc.
597
- if ($this._parseKeyValuePairs(line, current.pokemon)) {
598
- return;
599
- }
600
-
601
- // EVs and IVs
602
- if ($this._parseEvsIvs(line, current.pokemon)) {
603
- return;
604
- }
605
-
606
- // Moves
607
- if (current.pokemon.moves.length < 4 && line.match(regexes.move)) {
608
- current.pokemon.moves.push(regexes.move.exec(line)[1].trim());
609
- }
610
- });
611
-
612
- this._saveCurrent(teams, current);
613
-
614
- return new _PokemonTeamSet2.default(teams);
615
- }
616
-
617
- /**
618
- * @param {string} line
619
- * @param {PokemonTeam} team
620
- * @private
621
- */
622
-
623
- }, {
624
- key: "_parseTeam",
625
- value: function _parseTeam(line, team) {
626
- var rg = ShowdownParser.regexes;
627
-
628
- var teamData = rg.team.exec(line);
629
- var teamNames = teamData[2].split('/');
630
- var teamName = void 0,
631
- teamFolder = void 0;
632
-
633
- if (teamNames.length > 1) {
634
- teamFolder = teamNames.shift();
635
- teamName = teamNames.join('/');
636
- } else {
637
- teamName = teamData[2];
638
- }
639
-
640
- team.format = teamData[1].trim();
641
- team.name = teamName.trim();
642
- team.folder = teamFolder ? teamFolder.trim() : undefined;
643
- }
644
-
645
- /**
646
- * @param {string} line
647
- * @param {Pokemon} pokemon
648
- * @private
649
- */
650
-
651
- }, {
652
- key: "_parseNameLine",
653
- value: function _parseNameLine(line, pokemon) {
654
- var rg = ShowdownParser.regexes;
655
-
656
- if (line.match(rg.nickname_name)) {
657
- // has nickname?
658
- var nameMatches = rg.nickname_name.exec(line);
659
- pokemon.nickname = nameMatches[1].trim();
660
- pokemon.name = nameMatches[2].trim();
661
- } else if (line.match(rg.name)) {
662
- var _nameMatches = rg.name.exec(line);
663
- pokemon.name = _nameMatches[1].trim();
664
- }
665
-
666
- if (line.match(rg.gender)) {
667
- pokemon.gender = rg.gender.exec(line)[1].toUpperCase().trim();
668
- }
669
-
670
- if (line.match(rg.item)) {
671
- pokemon.item = rg.item.exec(line)[1].trim();
672
- }
673
- }
674
-
675
- /**
676
- * @param {string} line
677
- * @param {Pokemon} pokemon
678
- * @returns {boolean} True if it matched some, false otherwise
679
- * @private
680
- */
681
-
682
- }, {
683
- key: "_parseEvsIvs",
684
- value: function _parseEvsIvs(line, pokemon) {
685
- var rg = ShowdownParser.regexes;
686
-
687
- if (line.match(rg.eivs)) {
688
- var data = rg.eivs.exec(line);
689
- var prop = data[1].toLowerCase();
690
- var values = data[2].split('/');
691
- var limit = prop === 'evs' ? 255 : 31;
692
-
693
- values.forEach(function (stat) {
694
- var statData = rg.eivs_value.exec(stat.trim().toLowerCase());
695
- if (!statData) {
696
- console.error("Invalid syntax for " + prop + ": " + stat);
697
- return;
698
- }
699
- if (!pokemon[prop]) {
700
- pokemon[prop] = {};
701
- }
702
- pokemon[prop][statData[2]] = parseFloat(statData[1]);
703
-
704
- if (pokemon[prop][statData[2]] > limit) {
705
- pokemon[prop][statData[2]] = limit;
706
- }
707
- });
708
- return true;
709
- }
710
- return false;
711
- }
712
-
713
- /**
714
- * @param {string} line
715
- * @param {Pokemon} pokemon
716
- * @returns {boolean} True if it matched some, false otherwise
717
- * @private
718
- */
719
-
720
- }, {
721
- key: "_parseKeyValuePairs",
722
- value: function _parseKeyValuePairs(line, pokemon) {
723
- var rg = ShowdownParser.regexes;
724
-
725
- return ['ability', 'level', 'shiny', 'happiness', 'nature'].some(function (key) {
726
- if (line.match(rg[key])) {
727
- pokemon[key] = rg[key].exec(line)[1].trim();
728
-
729
- if (!isNaN(pokemon[key])) {
730
- pokemon[key] = parseFloat(pokemon[key]);
731
- }
732
-
733
- if (key === 'happiness' && pokemon[key] > 255) {
734
- pokemon[key] = 255;
735
- }
736
-
737
- if (key === 'level' && pokemon[key] < 1) {
738
- pokemon[key] = 1;
739
- }
740
-
741
- if (key === 'level' && pokemon[key] > 100) {
742
- pokemon[key] = 100;
743
- }
744
-
745
- if (key === 'shiny') {
746
- pokemon[key] = !!pokemon[key].match(/yes/i);
747
- }
748
-
749
- return true;
750
- }
751
- return false;
752
- });
753
- }
754
-
755
- /**
756
- * Saves the current state of the parsed team.
757
- *
758
- * @param {Array} teams
759
- * @param {{team: PokemonTeam, pokemon: Pokemon}} current
760
- * @returns {ShowdownParser}
761
- * @private
762
- */
763
-
764
- }, {
765
- key: "_saveCurrent",
766
- value: function _saveCurrent(teams, current) {
767
- if (!current.team) {
768
- // Create a team if there is no current one
769
- current.team = new _PokemonTeam2.default();
770
- teams.push(current.team);
771
- }
772
- if (current.pokemon) {
773
- // Create a team if there is no current one
774
- current.team.pokemon.push(current.pokemon);
775
- current.pokemon = null;
776
- }
777
- return this;
778
- }
779
-
780
- /**
781
- * Sanitizes and re-formats / prettifies the Showdown code
782
- *
783
- * @returns {ShowdownParser}
784
- */
785
-
786
- }, {
787
- key: "format",
788
- value: function format() {
789
- this.code = this.parse().toString();
790
- return this;
791
- }
792
-
793
- /**
794
- * @returns {string}
795
- */
796
-
797
- }, {
798
- key: "toString",
799
- value: function toString() {
800
- return this.code;
801
- }
802
- }]);
803
-
804
- return ShowdownParser;
805
- }();
806
-
807
- ShowdownParser.regexes = {
808
- team: /^===\s+\[(.*)\]\s+(.*)\s+===$/,
809
- gender: /\((F|M)\)/i,
810
- item: /@\s?(.*)$/i,
811
- name: /^([^()=@]{2,})/i,
812
- nickname_name: /^([^()=@]*)\s+\(([^()=@]{2,})\)/i,
813
- ability: /^Ability:\s?(.*)$/i,
814
- level: /^Level:\s?([0-9]{1,3})$/i,
815
- shiny: /^Shiny:\s?(Yes|No)$/i,
816
- happiness: /^Happiness:\s?([0-9]{1,3})$/i,
817
- eivs: /^([EI]Vs):\s?(.*)$/i,
818
- eivs_value: /^([0-9]+)\s+(hp|atk|def|spa|spd|spe)$/i,
819
- nature: /^(.*)\s+Nature$/,
820
- move: /^[-~]\s?(.*)$/i
821
- };
822
-
823
- exports.default = ShowdownParser;
824
-
825
- /***/ }),
826
- /* 4 */
827
- /***/ (function(module, exports, __webpack_require__) {
828
-
829
- "use strict";
830
-
831
-
832
- Object.defineProperty(exports, "__esModule", {
833
- value: true
834
- });
835
- exports.ShowdownParser = exports.Koffing = undefined;
836
-
837
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
838
-
839
- var _Pokemon = __webpack_require__(1);
840
-
841
- var _Pokemon2 = _interopRequireDefault(_Pokemon);
842
-
843
- var _PokemonTeam = __webpack_require__(0);
844
-
845
- var _PokemonTeam2 = _interopRequireDefault(_PokemonTeam);
846
-
847
- var _PokemonTeamSet = __webpack_require__(2);
848
-
849
- var _PokemonTeamSet2 = _interopRequireDefault(_PokemonTeamSet);
850
-
851
- var _ShowdownParser = __webpack_require__(3);
852
-
853
- var _ShowdownParser2 = _interopRequireDefault(_ShowdownParser);
854
-
855
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
856
-
857
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
858
-
859
- var Koffing = function () {
860
- function Koffing() {
861
- _classCallCheck(this, Koffing);
862
- }
863
-
864
- _createClass(Koffing, null, [{
865
- key: "parse",
866
-
867
- /**
868
- * Converts from Showdown to a PokemonTeamSet object.
869
- *
870
- * @param {String|Pokemon|PokemonTeam|PokemonTeamSet|ShowdownParser} data Showdown code or object
871
- * @returns {PokemonTeamSet}
872
- */
873
- value: function parse(data) {
874
- if (data instanceof _PokemonTeamSet2.default || data instanceof _PokemonTeam2.default || data instanceof _Pokemon2.default) {
875
- return data;
876
- }
877
- if (data instanceof _ShowdownParser2.default) {
878
- return data.parse();
879
- }
880
- return new _ShowdownParser2.default(data).parse();
881
- }
882
-
883
- /**
884
- * Prettifies and sanitizes the given Showdown code.
885
- *
886
- * @param {String|Pokemon|PokemonTeam|PokemonTeamSet|ShowdownParser} data Showdown code or object
887
- * @returns {String}
888
- */
889
-
890
- }, {
891
- key: "format",
892
- value: function format(data) {
893
- return this.parse(data).toShowdown();
894
- }
895
-
896
- /**
897
- * Converts from Showdown to JSON code.
898
- *
899
- * @param {String|Pokemon|PokemonTeam|PokemonTeamSet|ShowdownParser} data Showdown code or object
900
- * @returns {String}
901
- */
902
-
903
- }, {
904
- key: "toJson",
905
- value: function toJson(data) {
906
- return this.parse(data).toJson();
907
- }
908
-
909
- /**
910
- * Converts from JSON to Showdown code.
911
- *
912
- * @param {String|Object|Pokemon|PokemonTeam|PokemonTeamSet|ShowdownParser} data JSON code or object
913
- * @returns {String}
914
- */
915
-
916
- }, {
917
- key: "toShowdown",
918
- value: function toShowdown(data) {
919
- if (data instanceof _PokemonTeamSet2.default || data instanceof _PokemonTeam2.default || data instanceof _Pokemon2.default) {
920
- return data.toShowdown();
921
- }
922
- if (data instanceof _ShowdownParser2.default) {
923
- return data.parse().format();
924
- }
925
- if (typeof value === 'string' || value instanceof String) {
926
- data = JSON.parse(data);
927
- }
928
- return _PokemonTeamSet2.default.fromObject(JSON.parse(data)).toShowdown();
929
- }
930
- }]);
931
-
932
- return Koffing;
933
- }();
934
-
935
- exports.Koffing = Koffing;
936
- exports.ShowdownParser = _ShowdownParser2.default;
937
-
938
- /***/ })
939
- /******/ ]);
940
- });