-
Notifications
You must be signed in to change notification settings - Fork 13
/
ivcalcswsh.html
1923 lines (1840 loc) · 126 KB
/
ivcalcswsh.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--
This program has been written by Heracles Papatheodorou a.k.a Arty2, webmaster of LegendaryPKMN.net
You can contact the author via email: contact {at} LegendaryPKMN {dot} net
Please pardon the code mess that follows since it's always a work in progress :]
Be my guest if you think you can improve one of the following algorithms; I am not a programmer by profession.
I tried to provide subtle documentation here and there; the complex parts are at least covered.
Source is uncompressed, for educational (?) purposes.
The latest version of this program can always be found at https://legendarypkmn.github.io/ivcalcswsh.html
-->
<title>Sword & Shield Individual Value & Stat Calculator - LegendaryPKMN.net</title>
<meta name="Author" content="Heracles Papatheodorou" />
<meta name="keywords" content="Pokemon, IVs, IV, Calculator, Individual, Values, Stats, Stat, Sword, Shield" />
<meta name="description" content="This IV Calculator / Stat Calculator aims to help Pokemon trainers calculate the attributes of their Pokemon, in the Pokemon Sword & Shield games for Nintendo Switch." />
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFFJREFUOMu1kjEOACAIA/ng/f87Lo4WimgTo4M9G0vEWexlCbG3hDiPE5A81E5DcVeaEJ9KBcAAxFdABsFtBSOJVV0KYAq46Zuno2xNl2tsmxeYhhbdfJzuqAAAAABJRU5ErkJggg==" />
<style title="default" media="all" type="text/css">
body {
background: #b5bdb9;
margin: 0;
padding: 0;
text-align: center;
}
#calculator * { /* global styles */
font: 12px Verdana, Geneva, Kalimati, sans-serif;
-moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-background-clip: padding-box !important;
border-radius: 3px;
border-color: inherit;
line-height: 14px;
margin: 0;
padding: 0;
}
#calculator {
background: #b5bdb9;
border-bottom: 1px dotted; /* remove this when including */
border-color: #838986; /* universal border color */
color: #3e4340;
padding-top: 15px;
text-align: center;
/*text-shadow: #b5bdb9 1px 1px 0px;
text-shadow: rgba(255, 255, 255, 0.5) 1px 1px 0px;*/
}
#calculator ::-moz-selection { background:#e4287c; color:#fff; }
#calculator ::selection { background:#e4287c; color:#fff; }
#calculator strong { font-weight: bold !important; }
#calculator em { font-style: italic !important; }
#calculator img { border: none; }
#calculator input, #calculator select {
background-color: #fff;
border: 1px solid;
border-color: #737b76; /* universal input color */
color: #000;
padding: 1px;
text-align: right;
text-shadow: none;
-moz-transition: border-color 0.2s ease-in-out;
-webkit-transition: border-color 0.2s ease-in-out;
-o-transition: border-color 0.2s ease-in-out;
transition: border-color 0.2s ease-in-out;
}
#calculator select {
height: 18px;
text-align: left;
width: 100%;
}
#calculator optgroup {
font-weight: bold;
margin: 4px 0 0 0;
}
#calculator option { padding: 0 0 0 4px; }
#calculator #pot1 { height: auto; }
#calculator input:focus, #calculator select:focus {
outline: 3px double #e4287c;
border-color: #fff;
-moz-border-radius: 0 !important;
-webkit-border-radius: 0 !important;
border-radius: 0 !important;
position: relative;
text-decoration: none;
}
#calculator .radio {
-moz-border-radius: 10px !important;
-webkit-border-radius: 10px !important;
border-radius: 10px !important;
}
#calculator a {
color: inherit;
font-style: italic;
text-decoration: none;
}
#calculator table {
border-collapse: collapse;
border-spacing: 0;
table-layout: fixed;
width: 100%;
}
#calculator td {
padding: 3px;
text-align: center;
}
#calculator dt, #calculator #documentation h3 {
font-weight: bold !important;
text-align: left;
}
#calculator p, #calculator dd, #calculator li {
text-align: left;
margin: 3px 0 3px 15px !important;
}
#calculator h1 {
font: small-caps bold 15px sans-serif !important;
margin: 3px;
}
#calculator h2 {
border-bottom: 1px dotted;
font: bold 11px Verdana, Geneva, Kalimati, sans-serif;
text-align: left;
text-transform: uppercase;
}
#calculator h3 {
border-bottom: 1px dotted;
font: small-caps bold 12px Verdana, Geneva, Kalimati, sans-serif;
}
#calculator #documentation h3 { margin: 5px 0 0 0; }
#calculator #documentation h2 { margin: 10px 0 3px 0; }
#calculator h4 {
font: bold 11px Arial, sans-serif;
text-align: right !important;
}
#calculator #head td { vertical-align: middle; }
#calculator #documentation td { padding: 0 5px !important; }
#calculator #documentation a { text-shadow: 1px 1px 2px #3e4340; color: #fff; }
#calculator #documentation a:hover { color: #e4287c; }
#toggleinstructions, #togglehistory, #toggleinfo, .button, .btn { cursor: pointer; }
#status { cursor: text; }
#controls {
border-top: 2px dotted;
border-color: inherit;
}
#bar {
border-bottom: 2px solid;
border-top: 1px dashed;
border-color: inherit;
}
#nickname {
background: none !important;
color: #3e4340 !important;
border-style: dotted !important;
}
#calculator .loading {
background: url('data:image/png;base64,R0lGODlhDwAPAIABAP///////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJGQABACwAAAAADwAPAAACGoyPqQGLzQx00c0q6aU47c+F4vaImheS5lEAACH5BAkZAAEALAAAAAAPAA8AAAIZjI+pAYv9nIwOzjutAbxrDFLLF24JeZZLAQAh+QQJGQABACwAAAAADwAPAAACGIyPqQGL/ZyMDs47rdGs4i1pYnhBZvlJBQAh+QQFGQABACwAAAAADwAPAAACGYyPqQGL/ZyMDs47gd7WdAxSyxd6CXmWSwEAOw==') 50% 100% no-repeat;
display: inline-block;
padding: 0 0 25px 0;
}
#calculator .button {
background: #ced2d0 url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAWCAYAAAABxvaqAAAAGUlEQVQY02P8////GUYg8YxkogFOMBBLAACNTUydrXmzbAAAAABJRU5ErkJggg==') 50% 50% repeat-x;
border: 2px solid;
color: #606762;
font-size: 10px;
font-weight: bold;
height: 25px;
text-align: center;
text-shadow: 1px 1px 1px #fff;
width: 100%;
}
#calculator .button:focus, #calculator .button:active {
background-image: none;
border-color: #e4287c;
}
#calculator input:disabled {
background: none;
border-width: 1px;
border-style: dashed;
box-shadow: none !important;
text-shadow: none !important;
}
#calculator .button:hover { border-color: #e4287c; }
#calculator .btn { font-weight: bold !important; }
#calculator .block {
border: 2px solid;
border-color: inherit;
background: #9aa7a0; /* primary color */
margin: 0 auto 20px auto !important;
width: 750px;
}
#calculator .primary {
border-right: 2px solid;
border-color: inherit;
vertical-align: top;
width: 57% !important;
}
#calculator .secondary {
background: #8e9892; /* secondary color */
border-color: inherit;
vertical-align: top;
}
#calculator .top { vertical-align: top !important; }
#calculator .left { text-align: left !important; }
#calculator .center {
text-align: center !important;
vertical-align: middle !important;
}
#calculator .right {
text-align: right !important;
vertical-align: top !important;
padding-right: 6px !important;
}
#calculator #tooltip {
background: #eee;
border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -webkit-background-clip: padding-box !important;
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5);
color: #777;
display: none;
font-size: 9px;
margin: 0 30px;
padding: 3px;
text-align: left;
text-shadow: none;
position: absolute;
z-index: 1000;
}
#calculator .error {
color: #f00 !important;
border-color: #f00 !important;
font-weight: bold !important;
text-shadow: rgba(0, 0, 0, 0.5) 1px 1px 1px !important;
}
#calculator .ok {
color: #8d6 !important;
font-weight: bold !important;
text-shadow: rgba(0, 0, 0, 0.5) 1px 1px 1px !important;
}
#calculator .new {
background: #eee;
color: #000;
}
#calculator #sprite img {
image-rendering: crisp-edges;
max-height: 120px;
max-width : 120px;
height: 80px;
width : 80px;
}
/* SPP Theme */
.spp { background: #383838 !important; }
.spp * { border-color: #404040 !important; text-shadow: none !important; }
.spp ::-moz-selection { background:#cb7 !important; color:#444 !important; }
.spp ::selection { background:#cb7 !important; color:#444 !important; }
.spp #documentation a { border-bottom: 1px solid #cb7 !important; }
.spp #documentation a:hover { color: #cb7 !important; }
.spp #bar, .spp #controls { border: none; }
.spp table { border-collapse: separate !important; border-spacing: 3px !important; }
.spp .block, .spp .primary, .spp #documentation .secondary { background: #404040 !important; border: none; color: #fff !important; }
.spp .secondary { background: #6f9a4c !important; color: #444; border-radius: 5px !important; }
.spp input, .spp select { background: #cb7 !important; border-color: #3b3b3b !important; color: #444 !important; }
.spp input:focus, .spp select:focus { outline: 3px solid #8d6 !important; border-color: #8d6 !important; -moz-border-radius: 0 !important; -webkit-border-radius: 0 !important; border-radius: 0 !important; text-decoration: none; position: relative; }
.spp .button:hover { border-color: #8d6 !important; color: #000 !important; }
.spp .button:disabled { background: none !important; }
.spp .new { background: #ba6 !important; }
/* isotope Theme */
.isotope { background: #4c7da2 !important; }
.isotope * { border-color: #f0f0f0 !important; color: #2d2e2f !important; text-shadow: none !important; }
.isotope ::-moz-selection { color: #000 !important; background: #b6d796 !important; }
.isotope ::selection { color: #000 !important; background: #b6d796!important; }
.isotope #documentation a { color: #47a4fb !important; }
.isotope #documentation a:hover { color: #b5d594 !important; }
.isotope table { border-collapse: separate !important; border-spacing: 3px !important; }
.isotope .block { background: #f0f0f0 !important; border: 4px solid #f0f0f0 !important; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); }
.isotope .primary { background: #f0f0f0 !important; }
.isotope .secondary { background: #e9e9e9 !important; border: 2px solid #e9e9e9 !important; border-radius: 5px !important; -moz-border-radius: 4px; -webkit-border-radius: 4px; }
.isotope #bar { background: #b6d796 !important; border: 2px solid #aacd8b !important; border-radius: 5px !important; -moz-border-radius: 4px; -webkit-border-radius: 4px; }
.isotope input, .isotope select { border-color: #d6d6d6 !important; color: #000 !important; }
.isotope #controls { border: none !important; background: none !important; }
.isotope .button { background: #dfdfdf !important; border-color: #888 !important; color: #555 !important; }
.isotope input:focus, .isotope select:focus { outline: 3px double #b5d594 !important; border-color: #47a4fb !important; -moz-border-radius: 0 !important; -webkit-border-radius: 0 !important; border-radius: 0 !important; text-decoration: none; position: relative; }
.isotope .button:hover { border-color: #47a4fb !important; color: #000 !important; }
.isotope input:disabled { background: none !important; }
.isotope h1, .isotope h2, .isotope h3 { border: none !important; font-family: Century Gothic, Andale Mono, Futura, sans-serif !important; }
/* Simplex Theme */
.simplex .ext { display: none; }
/* td { outline: 1px dotted red !important; } *//* DEBUG */
/* Hidding Hidden Power */
#hpt, #hiddent, #hiddenp, #btn-hp {
display: none !important;
}
</style>
<style media="print" type="text/css">
#calculator * {
background: #fff;
border: none !important;
box-shadow: 0px 0px 0px #ffffff !important; -moz-box-shadow: 0px 0px 0px #ffffff !important; -webkit-box-shadow: 0px 0px 0px #ffffff !important;
color: #000 !important;
text-shadow: none !important;
}
#calculator #head {
border-bottom: 3px solid #000 !important;
padding-bottom: 1em;
}
#calculator .block { width: 100%; }
#calculator #controls, #documentation, #btn-addeps, #times, #name, #charn { display: none; }
#calculator h2 { border-bottom: 1px solid #000 !important; }
</style>
<style type="text/css" id="thema">/* required for the "Colorize" functionality */</style>
</head>
<body>
<div id="calculator"> <!-- Start here if you want to include this in your page -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
/*
todo:
- change how previous/next is handled as several Pokemon are missing from SwSh
- remove redudant Hidden Power functions, currently hidden, see Hidding Hidden Power at CSS
*/
/* Generic functions */
function $() {
var elements = [];
for (var i=0, j=arguments.length; i < j; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (j == 1)
return element;
elements.push(element);
}
return elements;
}
function $c(classname, node) { //Get elements by class
if(!node) node = document.getElementsByTagName('body')[0];
var a = [];
var re = new RegExp('\\b' + classname + '\\b');
var els = node.getElementsByTagName("*");
for(var i=0, j=els.length; i<j; i++)
if(re.test(els[i].className))a.push(els[i]);
return a;
}
function event_add(obj,type,fn) {
if (obj.addEventListener) obj.addEventListener(type,fn,false );
else if (obj.attachEvent) {
obj["e"+type+fn] = fn;
obj.attachEvent( "on"+type, function() { obj["e"+type+fn](); } );
}
}
function event_del(obj,type,fn) {
if (obj.removeEventListener) obj.removeEventListener(type,fn,false);
else if (obj.detachEvent) {
obj.detachEvent( "on"+type, obj["e"+type+fn] );
obj["e"+type+fn] = null;
}
}
function cookie_create(name,value,days) {
if (location.protocol == 'data:') { return null; } //prevents security errors
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = '; expires='+date.toGMTString();
}
else var expires = '';
document.cookie = name+'='+value+expires+'; path=/';
}
function cookie_read(name) {
if (location.protocol == 'data:') { return null; }
var name = name+'=', ca = document.cookie.split(';');
for(var i=0, j=ca.length;i < j;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return null;
}
function toggle(el) {
if ( el.style.display != 'none' ) { el.style.display = 'none'; }
else { el.style.display = ''; }
}
function autocomplete(field,select,property,forcematch) { // <input/> -> <select>
var f = false;
for (var i=0, j=select.options.length; i < j; i++) {
if (select.options[i][property].toUpperCase().indexOf(field.value.toUpperCase()) == 0) {
f=true; break;
}
}
if (forcematch && !f) {
field.value = field.value.slice(0,field.value.length-1);
autocomplete(field,select,property,forcematch);
return false;
}
if (f) { select.selectedIndex = i; }
else { select.selectedIndex = 0; }
}
function vv(e,min,max,evt,r) { //Field Value Validation (numeric only)
if (r != undefined && $('act-'+r).checked == 0) { row_act(r); }
if ($(e).title == '') {
$(e).autocomplete = 'off';
$(e).title = '('+min+' - '+max+') Use up/down arrow keys to increase/decrease.';
}
var r = $(e).id.split('-')[1], v = $(e).value;
var k = window.event?event.keyCode:evt.keyCode; // alert(k); //DEBUG
switch(k) {
case 9: return false; break; //tab
case 8: return false; break; //backspace
case 46: return false; break; //delete
case 13: calc_ivs((mode==2 && act>-1?act:0)); break; //enter
case 38: //Up key, increase
$(e).value = v<max?(1*v)+1:v;
break;
case 40: //Down key, decrease
$(e).value = v>min?(1*v)-1:v;
break;
default:
$(e).value = isNaN(v)?min:Math.min(v,max);
}
}
function tooltips() { // inspired by http://qrayg.com/learn/code/qtip
if (!$('tooltip')) { var e = el_add($('calculator'),'div',{className:'a',id:'tooltip'});
event_add(document, "mousemove", function(evt) {
var de = document.documentElement;
$('tooltip').style.left = (document.all?((de && de.scrollLeft)?de.scrollLeft:document.body.scrollLeft)+window.event.clientX:evt.pageX)+'px';
$('tooltip').style.top = (document.all?((de && de.scrollTop)?de.scrollTop:document.body.scrollTop)+window.event.clientY:evt.pageY)+'px';
});
}
var elements = $c('tooltip');
var i=elements.length-1; do {
var e = elements[i];
if(e.title && !e.tooltip) {
e.tooltip = e.title;
e.title = ''; e.alt = ''; //prevent default behaviour
event_add(e, "mouseover", function() { $('tooltip').innerHTML = this.tooltip; $('tooltip').style.display = 'block'; });
event_add(e, "mouseout", function() { $('tooltip').innerHTML = ''; $('tooltip').style.display = 'none'; });
}
} while(i--);
}
function el_add(el,tag,attr,txt) { //Appends element - el_add(el,'div',{className:'a',id:'b'},'text');
var i='',e=document.createElement(tag);
if (attr) {
for (i in attr) {
e[i] = attr[i];
}
}
e.innerHTML = txt || '';
el.appendChild(e);
return e;
}
function el_del(el) { //Removes all element children of el
while (el.firstChild) {
el.removeChild(el.firstChild);
}
return this;
}
function array_intersect(a, b) { //arrays must be sorted, a and b are destructed afterwards
var r=[];
while( a.length > 0 && b.length > 0 ) {
if (a[0] < b[0] ){ a.shift(); }
else if (a[0] > b[0] ){ b.shift(); }
else {
r.push(a.shift());
b.shift();
}
}
return r;
}
if (!Array.prototype.map) {
Array.prototype.map = function(fn, thisObj) {
var scope = thisObj || window;
var a = [];
for (var i=0, j=this.length; i < j; ++i) {
a.push(fn.call(scope, this[i], i, this));
}
return a;
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(el, start) {
var start = start || 0;
for (var i=0, j=this.length; i < j; ++i) { //rewrite using while do?
if (this[i] === el ) {
return i;
}
}
return -1;
};
}
Array.prototype.sum = function() {
var sum=0,i=this.length-1; do {
sum += this[i];
} while(i--);
return sum;
};
Array.prototype.sortnum = function() {
return this.sort( function (a,b) { return a-b; } );
};
Array.prototype.style = function(p,v) {
var i=this.length-1; do {
this[i].style[p] = v;
} while(i--);
};
Array.prototype.unique = function() {
var a = [];
var l = this.length;
for(var i=0; i<l; i++) {
for(var j=i+1; j<l; j++) {
if (this[i] === this[j])
j = ++i;
}
a.push(this[i]);
}
return a;
};
/* Pokemon Data and retrieval functions */
//Pokemon Name:Number - email the author for a precompiled list of the names in other languages
pkmns='Bulbasaur:1|Ivysaur:2|Venusaur:3|Charmander:4|Charmeleon:5|Charizard:6|Squirtle:7|Wartortle:8|Blastoise:9|Caterpie:10|Metapod:11|Butterfree:12|Pikachu:25|Pikachu .1:25.1|Pikachu .2:25.2|Pikachu .3:25.3|Pikachu .4:25.4|Pikachu .5:25.5|Pikachu .6:25.6|Pikachu .7:25.7|Raichu:26|Raichu .1:26.1|Clefairy:35|Clefable:36|Vulpix:37|Vulpix .1:37.1|Ninetales:38|Ninetales .1:38.1|Oddish:43|Gloom:44|Vileplume:45|Diglett:50|Diglett .1:50.1|Dugtrio:51|Dugtrio .1:51.1|Meowth:52|Meowth .1:52.1|Meowth .2:52.2|Persian:53|Persian .1:53.1|Growlithe:58|Arcanine:59|Machop:66|Machoke:67|Machamp:68|Ponyta:77|Ponyta .1:77.1|Rapidash:78|Rapidash .1:78.1|Farfetch’d:83|Farfetch’d .1:83.1|Shellder:90|Cloyster:91|Gastly:92|Haunter:93|Gengar:94|Onix:95|Krabby:98|Kingler:99|Hitmonlee:106|Hitmonchan:107|Koffing:109|Weezing:110|Weezing .1:110.1|Rhyhorn:111|Rhydon:112|Goldeen:118|Seaking:119|Mr. Mime:122|Mr. Mime .1:122.1|Magikarp:129|Gyarados:130|Lapras:131|Ditto:132|Eevee:133|Vaporeon:134|Jolteon:135|Flareon:136|Snorlax:143|Mewtwo:150|Mew:151|Hoothoot:163|Noctowl:164|Chinchou:170|Lanturn:171|Pichu:172|Cleffa:173|Togepi:175|Togetic:176|Natu:177|Xatu:178|Bellossom:182|Sudowoodo:185|Wooper:194|Quagsire:195|Espeon:196|Umbreon:197|Wobbuffet:202|Steelix:208|Qwilfish:211|Shuckle:213|Sneasel:215|Swinub:220|Piloswine:221|Corsola:222|Corsola .1:222.1|Remoraid:223|Octillery:224|Delibird:225|Mantine:226|Tyrogue:236|Hitmontop:237|Larvitar:246|Pupitar:247|Tyranitar:248|Celebi:251|Zigzagoon:263|Zigzagoon .1:263.1|Linoone:264|Linoone .1:264.1|Lotad:270|Lombre:271|Ludicolo:272|Seedot:273|Nuzleaf:274|Shiftry:275|Wingull:278|Pelipper:279|Ralts:280|Kirlia:281|Gardevoir:282|Nincada:290|Ninjask:291|Shedinja:292|Sableye:302|Mawile:303|Electrike:309|Manectric:310|Roselia:315|Wailmer:320|Wailord:321|Torkoal:324|Trapinch:328|Vibrava:329|Flygon:330|Lunatone:337|Solrock:338|Barboach:339|Whiscash:340|Corphish:341|Crawdaunt:342|Baltoy:343|Claydol:344|Feebas:349|Milotic:350|Duskull:355|Dusclops:356|Wynaut:360|Snorunt:361|Glalie:362|Jirachi:385|Budew:406|Roserade:407|Combee:415|Vespiquen:416|Cherubi:420|Cherrim:421|Cherrim .1:421.1|Shellos:422|Shellos .1:422.1|Gastrodon:423|Gastrodon .1:423.2|Drifloon:425|Drifblim:426|Stunky:434|Skuntank:435|Bronzor:436|Bronzong:437|Bonsly:438|Mime Jr.:439|Munchlax:446|Riolu:447|Lucario:448|Hippopotas:449|Hippowdon:450|Skorupi:451|Drapion:452|Croagunk:453|Toxicroak:454|Mantyke:458|Snover:459|Abomasnow:460|Weavile:461|Rhyperior:464|Togekiss:468|Leafeon:470|Glaceon:471|Mamoswine:473|Gallade:475|Dusknoir:477|Froslass:478|Rotom:479|Rotom .1:479.1|Rotom .2:479.2|Rotom .3:479.3|Rotom .4:479.4|Rotom .5:479.5|Purrloin:509|Liepard:510|Munna:517|Musharna:518|Pidove:519|Tranquill:520|Unfezant:521|Roggenrola:524|Boldore:525|Gigalith:526|Woobat:527|Swoobat:528|Drilbur:529|Excadrill:530|Timburr:532|Gurdurr:533|Conkeldurr:534|Tympole:535|Palpitoad:536|Seismitoad:537|Throh:538|Sawk:539|Cottonee:546|Whimsicott:547|Basculin:550|Basculin .1:550.1|Darumaka:554|Darumaka 1:993|Darmanitan:555|Darmanitan .1:555.1|Darmanitan .2:555.2|Darmanitan .3:555.3|Maractus:556|Dwebble:557|Crustle:558|Scraggy:559|Scrafty:560|Sigilyph:561|Yamask:562|Yamask .1:562.1|Cofagrigus:563|Trubbish:568|Garbodor:569|Minccino:572|Cinccino:573|Gothita:574|Gothorita:575|Gothitelle:576|Solosis:577|Duosion:578|Reuniclus:579|Vanillite:582|Vanillish:583|Vanilluxe:584|Karrablast:588|Escavalier:589|Frillish:592|Jellicent:593|Joltik:595|Galvantula:596|Ferroseed:597|Ferrothorn:598|Klink:599|Klang:600|Klinklang:601|Elgyem:605|Beheeyem:606|Litwick:607|Lampent:608|Chandelure:609|Axew:610|Fraxure:611|Haxorus:612|Cubchoo:613|Beartic:614|Shelmet:616|Accelgor:617|Stunfisk:618|Stunfisk .1:618.1|Golett:622|Golurk:623|Pawniard:624|Bisharp:625|Rufflet:627|Braviary:628|Vullaby:629|Mandibuzz:630|Heatmor:631|Durant:632|Deino:633|Zweilous:634|Hydreigon:635|Cobalion:638|Terrakion:639|Virizion:640|Reshiram:643|Zekrom:644|Kyurem:646|Kyurem .1:646.1|Kyurem .2:646.2|Keldeo:647|Keldeo .1:647.1|Bunnelby:659|Diggersby:660|Pancham:674|Pangoro:675|Espurr:677|Meowstic:678|Meowstic .1:678.1|Honedge:679|Doublade:680|Aegislash:681|Aegislash .1:681.1|Spritzee:682|Aromatisse:683|Swirlix:684|Slurpuff:685|Inkay:686|Malamar:687|Binacle:688|Barbaracle:689|Helioptile:694|Heliolisk:695|Sylveon:700|Hawlucha:701|Goomy:704|Sliggoo:705|Goodra:706|Phantump:708|Trevenant:709|Pumpkaboo:710|Pumpkaboo .1:710.1|Pumpkaboo .2:710.2|Pumpkaboo .3:710.3|Gourgeist:711|Gourgeist .1:711.1|Gourgeist .2:711.2|Gourgeist .3:711.3|Bergmite:712|Avalugg:713|Noibat:714|Noivern:715|Rowlet:722|Dartrix:723|Decidueye:724|Litten:725|Torracat:726|Incineroar:727|Popplio:728|Brionne:729|Primarina:730|Grubbin:736|Charjabug:737|Vikavolt:738|Cutiefly:742|Ribombee:743|Wishiwashi:746|Wishiwashi .1:746.1|Mareanie:747|Toxapex:748|Mudbray:749|Mudsdale:750|Dewpider:751|Araquanid:752|Morelull:755|Shiinotic:756|Salandit:757|Salazzle:758|Stufful:759|Bewear:760|Bounsweet:761|Steenee:762|Tsareena:763|Oranguru:765|Passimian:766|Wimpod:767|Golisopod:768|Pyukumuku:771|Type: Null:772|Silvally:773|Silvally .1:773.1|Silvally .2:773.2|Silvally .3:773.3|Silvally .4:773.4|Silvally .5:773.5|Silvally .6:773.6|Silvally .7:773.7|Silvally .8:773.8|Silvally .9:773.9|Silvally .10:773.10|Silvally .11:773.11|Silvally .12:773.12|Silvally .13:773.13|Silvally .14:773.14|Silvally .15:773.15|Silvally .16:773.16|Silvally .17:773.17|Turtonator:776|Togedemaru:777|Mimikyu:778|Mimikyu .1:778.1|Drampa:780|Dhelmise:781|Jangmo-o:782|Hakamo-o:783|Kommo-o:784|Cosmog:789|Cosmoem:790|Solgaleo:791|Lunala:792|Necrozma:800|Necrozma .1:800.1|Necrozma .2:800.2|Marshadow:802|Zeraora:807|Meltan:808|Melmetal:809|Grookey:810|Thwackey:811|Rillaboom:812|Scorbunny:813|Raboot:814|Cinderace:815|Sobble:816|Drizzile:817|Inteleon:818|Skwovet:819|Greedent:820|Rookidee:821|Corvisquire:822|Corviknight:823|Blipbug:824|Dottler:825|Orbeetle:826|Nickit:827|Thievul:828|Gossifleur:829|Eldegoss:830|Wooloo:831|Dubwool:832|Chewtle:833|Drednaw:834|Yamper:835|Boltund:836|Rolycoly:837|Carkol:838|Coalossal:839|Applin:840|Flapple:841|Appletun:842|Silicobra:843|Sandaconda:844|Cramorant:845|Cramorant .1:845.1|Cramorant .2:845.2|Arrokuda:846|Barraskewda:847|Toxel:848|Toxtricity:849|Toxtricity 1:1154|Sizzlipede:850|Centiskorch:851|Clobbopus:852|Grapploct:853|Sinistea:854|Sinistea .1:854.1|Polteageist:855|Polteageist .1:855.1|Hatenna:856|Hattrem:857|Hatterene:858|Impidimp:859|Morgrem:860|Grimmsnarl:861|Obstagoon:862|Perrserker:863|Cursola:864|Sirfetch’d:865|Mr. Rime:866|Runerigus:867|Milcery:868|Alcremie:869|Alcremie .1:869.1|Alcremie .2:869.2|Alcremie .3:869.3|Alcremie .4:869.4|Alcremie .5:869.5|Alcremie .6:869.6|Alcremie .7:869.7|Alcremie .8:869.8|Falinks:870|Pincurchin:871|Snom:872|Frosmoth:873|Stonjourner:874|Eiscue:875|Eiscue .1:875.1|Indeedee:876|Indeedee .1:876.1|Morpeko:877|Morpeko .1:877.1|Cufant:878|Copperajah:879|Dracozolt:880|Arctozolt:881|Dracovish:882|Arctovish:883|Duraludon:884|Dreepy:885|Drakloak:886|Dragapult:887|Zacian:888|Zacian .1:888.1|Zamazenta:889|Zamazenta .1:889.1|Eternatus:890|Eternatus .1:890.1';
//Compressed Pokemon data: HP/ATK/DEF/SP.ATK/SP.DEF/SPD/Type1/Type2/Egg1/Egg2/EPs2/EPs1 - national order + forms
pkmn=' ';
//Decompression Arrays
pk='00,05,0a,01,04,02,32,3c,03,0f,46,08,0b,41,50,37,28,2d,64,5a,0c,4b,55,06,5f,09,07,0d,10,1e,23,0e,40,69,6e,78,80,11,20,14,30,73,82,19,7d,96,3f,3a,48,3e,44,2c,4e,53,43,34,87,56,4d,4c,8c,2b,38,42,4f,3d,47,2a,49,35,5c,39,3b,45,51,26,5b,4a,29,6c,52,36,a0,31,6b,62,54,c0,91,61,6a,25,24,59,2e,6d,b4,67,2f,57,33,65,63,58,17,27,7b,68,70,18,74,7a,21,1c,5e,a5,aa,1f,22,66,1d,83,81,6f,9a,5d,7e,72,79,e6,c8,1b,76,75,84,60,86,16,7c,71,9b,be,fa,ff,90,a8,8a,85,93,77,b8,7f,9f,af,c2,b9,a4,88,98,8e,89,8b,b5,df,99,84,d8,ad,97,d3,8f,9d,a7'; pk=pk.split(',');
mn=' !"#$&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~%αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩςάέήίόύώϊϋΐàáâãäåæçèéêëìíîïðñòóô'; mn=mn.split(''); base=[];
forms_after = 890; // this is the last number in the National Dex, 807 in S&M
forms = {25.1:893,25.2:894,25.3:895,25.4:896,25.5:897,25.6:898,25.7:899,26.1:900,37.1:903,38.1:904,50.1:905,51.1:906,52.1:907,52.2:908,53.1:909,77.1:913,78.1:914,83.1:915,110.1:920,122.1:921,222.1:949,263.1:950,264.1:951,421.1:965,422.1:966,423.2:967,479.1:968,479.2:969,479.3:970,479.4:971,479.5:972,550.1:992,555.1:994,555.2:995,555.3:996,562.1:997,618.1:1004,646.1:1008,646.2:1009,647.1:1010,678.1:1097,681.1:1098,710.1:1099,710.2:1100,710.3:1101,711.1:1102,711.2:1103,711.3:1104,746.1:1117,773.1:1118,773.2:1119,773.3:1120,773.4:1121,773.5:1122,773.6:1123,773.7:1124,773.8:1125,773.9:1126,773.10:1127,773.11:1128,773.12:1129,773.13:1130,773.14:1131,773.15:1132,773.16:1133,773.17:1134,778.1:1148,800.1:1149,800.2:1150,845.1:1152,845.2:1153,854.1:1155,855.1:1156,869.1:1157,869.2:1158,869.3:1159,869.4:1160,869.5:1161,869.6:1162,869.7:1163,869.8:1164,875.1:1165,876.1:1166,877.1:1167,888.1:1168,889.1:1169,890.1:1170};
function get_base(p,s) { //Returns values from pkmn
if (p.indexOf('.') > -1) {
p = forms[p];
}
if (!base[p]) {
base[p]=pkmn.slice(12*p,12*p+12).split('').map(function(v,i){v=pk[mn.indexOf(v)];if(i<10)v=parseInt(v,16);return v});
base[p].push(('000000000000000'+parseInt(base[p].pop()+''+base[p].pop(),16).toString(2)).split('').reverse().join('').substr(0,12).split('').reverse().join('').match(new RegExp(".{1,"+2+"}", "g")).reverse().map(function (v) { return parseInt(v,2); }));
base[p][10].push(base[p][10].splice(3,1)[0]);
}
return base[p][s];
}
//Add a custom Pokemon by modifying and un-commenting the following lines.
//Format is HP,ATK,DEF,SP.ATK,SP.DEF,SPD,Type1,Type2,Egg1,Egg2,[HP EPs,ATK EPs,DEF EPs,SP.ATK EPs,SP.DEF EPs,SPD EPs]
/*
pkmns = pkmns+'|Bulbasaur:1';
base[1] = [45, 49, 49, 65, 65, 45, 12, 3, 1, 7,[0, 0, 0, 1, 0, 0]];
*/
base[1]=[45,49,49,65,65,45,11,3,1,7,[0,0,0,1,0,0]];base[2]=[60,62,63,80,80,60,11,3,1,7,[0,0,0,1,1,0]];base[3]=[80,82,83,100,100,80,11,3,1,7,[0,0,0,2,1,0]];base[4]=[39,52,43,60,50,65,9,9,1,14,[0,0,0,0,0,1]];base[5]=[58,64,58,80,65,80,9,9,1,14,[0,0,0,1,0,1]];base[6]=[78,84,78,109,85,100,9,2,1,14,[0,0,0,3,0,0]];base[7]=[44,48,65,50,64,43,10,10,1,2,[0,0,1,0,0,0]];base[8]=[59,63,80,65,80,58,10,10,1,2,[0,0,1,0,1,0]];base[9]=[79,83,100,85,105,78,10,10,1,2,[0,0,0,0,3,0]];base[10]=[45,30,35,20,20,45,6,6,3,3,[1,0,0,0,0,0]];base[11]=[50,20,55,25,25,30,6,6,3,3,[0,0,2,0,0,0]];base[12]=[60,45,50,90,80,70,6,2,3,3,[0,0,0,2,1,0]];base[25]=[35,55,40,50,50,90,12,12,5,6,[0,0,0,0,0,2]];base[893]=[35,55,40,50,50,90,12,12,15,15,[0,0,0,0,0,2]];base[894]=[35,55,40,50,50,90,12,12,15,15,[0,0,0,0,0,2]];base[895]=[35,55,40,50,50,90,12,12,15,15,[0,0,0,0,0,2]];base[896]=[35,55,40,50,50,90,12,12,15,15,[0,0,0,0,0,2]];base[897]=[35,55,40,50,50,90,12,12,15,15,[0,0,0,0,0,2]];base[898]=[35,55,40,50,50,90,12,12,15,15,[0,0,0,0,0,2]];base[899]=[35,55,40,50,50,90,12,12,15,15,[0,0,0,0,0,2]];base[26]=[60,90,55,90,80,110,12,12,5,6,[0,0,0,0,0,3]];base[900]=[60,85,50,95,85,110,12,13,5,6,[0,0,0,0,0,3]];base[35]=[70,45,48,60,65,35,17,17,6,6,[2,0,0,0,0,0]];base[36]=[95,70,73,95,90,60,17,17,6,6,[3,0,0,0,0,0]];base[37]=[38,41,40,50,65,65,9,9,5,5,[0,0,0,0,0,1]];base[903]=[38,41,40,50,65,65,14,14,5,5,[0,0,0,0,0,1]];base[38]=[73,76,75,81,100,100,9,9,5,5,[0,0,0,0,1,1]];base[904]=[73,67,75,81,100,109,14,17,5,5,[0,0,0,0,0,2]];base[43]=[45,50,55,75,65,30,11,3,7,7,[0,0,0,1,0,0]];base[44]=[60,65,70,85,75,40,11,3,7,7,[0,0,0,2,0,0]];base[45]=[75,80,85,110,90,50,11,3,7,7,[0,0,0,3,0,0]];base[50]=[10,55,25,35,45,95,4,4,5,5,[0,0,0,0,0,1]];base[905]=[10,55,30,35,45,90,4,8,5,5,[0,0,0,0,0,1]];base[51]=[35,100,50,50,70,120,4,4,5,5,[0,0,0,0,0,2]];base[906]=[35,100,60,50,70,110,4,8,5,5,[0,2,0,0,0,0]];base[52]=[40,45,35,40,40,90,0,0,5,5,[0,0,0,0,0,1]];base[907]=[40,35,35,50,40,90,16,16,5,5,[0,0,0,0,0,1]];base[908]=[50,65,55,40,40,40,8,8,5,5,[0,1,0,0,0,0]];base[53]=[65,70,60,65,65,115,0,0,5,5,[0,0,0,0,0,2]];base[909]=[65,60,60,75,65,115,16,16,5,5,[0,0,0,0,0,2]];base[58]=[55,70,45,70,50,60,9,9,5,5,[0,1,0,0,0,0]];base[59]=[90,110,80,100,80,95,9,9,5,5,[0,2,0,0,0,0]];base[66]=[70,80,50,35,35,35,1,1,8,8,[0,1,0,0,0,0]];base[67]=[80,100,70,50,60,45,1,1,8,8,[0,2,0,0,0,0]];base[68]=[90,130,80,65,85,55,1,1,8,8,[0,3,0,0,0,0]];base[77]=[50,85,55,65,65,90,9,9,5,5,[0,0,0,0,0,1]];base[913]=[50,85,55,65,65,90,13,13,5,5,[0,0,0,0,0,1]];base[78]=[65,100,70,80,80,105,9,9,5,5,[0,0,0,0,0,2]];base[914]=[65,100,70,80,80,105,13,17,5,5,[0,0,0,0,0,2]];base[83]=[52,90,55,58,62,60,0,2,4,5,[0,1,0,0,0,0]];base[915]=[52,95,55,58,62,55,1,1,4,5,[0,1,0,0,0,0]];base[90]=[30,65,100,45,25,40,10,10,9,9,[0,0,1,0,0,0]];base[91]=[50,95,180,85,45,70,10,14,9,9,[0,0,2,0,0,0]];base[92]=[30,35,30,100,35,80,7,3,11,11,[0,0,0,1,0,0]];base[93]=[45,50,45,115,55,95,7,3,11,11,[0,0,0,2,0,0]];base[94]=[60,65,60,130,75,110,7,3,11,11,[0,0,0,3,0,0]];base[95]=[35,45,160,30,45,70,5,4,10,10,[0,0,1,0,0,0]];base[98]=[30,105,90,25,25,50,10,10,9,9,[0,1,0,0,0,0]];base[99]=[55,130,115,50,50,75,10,10,9,9,[0,2,0,0,0,0]];base[106]=[50,120,53,35,110,87,1,1,8,8,[0,2,0,0,0,0]];base[107]=[50,105,79,35,110,76,1,1,8,8,[0,0,0,0,2,0]];base[109]=[40,65,95,60,45,35,3,3,11,11,[0,0,1,0,0,0]];base[110]=[65,90,120,85,70,60,3,3,11,11,[0,0,2,0,0,0]];base[920]=[65,90,120,85,70,60,3,17,11,11,[0,0,2,0,0,0]];base[111]=[80,85,95,30,30,25,4,5,1,5,[0,0,1,0,0,0]];base[112]=[105,130,120,45,45,40,4,5,1,5,[0,2,0,0,0,0]];base[118]=[45,67,60,35,50,63,10,10,12,12,[0,1,0,0,0,0]];base[119]=[80,92,65,65,80,68,10,10,12,12,[0,2,0,0,0,0]];base[122]=[40,45,65,100,120,90,13,17,8,8,[0,0,0,0,2,0]];base[921]=[50,65,65,90,90,100,14,13,8,8,[0,0,0,0,0,2]];base[129]=[20,10,55,15,20,80,10,10,12,14,[0,0,0,0,0,1]];base[130]=[95,125,79,60,100,81,10,2,12,14,[0,2,0,0,0,0]];base[131]=[130,85,80,85,95,60,10,14,1,2,[2,0,0,0,0,0]];base[132]=[48,48,48,48,48,48,0,0,13,13,[1,0,0,0,0,0]];base[133]=[55,55,50,45,65,55,0,0,5,5,[0,0,0,0,1,0]];base[134]=[130,65,60,110,95,65,10,10,5,5,[2,0,0,0,0,0]];base[135]=[65,65,60,110,95,130,12,12,5,5,[0,0,0,0,0,2]];base[136]=[65,130,60,95,110,65,9,9,5,5,[0,2,0,0,0,0]];base[143]=[160,110,65,65,110,30,0,0,1,1,[2,0,0,0,0,0]];base[150]=[106,110,90,154,90,130,13,13,15,15,[0,0,0,3,0,0]];base[151]=[100,100,100,100,100,100,13,13,15,15,[3,0,0,0,0,0]];base[163]=[60,30,30,36,56,50,0,2,4,4,[1,0,0,0,0,0]];base[164]=[100,50,50,86,96,70,0,2,4,4,[2,0,0,0,0,0]];base[170]=[75,38,38,56,56,67,10,12,12,12,[1,0,0,0,0,0]];base[171]=[125,58,58,76,76,67,10,12,12,12,[2,0,0,0,0,0]];base[172]=[20,40,15,35,35,60,12,12,15,15,[0,0,0,0,0,1]];base[173]=[50,25,28,45,55,15,17,17,15,15,[0,0,0,0,1,0]];base[175]=[35,20,65,40,65,20,17,17,15,15,[0,0,0,0,1,0]];base[176]=[55,40,85,80,105,40,17,2,4,6,[0,0,0,0,2,0]];base[177]=[40,50,45,70,45,70,13,2,4,4,[0,0,0,1,0,0]];base[178]=[65,75,70,95,70,95,13,2,4,4,[0,0,0,1,0,1]];base[182]=[75,80,95,90,100,50,11,11,7,7,[0,0,0,0,3,0]];base[185]=[70,100,115,30,65,30,5,5,10,10,[0,0,2,0,0,0]];base[194]=[55,45,45,25,25,15,10,4,2,5,[1,0,0,0,0,0]];base[195]=[95,85,85,65,65,35,10,4,2,5,[2,0,0,0,0,0]];base[196]=[65,65,60,130,95,110,13,13,5,5,[0,0,0,2,0,0]];base[197]=[95,65,110,60,130,65,16,16,5,5,[0,0,0,0,2,0]];base[202]=[190,33,58,33,58,33,13,13,11,11,[2,0,0,0,0,0]];base[208]=[75,85,200,55,65,30,8,4,10,10,[0,0,2,0,0,0]];base[211]=[65,95,85,55,55,85,10,3,12,12,[0,1,0,0,0,0]];base[213]=[20,10,230,10,230,5,6,5,3,3,[0,0,1,0,1,0]];base[215]=[55,95,55,35,75,115,16,14,5,5,[0,0,0,0,0,1]];base[220]=[50,50,40,30,30,50,14,4,5,5,[0,1,0,0,0,0]];base[221]=[100,100,80,60,60,50,14,4,5,5,[1,1,0,0,0,0]];base[222]=[65,55,95,65,95,35,10,5,2,9,[0,0,1,0,1,0]];base[949]=[60,55,100,65,100,30,7,7,2,9,[0,0,0,0,1,0]];base[223]=[35,65,35,65,35,65,10,10,2,12,[0,0,0,1,0,0]];base[224]=[75,105,75,105,75,45,10,10,2,12,[0,1,0,1,0,0]];base[225]=[45,55,45,65,45,75,14,2,2,5,[0,0,0,0,0,1]];base[226]=[85,40,70,80,140,70,10,2,2,2,[0,0,0,0,2,0]];base[236]=[35,35,35,35,35,35,1,1,15,15,[0,1,0,0,0,0]];base[237]=[50,95,95,35,110,70,1,1,8,8,[0,0,0,0,2,0]];base[246]=[50,64,50,45,50,41,5,4,1,1,[0,1,0,0,0,0]];base[247]=[70,84,70,65,70,51,5,4,1,1,[0,2,0,0,0,0]];base[248]=[100,134,110,95,100,61,5,16,1,1,[0,3,0,0,0,0]];base[251]=[100,100,100,100,100,100,13,11,15,15,[3,0,0,0,0,0]];base[263]=[38,30,41,30,41,60,0,0,5,5,[0,0,0,0,0,1]];base[950]=[38,30,41,30,41,60,16,0,5,5,[0,0,0,0,0,1]];base[264]=[78,70,61,50,61,100,0,0,5,5,[0,0,0,0,0,2]];base[951]=[78,70,61,50,61,100,16,0,5,5,[0,0,0,0,0,2]];base[270]=[40,30,30,40,50,30,10,11,2,7,[0,0,0,0,1,0]];base[271]=[60,50,50,60,70,50,10,11,2,7,[0,0,0,0,2,0]];base[272]=[80,70,70,90,100,70,10,11,2,7,[0,0,0,0,3,0]];base[273]=[40,40,50,30,30,30,11,11,5,7,[0,0,1,0,0,0]];base[274]=[70,70,40,60,40,60,11,16,5,7,[0,2,0,0,0,0]];base[275]=[90,100,60,90,60,80,11,16,5,7,[0,3,0,0,0,0]];base[278]=[40,30,30,55,30,85,10,2,2,4,[0,0,0,0,0,1]];base[279]=[60,50,100,95,70,65,10,2,2,4,[0,0,2,0,0,0]];base[280]=[28,25,25,45,35,40,13,17,8,11,[0,0,0,1,0,0]];base[281]=[38,35,35,65,55,50,13,17,8,11,[0,0,0,2,0,0]];base[282]=[68,65,65,125,115,80,13,17,8,11,[0,0,0,3,0,0]];base[290]=[31,45,90,30,30,40,6,4,3,3,[0,0,1,0,0,0]];base[291]=[61,90,45,50,50,160,6,2,3,3,[0,0,0,0,0,2]];base[292]=[1,90,45,30,30,40,6,7,10,10,[2,0,0,0,0,0]];base[302]=[50,75,75,65,65,50,16,7,8,8,[0,1,1,0,0,0]];base[303]=[50,85,85,55,55,50,8,17,5,6,[0,1,1,0,0,0]];base[309]=[40,45,40,65,40,65,12,12,5,5,[0,0,0,0,0,1]];base[310]=[70,75,60,105,60,105,12,12,5,5,[0,0,0,0,0,2]];base[315]=[50,60,45,100,80,65,11,3,6,7,[0,0,0,2,0,0]];base[320]=[130,70,35,70,35,60,10,10,5,12,[1,0,0,0,0,0]];base[321]=[170,90,45,90,45,60,10,10,5,12,[2,0,0,0,0,0]];base[324]=[70,85,140,85,70,20,9,9,5,5,[0,0,2,0,0,0]];base[328]=[45,100,45,45,45,10,4,4,3,14,[0,1,0,0,0,0]];base[329]=[50,70,50,50,50,70,4,15,3,14,[0,1,0,0,0,1]];base[330]=[80,100,80,80,80,100,4,15,3,14,[0,1,0,0,0,2]];base[337]=[90,55,65,95,85,70,5,13,10,10,[0,0,0,2,0,0]];base[338]=[90,95,85,55,65,70,5,13,10,10,[0,2,0,0,0,0]];base[339]=[50,48,43,46,41,60,10,4,12,12,[1,0,0,0,0,0]];base[340]=[110,78,73,76,71,60,10,4,12,12,[2,0,0,0,0,0]];base[341]=[43,80,65,50,35,35,10,10,2,9,[0,1,0,0,0,0]];base[342]=[63,120,85,90,55,55,10,16,2,9,[0,2,0,0,0,0]];base[343]=[40,40,55,40,70,55,4,13,10,10,[0,0,0,0,1,0]];base[344]=[60,70,105,70,120,75,4,13,10,10,[0,0,0,0,2,0]];base[349]=[20,15,20,10,55,80,10,10,2,14,[0,0,0,0,0,1]];base[350]=[95,60,79,100,125,81,10,10,2,14,[0,0,0,0,2,0]];base[355]=[20,40,90,30,90,25,7,7,11,11,[0,0,0,0,1,0]];base[356]=[40,70,130,60,130,25,7,7,11,11,[0,0,1,0,1,0]];base[360]=[95,23,48,23,48,23,13,13,15,15,[1,0,0,0,0,0]];base[361]=[50,50,50,50,50,50,14,14,6,10,[1,0,0,0,0,0]];base[362]=[80,80,80,80,80,80,14,14,6,10,[2,0,0,0,0,0]];base[385]=[100,100,100,100,100,100,8,13,15,15,[3,0,0,0,0,0]];base[406]=[40,30,35,50,70,55,11,3,15,15,[0,0,0,1,0,0]];base[407]=[60,70,65,125,105,90,11,3,6,7,[0,0,0,3,0,0]];base[415]=[30,30,42,30,42,70,6,2,3,3,[0,0,0,0,0,1]];base[416]=[70,80,102,80,102,40,6,2,3,3,[0,0,1,0,1,0]];base[420]=[45,35,45,62,53,35,11,11,6,7,[0,0,0,1,0,0]];base[421]=[70,60,70,87,78,85,11,11,6,7,[0,0,0,2,0,0]];base[965]=[70,60,70,87,78,85,11,11,6,7,[0,0,0,2,0,0]];base[422]=[76,48,48,57,62,34,10,10,2,11,[1,0,0,0,0,0]];base[966]=[76,48,48,57,62,34,10,10,2,11,[1,0,0,0,0,0]];base[423]=[111,83,68,92,82,39,10,4,2,11,[2,0,0,0,0,0]];base[967]=[111,83,68,92,82,39,10,4,2,11,[2,0,0,0,0,0]];base[425]=[90,50,34,60,44,70,7,2,11,11,[1,0,0,0,0,0]];base[426]=[150,80,44,90,54,80,7,2,11,11,[2,0,0,0,0,0]];base[434]=[63,63,47,41,41,74,3,16,5,5,[0,0,0,0,0,1]];base[435]=[103,93,67,71,61,84,3,16,5,5,[2,0,0,0,0,0]];base[436]=[57,24,86,24,86,23,8,13,10,10,[0,0,1,0,0,0]];base[437]=[67,89,116,79,116,33,8,13,10,10,[0,0,1,0,1,0]];base[438]=[50,80,95,10,45,10,5,5,15,15,[0,0,1,0,0,0]];base[439]=[20,25,45,70,90,60,13,17,15,15,[0,0,0,0,1,0]];base[446]=[135,85,40,40,85,5,0,0,15,15,[1,0,0,0,0,0]];base[447]=[40,70,40,35,40,60,1,1,15,15,[0,1,0,0,0,0]];base[448]=[70,110,70,115,70,90,1,8,5,8,[0,1,0,1,0,0]];base[449]=[68,72,78,38,42,32,4,4,5,5,[0,0,1,0,0,0]];base[450]=[108,112,118,68,72,47,4,4,5,5,[0,0,2,0,0,0]];base[451]=[40,50,90,30,55,65,3,6,3,9,[0,0,1,0,0,0]];base[452]=[70,90,110,60,75,95,3,16,3,9,[0,0,2,0,0,0]];base[453]=[48,61,40,61,40,50,3,1,8,8,[0,1,0,0,0,0]];base[454]=[83,106,65,86,65,85,3,1,8,8,[0,2,0,0,0,0]];base[458]=[45,20,50,60,120,50,10,2,15,15,[0,0,0,0,1,0]];base[459]=[60,62,50,62,60,40,11,14,1,7,[0,1,0,0,0,0]];base[460]=[90,92,75,92,85,60,11,14,1,7,[0,1,0,1,0,0]];base[461]=[70,120,65,45,85,125,16,14,5,5,[0,1,0,0,0,1]];base[464]=[115,140,130,55,55,40,4,5,1,5,[0,3,0,0,0,0]];base[468]=[85,50,95,120,115,80,17,2,4,6,[0,0,0,2,1,0]];base[470]=[65,110,130,60,65,95,11,11,5,5,[0,0,2,0,0,0]];base[471]=[65,60,110,130,95,65,14,14,5,5,[0,0,0,2,0,0]];base[473]=[110,130,80,70,60,80,14,4,5,5,[0,3,0,0,0,0]];base[475]=[68,125,65,65,115,80,13,1,8,11,[0,3,0,0,0,0]];base[477]=[45,100,135,65,135,45,7,7,11,11,[0,0,1,0,2,0]];base[478]=[70,80,70,80,70,110,14,7,6,10,[0,0,0,0,0,2]];base[479]=[50,50,77,95,77,91,12,7,11,11,[0,0,0,1,0,1]];base[968]=[50,65,107,105,107,86,12,9,11,11,[0,0,0,1,0,1]];base[969]=[50,65,107,105,107,86,12,10,11,11,[0,0,0,1,0,1]];base[970]=[50,65,107,105,107,86,12,14,11,11,[0,0,0,1,0,1]];base[971]=[50,65,107,105,107,86,12,2,11,11,[0,0,0,1,0,1]];base[972]=[50,65,107,105,107,86,12,11,11,11,[0,0,0,1,0,1]];base[509]=[41,50,37,50,37,66,16,16,5,5,[0,0,0,0,0,1]];base[510]=[64,88,50,88,50,106,16,16,5,5,[0,0,0,0,0,2]];base[517]=[76,25,45,67,55,24,13,13,5,5,[1,0,0,0,0,0]];base[518]=[116,55,85,107,95,29,13,13,5,5,[2,0,0,0,0,0]];base[519]=[50,55,50,36,30,43,0,2,4,4,[0,1,0,0,0,0]];base[520]=[62,77,62,50,42,65,0,2,4,4,[0,2,0,0,0,0]];base[521]=[80,115,80,65,55,93,0,2,4,4,[0,3,0,0,0,0]];base[524]=[55,75,85,25,25,15,5,5,10,10,[0,0,1,0,0,0]];base[525]=[70,105,105,50,40,20,5,5,10,10,[0,1,1,0,0,0]];base[526]=[85,135,130,60,80,25,5,5,10,10,[0,3,0,0,0,0]];base[527]=[65,45,43,55,43,72,13,2,5,4,[0,0,0,0,0,1]];base[528]=[67,57,55,77,55,114,13,2,5,4,[0,0,0,0,0,2]];base[529]=[60,85,40,30,45,68,4,4,5,5,[0,1,0,0,0,0]];base[530]=[110,135,60,50,65,88,4,8,5,5,[0,2,0,0,0,0]];base[532]=[75,80,55,25,35,35,1,1,8,8,[0,1,0,0,0,0]];base[533]=[85,105,85,40,50,40,1,1,8,8,[0,2,0,0,0,0]];base[534]=[105,140,95,55,65,45,1,1,8,8,[0,3,0,0,0,0]];base[535]=[50,50,40,50,40,64,10,10,2,2,[0,0,0,0,0,1]];base[536]=[75,65,55,65,55,69,10,4,2,2,[2,0,0,0,0,0]];base[537]=[105,95,75,85,75,74,10,4,2,2,[3,0,0,0,0,0]];base[538]=[120,100,85,30,85,45,1,1,8,8,[2,0,0,0,0,0]];base[539]=[75,125,75,30,75,85,1,1,8,8,[0,2,0,0,0,0]];base[546]=[40,27,60,37,50,66,11,17,7,6,[0,0,0,0,0,1]];base[547]=[60,67,85,77,75,116,11,17,7,6,[0,0,0,0,0,2]];base[550]=[70,92,65,80,55,98,10,10,12,12,[0,0,0,0,0,2]];base[992]=[70,92,65,80,55,98,10,10,12,12,[0,0,0,0,0,2]];base[554]=[70,90,45,15,45,50,9,9,5,5,[0,1,0,0,0,0]];base[993]=[70,90,45,15,45,50,14,14,5,5,[0,1,0,0,0,0]];base[555]=[105,140,55,30,55,95,9,9,5,5,[0,2,0,0,0,0]];base[994]=[105,30,105,140,105,55,9,13,5,5,[0,0,0,2,0,0]];base[995]=[105,140,55,30,55,95,14,14,5,5,[0,2,0,0,0,0]];base[996]=[105,160,55,30,55,135,14,9,5,5,[0,0,0,2,0,0]];base[556]=[75,86,67,106,67,60,11,11,7,7,[0,0,0,2,0,0]];base[557]=[50,65,85,35,35,55,6,5,3,10,[0,0,1,0,0,0]];base[558]=[70,105,125,65,75,45,6,5,3,10,[0,0,2,0,0,0]];base[559]=[50,75,70,35,70,48,16,1,5,14,[0,1,0,0,0,0]];base[560]=[65,90,115,45,115,58,16,1,5,14,[0,0,1,0,1,0]];base[561]=[72,58,80,103,80,97,13,2,4,4,[0,0,0,2,0,0]];base[562]=[38,30,85,55,65,30,7,7,10,11,[0,0,1,0,0,0]];base[997]=[38,55,85,30,65,30,4,7,10,11,[0,0,1,0,0,0]];base[563]=[58,50,145,95,105,30,7,7,10,11,[0,0,2,0,0,0]];base[568]=[50,50,62,40,62,65,3,3,10,10,[0,0,0,0,0,1]];base[569]=[80,95,82,60,82,75,3,3,10,10,[0,2,0,0,0,0]];base[572]=[55,50,40,40,40,75,0,0,5,5,[0,0,0,0,0,1]];base[573]=[75,95,60,65,60,115,0,0,5,5,[0,0,0,0,0,2]];base[574]=[45,30,50,55,65,45,13,13,8,8,[0,0,0,0,1,0]];base[575]=[60,45,70,75,85,55,13,13,8,8,[0,0,0,0,2,0]];base[576]=[70,55,95,95,110,65,13,13,8,8,[0,0,0,0,3,0]];base[577]=[45,30,40,105,50,20,13,13,11,11,[0,0,0,1,0,0]];base[578]=[65,40,50,125,60,30,13,13,11,11,[0,0,0,2,0,0]];base[579]=[110,65,75,125,85,30,13,13,11,11,[0,0,0,3,0,0]];base[582]=[36,50,50,65,60,44,14,14,10,10,[0,0,0,1,0,0]];base[583]=[51,65,65,80,75,59,14,14,10,10,[0,0,0,2,0,0]];base[584]=[71,95,85,110,95,79,14,14,10,10,[0,0,0,3,0,0]];base[588]=[50,75,45,40,45,60,6,6,3,3,[0,1,0,0,0,0]];base[589]=[70,135,105,60,105,20,6,8,3,3,[0,2,0,0,0,0]];base[592]=[55,40,50,65,85,40,10,7,11,11,[0,0,0,0,1,0]];base[593]=[100,60,70,85,105,60,10,7,11,11,[0,0,0,0,2,0]];base[595]=[50,47,50,57,50,65,6,12,3,3,[0,0,0,0,0,1]];base[596]=[70,77,60,97,60,108,6,12,3,3,[0,0,0,0,0,2]];base[597]=[44,50,91,24,86,10,11,8,7,10,[0,0,1,0,0,0]];base[598]=[74,94,131,54,116,20,11,8,7,10,[0,0,2,0,0,0]];base[599]=[40,55,70,45,60,30,8,8,10,10,[0,0,1,0,0,0]];base[600]=[60,80,95,70,85,50,8,8,10,10,[0,0,2,0,0,0]];base[601]=[60,100,115,70,85,90,8,8,10,10,[0,0,3,0,0,0]];base[605]=[55,55,55,85,55,30,13,13,8,8,[0,0,0,1,0,0]];base[606]=[75,75,75,125,95,40,13,13,8,8,[0,0,0,2,0,0]];base[607]=[50,30,55,65,55,20,7,9,11,11,[0,0,0,1,0,0]];base[608]=[60,40,60,95,60,55,7,9,11,11,[0,0,0,2,0,0]];base[609]=[60,55,90,145,90,80,7,9,11,11,[0,0,0,3,0,0]];base[610]=[46,87,60,30,40,57,15,15,1,14,[0,1,0,0,0,0]];base[611]=[66,117,70,40,50,67,15,15,1,14,[0,2,0,0,0,0]];base[612]=[76,147,90,60,70,97,15,15,1,14,[0,3,0,0,0,0]];base[613]=[55,70,40,60,40,40,14,14,5,5,[0,1,0,0,0,0]];base[614]=[95,130,80,70,80,50,14,14,5,5,[0,2,0,0,0,0]];base[616]=[50,40,85,40,65,25,6,6,3,3,[0,0,1,0,0,0]];base[617]=[80,70,40,100,60,145,6,6,3,3,[0,0,0,0,0,2]];base[618]=[109,66,84,81,99,32,4,12,2,11,[2,0,0,0,0,0]];base[1004]=[109,81,99,66,84,32,4,8,2,11,[2,0,0,0,0,0]];base[622]=[59,74,50,35,50,35,4,7,10,10,[0,1,0,0,0,0]];base[623]=[89,124,80,55,80,55,4,7,10,10,[0,2,0,0,0,0]];base[624]=[45,85,70,40,40,60,16,8,8,8,[0,1,0,0,0,0]];base[625]=[65,125,100,60,70,70,16,8,8,8,[0,2,0,0,0,0]];base[627]=[70,83,50,37,50,60,0,2,4,4,[0,1,0,0,0,0]];base[628]=[100,123,75,57,75,80,0,2,4,4,[0,2,0,0,0,0]];base[629]=[70,55,75,45,65,60,16,2,4,4,[0,0,1,0,0,0]];base[630]=[110,65,105,55,95,80,16,2,4,4,[0,0,0,2,0,0]];base[631]=[85,97,66,105,66,65,9,9,5,5,[0,0,0,2,0,0]];base[632]=[58,109,112,48,48,109,6,8,3,3,[0,0,2,0,0,0]];base[633]=[52,65,50,45,50,38,16,15,14,14,[0,1,0,0,0,0]];base[634]=[72,85,70,65,70,58,16,15,14,14,[0,2,0,0,0,0]];base[635]=[92,105,90,125,90,98,16,15,14,14,[0,0,0,3,0,0]];base[638]=[91,90,129,90,72,108,8,1,15,15,[0,0,3,0,0,0]];base[639]=[91,129,90,72,90,108,5,1,15,15,[0,3,0,0,0,0]];base[640]=[91,90,72,90,129,108,11,1,15,15,[0,0,0,0,3,0]];base[643]=[100,120,100,150,120,90,15,9,15,15,[0,0,0,3,0,0]];base[644]=[100,150,120,120,100,90,15,12,15,15,[0,3,0,0,0,0]];base[646]=[125,130,90,130,90,95,15,14,15,15,[1,1,0,1,0,0]];base[1008]=[125,120,90,170,100,95,15,14,15,15,[0,0,0,3,0,0]];base[1009]=[125,170,100,120,90,95,15,14,15,15,[0,3,0,0,0,0]];base[647]=[91,72,90,129,90,108,10,1,15,15,[0,0,0,3,0,0]];base[1010]=[91,72,90,129,90,108,10,1,15,15,[0,0,0,3,0,0]];base[659]=[38,36,38,32,36,57,0,0,5,5,[0,0,0,0,0,1]];base[660]=[85,56,77,50,77,78,0,4,5,5,[2,0,0,0,0,0]];base[674]=[67,82,62,46,48,43,1,1,5,8,[0,1,0,0,0,0]];base[675]=[95,124,78,69,71,58,1,16,5,8,[0,2,0,0,0,0]];base[677]=[62,48,54,63,60,68,13,13,5,5,[0,0,0,0,0,1]];base[678]=[74,48,76,83,81,104,13,13,5,5,[0,0,0,0,0,2]];base[1097]=[74,48,76,83,81,104,13,13,5,5,[0,0,0,0,0,2]];base[679]=[45,80,100,35,37,28,8,7,10,10,[0,0,1,0,0,0]];base[680]=[59,110,150,45,49,35,8,7,10,10,[0,0,2,0,0,0]];base[681]=[60,50,140,50,140,60,8,7,10,10,[0,0,2,0,1,0]];base[1098]=[60,140,50,140,50,60,8,7,10,10,[0,2,0,1,0,0]];base[682]=[78,52,60,63,65,23,17,17,6,6,[1,0,0,0,0,0]];base[683]=[101,72,72,99,89,29,17,17,6,6,[2,0,0,0,0,0]];base[684]=[62,48,66,59,57,49,17,17,6,6,[0,0,1,0,0,0]];base[685]=[82,80,86,85,75,72,17,17,6,6,[0,0,2,0,0,0]];base[686]=[53,54,53,37,46,45,16,13,2,12,[0,1,0,0,0,0]];base[687]=[86,92,88,68,75,73,16,13,2,12,[0,2,0,0,0,0]];base[688]=[42,52,67,39,56,50,5,10,9,9,[0,1,0,0,0,0]];base[689]=[72,105,115,54,86,68,5,10,9,9,[0,2,0,0,0,0]];base[694]=[44,38,33,61,43,70,12,0,1,14,[0,0,0,0,0,1]];base[695]=[62,55,52,109,94,109,12,0,1,14,[0,0,0,1,0,1]];base[700]=[95,65,65,110,130,60,17,17,5,5,[0,0,0,0,2,0]];base[701]=[78,92,75,74,63,118,1,2,4,8,[0,2,0,0,0,0]];base[704]=[45,50,35,55,75,40,15,15,14,14,[0,0,0,0,1,0]];base[705]=[68,75,53,83,113,60,15,15,14,14,[0,0,0,0,2,0]];base[706]=[90,100,70,110,150,80,15,15,14,14,[0,0,0,0,3,0]];base[708]=[43,70,48,50,60,38,7,11,7,11,[0,1,0,0,0,0]];base[709]=[85,110,76,65,82,56,7,11,7,11,[0,2,0,0,0,0]];base[710]=[49,66,70,44,55,51,7,11,11,11,[0,0,1,0,0,0]];base[1099]=[44,66,70,44,55,56,7,11,11,11,[0,0,1,0,0,0]];base[1100]=[54,66,70,44,55,46,7,11,11,11,[0,0,1,0,0,0]];base[1101]=[59,66,70,44,55,41,7,11,11,11,[0,0,1,0,0,0]];base[711]=[65,90,122,58,75,84,7,11,11,11,[0,0,2,0,0,0]];base[1102]=[55,85,122,58,75,99,7,11,11,11,[0,0,2,0,0,0]];base[1103]=[75,95,122,58,75,69,7,11,11,11,[0,0,2,0,0,0]];base[1104]=[85,100,122,58,75,54,7,11,11,11,[0,0,2,0,0,0]];base[712]=[55,69,85,32,35,28,14,14,1,10,[0,0,1,0,0,0]];base[713]=[95,117,184,44,46,28,14,14,1,10,[0,0,2,0,0,0]];base[714]=[40,30,35,45,40,55,2,15,4,14,[0,0,0,0,0,1]];base[715]=[85,70,80,97,80,123,2,15,4,14,[0,0,0,0,0,2]];base[722]=[68,55,55,50,50,42,11,2,4,4,[1,0,0,0,0,0]];base[723]=[78,75,75,70,70,52,11,2,4,4,[2,0,0,0,0,0]];base[724]=[78,107,75,100,100,70,11,7,4,4,[0,3,0,0,0,0]];base[725]=[45,65,40,60,40,70,9,9,5,5,[0,0,0,0,0,1]];base[726]=[65,85,50,80,50,90,9,9,5,5,[0,0,0,0,0,2]];base[727]=[95,115,90,80,90,60,9,16,5,5,[0,3,0,0,0,0]];base[728]=[50,54,54,66,56,40,10,10,2,5,[0,0,0,1,0,0]];base[729]=[60,69,69,91,81,50,10,10,2,5,[0,0,0,2,0,0]];base[730]=[80,74,74,126,116,60,10,17,2,5,[0,0,0,3,0,0]];base[736]=[47,62,45,55,45,46,6,6,3,3,[0,1,0,0,0,0]];base[737]=[57,82,95,55,75,36,6,12,3,3,[0,0,2,0,0,0]];base[738]=[77,70,90,145,75,43,6,12,3,3,[0,0,0,3,0,0]];base[742]=[40,45,40,55,40,84,6,17,3,6,[0,0,0,0,0,1]];base[743]=[60,55,60,95,70,124,6,17,3,6,[0,0,0,0,0,2]];base[746]=[45,20,20,25,25,40,10,10,12,12,[1,0,0,0,0,0]];base[1117]=[45,140,130,140,135,30,10,10,12,12,[1,0,0,0,0,0]];base[747]=[50,53,62,43,52,45,3,10,2,2,[0,0,1,0,0,0]];base[748]=[50,63,152,53,142,35,3,10,2,2,[0,0,2,0,0,0]];base[749]=[70,100,70,45,55,45,4,4,5,5,[0,1,0,0,0,0]];base[750]=[100,125,100,55,85,35,4,4,5,5,[0,2,0,0,0,0]];base[751]=[38,40,52,40,72,27,10,6,2,3,[0,0,0,0,1,0]];base[752]=[68,70,92,50,132,42,10,6,2,3,[0,0,0,0,2,0]];base[755]=[40,35,55,65,75,15,11,17,7,7,[0,0,0,0,1,0]];base[756]=[60,45,80,90,100,30,11,17,7,7,[0,0,0,0,2,0]];base[757]=[48,44,40,71,40,77,3,9,1,14,[0,0,0,0,0,1]];base[758]=[68,64,60,111,60,117,3,9,1,14,[0,0,0,0,0,2]];base[759]=[70,75,50,45,50,50,0,1,5,5,[0,1,0,0,0,0]];base[760]=[120,125,80,55,60,60,0,1,5,5,[0,2,0,0,0,0]];base[761]=[42,30,38,30,38,32,11,11,7,7,[1,0,0,0,0,0]];base[762]=[52,40,48,40,48,62,11,11,7,7,[0,0,0,0,0,2]];base[763]=[72,120,98,50,98,72,11,11,7,7,[0,3,0,0,0,0]];base[765]=[90,60,80,90,110,60,0,13,5,5,[0,0,0,0,2,0]];base[766]=[100,120,90,40,60,80,1,1,5,5,[0,2,0,0,0,0]];base[767]=[25,35,40,20,30,80,6,10,3,9,[0,0,0,0,0,1]];base[768]=[75,125,140,60,90,40,6,10,3,9,[0,0,2,0,0,0]];base[771]=[55,60,130,30,130,5,10,10,2,2,[0,0,0,0,2,0]];base[772]=[95,95,95,95,95,59,0,0,15,15,[2,0,0,0,0,0]];base[773]=[95,95,95,95,95,95,0,0,15,15,[3,0,0,0,0,0]];base[1118]=[95,95,95,95,95,95,1,1,15,15,[3,0,0,0,0,0]];base[1119]=[95,95,95,95,95,95,2,2,15,15,[3,0,0,0,0,0]];base[1120]=[95,95,95,95,95,95,3,3,15,15,[3,0,0,0,0,0]];base[1121]=[95,95,95,95,95,95,4,4,15,15,[3,0,0,0,0,0]];base[1122]=[95,95,95,95,95,95,5,5,15,15,[3,0,0,0,0,0]];base[1123]=[95,95,95,95,95,95,6,6,15,15,[3,0,0,0,0,0]];base[1124]=[95,95,95,95,95,95,7,7,15,15,[3,0,0,0,0,0]];base[1125]=[95,95,95,95,95,95,8,8,15,15,[3,0,0,0,0,0]];base[1126]=[95,95,95,95,95,95,9,9,15,15,[3,0,0,0,0,0]];base[1127]=[95,95,95,95,95,95,10,10,15,15,[3,0,0,0,0,0]];base[1128]=[95,95,95,95,95,95,11,11,15,15,[3,0,0,0,0,0]];base[1129]=[95,95,95,95,95,95,12,12,15,15,[3,0,0,0,0,0]];base[1130]=[95,95,95,95,95,95,13,13,15,15,[3,0,0,0,0,0]];base[1131]=[95,95,95,95,95,95,14,14,15,15,[3,0,0,0,0,0]];base[1132]=[95,95,95,95,95,95,15,15,15,15,[3,0,0,0,0,0]];base[1133]=[95,95,95,95,95,95,16,16,15,15,[3,0,0,0,0,0]];base[1134]=[95,95,95,95,95,95,17,17,15,15,[3,0,0,0,0,0]];base[776]=[60,78,135,91,85,36,9,15,1,14,[0,0,2,0,0,0]];base[777]=[65,98,63,40,73,96,12,8,5,6,[0,2,0,0,0,0]];base[778]=[55,90,80,50,105,96,7,17,11,11,[0,0,0,0,2,0]];base[1148]=[55,90,80,50,105,96,7,17,11,11,[0,0,0,0,2,0]];base[780]=[78,60,85,135,91,36,0,15,1,14,[0,0,0,2,0,0]];base[781]=[70,131,100,86,90,40,7,11,10,10,[0,2,0,0,0,0]];base[782]=[45,55,65,45,45,45,15,15,14,14,[0,0,1,0,0,0]];base[783]=[55,75,90,65,70,65,15,1,14,14,[0,0,2,0,0,0]];base[784]=[75,110,125,100,105,85,15,1,14,14,[0,0,3,0,0,0]];base[789]=[43,29,31,29,31,37,13,13,15,15,[1,0,0,0,0,0]];base[790]=[43,29,131,29,131,37,13,13,15,15,[0,0,1,0,1,0]];base[791]=[137,137,107,113,89,97,13,8,15,15,[0,3,0,0,0,0]];base[792]=[137,113,89,137,107,97,13,7,15,15,[0,0,0,3,0,0]];base[800]=[97,107,101,127,89,79,13,13,15,15,[0,1,0,2,0,0]];base[1149]=[97,157,127,113,109,77,13,8,15,15,[0,3,0,0,0,0]];base[1150]=[97,113,109,157,127,77,13,7,15,15,[0,0,0,3,0,0]];base[802]=[90,125,80,90,90,125,1,7,15,15,[0,2,0,0,0,1]];base[807]=[88,112,75,102,80,143,12,12,15,15,[0,0,0,0,0,3]];base[808]=[46,65,65,55,35,34,8,8,15,15,[0,1,0,0,0,0]];base[809]=[135,143,143,80,65,34,8,8,15,15,[0,3,0,0,0,0]];base[810]=[50,65,50,40,40,65,11,11,5,7,[0,1,0,0,0,0]];base[811]=[70,85,70,55,60,80,11,11,5,7,[0,2,0,0,0,0]];base[812]=[100,125,90,60,70,85,11,11,5,7,[0,3,0,0,0,0]];base[813]=[50,71,40,40,40,69,9,9,5,8,[0,0,0,0,0,1]];base[814]=[65,86,60,55,60,94,9,9,5,8,[0,0,0,0,0,2]];base[815]=[80,116,75,65,75,119,9,9,5,8,[0,0,0,0,0,3]];base[816]=[50,40,40,70,40,70,10,10,2,5,[0,0,0,0,1,1]];base[817]=[65,60,55,95,55,90,10,10,2,5,[0,0,0,2,0,0]];base[818]=[70,85,65,125,65,120,10,10,2,5,[0,0,0,0,0,3]];base[819]=[70,55,55,35,35,25,0,0,5,5,[1,0,0,0,0,0]];base[820]=[120,95,95,55,75,20,0,0,5,5,[2,0,0,0,0,0]];base[821]=[38,47,35,33,35,57,2,2,4,4,[0,0,0,0,0,1]];base[822]=[68,67,55,43,55,77,2,2,4,4,[0,0,0,0,0,2]];base[823]=[98,87,105,53,85,67,2,8,4,4,[0,0,3,0,0,0]];base[824]=[25,20,20,25,45,45,6,6,3,3,[0,0,0,0,1,0]];base[825]=[50,35,80,50,90,30,6,13,3,3,[0,0,0,0,2,0]];base[826]=[60,45,110,80,120,90,6,13,3,3,[0,0,0,0,3,0]];base[827]=[40,28,28,47,52,50,16,16,5,5,[0,0,0,0,1,0]];base[828]=[70,58,58,87,92,90,16,16,5,5,[0,0,0,0,2,0]];base[829]=[40,40,60,40,60,10,11,11,7,7,[0,0,0,0,1,0]];base[830]=[60,50,90,80,120,60,11,11,7,7,[0,0,0,0,2,0]];base[831]=[42,40,55,40,45,48,0,0,5,5,[0,0,1,0,0,0]];base[832]=[72,80,100,60,90,88,0,0,5,5,[0,0,2,0,0,0]];base[833]=[50,64,50,38,38,44,10,10,1,2,[0,1,0,0,0,0]];base[834]=[90,115,90,48,68,74,10,5,1,2,[0,2,0,0,0,0]];base[835]=[59,45,50,40,50,26,12,12,5,5,[1,0,0,0,0,0]];base[836]=[69,90,60,90,60,121,12,12,5,5,[0,0,0,0,0,2]];base[837]=[30,40,50,40,50,30,5,5,10,10,[0,0,1,0,0,0]];base[838]=[80,60,90,60,70,50,5,9,10,10,[0,0,2,0,0,0]];base[839]=[110,80,120,80,90,30,5,9,10,10,[0,0,3,0,0,0]];base[840]=[40,40,80,40,40,20,11,15,7,14,[0,0,1,0,0,0]];base[841]=[70,110,80,95,60,70,11,15,7,14,[0,2,0,0,0,0]];base[842]=[110,85,80,100,80,30,11,15,7,14,[2,0,0,0,0,0]];base[843]=[52,57,75,35,50,46,4,4,5,14,[0,0,1,0,0,0]];base[844]=[72,107,125,65,70,71,4,4,5,14,[0,0,2,0,0,0]];base[845]=[70,85,55,85,95,85,2,10,2,4,[0,0,0,0,2,0]];base[1152]=[70,85,55,85,95,85,2,10,2,4,[0,0,0,0,2,0]];base[1153]=[70,85,55,85,95,85,2,10,2,4,[0,0,0,0,2,0]];base[846]=[41,63,40,40,30,66,10,10,12,12,[0,0,0,0,0,1]];base[847]=[61,123,60,60,50,136,10,10,12,12,[0,0,0,0,0,2]];base[848]=[40,38,35,54,35,40,12,3,15,15,[0,0,0,1,0,0]];base[849]=[75,98,70,114,70,75,12,3,8,8,[0,0,0,2,0,0]];base[1154]=[75,98,70,114,70,75,12,3,8,8,[0,0,0,2,0,0]];base[850]=[50,65,45,50,50,45,9,6,3,3,[0,1,0,0,0,0]];base[851]=[100,115,65,90,90,65,9,6,3,3,[0,2,0,0,0,0]];base[852]=[50,68,60,50,50,32,1,1,2,8,[0,1,0,0,0,0]];base[853]=[80,118,90,70,80,42,1,1,2,8,[0,2,0,0,0,0]];base[854]=[40,45,45,74,54,50,7,7,10,11,[0,0,0,1,0,0]];base[1155]=[40,45,45,74,54,50,7,7,10,11,[0,0,0,1,0,0]];base[855]=[60,65,65,134,114,70,7,7,10,11,[0,0,0,2,0,0]];base[1156]=[60,65,65,134,114,70,7,7,10,11,[0,0,0,2,0,0]];base[856]=[42,30,45,56,53,39,13,13,6,6,[0,0,0,1,0,0]];base[857]=[57,40,65,86,73,49,13,13,6,6,[0,0,0,2,0,0]];base[858]=[57,90,95,136,103,29,13,17,6,6,[0,0,0,3,0,0]];base[859]=[45,45,30,55,40,50,16,17,6,8,[0,0,0,1,0,0]];base[860]=[65,60,45,75,55,70,16,17,6,8,[0,0,0,2,0,0]];base[861]=[95,120,65,95,75,60,16,17,6,8,[0,3,0,0,0,0]];base[862]=[93,90,101,60,81,95,16,0,5,5,[0,0,3,0,0,0]];base[863]=[70,110,100,50,60,50,8,8,5,5,[0,2,0,0,0,0]];base[864]=[60,95,50,145,130,30,7,7,2,9,[0,0,0,2,0,0]];base[865]=[62,135,95,68,82,65,1,1,4,5,[0,2,0,0,0,0]];base[866]=[80,85,75,110,100,70,14,13,8,8,[0,0,0,3,0,0]];base[867]=[58,95,145,50,105,30,4,7,10,11,[0,0,2,0,0,0]];base[868]=[45,40,40,50,61,34,17,17,6,11,[0,0,0,0,1,0]];base[869]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[1157]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[1158]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[1159]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[1160]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[1161]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[1162]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[1163]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[1164]=[65,60,75,110,121,64,17,17,6,11,[0,0,0,0,2,0]];base[870]=[65,100,100,70,60,75,1,1,6,10,[0,2,0,0,1,0]];base[871]=[48,101,95,91,85,15,12,12,2,11,[0,2,0,0,0,0]];base[872]=[30,25,35,45,30,20,14,6,3,3,[0,0,0,1,0,0]];base[873]=[70,65,60,125,90,65,14,6,3,3,[0,0,0,2,0,0]];base[874]=[100,125,135,20,20,70,5,5,10,10,[0,0,2,0,0,0]];base[875]=[75,80,110,65,90,50,14,14,2,5,[0,0,2,0,0,0]];base[1165]=[75,80,70,65,50,130,14,14,2,5,[0,0,2,0,0,0]];base[876]=[60,65,55,105,95,95,13,0,6,6,[0,0,0,2,0,0]];base[1166]=[70,55,65,95,105,85,13,0,6,6,[0,0,0,0,2,0]];base[877]=[58,95,58,70,58,97,12,16,5,6,[0,0,0,0,0,2]];base[1167]=[58,95,58,70,58,97,12,16,5,6,[0,0,0,0,0,2]];base[878]=[72,80,49,40,49,40,8,8,5,10,[0,1,0,0,0,0]];base[879]=[122,130,69,80,69,30,8,8,5,10,[0,2,0,0,0,0]];base[880]=[90,100,90,80,70,75,12,15,15,15,[0,2,0,0,0,0]];base[881]=[90,100,90,90,80,55,12,14,15,15,[0,2,0,0,0,0]];base[882]=[90,90,100,70,80,75,10,15,15,15,[0,0,2,0,0,0]];base[883]=[90,90,100,80,90,55,10,14,15,15,[0,0,2,0,0,0]];base[884]=[70,95,115,120,50,85,8,15,10,14,[0,0,0,2,0,0]];base[885]=[28,60,30,40,30,82,15,7,11,14,[0,0,0,0,0,1]];base[886]=[68,80,50,60,50,102,15,7,11,14,[0,0,0,0,0,2]];base[887]=[88,120,75,100,75,142,15,7,11,14,[0,0,0,0,0,3]];base[888]=[92,130,115,80,115,138,17,17,15,15,[0,0,0,0,0,3]];base[1168]=[92,170,115,80,115,148,17,8,15,15,[0,0,0,0,0,3]];base[889]=[92,130,115,80,115,138,1,1,15,15,[0,0,0,0,0,3]];base[1169]=[92,130,145,80,145,128,1,8,15,15,[0,0,0,0,0,3]];base[890]=[140,85,95,145,95,130,3,15,15,15,[3,0,0,0,0,0]];base[1170]=[255,115,250,125,250,130,3,15,15,15,[3,0,0,0,0,0]];
//ATK/DEF/SP.ATK/SP.DEF/SPD / Bashful 1, Docile 2, Hardy 3, Serious 4, Quirky 5, Bold 6, Modest 7, Calm 8, Timid 9, Lonely 10, Mild 11, Gentle 12, Hasty 13, Adamant 14, Impish 15, Careful 16, Jolly 17, Naughty 18, Lax 19, Rash 20, Naive 21, Brave 22, Relaxed 23, Quiet 24, Sassy 25
natures = [[],[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1],[0.9,1.1,1,1,1],[0.9,1,1.1,1,1],[0.9,1,1,1.1,1],[0.9,1,1,1,1.1],[1.1,0.9,1,1,1],[1,0.9,1.1,1,1],[1,0.9,1,1.1,1],[1,0.9,1,1,1.1],[1.1,1,0.9,1,1],[1,1.1,0.9,1,1],[1,1,0.9,1.1,1],[1,1,0.9,1,1.1],[1.1,1,1,0.9,1],[1,1.1,1,0.9,1],[1,1,1.1,0.9,1],[1,1,1,0.9,1.1],[1.1,1,1,1,0.9],[1,1.1,1,1,0.9],[1,1,1.1,1,0.9],[1,1,1,1.1,0.9]];
natures[-1] = [1,1,1,1,1]; //neutral
natures['max'] = [1.1,1.1,1.1,1.1,1.1]; //all max
natures['min'] = [0.9,0.9,0.9,0.9,0.9]; //all max
//Type affinity no fg fl po gu ro bu gh st fi wa gs el ps ic dr da fa
damage = [[1,1,1,1,1,0.5,1,0,0.5,1,1,1,1,1,1,1,1,1],[2,1,0.5,0.5,1,2,0.5,0,2,1,1,1,1,0.5,2,1,2,0.5],[1,2,1,1,1,0.5,2,1,0.5,1,1,2,0.5,1,1,1,1,1],[1,1,1,0.5,0.5,0.5,1,0.5,0,1,1,2,1,1,1,1,1,2],[1,1,0,2,1,2,0.5,1,2,2,1,0.5,2,1,1,1,1,1],[1,0.5,2,1,0.5,1,2,1,0.5,2,1,1,1,1,2,1,1,1],[1,0.5,0.5,0.5,1,1,1,0.5,0.5,0.5,1,2,1,2,1,1,2,0.5],[0,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,0.5,1],[1,1,1,1,1,2,1,1,0.5,0.5,0.5,1,0.5,1,2,1,1,2],[1,1,1,1,1,0.5,2,1,2,0.5,0.5,2,1,1,2,0.5,1,1],[1,1,1,1,2,2,1,1,1,2,0.5,0.5,1,1,1,0.5,1,1],[1,1,0.5,0.5,2,2,0.5,1,0.5,0.5,2,0.5,1,1,1,0.5,1,1],[1,1,2,1,0,1,1,1,1,1,2,0.5,0.5,1,1,0.5,1,1],[1,2,1,2,1,1,1,1,0.5,1,1,1,1,0.5,1,1,0,1],[1,1,2,1,2,1,1,1,0.5,0.5,0.5,2,1,1,0.5,2,1,1],[1,1,1,1,1,1,1,1,0.5,1,1,1,1,1,1,2,1,0],[1,0.5,1,1,1,1,1,2,1,1,1,1,1,2,1,1,0.5,0.5],[1,2,1,0.5,1,1,1,1,0.5,0.5,1,1,1,1,1,2,2,1]];
ivr = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
stats = ['HP','Attack','Defense','Sp.Attack','Sp.Defense','Speed','—'];
types = ['Normal','Fighting','Flying','Poison','Ground','Rock','Bug','Ghost','Steel','Fire','Water','Grass','Electric','Psychic','Ice','Dragon','Dark','Fairy'];
eggs = ['???','Monster','Water1','Bug','Flying','Ground','Fairy','Plant','Humanshape','Water3','Mineral','Indeterminate','Water2','Ditto','Dragon','No Eggs'];
typeshp = ['Fighting','Flying','Poison','Ground','Rock','Bug','Ghost','Steel','Fire','Water','Grass','Electric','Psychic','Ice','Dragon','Dark'];
hps = ['0,1,2,3,4','5,6,7,8','9,10,11,12','13,14,15,16','17,18,19,20','21,22,23,24,25','26,27,28,29','30,31,32,33','34,35,36,37','38,39,40,41','42,43,44,45,46','47,48,49,50','51,52,53,54','55,56,57,58','59,60,61,62','63']; //possible Hidden Power "types"
/* UI specific functions */
function get_text(id,n) { //Returns text associated with n value from id (<select/>)
var a = $(id).value;
$(id).value = n;
var b = $(id).options[$(id).selectedIndex].text;
$(id).value = a;
return b;
}
pkmns=pkmns.split('|');
pkmns.sort(); //Sort names alphabetically
function pop_species() { //Populates the species list
var a = document.createDocumentFragment();
var i=0,j=pkmns.length; do {
var b = pkmns[i].split(':');
var c = el_add(a,"option",{value:b[1]},b[0]);
if ((b[1] > 807 && b[1] <= forms_after)) { c.className = 'new'; } //show new species
i++;
} while (i<j);
$('species').appendChild(a);
}
online = 0; //global- online status
function online_check() { //Checks if there's an internet connection alive
if (navigator.onLine) {
if (online == 1) { return true; }
online = 1;
add_sprite();
//Version Check - DO NOT change the following
$('version').innerHTML = '<a href="https://legendarypkmn.github.io/ivcalcswsh.html"><img id="verchk" alt=""/></a><span class="error">Ø</span> <strong>There is a <a href="https://legendarypkmn.github.io/ivcalcswsh.html">newer version</a> available!</strong>';
var verchk = $('verchk');
verchk.src = 'https://legendarypkmn.github.io/ivcalcswsh_20191115.png?p='+ Math.floor(Math.random( )*100);
verchk.onload = function() { if (verchk.width==1) { $('version').innerHTML = '<span class="ok">OK!</span> You are using the latest version!'; } }
}
else { $('version').innerHTML = '<span class="error">Ø</span> Browser is <strong>offline</strong>! Unable to check for updates.'; }
}
themes = ['isotope','spp','simplex']; //define your own themes here, feel free to edit this
themed = themes.indexOf('none'); //global- set default theme here
theme = (!cookie_read('theme')?themed:cookie_read('theme'));
function toggle_theme() {
$('calculator').className = themes[theme];
display_status('The active theme has been changed to "'+themes[theme]+'".<br/><span class="btn" onclick="toggle_simple();">Simplify?</span>');
if (theme == -1 && (navigator.userAgent.indexOf('MSIE ') == -1)) {
display_status('The active theme has been changed to "Colorize".<br/>Select Hue, Saturation and Brightness:');
var c = cookie_read('color') || 'd';
if (c.charAt(0) == ',') {
c = c.split(',');
thema(c[1],c[2],c[3]);
}
$('status').innerHTML += '<br/><br/><input id="hue" type="range" min="0" max="360" value="150" />';
$('status').innerHTML += '<br/><input id="sat" type="range" min="0" max="100" value="4" />';
$('status').innerHTML += '<br/><input id="lit" type="range" min="0" max="100" value="74" />';
event_add($('hue'),"change", function () { thema($('hue').value,$('sat').value,$('lit').value); });
event_add($('sat'),"change", function () { thema($('hue').value,$('sat').value,$('lit').value); });
event_add($('lit'),"change", function () { thema($('hue').value,$('sat').value,$('lit').value); });
event_add($('hue'),"keyup", function (evt) { vv(this.id,0,360,evt); thema($('hue').value,$('sat').value,$('lit').value); });
event_add($('sat'),"keyup", function (evt) { vv(this.id,0,100,evt); thema($('hue').value,$('sat').value,$('lit').value); });
event_add($('lit'),"keyup", function (evt) { vv(this.id,0,100,evt); thema($('hue').value,$('sat').value,$('lit').value); });
}
cookie_create('theme',theme,60);
theme = (theme == themes.length?-1:theme*1+1);
}
function toggle_simple() {
$('calculator').className += ' simplex';
toggle($('info')); toggle($('instructions'));
display_status('All is plain and neat now!<br/>(refresh page to restore defaults)');
}
function thema(h,s,l) { //Color theming, does not work in IE8
var bg = 'hsl('+h+', '+s+'%, '+l+'%)';
var bd = 'hsl('+h+', '+s+'%, '+(l-20)+'%)';
var bd2 = 'hsl('+h+', '+s+'%, '+(l-26)+'%)';
var bp = 'hsl('+h+', '+s+'%, '+(l-9)+'%)';
var bs = 'hsl('+h+', '+s+'%, '+(l-16)+'%)';
$('thema').innerHTML = '#calculator{background:'+bg+';border-color:'+bd+';}#calculator .primary{background:'+bp+';}#calculator .secondary{background:'+bs+';}#calculator input,#calculator select,#calculator .button{border-color:'+bd2+';color:'+bd2+';}#calculator .button {background-color:'+bg+';}'; //dibs on this method
cookie_create('color',','+h+','+s+','+l,60);
}
eps = 1; //global- EPs enabled
function toggle_evs() { //Enable/Disable EV functions
switch(eps) {
case 1:
eps = 0; $('btn-evs').value = 'EVs: OFF';
break;
case 0:
eps = 1; $('btn-evs').value = 'EVs: ON';
break;
}
var j = $c('eps').slice();
var i = j.length-1; do {
toggle(j[i]);
} while(i--);
display_base();
}
mode = 0; //global- Single enabled
function toggle_mode(m) { //Single/Team/Row mode
var m = m || mode;
switch(m) {
case 0:
mode = 1;
$('btn-mode').value = 'Mode: Team Calculation';
$('mode0').style.display='none';
$('mode1').style.display='';
$('btn-hp').disabled = 'disabled';
$('btn-stats').disabled = 'disabled';
$('btn-eps').disabled = 'disabled';
display_status('Mode has been changed to <strong>Team Calculation</strong>.');
break;
case 1:
mode = 2;
$('btn-mode').value = 'Mode: Row Calculation';
$('mode0').style.display='';
$('mode1').style.display='none';
$('btn-hp').disabled = '';
$('btn-stats').disabled = '';
display_status('Mode has been changed to <strong>Row Calculation</strong>.');
break;
default:
mode = 0;
$('btn-mode').value = 'Mode: Single Pokémon';
$('mode0').style.display='';
$('mode1').style.display='none';
$('btn-hp').disabled = '';
$('btn-stats').disabled = '';
$('btn-eps').disabled = '';
display_status('Mode has been changed to <strong>Single Pokémon</strong>.');
}
display_sprite();
display_effectiveness($('number-'+(act>-1?act:0)).value);
}
/* Save & Load functionality */
function code_load(c) { //Loads a SaveCode
//var c = prompt('Input SaveCode or [Cancel] to load from URL:') || location.search;
//var c = location.search;
display_status('<span class="loading">Loading SaveCode...</span>');
if (c == undefined || c.indexOf('?sc=') == -1) { display_status('Cannot load improper SaveCode.'); return NULL; }
c = c.replace(/%20/gi,'').substring(1).split('!');
if (c.length < 2) { display_status('Cannot load improper SaveCode.'); return; }
var i = c.length-1; do { c[i] = c[i].split(','); } while(i--);
//Check if SaveCodeVersion is compatible (may change with Black/White)
if (c[0][0] > 1) { display_status('Cannot load incompatible SaveCode.'); return; }
//Check if SaveCodeUI is compatible, and restore UI
if (c[0][1] == 0) {
if (c[0][2] == 0 && eps == 1) { toggle_evs(); }
var i = c[0][3]*1;
if(mode!=i) { if(mode==2) { mode = 0; } toggle_mode(i-1); }
display_status('<span class="loading">Loading SaveCode...</span>');
mode = i;
$('nickname').value = unescape(c[0][4]);
}
//Load user entered IVs
$('statlvl').value = c[1][6]; $('hiddent').innerHTML=''; $('hiddenp').innerHTML='';
var i=5; do {
ivs[i] = ivr.slice();
$('med'+i+'-0').value = c[1][i]*1;
$('spr'+i+'-0').innerHTML = '';
$('plv'+i+'-0').innerHTML = '';
$('stats'+i).innerHTML = '';
} while(i--);
//Load row data
$('statrows').style.display = 'none';
el_del($('statrows'));act=-1;actp=0;rn=1;rs=[0];ivs=[];
var i=2, r=i-2; l=c.length;
if (l > 2) {
do {
if (r!=0) { row_add(0,c[i][1]); };
$('level-'+r).value = c[i][1]*1; $('number-'+r).value = c[i][0]*1; $('nat-'+r).value = c[i][14]*1; $('char-'+r).value = c[i][15]; $('hpt-'+r).value = c[i][16]*1;
$('pot0-'+r).value = c[i][17]*1; $('pot1-'+r).value = c[i][18]; $('pot2-'+r).value = c[i][19]*1;
var j=5; do {
$('stat'+j+'-'+r).value = c[i][j+2]*1;
$('ep'+j+'-'+r).value = c[i][j+8]*1;
} while(j--);
display_eps();
i++; r++;
} while (i<l);
}
//Restore focus and set active row
$('act-0').checked = 1; act=0; actp=0; row_sync();
$('statrows').style.display = '';
display_effectiveness($('number-'+act).value);
tooltips();
display_status('Loaded SaveCode successfully!');
$('btn-ivs').focus();
}
function code_save() { //Displays a SaveCode
var c = '?sc=0,0,'; //Data/SaveCode version
c += eps+',';
c += mode+',';
c += escape($('nickname').value)+'!';
c += $('med0-0').value+',';
c += $('med1-0').value+',';
c += $('med2-0').value+',';
c += $('med3-0').value+',';
c += $('med4-0').value+',';
c += $('med5-0').value+',';
c += $('statlvl').value+'';
var s = $c('statrow'), i = (mode==2?0:s.length), r = (mode==2 && act>-1?act:0); s.reverse();
do {
c += '!'+$('number-'+r).value+','+$('level-'+r).value+','+$('stat0-'+r).value+','+$('stat1-'+r).value+','+$('stat2-'+r).value+','+$('stat3-'+r).value+','+$('stat4-'+r).value+','+$('stat5-'+r).value+','+$('ep0-'+r).value+','+$('ep1-'+r).value+','+$('ep2-'+r).value+','+$('ep3-'+r).value+','+$('ep4-'+r).value+','+$('ep5-'+r).value+','+$('nat-'+r).value+','+$('char-'+r).value+','+$('hpt-'+r).value+','+$('pot0-'+r).value+','+$('pot1-'+r).value+','+$('pot2-'+r).value;
if (i > 0) { r = s[i-1].id.split('-')[1]; }
} while (i--);
display_status('<a href="'+c+'">SaveCode</a> (<a href="http://j.mp/https://legendarypkmn.github.io/ivcalcswsh.html'+c+'">shorten</a>):<br/>'+c.split('!').join('! '));
$('contact').href = 'https://legendarypkmn.net/contact?topic=IV%20Calculator&text='+escape('My browser is: '+navigator.userAgent+'\nMy savecode is: '+c+'\n\n');
//window.location += c; //Uncomment for old behaviour
}
/* Row functions */
act = 0; actp = 0; //global- active row; previous active row
rn = 1; rs = [0]; //global- new row counter; array of current rows
error = 1; //global- error flag, default: true
function row_act(n) { //Makes n row active
if ($('act-'+n).value == act) {
actp = act;
act = -1;
$('act-'+n).checked = 0;
$('name').focus();
$('ept').style.visibility = '';
if (online == 1) { display_sprite(); }
display_effectiveness($('number').value);
return false;
}
act = n;
actp = 0;
$('act-'+n).checked = 1;
/*$('number-'+n).readonly = 'readonly'; $('number-'+n).disabled = ''; //look into this
$('number-'+actp).readonly = ''; $('number-'+actp).disabled = 'disabled';*/
$('ept').style.visibility = 'hidden';
row_sync();
}
function row_sync() { //Syncs the display with active row
var n=act, t=$('pot1-'+n).value.split('.');
$('number').value = Math.floor($('number-'+n).value);
$('species').value = $('number-'+n).value;
$('nat').value = $('nat-'+n).value;
$('char').value = $('char-'+n).value;
$('hpt').value = $('hpt-'+n).value;
$('pot0').value = $('pot0-'+n).value;
$('pot2').value = $('pot2-'+n).value;
var i=5; do {
$('pot1').options[(i+1)].selected = (t.indexOf(i.toString()) > -1?true:false);
} while(i--);
display_effectiveness($('number-'+n).value);
display_base();
display_nature();
display_char();
if (mode == 2) { calc_ivs(n); }
if (online == 1) { display_sprite(); }
}
function row_edit() { //Makes active row editable
var n=act, t=[];
if (n == -1) { return false; }
$('number-'+n).value = $('species').value;
$('nat-'+n).value = $('nat').value;
$('char-'+n).value = $('char').value;
$('hpt-'+n).value = $('hpt').value;
$('pot0-'+n).value = $('pot0').value;
var i=6; do {
if ($('pot1').options[i].selected && t.indexOf(i-1) == -1 ) { t.push(i-1); }
} while(i--);
$('pot1-'+n).value = t.join('.');
$('pot2-'+n).value = $('pot2').value;
}
function row_up(r) { //Moves row upwards
var t=[], n=[], p=rs[rs.indexOf(r)-1];
if ($('act-'+p).checked == 0) { row_act(p); }
else if (online == 1) { display_sprite(); }
p = $('level-'+p,'stat0-'+p,'stat1-'+p,'stat2-'+p,'stat3-'+p,'stat4-'+p,'stat5-'+p,'number-'+p,'nat-'+p,'char-'+p,'hpt-'+p,'pot0-'+p,'pot1-'+p,'pot2-'+p,'ep0-'+p,'ep1-'+p,'ep2-'+p,'ep3-'+p,'ep4-'+p,'ep5-'+p);
n = $('level-'+r,'stat0-'+r,'stat1-'+r,'stat2-'+r,'stat3-'+r,'stat4-'+r,'stat5-'+r,'number-'+r,'nat-'+r,'char-'+r,'hpt-'+r,'pot0-'+r,'pot1-'+r,'pot2-'+r,'ep0-'+r,'ep1-'+r,'ep2-'+r,'ep3-'+r,'ep4-'+r,'ep5-'+r);
p.map(function(v){t.push(v.value); });
n.map(function(v,i){p[i].value=v.value;v.value=t[i];});
display_eps(r);
row_sync();
}
function row_del(n) { //Removes n row
rs.splice(rs.indexOf(n),1);
if (act==n) { row_act(0); }
$('statrows').removeChild($('statrow-'+n));
$('statrows').removeChild($('eprow-'+n));
row_sync();
}
function row_add(n,lvl) { //Appends a new row
if (n > 0) { rn = (rs.length == 1?1:n); }
if (!lvl && mode==0) {
var lvl = $('level-'+rs[(rs.length-1)]).value;
lvl = (lvl<100?lvl*1+1:100);
}
lvl = lvl || 100;
var ep = [0,0,0,0,0,0];
if (mode==0) {
var p = rs[(rs.length-1)];
var ep = [$('ep0-'+p).value,$('ep1-'+p).value,$('ep2-'+p).value,$('ep3-'+p).value,$('ep4-'+p).value,$('ep5-'+p).value,];
}
rs.push(rn);
var a = document.createDocumentFragment();
var b = el_add(a,"tr",{id:'statrow-'+rn,className:'statrow'});
el_add(b,"td",'','<input type="radio" class="radio tooltip" name="act" id="act-'+rn+'" value="'+rn+'" onclick="row_act('+rn+');" title="(De)Activate this row."/> <span class="btn tooltip" onclick="row_del('+rn+');" title="Delete this row.">-</span>');
el_add(b,"td",'','<input type="text" id="level-'+rn+'" name="level-'+rn+'" maxlength="3" size="3" value="'+lvl+'" onkeyup="vv(this.id,0,100,event,'+rn+');" />');
el_add(b,"td",{},'<span class="btn tooltip" onclick="row_up('+rn+');" title="Move row upwards.">^</span>');
var i = 0; do {
el_add(b,"td",'','<input type="text" name="stat'+i+'-'+rn+'" id="stat'+i+'-'+rn+'" maxlength="3" size="3" value="" onkeyup="vv(this.id,0,999,event,'+rn+');" />');
i++;
} while (i<6);
el_add(b,"td",'','<input type="text" disabled="disabled" id="number-'+rn+'" name="number-'+rn+'" maxlength="3" size="3" value="'+$('number').value+'" /><input type="hidden" id="nat-'+rn+'" name="nat-'+rn+'" value="'+$('nat').value+'" /><input type="hidden" id="char-'+rn+'" name="char-'+rn+'" value="'+$('char').value+'" /><input type="hidden" id="hpt-'+rn+'" name="hpt-'+rn+'" value="'+$('hpt').value+'" /><input type="hidden" id="pot0-'+rn+'" name="pot0-'+rn+'" value="'+$('pot0').value+'" /><input type="hidden" id="pot1-'+rn+'" name="pot1-'+rn+'" value="'+$('pot1').value+'" /><input type="hidden" id="pot2-'+rn+'" name="pot2-'+rn+'" value="'+$('pot2').value+'" />');
var c = el_add(a,"tr",{id:'eprow-'+rn,className:'eps'});
if (eps == 0) { c.style.display = 'none'; }
el_add(c,"td");
el_add(c,"td",{id:'eps-'+rn,value:ep.sum()});
el_add(c,"td");
var i = 0; do {
el_add(c,"td",'','<input type="text" name="ep'+i+'-'+rn+'" id="ep'+i+'-'+rn+'" maxlength="3" size="3" value="'+ep[i]+'" onkeyup="vv(this.id,0,255,event,'+rn+');display_eps();" />');
i++;
} while (i<6);
el_add(c,"td");
$('statrows').appendChild(a);
row_act(rn);
rn++;
}
function add_eps() { //adds provided effort points to Pokemon's Effort Values
function validate_eps(ep1,ep2) { //EPs limits | ep1 = current EPs | ep2 = EPs to be added
var n = actp;
var eps = 1*$('eps-'+n).innerHTML;
epsum = 1*ep1 + 1*ep2;
epsum2 = 1*ep1 + (510-1*eps);
if (ep2 < 0 && epsum > 0) { return epsum; }
if (eps < 510 && ep1 < 255) {
ep3 = (eps + 1*ep2 < 510)?((epsum < 255)?epsum:255):((epsum2 < 255)?epsum2:255);
return ((ep3 < 0)?0:ep3);
}
else { return ep1; }
}
display_base();
var n = actp; //active row
var i=5; do {
$('ep'+i+'-'+n).value = validate_eps($('ep'+i+'-'+n).value,$('eff'+i+'').innerHTML);
} while(i--);
display_eps();
$('name').focus(); //return focus to input
}
/* Calculation functions */
function calc_effectiveness(typ,type1,type2) { //Calculates effectiveness
var mul = damage[typ][type1];
if (type2 != type1) { mul = mul * damage[typ][type2]; }
return mul;
}
function calc_hiddenp() { //Calculates Hidden Power's power
return 60; //Obsolete since XY
var a = arguments;
return Math.floor((0.5*(a[0]&2)+1*(a[1]&2)+2*(a[2]&2)+4*(a[5]&2)+8*(a[3]&2)+16*(a[4]&2))*40/63 + 30);
//return (((((a[4]&2)<<1) + (a[3]&2) + ((a[5]&2)>>>1))*10 + (a[2]&2)*3 + (a[0]&2) + (a[1]&2)) >>> 1)+30; //alternate, by Chase
}
function calc_hiddent() { //Calculates Hidden Power's type
var a = arguments;
return Math.floor(((a[0]&1)+2*(a[1]&1)+4*(a[2]&1)+8*(a[5]&1)+16*(a[3]&1)+32*(a[4]&1))*15/63);
//return (a[2] & 1) + ((a[5] & 1) << 1) + ((a[3] & 1) << 2) + ((a[4] & 1) << 3); //alternate, by Chase, uses the main types[]
}
function calc_hidden(n) { //Displays all possible Hidden Powers
//d = new Date(); time = d.getTime(); //DEBUG
function display_hp() {
t.reverse().sort(); //p.sortnum();
$('hiddent').innerHTML = t.join(', ');
$('hiddenp').innerHTML = 60; //p.join(', ');
//array_intersect(ivs[i],eo[ivhss[i][0]].slice());
//d = new Date(); display_status((d.getTime()-time)/1000); return true; //DEBUG
display_text(n);
}
display_status('<span class="loading">Calculating <em>Hidden Power</em>...</span>');
if ($('medl').checked) {
var t = [typeshp[calc_hiddent($('med0-0').value,$('med1-0').value,$('med2-0').value,$('med3-0').value,$('med4-0').value,$('med5-0').value)]];
//var p = [calc_hiddenp($('med0-0').value,$('med1-0').value,$('med2-0').value,$('med3-0').value,$('med4-0').value,$('med5-0').value)];
display_hp(); return true;
}
if (error != 0) { display_status('Does not compute!<br/>Properly input or Calculate IVs first.'); return false; }
var a = [], b = $('hpt-'+n).value, t = [], p = [], i0=ivs[0].length-1;
do { //must optimize this further
a[0] = ivs[0][i0];
var i1=ivs[1].length-1;
do {
a[1] = ivs[1][i1];
var i2=ivs[2].length-1;
do {
a[2] = ivs[2][i2];
var i3=ivs[3].length-1;
do {
a[3] = ivs[3][i3];
var i4=ivs[4].length-1;
do {
a[4] = ivs[4][i4];
var i5=ivs[5].length-1;
do {
a[5] = ivs[5][i5];
var c = typeshp[calc_hiddent(a[0],a[1],a[2],a[3],a[4],a[5])];
if (b == -1 || c == typeshp[b]) {
if (t.indexOf(c) == -1) { t.push(c); }
//var d = calc_hiddenp(a[0],a[1],a[2],a[3],a[4],a[5]);
//if (p.indexOf(d) == -1) { p.push(d); }
}
if (p.length == 41 && t.length == 16) { display_hp(); return true; } //exit loops if all possible
} while (i5--);
} while (i4--);
} while (i3--);
} while (i2--);
} while (i1--);
} while (i0--);
display_hp();
}
function calc_stat(species,pstat,stativ,statev,pokelvl,nature) { //Calculates Pokemon stats
var basestat = get_base(species,pstat);
var bonus = natures[nature][(pstat-1)];
if (eps == 0) { var statev = 0; }
if (pstat == 0) { //HP uses a different formula
var result = (Math.floor(((basestat*2 + (stativ/1) + Math.floor(statev/4))*pokelvl)/100)) + (pokelvl/1) + 10;
if (species == 292) { return 1; } //Shedinja Case
}
else { var result = Math.floor((Math.floor(((basestat*2 + (stativ/1) + Math.floor(statev/4))*pokelvl)/100) + 5)*bonus); }
return result;
}
ivs = [ivr.slice(),ivr.slice(),ivr.slice(),ivr.slice(),ivr.slice(),ivr.slice()]; //global- IVs array
function calc_stativ(species,pstat,stat,statev,pokelvl,nature,chara,pot1,pot2) { //Calculates Pokemon IVs - brute force
var chara = chara.split('.');
var pot1 = pot1.split('.');