summaryrefslogtreecommitdiff
path: root/src/com/sneed/pkrandom/Settings.java
blob: 7bbff05b924513b0a7816dc8249876c0ab72a230 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
package com.sneed.pkrandom;

/*----------------------------------------------------------------------------*/
/*--  Settings.java - encapsulates a configuration of settings used by the  --*/
/*--                  randomizer to determine how to randomize the          --*/
/*--                  target game.                                          --*/
/*--                                                                        --*/
/*--  Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team          --*/
/*--  Originally part of "Universal Pokemon Randomizer" by sneed        --*/
/*--  Pokemon and any associated names and the like are                     --*/
/*--  trademark and (C) Nintendo 1996-2020.                                 --*/
/*--                                                                        --*/
/*--  The custom code written here is licensed under the terms of the GPL:  --*/
/*--                                                                        --*/
/*--  This program is free software: you can redistribute it and/or modify  --*/
/*--  it under the terms of the GNU General Public License as published by  --*/
/*--  the Free Software Foundation, either version 3 of the License, or     --*/
/*--  (at your option) any later version.                                   --*/
/*--                                                                        --*/
/*--  This program is distributed in the hope that it will be useful,       --*/
/*--  but WITHOUT ANY WARRANTY; without even the implied warranty of        --*/
/*--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          --*/
/*--  GNU General Public License for more details.                          --*/
/*--                                                                        --*/
/*--  You should have received a copy of the GNU General Public License     --*/
/*--  along with this program. If not, see <http://www.gnu.org/licenses/>.  --*/
/*----------------------------------------------------------------------------*/

import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.Base64;
import java.util.List;
import java.util.zip.CRC32;

import com.sneed.pkrandom.pokemon.ExpCurve;
import com.sneed.pkrandom.pokemon.GenRestrictions;
import com.sneed.pkrandom.pokemon.Pokemon;
import com.sneed.pkrandom.romhandlers.Gen1RomHandler;
import com.sneed.pkrandom.romhandlers.Gen2RomHandler;
import com.sneed.pkrandom.romhandlers.Gen3RomHandler;
import com.sneed.pkrandom.romhandlers.Gen5RomHandler;
import com.sneed.pkrandom.romhandlers.RomHandler;

public class Settings {

    public static final int VERSION = Version.VERSION;

    public static final int LENGTH_OF_SETTINGS_DATA = 51;

    private CustomNamesSet customNames;

    private String romName;
    private boolean updatedFromOldVersion = false;
    private GenRestrictions currentRestrictions;
    private int currentMiscTweaks;

    private boolean changeImpossibleEvolutions;
    private boolean makeEvolutionsEasier;
    private boolean removeTimeBasedEvolutions;
    private boolean raceMode;
    private boolean blockBrokenMoves;
    private boolean limitPokemon;
    private boolean banIrregularAltFormes;
    private boolean dualTypeOnly;

    public enum BaseStatisticsMod {
        UNCHANGED, SHUFFLE, RANDOM,
    }

    public enum ExpCurveMod {
        LEGENDARIES, STRONG_LEGENDARIES, ALL
    }

    private BaseStatisticsMod baseStatisticsMod = BaseStatisticsMod.UNCHANGED;
    private boolean baseStatsFollowEvolutions;
    private boolean baseStatsFollowMegaEvolutions;
    private boolean assignEvoStatsRandomly;
    private boolean updateBaseStats;
    private int updateBaseStatsToGeneration;
    private boolean standardizeEXPCurves;
    private ExpCurve selectedEXPCurve;
    private ExpCurveMod expCurveMod = ExpCurveMod.LEGENDARIES;

    public enum AbilitiesMod {
        UNCHANGED, RANDOMIZE
    }

    private AbilitiesMod abilitiesMod = AbilitiesMod.UNCHANGED;
    private boolean allowWonderGuard = true;
    private boolean abilitiesFollowEvolutions;
    private boolean abilitiesFollowMegaEvolutions;
    private boolean banTrappingAbilities;
    private boolean banNegativeAbilities;
    private boolean banBadAbilities;
    private boolean weighDuplicateAbilitiesTogether;
    private boolean ensureTwoAbilities;

    public enum StartersMod {
        UNCHANGED, CUSTOM, COMPLETELY_RANDOM, RANDOM_WITH_TWO_EVOLUTIONS
    }

    private StartersMod startersMod = StartersMod.UNCHANGED;
    private boolean allowStarterAltFormes;

    // index in the rom's list of pokemon
    // offset from the dropdown index from RandomizerGUI by 1
    private int[] customStarters = new int[3];
    private boolean randomizeStartersHeldItems;
    private boolean limitMainGameLegendaries;
    private boolean limit600;
    private boolean banBadRandomStarterHeldItems;

    public enum TypesMod {
        UNCHANGED, RANDOM_FOLLOW_EVOLUTIONS, COMPLETELY_RANDOM
    }

    private TypesMod typesMod = TypesMod.UNCHANGED;

    private boolean typesFollowMegaEvolutions;

    // Evolutions
    public enum EvolutionsMod {
        UNCHANGED, RANDOM, RANDOM_EVERY_LEVEL
    }

    private EvolutionsMod evolutionsMod = EvolutionsMod.UNCHANGED;
    private boolean evosSimilarStrength;
    private boolean evosSameTyping;
    private boolean evosMaxThreeStages;
    private boolean evosForceChange;
    private boolean evosAllowAltFormes;

    // Move data
    private boolean randomizeMovePowers;
    private boolean randomizeMoveAccuracies;
    private boolean randomizeMovePPs;
    private boolean randomizeMoveTypes;
    private boolean randomizeMoveCategory;
    private boolean updateMoves;
    private int updateMovesToGeneration;
    private boolean updateMovesLegacy;

    public enum MovesetsMod {
        UNCHANGED, RANDOM_PREFER_SAME_TYPE, COMPLETELY_RANDOM, METRONOME_ONLY
    }

    private MovesetsMod movesetsMod = MovesetsMod.UNCHANGED;
    private boolean startWithGuaranteedMoves;
    private int guaranteedMoveCount = 2;
    private boolean reorderDamagingMoves;
    private boolean movesetsForceGoodDamaging;
    private int movesetsGoodDamagingPercent = 0;
    private boolean blockBrokenMovesetMoves;
    private boolean evolutionMovesForAll;

    public enum TrainersMod {
        UNCHANGED, RANDOM, DISTRIBUTED, MAINPLAYTHROUGH, TYPE_THEMED, TYPE_THEMED_ELITE4_GYMS
    }

    private TrainersMod trainersMod = TrainersMod.UNCHANGED;
    private boolean rivalCarriesStarterThroughout;
    private boolean trainersUsePokemonOfSimilarStrength;
    private boolean trainersMatchTypingDistribution;
    private boolean trainersBlockLegendaries = true;
    private boolean trainersBlockEarlyWonderGuard = true;
    private boolean trainersEnforceDistribution;
    private boolean trainersEnforceMainPlaythrough;
    private boolean randomizeTrainerNames;
    private boolean randomizeTrainerClassNames;
    private boolean trainersForceFullyEvolved;
    private int trainersForceFullyEvolvedLevel = 30;
    private boolean trainersLevelModified;
    private int trainersLevelModifier = 0; // -50 ~ 50
    private int eliteFourUniquePokemonNumber = 0; // 0 ~ 2
    private boolean allowTrainerAlternateFormes;
    private boolean swapTrainerMegaEvos;
    private int additionalBossTrainerPokemon = 0;
    private int additionalImportantTrainerPokemon = 0;
    private int additionalRegularTrainerPokemon = 0;
    private boolean randomizeHeldItemsForBossTrainerPokemon;
    private boolean randomizeHeldItemsForImportantTrainerPokemon;
    private boolean randomizeHeldItemsForRegularTrainerPokemon;
    private boolean consumableItemsOnlyForTrainerPokemon;
    private boolean sensibleItemsOnlyForTrainerPokemon;
    private boolean highestLevelOnlyGetsItemsForTrainerPokemon;
    private boolean doubleBattleMode;
    private boolean shinyChance;
    private boolean betterTrainerMovesets;

    public enum WildPokemonMod {
        UNCHANGED, RANDOM, AREA_MAPPING, GLOBAL_MAPPING
    }

    public enum WildPokemonRestrictionMod {
        NONE, SIMILAR_STRENGTH, CATCH_EM_ALL, TYPE_THEME_AREAS
    }

    private WildPokemonMod wildPokemonMod = WildPokemonMod.UNCHANGED;
    private WildPokemonRestrictionMod wildPokemonRestrictionMod = WildPokemonRestrictionMod.NONE;
    private boolean useTimeBasedEncounters;
    private boolean blockWildLegendaries = true;
    private boolean useMinimumCatchRate;
    private int minimumCatchRateLevel = 1;
    private boolean randomizeWildPokemonHeldItems;
    private boolean banBadRandomWildPokemonHeldItems;
    private boolean balanceShakingGrass;
    private boolean wildLevelsModified;
    private int wildLevelModifier = 0;
    private boolean allowWildAltFormes;

    public enum StaticPokemonMod {
        UNCHANGED, RANDOM_MATCHING, COMPLETELY_RANDOM, SIMILAR_STRENGTH
    }

    private StaticPokemonMod staticPokemonMod = StaticPokemonMod.UNCHANGED;

    private boolean allowStaticAltFormes;
    private boolean swapStaticMegaEvos;
    private boolean staticLevelModified;
    private int staticLevelModifier = 0; // -50 ~ 50
    private boolean correctStaticMusic;

    public enum TotemPokemonMod {
        UNCHANGED, RANDOM, SIMILAR_STRENGTH
    }

    public enum AllyPokemonMod {
        UNCHANGED, RANDOM, SIMILAR_STRENGTH
    }

    public enum AuraMod {
        UNCHANGED, RANDOM, SAME_STRENGTH
    }

    private TotemPokemonMod totemPokemonMod = TotemPokemonMod.UNCHANGED;
    private AllyPokemonMod allyPokemonMod = AllyPokemonMod.UNCHANGED;
    private AuraMod auraMod = AuraMod.UNCHANGED;
    private boolean randomizeTotemHeldItems;
    private boolean totemLevelsModified;
    private int totemLevelModifier = 0;
    private boolean allowTotemAltFormes;

    public enum TMsMod {
        UNCHANGED, RANDOM
    }

    private TMsMod tmsMod = TMsMod.UNCHANGED;
    private boolean tmLevelUpMoveSanity;
    private boolean keepFieldMoveTMs;
    private boolean fullHMCompat;
    private boolean tmsForceGoodDamaging;
    private int tmsGoodDamagingPercent = 0;
    private boolean blockBrokenTMMoves;
    private boolean tmsFollowEvolutions;

    public enum TMsHMsCompatibilityMod {
        UNCHANGED, RANDOM_PREFER_TYPE, COMPLETELY_RANDOM, FULL
    }

    private TMsHMsCompatibilityMod tmsHmsCompatibilityMod = TMsHMsCompatibilityMod.UNCHANGED;

    public enum MoveTutorMovesMod {
        UNCHANGED, RANDOM
    }

    private MoveTutorMovesMod moveTutorMovesMod = MoveTutorMovesMod.UNCHANGED;
    private boolean tutorLevelUpMoveSanity;
    private boolean keepFieldMoveTutors;
    private boolean tutorsForceGoodDamaging;
    private int tutorsGoodDamagingPercent = 0;
    private boolean blockBrokenTutorMoves;
    private boolean tutorFollowEvolutions;

    public enum MoveTutorsCompatibilityMod {
        UNCHANGED, RANDOM_PREFER_TYPE, COMPLETELY_RANDOM, FULL
    }

    private MoveTutorsCompatibilityMod moveTutorsCompatibilityMod = MoveTutorsCompatibilityMod.UNCHANGED;

    public enum InGameTradesMod {
        UNCHANGED, RANDOMIZE_GIVEN, RANDOMIZE_GIVEN_AND_REQUESTED
    }

    private InGameTradesMod inGameTradesMod = InGameTradesMod.UNCHANGED;
    private boolean randomizeInGameTradesNicknames;
    private boolean randomizeInGameTradesOTs;
    private boolean randomizeInGameTradesIVs;
    private boolean randomizeInGameTradesItems;

    public enum FieldItemsMod {
        UNCHANGED, SHUFFLE, RANDOM, RANDOM_EVEN
    }

    private FieldItemsMod fieldItemsMod = FieldItemsMod.UNCHANGED;
    private boolean banBadRandomFieldItems;

    public enum ShopItemsMod {
        UNCHANGED, SHUFFLE, RANDOM
    }

    private ShopItemsMod shopItemsMod = ShopItemsMod.UNCHANGED;
    private boolean banBadRandomShopItems;
    private boolean banRegularShopItems;
    private boolean banOPShopItems;
    private boolean balanceShopPrices;
    private boolean guaranteeEvolutionItems;
    private boolean guaranteeXItems;

    public enum PickupItemsMod {
        UNCHANGED, RANDOM
    }

    private PickupItemsMod pickupItemsMod = PickupItemsMod.UNCHANGED;
    private boolean banBadRandomPickupItems;

    // to and from strings etc
    public void write(FileOutputStream out) throws IOException {
        byte[] settings = toString().getBytes("UTF-8");
        ByteBuffer buf = ByteBuffer.allocate(settings.length + 8);
        buf.putInt(VERSION);
        buf.putInt(settings.length);
        buf.put(settings);
        out.write(buf.array());
    }

    public static Settings read(FileInputStream in) throws IOException, UnsupportedOperationException {
        byte[] versionBytes = new byte[4];
        byte[] lengthBytes = new byte[4];
        int nread = in.read(versionBytes);
        if (nread < 4) {
            throw new UnsupportedOperationException("Error reading version number from settings string.");
        }
        int version = ByteBuffer.wrap(versionBytes).getInt();
        if (((version >> 24) & 0xFF) > 0 && ((version >> 24) & 0xFF) <= 172) {
            throw new UnsupportedOperationException("The settings file is old and must be updated. Press Settings -> \"Update Pre-3.0.0 Settings File\" to update.");
        }
        if (version > VERSION) {
            throw new UnsupportedOperationException("Cannot read settings from a newer version of the randomizer.");
        }
        nread = in.read(lengthBytes);
        if (nread < 4) {
            throw new UnsupportedOperationException("Error reading settings length from settings string.");
        }
        int length = ByteBuffer.wrap(lengthBytes).getInt();
        byte[] buffer = FileFunctions.readFullyIntoBuffer(in, length);
        String settings = new String(buffer, "UTF-8");
        boolean oldUpdate = false;

        if (version < VERSION) {
            oldUpdate = true;
            settings = new SettingsUpdater().update(version, settings);
        }

        Settings settingsObj = fromString(settings);
        settingsObj.setUpdatedFromOldVersion(oldUpdate);
        return settingsObj;
    }

    @Override
    public String toString() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        // 0: general options #1 + trainer/class names
        out.write(makeByteSelected(changeImpossibleEvolutions, updateMoves, updateMovesLegacy, randomizeTrainerNames,
                randomizeTrainerClassNames, makeEvolutionsEasier, removeTimeBasedEvolutions));

        // 1: pokemon base stats & abilities
        out.write(makeByteSelected(baseStatsFollowEvolutions, baseStatisticsMod == BaseStatisticsMod.RANDOM,
                baseStatisticsMod == BaseStatisticsMod.SHUFFLE, baseStatisticsMod == BaseStatisticsMod.UNCHANGED,
                standardizeEXPCurves, updateBaseStats, baseStatsFollowMegaEvolutions, assignEvoStatsRandomly));

        // 2: pokemon types & more general options
        out.write(makeByteSelected(typesMod == TypesMod.RANDOM_FOLLOW_EVOLUTIONS,
                typesMod == TypesMod.COMPLETELY_RANDOM, typesMod == TypesMod.UNCHANGED, raceMode, blockBrokenMoves,
                limitPokemon, typesFollowMegaEvolutions, dualTypeOnly));

        // 3: v171: changed to the abilities byte
        out.write(makeByteSelected(abilitiesMod == AbilitiesMod.UNCHANGED, abilitiesMod == AbilitiesMod.RANDOMIZE,
                allowWonderGuard, abilitiesFollowEvolutions, banTrappingAbilities, banNegativeAbilities, banBadAbilities,
                abilitiesFollowMegaEvolutions));

        // 4: starter pokemon stuff
        out.write(makeByteSelected(startersMod == StartersMod.CUSTOM, startersMod == StartersMod.COMPLETELY_RANDOM,
                startersMod == StartersMod.UNCHANGED, startersMod == StartersMod.RANDOM_WITH_TWO_EVOLUTIONS,
                randomizeStartersHeldItems, banBadRandomStarterHeldItems, allowStarterAltFormes));

        // 5 - 10: dropdowns
        write2ByteInt(out, customStarters[0] - 1);
        write2ByteInt(out, customStarters[1] - 1);
        write2ByteInt(out, customStarters[2] - 1);

        // 11 movesets
        out.write(makeByteSelected(movesetsMod == MovesetsMod.COMPLETELY_RANDOM,
                movesetsMod == MovesetsMod.RANDOM_PREFER_SAME_TYPE, movesetsMod == MovesetsMod.UNCHANGED,
                movesetsMod == MovesetsMod.METRONOME_ONLY, startWithGuaranteedMoves, reorderDamagingMoves)
                | ((guaranteedMoveCount - 2) << 6));

        // 12 movesets good damaging
        out.write((movesetsForceGoodDamaging ? 0x80 : 0) | movesetsGoodDamagingPercent);

        // 13 trainer pokemon
        out.write(makeByteSelected(trainersMod == TrainersMod.UNCHANGED,
                trainersMod == TrainersMod.RANDOM,
                trainersMod == TrainersMod.DISTRIBUTED,
                trainersMod == TrainersMod.MAINPLAYTHROUGH,
                trainersMod == TrainersMod.TYPE_THEMED,
                trainersMod == TrainersMod.TYPE_THEMED_ELITE4_GYMS));
        
        // 14 trainer pokemon force evolutions
        out.write((trainersForceFullyEvolved ? 0x80 : 0) | trainersForceFullyEvolvedLevel);

        // 15 wild pokemon
        out.write(makeByteSelected(wildPokemonRestrictionMod == WildPokemonRestrictionMod.CATCH_EM_ALL,
                wildPokemonMod == WildPokemonMod.AREA_MAPPING,
                wildPokemonRestrictionMod == WildPokemonRestrictionMod.NONE,
                wildPokemonRestrictionMod == WildPokemonRestrictionMod.TYPE_THEME_AREAS,
                wildPokemonMod == WildPokemonMod.GLOBAL_MAPPING, wildPokemonMod == WildPokemonMod.RANDOM,
                wildPokemonMod == WildPokemonMod.UNCHANGED, useTimeBasedEncounters));

        // 16 wild pokemon 2
        out.write(makeByteSelected(useMinimumCatchRate, blockWildLegendaries,
                wildPokemonRestrictionMod == WildPokemonRestrictionMod.SIMILAR_STRENGTH, randomizeWildPokemonHeldItems,
                banBadRandomWildPokemonHeldItems, false, false, balanceShakingGrass));

        // 17 static pokemon
        out.write(makeByteSelected(staticPokemonMod == StaticPokemonMod.UNCHANGED,
                staticPokemonMod == StaticPokemonMod.RANDOM_MATCHING,
                staticPokemonMod == StaticPokemonMod.COMPLETELY_RANDOM,
                staticPokemonMod == StaticPokemonMod.SIMILAR_STRENGTH,
                limitMainGameLegendaries, limit600, allowStaticAltFormes, swapStaticMegaEvos));

        // 18 tm randomization
        out.write(makeByteSelected(tmsHmsCompatibilityMod == TMsHMsCompatibilityMod.COMPLETELY_RANDOM,
                tmsHmsCompatibilityMod == TMsHMsCompatibilityMod.RANDOM_PREFER_TYPE,
                tmsHmsCompatibilityMod == TMsHMsCompatibilityMod.UNCHANGED, tmsMod == TMsMod.RANDOM,
                tmsMod == TMsMod.UNCHANGED, tmLevelUpMoveSanity, keepFieldMoveTMs,
                tmsHmsCompatibilityMod == TMsHMsCompatibilityMod.FULL));

        // 19 tms part 2
        out.write(makeByteSelected(fullHMCompat, tmsFollowEvolutions, tutorFollowEvolutions));

        // 20 tms good damaging
        out.write((tmsForceGoodDamaging ? 0x80 : 0) | tmsGoodDamagingPercent);

        // 21 move tutor randomization
        out.write(makeByteSelected(moveTutorsCompatibilityMod == MoveTutorsCompatibilityMod.COMPLETELY_RANDOM,
                moveTutorsCompatibilityMod == MoveTutorsCompatibilityMod.RANDOM_PREFER_TYPE,
                moveTutorsCompatibilityMod == MoveTutorsCompatibilityMod.UNCHANGED,
                moveTutorMovesMod == MoveTutorMovesMod.RANDOM, moveTutorMovesMod == MoveTutorMovesMod.UNCHANGED,
                tutorLevelUpMoveSanity, keepFieldMoveTutors,
                moveTutorsCompatibilityMod == MoveTutorsCompatibilityMod.FULL));

        // 22 tutors good damaging
        out.write((tutorsForceGoodDamaging ? 0x80 : 0) | tutorsGoodDamagingPercent);

        // 23 in game trades
        out.write(makeByteSelected(inGameTradesMod == InGameTradesMod.RANDOMIZE_GIVEN_AND_REQUESTED,
                inGameTradesMod == InGameTradesMod.RANDOMIZE_GIVEN, randomizeInGameTradesItems,
                randomizeInGameTradesIVs, randomizeInGameTradesNicknames, randomizeInGameTradesOTs,
                inGameTradesMod == InGameTradesMod.UNCHANGED));

        // 24 field items
        out.write(makeByteSelected(fieldItemsMod == FieldItemsMod.RANDOM, fieldItemsMod == FieldItemsMod.SHUFFLE,
                fieldItemsMod == FieldItemsMod.UNCHANGED, banBadRandomFieldItems, fieldItemsMod == FieldItemsMod.RANDOM_EVEN));

        // 25 move randomizers
        // + static music
        out.write(makeByteSelected(randomizeMovePowers, randomizeMoveAccuracies, randomizeMovePPs, randomizeMoveTypes,
                randomizeMoveCategory, correctStaticMusic));

        // 26 evolutions
        out.write(makeByteSelected(evolutionsMod == EvolutionsMod.UNCHANGED, evolutionsMod == EvolutionsMod.RANDOM,
                evosSimilarStrength, evosSameTyping, evosMaxThreeStages, evosForceChange, evosAllowAltFormes,
                evolutionsMod == EvolutionsMod.RANDOM_EVERY_LEVEL));
        
        // 27 pokemon trainer misc
        out.write(makeByteSelected(trainersUsePokemonOfSimilarStrength, 
                rivalCarriesStarterThroughout,
                trainersMatchTypingDistribution,
                trainersBlockLegendaries,
                trainersBlockEarlyWonderGuard,
                swapTrainerMegaEvos,
                shinyChance,
                betterTrainerMovesets));

        // 28 - 31: pokemon restrictions
        try {
            if (currentRestrictions != null) {
                writeFullInt(out, currentRestrictions.toInt());
            } else {
                writeFullInt(out, 0);
            }
        } catch (IOException e) {
            e.printStackTrace(); // better than nothing
        }

        // 32 - 35: misc tweaks
        try {
            writeFullInt(out, currentMiscTweaks);
        } catch (IOException e) {
            e.printStackTrace(); // better than nothing
        }

        // 36 trainer pokemon level modifier
        out.write((trainersLevelModified ? 0x80 : 0) | (trainersLevelModifier+50));

        // 37 shop items
        out.write(makeByteSelected(shopItemsMod == ShopItemsMod.RANDOM, shopItemsMod == ShopItemsMod.SHUFFLE,
                shopItemsMod == ShopItemsMod.UNCHANGED, banBadRandomShopItems, banRegularShopItems, banOPShopItems,
                balanceShopPrices, guaranteeEvolutionItems));

        // 38 wild level modifier
        out.write((wildLevelsModified ? 0x80 : 0) | (wildLevelModifier+50));

        // 39 EXP curve mod, block broken moves, alt forme stuff
        out.write(makeByteSelected(
                expCurveMod == ExpCurveMod.LEGENDARIES,
                expCurveMod == ExpCurveMod.STRONG_LEGENDARIES,
                expCurveMod == ExpCurveMod.ALL,
                blockBrokenMovesetMoves,
                blockBrokenTMMoves,
                blockBrokenTutorMoves,
                allowTrainerAlternateFormes,
                allowWildAltFormes));

        // 40 Double Battle Mode, Additional Boss/Important Trainer Pokemon, Weigh Duplicate Abilities
        out.write((doubleBattleMode ? 0x1 : 0) |
                (additionalBossTrainerPokemon << 1) |
                (additionalImportantTrainerPokemon << 4) |
                (weighDuplicateAbilitiesTogether ? 0x80 : 0));

        // 41 Additional Regular Trainer Pokemon, Aura modification, evolution moves, guarantee X items
        out.write(additionalRegularTrainerPokemon |
                ((auraMod == AuraMod.UNCHANGED) ? 0x8 : 0) |
                ((auraMod == AuraMod.RANDOM) ? 0x10 : 0) |
                ((auraMod == AuraMod.SAME_STRENGTH) ? 0x20 : 0) |
                (evolutionMovesForAll ? 0x40 : 0) |
                (guaranteeXItems ? 0x80 : 0));

        // 42 Totem Pokemon settings
        out.write(makeByteSelected(
                totemPokemonMod == TotemPokemonMod.UNCHANGED,
                totemPokemonMod == TotemPokemonMod.RANDOM,
                totemPokemonMod == TotemPokemonMod.SIMILAR_STRENGTH,
                allyPokemonMod == AllyPokemonMod.UNCHANGED,
                allyPokemonMod == AllyPokemonMod.RANDOM,
                allyPokemonMod == AllyPokemonMod.SIMILAR_STRENGTH,
                randomizeTotemHeldItems,
                allowTotemAltFormes));

        // 43 Totem level modifier
        out.write((totemLevelsModified ? 0x80 : 0) | (totemLevelModifier+50));

        // 44 - 45: These two get a byte each for future proofing
        out.write(updateBaseStatsToGeneration);
        out.write(updateMovesToGeneration);

        // 46 Selected EXP curve
        out.write(selectedEXPCurve.toByte());

        // 47 Static level modifier
        out.write((staticLevelModified ? 0x80 : 0) | (staticLevelModifier+50));

        // 48 trainer pokemon held items / pokemon ensure two abilities
        out.write(makeByteSelected(randomizeHeldItemsForBossTrainerPokemon,
                randomizeHeldItemsForImportantTrainerPokemon,
                randomizeHeldItemsForRegularTrainerPokemon,
                consumableItemsOnlyForTrainerPokemon,
                sensibleItemsOnlyForTrainerPokemon,
                highestLevelOnlyGetsItemsForTrainerPokemon,
                ensureTwoAbilities));

        // 49 pickup item randomization
        out.write(makeByteSelected(pickupItemsMod == PickupItemsMod.RANDOM,
                pickupItemsMod == PickupItemsMod.UNCHANGED, banBadRandomPickupItems,
                banIrregularAltFormes));

        // 50 elite four unique pokemon (3 bits) + catch rate level (3 bits)
        out.write(eliteFourUniquePokemonNumber | ((minimumCatchRateLevel - 1) << 3));

        try {
            byte[] romName = this.romName.getBytes("US-ASCII");
            out.write(romName.length);
            out.write(romName);
        } catch (IOException e) {
            out.write(0);
        }

        byte[] current = out.toByteArray();
        CRC32 checksum = new CRC32();
        checksum.update(current);

        try {
            writeFullInt(out, (int) checksum.getValue());
            writeFullInt(out, FileFunctions.getFileChecksum(SysConstants.customNamesFile));
        } catch (IOException e) {
            e.printStackTrace(); // better than nothing
        }

        return Base64.getEncoder().encodeToString(out.toByteArray());
    }

    public static Settings fromString(String settingsString) throws UnsupportedEncodingException, IllegalArgumentException {
        byte[] data = Base64.getDecoder().decode(settingsString);
        checkChecksum(data);

        Settings settings = new Settings();

        // Restore the actual controls
        settings.setChangeImpossibleEvolutions(restoreState(data[0], 0));
        settings.setUpdateMoves(restoreState(data[0], 1));
        settings.setUpdateMovesLegacy(restoreState(data[0], 2));
        settings.setRandomizeTrainerNames(restoreState(data[0], 3));
        settings.setRandomizeTrainerClassNames(restoreState(data[0], 4));
        settings.setMakeEvolutionsEasier(restoreState(data[0], 5));
        settings.setRemoveTimeBasedEvolutions(restoreState(data[0], 6));

        settings.setBaseStatisticsMod(restoreEnum(BaseStatisticsMod.class, data[1], 3, // UNCHANGED
                2, // SHUFFLE
                1 // RANDOM
        ));
        settings.setStandardizeEXPCurves(restoreState(data[1], 4));
        settings.setBaseStatsFollowEvolutions(restoreState(data[1], 0));
        settings.setUpdateBaseStats(restoreState(data[1], 5));
        settings.setBaseStatsFollowMegaEvolutions(restoreState(data[1],6));
        settings.setAssignEvoStatsRandomly(restoreState(data[1],7));

        settings.setTypesMod(restoreEnum(TypesMod.class, data[2], 2, // UNCHANGED
                0, // RANDOM_FOLLOW_EVOLUTIONS
                1 // COMPLETELY_RANDOM
        ));
        settings.setRaceMode(restoreState(data[2], 3));
        settings.setBlockBrokenMoves(restoreState(data[2], 4));
        settings.setLimitPokemon(restoreState(data[2], 5));
        settings.setTypesFollowMegaEvolutions(restoreState(data[2],6));
        settings.setDualTypeOnly(restoreState(data[2], 7));
        settings.setAbilitiesMod(restoreEnum(AbilitiesMod.class, data[3], 0, // UNCHANGED
                1 // RANDOMIZE
        ));
        settings.setAllowWonderGuard(restoreState(data[3], 2));
        settings.setAbilitiesFollowEvolutions(restoreState(data[3], 3));
        settings.setBanTrappingAbilities(restoreState(data[3], 4));
        settings.setBanNegativeAbilities(restoreState(data[3], 5));
        settings.setBanBadAbilities(restoreState(data[3], 6));
        settings.setAbilitiesFollowMegaEvolutions(restoreState(data[3],7));

        settings.setStartersMod(restoreEnum(StartersMod.class, data[4], 2, // UNCHANGED
                0, // CUSTOM
                1, // COMPLETELY_RANDOM
                3 // RANDOM_WITH_TWO_EVOLUTIONS
        ));
        settings.setRandomizeStartersHeldItems(restoreState(data[4], 4));
        settings.setBanBadRandomStarterHeldItems(restoreState(data[4], 5));
        settings.setAllowStarterAltFormes(restoreState(data[4],6));

        settings.setCustomStarters(new int[] { FileFunctions.read2ByteInt(data, 5) + 1,
                FileFunctions.read2ByteInt(data, 7) + 1, FileFunctions.read2ByteInt(data, 9) + 1 });

        settings.setMovesetsMod(restoreEnum(MovesetsMod.class, data[11], 2, // UNCHANGED
                1, // RANDOM_PREFER_SAME_TYPE
                0, // COMPLETELY_RANDOM
                3 // METRONOME_ONLY
        ));
        settings.setStartWithGuaranteedMoves(restoreState(data[11], 4));
        settings.setReorderDamagingMoves(restoreState(data[11], 5));
        settings.setGuaranteedMoveCount(((data[11] & 0xC0) >> 6) + 2);

        settings.setMovesetsForceGoodDamaging(restoreState(data[12], 7));
        settings.setMovesetsGoodDamagingPercent(data[12] & 0x7F);

        // changed 160
        settings.setTrainersMod(restoreEnum(TrainersMod.class, data[13], 0, // UNCHANGED
                1, // RANDOM
                2, // DISTRIBUTED
                3, // MAINPLAYTHROUGH 
                4, // TYPE_THEMED
                5 // TYPE_THEMED_ELITE4_GYMS
        ));

        settings.setTrainersForceFullyEvolved(restoreState(data[14], 7));
        settings.setTrainersForceFullyEvolvedLevel(data[14] & 0x7F);

        settings.setWildPokemonMod(restoreEnum(WildPokemonMod.class, data[15], 6, // UNCHANGED
                5, // RANDOM
                1, // AREA_MAPPING
                4 // GLOBAL_MAPPING
        ));
        settings.setWildPokemonRestrictionMod(getEnum(WildPokemonRestrictionMod.class, restoreState(data[15], 2), // NONE
                restoreState(data[16], 2), // SIMILAR_STRENGTH
                restoreState(data[15], 0), // CATCH_EM_ALL
                restoreState(data[15], 3) // TYPE_THEME_AREAS
        ));
        settings.setUseTimeBasedEncounters(restoreState(data[15], 7));

        settings.setUseMinimumCatchRate(restoreState(data[16], 0));
        settings.setBlockWildLegendaries(restoreState(data[16], 1));
        settings.setRandomizeWildPokemonHeldItems(restoreState(data[16], 3));
        settings.setBanBadRandomWildPokemonHeldItems(restoreState(data[16], 4));
        settings.setBalanceShakingGrass(restoreState(data[16], 7));

        settings.setStaticPokemonMod(restoreEnum(StaticPokemonMod.class, data[17], 0, // UNCHANGED
                1, // RANDOM_MATCHING
                2, // COMPLETELY_RANDOM
                3  // SIMILAR_STRENGTH 
        ));
        
        settings.setLimitMainGameLegendaries(restoreState(data[17], 4));
        settings.setLimit600(restoreState(data[17], 5));
        settings.setAllowStaticAltFormes(restoreState(data[17], 6));
        settings.setSwapStaticMegaEvos(restoreState(data[17], 7));
        
        settings.setTmsMod(restoreEnum(TMsMod.class, data[18], 4, // UNCHANGED
                3 // RANDOM
        ));
        settings.setTmsHmsCompatibilityMod(restoreEnum(TMsHMsCompatibilityMod.class, data[18], 2, // UNCHANGED
                1, // RANDOM_PREFER_TYPE
                0, // COMPLETELY_RANDOM
                7 // FULL
        )); 
        settings.setTmLevelUpMoveSanity(restoreState(data[18], 5));
        settings.setKeepFieldMoveTMs(restoreState(data[18], 6));

        settings.setFullHMCompat(restoreState(data[19], 0));
        settings.setTmsFollowEvolutions(restoreState(data[19], 1));
        settings.setTutorFollowEvolutions(restoreState(data[19], 2));

        settings.setTmsForceGoodDamaging(restoreState(data[20], 7));
        settings.setTmsGoodDamagingPercent(data[20] & 0x7F);

        settings.setMoveTutorMovesMod(restoreEnum(MoveTutorMovesMod.class, data[21], 4, // UNCHANGED
                3 // RANDOM
        ));
        settings.setMoveTutorsCompatibilityMod(restoreEnum(MoveTutorsCompatibilityMod.class, data[21], 2, // UNCHANGED
                1, // RANDOM_PREFER_TYPE
                0, // COMPLETELY_RANDOM
                7 // FULL
        ));
        settings.setTutorLevelUpMoveSanity(restoreState(data[21], 5));
        settings.setKeepFieldMoveTutors(restoreState(data[21], 6));

        settings.setTutorsForceGoodDamaging(restoreState(data[22], 7));
        settings.setTutorsGoodDamagingPercent(data[22] & 0x7F);

        // new 150
        settings.setInGameTradesMod(restoreEnum(InGameTradesMod.class, data[23], 6, // UNCHANGED
                1, // RANDOMIZE_GIVEN
                0 // RANDOMIZE_GIVEN_AND_REQUESTED
        ));
        settings.setRandomizeInGameTradesItems(restoreState(data[23], 2));
        settings.setRandomizeInGameTradesIVs(restoreState(data[23], 3));
        settings.setRandomizeInGameTradesNicknames(restoreState(data[23], 4));
        settings.setRandomizeInGameTradesOTs(restoreState(data[23], 5));

        settings.setFieldItemsMod(restoreEnum(FieldItemsMod.class, data[24],  
                2,  // UNCHANGED
                1,  // SHUFFLE
                0,  // RANDOM
                4   // RANDOM_EVEN
        ));
        settings.setBanBadRandomFieldItems(restoreState(data[24], 3));

        // new 170
        settings.setRandomizeMovePowers(restoreState(data[25], 0));
        settings.setRandomizeMoveAccuracies(restoreState(data[25], 1));
        settings.setRandomizeMovePPs(restoreState(data[25], 2));
        settings.setRandomizeMoveTypes(restoreState(data[25], 3));
        settings.setRandomizeMoveCategory(restoreState(data[25], 4));
        settings.setCorrectStaticMusic(restoreState(data[25], 5));

        settings.setEvolutionsMod(restoreEnum(EvolutionsMod.class, data[26], 0, // UNCHANGED
                1, // RANDOM
                7 // RANDOM_EVERY_LEVEL
        ));
        settings.setEvosSimilarStrength(restoreState(data[26], 2));
        settings.setEvosSameTyping(restoreState(data[26], 3));
        settings.setEvosMaxThreeStages(restoreState(data[26], 4));
        settings.setEvosForceChange(restoreState(data[26], 5));
        settings.setEvosAllowAltFormes(restoreState(data[26],6));

        // new pokemon trainer misc
        settings.setTrainersUsePokemonOfSimilarStrength(restoreState(data[27], 0));
        settings.setRivalCarriesStarterThroughout(restoreState(data[27], 1));
        settings.setTrainersMatchTypingDistribution(restoreState(data[27], 2));
        settings.setTrainersBlockLegendaries(restoreState(data[27], 3));
        settings.setTrainersBlockEarlyWonderGuard(restoreState(data[27], 4));
        settings.setSwapTrainerMegaEvos(restoreState(data[27], 5));
        settings.setShinyChance(restoreState(data[27], 6));
        settings.setBetterTrainerMovesets(restoreState(data[27], 7));

        // gen restrictions
        int genLimit = FileFunctions.readFullIntBigEndian(data, 28);
        GenRestrictions restrictions = null;
        if (genLimit != 0) {
            restrictions = new GenRestrictions(genLimit);
        }
        settings.setCurrentRestrictions(restrictions);

        int codeTweaks = FileFunctions.readFullIntBigEndian(data, 32);

        settings.setCurrentMiscTweaks(codeTweaks);

        settings.setTrainersLevelModified(restoreState(data[36], 7));
        settings.setTrainersLevelModifier((data[36] & 0x7F) - 50);
        //settings.setTrainersLevelModifier((data[36] & 0x7F));
        settings.setShopItemsMod(restoreEnum(ShopItemsMod.class,data[37],
                2,
                1,
                0));
        settings.setBanBadRandomShopItems(restoreState(data[37],3));
        settings.setBanRegularShopItems(restoreState(data[37],4));
        settings.setBanOPShopItems(restoreState(data[37],5));
        settings.setBalanceShopPrices(restoreState(data[37],6));
        settings.setGuaranteeEvolutionItems(restoreState(data[37],7));

        settings.setWildLevelsModified(restoreState(data[38],7));
        settings.setWildLevelModifier((data[38] & 0x7F) - 50);

        settings.setExpCurveMod(restoreEnum(ExpCurveMod.class,data[39],0,1,2));

        settings.setBlockBrokenMovesetMoves(restoreState(data[39],3));
        settings.setBlockBrokenTMMoves(restoreState(data[39],4));
        settings.setBlockBrokenTutorMoves(restoreState(data[39],5));

        settings.setAllowTrainerAlternateFormes(restoreState(data[39],6));
        settings.setAllowWildAltFormes(restoreState(data[39],7));

        settings.setDoubleBattleMode(restoreState(data[40], 0));
        settings.setAdditionalBossTrainerPokemon((data[40] & 0xE) >> 1);
        settings.setAdditionalImportantTrainerPokemon((data[40] & 0x70) >> 4);
        settings.setWeighDuplicateAbilitiesTogether(restoreState(data[40], 7));

        settings.setAdditionalRegularTrainerPokemon((data[41] & 0x7));
        settings.setAuraMod(restoreEnum(AuraMod.class,data[41],3,4,5));
        settings.setEvolutionMovesForAll(restoreState(data[41],6));
        settings.setGuaranteeXItems(restoreState(data[41],7));

        settings.setTotemPokemonMod(restoreEnum(TotemPokemonMod.class,data[42],0,1,2));
        settings.setAllyPokemonMod(restoreEnum(AllyPokemonMod.class,data[42],3,4,5));
        settings.setRandomizeTotemHeldItems(restoreState(data[42],6));
        settings.setAllowTotemAltFormes(restoreState(data[42],7));
        settings.setTotemLevelsModified(restoreState(data[43],7));
        settings.setTotemLevelModifier((data[43] & 0x7F) - 50);

        settings.setUpdateBaseStatsToGeneration(data[44]);

        settings.setUpdateMovesToGeneration(data[45]);

        settings.setSelectedEXPCurve(ExpCurve.fromByte(data[46]));

        settings.setStaticLevelModified(restoreState(data[47],7));
        settings.setStaticLevelModifier((data[47] & 0x7F) - 50);

        settings.setRandomizeHeldItemsForBossTrainerPokemon(restoreState(data[48], 0));
        settings.setRandomizeHeldItemsForImportantTrainerPokemon(restoreState(data[48], 1));
        settings.setRandomizeHeldItemsForRegularTrainerPokemon(restoreState(data[48], 2));
        settings.setConsumableItemsOnlyForTrainers(restoreState(data[48], 3));
        settings.setSensibleItemsOnlyForTrainers(restoreState(data[48], 4));
        settings.setHighestLevelGetsItemsForTrainers(restoreState(data[48], 5));
        settings.setEnsureTwoAbilities(restoreState(data[48], 6));

        settings.setPickupItemsMod(restoreEnum(PickupItemsMod.class, data[49],
                1, // UNCHANGED
                0));       // RANDOMIZE
        settings.setBanBadRandomPickupItems(restoreState(data[49], 2));
        settings.setBanIrregularAltFormes(restoreState(data[49], 3));

        settings.setEliteFourUniquePokemonNumber(data[50] & 0x7);
        settings.setMinimumCatchRateLevel(((data[50] & 0x38) >> 3) + 1);

        int romNameLength = data[LENGTH_OF_SETTINGS_DATA] & 0xFF;
        String romName = new String(data, LENGTH_OF_SETTINGS_DATA + 1, romNameLength, "US-ASCII");
        settings.setRomName(romName);

        return settings;
    }

    public static class TweakForROMFeedback {
        private boolean changedStarter;
        private boolean removedCodeTweaks;

        public boolean isChangedStarter() {
            return changedStarter;
        }

        public TweakForROMFeedback setChangedStarter(boolean changedStarter) {
            this.changedStarter = changedStarter;
            return this;
        }

        public boolean isRemovedCodeTweaks() {
            return removedCodeTweaks;
        }

        public TweakForROMFeedback setRemovedCodeTweaks(boolean removedCodeTweaks) {
            this.removedCodeTweaks = removedCodeTweaks;
            return this;
        }
    }

    public TweakForROMFeedback tweakForRom(RomHandler rh) {

        TweakForROMFeedback feedback = new TweakForROMFeedback();

        // move update check
        if (this.isUpdateMovesLegacy() && rh instanceof Gen5RomHandler) {
            // don't actually update moves
            this.setUpdateMovesLegacy(false);
            this.setUpdateMoves(false);
        }

        // starters
        List<Pokemon> romPokemon = rh.getPokemonInclFormes();
        List<Pokemon> romStarters = rh.getStarters();
        for (int starter = 0; starter < 3; starter++) {
            if (this.customStarters[starter] < 0 || this.customStarters[starter] >= romPokemon.size()) {
                // invalid starter for this game
                feedback.setChangedStarter(true);
                if (starter >= romStarters.size()) {
                    this.customStarters[starter] = 1;
                } else {
                    this.customStarters[starter] = romPokemon.indexOf(romStarters.get(starter));
                }
            }
        }

        // gen restrictions
        if (rh instanceof Gen1RomHandler || (rh instanceof Gen3RomHandler && !rh.isRomValid())) {
            this.currentRestrictions = null;
            this.setLimitPokemon(false);
        } else if (this.currentRestrictions != null) {
            this.currentRestrictions.limitToGen(rh.generationOfPokemon());
        }

        // gen 5 exclusive stuff
        if (rh.generationOfPokemon() != 5) {
            if (trainersMod == TrainersMod.MAINPLAYTHROUGH) {
                trainersMod = TrainersMod.RANDOM;
            }
        }

        // misc tweaks
        int oldMiscTweaks = this.currentMiscTweaks;
        this.currentMiscTweaks &= rh.miscTweaksAvailable();

        if (oldMiscTweaks != this.currentMiscTweaks) {
            feedback.setRemovedCodeTweaks(true);
        }

        if (rh.abilitiesPerPokemon() == 0) {
            this.setAbilitiesMod(AbilitiesMod.UNCHANGED);
            this.setAllowWonderGuard(false);
        }

        if (!(rh instanceof Gen2RomHandler || rh instanceof Gen3RomHandler)) {
            // starter held items don't exist
            this.setRandomizeStartersHeldItems(false);
            this.setBanBadRandomStarterHeldItems(false);
        }

        if (!rh.supportsFourStartingMoves()) {
            this.setStartWithGuaranteedMoves(false);
        }

        if (rh instanceof Gen1RomHandler || rh instanceof Gen2RomHandler) {
            this.setTrainersBlockEarlyWonderGuard(false);
        }

        if (!rh.hasTimeBasedEncounters()) {
            this.setUseTimeBasedEncounters(false);
        }

        if (rh instanceof Gen1RomHandler) {
            this.setRandomizeWildPokemonHeldItems(false);
            this.setBanBadRandomWildPokemonHeldItems(false);
        }

        if (!rh.canChangeStaticPokemon()) {
            this.setStaticPokemonMod(StaticPokemonMod.UNCHANGED);
        }

        if (!rh.hasMoveTutors()) {
            this.setMoveTutorMovesMod(MoveTutorMovesMod.UNCHANGED);
            this.setMoveTutorsCompatibilityMod(MoveTutorsCompatibilityMod.UNCHANGED);
            this.setTutorLevelUpMoveSanity(false);
            this.setKeepFieldMoveTutors(false);
        }

        if (rh instanceof Gen1RomHandler) {
            // missing some ingame trade fields
            this.setRandomizeInGameTradesItems(false);
            this.setRandomizeInGameTradesIVs(false);
            this.setRandomizeInGameTradesOTs(false);
        }

        if (!rh.hasPhysicalSpecialSplit()) {
            this.setRandomizeMoveCategory(false);
        }

        if (!rh.hasShopRandomization()) {
            this.setShopItemsMod(ShopItemsMod.UNCHANGED);
        }

        // done
        return feedback;
    }

    // getters and setters

    public CustomNamesSet getCustomNames() {
        return customNames;
    }

    public Settings setCustomNames(CustomNamesSet customNames) {
        this.customNames = customNames;
        return this;
    }

    public String getRomName() {
        return romName;
    }

    public void setRomName(String romName) {
        this.romName = romName;
    }

    public boolean isUpdatedFromOldVersion() {
        return updatedFromOldVersion;
    }

    private void setUpdatedFromOldVersion(boolean updatedFromOldVersion) {
        this.updatedFromOldVersion = updatedFromOldVersion;
    }

    public GenRestrictions getCurrentRestrictions() {
        return currentRestrictions;
    }

    public void setCurrentRestrictions(GenRestrictions currentRestrictions) {
        this.currentRestrictions = currentRestrictions;
    }

    public int getCurrentMiscTweaks() {
        return currentMiscTweaks;
    }

    public void setCurrentMiscTweaks(int currentMiscTweaks) {
        this.currentMiscTweaks = currentMiscTweaks;
    }

    public boolean isUpdateMoves() {
        return updateMoves;
    }

    public void setUpdateMoves(boolean updateMoves) {
        this.updateMoves = updateMoves;
    }

    public boolean isUpdateMovesLegacy() {
        return updateMovesLegacy;
    }

    public void setUpdateMovesLegacy(boolean updateMovesLegacy) {
        this.updateMovesLegacy = updateMovesLegacy;
    }

    public int getUpdateMovesToGeneration() {
        return updateMovesToGeneration;
    }

    public void setUpdateMovesToGeneration(int generation) {
        updateMovesToGeneration = generation;
    }

    public boolean isChangeImpossibleEvolutions() {
        return changeImpossibleEvolutions;
    }

    public boolean isDualTypeOnly(){
        return dualTypeOnly;
    }

    public void setDualTypeOnly(boolean dualTypeOnly){
        this.dualTypeOnly = dualTypeOnly;
    }

    public void setChangeImpossibleEvolutions(boolean changeImpossibleEvolutions) {
        this.changeImpossibleEvolutions = changeImpossibleEvolutions;
    }

    public boolean isMakeEvolutionsEasier() {
        return makeEvolutionsEasier;
    }

    public void setMakeEvolutionsEasier(boolean makeEvolutionsEasier) {
        this.makeEvolutionsEasier = makeEvolutionsEasier;
    }

    public boolean isRemoveTimeBasedEvolutions() {
        return removeTimeBasedEvolutions;
    }

    public void setRemoveTimeBasedEvolutions(boolean removeTimeBasedEvolutions) {
        this.removeTimeBasedEvolutions = removeTimeBasedEvolutions;
    }

    public boolean isEvosAllowAltFormes() {
        return evosAllowAltFormes;
    }

    public void setEvosAllowAltFormes(boolean evosAllowAltFormes) {
        this.evosAllowAltFormes = evosAllowAltFormes;
    }

    public boolean isRaceMode() {
        return raceMode;
    }

    public void setRaceMode(boolean raceMode) {
        this.raceMode = raceMode;
    }

    public boolean isBanIrregularAltFormes() {
        return banIrregularAltFormes;
    }

    public void setBanIrregularAltFormes(boolean banIrregularAltFormes) {
        this.banIrregularAltFormes = banIrregularAltFormes;
    }

    public boolean doBlockBrokenMoves() {
        return blockBrokenMoves;
    }

    public void setBlockBrokenMoves(boolean blockBrokenMoves) {
        blockBrokenMovesetMoves = blockBrokenMoves;
        blockBrokenTMMoves = blockBrokenMoves;
        blockBrokenTutorMoves = blockBrokenMoves;
    }

    public boolean isLimitPokemon() {
        return limitPokemon;
    }

    public void setLimitPokemon(boolean limitPokemon) {
        this.limitPokemon = limitPokemon;
    }

    public BaseStatisticsMod getBaseStatisticsMod() {
        return baseStatisticsMod;
    }

    public void setBaseStatisticsMod(boolean... bools) {
        setBaseStatisticsMod(getEnum(BaseStatisticsMod.class, bools));
    }

    private void setBaseStatisticsMod(BaseStatisticsMod baseStatisticsMod) {
        this.baseStatisticsMod = baseStatisticsMod;
    }

    public boolean isBaseStatsFollowEvolutions() {
        return baseStatsFollowEvolutions;
    }

    public void setBaseStatsFollowEvolutions(boolean baseStatsFollowEvolutions) {
        this.baseStatsFollowEvolutions = baseStatsFollowEvolutions;
    }

    public boolean isBaseStatsFollowMegaEvolutions() {
        return baseStatsFollowMegaEvolutions;
    }

    public void setBaseStatsFollowMegaEvolutions(boolean baseStatsFollowMegaEvolutions) {
        this.baseStatsFollowMegaEvolutions = baseStatsFollowMegaEvolutions;
    }

    public boolean isAssignEvoStatsRandomly() {
        return assignEvoStatsRandomly;
    }

    public void setAssignEvoStatsRandomly(boolean assignEvoStatsRandomly) {
        this.assignEvoStatsRandomly = assignEvoStatsRandomly;
    }


    public boolean isStandardizeEXPCurves() {
        return standardizeEXPCurves;
    }

    public void setStandardizeEXPCurves(boolean standardizeEXPCurves) {
        this.standardizeEXPCurves = standardizeEXPCurves;
    }

    public ExpCurveMod getExpCurveMod() {
        return expCurveMod;
    }

    public void setExpCurveMod(boolean... bools) {
        setExpCurveMod(getEnum(ExpCurveMod.class, bools));
    }

    private void setExpCurveMod(ExpCurveMod expCurveMod) {
        this.expCurveMod = expCurveMod;
    }

    public ExpCurve getSelectedEXPCurve() {
        return selectedEXPCurve;
    }

    public void setSelectedEXPCurve(ExpCurve expCurve) {
        this.selectedEXPCurve = expCurve;
    }

    public boolean isUpdateBaseStats() {
        return updateBaseStats;
    }

    public void setUpdateBaseStats(boolean updateBaseStats) {
        this.updateBaseStats = updateBaseStats;
    }

    public int getUpdateBaseStatsToGeneration() {
        return updateBaseStatsToGeneration;
    }

    public void setUpdateBaseStatsToGeneration(int generation) {
        this.updateBaseStatsToGeneration = generation;
    }

    public AbilitiesMod getAbilitiesMod() {
        return abilitiesMod;
    }

    public void setAbilitiesMod(boolean... bools) {
        setAbilitiesMod(getEnum(AbilitiesMod.class, bools));
    }

    private void setAbilitiesMod(AbilitiesMod abilitiesMod) {
        this.abilitiesMod = abilitiesMod;
    }

    public boolean isAllowWonderGuard() {
        return allowWonderGuard;
    }

    public void setAllowWonderGuard(boolean allowWonderGuard) {
        this.allowWonderGuard = allowWonderGuard;
    }

    public boolean isAbilitiesFollowEvolutions() {
        return abilitiesFollowEvolutions;
    }

    public void setAbilitiesFollowEvolutions(boolean abilitiesFollowEvolutions) {
        this.abilitiesFollowEvolutions = abilitiesFollowEvolutions;
    }

    public boolean isAbilitiesFollowMegaEvolutions() {
        return abilitiesFollowMegaEvolutions;
    }

    public void setAbilitiesFollowMegaEvolutions(boolean abilitiesFollowMegaEvolutions) {
        this.abilitiesFollowMegaEvolutions = abilitiesFollowMegaEvolutions;
    }

    public boolean isBanTrappingAbilities() {
        return banTrappingAbilities;
    }

    public void setBanTrappingAbilities(boolean banTrappingAbilities) {
        this.banTrappingAbilities = banTrappingAbilities;
    }

    public boolean isBanNegativeAbilities() {
        return banNegativeAbilities;
    }

    public void setBanNegativeAbilities(boolean banNegativeAbilities) {
        this.banNegativeAbilities = banNegativeAbilities;
    }

    public boolean isBanBadAbilities() {
        return banBadAbilities;
    }

    public void setBanBadAbilities(boolean banBadAbilities) {
        this.banBadAbilities = banBadAbilities;
    }

    public boolean isWeighDuplicateAbilitiesTogether() {
        return weighDuplicateAbilitiesTogether;
    }

    public void setWeighDuplicateAbilitiesTogether(boolean weighDuplicateAbilitiesTogether) {
        this.weighDuplicateAbilitiesTogether = weighDuplicateAbilitiesTogether;
    }

    public boolean isEnsureTwoAbilities() { return ensureTwoAbilities; }

    public void setEnsureTwoAbilities(boolean ensureTwoAbilities) {
        this.ensureTwoAbilities = ensureTwoAbilities;
    }

    public StartersMod getStartersMod() {
        return startersMod;
    }

    public void setStartersMod(boolean... bools) {
        setStartersMod(getEnum(StartersMod.class, bools));
    }

    private void setStartersMod(StartersMod startersMod) {
        this.startersMod = startersMod;
    }

    public int[] getCustomStarters() {
        return customStarters;
    }

    public void setCustomStarters(int[] customStarters) {
        this.customStarters = customStarters;
    }

    public boolean isRandomizeStartersHeldItems() {
        return randomizeStartersHeldItems;
    }

    public void setRandomizeStartersHeldItems(boolean randomizeStartersHeldItems) {
        this.randomizeStartersHeldItems = randomizeStartersHeldItems;
    }

    public boolean isBanBadRandomStarterHeldItems() {
        return banBadRandomStarterHeldItems;
    }

    public void setBanBadRandomStarterHeldItems(boolean banBadRandomStarterHeldItems) {
        this.banBadRandomStarterHeldItems = banBadRandomStarterHeldItems;
    }

    public boolean isAllowStarterAltFormes() {
        return allowStarterAltFormes;
    }

    public void setAllowStarterAltFormes(boolean allowStarterAltFormes) {
        this.allowStarterAltFormes = allowStarterAltFormes;
    }

    
    public TypesMod getTypesMod() {
        return typesMod;
    }

    public void setTypesMod(boolean... bools) {
        setTypesMod(getEnum(TypesMod.class, bools));
    }

    private void setTypesMod(TypesMod typesMod) {
        this.typesMod = typesMod;
    }

    public boolean isTypesFollowMegaEvolutions() {
        return typesFollowMegaEvolutions;
    }

    public void setTypesFollowMegaEvolutions(boolean typesFollowMegaEvolutions) {
        this.typesFollowMegaEvolutions = typesFollowMegaEvolutions;
    }

    public EvolutionsMod getEvolutionsMod() {
        return evolutionsMod;
    }

    public void setEvolutionsMod(boolean... bools) {
        setEvolutionsMod(getEnum(EvolutionsMod.class, bools));
    }

    private void setEvolutionsMod(EvolutionsMod evolutionsMod) {
        this.evolutionsMod = evolutionsMod;
    }

    public boolean isEvosSimilarStrength() {
        return evosSimilarStrength;
    }

    public void setEvosSimilarStrength(boolean evosSimilarStrength) {
        this.evosSimilarStrength = evosSimilarStrength;
    }

    public boolean isEvosSameTyping() {
        return evosSameTyping;
    }

    public void setEvosSameTyping(boolean evosSameTyping) {
        this.evosSameTyping = evosSameTyping;
    }

    public boolean isEvosMaxThreeStages() {
        return evosMaxThreeStages;
    }

    public void setEvosMaxThreeStages(boolean evosMaxThreeStages) {
        this.evosMaxThreeStages = evosMaxThreeStages;
    }

    public boolean isEvosForceChange() {
        return evosForceChange;
    }

    public void setEvosForceChange(boolean evosForceChange) {
        this.evosForceChange = evosForceChange;
    }

    public boolean isRandomizeMovePowers() {
        return randomizeMovePowers;
    }

    public void setRandomizeMovePowers(boolean randomizeMovePowers) {
        this.randomizeMovePowers = randomizeMovePowers;
    }

    public boolean isRandomizeMoveAccuracies() {
        return randomizeMoveAccuracies;
    }

    public void setRandomizeMoveAccuracies(boolean randomizeMoveAccuracies) {
        this.randomizeMoveAccuracies = randomizeMoveAccuracies;
    }

    public boolean isRandomizeMovePPs() {
        return randomizeMovePPs;
    }

    public void setRandomizeMovePPs(boolean randomizeMovePPs) {
        this.randomizeMovePPs = randomizeMovePPs;
    }

    public boolean isRandomizeMoveTypes() {
        return randomizeMoveTypes;
    }

    public void setRandomizeMoveTypes(boolean randomizeMoveTypes) {
        this.randomizeMoveTypes = randomizeMoveTypes;
    }

    public boolean isRandomizeMoveCategory() {
        return randomizeMoveCategory;
    }

    public void setRandomizeMoveCategory(boolean randomizeMoveCategory) {
        this.randomizeMoveCategory = randomizeMoveCategory;
    }

    public MovesetsMod getMovesetsMod() {
        return movesetsMod;
    }

    public void setMovesetsMod(boolean... bools) {
        setMovesetsMod(getEnum(MovesetsMod.class, bools));
    }

    private void setMovesetsMod(MovesetsMod movesetsMod) {
        this.movesetsMod = movesetsMod;
    }

    public boolean isStartWithGuaranteedMoves() {
        return startWithGuaranteedMoves;
    }

    public void setStartWithGuaranteedMoves(boolean startWithGuaranteedMoves) {
        this.startWithGuaranteedMoves = startWithGuaranteedMoves;
    }

    public int getGuaranteedMoveCount() {
        return guaranteedMoveCount;
    }

    public void setGuaranteedMoveCount(int guaranteedMoveCount) {
        this.guaranteedMoveCount = guaranteedMoveCount;
    }

    public boolean isReorderDamagingMoves() {
        return reorderDamagingMoves;
    }

    public void setReorderDamagingMoves(boolean reorderDamagingMoves) {
        this.reorderDamagingMoves = reorderDamagingMoves;
    }

    public boolean isMovesetsForceGoodDamaging() {
        return movesetsForceGoodDamaging;
    }

    public void setMovesetsForceGoodDamaging(boolean movesetsForceGoodDamaging) {
        this.movesetsForceGoodDamaging = movesetsForceGoodDamaging;
    }

    public int getMovesetsGoodDamagingPercent() {
        return movesetsGoodDamagingPercent;
    }

    public void setMovesetsGoodDamagingPercent(int movesetsGoodDamagingPercent) {
        this.movesetsGoodDamagingPercent = movesetsGoodDamagingPercent;
    }

    public boolean isBlockBrokenMovesetMoves() {
        return blockBrokenMovesetMoves;
    }

    public void setBlockBrokenMovesetMoves(boolean blockBrokenMovesetMoves) {
        this.blockBrokenMovesetMoves = blockBrokenMovesetMoves;
    }

    public boolean isEvolutionMovesForAll() {
        return evolutionMovesForAll;
    }

    public void setEvolutionMovesForAll(boolean evolutionMovesForAll) {
        this.evolutionMovesForAll = evolutionMovesForAll;
    }

    public TrainersMod getTrainersMod() {
        return trainersMod;
    }

    public void setTrainersMod(boolean... bools) {
        setTrainersMod(getEnum(TrainersMod.class, bools));
    }

    private void setTrainersMod(TrainersMod trainersMod) {
        this.trainersMod = trainersMod;
    }

    public boolean isRivalCarriesStarterThroughout() {
        return rivalCarriesStarterThroughout;
    }

    public void setRivalCarriesStarterThroughout(boolean rivalCarriesStarterThroughout) {
        this.rivalCarriesStarterThroughout = rivalCarriesStarterThroughout;
    }

    public boolean isTrainersUsePokemonOfSimilarStrength() {
        return trainersUsePokemonOfSimilarStrength;
    }

    public void setTrainersUsePokemonOfSimilarStrength(boolean trainersUsePokemonOfSimilarStrength) {
        this.trainersUsePokemonOfSimilarStrength = trainersUsePokemonOfSimilarStrength;
    }

    public boolean isTrainersMatchTypingDistribution() {
        return trainersMatchTypingDistribution;
    }

    public void setTrainersMatchTypingDistribution(boolean trainersMatchTypingDistribution) {
        this.trainersMatchTypingDistribution = trainersMatchTypingDistribution;
    }

    public boolean isTrainersBlockLegendaries() {
        return trainersBlockLegendaries;
    }

    public void setTrainersBlockLegendaries(boolean trainersBlockLegendaries) {
        this.trainersBlockLegendaries = trainersBlockLegendaries;
    }

    public boolean isTrainersEnforceDistribution() {
        return trainersEnforceDistribution;
    }

    public Settings setTrainersEnforceDistribution(boolean trainersEnforceDistribution) {
        this.trainersEnforceDistribution = trainersEnforceDistribution;
        return this;
    }
    
    public boolean isTrainersEnforceMainPlaythrough() {
        return trainersEnforceMainPlaythrough;
    }

    public Settings setTrainersEnforceMainPlaythrough(boolean trainersEnforceMainPlaythrough) {
        this.trainersEnforceMainPlaythrough = trainersEnforceMainPlaythrough;
        return this;
    }

    
    public boolean isTrainersBlockEarlyWonderGuard() {
        return trainersBlockEarlyWonderGuard;
    }

    public void setTrainersBlockEarlyWonderGuard(boolean trainersBlockEarlyWonderGuard) {
        this.trainersBlockEarlyWonderGuard = trainersBlockEarlyWonderGuard;
    }

    public boolean isRandomizeTrainerNames() {
        return randomizeTrainerNames;
    }

    public void setRandomizeTrainerNames(boolean randomizeTrainerNames) {
        this.randomizeTrainerNames = randomizeTrainerNames;
    }

    public boolean isRandomizeTrainerClassNames() {
        return randomizeTrainerClassNames;
    }

    public void setRandomizeTrainerClassNames(boolean randomizeTrainerClassNames) {
        this.randomizeTrainerClassNames = randomizeTrainerClassNames;
    }

    public boolean isTrainersForceFullyEvolved() {
        return trainersForceFullyEvolved;
    }

    public void setTrainersForceFullyEvolved(boolean trainersForceFullyEvolved) {
        this.trainersForceFullyEvolved = trainersForceFullyEvolved;
    }

    public int getTrainersForceFullyEvolvedLevel() {
        return trainersForceFullyEvolvedLevel;
    }

    public void setTrainersForceFullyEvolvedLevel(int trainersForceFullyEvolvedLevel) {
        this.trainersForceFullyEvolvedLevel = trainersForceFullyEvolvedLevel;
    }

    public boolean isTrainersLevelModified() {
        return trainersLevelModified;
    }

    public void setTrainersLevelModified(boolean trainersLevelModified) {
        this.trainersLevelModified = trainersLevelModified;
    }

    public int getTrainersLevelModifier() {
        return trainersLevelModifier;
    }

    public void setTrainersLevelModifier(int trainersLevelModifier) {
        this.trainersLevelModifier = trainersLevelModifier;
    }

    public int getEliteFourUniquePokemonNumber() {
        return eliteFourUniquePokemonNumber;
    }

    public void setEliteFourUniquePokemonNumber(int eliteFourUniquePokemonNumber) {
        this.eliteFourUniquePokemonNumber = eliteFourUniquePokemonNumber;
    }


    public boolean isAllowTrainerAlternateFormes() {
        return allowTrainerAlternateFormes;
    }

    public void setAllowTrainerAlternateFormes(boolean allowTrainerAlternateFormes) {
        this.allowTrainerAlternateFormes = allowTrainerAlternateFormes;
    }

    public boolean isSwapTrainerMegaEvos() {
        return swapTrainerMegaEvos;
    }

    public void setSwapTrainerMegaEvos(boolean swapTrainerMegaEvos) {
        this.swapTrainerMegaEvos = swapTrainerMegaEvos;
    }

    public int getAdditionalBossTrainerPokemon() {
        return additionalBossTrainerPokemon;
    }

    public void setAdditionalBossTrainerPokemon(int additional) {
        this.additionalBossTrainerPokemon = additional;
    }

    public int getAdditionalImportantTrainerPokemon() {
        return additionalImportantTrainerPokemon;
    }

    public void setAdditionalImportantTrainerPokemon(int additional) {
        this.additionalImportantTrainerPokemon = additional;
    }

    public int getAdditionalRegularTrainerPokemon() {
        return additionalRegularTrainerPokemon;
    }

    public void setAdditionalRegularTrainerPokemon(int additional) {
        this.additionalRegularTrainerPokemon = additional;
    }

    public boolean isRandomizeHeldItemsForBossTrainerPokemon() {
        return randomizeHeldItemsForBossTrainerPokemon;
    }

    public void setRandomizeHeldItemsForBossTrainerPokemon(boolean bossTrainers) {
        this.randomizeHeldItemsForBossTrainerPokemon = bossTrainers;
    }

    public boolean isRandomizeHeldItemsForImportantTrainerPokemon() {
        return randomizeHeldItemsForImportantTrainerPokemon;
    }

    public void setRandomizeHeldItemsForImportantTrainerPokemon(boolean importantTrainers) {
        this.randomizeHeldItemsForImportantTrainerPokemon = importantTrainers;
    }

    public boolean isRandomizeHeldItemsForRegularTrainerPokemon() {
        return randomizeHeldItemsForRegularTrainerPokemon;
    }

    public void setRandomizeHeldItemsForRegularTrainerPokemon(boolean regularTrainers) {
        this.randomizeHeldItemsForRegularTrainerPokemon = regularTrainers;
    }

    public boolean isConsumableItemsOnlyForTrainers() {
        return consumableItemsOnlyForTrainerPokemon;
    }

    public void setConsumableItemsOnlyForTrainers(boolean consumableOnly) {
        this.consumableItemsOnlyForTrainerPokemon = consumableOnly;
    }

    public boolean isSensibleItemsOnlyForTrainers() {
        return sensibleItemsOnlyForTrainerPokemon;
    }

    public void setSensibleItemsOnlyForTrainers(boolean sensibleOnly) {
        this.sensibleItemsOnlyForTrainerPokemon = sensibleOnly;
    }

    public boolean isHighestLevelGetsItemsForTrainers() {
        return highestLevelOnlyGetsItemsForTrainerPokemon;
    }

    public void setHighestLevelGetsItemsForTrainers(boolean highestOnly) {
        this.highestLevelOnlyGetsItemsForTrainerPokemon = highestOnly;
    }

    public boolean isDoubleBattleMode() {
        return doubleBattleMode;
    }

    public void setDoubleBattleMode(boolean doubleBattleMode) {
        this.doubleBattleMode = doubleBattleMode;
    }

    public boolean isShinyChance() {
        return shinyChance;
    }

    public void setShinyChance(boolean shinyChance) {
        this.shinyChance = shinyChance;
    }

    public boolean isBetterTrainerMovesets() {
        return betterTrainerMovesets;
    }

    public void setBetterTrainerMovesets(boolean betterTrainerMovesets) {
        this.betterTrainerMovesets = betterTrainerMovesets;
    }

    public WildPokemonMod getWildPokemonMod() {
        return wildPokemonMod;
    }

    public void setWildPokemonMod(boolean... bools) {
        setWildPokemonMod(getEnum(WildPokemonMod.class, bools));
    }

    private void setWildPokemonMod(WildPokemonMod wildPokemonMod) {
        this.wildPokemonMod = wildPokemonMod;
    }

    public WildPokemonRestrictionMod getWildPokemonRestrictionMod() {
        return wildPokemonRestrictionMod;
    }

    public void setWildPokemonRestrictionMod(boolean... bools) {
        setWildPokemonRestrictionMod(getEnum(WildPokemonRestrictionMod.class, bools));
    }

    private void setWildPokemonRestrictionMod(WildPokemonRestrictionMod wildPokemonRestrictionMod) {
        this.wildPokemonRestrictionMod = wildPokemonRestrictionMod;
    }

    public boolean isUseTimeBasedEncounters() {
        return useTimeBasedEncounters;
    }

    public void setUseTimeBasedEncounters(boolean useTimeBasedEncounters) {
        this.useTimeBasedEncounters = useTimeBasedEncounters;
    }

    public boolean isBlockWildLegendaries() {
        return blockWildLegendaries;
    }

    public void setBlockWildLegendaries(boolean blockWildLegendaries) {
        this.blockWildLegendaries = blockWildLegendaries;
    }

    public boolean isUseMinimumCatchRate() {
        return useMinimumCatchRate;
    }

    public void setUseMinimumCatchRate(boolean useMinimumCatchRate) {
        this.useMinimumCatchRate = useMinimumCatchRate;
    }

    public int getMinimumCatchRateLevel() {
        return minimumCatchRateLevel;
    }

    public void setMinimumCatchRateLevel(int minimumCatchRateLevel) {
        this.minimumCatchRateLevel = minimumCatchRateLevel;
    }

    public boolean isRandomizeWildPokemonHeldItems() {
        return randomizeWildPokemonHeldItems;
    }

    public void setRandomizeWildPokemonHeldItems(boolean randomizeWildPokemonHeldItems) {
        this.randomizeWildPokemonHeldItems = randomizeWildPokemonHeldItems;
    }

    public boolean isBanBadRandomWildPokemonHeldItems() {
        return banBadRandomWildPokemonHeldItems;
    }

    public void setBanBadRandomWildPokemonHeldItems(boolean banBadRandomWildPokemonHeldItems) {
        this.banBadRandomWildPokemonHeldItems = banBadRandomWildPokemonHeldItems;
    }

    public boolean isBalanceShakingGrass() {
        return balanceShakingGrass;
    }

    public void setBalanceShakingGrass(boolean balanceShakingGrass) {
        this.balanceShakingGrass = balanceShakingGrass;
    }

    public boolean isWildLevelsModified() {
        return wildLevelsModified;
    }

    public void setWildLevelsModified(boolean wildLevelsModified) {
        this.wildLevelsModified = wildLevelsModified;
    }

    public int getWildLevelModifier() {
        return wildLevelModifier;
    }

    public void setWildLevelModifier(int wildLevelModifier) {
        this.wildLevelModifier = wildLevelModifier;
    }

    public boolean isAllowWildAltFormes() {
        return allowWildAltFormes;
    }

    public void setAllowWildAltFormes(boolean allowWildAltFormes) {
        this.allowWildAltFormes = allowWildAltFormes;
    }

    public StaticPokemonMod getStaticPokemonMod() {
        return staticPokemonMod;
    }

    public void setStaticPokemonMod(boolean... bools) {
        setStaticPokemonMod(getEnum(StaticPokemonMod.class, bools));
    }

    private void setStaticPokemonMod(StaticPokemonMod staticPokemonMod) {
        this.staticPokemonMod = staticPokemonMod;
    }

    public boolean isLimitMainGameLegendaries() {
        return limitMainGameLegendaries;
    }

    public void setLimitMainGameLegendaries(boolean limitMainGameLegendaries) {
        this.limitMainGameLegendaries = limitMainGameLegendaries;
    }

    public boolean isLimit600() {
        return limit600;
    }

    public void setLimit600(boolean limit600) {
        this.limit600 = limit600;
    }

    public boolean isAllowStaticAltFormes() {
        return allowStaticAltFormes;
    }

    public void setAllowStaticAltFormes(boolean allowStaticAltFormes) {
        this.allowStaticAltFormes = allowStaticAltFormes;
    }

    public boolean isSwapStaticMegaEvos() {
        return swapStaticMegaEvos;
    }

    public void setSwapStaticMegaEvos(boolean swapStaticMegaEvos) {
        this.swapStaticMegaEvos = swapStaticMegaEvos;
    }

    public boolean isStaticLevelModified() {
        return staticLevelModified;
    }

    public void setStaticLevelModified(boolean staticLevelModified) {
        this.staticLevelModified = staticLevelModified;
    }

    public int getStaticLevelModifier() {
        return staticLevelModifier;
    }

    public void setStaticLevelModifier(int staticLevelModifier) {
        this.staticLevelModifier = staticLevelModifier;
    }

    public boolean isCorrectStaticMusic() {
        return correctStaticMusic;
    }

    public void setCorrectStaticMusic(boolean correctStaticMusic) {
        this.correctStaticMusic = correctStaticMusic;
    }


    public TotemPokemonMod getTotemPokemonMod() {
        return totemPokemonMod;
    }

    public void setTotemPokemonMod(boolean... bools) {
        setTotemPokemonMod(getEnum(TotemPokemonMod.class, bools));
    }

    private void setTotemPokemonMod(TotemPokemonMod totemPokemonMod) {
        this.totemPokemonMod = totemPokemonMod;
    }

    public AllyPokemonMod getAllyPokemonMod() {
        return allyPokemonMod;
    }

    public void setAllyPokemonMod(boolean... bools) {
        setAllyPokemonMod(getEnum(AllyPokemonMod.class, bools));
    }

    private void setAllyPokemonMod(AllyPokemonMod allyPokemonMod) {
        this.allyPokemonMod = allyPokemonMod;
    }

    public AuraMod getAuraMod() {
        return auraMod;
    }

    public void setAuraMod(boolean... bools) {
        setAuraMod(getEnum(AuraMod.class, bools));
    }

    private void setAuraMod(AuraMod auraMod) {
        this.auraMod = auraMod;
    }

    public boolean isRandomizeTotemHeldItems() {
        return randomizeTotemHeldItems;
    }

    public void setRandomizeTotemHeldItems(boolean randomizeTotemHeldItems) {
        this.randomizeTotemHeldItems = randomizeTotemHeldItems;
    }

    public boolean isTotemLevelsModified() {
        return totemLevelsModified;
    }

    public void setTotemLevelsModified(boolean totemLevelsModified) {
        this.totemLevelsModified = totemLevelsModified;
    }

    public int getTotemLevelModifier() {
        return totemLevelModifier;
    }

    public void setTotemLevelModifier(int totemLevelModifier) {
        this.totemLevelModifier = totemLevelModifier;
    }

    public boolean isAllowTotemAltFormes() {
        return allowTotemAltFormes;
    }

    public void setAllowTotemAltFormes(boolean allowTotemAltFormes) {
        this.allowTotemAltFormes = allowTotemAltFormes;
    }

    public TMsMod getTmsMod() {
        return tmsMod;
    }

    public void setTmsMod(boolean... bools) {
        setTmsMod(getEnum(TMsMod.class, bools));
    }

    private void setTmsMod(TMsMod tmsMod) {
        this.tmsMod = tmsMod;
    }

    public boolean isTmLevelUpMoveSanity() {
        return tmLevelUpMoveSanity;
    }

    public void setTmLevelUpMoveSanity(boolean tmLevelUpMoveSanity) {
        this.tmLevelUpMoveSanity = tmLevelUpMoveSanity;
    }

    public boolean isKeepFieldMoveTMs() {
        return keepFieldMoveTMs;
    }

    public void setKeepFieldMoveTMs(boolean keepFieldMoveTMs) {
        this.keepFieldMoveTMs = keepFieldMoveTMs;
    }

    public boolean isFullHMCompat() {
        return fullHMCompat;
    }

    public void setFullHMCompat(boolean fullHMCompat) {
        this.fullHMCompat = fullHMCompat;
    }

    public boolean isTmsForceGoodDamaging() {
        return tmsForceGoodDamaging;
    }

    public void setTmsForceGoodDamaging(boolean tmsForceGoodDamaging) {
        this.tmsForceGoodDamaging = tmsForceGoodDamaging;
    }

    public int getTmsGoodDamagingPercent() {
        return tmsGoodDamagingPercent;
    }

    public void setTmsGoodDamagingPercent(int tmsGoodDamagingPercent) {
        this.tmsGoodDamagingPercent = tmsGoodDamagingPercent;
    }

    public boolean isBlockBrokenTMMoves() {
        return blockBrokenTMMoves;
    }

    public void setBlockBrokenTMMoves(boolean blockBrokenTMMoves) {
        this.blockBrokenTMMoves = blockBrokenTMMoves;
    }

    public TMsHMsCompatibilityMod getTmsHmsCompatibilityMod() {
        return tmsHmsCompatibilityMod;
    }

    public void setTmsHmsCompatibilityMod(boolean... bools) {
        setTmsHmsCompatibilityMod(getEnum(TMsHMsCompatibilityMod.class, bools));
    }

    private void setTmsHmsCompatibilityMod(TMsHMsCompatibilityMod tmsHmsCompatibilityMod) {
        this.tmsHmsCompatibilityMod = tmsHmsCompatibilityMod;
    }

    public boolean isTmsFollowEvolutions() {
        return tmsFollowEvolutions;
    }

    public void setTmsFollowEvolutions(boolean tmsFollowEvolutions) {
        this.tmsFollowEvolutions = tmsFollowEvolutions;
    }

    public MoveTutorMovesMod getMoveTutorMovesMod() {
        return moveTutorMovesMod;
    }

    public void setMoveTutorMovesMod(boolean... bools) {
        setMoveTutorMovesMod(getEnum(MoveTutorMovesMod.class, bools));
    }

    private void setMoveTutorMovesMod(MoveTutorMovesMod moveTutorMovesMod) {
        this.moveTutorMovesMod = moveTutorMovesMod;
    }

    public boolean isTutorLevelUpMoveSanity() {
        return tutorLevelUpMoveSanity;
    }

    public void setTutorLevelUpMoveSanity(boolean tutorLevelUpMoveSanity) {
        this.tutorLevelUpMoveSanity = tutorLevelUpMoveSanity;
    }

    public boolean isKeepFieldMoveTutors() {
        return keepFieldMoveTutors;
    }

    public void setKeepFieldMoveTutors(boolean keepFieldMoveTutors) {
        this.keepFieldMoveTutors = keepFieldMoveTutors;
    }

    public boolean isTutorsForceGoodDamaging() {
        return tutorsForceGoodDamaging;
    }

    public void setTutorsForceGoodDamaging(boolean tutorsForceGoodDamaging) {
        this.tutorsForceGoodDamaging = tutorsForceGoodDamaging;
    }

    public int getTutorsGoodDamagingPercent() {
        return tutorsGoodDamagingPercent;
    }

    public void setTutorsGoodDamagingPercent(int tutorsGoodDamagingPercent) {
        this.tutorsGoodDamagingPercent = tutorsGoodDamagingPercent;
    }

    public boolean isBlockBrokenTutorMoves() {
        return blockBrokenTutorMoves;
    }

    public void setBlockBrokenTutorMoves(boolean blockBrokenTutorMoves) {
        this.blockBrokenTutorMoves = blockBrokenTutorMoves;
    }

    public MoveTutorsCompatibilityMod getMoveTutorsCompatibilityMod() {
        return moveTutorsCompatibilityMod;
    }

    public void setMoveTutorsCompatibilityMod(boolean... bools) {
        setMoveTutorsCompatibilityMod(getEnum(MoveTutorsCompatibilityMod.class, bools));
    }

    private void setMoveTutorsCompatibilityMod(MoveTutorsCompatibilityMod moveTutorsCompatibilityMod) {
        this.moveTutorsCompatibilityMod = moveTutorsCompatibilityMod;
    }

    public boolean isTutorFollowEvolutions() {
        return tutorFollowEvolutions;
    }

    public void setTutorFollowEvolutions(boolean tutorFollowEvolutions) {
        this.tutorFollowEvolutions = tutorFollowEvolutions;
    }

    public InGameTradesMod getInGameTradesMod() {
        return inGameTradesMod;
    }

    public void setInGameTradesMod(boolean... bools) {
        setInGameTradesMod(getEnum(InGameTradesMod.class, bools));
    }

    private void setInGameTradesMod(InGameTradesMod inGameTradesMod) {
        this.inGameTradesMod = inGameTradesMod;
    }

    public boolean isRandomizeInGameTradesNicknames() {
        return randomizeInGameTradesNicknames;
    }

    public void setRandomizeInGameTradesNicknames(boolean randomizeInGameTradesNicknames) {
        this.randomizeInGameTradesNicknames = randomizeInGameTradesNicknames;
    }

    public boolean isRandomizeInGameTradesOTs() {
        return randomizeInGameTradesOTs;
    }

    public void setRandomizeInGameTradesOTs(boolean randomizeInGameTradesOTs) {
        this.randomizeInGameTradesOTs = randomizeInGameTradesOTs;
    }

    public boolean isRandomizeInGameTradesIVs() {
        return randomizeInGameTradesIVs;
    }

    public void setRandomizeInGameTradesIVs(boolean randomizeInGameTradesIVs) {
        this.randomizeInGameTradesIVs = randomizeInGameTradesIVs;
    }

    public boolean isRandomizeInGameTradesItems() {
        return randomizeInGameTradesItems;
    }

    public void setRandomizeInGameTradesItems(boolean randomizeInGameTradesItems) {
        this.randomizeInGameTradesItems = randomizeInGameTradesItems;
    }

    public FieldItemsMod getFieldItemsMod() {
        return fieldItemsMod;
    }

    public void setFieldItemsMod(boolean... bools) {
        setFieldItemsMod(getEnum(FieldItemsMod.class, bools));
    }

    private void setFieldItemsMod(FieldItemsMod fieldItemsMod) {
        this.fieldItemsMod = fieldItemsMod;
    }

    public boolean isBanBadRandomFieldItems() {
        return banBadRandomFieldItems;
    }


    public void setBanBadRandomFieldItems(boolean banBadRandomFieldItems) {
        this.banBadRandomFieldItems = banBadRandomFieldItems;
    }

    public ShopItemsMod getShopItemsMod() {
        return shopItemsMod;
    }

    public void setShopItemsMod(boolean... bools) {
        setShopItemsMod(getEnum(ShopItemsMod.class, bools));
    }

    private void setShopItemsMod(ShopItemsMod shopItemsMod) {
        this.shopItemsMod = shopItemsMod;
    }

    public boolean isBanBadRandomShopItems() {
        return banBadRandomShopItems;
    }

    public void setBanBadRandomShopItems(boolean banBadRandomShopItems) {
        this.banBadRandomShopItems = banBadRandomShopItems;
    }

    public boolean isBanRegularShopItems() {
        return banRegularShopItems;
    }

    public void setBanRegularShopItems(boolean banRegularShopItems) {
        this.banRegularShopItems = banRegularShopItems;
    }

    public boolean isBanOPShopItems() {
        return banOPShopItems;
    }

    public void setBanOPShopItems(boolean banOPShopItems) {
        this.banOPShopItems = banOPShopItems;
    }

    public boolean isBalanceShopPrices() {
        return balanceShopPrices;
    }

    public void setBalanceShopPrices(boolean balanceShopPrices) {
        this.balanceShopPrices = balanceShopPrices;
    }
   
    public boolean isGuaranteeEvolutionItems() {
        return guaranteeEvolutionItems;
    }

    public void setGuaranteeEvolutionItems(boolean guaranteeEvolutionItems) {
        this.guaranteeEvolutionItems = guaranteeEvolutionItems;
    }

    public boolean isGuaranteeXItems() {
        return guaranteeXItems;
    }

    public void setGuaranteeXItems(boolean guaranteeXItems) {
        this.guaranteeXItems = guaranteeXItems;
    }

    public PickupItemsMod getPickupItemsMod() {
        return pickupItemsMod;
    }

    public void setPickupItemsMod(boolean... bools) {
        setPickupItemsMod(getEnum(PickupItemsMod.class, bools));
    }

    private void setPickupItemsMod(PickupItemsMod pickupItemsMod) {
        this.pickupItemsMod = pickupItemsMod;
    }

    public boolean isBanBadRandomPickupItems() {
        return banBadRandomPickupItems;
    }

    public void setBanBadRandomPickupItems(boolean banBadRandomPickupItems) {
        this.banBadRandomPickupItems = banBadRandomPickupItems;
    }

    private static int makeByteSelected(boolean... bools) {
        if (bools.length > 8) {
            throw new IllegalArgumentException("Can't set more than 8 bits in a byte!");
        }

        int initial = 0;
        int state = 1;
        for (boolean b : bools) {
            initial |= b ? state : 0;
            state *= 2;
        }
        return initial;
    }

    private static boolean restoreState(byte b, int index) {
        if (index >= 8) {
            throw new IllegalArgumentException("Can't read more than 8 bits from a byte!");
        }

        int value = b & 0xFF;
        return ((value >> index) & 0x01) == 0x01;
    }

    private static void writeFullInt(ByteArrayOutputStream out, int value) throws IOException {
        byte[] crc = ByteBuffer.allocate(4).putInt(value).array();
        out.write(crc);
    }

    private static void write2ByteInt(ByteArrayOutputStream out, int value) {
        out.write(value & 0xFF);
        out.write((value >> 8) & 0xFF);
    }

    private static <E extends Enum<E>> E restoreEnum(Class<E> clazz, byte b, int... indices) {
        boolean[] bools = new boolean[indices.length];
        int i = 0;
        for (int idx : indices) {
            bools[i] = restoreState(b, idx);
            i++;
        }
        return getEnum(clazz, bools);
    }

    @SuppressWarnings("unchecked")
    private static <E extends Enum<E>> E getEnum(Class<E> clazz, boolean... bools) {
        int index = getSetEnum(clazz.getSimpleName(), bools);
        try {
            return ((E[]) clazz.getMethod("values").invoke(null))[index];
        } catch (Exception e) {
            throw new IllegalArgumentException(String.format("Unable to parse enum of type %s", clazz.getSimpleName()),
                    e);
        }
    }

    private static int getSetEnum(String type, boolean... bools) {
        int index = -1;
        for (int i = 0; i < bools.length; i++) {
            if (bools[i]) {
                if (index >= 0) {
                    throw new IllegalStateException(String.format("Only one value for %s may be chosen!", type));
                }
                index = i;
            }
        }
        // We have to return something, so return the default
        return index >= 0 ? index : 0;
    }

    private static void checkChecksum(byte[] data) {
        // Check the checksum
        ByteBuffer buf = ByteBuffer.allocate(4).put(data, data.length - 8, 4);
        buf.rewind();
        int crc = buf.getInt();

        CRC32 checksum = new CRC32();
        checksum.update(data, 0, data.length - 8);

        if ((int) checksum.getValue() != crc) {
            throw new IllegalArgumentException("Malformed input string");
        }
    }

}