Loads more work on battling, initial stretch to run a turn done.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
285
tests/data/Abilities.json
Normal file
285
tests/data/Abilities.json
Normal file
@@ -0,0 +1,285 @@
|
||||
{
|
||||
"adaptability": {
|
||||
"effect": "IncreasedStab"
|
||||
},
|
||||
"aerilate": {
|
||||
"effect": "ChangeMoveType",
|
||||
"parameters": ["normal", "flying"]
|
||||
},
|
||||
"aftermath": {
|
||||
"effect": "Aftermath"
|
||||
},
|
||||
"air_lock": {
|
||||
"effect": "SuppressWeather"
|
||||
},
|
||||
"analytic": {
|
||||
"effect": "Analytic"
|
||||
},
|
||||
"anger_point": {
|
||||
"effect": "AngerPoint"
|
||||
},
|
||||
"anticipation": {
|
||||
"effect": "Anticipation"
|
||||
},
|
||||
"arena_trap": {
|
||||
"effect": "ArenaTrap"
|
||||
},
|
||||
"aroma_veil": {
|
||||
"effect": "AromaVeil"
|
||||
},
|
||||
"aura_break": {
|
||||
"effect": "AuraBreal"
|
||||
},
|
||||
"bad_dreams": {
|
||||
"effect": "BadDreams"
|
||||
},
|
||||
"battery": {
|
||||
"effect": "Battery"
|
||||
},
|
||||
"battle_armor": {
|
||||
"effect": "PreventCritical"
|
||||
},
|
||||
"battle_bond": {
|
||||
"effect": "BattleBond"
|
||||
},
|
||||
"beast_boost": {
|
||||
"effect": "BeastBoost"
|
||||
},
|
||||
"berserk": {
|
||||
"effect": "Berserk"
|
||||
},
|
||||
"big_pecks": {
|
||||
"effect": "PreventDefLowering"
|
||||
},
|
||||
"blaze": {
|
||||
"effect": "PowerUpType",
|
||||
"parameters": ["fire"]
|
||||
},
|
||||
"bulletproof": {
|
||||
"effect": "Bulletproof"
|
||||
},
|
||||
"cheek_pouch": {
|
||||
"effect": "CheekPouch"
|
||||
},
|
||||
"chlorophyll": {
|
||||
"effect": "DoubleSpeedInWeather",
|
||||
"parameters": ["HarshSunlight"]
|
||||
},
|
||||
"clear_body": {
|
||||
"effect": "PreventStatLowering"
|
||||
},
|
||||
"cloud_nine": {
|
||||
"effect": "SuppressWeather"
|
||||
},
|
||||
"color_change": {
|
||||
"effect": "ColorChange"
|
||||
},
|
||||
"comatose": {},
|
||||
"competitive": {},
|
||||
"compound_eyes": {},
|
||||
"contrary": {},
|
||||
"corrosion": {},
|
||||
"cursed_body": {},
|
||||
"cute_charm": {},
|
||||
"damp": {},
|
||||
"dancer": {},
|
||||
"dark_aura": {},
|
||||
"dazzling": {},
|
||||
"defeatist": {},
|
||||
"defiant": {},
|
||||
"delta_stream": {},
|
||||
"desolate_land": {},
|
||||
"disguise": {},
|
||||
"download": {},
|
||||
"drizzle": {},
|
||||
"drought": {},
|
||||
"dry_skin": {},
|
||||
"early_bird": {},
|
||||
"effect_spore": {},
|
||||
"electric_surge": {},
|
||||
"emergency_exit": {},
|
||||
"fairy_aura": {},
|
||||
"filter": {},
|
||||
"flame_body": {},
|
||||
"flare_boost": {},
|
||||
"flash_fire": {},
|
||||
"flower_gift": {},
|
||||
"flower_veil": {},
|
||||
"fluffy": {},
|
||||
"forecast": {},
|
||||
"forewarn": {},
|
||||
"friend_guard": {},
|
||||
"frisk": {},
|
||||
"full_metal_body": {},
|
||||
"fur_coat": {},
|
||||
"gale_wings": {},
|
||||
"galvanize": {},
|
||||
"gluttony": {},
|
||||
"gooey": {},
|
||||
"grass_pelt": {},
|
||||
"grassy_surge": {},
|
||||
"guts": {},
|
||||
"harvest": {},
|
||||
"healer": {},
|
||||
"heatproof": {},
|
||||
"heavy_metal": {},
|
||||
"honey_gather": {},
|
||||
"huge_power": {},
|
||||
"hustle": {},
|
||||
"hydration": {},
|
||||
"hyper_cutter": {},
|
||||
"ice_body": {},
|
||||
"illuminate": {},
|
||||
"illusion": {},
|
||||
"immunity": {},
|
||||
"imposter": {},
|
||||
"infiltrator": {},
|
||||
"innards_out": {},
|
||||
"inner_focus": {},
|
||||
"insomnia": {},
|
||||
"intimidate": {},
|
||||
"iron_barbs": {},
|
||||
"iron_fist": {},
|
||||
"justified": {},
|
||||
"keen_eye": {},
|
||||
"klutz": {},
|
||||
"leaf_guard": {},
|
||||
"levitate": {},
|
||||
"light_metal": {},
|
||||
"lightning_rod": {},
|
||||
"limber": {},
|
||||
"liquid_ooze": {},
|
||||
"liquid_voice": {},
|
||||
"long_reach": {},
|
||||
"magic_bounce": {},
|
||||
"magic_guard": {},
|
||||
"magician": {},
|
||||
"magma_armor": {},
|
||||
"magnet_pull": {},
|
||||
"marvel_scale": {},
|
||||
"mega_launcher": {},
|
||||
"merciless": {},
|
||||
"minus": {},
|
||||
"misty_surge": {},
|
||||
"mold_breaker": {},
|
||||
"moody": {},
|
||||
"motor_drive": {},
|
||||
"moxie": {},
|
||||
"multiscale": {},
|
||||
"multitype": {},
|
||||
"mummy": {},
|
||||
"natural_cure": {},
|
||||
"no_guard": {},
|
||||
"normalize": {},
|
||||
"oblivious": {},
|
||||
"overcoat": {},
|
||||
"overgrow": {},
|
||||
"own_tempo": {},
|
||||
"parental_bond": {},
|
||||
"pickpocket": {},
|
||||
"pickup": {},
|
||||
"pixilate": {},
|
||||
"plus": {},
|
||||
"poison_heal": {},
|
||||
"poison_point": {},
|
||||
"poison_touch": {},
|
||||
"power_construct": {},
|
||||
"power_of_alchemy": {},
|
||||
"prankster": {},
|
||||
"pressure": {},
|
||||
"primordial_sea": {},
|
||||
"prism_armor": {},
|
||||
"protean": {},
|
||||
"psychic_surge": {},
|
||||
"pure_power": {},
|
||||
"queenly_majesty": {},
|
||||
"quick_feet": {},
|
||||
"rain_dish": {},
|
||||
"rattled": {},
|
||||
"receiver": {},
|
||||
"reckless": {},
|
||||
"refrigerate": {},
|
||||
"regenerator": {},
|
||||
"rivalry": {},
|
||||
"rks_system": {},
|
||||
"rock_head": {},
|
||||
"rough_skin": {},
|
||||
"run_away": {},
|
||||
"sand_force": {},
|
||||
"sand_rush": {},
|
||||
"sand_stream": {},
|
||||
"sand_veil": {},
|
||||
"sap_sipper": {},
|
||||
"schooling": {},
|
||||
"scrappy": {},
|
||||
"serene_grace": {},
|
||||
"shadow_shield": {},
|
||||
"shadow_tag": {},
|
||||
"shed_skin": {},
|
||||
"sheer_force": {},
|
||||
"shell_armor": {},
|
||||
"shield_dust": {},
|
||||
"shields_down": {},
|
||||
"simple": {},
|
||||
"skill_link": {},
|
||||
"slow_start": {},
|
||||
"slush_rush": {},
|
||||
"sniper": {},
|
||||
"snow_cloak": {},
|
||||
"snow_warning": {},
|
||||
"solar_power": {},
|
||||
"solid_rock": {},
|
||||
"soul_heart": {},
|
||||
"soundproof": {},
|
||||
"speed_boost": {},
|
||||
"stakeout": {},
|
||||
"stall": {},
|
||||
"stamina": {},
|
||||
"stance_change": {},
|
||||
"static": {},
|
||||
"steadfast": {},
|
||||
"steelworker": {},
|
||||
"stench": {},
|
||||
"sticky_hold": {},
|
||||
"storm_drain": {},
|
||||
"strong_jaw": {},
|
||||
"sturdy": {},
|
||||
"suction_cups": {},
|
||||
"super_luck": {},
|
||||
"surge_surfer": {},
|
||||
"swarm": {},
|
||||
"sweet_veil": {},
|
||||
"swift_swim": {},
|
||||
"symbiosis": {},
|
||||
"synchronize": {},
|
||||
"tangled_feet": {},
|
||||
"tangling_hair": {},
|
||||
"technician": {},
|
||||
"telepathy": {},
|
||||
"teravolt": {},
|
||||
"thick_fat": {},
|
||||
"tinted_lens": {},
|
||||
"torrent": {},
|
||||
"tough_claws": {},
|
||||
"toxic_boost": {},
|
||||
"trace": {},
|
||||
"triage": {},
|
||||
"truant": {},
|
||||
"turboblaze": {},
|
||||
"unaware": {},
|
||||
"unburden": {},
|
||||
"unnerve": {},
|
||||
"victory_star": {},
|
||||
"vital_spirit": {},
|
||||
"volt_absorb": {},
|
||||
"water_absorb": {},
|
||||
"water_bubble": {},
|
||||
"water_compaction": {},
|
||||
"water_veil": {},
|
||||
"weak_armor": {},
|
||||
"white_smoke": {},
|
||||
"wimp_out": {},
|
||||
"wonder_guard": {},
|
||||
"wonder_skin": {},
|
||||
"zen_mode": {}
|
||||
}
|
||||
614
tests/data/GrowthRates.json
Normal file
614
tests/data/GrowthRates.json
Normal file
@@ -0,0 +1,614 @@
|
||||
{
|
||||
"Erratic": [
|
||||
0,
|
||||
15,
|
||||
52,
|
||||
122,
|
||||
237,
|
||||
406,
|
||||
637,
|
||||
942,
|
||||
1326,
|
||||
1800,
|
||||
2369,
|
||||
3041,
|
||||
3822,
|
||||
4719,
|
||||
5737,
|
||||
6881,
|
||||
8155,
|
||||
9564,
|
||||
11111,
|
||||
12800,
|
||||
14632,
|
||||
16610,
|
||||
18737,
|
||||
21012,
|
||||
23437,
|
||||
26012,
|
||||
28737,
|
||||
31610,
|
||||
34632,
|
||||
37800,
|
||||
41111,
|
||||
44564,
|
||||
48155,
|
||||
51881,
|
||||
55737,
|
||||
59719,
|
||||
63822,
|
||||
68041,
|
||||
72369,
|
||||
76800,
|
||||
81326,
|
||||
85942,
|
||||
90637,
|
||||
95406,
|
||||
100237,
|
||||
105122,
|
||||
110052,
|
||||
115015,
|
||||
120001,
|
||||
125000,
|
||||
131324,
|
||||
137795,
|
||||
144410,
|
||||
151165,
|
||||
158056,
|
||||
165079,
|
||||
172229,
|
||||
179503,
|
||||
186894,
|
||||
194400,
|
||||
202013,
|
||||
209728,
|
||||
217540,
|
||||
225443,
|
||||
233431,
|
||||
241496,
|
||||
249633,
|
||||
257834,
|
||||
267406,
|
||||
276458,
|
||||
286328,
|
||||
296358,
|
||||
305767,
|
||||
316074,
|
||||
326531,
|
||||
336255,
|
||||
346965,
|
||||
357812,
|
||||
367807,
|
||||
378880,
|
||||
390077,
|
||||
400293,
|
||||
411686,
|
||||
423190,
|
||||
433572,
|
||||
445239,
|
||||
457001,
|
||||
467489,
|
||||
479378,
|
||||
491346,
|
||||
501878,
|
||||
513934,
|
||||
526049,
|
||||
536557,
|
||||
548720,
|
||||
560922,
|
||||
571333,
|
||||
583539,
|
||||
591882,
|
||||
600000
|
||||
],
|
||||
"Fast": [
|
||||
0,
|
||||
6,
|
||||
21,
|
||||
51,
|
||||
100,
|
||||
172,
|
||||
274,
|
||||
409,
|
||||
583,
|
||||
800,
|
||||
1064,
|
||||
1382,
|
||||
1757,
|
||||
2195,
|
||||
2700,
|
||||
3276,
|
||||
3930,
|
||||
4665,
|
||||
5487,
|
||||
6400,
|
||||
7408,
|
||||
8518,
|
||||
9733,
|
||||
11059,
|
||||
12500,
|
||||
14060,
|
||||
15746,
|
||||
17561,
|
||||
19511,
|
||||
21600,
|
||||
23832,
|
||||
26214,
|
||||
28749,
|
||||
31443,
|
||||
34300,
|
||||
37324,
|
||||
40522,
|
||||
43897,
|
||||
47455,
|
||||
51200,
|
||||
55136,
|
||||
59270,
|
||||
63605,
|
||||
68147,
|
||||
72900,
|
||||
77868,
|
||||
83058,
|
||||
88473,
|
||||
94119,
|
||||
100000,
|
||||
106120,
|
||||
112486,
|
||||
119101,
|
||||
125971,
|
||||
133100,
|
||||
140492,
|
||||
148154,
|
||||
156089,
|
||||
164303,
|
||||
172800,
|
||||
181584,
|
||||
190662,
|
||||
200037,
|
||||
209715,
|
||||
219700,
|
||||
229996,
|
||||
240610,
|
||||
251545,
|
||||
262807,
|
||||
274400,
|
||||
286328,
|
||||
298598,
|
||||
311213,
|
||||
324179,
|
||||
337500,
|
||||
351180,
|
||||
365226,
|
||||
379641,
|
||||
394431,
|
||||
409600,
|
||||
425152,
|
||||
441094,
|
||||
457429,
|
||||
474163,
|
||||
491300,
|
||||
508844,
|
||||
526802,
|
||||
545177,
|
||||
563975,
|
||||
583200,
|
||||
602856,
|
||||
622950,
|
||||
643485,
|
||||
664467,
|
||||
685900,
|
||||
707788,
|
||||
730138,
|
||||
752953,
|
||||
776239,
|
||||
800000
|
||||
],
|
||||
"MediumFast": [
|
||||
0,
|
||||
8,
|
||||
27,
|
||||
64,
|
||||
125,
|
||||
216,
|
||||
343,
|
||||
512,
|
||||
729,
|
||||
1000,
|
||||
1331,
|
||||
1728,
|
||||
2197,
|
||||
2744,
|
||||
3375,
|
||||
4096,
|
||||
4913,
|
||||
5832,
|
||||
6859,
|
||||
8000,
|
||||
9261,
|
||||
10648,
|
||||
12167,
|
||||
13824,
|
||||
15625,
|
||||
17576,
|
||||
19683,
|
||||
21952,
|
||||
24389,
|
||||
27000,
|
||||
29791,
|
||||
32768,
|
||||
35937,
|
||||
39304,
|
||||
42875,
|
||||
46656,
|
||||
50653,
|
||||
54872,
|
||||
59319,
|
||||
64000,
|
||||
68921,
|
||||
74088,
|
||||
79507,
|
||||
85184,
|
||||
91125,
|
||||
97336,
|
||||
103823,
|
||||
110592,
|
||||
117649,
|
||||
125000,
|
||||
132651,
|
||||
140608,
|
||||
148877,
|
||||
157464,
|
||||
166375,
|
||||
175616,
|
||||
185193,
|
||||
195112,
|
||||
205379,
|
||||
216000,
|
||||
226981,
|
||||
238328,
|
||||
250047,
|
||||
262144,
|
||||
274625,
|
||||
287496,
|
||||
300763,
|
||||
314432,
|
||||
328509,
|
||||
343000,
|
||||
357911,
|
||||
373248,
|
||||
389017,
|
||||
405224,
|
||||
421875,
|
||||
438976,
|
||||
456533,
|
||||
474552,
|
||||
493039,
|
||||
512000,
|
||||
531441,
|
||||
551368,
|
||||
571787,
|
||||
592704,
|
||||
614125,
|
||||
636056,
|
||||
658503,
|
||||
681472,
|
||||
704969,
|
||||
729000,
|
||||
753571,
|
||||
778688,
|
||||
804357,
|
||||
830584,
|
||||
857375,
|
||||
884736,
|
||||
912673,
|
||||
941192,
|
||||
970299,
|
||||
1000000
|
||||
],
|
||||
"MediumSlow": [
|
||||
0,
|
||||
9,
|
||||
57,
|
||||
96,
|
||||
135,
|
||||
179,
|
||||
236,
|
||||
314,
|
||||
419,
|
||||
560,
|
||||
742,
|
||||
973,
|
||||
1261,
|
||||
1612,
|
||||
2035,
|
||||
2535,
|
||||
3120,
|
||||
3798,
|
||||
4575,
|
||||
5460,
|
||||
6458,
|
||||
7577,
|
||||
8825,
|
||||
10208,
|
||||
11735,
|
||||
13411,
|
||||
15244,
|
||||
17242,
|
||||
19411,
|
||||
21760,
|
||||
24294,
|
||||
27021,
|
||||
29949,
|
||||
33084,
|
||||
36435,
|
||||
40007,
|
||||
43808,
|
||||
47846,
|
||||
52127,
|
||||
56660,
|
||||
61450,
|
||||
66505,
|
||||
71833,
|
||||
77440,
|
||||
83335,
|
||||
89523,
|
||||
96012,
|
||||
102810,
|
||||
109923,
|
||||
117360,
|
||||
125126,
|
||||
133229,
|
||||
141677,
|
||||
150476,
|
||||
159635,
|
||||
169159,
|
||||
179056,
|
||||
189334,
|
||||
199999,
|
||||
211060,
|
||||
222522,
|
||||
234393,
|
||||
246681,
|
||||
259392,
|
||||
272535,
|
||||
286115,
|
||||
300140,
|
||||
314618,
|
||||
329555,
|
||||
344960,
|
||||
360838,
|
||||
377197,
|
||||
394045,
|
||||
411388,
|
||||
429235,
|
||||
447591,
|
||||
466464,
|
||||
485862,
|
||||
505791,
|
||||
526260,
|
||||
547274,
|
||||
568841,
|
||||
590969,
|
||||
613664,
|
||||
636935,
|
||||
660787,
|
||||
685228,
|
||||
710266,
|
||||
735907,
|
||||
762160,
|
||||
789030,
|
||||
816525,
|
||||
844653,
|
||||
873420,
|
||||
902835,
|
||||
932903,
|
||||
963632,
|
||||
995030,
|
||||
1027103,
|
||||
1059860
|
||||
],
|
||||
"Slow": [
|
||||
0,
|
||||
10,
|
||||
33,
|
||||
80,
|
||||
156,
|
||||
270,
|
||||
428,
|
||||
640,
|
||||
911,
|
||||
1250,
|
||||
1663,
|
||||
2160,
|
||||
2746,
|
||||
3430,
|
||||
4218,
|
||||
5120,
|
||||
6141,
|
||||
7290,
|
||||
8573,
|
||||
10000,
|
||||
11576,
|
||||
13310,
|
||||
15208,
|
||||
17280,
|
||||
19531,
|
||||
21970,
|
||||
24603,
|
||||
27440,
|
||||
30486,
|
||||
33750,
|
||||
37238,
|
||||
40960,
|
||||
44921,
|
||||
49130,
|
||||
53593,
|
||||
58320,
|
||||
63316,
|
||||
68590,
|
||||
74148,
|
||||
80000,
|
||||
86151,
|
||||
92610,
|
||||
99383,
|
||||
106480,
|
||||
113906,
|
||||
121670,
|
||||
129778,
|
||||
138240,
|
||||
147061,
|
||||
156250,
|
||||
165813,
|
||||
175760,
|
||||
186096,
|
||||
196830,
|
||||
207968,
|
||||
219520,
|
||||
231491,
|
||||
243890,
|
||||
256723,
|
||||
270000,
|
||||
283726,
|
||||
297910,
|
||||
312558,
|
||||
327680,
|
||||
343281,
|
||||
359370,
|
||||
375953,
|
||||
393040,
|
||||
410636,
|
||||
428750,
|
||||
447388,
|
||||
466560,
|
||||
486271,
|
||||
506530,
|
||||
527343,
|
||||
548720,
|
||||
570666,
|
||||
593190,
|
||||
616298,
|
||||
640000,
|
||||
664301,
|
||||
689210,
|
||||
714733,
|
||||
740880,
|
||||
767656,
|
||||
795070,
|
||||
823128,
|
||||
851840,
|
||||
881211,
|
||||
911250,
|
||||
941963,
|
||||
973360,
|
||||
1005446,
|
||||
1038230,
|
||||
1071718,
|
||||
1105920,
|
||||
1140841,
|
||||
1176490,
|
||||
1212873,
|
||||
1250000
|
||||
],
|
||||
"Fluctuating": [
|
||||
0,
|
||||
4,
|
||||
13,
|
||||
32,
|
||||
65,
|
||||
112,
|
||||
178,
|
||||
276,
|
||||
393,
|
||||
540,
|
||||
745,
|
||||
967,
|
||||
1230,
|
||||
1591,
|
||||
1957,
|
||||
2457,
|
||||
3046,
|
||||
3732,
|
||||
4526,
|
||||
5440,
|
||||
6482,
|
||||
7666,
|
||||
9003,
|
||||
10506,
|
||||
12187,
|
||||
14060,
|
||||
16140,
|
||||
18439,
|
||||
20974,
|
||||
23760,
|
||||
26811,
|
||||
30146,
|
||||
33780,
|
||||
37731,
|
||||
42017,
|
||||
46656,
|
||||
50653,
|
||||
55969,
|
||||
60505,
|
||||
66560,
|
||||
71677,
|
||||
78533,
|
||||
84277,
|
||||
91998,
|
||||
98415,
|
||||
107069,
|
||||
114205,
|
||||
123863,
|
||||
131766,
|
||||
142500,
|
||||
151222,
|
||||
163105,
|
||||
172697,
|
||||
185807,
|
||||
196322,
|
||||
210739,
|
||||
222231,
|
||||
238036,
|
||||
250562,
|
||||
267840,
|
||||
281456,
|
||||
300293,
|
||||
315059,
|
||||
335544,
|
||||
351520,
|
||||
373744,
|
||||
390991,
|
||||
415050,
|
||||
433631,
|
||||
459620,
|
||||
479600,
|
||||
507617,
|
||||
529063,
|
||||
559209,
|
||||
582187,
|
||||
614566,
|
||||
639146,
|
||||
673863,
|
||||
700115,
|
||||
737280,
|
||||
765275,
|
||||
804997,
|
||||
834809,
|
||||
877201,
|
||||
908905,
|
||||
954084,
|
||||
987754,
|
||||
1035837,
|
||||
1071552,
|
||||
1122660,
|
||||
1160499,
|
||||
1214753,
|
||||
1254796,
|
||||
1312322,
|
||||
1354652,
|
||||
1415577,
|
||||
1460276,
|
||||
1524731,
|
||||
1571884,
|
||||
1640000
|
||||
]
|
||||
}
|
||||
5913
tests/data/Items.json
Normal file
5913
tests/data/Items.json
Normal file
File diff suppressed because it is too large
Load Diff
10400
tests/data/Moves.json
Normal file
10400
tests/data/Moves.json
Normal file
File diff suppressed because it is too large
Load Diff
26
tests/data/Natures.csv
Normal file
26
tests/data/Natures.csv
Normal file
@@ -0,0 +1,26 @@
|
||||
Name|Increased|Decreased
|
||||
Hardy||
|
||||
Lonely|Attack|Defense
|
||||
Brave|Attack|Speed
|
||||
Adamant|Attack|SpecialAttack
|
||||
Naughty|Attack|SpecialDefense
|
||||
Bold|Defense|Attack
|
||||
Docile||
|
||||
Relaxed|Defense|Speed
|
||||
Impish|Defense|SpecialAttack
|
||||
Lax|Defense|SpecialDefense
|
||||
Timid|Speed|Attack
|
||||
Hasty|Speed|Defense
|
||||
Serious||
|
||||
Jolly|Speed|SpecialAttack
|
||||
Naive|Speed|SpecialDefense
|
||||
Modest|SpecialAttack|Attack
|
||||
Mild|SpecialAttack|Defense
|
||||
Quiet|SpecialAttack|Speed
|
||||
Bashful||
|
||||
Rash|SpecialAttack|SpecialDefense
|
||||
Calm|SpecialDefense|Attack
|
||||
Gentle|SpecialDefense|Defense
|
||||
Sassy|SpecialDefense|Speed
|
||||
Careful|SpecialDefense|SpecialAttack
|
||||
Quirky||
|
||||
|
86767
tests/data/Pokemon.json
Normal file
86767
tests/data/Pokemon.json
Normal file
File diff suppressed because it is too large
Load Diff
19
tests/data/Types.csv
Normal file
19
tests/data/Types.csv
Normal file
@@ -0,0 +1,19 @@
|
||||
Types|Normal|Fighting|Flying|Poison|Ground|Rock|Bug|Ghost|Steel|Fire|Water|Grass|Electric|Psychic|Ice|Dragon|Dark|Fairy
|
||||
Normal|1|1|1|1|1|0.5|1|0|0.5|1|1|1|1|1|1|1|1|1
|
||||
Fighting|2|1|0.5|0.5|1|2|0.5|0|2|1|1|1|1|0.5|2|1|2|0.5
|
||||
Flying|1|2|1|1|1|0.5|2|1|0.5|1|1|2|0.5|1|1|1|1|1
|
||||
Poison|1|1|1|0.5|0.5|0.5|1|0.5|0|1|1|2|1|1|1|1|1|2
|
||||
Ground|1|1|0|2|1|2|0.5|1|2|2|1|0.5|2|1|1|1|1|1
|
||||
Rock|1|0.5|2|1|0.5|1|2|1|0.5|2|1|1|1|1|2|1|1|1
|
||||
Bug|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
|
||||
Ghost|0|1|1|1|1|1|1|2|1|1|1|1|1|2|1|1|0.5|1
|
||||
Steel|1|1|1|1|1|2|1|1|0.5|0.5|0.5|1|0.5|1|2|1|1|2
|
||||
Fire|1|1|1|1|1|0.5|2|1|2|0.5|0.5|2|1|1|2|0.5|1|1
|
||||
Water|1|1|1|1|2|2|1|1|1|2|0.5|0.5|1|1|1|0.5|1|1
|
||||
Grass|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
|
||||
Electric|1|1|2|1|0|1|1|1|1|1|2|0.5|0.5|1|1|0.5|1|1
|
||||
Psychic|1|2|1|2|1|1|1|1|0.5|1|1|1|1|0.5|1|1|0|1
|
||||
Ice|1|1|2|1|2|1|1|1|0.5|0.5|0.5|2|1|1|0.5|2|1|1
|
||||
Dragon|1|1|1|1|1|1|1|1|0.5|1|1|1|1|1|1|2|1|0
|
||||
Dark|1|0.5|1|1|1|1|1|2|1|1|1|1|1|2|1|1|0.5|0.5
|
||||
Fairy|1|2|1|0.5|1|1|1|1|0.5|0.5|1|1|1|1|1|2|2|1
|
||||
|
141
tests/library_loader.rs
Normal file
141
tests/library_loader.rs
Normal file
@@ -0,0 +1,141 @@
|
||||
use hashbrown::HashSet;
|
||||
use pkmn_lib::static_data::{DataLibrary, EffectParameter, MoveData, MoveLibrary, SecondaryEffect, TypeLibrary};
|
||||
use pkmn_lib::StringKey;
|
||||
use project_root::get_project_root;
|
||||
use serde_json::Value;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
|
||||
pub fn load_types(path: &String) -> TypeLibrary {
|
||||
let mut type_library = TypeLibrary::new(18);
|
||||
|
||||
let mut reader = csv::ReaderBuilder::new()
|
||||
.delimiter(b'|')
|
||||
.from_path(path.to_string() + "Types.csv")
|
||||
.unwrap();
|
||||
let headers = reader.headers().unwrap();
|
||||
for header in headers.iter().skip(1) {
|
||||
type_library.register_type(&StringKey::new(header.clone()));
|
||||
}
|
||||
|
||||
for record in reader.records() {
|
||||
let record = record.unwrap();
|
||||
let offensive_type = record.get(0).unwrap();
|
||||
let offensive_type_id = type_library.get_type_id(&StringKey::new(offensive_type.clone()));
|
||||
|
||||
for (i, v) in record.iter().skip(1).enumerate() {
|
||||
let effectiveness = v.parse::<f32>().unwrap();
|
||||
type_library.set_effectiveness(offensive_type_id, i as u8, effectiveness);
|
||||
}
|
||||
}
|
||||
|
||||
type_library
|
||||
}
|
||||
|
||||
pub fn load_moves(path: &String, type_library: &TypeLibrary) -> MoveLibrary {
|
||||
let mut file = File::open(path.to_string() + "Moves.json").unwrap();
|
||||
let mut data = String::new();
|
||||
file.read_to_string(&mut data).unwrap();
|
||||
println!("1");
|
||||
let json: Value = serde_json::from_str(&data).unwrap();
|
||||
println!("a");
|
||||
let data = json.as_object().unwrap().get("data").unwrap().as_array().unwrap();
|
||||
println!("this");
|
||||
let mut move_library = MoveLibrary::new(data.len());
|
||||
println!("Heeere");
|
||||
for move_data in data {
|
||||
let move_data = move_data.as_object().unwrap();
|
||||
let move_name = StringKey::new(move_data["name"].as_str().unwrap().clone());
|
||||
println!("Loaded move {:?}", move_name);
|
||||
let move_type = StringKey::new(move_data["type"].as_str().unwrap());
|
||||
let move_type_id = type_library.get_type_id(&move_type);
|
||||
let move_category = serde_json::from_value(move_data["category"].clone()).unwrap();
|
||||
let base_power = move_data["power"].as_i64().unwrap() as u8;
|
||||
let accuracy = move_data["accuracy"].as_i64().unwrap() as u8;
|
||||
let pp = move_data["pp"].as_i64().unwrap() as u8;
|
||||
let target = serde_json::from_value(move_data["target"].clone()).unwrap();
|
||||
let priority = move_data["priority"].as_i64().unwrap() as i8;
|
||||
let secondary_effect = if let Some(v) = move_data.get("effect") {
|
||||
let mut chance = -1.0;
|
||||
if let Some(chance_value) = v.get("chance") {
|
||||
chance = chance_value.as_f64().unwrap() as f32;
|
||||
}
|
||||
let mut parameters = Vec::new();
|
||||
if let Some(pars) = v.get("parameters") {
|
||||
let pars = pars.as_array().unwrap();
|
||||
for par in pars {
|
||||
match par {
|
||||
Value::Null => {
|
||||
panic!("Unexpected type")
|
||||
}
|
||||
Value::Bool(b) => {
|
||||
parameters.push(EffectParameter::Bool(*b));
|
||||
}
|
||||
Value::Number(n) => {
|
||||
if n.is_f64() {
|
||||
parameters.push(EffectParameter::Float(n.as_f64().unwrap() as f32));
|
||||
} else {
|
||||
parameters.push(EffectParameter::Int(n.as_i64().unwrap()));
|
||||
}
|
||||
}
|
||||
Value::String(s) => {
|
||||
parameters.push(EffectParameter::String(s.clone()));
|
||||
}
|
||||
Value::Array(_) => {
|
||||
panic!("Unexpected type")
|
||||
}
|
||||
Value::Object(_) => {
|
||||
panic!("Unexpected type")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SecondaryEffect::new(chance, StringKey::new(v["name"].as_str().unwrap().clone()), parameters)
|
||||
} else {
|
||||
SecondaryEffect::empty()
|
||||
};
|
||||
|
||||
let mut flags = HashSet::new();
|
||||
if let Some(f) = move_data.get("flags") {
|
||||
let f = f.as_array().unwrap();
|
||||
for flag in f {
|
||||
flags.insert(StringKey::new(flag.as_str().unwrap()));
|
||||
}
|
||||
}
|
||||
|
||||
move_library.add(
|
||||
&move_name,
|
||||
MoveData::new(
|
||||
&move_name.clone(),
|
||||
move_type_id,
|
||||
move_category,
|
||||
base_power,
|
||||
accuracy,
|
||||
pp,
|
||||
target,
|
||||
priority,
|
||||
secondary_effect,
|
||||
flags,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
move_library
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(miri, ignore)]
|
||||
fn test_type_library_loaded() {
|
||||
let mut path = get_project_root().unwrap();
|
||||
path.push("tests/data/");
|
||||
let lib = load_types(&path.to_str().unwrap().to_string());
|
||||
|
||||
assert_eq!(
|
||||
lib.get_effectiveness(
|
||||
lib.get_type_id(&StringKey::new("fire")),
|
||||
&vec![lib.get_type_id(&StringKey::new("grass")),]
|
||||
),
|
||||
2.0
|
||||
);
|
||||
}
|
||||
13
tests/tests.rs
Normal file
13
tests/tests.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use project_root::get_project_root;
|
||||
|
||||
pub mod library_loader;
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(miri, ignore)]
|
||||
fn run_integration_tests() {
|
||||
let mut path = get_project_root().unwrap();
|
||||
path.push("tests/data/");
|
||||
let path = path.to_str().unwrap().to_string();
|
||||
let type_library = library_loader::load_types(&path);
|
||||
let move_library = library_loader::load_moves(&path, &type_library);
|
||||
}
|
||||
Reference in New Issue
Block a user