summaryrefslogtreecommitdiff
path: root/src/player.pkg
blob: dfdced268e9ea06b51fe428d0e6e249874c8a713 (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
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
/* File: player.pkg */

/*
 * Purpose: Lua interface defitions for the player.
 * To be processed by tolua to generate C source code.
 */

$#include "angband.h"

/** @typedef cptr
 * @note String
 */
typedef char* cptr;
/** @typedef errr
 * @note Number
 */
typedef int errr;
/** @typedef bool
 * @note Boolean
 */
typedef unsigned char bool;
/** @typedef byte
 * @note Number
 */
typedef unsigned char byte;
/** @typedef s16b
 * @note Number
 */
typedef signed short s16b;
/** @typedef u16b
 * @note Number
 */
typedef unsigned short u16b;
/** @typedef s32b
 * @note Number
 */
typedef signed int s32b;
/** @typedef u32b
 * @note Number
 */
typedef unsigned int u32b;

/** @def PY_MAX_LEVEL
 * @note Maximum level
 */
#define PY_MAX_LEVEL    50

/** @var player_exp[PY_MAX_LEVEL]
 * @brief Number
 * @note Array of experience points per level.
 */
extern s32b player_exp[PY_MAX_LEVEL];

/** @name Attributes
 * @brief Indexes of the various "stats" (hard-coded by savefiles, etc).
 * @{ */
/** @def A_STR
 * @note Strength */
#define A_STR   0

/** @def A_INT
 * @note Intelligence */
#define A_INT   1

/** @def A_WIS
 * @note Wisdom */
#define A_WIS   2

/** @def A_DEX
 * @note Dexterity */
#define A_DEX   3

/** @def A_CON
 * @note Constitution */
#define A_CON   4

/** @def A_CHR
 * @note Charisma */
#define A_CHR   5
/** @} */

/* Ugly hack, should be in foo-info, the subrace saved to the savefile */
/** @def SUBRACE_SAVE */
#define SUBRACE_SAVE    9


/** @name Sex
 * @brief Player sex constants (hard-coded by save-files, arrays, etc)
 * @{ */
/** @def SEX_FEMALE */
#define SEX_FEMALE	      0

/** @def SEX_MALE */
#define SEX_MALE		1

/** @def SEX_NEUTER */
#define SEX_NEUTER	      2


/** @def MAX_SEXES */
#define MAX_SEXES	    3
/** @} */

/** @name Race flags
 * @{ */
/** @def PR1_EXPERIMENTAL
 * @note Is still under developemnt
 */
#define PR1_EXPERIMENTAL	0x00000001L
/* XXX */
/** @def PR1_RESIST_BLACK_BREATH
 * @note Resist black breath
 */
#define PR1_RESIST_BLACK_BREATH 0x00000004L
/** @def PR1_NO_STUN
 * @note Never stunned
 */
#define PR1_NO_STUN	     0x00000008L
/** @def PR1_XTRA_MIGHT_BOW
 * @note Xtra might with bows
 */
#define PR1_XTRA_MIGHT_BOW      0x00000010L
/** @def PR1_XTRA_MIGHT_XBOW
 * @note Xtra might with xbows
 */
#define PR1_XTRA_MIGHT_XBOW     0x00000020L
/** @def PR1_XTRA_MIGHT_SLING
 * @note Xtra might with slings
 */
#define PR1_XTRA_MIGHT_SLING    0x00000040L
/** @def PR1_AC_LEVEL
 * @note More AC with levels
 */
#define PR1_AC_LEVEL	    0x00000080L
/** @def PR1_HURT_LITE
 * @note Hurt by light
 */
#define PR1_HURT_LITE	   0x00000100L
/** @def PR1_VAMPIRE
 * @note Vampire
 */
#define PR1_VAMPIRE	     0x00000200L
/** @def PR1_UNDEAD
 * @note Undead
 */
#define PR1_UNDEAD	      0x00000400L
/** @def PR1_NO_CUT
 * @note no cuts
 */
#define PR1_NO_CUT	      0x00000800L
/** @def PR1_CORRUPT
 * @note hack-- corrupted
 */
#define PR1_CORRUPT	     0x00001000L
/** @def PR1_NO_FOOD
 * @note little gain from food
 */
#define PR1_NO_FOOD	     0x00002000L
/** @def PR1_NO_GOD
 * @note cannot worship
 */
#define PR1_NO_GOD	      0x00004000L
/* XXX */
/** @def PR1_ELF
 * @note Is an elf
 */
#define PR1_ELF		 0x00010000L
/** @def PR1_SEMI_WRAITH
 * @note Takes damage when going in walls
 */
#define PR1_SEMI_WRAITH	 0x00020000L
/** @def PR1_NO_SUBRACE_CHANGE
 * @note Impossible to change subrace
 */
#define PR1_NO_SUBRACE_CHANGE   0x00040000L
/* XXX */
/** @def PR1_ANTIMAGIC
 * @note antimagic ... hack
 */
#define PR1_ANTIMAGIC	   0x00100000L
/** @def PR1_MOLD_FRIEND
 * @note Not attacked by molds wielded
 */
#define PR1_MOLD_FRIEND	 0x00200000L
/** @def PR1_GOD_FRIEND
 * @note Better grace
 */
#define PR1_GOD_FRIEND	  0x00400000L
/* XXX */
/** @def PR1_INNATE_SPELLS
 * @note KNown all spells, only need books
 */
#define PR1_INNATE_SPELLS       0x01000000L
/* XXX */
/* XXX */
/** @def PR1_EASE_STEAL
 * @note Gain xp by stealing
 */
#define PR1_EASE_STEAL	  0x08000000L
/* XXX */
/* XXX */
/* XXX */
/* XXX */

/* XXX */
/** @def PR2_ASTRAL
 * @note Is it an astral being coming from th halls of mandos ?
 */
#define PR2_ASTRAL	      0x00000002L
/* XXX */
/** @} */

/** @name Notice flags
 * @brief Bit flags for the "p_ptr->notice" variable
 * @{ */
/** @def PN_COMBINE
 * @note Combine the pack
 */
#define PN_COMBINE      0x00000001L
/** @def PN_REORDER
 * @note Reorder the pack
 */
#define PN_REORDER      0x00000002L
/* xxx (many) */
/** @} */


/** @name Update flags
 * @brief Bit flags for the "p_ptr->update" variable
 * @{ */
/** @def PU_BONUS
 * @note Calculate bonuses
 */
#define PU_BONUS	0x00000001L
/** @def PU_TORCH
 * @note Calculate torch radius
 */
#define PU_TORCH	0x00000002L
/** @def PU_BODY
 * @note Calculate body parts
 */
#define PU_BODY	 0x00000004L
/** @def PU_SANITY
 * @note Calculate csan and msan
 */
#define PU_SANITY       0x00000008L
/** @def PU_HP
 * @note Calculate chp and mhp
 */
#define PU_HP	   0x00000010L
/** @def PU_MANA
 * @note Calculate csp and msp
 */
#define PU_MANA	 0x00000020L
/** @def PU_SPELLS
 * @note Calculate spells
 */
#define PU_SPELLS       0x00000040L
/** @def PU_POWERS
 * @note Calculate powers
 */
#define PU_POWERS       0x00000080L
/* xxx (many) */
/** @def PU_UN_VIEW
 * @note Forget view
 */
#define PU_UN_VIEW      0x00010000L
/* xxx (many) */
/** @def PU_VIEW
 * @note Update view
 */
#define PU_VIEW	 0x00100000L
/** @def PU_MON_LITE
 * @note Update monster light
 */
#define PU_MON_LITE     0x00200000L
/* xxx */
/** @def PU_MONSTERS
 * @note Update monsters
 */
#define PU_MONSTERS     0x01000000L
/** @def PU_DISTANCE
 * @note Update distances
 */
#define PU_DISTANCE     0x02000000L
/* xxx */
/** @def PU_FLOW
 * @note Update flow
 */
#define PU_FLOW	 0x10000000L
/* xxx (many) */
/** @} */


/** @name Redraw flags
 * @brief Bit flags for the "p_ptr->redraw" variable
 * @{ */
/** @def PR_MISC
 * @note Display Race/Class
 */
#define PR_MISC	 0x00000001L
/** @def PR_TITLE
 * @note Display Title
 */
#define PR_TITLE	0x00000002L
/** @def PR_LEV
 * @note Display Level
 */
#define PR_LEV	  0x00000004L
/** @def PR_EXP
 * @note Display Experience
 */
#define PR_EXP	  0x00000008L
/** @def PR_STATS
 * @note Display Stats
 */
#define PR_STATS	0x00000010L
/** @def PR_ARMOR
 * @note Display Armor
 */
#define PR_ARMOR	0x00000020L
/** @def PR_HP
 * @note Display Hitpoints
 */
#define PR_HP	   0x00000040L
/** @def PR_MANA
 * @note Display Mana
 */
#define PR_MANA	 0x00000080L
/** @def PR_GOLD
 * @note Display Gold
 */
#define PR_GOLD	 0x00000100L
/** @def PR_DEPTH
 * @note Display Depth
 */
#define PR_DEPTH	0x00000200L
/****/
/** @def PR_HEALTH
 * @note Display Health Bar
 */
#define PR_HEALTH       0x00000800L
/** @def PR_CUT
 * @note Display Extra (Cut)
 */
#define PR_CUT	  0x00001000L
/** @def PR_STUN
 * @note Display Extra (Stun)
 */
#define PR_STUN	 0x00002000L
/** @def PR_HUNGER
 * @note Display Extra (Hunger)
 */
#define PR_HUNGER       0x00004000L
/** @def PR_PIETY
 * @note Display Piety
 */
#define PR_PIETY	0x00008000L
/** @def PR_BLIND
 * @note Display Extra (Blind)
 */
#define PR_BLIND	0x00010000L
/** @def PR_CONFUSED
 * @note Display Extra (Confused)
 */
#define PR_CONFUSED     0x00020000L
/** @def PR_AFRAID
 * @note Display Extra (Afraid)
 */
#define PR_AFRAID       0x00040000L
/** @def PR_POISONED
 * @note Display Extra (Poisoned)
 */
#define PR_POISONED     0x00080000L
/** @def PR_STATE
 * @note Display Extra (State)
 */
#define PR_STATE	0x00100000L
/** @def PR_SPEED
 * @note Display Extra (Speed)
 */
#define PR_SPEED	0x00200000L
/** @def PR_STUDY
 * @note Display Extra (Study)
 */
#define PR_STUDY	0x00400000L
/** @def PR_SANITY
 * @note Display Sanity
 */
#define PR_SANITY       0x00800000L
/** @def PR_EXTRA
 * @note Display Extra Info
 */
#define PR_EXTRA	0x01000000L
/** @def PR_BASIC
 * @note Display Basic Info
 */
#define PR_BASIC	0x02000000L
/** @def PR_MAP
 * @note Display Map
 */
#define PR_MAP	  0x04000000L
/** @def PR_WIPE
 * @note Hack -- Total Redraw
 */
#define PR_WIPE	 0x08000000L
/** @def PR_MH
 * @note Display Monster hitpoints
 */
#define PR_MH	   0x10000000L
/** @def PR_MH
 * @note Display Monster hitpoints
 */
#define PR_MH	   0x10000000L
/** @def PR_DTRAP
 * @note Display Extra (DTrap)
 */
#define PR_DTRAP	0x20000000L
/* xxx */
/* xxx */
/** @} */


/** @name Window flags
 * @brief Bit flags for the "p_ptr->window" variable (etc)
 * @{ */
/** @def PW_INVEN
 * @note Display inven/equip
 */
#define PW_INVEN	0x00000001L
/** @def PW_EQUIP
 * @note Display equip/inven
 */
#define PW_EQUIP	0x00000002L
/* xxx */
/** @def PW_PLAYER
 * @note Display character
 */
#define PW_PLAYER       0x00000008L
/** @def PW_M_LIST
 * @note Show monster list
 */
#define PW_M_LIST       0x00000010L
/* xxx */
/** @def PW_MESSAGE
 * @note Display messages
 */
#define PW_MESSAGE      0x00000040L
/** @def PW_OVERHEAD
 * @note Display overhead view
 */
#define PW_OVERHEAD     0x00000080L
/** @def PW_MONSTER
 * @note Display monster recall
 */
#define PW_MONSTER      0x00000100L
/** @def PW_OBJECT
 * @note Display object recall
 */
#define PW_OBJECT       0x00000200L
/* xxx */
/** @def PW_SNAPSHOT
 * @note Display snap-shot
 */
#define PW_SNAPSHOT     0x00000800L
/* xxx */
/* xxx */
/** @def PW_BORG_1
 * @note Display borg messages
 */
#define PW_BORG_1       0x00004000L
/** @def PW_BORG_2
 * @note Display borg status
 */
#define PW_BORG_2       0x00008000L
/** @} */

/** @struct deity_type
 */
struct deity_type
{
	/** @structvar name
	 * @brief String
	 */
	cptr name;
};
/** @var deity_info[max_gods]
 * @brief deity_type
 * @note Array of gods.
 */
extern deity_type deity_info[max_gods];

/** @name Body parts
 * @{ */
/** @def BODY_WEAPON */
#define BODY_WEAPON     0

/** @def BODY_TORSO */
#define BODY_TORSO      1

/** @def BODY_ARMS */
#define BODY_ARMS       2

/** @def BODY_FINGER */
#define BODY_FINGER     3

/** @def BODY_HEAD */
#define BODY_HEAD       4

/** @def BODY_LEGS */
#define BODY_LEGS       5

/** @def BODY_MAX */
#define BODY_MAX	6
/** @} */


/** @struct player_type
 */
struct player_type
{
	/** @structvar lives
	 * @brief Number
	 * @note How many times we resurected
	 */
	s32b lives;

	/** @structvar oldpy
	 * @brief Number
	 * @note Previous player location -KMW-
	 */
	s16b oldpy;
	/** @structvar oldpx
	 * @brief Number
	 * @note Previous player location -KMW-
	 */
	s16b oldpx;

	/** @structvar py
	 * @brief Number
	 * @note Player location
	 */
	s16b py;
	/** @structvar px
	 * @brief Number
	 * @note Player location
	 */
	s16b px;

	/** @structvar psex
	 * @brief Number
	 * @note Sex index
	 */
	byte psex;
	/** @structvar prace
	 * @brief Number
	 * @note Race index
	 */
	byte prace;
	/** @structvar pracem
	 * @brief Number
	 * @note Race Mod index
	 */
	byte pracem;
	/** @structvar pclass
	 * @brief Number
	 * @note Class index
	 */
	byte pclass;
	/** @structvar mimic_form
	 * @brief Number
	 * @note Actualy transformation
	 */
	byte mimic_form;
	/** @structvar mimic_level
	 * @brief Number
	 * @note Level of the mimic effect
	 */
	s16b mimic_level;
	/** @structvar oops
	 * @brief Number
	 * @note Unused
	 */
	byte oops;

	object_type inventory[INVEN_TOTAL] @inventory_real;

	/** @structvar hitdie
	 * @brief Number
	 * @note Hit dice (sides)
	 */
	byte hitdie;
	/** @structvar expfact
	 * @brief Number
	 * @note Experience factor
	 */
	u16b expfact;

	/** @structvar allow_one_death
	 * @brief Number
	 * @note Blood of life
	 */
	byte allow_one_death;

	/** @structvar age
	 * @brief Number
	 * @note Characters age
	 */
	s16b age;
	/** @structvar ht
	 * @brief Number
	 * @note Height
	 */
	s16b ht;
	/** @structvar wt
	 * @brief Number
	 * @note Weight
	 */
	s16b wt;
	/** @structvar sc
	 * @brief Number
	 * @note Social Class
	 */
	s16b sc;


	/** @structvar au
	 * @brief Number
	 * @note Current Gold
	 */
	s32b au;

	/** @structvar max_exp
	 * @brief Number
	 * @note Max experience
	 */
	s32b max_exp;
	/** @structvar exp
	 * @brief Number
	 * @note Cur experience
	 */
	s32b exp;
	/** @structvar exp_frac
	 * @brief Number
	 * @note Cur exp frac (times 2^16)
	 */
	u16b exp_frac;

	/** @structvar lev
	 * @brief Number
	 * @note Level
	 */
	s16b lev;

	/** @structvar town_num
	 * @brief Number
	 * @note Current town number
	 */
	s16b town_num;
	/** @structvar inside_quest
	 * @brief Number
	 * @note Inside quest level
	 */
	s16b inside_quest;
	/** @structvar exit_bldg
	 * @brief Boolean
	 * @note Goal obtained in arena? -KMW-
	 */
	bool exit_bldg;

	/** @structvar wilderness_x
	 * @brief Number
	 * @note Coordinates in the wilderness
	 */
	s32b wilderness_x;
	/** @structvar wilderness_y
	 * @brief Number
	 */
	s32b wilderness_y;
	/** @structvar wild_mode
	 * @brief Boolean
	 * @note TRUE = Small map, FLASE = Big map
	 */
	bool wild_mode;
	/** @structvar old_wild_mode
	 * @brief Boolean
	 * @note TRUE = Small map, FLASE = Big map
	 */
	bool old_wild_mode;

	/** @structvar mhp
	 * @brief Number
	 * @note Max hit pts
	 */
	s16b mhp;
	/** @structvar chp
	 * @brief Number
	 * @note Cur hit pts
	 */
	s16b chp;
	/** @structvar chp_frac
	 * @brief Number
	 * @note Cur hit frac (times 2^16)
	 */
	u16b chp_frac;
	/** @structvar hp_mod
	 * @brief Number
	 * @note A modificator(permanent)
	 */
	s16b hp_mod;

	/** @structvar msp
	 * @brief Number
	 * @note Max mana pts
	 */
	s16b msp;
	/** @structvar csp
	 * @brief Number
	 * @note Cur mana pts
	 */
	s16b csp;
	/** @structvar csp_frac
	 * @brief Number
	 * @note Cur mana frac (times 2^16)
	 */
	u16b csp_frac;

	/** @structvar msane
	 * @brief Number
	 * @note Max sanity
	 */
	s16b msane;
	/** @structvar csane
	 * @brief Number
	 * @note Cur sanity
	 */
	s16b csane;
	/** @structvar csane_frac
	 * @brief Number
	 * @note Cur sanity frac
	 */
	u16b csane_frac;

	/** @structvar grace
	 * @brief Number
	 * @note Your God's appreciation factor.
	 */
	s32b grace;
	/** @structvar pgod
	 * @brief Number
	 * @note Your God.
	 */
	byte pgod;
	/** @structvar praying
	 * @brief Boolean
	 * @note Praying to your god.
	 */
	bool praying;

	/** @structvar max_plv
	 * @brief Number
	 * @note Max Player Level
	 */
	s16b max_plv;

	/** @structvar stat_max[6]
	 * @brief Number
	 * @note Current "maximal" stat values
	 */
	s16b stat_max[6];
	/** @structvar stat_cur[6]
	 * @brief Number
	 * @note Current "natural" stat values
	 */
	s16b stat_cur[6];

	/** @structvar luck_cur
	 * @brief Number
	 * @note Current "natural" luck value (range -30 <> 30)
	 */
	s16b luck_cur;
	/** @structvar luck_max
	 * @brief Number
	 * @note Current "maximal base" luck value (range -30 <> 30)
	 */
	s16b luck_max;
	/** @structvar luck_base
	 * @brief Number
	 * @note Current "base" luck value (range -30 <> 30)
	 */
	s16b luck_base;

	/** @structvar fast
	 * @brief Number
	 * @note Timed -- Fast
	 */
	s16b fast;
	/** @structvar lightspeed
	 * @brief Number
	 * @note Timed -- Light Speed
	 */
	s16b lightspeed;
	/** @structvar slow
	 * @brief Number
	 * @note Timed -- Slow
	 */
	s16b slow;
	/** @structvar blind
	 * @brief Number
	 * @note Timed -- Blindness
	 */
	s16b blind;
	/** @structvar paralyzed
	 * @brief Number
	 * @note Timed -- Paralysis
	 */
	s16b paralyzed;
	/** @structvar confused
	 * @brief Number
	 * @note Timed -- Confusion
	 */
	s16b confused;
	/** @structvar afraid
	 * @brief Number
	 * @note Timed -- Fear
	 */
	s16b afraid;
	/** @structvar image
	 * @brief Number
	 * @note Timed -- Hallucination
	 */
	s16b image;
	/** @structvar poisoned
	 * @brief Number
	 * @note Timed -- Poisoned
	 */
	s16b poisoned;
	/** @structvar cut
	 * @brief Number
	 * @note Timed -- Cut
	 */
	s16b cut;
	/** @structvar stun
	 * @brief Number
	 * @note Timed -- Stun
	 */
	s16b stun;

	/** @structvar protevil
	 * @brief Number
	 * @note Timed -- Protection from Evil
	 */
	s16b protevil;
	/** @structvar protgood
	 * @brief Number
	 * @note Timed -- Protection from Good
	 */
	s16b protgood;
	/** @structvar protundead
	 * @brief Number
	 * @note Timed -- Protection from Undead
	 */
	s16b protundead;
	/** @structvar invuln
	 * @brief Number
	 * @note Timed -- Invulnerable
	 */
	s16b invuln;
	/** @structvar hero
	 * @brief Number
	 * @note Timed -- Heroism
	 */
	s16b hero;
	/** @structvar shero
	 * @brief Number
	 * @note Timed -- Super Heroism
	 */
	s16b shero;
	/** @structvar shield
	 * @brief Number
	 * @note Timed -- Shield Spell
	 */
	s16b shield;
	/** @structvar shield_power
	 * @brief Number
	 * @note Timed -- Shield Spell Power
	 */
	s16b shield_power;
	/** @structvar shield_opt
	 * @brief Number
	 * @note Timed -- Shield Spell options
	 */
	s16b shield_opt;
	/** @structvar blessed
	 * @brief Number
	 * @note Timed -- Blessed
	 */
	s16b blessed;
	/** @structvar tim_invis
	 * @brief Number
	 * @note Timed -- See Invisible
	 */
	s16b tim_invis;
	/** @structvar tim_infra
	 * @brief Number
	 * @note Timed -- Infra Vision
	 */
	s16b tim_infra;

	/** @structvar oppose_acid
	 * @brief Number
	 * @note Timed -- oppose acid
	 */
	s16b oppose_acid;
	/** @structvar oppose_elec
	 * @brief Number
	 * @note Timed -- oppose lightning
	 */
	s16b oppose_elec;
	/** @structvar oppose_fire
	 * @brief Number
	 * @note Timed -- oppose heat
	 */
	s16b oppose_fire;
	/** @structvar oppose_cold
	 * @brief Number
	 * @note Timed -- oppose cold
	 */
	s16b oppose_cold;
	/** @structvar oppose_pois
	 * @brief Number
	 * @note Timed -- oppose poison
	 */
	s16b oppose_pois;
	/** @structvar oppose_ld
	 * @brief Number
	 * @note Timed -- oppose light & dark
	 */
	s16b oppose_ld;
	/** @structvar oppose_cc
	 * @brief Number
	 * @note Timed -- oppose chaos & confusion
	 */
	s16b oppose_cc;
	/** @structvar oppose_ss
	 * @brief Number
	 * @note Timed -- oppose sound & shards
	 */
	s16b oppose_ss;
	/** @structvar oppose_nex
	 * @brief Number
	 * @note Timed -- oppose nexus
	 */
	s16b oppose_nex;


	/** @structvar tim_esp
	 * @brief Number
	 * @note Timed ESP
	 */
	s16b tim_esp;
	/** @structvar tim_wraith
	 * @brief Number
	 * @note Timed wraithform
	 */
	s16b tim_wraith;
	/** @structvar tim_ffall
	 * @brief Number
	 * @note Timed Levitation
	 */
	s16b tim_ffall;
	/** @structvar tim_fly
	 * @brief Number
	 * @note Timed Levitation
	 */
	s16b tim_fly;
	/** @structvar tim_fire_aura
	 * @brief Number
	 * @note Timed Fire Aura
	 */
	s16b tim_fire_aura;
	/** @structvar tim_regen
	 * @brief Number
	 * @note Timed regen
	 */
	s16b tim_regen;
	/** @structvar tim_regen_pow
	 * @brief Number
	 * @note Timed regen
	 */
	s16b tim_regen_pow;
	/** @structvar tim_poison
	 * @brief Number
	 * @note Timed poison hands
	 */
	s16b tim_poison;
	/** @structvar tim_thunder
	 * @brief Number
	 * @note Timed thunderstorm
	 */
	s16b tim_thunder;
	/** @structvar tim_thunder_p1
	 * @brief Number
	 * @note Timed thunderstorm
	 */
	s16b tim_thunder_p1;
	/** @structvar tim_thunder_p2
	 * @brief Number
	 * @note Timed thunderstorm
	 */
	s16b tim_thunder_p2;

	/** @structvar resist_magic
	 * @brief Number
	 * @note Timed Resist Magic (later)
	 */
	s16b resist_magic;
	/** @structvar tim_invisible
	 * @brief Number
	 * @note Timed Invisibility
	 */
	s16b tim_invisible;
	/** @structvar tim_inv_pow
	 * @brief Number
	 * @note Power of timed invisibility
	 */
	s16b tim_inv_pow;
	/** @structvar tim_mimic
	 * @brief Number
	 * @note Timed Mimic
	 */
	s16b tim_mimic;
	/** @structvar tim_lite
	 * @brief Number
	 * @note Timed Lite
	 */
	s16b tim_lite;
	/** @structvar holy
	 * @brief Number
	 * @note Holy Aura
	 */
	s16b holy;
	/** @structvar walk_water
	 * @brief Number
	 * @note Walk over water as a god
	 */
	s16b walk_water;
	/** @structvar tim_mental_barrier
	 * @brief Number
	 * @note Sustain Int&Wis
	 */
	s16b tim_mental_barrier;
	/** @structvar strike
	 * @brief Number
	 * @note True Strike(+25 hit)
	 */
	s16b strike;
	/** @structvar meditation
	 * @brief Number
	 * @note Meditation(+50 mana -25 to hit/to dam)
	 */
	s16b meditation;
	/** @structvar tim_reflect
	 * @brief Number
	 * @note Timed Reflection
	 */
	s16b tim_reflect;
	/** @structvar tim_res_time
	 * @brief Number
	 * @note Timed Resistance to Time
	 */
	s16b tim_res_time;
	/** @structvar tim_deadly
	 * @brief Number
	 * @note Timed deadly blow
	 */
	s16b tim_deadly;
	/** @structvar prob_travel
	 * @brief Number
	 * @note Timed probability travel
	 */
	s16b prob_travel;
	/** @structvar disrupt_shield
	 * @brief Number
	 * @note Timed disruption shield
	 */
	s16b disrupt_shield;
	/** @structvar parasite
	 * @brief Number
	 * @note Timed parasite
	 */
	s16b parasite;
	/** @structvar parasite_r_idx
	 * @brief Number
	 * @note Timed parasite monster
	 */
	s16b parasite_r_idx;
	/** @structvar loan
	 * @brief Number
	 */
	u32b loan;
	/** @structvar loan_time
	 * @brief Number
	 * @note Timer -- loan
	 */
	u32b loan_time;
	/** @structvar tim_magic_breath
	 * @brief Number
	 * @note Magical breathing -- can breath anywhere
	 */
	s16b tim_magic_breath;
	/** @structvar tim_water_breath
	 * @brief Number
	 * @note Water breathing -- can breath underwater
	 */
	s16b tim_water_breath;

	/** @structvar immov_cntr
	 * @brief Number
	 * @note Timed -- Last ``immovable'' command.
	 */
	s16b immov_cntr;

	/** @structvar music_extra
	 * @brief Number
	 * @note Music songs
	 */
	u32b music_extra;
	/** @structvar music_extra2
	 * @brief Number
	 * @note Music songs
	 */
	u32b music_extra2;

	/** @structvar chaos_patron
	 * @brief Number
	 */
	s16b chaos_patron;

	/** @structvar recall_dungeon
	 * @brief Number
	 * @note Recall in which dungeon
	 */
	s16b recall_dungeon;
	/** @structvar word_recall
	 * @brief Number
	 * @note Word of recall counter
	 */
	s16b word_recall;

	/** @structvar energy
	 * @brief Number
	 * @note Current energy
	 */
	s32b energy;

	/** @structvar food
	 * @brief Number
	 * @note Current nutrition
	 */
	s16b food;

	/** @structvar confusing
	 * @brief Number
	 * @note Glowing hands
	 */
	byte confusing;
	/** @structvar searching
	 * @brief Number
	 * @note Currently searching
	 */
	byte searching;

	/** @structvar new_spells
	 * @brief Number
	 * @note Number of spells available
	 */
	s16b new_spells;

	/** @structvar old_spells
	 * @brief Number
	 */
	s16b old_spells;

	/** @structvar xtra_spells
	 * @brief Number
	 * @note Number of xtra spell learned(via potion)
	 */
	s16b xtra_spells;

	/** @structvar cur_lite
	 * @brief Number
	 * @note Radius of lite (if any)
	 */
	s16b cur_lite;

	/*** Extra flags -- used for lua and easying stuff ***/
	/** @structvar xtra_f1
	 * @brief Number
	 */
	u32b xtra_f1;
	/** @structvar xtra_f2
	 * @brief Number
	 */
	u32b xtra_f2;
	/** @structvar xtra_f3
	 * @brief Number
	 */
	u32b xtra_f3;
	/** @structvar xtra_f4
	 * @brief Number
	 */
	u32b xtra_f4;
	/** @structvar xtra_f5
	 * @brief Number
	 */
	u32b xtra_f5;
	/** @structvar xtra_esp
	 * @brief Number
	 */
	u32b xtra_esp;

	/** @structvar pspeed
	 * @brief Number
	 * @note Current speed
	 */
	s16b pspeed;

	/** @structvar notice
	 * @brief Number
	 * @note Special Updates (bit flags)
	 */
	u32b notice;
	/** @structvar update
	 * @brief Number
	 * @note Pending Updates (bit flags)
	 */
	u32b update;
	/** @structvar redraw
	 * @brief Number
	 * @note Normal Redraws (bit flags)
	 */
	u32b redraw;
	/** @structvar window
	 * @brief Number
	 * @note Window Redraws (bit flags)
	 */
	u32b window;

	/** @structvar stat_use[6]
	 * @brief Number
	 * @note Current modified stats
	 */
	s16b stat_use[6];
	/** @structvar stat_top[6]
	 * @brief Number
	 * @note Maximal modified stats
	 */
	s16b stat_top[6];

	/** @structvar stat_add[6]
	 * @brief Number
	 * @note Modifiers to stat values
	 */
	s16b stat_add[6];
	/** @structvar stat_ind[6]
	 * @brief Number
	 * @note Indexes into stat tables
	 */
	s16b stat_ind[6];
	/** @structvar stat_cnt[6]
	 * @brief Number
	 * @note Counter for temporary drains
	 */
	s16b stat_cnt[6];
	/** @structvar stat_los[6]
	 * @brief Number
	 * @note Amount of temporary drains
	 */
	s16b stat_los[6];

	/** @structvar immune_acid
	 * @brief Boolean
	 * @note Immunity to acid
	 */
	bool immune_acid;
	/** @structvar immune_elec
	 * @brief Boolean
	 * @note Immunity to lightning
	 */
	bool immune_elec;
	/** @structvar immune_fire
	 * @brief Boolean
	 * @note Immunity to fire
	 */
	bool immune_fire;
	/** @structvar immune_cold
	 * @brief Boolean
	 * @note Immunity to cold
	 */
	bool immune_cold;
	/** @structvar immune_neth
	 * @brief Boolean
	 * @note Immunity to nether
	 */
	bool immune_neth;

	/** @structvar resist_acid
	 * @brief Boolean
	 * @note Resist acid
	 */
	bool resist_acid;
	/** @structvar resist_elec
	 * @brief Boolean
	 * @note Resist lightning
	 */
	bool resist_elec;
	/** @structvar resist_fire
	 * @brief Boolean
	 * @note Resist fire
	 */
	bool resist_fire;
	/** @structvar resist_cold
	 * @brief Boolean
	 * @note Resist cold
	 */
	bool resist_cold;
	/** @structvar resist_pois
	 * @brief Boolean
	 * @note Resist poison
	 */
	bool resist_pois;

	/** @structvar resist_conf
	 * @brief Boolean
	 * @note Resist confusion
	 */
	bool resist_conf;
	/** @structvar resist_sound
	 * @brief Boolean
	 * @note Resist sound
	 */
	bool resist_sound;
	/** @structvar resist_lite
	 * @brief Boolean
	 * @note Resist light
	 */
	bool resist_lite;
	/** @structvar resist_dark
	 * @brief Boolean
	 * @note Resist darkness
	 */
	bool resist_dark;
	/** @structvar resist_chaos
	 * @brief Boolean
	 * @note Resist chaos
	 */
	bool resist_chaos;
	/** @structvar resist_disen
	 * @brief Boolean
	 * @note Resist disenchant
	 */
	bool resist_disen;
	/** @structvar resist_shard
	 * @brief Boolean
	 * @note Resist shards
	 */
	bool resist_shard;
	/** @structvar resist_nexus
	 * @brief Boolean
	 * @note Resist nexus
	 */
	bool resist_nexus;
	/** @structvar resist_blind
	 * @brief Boolean
	 * @note Resist blindness
	 */
	bool resist_blind;
	/** @structvar resist_neth
	 * @brief Boolean
	 * @note Resist nether
	 */
	bool resist_neth;
	/** @structvar resist_fear
	 * @brief Boolean
	 * @note Resist fear
	 */
	bool resist_fear;
	/** @structvar resist_continuum
	 * @brief Boolean
	 * @note Resist space-time continuum disruption
	 */
	bool resist_continuum;

	/** @structvar sensible_fire
	 * @brief Boolean
	 * @note Fire does more damage on the player
	 */
	bool sensible_fire;
	/** @structvar sensible_lite
	 * @brief Boolean
	 * @note Lite does more damage on the player and blinds her/him
	 */
	bool sensible_lite;

	/** @structvar reflect
	 * @brief Boolean
	 * @note Reflect 'bolt' attacks
	 */
	bool reflect;
	/** @structvar sh_fire
	 * @brief Boolean
	 * @note Fiery 'immolation' effect
	 */
	bool sh_fire;
	/** @structvar sh_elec
	 * @brief Boolean
	 * @note Electric 'immolation' effect
	 */
	bool sh_elec;
	/** @structvar wraith_form
	 * @brief Boolean
	 * @note wraithform
	 */
	bool wraith_form;

	/** @structvar anti_magic
	 * @brief Boolean
	 * @note Anti-magic
	 */
	bool anti_magic;
	/** @structvar anti_tele
	 * @brief Boolean
	 * @note Prevent teleportation
	 */
	bool anti_tele;

	/** @structvar sustain_str
	 * @brief Boolean
	 * @note Keep strength
	 */
	bool sustain_str;
	/** @structvar sustain_int
	 * @brief Boolean
	 * @note Keep intelligence
	 */
	bool sustain_int;
	/** @structvar sustain_wis
	 * @brief Boolean
	 * @note Keep wisdom
	 */
	bool sustain_wis;
	/** @structvar sustain_dex
	 * @brief Boolean
	 * @note Keep dexterity
	 */
	bool sustain_dex;
	/** @structvar sustain_con
	 * @brief Boolean
	 * @note Keep constitution
	 */
	bool sustain_con;
	/** @structvar sustain_chr
	 * @brief Boolean
	 * @note Keep charisma
	 */
	bool sustain_chr;

	/** @structvar aggravate
	 * @brief Boolean
	 * @note Aggravate monsters
	 */
	bool aggravate;
	/** @structvar teleport
	 * @brief Boolean
	 * @note Random teleporting
	 */
	bool teleport;

	/** @structvar exp_drain
	 * @brief Boolean
	 * @note Experience draining
	 */
	bool exp_drain;
	/** @structvar drain_mana
	 * @brief Number
	 * @note mana draining
	 */
	byte drain_mana;
	/** @structvar drain_life
	 * @brief Number
	 * @note hp draining
	 */
	byte drain_life;

	/** @structvar magical_breath
	 * @brief Boolean
	 * @note Magical breathing -- can breath anywhere
	 */
	bool magical_breath;
	/** @structvar water_breath
	 * @brief Boolean
	 * @note Water breathing -- can breath underwater
	 */
	bool water_breath;
	/** @structvar climb
	 * @brief Boolean
	 * @note Can climb mountains
	 */
	bool climb;
	/** @structvar fly
	 * @brief Boolean
	 * @note Can fly over some features
	 */
	bool fly;
	/** @structvar ffall
	 * @brief Boolean
	 * @note No damage falling
	 */
	bool ffall;
	/** @structvar lite
	 * @brief Boolean
	 * @note Permanent light
	 */
	bool lite;
	/** @structvar free_act
	 * @brief Boolean
	 * @note Never paralyzed
	 */
	bool free_act;
	/** @structvar see_inv
	 * @brief Boolean
	 * @note Can see invisible
	 */
	bool see_inv;
	/** @structvar regenerate
	 * @brief Boolean
	 * @note Regenerate hit pts
	 */
	bool regenerate;
	/** @structvar hold_life
	 * @brief Boolean
	 * @note Resist life draining
	 */
	bool hold_life;
	/** @structvar telepathy
	 * @brief Number
	 * @note Telepathy
	 */
	u32b telepathy;
	/** @structvar slow_digest
	 * @brief Boolean
	 * @note Slower digestion
	 */
	bool slow_digest;
	/** @structvar bless_blade
	 * @brief Boolean
	 * @note Blessed blade
	 */
	bool bless_blade;
	/** @structvar xtra_might
	 * @brief Number
	 * @note Extra might bow
	 */
	byte xtra_might;
	/** @structvar impact
	 * @brief Boolean
	 * @note Earthquake blows
	 */
	bool impact;
	/** @structvar auto_id
	 * @brief Boolean
	 * @note Auto id items
	 */
	bool auto_id;

	/** @structvar dis_to_h
	 * @brief Number
	 * @note Known bonus to hit
	 */
	s16b dis_to_h;
	/** @structvar dis_to_d
	 * @brief Number
	 * @note Known bonus to dam
	 */
	s16b dis_to_d;
	/** @structvar dis_to_a
	 * @brief Number
	 * @note Known bonus to ac
	 */
	s16b dis_to_a;

	/** @structvar dis_ac
	 * @brief Number
	 * @note Known base ac
	 */
	s16b dis_ac;

	/** @structvar to_m
	 * @brief Number
	 * @note Bonus to mana
	 */
	s16b to_m;
	/** @structvar to_s
	 * @brief Number
	 * @note Bonus to spell
	 */
	s16b to_s;
	/** @structvar to_h
	 * @brief Number
	 * @note Bonus to hit
	 */
	s16b to_h;
	/** @structvar to_d
	 * @brief Number
	 * @note Bonus to dam
	 */
	s16b to_d;
	/** @structvar to_a
	 * @brief Number
	 * @note Bonus to ac
	 */
	s16b to_a;

	/** @structvar to_h_melee
	 * @brief Number
	 * @note Bonus to hit
	 */
	s16b to_h_melee;
	/** @structvar to_d_melee
	 * @brief Number
	 * @note Bonus to dam
	 */
	s16b to_d_melee;

	/** @structvar to_h_ranged
	 * @brief Number
	 * @note Bonus to hit
	 */
	s16b to_h_ranged;
	/** @structvar to_d_ranged
	 * @brief Number
	 * @note Bonus to dam
	 */
	s16b to_d_ranged;

	/** @structvar num_blow
	 * @brief Number
	 * @note Number of blows
	 */
	s16b num_blow;
	/** @structvar num_fire
	 * @brief Number
	 * @note Number of shots
	 */
	s16b num_fire;

	/** @structvar ac
	 * @brief Number
	 * @note Base ac
	 */
	s16b ac;

	/** @structvar antimagic
	 * @brief Number
	 * @note Power of the anti magic field
	 */
	byte antimagic;
	/** @structvar antimagic_dis
	 * @brief Number
	 * @note Radius of the anti magic field
	 */
	byte antimagic_dis;

	/** @structvar see_infra
	 * @brief Number
	 * @note Infravision range
	 */
	s16b see_infra;

	/** @structvar skill_dis
	 * @brief Number
	 * @note Skill: Disarming
	 */
	s16b skill_dis;
	/** @structvar skill_dev
	 * @brief Number
	 * @note Skill: Magic Devices
	 */
	s16b skill_dev;
	/** @structvar skill_sav
	 * @brief Number
	 * @note Skill: Saving throw
	 */
	s16b skill_sav;
	/** @structvar skill_stl
	 * @brief Number
	 * @note Skill: Stealth factor
	 */
	s16b skill_stl;
	/** @structvar skill_srh
	 * @brief Number
	 * @note Skill: Searching ability
	 */
	s16b skill_srh;
	/** @structvar skill_fos
	 * @brief Number
	 * @note Skill: Searching frequency
	 */
	s16b skill_fos;
	/** @structvar skill_thn
	 * @brief Number
	 * @note Skill: To hit (normal)
	 */
	s16b skill_thn;
	/** @structvar skill_thb
	 * @brief Number
	 * @note Skill: To hit (shooting)
	 */
	s16b skill_thb;
	/** @structvar skill_tht
	 * @brief Number
	 * @note Skill: To hit (throwing)
	 */
	s16b skill_tht;
	/** @structvar skill_dig
	 * @brief Number
	 * @note Skill: Digging
	 */
	s16b skill_dig;

	/** @structvar skill_points
	 * @brief Number
	 */
	s16b skill_points;

	/** @structvar control
	 * @brief Number
	 * @note Controlled monster
	 */
	s16b control;
	/** @structvar control_dir
	 * @brief Number
	 * @note Controlled monster
	 */
	byte control_dir;
	/** @structvar companion_killed
	 * @brief Number
	 * @note Number of companion death
	 */
	s16b companion_killed;
	/** @structvar black_breath
	 * @brief Boolean
	 * @note The Tolkien's Black Breath
	 */
	bool black_breath;
	/** @structvar body_monster
	 * @brief Number
	 * @note In which body is the player
	 */
	u16b body_monster;

	/** @structvar body_parts[28]
	 * @brief Number
	 * @note Various body modifiers
	 */
	byte body_parts[28];

	/** @structvar powers_mod[POWER_MAX_INIT]
	 * @brief Boolean
	 * @note Intrinsinc powers
	 */
	bool powers_mod[POWER_MAX_INIT];
	/** @structvar powers[power_max]
	 * @brief Boolean
	 */
	bool powers[power_max];

	/** @structvar spellbinder_num
	 * @brief Number
	 * @note Number of spells bound
	 */
	byte spellbinder_num;
	/** @structvar spellbinder[4]
	 * @brief Number
	 * @note Spell bounds
	 */
	u32b spellbinder[4];
	/** @structvar spellbinder_trigger
	 * @brief Number
	 * @note Spellbinder trigger condition
	 */
	byte spellbinder_trigger;

	/* Corruptions */
	/** @structvar  corruptions_aux;
	 * @brief Boolean
	 */
	bool corruptions[max_corruptions] @ corruptions_aux;

	/* Astral */
	/** @structvar astral
	 * @brief Boolean
	 * @note We started at the bottom ?
	 */
	bool astral;

	/*** Temporary fields ***/

	/** @structvar leaving
	 * @brief Boolean
	 * @note True if player is leaving
	 */
	bool leaving;
};

/** @name Spellbinder triggers
 * @{ */
/** @def SPELLBINDER_HP75
 * @note Trigger spellbinder at 75% maximum hit points */
#define SPELLBINDER_HP75	1

/** @def SPELLBINDER_HP50
 * @note Trigger spellbinder at 50% maximum hit points */
#define SPELLBINDER_HP50	2

/** @def SPELLBINDER_HP25
 * @note Trigger spellbinder at 25% maximum hit points */
#define SPELLBINDER_HP25	3
/** @} */


/** @struct player_race
 */
struct player_race
{
	/** @structvar title
	 * @brief Number
	 * @note Type of race
	 */
	s32b title;
	/** @structvar desc
	 * @brief Number
	 */
	s32b desc;

	/** @structvar infra
	 * @brief Number
	 * @note Infra-vision range
	 */
	byte infra;
};

/** @struct player_race_mod
 */
struct player_race_mod
{
	/** @structvar title
	 * @brief Number
	 * @note Type of race mod
	 */
	s32b title;
	/** @structvar desc
	 * @brief Number
	 * @note Desc
	 */
	s32b desc;
	/** @structvar place
	 * @brief Boolean
	 * @note TRUE = race race modifier, FALSE = Race modifier race
	 */
	bool place;

	/** @structvar r_adj[6]
	 * @brief Number
	 * @note (+) Racial stat bonuses
	 */
	s16b r_adj[6];

	/** @structvar luck
	 * @brief String
	 * @note Luck
	 */
	char luck;
	/** @structvar mana
	 * @brief Number
	 * @note Mana %
	 */
	s16b mana;

	/** @structvar r_dis
	 * @brief Number
	 * @note (+) disarming
	 */
	s16b r_dis;
	/** @structvar r_dev
	 * @brief Number
	 * @note (+) magic devices
	 */
	s16b r_dev;
	/** @structvar r_sav
	 * @brief Number
	 * @note (+) saving throw
	 */
	s16b r_sav;
	/** @structvar r_stl
	 * @brief Number
	 * @note (+) stealth
	 */
	s16b r_stl;
	/** @structvar r_srh
	 * @brief Number
	 * @note (+) search ability
	 */
	s16b r_srh;
	/** @structvar r_fos
	 * @brief Number
	 * @note (+) search frequency
	 */
	s16b r_fos;
	/** @structvar r_thn
	 * @brief Number
	 * @note (+) combat (normal)
	 */
	s16b r_thn;
	/** @structvar r_thb
	 * @brief Number
	 * @note (+) combat (shooting)
	 */
	s16b r_thb;

	/** @structvar r_mhp
	 * @brief String
	 * @note (+) Race mod hit-dice modifier
	 */
	char r_mhp;
	/** @structvar r_exp
	 * @brief Number
	 * @note (+) Race mod experience factor
	 */
	s16b r_exp;

	/** @structvar b_age
	 * @brief String
	 * @note (+) base age
	 */
	char b_age;
	/** @structvar m_age
	 * @brief String
	 * @note (+) mod age
	 */
	char m_age;

	/** @structvar m_b_ht
	 * @brief String
	 * @note (+) base height (males)
	 */
	char m_b_ht;
	/** @structvar m_m_ht
	 * @brief String
	 * @note (+) mod height (males)
	 */
	char m_m_ht;
	/** @structvar m_b_wt
	 * @brief String
	 * @note (+) base weight (males)
	 */
	char m_b_wt;
	/** @structvar m_m_wt
	 * @brief String
	 * @note (+) mod weight (males)
	 */
	char m_m_wt;

	/** @structvar f_b_ht
	 * @brief String
	 * @note (+) base height (females)
	 */
	char f_b_ht;
	/** @structvar f_m_ht
	 * @brief String
	 * @note (+) mod height (females)
	 */
	char f_m_ht;
	/** @structvar f_b_wt
	 * @brief String
	 * @note (+) base weight (females)
	 */
	char f_b_wt;
	/** @structvar f_m_wt
	 * @brief String
	 * @note (+) mod weight (females)
	 */
	char f_m_wt;

	/** @structvar infra
	 * @brief String
	 * @note (+) Infra-vision range
	 */
	char infra;

	/** @structvar choice[2]
	 * @brief Number
	 * @note Legal race choices
	 */
	u32b choice[2];

	/** @structvar pclass[2]
	 * @brief Number
	 * @note Classes allowed
	 */
	u32b pclass[2];
	/** @structvar mclass[2]
	 * @brief Number
	 * @note Classes restricted
	 */
	u32b mclass[2];

	/** @structvar powers[4]
	 * @brief Number
	 * @note Powers of the subrace
	 */
	s16b powers[4];

	/** @structvar body_parts[BODY_MAX]
	 * @brief String
	 * @note To help to decide what to use when body changing
	 */
	char body_parts[BODY_MAX];

	/** @structvar flags1
	 * @brief Number
	 */
	u32b flags1;
	/** @structvar flags2
	 * @brief Number
	 * @note flags
	 */
	u32b flags2;

	/** @structvar oflags1[51]
	 * @brief Number
	 */
	u32b oflags1[51];
	/** @structvar oflags2[51]
	 * @brief Number
	 */
	u32b oflags2[51];
	/** @structvar oflags3[51]
	 * @brief Number
	 */
	u32b oflags3[51];
	/** @structvar oflags4[51]
	 * @brief Number
	 */
	u32b oflags4[51];
	/** @structvar oflags5[51]
	 * @brief Number
	 */
	u32b oflags5[51];
	/** @structvar oesp[51]
	 * @brief Number
	 */
	u32b oesp[51];
	/** @structvar opval[51]
	 * @brief Number
	 */
	s16b opval[51];

	/** @structvar g_attr
	 * @brief Number
	 * @note Overlay graphic attribute
	 */
	byte g_attr;
	/** @structvar g_char
	 * @brief String
	 * @note Overlay graphic character
	 */
	char g_char;

	/** @structvar skill_basem[MAX_SKILLS]
	 * @brief String
	 */
	char skill_basem[MAX_SKILLS];
	/** @structvar skill_base[MAX_SKILLS]
	 * @brief Number
	 */
	u32b skill_base[MAX_SKILLS];
	/** @structvar skill_modm[MAX_SKILLS]
	 * @brief String
	 */
	char skill_modm[MAX_SKILLS];
	/** @structvar skill_mod[MAX_SKILLS]
	 * @brief Number
	 */
	s16b skill_mod[MAX_SKILLS];
};

/** @var energy_use
 * @brief Number
 * @note Energy use for an action (0 if action does not take a turn).
 */
extern s32b energy_use;

/** @var  player;
 * @brief player_type
 * @note The player.
 */
extern player_type *p_ptr @ player;

/** @var max_rp_idx
 * @brief Number
 * @note Maximum number of entries in player race array.
 */
extern u16b max_rp_idx;

/** @var race_info[max_rp_idx]
 * @brief player_race
 * @note Array of player races.
 */
extern player_race race_info[max_rp_idx];

/** @var *rp_name
 * @brief String
 * @note Name of player race.
 */
extern char *rp_name;

/** @var *rp_text
 * @brief String
 */
extern char *rp_text;

/** @var max_rmp_idx
 * @brief Number
 * @note Maximum number of player subraces.
 */
extern u16b max_rmp_idx;

/** @var _mod race_mod_info[max_rmp_idx]
 * @brief player_race
 * @note Array of player subraces.
 */
extern player_race_mod race_mod_info[max_rmp_idx];

/** @var *rmp_name
 * @brief String
 * @note Name of player subrace.
 */
extern char *rmp_name;

/** @var *rmp_text
 * @brief String
 */
extern char *rmp_text;

/** @var class_info[max_c_idx]
 * @brief player_class
 * @note Array of classes.
 */
extern player_class class_info[max_c_idx];

/** @var *c_name
 * @brief String
 * @note Name of player class.
 */
extern char *c_name;

/** @var *c_text
 * @brief String
 */
extern char *c_text;

/** @var flush_failure
 * @brief Boolean
 * @note TRUE if flush input on any failure, otherwise FALSE.
 */
extern bool flush_failure;

/** @fn set_roots(int v, s16b ac, s16b dam)
 * @brief Player has timed roots.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param ac Number \n bonus to AC
 * @brief AC bonus
 * @param dam Number \n bonus to melee to-damage
 * @brief To-damage bonus
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_roots(int v, s16b ac, s16b dam);

/** @fn set_shadow(int v)
 * @brief Player has wraith form.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_shadow(int v);

/** @fn set_parasite(int v, int r)
 * @brief Player has timed parasite.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param r Number \n index of race in monster race array
 * @brief Parasite race index
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * When the time remaining reaches 0, there is an 80% chance the parasite will
 * be born, otherwise it will die away.
 * @note (see file xtra2.c)
 */
extern bool set_parasite(int v, int r);

/** @fn set_disrupt_shield(int v)
 * @brief Player has timed disrupt shield (feels invulnerable).\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_disrupt_shield(int v);

/** @fn set_prob_travel(int v)
 * @brief Player has timed probability travel.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_prob_travel(int v);

/** @fn set_project(int v, s16b gf, s16b dam, s16b rad, s16b flag)
 * @brief Player's weapon has a spell effect.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param gf Number \n spell effect
 * @brief Spell effect
 * @param dam Number \n damage caused by spell effect
 * @brief Spell damage
 * @param rad Number \n radius of spell effect
 * @brief Spell radius
 * @param flag Number \n spell projection effect
 * @brief Spell properties
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_project(int v, s16b gf, s16b dam, s16b rad, s16b flag);

/** @fn set_tim_deadly(int v)
 * @brief Player has deadly accuracy.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_deadly(int v);

/** @fn set_tim_res_time(int v)
 * @brief Player has timed time resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_res_time(int v);

/** @fn set_tim_reflect(int v)
 * @brief Player has timed reflection.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_reflect(int v);

/** @fn set_meditation(int v)
 * @brief Player can meditate (forcibly pseudo-id).\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_meditation(int v);

/** @fn set_strike(int v)
 * @brief Player has true strike.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_strike(int v);

/** @fn set_walk_water(int v)
 * @brief Player can walk on water.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_walk_water(int v);

/** @fn set_tim_ffall(int v)
 * @brief Player has timed levitation (feather-fall).\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_ffall(int v);

/** @fn set_tim_fire_aura(int v)
 * @brief Player has a timed fiery aura.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_fire_aura(int v);

/** @fn set_tim_regen(int v, int p)
 * @brief Player has timed regeneration.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param p Number \n power of regeneration
 * @brief Regeneration power
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_regen(int v, int p);

/** @fn set_holy(int v)
 * @brief Player has a timed holy aura.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_holy(int v);

/** @fn set_grace(s32b v)
 * @brief Set the amount of grace a player has with a god.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range -30,000 to 30,000)
 * @brief Grace
 * @note (see file xtra2.c)
 */
extern void set_grace(s32b v);

/** @fn set_mimic(int v, int p, int level)
 * @brief Player has mimic form.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param p Number \n the mimic form
 * @brief Mimic form
 * @param level Number \n the level of the mimic form
 * @brief Mimic level
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_mimic(int v, int p, int level);

/** @fn set_no_breeders(int v)
 * @brief Player has timed breeder prevention.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_no_breeders(int v);

/** @fn set_tim_esp(int v)
 * @brief Player has timed ESP.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_esp(int v);

/** @fn set_invis(int v, int p)
 * @brief Player has timed invisibility.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param p Number \n power of invisibility
 * @brief Invisibility power
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_invis(int v, int p);

/** @fn set_lite(int v)
 * @brief Player has timed light.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Note the use of "PU_VIEW", which is needed to
 * memorize any terrain features which suddenly become "visible".
 * @note
 * Note that blindness is currently the only thing which can affect
 * "player_can_see_bold()".
 * @note (see file xtra2.c)
 */
extern bool set_lite(int v);

/** @fn set_blind(int v)
 * @brief Player has timed blindness.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Note the use of "PU_UN_VIEW", which is needed to memorize any terrain
 * features which suddenly become "visible".
 * @note
 * Note that blindness is currently the only thing which can affect
 * "player_can_see_bold()".
 * @note (see file xtra2.c)
 */
extern bool set_blind(int v);

/** @fn set_confused(int v)
 * @brief Player has timed confusion.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_confused(int v);

/** @fn set_poisoned(int v)
 * @brief Player has timed poisoning.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_poisoned(int v);

/** @fn set_afraid(int v)
 * @brief Player has timed fear.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_afraid(int v);

/** @fn set_paralyzed(int v)
 * @brief Player has timed paralysis.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_paralyzed(int v);

/** @fn set_image(int v)
 * @brief Player has timed hallucination.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Note that we must redraw the map when hallucination changes.
 * @note (see file xtra2.c)
 */
extern bool set_image(int v);

/** @fn set_fast(int v, int p)
 * @brief Player has timed speed boost.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param p Number \n speed factor
 * @brief Speed factor
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_fast(int v, int p);

/** @fn set_light_speed(int v)
 * @brief Player has timed light speed.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_light_speed(int v);

/** @fn set_slow(int v)
 * @brief Player has timed slowness.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_slow(int v);

/** @fn set_shield(int v, int p, s16b o, s16b d1, s16b d2)
 * @brief Player has timed mystic shield.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param p Number \n bonus to AC
 * @brief AC bonus
 * @param o Number \n type of shield (see SHIELD_foo fields)
 * @brief Shield type
 * @param d1 Number \n number of dice for damage roll
 * @brief Damage dice
 * @param d2 Number \n number of sides per die for damage roll
 * @brief Damage sides
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_shield(int v, int p, s16b o, s16b d1, s16b d2);

/* For calc_bonus hooks */
/** @fn apply_flags(u32b f1, u32b f2, u32b f3, u32b f4, u32b f5, u32b esp, s16b pval = 0, s16b tval = 0, s16b to_h = 0, s16b to_d = 0, s16b to_a = 0)
 * @brief Apply flags and values to the player.\n
 * @param f1 Number \n flags to be applied to the player
 * @brief Flag1
 * @param f2 Number \n flags to be applied to the player
 * @brief Flag2
 * @param f3 Number \n flags to be applied to the player
 * @brief Flag3
 * @param f4 Number \n flags to be applied to the player
 * @brief Flag4
 * @param f5 Number \n flags to be applied to the player
 * @brief Flag5
 * @param esp Number \n ESP flag
 * @brief Esp flag
 * @param pval Number \n PVal to be applied to the player
 * @brief Pval
 * @param tval Number \n TVal to be applied to the player
 * @brief Tval
 * @param to_h Number \n to-hit bonus to be applied to the player
 * @brief To-hit
 * @param to_d Number \n to-damage bonus to be applied to the player
 * @brief To-damage
 * @param to_a Number \n AC bonus to be applied to the player
 * @brief AC
 * @note
 * f1 can apply to attribuets, spell power, mana capacity, stealth, searching
 * ability and frequency, infravision, digging, speed, extra blows, and
 * earthquakes.
 * @note
 * f2 can apply to life capacity, sensible fire, invisibility, free action,
 * hold life, immunities (except neither), resistances, reflection, and
 * sustains.
 * @note
 * f3 can apply to extra shots, aggravate, teleport, drain XP, blessed, extra
 * might, slow digestion, regeneration, lite, see invisible, wraith form,
 * feather fall, fire sheath, electricity sheath, anti magic, and anti
 * teleport.
 * @note
 * f4 can apply to lite, flying, climbing, nether immunity, precognition, and
 * anti-magic power and radius.
 * @note
 * f5 can apply to luck, critical hits, drain mana, drain life, immovable,
 * water breath, and magic breath.
 * @note
 * esp can apply to, well, just telepathy.
 * @note
 * pval can apply to attributes, luck, spell power, mana capacity, life
 * capacity, stealth, search ability and frequency (x 5), infravision, digging
 * (x 20), speed, extra blows, critical blows, invisibility (x 10), extra
 * might, anti-magic power and radius.
 * @note
 * tval can apply to lite
 * @note
 * to_h, to_d, and to_ac can apply to anti-magic power and radius.
 * @note (see file xtra1.c)
 */
extern void apply_flags(u32b f1, u32b f2, u32b f3, u32b f4, u32b f5, u32b esp, s16b pval = 0, s16b tval = 0, s16b to_h = 0, s16b to_d = 0, s16b to_a = 0);

/** @name Shield effect options
 * @{ */
/** @def SHIELD_NONE */
#define SHIELD_NONE	     0x0000

/** @def SHIELD_COUNTER */
#define SHIELD_COUNTER	  0x0001

/** @def SHIELD_FIRE */
#define SHIELD_FIRE	     0x0002

/** @def SHIELD_GREAT_FIRE */
#define SHIELD_GREAT_FIRE       0x0004

/** @def SHIELD_FEAR */
#define SHIELD_FEAR	     0x0008
/** @} */


/** @fn set_tim_thunder(int v, int p1, int p2)
 * @brief Player has timed thunderstorm.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param p1 Number \n number of dice for damage roll
 * @brief Damage dice
 * @param p2 Number \n number of sides per die for damage roll
 * @brief Damage sides
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_thunder(int v, int p1, int p2);

/** @fn set_tim_breath(int v, bool magical)
 * @brief Player has timed magic/water breath.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @param magical Boolean \n TRUE if player has magic breath, or FALSE if the
 * player has water breath
 * @brief Magic breath?
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_breath(int v, bool magical);

/** @fn set_tim_fly(int v)
 * @brief Player has timed flight.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_fly(int v);

/** @fn set_blessed(int v)
 * @brief Player has timed blessing.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Blessing gives +5 bonus AC and +10 bonus to-hit.
 * @note (see file xtra2.c)
 */
extern bool set_blessed(int v);

/** @fn set_hero(int v)
 * @brief Player has timed heroism.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Heroism gives +10 bonus max HP, +12 bonus to-hit, and resist fear.
 * @note (see file xtra2.c)
 */
extern bool set_hero(int v);

/** @fn set_shero(int v)
 * @brief Player has timed berserk strength.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Berserk strength gives +30 bonus max HP, +24 bonus to-hit, -10 penalty AC,
 * and resist fear.
 * @note (see file xtra2.c)
 */
extern bool set_shero(int v);

/** @fn set_protevil(int v)
 * @brief Player has timed protection from evil.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Protection from evil gives the player a chance to repel evil monsters.
 * @note (see file xtra2.c)
 */
extern bool set_protevil(int v);

/** @fn set_protgood(int v)
 * @brief Player has timed protection from good.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Protection from good gives the player a chance to repel good monsters.
 * @note (see file xtra2.c)
 */
extern bool set_protgood(int v);

/** @fn set_protundead(int v)
 * @brief Player has timed protection from undead.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Protection from undead protects against getting the Black Breath in a melee
 * attack.
 * @note (see file xtra2.c)
 */
extern bool set_protundead(int v);

/** @fn set_invuln(int v)
 * @brief Player has timed invulnerability.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Invulnerability prevents damage from walking on lava, walking the Straight
 * Road, poison, cuts, and starvation. It gives +100 bonus to AC.
 * @note
 * It can be ended by the player attacking a monster, firing a missile,
 * throwing an object, or activating a power.
 * @note (see file xtra2.c)
 */
extern bool set_invuln(int v);

/** @fn set_tim_invis(int v)
 * @brief Player has timed "see invisibile".\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_invis(int v);

/** @fn set_tim_infra(int v)
 * @brief Player has timed infravision.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_tim_infra(int v);

/** @fn set_mental_barrier(int v)
 * @brief Player has timed mental barrier.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Mental barrier sustains intelligence and wisdom.
 * @note (see file xtra2.c)
 */
extern bool set_mental_barrier(int v);

/** @fn set_poison(int v)
 * @brief Player has timed poison hands.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_poison(int v);

/** @fn set_oppose_acid(int v)
 * @brief Player has timed acid resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_acid(int v);

/** @fn set_oppose_elec(int v)
 * @brief Player has timed electricity resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_elec(int v);

/** @fn set_oppose_fire(int v)
 * @brief Player has timed fire resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_fire(int v);

/** @fn set_oppose_cold(int v)
 * @brief Player has timed cold resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_cold(int v);

/** @fn set_oppose_pois(int v)
 * @brief Player has timed poison resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_pois(int v);

/** @fn set_oppose_ld(int v)
 * @brief Player has timed light and dark resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_ld(int v);

/** @fn set_oppose_cc(int v)
 * @brief Player has timed chaos and confusion resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_cc(int v);

/** @fn set_oppose_ss(int v)
 * @brief Player has timed sound and shard resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_ss(int v);

/** @fn set_oppose_nex(int v)
 * @brief Player has timed nexus resistance.\n
 * @param v Number \n time remaining until effect expires
 * (must be in the range 0 to 10,000)
 * @brief Time remaining
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note (see file xtra2.c)
 */
extern bool set_oppose_nex(int v);

/** @fn set_stun(int v)
 * @brief Player stun level changes.\n
 * @param v Number \n the level of stun (must be in the range 0 to 10,000)
 * @brief Stun level
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Note the special code to only notice "range" changes.
 * @note
 * Some races resist stunning.
 * @note
 * There is a v chance in 1000 or 1 in 16 that a stun will be the result of
 * a vicious blow to the head. If so, the player will lose a point of
 * intelligence, or wisdom, or both unless the stat is sustained.
 * @note (see file xtra2.c)
 */
extern bool set_stun(int v);

/** @fn set_cut(int v)
 * @brief Player cut level changes.\n
 * @param v Number \n the level of cut (must be in the range 0 to 10,000)
 * @brief Cut level
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * Note the special code to only notice "range" changes.
 * @note
 * Some races resist cutting.
 * @note
 * There is a v chance in 1000 or 1 in 16 that a cut will result in scarrring.
 * If so, the player will lose a point of charisma unless it is sustained.
 * @note (see file xtra2.c)
 */
extern bool set_cut(int v);

/** @fn set_food(int v)
 * @brief Player hunger level changes.\n
 * @param v Number \n the level of cut (must be in the range 0 to 10,000)
 * @brief Cut level
 * @return Boolean \n TRUE if player notices the effect, otherwise FALSE.
 * @note
 * The "p_ptr->food" variable can get as large as 20000, allowing the
 * addition of the most "filling" item, Elvish Waybread, which adds
 * 7500 food units, without overflowing the 32767 maximum limit.
 * @note
 * Perhaps we should disturb the player with various messages,
 * especially messages about hunger status changes.  XXX XXX XXX
 * @note
 * Digestion of food is handled in "dungeon.c", in which, normally,
 * the player digests about 20 food units per 100 game turns, more
 * when "fast", more when "regenerating", less with "slow digestion",
 * but when the player is "gorged", he digests 100 food units per 10
 * game turns, or a full 1000 food units per 100 game turns.
 * @note
 * Note that the player's speed is reduced by 10 units while gorged,
 * so if the player eats a single food ration (5000 food units) when
 * full (15000 food units), he will be gorged for (5000/100)*10 = 500
 * game turns, or 500/(100/5) = 25 player turns (if nothing else is
 * affecting the player speed).
 * @note (see file xtra2.c)
 */
extern bool set_food(int v);

/** @name Hunger flags
 * @brief Player "food" crucial values
 * @{ */
/** @def PY_FOOD_MAX
 * @note Food value (Bloated)
 */
#define PY_FOOD_MAX	     15000
/** @def PY_FOOD_FULL
 * @note Food value (Normal)
 */
#define PY_FOOD_FULL    10000
/** @def PY_FOOD_ALERT
 * @note Food value (Hungry)
 */
#define PY_FOOD_ALERT   2000
/** @def PY_FOOD_WEAK
 * @note Food value (Weak)
 */
#define PY_FOOD_WEAK    1000
/** @def PY_FOOD_FAINT
 * @note Food value (Fainting)
 */
#define PY_FOOD_FAINT   500
/** @def PY_FOOD_STARVE
 * @note Food value (Starving)
 */
#define PY_FOOD_STARVE  100
/** @} */

/** @fn check_experience(void)
 * @brief Check if player experience level has changed.\n
 * @note
 * If a player has achieved a level for the first time, give a corruption
 * (1 chance in 3) if it applies, increase skill points, check ability levels,
 * and add a note if notes are taken.
 * @note (see file xtra2.c)
 */
extern void check_experience(void);

/** @fn check_experience_obj(object_type *o_ptr)
 * @brief Check if object "o_ptr" experience level has changed.\n
 * @param *o_ptr object_type \n the object
 * @brief Object
 * @note
 * If an object has achieved a level for the first time, apply gains.
 * @note (see file xtra2.c)
 */
extern void check_experience_obj(object_type *o_ptr);

/** @fn gain_exp(s32b amount)
 * @brief Gain "amount" of experience.\n
 * @param amount Number \n the experience points to gain.
 * @brief Experience
 * @note
 * Count the number of objects which will gain experience. The objects share
 * equally 2/3 of "amount". Give corruption if it applies. Gain experience.
 * If experience is less than maximum, then increase maximum experience by 20%
 * of "amount". Check for level change and print experience (check_experience).
 * @note (see file xtra2.c)
 */
extern void gain_exp(s32b amount);

/** @fn lose_exp(s32b amount)
 * @brief Decrease experience by "amount".\n
 * @param amount Number \n the experience points to lose.
 * @brief Experience
 * @note
 * Experience can not fall below zero. Check for level change and print
 * experience (check_experience).
 * @note (see file xtra2.c)
 */
extern void lose_exp(s32b amount);

/** @fn no_lite(void)
 * @brief Return true if the player's grid is dark.
 * @return Boolean \n TRUE if the player's grid is dark, otherwise FALSE.
 * @note (see file cave.c)
 */
extern bool no_lite(void);

/** @var dun_level
 * @brief Number
 * @note Current dungeon level
 */
extern s16b dun_level;


/** @name Gods
 * @{ */
/** @def GOD_ALL */
#define GOD_ALL		 -1

/** @def GOD_NONE */
#define GOD_NONE		0

/** @def GOD_ERU */
#define GOD_ERU		 1

/** @def GOD_MANWE */
#define GOD_MANWE	       2

/** @def GOD_TULKAS */
#define GOD_TULKAS	      3

/** @def GOD_MELKOR */
#define GOD_MELKOR	      4

/** @def GOD_YAVANNA */
#define GOD_YAVANNA	     5
/** @} */


/** @fn inc_piety(int god, s32b amt)
 * @brief Increase piety for god "god" by amount "amt".\n
 * @param god Number \n the god
 * @brief God
 * @param amt Number \n the amount of piety
 * @brief Piety
 * @note
 * If the player worships all gods, or "god", the piety (grace) will increase.
 * @note (see file gods.c)
 */
extern void inc_piety(int god, s32b amt);

/** @fn abandon_god(int god)
 * @brief Player renounces their religion.\n
 * @param god Number \n the god
 * @brief God
 * @note
 * If the player worships all gods or "god", the player worships no god and
 * the piety score is set to 0.
 * @note (see file gods.c)
 */
extern void abandon_god(int god);

/** @fn wisdom_scale(int max)
 * @brief Rescale the wisdom value to a 0 <-> max range.\n
 * @param max Number \n the new maximum value of the rescaled wisdom
 * @brief New maximum wisdom
 * @return Number \n The rescaled value of player wisdom.
 * @note (see file gods.c)
 */
extern int wisdom_scale(int max);

/** @fn follow_god(int god, bool silent)
 * @brief Player starts to follow god "god".\n
 * @param god Number \n the god
 * @brief God
 * @param silent Boolean \n TRUE if Melkor message is displayed, otherwise
 * FALSE.
 * @brief Show message?
 * @note
 * Unbelievers can not follow a god.
 * @note
 * If the player does not worship a god, they start worshipping "god". If the
 * god is Melkor, the player gains the Udun skill (show a message if silent is
 * FALSE).
 * @note (see file gods.c)
 */
extern void follow_god(int god, bool silent);

/** @fn add_new_gods(char *name)
 * @brief Add a new god to the deity array.\n
 * @param *name String \n the name of the god
 * @brief God name
 * @return Number \n The index of the new god inthe deity array.
 * @note (see file lua_bind.c)
 */
extern s16b    add_new_gods(char *name);

/** @fn desc_god(int g_idx, int d, char *desc)
 * @brief Return line "d" of the description of god with god index "g_idx".\n
 * @param g_idx Number \n the index of god in the deity array.
 * @brief God index
 * @param d Number \n the line of the description
 * (must be in the range 0 to 9).
 * @brief Line of description
 * @param *desc String
 * @brief Description
 * @return *desc String \n Line "d" of the god description.
 * @note (see file lua_bind.c)
 */
extern void    desc_god(int g_idx, int d, char *desc);

/** @name Powers
 * @{ */
/** @def PWR_SPIT_ACID
 * @note Spit acid (GF_ACID) */
#define PWR_SPIT_ACID		  0

/** @def PWR_BR_FIRE
 * @note Breathe fire (GF_FIRE) */
#define PWR_BR_FIRE		    1

/** @def PWR_HYPN_GAZE
 * @note Hypnotic gaze */
#define PWR_HYPN_GAZE		  2

/** @def PWR_TELEKINES
 * @note Telekinesis (fetch an object) */
#define PWR_TELEKINES		  3

/** @def PWR_VTELEPORT
 * @note Teleport */
#define PWR_VTELEPORT		  4

/** @def PWR_MIND_BLST
 * @note Mind blast (GF_PSI) */
#define PWR_MIND_BLST		  5

/** @def PWR_RADIATION
 * @note Emit radiation (GF_NUKE) */
#define PWR_RADIATION		  6

/** @def PWR_VAMPIRISM
 * @note Vampire bite */
#define PWR_VAMPIRISM		  7

/** @def PWR_SMELL_MET
 * @note Detect treasure */
#define PWR_SMELL_MET		  8

/** @def PWR_SMELL_MON
 * @note Detect normal monsters */
#define PWR_SMELL_MON		  9

/** @def PWR_BLINK
 * @note Short teleport (up to 10 grids) */
#define PWR_BLINK		      10

/** @def PWR_EAT_ROCK
 * @note Eat rock for food (wall to mud) */
#define PWR_EAT_ROCK		   11

/** @def PWR_SWAP_POS
 * @note Swap position with a monster */
#define PWR_SWAP_POS		   12

/** @def PWR_SHRIEK
 * @note Shriek (GF_SOUND and aggravate) */
#define PWR_SHRIEK		     13

/** @def PWR_ILLUMINE
 * @note Lite area */
#define PWR_ILLUMINE		   14

/** @def PWR_DET_CURSE
 * @note Detect cursed items in inventory */
#define PWR_DET_CURSE		  15

/** @def PWR_BERSERK
 * @note Berserk rage */
#define PWR_BERSERK		    16

/** @def PWR_POLYMORPH
 * @note Polymorph self */
#define PWR_POLYMORPH		  17

/** @def PWR_MIDAS_TCH
 * @note Midas touch - turn an item into gold */
#define PWR_MIDAS_TCH		  18

/** @def PWR_GROW_MOLD
 * @note Summon mold */
#define PWR_GROW_MOLD		  19

/** @def PWR_RESIST
 * @note Temporary elemental resist */
#define PWR_RESIST		     20

/** @def PWR_EARTHQUAKE
 * @note Cause an earthquake (destruction) */
#define PWR_EARTHQUAKE		 21

/** @def PWR_EAT_MAGIC
 * @note Absorb energy from magic items */
#define PWR_EAT_MAGIC		  22

/** @def PWR_WEIGH_MAG
 * @note Report magic affecting player */
#define PWR_WEIGH_MAG		  23

/** @def PWR_STERILITY
 * @note Player experiences forced abstinence */
#define PWR_STERILITY		  24

/** @def PWR_PANIC_HIT
 * @note Hit a monster and run away */
#define PWR_PANIC_HIT		  25

/** @def PWR_DAZZLE
 * @note Stun, confuse, and turn monsters */
#define PWR_DAZZLE		     26

/** @def PWR_DARKRAY
 * @note Fire a beam of light (GF_LITE) */
#define PWR_DARKRAY		    27

/** @def PWR_RECALL
 * @note Recall to dungeon/town */
#define PWR_RECALL		     28

/** @def PWR_BANISH
 * @note Banish evil creatures */
#define PWR_BANISH		     29

/** @def PWR_COLD_TOUCH
 * @note Bolt of cold (GF_COLD) */
#define PWR_COLD_TOUCH		 30

/** @def PWR_LAUNCHER
 * @note Increase the multiplier for a thrown object */
#define PWR_LAUNCHER		   31

/** @def PWR_PASSWALL
 * @note Walk through a wall */
#define PWR_PASSWALL		    32

/** @def PWR_DETECT_TD
 * @note Detect traps, doors, and stairs */
#define PWR_DETECT_TD		   33

/** @def PWR_COOK_FOOD
 * @note Create some food */
#define PWR_COOK_FOOD		   34

/** @def PWR_UNFEAR
 * @note Remove fear */
#define PWR_UNFEAR		      35

/** @def PWR_EXPL_RUNE
 * @note Set an explosive rune */
#define PWR_EXPL_RUNE		   36

/** @def PWR_STM
 * @note Bash a wall (stone to mud) */
#define PWR_STM			 37

/** @def PWR_POIS_DART
 * @note Throw a poison dart (GF_POIS) */
#define PWR_POIS_DART		   38

/** @def PWR_MAGIC_MISSILE
 * @note Fire a magic missile (GF_MISSILE) */
#define PWR_MAGIC_MISSILE	       39

/** @def PWR_GROW_TREE
 * @note Grow trees around the player */
#define PWR_GROW_TREE		   40

/** @def PWR_BR_COLD
 * @note Breathe cold (GF_COLD) */
#define PWR_BR_COLD		     41

/** @def PWR_BR_CHAOS
 * @note Breathe chaos (GF_CHAOS) */
#define PWR_BR_CHAOS		    42

/** @def PWR_BR_ELEM
 * @note Breath elements (GF_MISSILE) */
#define PWR_BR_ELEM		     43

/** @def PWR_WRECK_WORLD
 * @note Change the world (new level) */
#define PWR_WRECK_WORLD		 44

/** @def PWR_SCARE
 * @note Howl to scare monsters */
#define PWR_SCARE		       45

/** @def PWR_REST_LIFE
 * @note Restore life levels */
#define PWR_REST_LIFE		   46

/** @def PWR_SUMMON_MONSTER
 * @note Beastmaster powers (summon pets) */
#define PWR_SUMMON_MONSTER	      47

/** @def PWR_NECRO
 * @note Cast a necromancy spell */
#define PWR_NECRO		       48

/** @def PWR_ROHAN
 * @note Use flash aura or light speed jump */
#define PWR_ROHAN		       49

/** @def PWR_THUNDER
 * @note Use thunder strike, ride the straight road, or go back in town */
#define PWR_THUNDER		     50

/** @def PWR_DEATHMOLD
 * @note Use deathmold powers:\n
 * (a) Teleport to a specific place\n
 * (b) Fetch an item\n
 * (c) Go up 50'\n
 * (d) Go down 50'
 */
#define PWR_DEATHMOLD		   51

/** @def PWR_HYPNO
 * @note Hypnotise a pet */
#define PWR_HYPNO		       52

/** @def PWR_UNHYPNO
 * @note Unhypnotise a pet */
#define PWR_UNHYPNO		     53

/** @def PWR_INCARNATE
 * @note Incarnate into a body */
#define PWR_INCARNATE		   54

/** @def PWR_MAGIC_MAP
 * @note Magic mapping */
#define PWR_MAGIC_MAP		   55

/** @def PWR_LAY_TRAP
 * @note Set a trap */
#define PWR_LAY_TRAP		    56

/** @def PWR_MERCHANT
 * @note Appraise item, warp item, or identify item */
#define PWR_MERCHANT		    57

/** @def PWR_COMPANION
 * @note Create a companion */
#define PWR_COMPANION		   58

/** @def PWR_BEAR
 * @note Mimic a bear */
#define PWR_BEAR			59

/** @def PWR_DODGE
 * @note Report chance of dodging a monster */
#define PWR_DODGE		       60

/** @def PWR_BALROG
 * @note Mimic a balrog */
#define PWR_BALROG		      61
/** @} */

/* Misc */
/** @fn do_cmd_throw(void)
 * @brief Throw an object from the pack or floor.
 * @note
 * Note: "unseen" monsters are very hard to hit.
 * @note
 * Should throwing a weapon do full damage?  Should it allow the magic
 * to hit bonus of the weapon to have an effect?  Should it ever cause
 * the item to be destroyed?  Should it do any damage at all?
 * @note (see file cmd2.c)
 */
extern void do_cmd_throw(void);

/** @fn change_wild_mode()
 * @brief Toggle between big map and little map.
 * @note
 * If the player is immovable, and the map is big, the player receives a
 * warning and is allowed to proceed.
 * @note
 * If the player is about to be recalled, and the map is big, the map is
 * not changed.
 * @note
 * The map is changed. The game is saved if autosave is set to "levels".
 * @note (see file spells2.c)
 */
extern void change_wild_mode();

/** @fn switch_class(int sclass)
 * @brief Change to an other class.\n
 * @param sclass Number \n the inex of the new class in the class array
 * @brief Class index
 * @note (see file xtra2.c)
 */
extern void switch_class(int sclass);

/** @fn switch_subclass(int sclass)
 * @brief Change to an other subclass.\n
 * @param sclass Number \n the new subclass
 * @brief Subclass
 * @note (see file xtra2.c)
 */
extern void switch_subclass(int sclass);

/** @fn switch_subrace(int racem, bool copy_old)
 * @brief Change to an other subrace.\n
 * @param racem Number \n index of subrace in subrace array
 * @brief Subrace index
 * @param copy_old Boolean \n TRUE if the new subrace is to be saved,
 * otherwise FALSE.
 * @brief Copy old subrace?
 * @note (see file xtra2.c)
 */
extern void switch_subrace(int racem, bool copy_old);

/** @fn get_subrace_title(int racem)
 * @brief Return the subrace title.\n
 * @param racem Number \n index of subrace in subrace array
 * @brief Subrace index
 * @return String \n Title of subrace.
 * @note (see file xtra2.c)
 */
extern cptr get_subrace_title(int racem);

/** @fn set_subrace_title(int racem, cptr name)
 * @brief Set the subrace title.\n
 * @param racem Number \n index of subrace in subrace array
 * @brief Subrace index
 * @param name String \n new title of subrace
 * @brief New title
 * @note (see file xtra2.c)
 */
extern void set_subrace_title(int racem, cptr name);

/** @fn do_rebirth()
 * @brief The player is reborn after a class, race, or subrace change.
 * @note
 * The experience factor is recalculated. The hit dice are reset and new HP
 * are calculated. There may be a level change involved.
 * @note (see file xtra2.c)
 */
extern void do_rebirth();

/* Player race flags */
$static bool lua_test_race_flags(int slot, u32b flags) { if (slot == 1) return (PRACE_FLAG(flags)) ? TRUE : FALSE; else return (PRACE_FLAG2(flags)) ? TRUE : FALSE; }
/** @fn test_race_flags(int slot, u32b flags);
 * @brief Test flag "flags" against race flags, race modifier flags, class
 * flags, and specialist flags.\n
 * @param slot Number \n 1 if testing against first set of flags (PRACE_FLAG),
 * 2 if testing against second set of flags (PRACE_FLAG2)
 * @brief Flag selecter.
 * @param flags Number \n the flags to be tested
 * @brief Test flags
 * @return Boolean \n TRUE if test flags match any of the corresponding race,
 * race modifier, class, and specialist flags.
 * @note (see file w_player.c)
 */
static bool lua_test_race_flags@test_race_flags(int slot, u32b flags);

/** @name Winner states
 * @{ */
/** @def WINNER_NORMAL
 * @note Player has killed Morgoth */
#define WINNER_NORMAL	   1

/** @def WINNER_ULTRA
 * @note Player has killed Melkor */
#define WINNER_ULTRA	    2
/** @} */

/** @var wizard
 * @brief Boolean
 * @note TRUE if player currently in Wizard mode, otherwise FALSE.
 */
extern bool wizard;

/** @var total_winner
 * @brief Number
 * @note Game has been won (see WINNER_foo fields).
 */
extern u16b total_winner;

/** @var has_won
 * @brief Number
 * @note Game has been won (see WINNER_foo fields).
 */
extern u16b has_won;

/** @var joke_monsters
 * @brief Boolean
 * @note TRUE if allowing joke monsters, otherwise FALSE.
 */
extern bool joke_monsters;

extern s16b max_dlv[999999];