summaryrefslogtreecommitdiff
path: root/lib/mods/theme/help/lua_spel.txt
blob: aa4a532b8c026642e18133b5e3cadadec988c00e (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
|||||oy

#####R             /----------------------------------------\
#####R            <      spell.pkg functions helper file     >
#####R             \----------------------------------------/

----------------------------------------------------------------------

#####R=== teleport_player_directed ===

#####GDeclaration
    extern void teleport_player_directed(int rad, int dir);

#####GFile
    spells1.c

#####GComment
/*
 * Teleport player, using a distance and a direction as a rough guide.
 *
 * This function is not at all obsessive about correctness.
 * This function allows teleporting into vaults (!)
 */

#####GDescription
Teleport a player up to "rad" grids away roughly in "dir" direction.

#####GParameters
> "rad" must not exceed 200. The distance teleported is a minimum of a
  quarter of "rad".
> "dir" must be from 0 to 9.
  *****fields.txt*0[direction]

----------------------------------------------------------------------

#####R=== teleport_away ===

#####GDeclaration
    extern void teleport_away(int m_idx, int dis);

#####GFile
    spells1.c

#####GComment
/*
 * Teleport a monster, normally up to "dis" grids away.
 *
 * Attempt to move the monster at least "dis/2" grids away.
 *
 * But allow variation to prevent infinite loops.
 */

#####GDescription
Teleport monster indicated by "m_idx" up to "dis" grids away.

#####GParameters
> "m_idx" is the index of the monster in m_list[].
> "dis" must not exceed 200. The distance teleported is a minimum of a
  quarter of "dis".

----------------------------------------------------------------------

#####R=== teleport_player ===

#####GDeclaration
    extern void teleport_player(int dis);

#####GFile
    spells1.c

#####GComment
/*
 * Teleport the player to a location up to "dis" grids away.
 *
 * If no such spaces are readily available, the distance may increase.
 * Try very hard to move the player at least a quarter that distance.
 */

#####GDescription
Teleport player up to "dis" grids away.

#####GParameters
> "dis" must not exceed 200. The distance teleported is a minimum of a
  quarter of "dis".

----------------------------------------------------------------------

#####R=== teleport_player_to ===

#####GDeclaration
    extern void teleport_player_to(int ny, int nx);

#####GFile
    spells1.c

#####GComment
/*
 * Teleport player to a grid near the given location
 *
 * This function is slightly obsessive about correctness.
 * This function allows teleporting into vaults (!)
 */

#####GDescription
Teleport player to a grid near the given location ("ny", "nx"). If
the location is empty, the player goes there, otherwise they go to
a grid as close as possible to the location.

#####GParameters
> "ny" is the y co-ordinate of the location.
> "nx" is the x co-ordinate of the location.

----------------------------------------------------------------------

#####R=== teleport_monster_to ===

#####GDeclaration
    extern void teleport_monster_to(int m_idx, int ny,
        int nx);

#####GFile
    spells1.c

#####GComment
/*
 * Teleport a monster to a grid near the given location
 *
 * This function is slightly obsessive about correctness.
 */

#####GDescription
Teleport monster indicated by "m_idx" to a grid near the given
location ("ny", "nx"). If the location is empty, the monster goes
there, otherwise they go to a grid as close as possible to the
location.

#####GParameters
> "m_idx" is the index of the monster in m_list[].
> "ny" is the y co-ordinate of the location.
> "nx" is the x co-ordinate of the location.

----------------------------------------------------------------------

#####R=== teleport_player_level ===

#####GDeclaration
    extern void teleport_player_level(void);

#####GFile
    spells1.c

#####GComment
/*
 * Teleport the player one level up or down (random when legal)
 */

#####GDescription
Teleport the player one level up or down at random.

----------------------------------------------------------------------

#####R=== recall_player ===

#####GDeclaration
    extern void recall_player(void);

#####GFile
    spells1.c

#####GComment
/*
 * Recall the player to town or dungeon
 */

#####GDescription
Recall the player to town (if in dungeon) or dungeon (if in town).

----------------------------------------------------------------------

#####R=== take_hit ===

#####GDeclaration
    extern void take_hit(int damage, cptr kb_str);

#####GFile
    spells1.c

#####GComment
/*
 * Decreases players hit points and sets death flag if necessary
 *
 * XXX XXX XXX Invulnerability needs to be changed into a "shield"
 *
 * XXX XXX XXX Hack -- this function allows the user to save (or quit)
 * the game when he dies, since the "You die." message is shown before
 * setting the player to "dead".
 */

#####GDescription
Reduce the player's current hit points by "damage" points. If the
player dies, "kb_str" is used to record what the player was killed by
(see high-score table).

#####GParameters
> "damage" is the amount of damage.
> "kb_str" is a string describing what killed the player.

----------------------------------------------------------------------

#####R=== take_sanity_hit ===

#####GDeclaration
    extern void take_sanity_hit(int damage, cptr hit_from);

#####GFile
    spells1.c

#####GComment
/* Decrease player's sanity. This is a copy of the function above. */

#####GDescription
Reduce the player's current sanity points by "damage" points. If the
player dies, "hit_from" is used to record what the player was killed
by (see high-score table).

#####GParameters
> "damage" is the amount of damage.
> "hit_from" is a string describing what killed the player.

----------------------------------------------------------------------

#####R=== project ===

#####GDeclaration
    extern bool project(int who, int rad, int y, int x,
        int dam, int typ, int flg);

#####GFile
    spells1.c

#####GComment
/*
 * Generic "beam"/"bolt"/"ball" projection routine.
 *
 * Input:
 *   who: Index of "source" monster (negative for "player")
 *        jk -- -2 for traps, only used with project_jump
 *   rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
 *   y,x: Target location (or location to travel "towards")
 *   dam: Base damage roll to apply to affected monsters (or player)
 *   typ: Type of damage to apply to monsters (and objects)
 *   flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
 *
 * Return:
 *   TRUE if any "effects" of the projection were observed, else FALSE
 *
 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
 * towards a given location (optionally passing over the heads of interposing
 * monsters), and have it do a given amount of damage to the monsters (and
 * optionally objects) within the given radius of the final location.
 *
 * A "bolt" travels from source to target and affects only the target grid.
 * A "beam" travels from source to target, affecting all grids passed through.
 * A "ball" travels from source to the target, exploding at the target, and
 *   affecting everything within the given radius of the target location.
 *
 * Traditionally, a "bolt" does not affect anything on the ground, and does
 * not pass over the heads of interposing monsters, much like a traditional
 * missile, and will "stop" abruptly at the "target" even if no monster is
 * positioned there, while a "ball", on the other hand, passes over the heads
 * of monsters between the source and target, and affects everything except
 * the source monster which lies within the final radius, while a "beam"
 * affects every monster between the source and target, except for the casting
 * monster (or player), and rarely affects things on the ground.
 *
 * Two special flags allow us to use this function in special ways, the
 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
 * actually projecting from the source monster (or player).
 *
 * The player will only get "experience" for monsters killed by himself
 * Unique monsters can only be destroyed by attacks from the player
 *
 * Only 256 grids can be affected per projection, limiting the effective
 * "radius" of standard ball attacks to nine units (diameter nineteen).
 *
 * One can project in a given "direction" by combining PROJECT_THRU with small
 * offsets to the initial location (see "line_spell()"), or by calculating
 * "virtual targets" far away from the player.
 *
 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
 * continuing until it actually hits something (useful for "stone to mud").
 *
 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
 *
 * Balls must explode BEFORE hitting walls, or they would affect monsters
 * on both sides of a wall.  Some bug reports indicate that this is still
 * happening in 2.7.8 for Windows, though it appears to be impossible.
 *
 * We "pre-calculate" the blast area only in part for efficiency.
 * More importantly, this lets us do "explosions" from the "inside" out.
 * This results in a more logical distribution of "blast" treasure.
 * It also produces a better (in my opinion) animation of the explosion.
 * It could be (but is not) used to have the treasure dropped by monsters
 * in the middle of the explosion fall "outwards", and then be damaged by
 * the blast as it spreads outwards towards the treasure drop location.
 *
 * Walls and doors are included in the blast area, so that they can be
 * "burned" or "melted" in later versions.
 *
 * This algorithm is intended to maximise simplicity, not necessarily
 * efficiency, since this function is not a bottleneck in the code.
 *
 * We apply the blast effect from ground zero outwards, in several passes,
 * first affecting features, then objects, then monsters, then the player.
 * This allows walls to be removed before checking the object or monster
 * in the wall, and protects objects which are dropped by monsters killed
 * in the blast, and allows the player to see all affects before he is
 * killed or teleported away.  The semantics of this method are open to
 * various interpretations, but they seem to work well in practice.
 *
 * We process the blast area from ground-zero outwards to allow for better
 * distribution of treasure dropped by monsters, and because it provides a
 * pleasing visual effect at low cost.
 *
 * Note that the damage done by "ball" explosions decreases with distance.
 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
 *
 * Notice the "napalm" effect of "beam" weapons.  First they "project" to
 * the target, and then the damage "flows" along this beam of destruction.
 * The damage at every grid is the same as at the "centre" of a "ball"
 * explosion, since the "beam" grids are treated as if they ARE at the
 * centre of a "ball" explosion.
 *
 * Currently, specifying "beam" plus "ball" means that locations which are
 * covered by the initial "beam", and also covered by the final "ball", except
 * for the final grid (the epicentre of the ball), will be "hit twice", once
 * by the initial beam, and once by the exploding ball.  For the grid right
 * next to the epicentre, this results in 150% damage being done.  The centre
 * does not have this problem, for the same reason the final grid in a "beam"
 * plus "bolt" does not -- it is explicitly removed.  Simply removing "beam"
 * grids which are covered by the "ball" will NOT work, as then they will
 * receive LESS damage than they should.  Do not combine "beam" with "ball".
 *
 * The array "gy[],gx[]" with current size "grids" is used to hold the
 * collected locations of all grids in the "blast area" plus "beam path".
 *
 * Note the rather complex usage of the "gm[]" array.  First, gm[0] is always
 * zero.  Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
 * first blast grid (see above) with radius "N" from the blast centre.  Note
 * that only the first gm[1] grids in the blast area thus take full damage.
 * Also, note that gm[rad+1] is always equal to "grids", which is the total
 * number of blast grids.
 *
 * Note that once the projection is complete, (y2,x2) holds the final location
 * of bolts/beams, and the "epicentre" of balls.
 *
 * Note also that "rad" specifies the "inclusive" radius of projection blast,
 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
 * implementation of the "distance" function.  Also, a bolt can be properly
 * viewed as a "ball" with a "rad" of "zero".
 *
 * Note that if no "target" is reached before the beam/bolt/ball travels the
 * maximum distance allowed (MAX_RANGE), no "blast" will be induced.  This
 * may be relevant even for bolts, since they have a "1x1" mini-blast.
 *
 * Note that for consistency, we "pretend" that the bolt actually takes "time"
 * to move from point A to point B, even if the player cannot see part of the
 * projection path.  Note that in general, the player will *always* see part
 * of the path, since it either starts at the player or ends on the player.
 *
 * Hack -- we assume that every "projection" is "self-illuminating".
 *
 * Hack -- when only a single monster is affected, we automatically track
 * (and recall) that monster, unless "PROJECT_JUMP" is used.
 *
 * Note that all projections now "explode" at their final destination, even
 * if they were being projected at a more distant destination.  This means
 * that "ball" spells will *always* explode.
 *
 * Note that we must call "handle_stuff()" after affecting terrain features
 * in the blast radius, in case the "illumination" of the grid was changed,
 * and "update_view()" and "update_monsters()" need to be called.
 */

#####GDescription
Generate a beam/bolt/ball starting from "who" with a radius of "rad"
at target grid "y,x" for "damage" points of "typ" damage. The beam/
bolt/ball can have various properties as denoted by "flg".

#####GParameters
> "who" is > 0 (index of monster in m_list[]), < 0 and
  not -100 or -101 (player), -100 or -101 (trap).
> "rad" is 0 for a beam/bolt and 1-9 for a ball.
> "y" is the y co-ordinate of the target grid.
> "x" is the x co-ordinate of the target grid.
> "dam" is the number of points of damage.
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "flg" is the projection effect
  *****fields.txt*0[PROJECT_fields]

----------------------------------------------------------------------

#####R=== corrupt_player ===

#####GDeclaration
    extern void corrupt_player(void);

#####GFile
    spells1.c

#####GComment
(none)

#####GDescription
Swap two of the players stats at random.

----------------------------------------------------------------------

#####R=== grow_trees ===

#####GDeclaration
    extern void grow_trees(int rad);

#####GFile
    spells2.c

#####GComment
/*
 * Grow trees
 */

#####GDescription
Grow up to (("rad" x "rad") + 11) trees around the player.

#####GParameters
> "rad" is the radius of the area where trees may grow.

----------------------------------------------------------------------

#####R=== hp_player ===

#####GDeclaration
    extern bool hp_player(int num);

#####GFile
    spells2.c

#####GComment
/*
 * Increase players hit points, notice effects
 */

#####GDescription
Add "num" points to the player's current hit points. The total can
not exceed the maximum.

#####GParameters
> "num" is the number of points to add.

----------------------------------------------------------------------

#####R=== heal_insanity ===

#####GDeclaration
    extern bool heal_insanity(int val);

#####GFile
    spells2.c

#####GComment
/* Heal insanity. */

#####GDescription
Add "val" points to the player's current sanity points. The total can
not exceed the maximum.

#####GParameters
> "val" is the number of points to add.

----------------------------------------------------------------------

#####R=== warding_glyph ===

#####GDeclaration
    extern void warding_glyph(void);

#####GFile
    spells2.c

#####GComment
/*
 * Leave a "glyph of warding" which prevents monster movement
 */

#####GDescription
Place a glyph at the player's location. The location must be bare.

----------------------------------------------------------------------

#####R=== explosive_rune ===

#####GDeclaration
    extern void explosive_rune(void);

#####GFile
    spells2.c

#####GComment
(none)

#####GDescription
Place a minor glyph (explosive rune) at the player's location. The
location must be bare.

----------------------------------------------------------------------

#####R=== do_dec_stat ===

#####GDeclaration
    extern bool do_dec_stat(int stat, int mode);

#####GFile
    spells2.c

#####GComment
/*
 * Lose a "point"
 */

#####GDescription
Attempt to reduce the player's "stat" statistic by a point.

#####GParameters
> "stat" is the statistic
  *****fields.txt*0[A_fields]
> "mode" is the type of decrease: temporary, normal, or permanent
  *****fields.txt*0[STAT_DEC_fields]

----------------------------------------------------------------------

#####R=== do_res_stat ===

#####GDeclaration
    extern bool do_res_stat(int stat);

#####GFile
    spells2.c

#####GComment
/*
 * Restore lost "points" in a stat
 */

#####GDescription
Restore the player's "stat" statistic.

#####GParameters
> "stat" is the statistic
  *****fields.txt*0[A_fields]

----------------------------------------------------------------------

#####R=== do_inc_stat ===

#####GDeclaration
    extern bool do_inc_stat(int stat);

#####GFile
    spells2.c

#####GComment
/*
 * Gain a "point" in a stat
 */

#####GDescription
Increase the player's "stat" statistic by a point.

#####GParameters
> "stat" is the statistic
  *****fields.txt*0[A_fields]

----------------------------------------------------------------------

#####R=== identify_pack ===

#####GDeclaration
    extern void identify_pack(void);

#####GFile
    spells2.c

#####GComment
/*
 * Identify everything being carried.
 * Done by a potion of "self knowledge".
 */

#####GDescription
Identify all items in the inventory.

----------------------------------------------------------------------

#####R=== remove_curse ===

#####GDeclaration
    extern bool remove_curse(void);

#####GFile
    spells2.c

#####GComment
/*
 * Remove most curses
 */

#####GDescription
Remove all curses except for heavy curses.

----------------------------------------------------------------------

#####R=== remove_all_curse ===

#####GDeclaration
    extern bool remove_all_curse(void);

#####GFile
    spells2.c

#####GComment
/*
 * Remove all curses
 */

#####GDescription
Remove all curses including heavy curses.

----------------------------------------------------------------------

#####R=== restore_level ===

#####GDeclaration
    extern bool restore_level(void);

#####GFile
    spells2.c

#####GComment
/*
 * Restores any drained experience
 */

#####GDescription
Restore all drained experience points (if any).

----------------------------------------------------------------------

#####R=== self_knowledge ===

#####GDeclaration
    extern void self_knowledge(FILE *fff);

#####GFile
    spells2.c

#####GComment
/*
 * self-knowledge... idea from nethack.  Useful for determining powers and
 * resistances of items.  It saves the screen, clears it, then starts listing
 * attributes, a screenful at a time.  (There are a LOT of attributes to
 * list.  It will probably take 2 or 3 screens for a powerful character whose
 * using several artifacts...) -CFT
 *
 * It is now a lot more efficient. -BEN-
 *
 * See also "identify_fully()".
 *
 * XXX XXX XXX Use the "show_file()" method, perhaps.
 */

#####GDescription
Show all attributes including racial powers, mutations, and equipment
effects.

#####GParameters
> "*ffff" points to a file (write info to file) or is NULL (write info
  to screen).

----------------------------------------------------------------------

#####R=== lose_all_info ===

#####GDeclaration
    extern bool lose_all_info(void);

#####GFile
    spells2.c

#####GComment
/*
 * Forget everything
 */

#####GDescription
Forget about objects and the map.

----------------------------------------------------------------------

#####R=== detect_traps ===

#####GDeclaration
    extern bool detect_traps(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all traps on current panel
 */

#####GDescription
Detect all traps on current panel.

----------------------------------------------------------------------

#####R=== detect_doors ===

#####GDeclaration
    extern bool detect_doors(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all doors on current panel
 */

#####GDescription
Detect all doors on current panel.

----------------------------------------------------------------------

#####R=== detect_stairs ===

#####GDeclaration
    extern bool detect_stairs(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all stairs on current panel
 */

#####GDescription
Detect all stairs on current panel.

----------------------------------------------------------------------

#####R=== detect_treasure ===

#####GDeclaration
    extern bool detect_treasure(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect any treasure on the current panel
 */

#####GDescription
Detect any treasure on the current panel.

----------------------------------------------------------------------

Field: hack_no_detect_message
Value: FALSE

----------------------------------------------------------------------

#####R=== detect_objects_gold ===

#####GDeclaration
    extern bool detect_objects_gold(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all "gold" objects on the current panel
 */

#####GDescription
Detect all objects with the TV_GOLD flag.

----------------------------------------------------------------------

#####R=== detect_objects_normal ===

#####GDeclaration
    extern bool detect_objects_normal(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all "normal" objects on the current panel
 */

#####GDescription
Detect all objects without the TV_GOLD flag.

----------------------------------------------------------------------

#####R=== detect_objects_magic ===

#####GDeclaration
    extern bool detect_objects_magic(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all "magic" objects on the current panel.
 *
 * This will light up all spaces with "magic" items, including artifacts,
 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
 * and "enchanted" items of the "good" variety.
 *
 * It can probably be argued that this function is now too powerful.
 */

#####GDescription
Detect all "magic" objects which are artefacts, ego items, or have one
of the following flags - TV_AMULET, TV_RING, TV_BATERIE, TV_STAFF,
TV_WAND, TV_ROD, TV_ROD_MAIN, TV_SCROLL, TV_POTION, TV_POTION2,
TV_VALARIN_BOOK, TV_MAGERY_BOOK, TV_SHADOW_BOOK, TV_CHAOS_BOOK,
TV_SPIRIT_BOOK, TV_NETHER_BOOK, TV_DAEMON_BOOK, TV_CRUSADE_BOOK,
TV_SIGALDRY_BOOK, TV_SYMBIOTIC_BOOK, TV_MUSIC_BOOK.

----------------------------------------------------------------------

#####R=== detect_monsters_normal ===

#####GDeclaration
    extern bool detect_monsters_normal(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all "normal" monsters on the current panel
 */

#####GDescription
Detect all non-invisible monsters (without RF2_INVISIBLE).

----------------------------------------------------------------------

#####R=== detect_monsters_invis ===

#####GDeclaration
    extern bool detect_monsters_invis(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all "invisible" monsters on current panel
 */

#####GDescription
Detect all invisible monsters (with RF2_INVISIBLE).

----------------------------------------------------------------------

#####R=== detect_monsters_evil ===

#####GDeclaration
    extern bool detect_monsters_evil(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all "evil" monsters on current panel
 */

#####GDescription
Detect all evil monsters (with RF3_EVIL).

----------------------------------------------------------------------

#####R=== detect_monsters_good ===

#####GDeclaration
    extern bool detect_monsters_good(void);

#####GFile
    spells2.c

#####GComment
/* Detect good monsters */

#####GDescription
Detect all good monsters (with RF3_GOOD).

----------------------------------------------------------------------

#####R=== detect_monsters_xxx ===

#####GDeclaration
    extern bool detect_monsters_xxx(u32b match_flag);

#####GFile
    spells2.c

#####GComment
/*
 * A "generic" detect monsters routine, tagged to flags3
 */

#####GDescription
Detect all monsters with "match_flag" flag.

#####GParameters
> "match_flag" can be any RF3_ flag (see defines.h) but only
  RF3_DEMON, RF3_UNDEAD, RF3_GOOD work.

----------------------------------------------------------------------

#####R=== detect_monsters_string ===

#####GDeclaration
    extern bool detect_monsters_string(cptr);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all (string) monsters on current panel
 */

#####GDescription
Detect all monsters whose default monster character matches a
character pointed to by "cptr".

#####GParameters
> "cptr" is a pointer to a single character, eg 'Z' for hounds. For
  available characters, see the "symbol" field of the graphics (G)
  line of r_info.txt.

----------------------------------------------------------------------

#####R=== detect_monsters_nonliving ===

#####GDeclaration
    extern bool detect_monsters_nonliving(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect all "nonliving", "undead" or "demonic" monsters on current panel
 */

#####GDescription
Detect all non-living monsters (with RF3_NONLIVING, RF3_UNDEAD, or
RF3_DEMON).

----------------------------------------------------------------------

#####R=== detect_all ===

#####GDeclaration
    extern bool detect_all(void);

#####GFile
    spells2.c

#####GComment
/*
 * Detect everything
 */

#####GDescription
Detects traps, doors, stairs, treasure, gold objects, normal objects,
invisible monsters, normal (visible) monsters.

----------------------------------------------------------------------

#####R=== stair_creation ===

#####GDeclaration
    extern void stair_creation(void);

#####GFile
    spells2.c

#####GComment
/*
 * Create stairs at the player location
 */

#####GDescription
Create stairs at the player location. This is not allowed if the grid
is not empty, the player is not in a dungeon, the player is on a
special level, the player is in an arena or quest. If the player is
in the town or wilderness the stairs will go down. If the player is
on a quest level or at the bottom of a dungeon, the stairs will go up.
Otherwise there is an even chance the stairs will go up or down.

----------------------------------------------------------------------

#####R=== wall_stone ===

#####GDeclaration
    extern bool wall_stone(void);

#####GFile
    spells2.c

#####GComment
(none)

#####GDescription
Create a stone wall on the player's grid. This function uses the
project() function to create the stone wall. Apparently zero can be
used as the "who" parameter for the player. See details for the
project() function elsewhere in this document.

----------------------------------------------------------------------

#####R=== create_artifact ===

#####GDeclaration
    extern bool create_artifact(object_type *o_ptr,
        bool a_scroll, bool get_name);

#####GFile
    randart.c

#####GComment
(none)

#####GDescription
Create an artifact from object "*optr".

#####GParameters
> "*optr* is a pointer to an object
> "a_scroll" is true if the artifact is created by reading a scroll
> "get_name" is true if the artifact is to be named by the player (if
  a_scroll is true) or created randomly (a_scroll is false), or false
  if an inscription is used.

----------------------------------------------------------------------

#####R=== ident_spell ===

#####GDeclaration
    extern bool ident_spell(void);

#####GFile
    spells2.c

#####GComment
/*
 * Identify an object in the inventory (or on the floor)
 * This routine does *not* automatically combine objects.
 * Returns TRUE if something was identified, else FALSE.
 */

#####GDescription
Identify an object in the inventory (or on the floor).

----------------------------------------------------------------------

#####R=== identify_fully ===

#####GDeclaration
    extern bool identify_fully(void);

#####GFile
    spells2.c

#####GComment
/*
 * Fully "identify" an object in the inventory  -BEN-
 * This routine returns TRUE if an item was identified.
 */

#####GDescription
Fully "identify" an object in the inventory (or on the floor).

----------------------------------------------------------------------

#####R=== recharge ===

#####GDeclaration
    extern bool recharge(int num);

#####GFile
    spells2.c

#####GComment
/*
 * Recharge a wand/staff/rod from the pack or on the floor.
 * This function has been rewritten in Oangband. -LM-
 *
 * Mage -- Recharge I --> recharge(90)
 * Mage -- Recharge II --> recharge(150)
 * Mage -- Recharge III --> recharge(220)
 *
 * Priest or Necromancer -- Recharge --> recharge(140)
 *
 * Scroll of recharging --> recharge(130)
 * Scroll of *recharging* --> recharge(200)
 *
 * It is harder to recharge high level, and highly charged wands,
 * staffs, and rods.  The more wands in a stack, the more easily and
 * strongly they recharge.  Staffs, however, each get fewer charges if
 * stacked.
 *
 * XXX XXX XXX Beware of "sliding index errors".
 */

#####GDescription
Recharge an object in the inventory (or on the floor) with "num"
power.

#####GParameters
> "num" is the power used in recharging. It is compared to the
  object's level to determine whether the item is recharged
  successfully or destroyed. If it is recharged, it also determines
  how many charges are added, or how much recharge time is reduced.

----------------------------------------------------------------------

#####R=== aggravate_monsters ===

#####GDeclaration
    extern void aggravate_monsters(int who);

#####GFile
    spells2.c

#####GComment
/*
 * Wake up all monsters, and speed up "los" monsters.
 */

#####GDescription
Aggravate monsters, originating from "who".

#####GParameters
> "who" is the index of monster in m_list[] (1 if it is the player)
  which triggers the aggravation;

----------------------------------------------------------------------

#####R=== genocide ===

#####GDeclaration
    extern bool genocide(bool player_cast);

#####GFile
    spells2.c

#####GComment
(none)

#####GDescription
Genocide a monster race.

#####GParameters
> "player_cast" is true if the player cast the spell so the player can
  take damage.

----------------------------------------------------------------------

#####R=== mass_genocide ===

#####GDeclaration
    extern bool mass_genocide(bool player_cast);

#####GFile
    spells2.c

#####GComment
/*
 * Delete all nearby (non-unique) monsters
 */

#####GDescription
Delete all nearby (non-unique) monsters.

#####GParameters
> "player_cast" is true if the player cast the spell so the player can
  take damage.

----------------------------------------------------------------------

#####R=== probing ===

#####GDeclaration
    extern bool probing(void);

#####GFile
    spells2.c

#####GComment
/*
 * Probe nearby monsters
 */

#####GDescription
Probe all nearby monsters.

----------------------------------------------------------------------

#####R=== banish_evil ===

#####GDeclaration
    extern bool banish_evil(int dist);

#####GFile
    spells2.c

#####GComment
/*
 * Banish evil monsters
 */

#####GDescription
Banish nearby evil monsters doing "dist" points of GF_AWAY_EVIL
damage.

#####GParameters
> "dist" is the amount of damage done to each monster.

----------------------------------------------------------------------

#####R=== dispel_evil ===

#####GDeclaration
    extern bool dispel_evil(int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Dispel evil monsters
 */

#####GDescription
Dispel nearby evil monsters doing "dam" points of GF_DISP_EVIL
damage.

#####GParameters
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== dispel_good ===

#####GDeclaration
    extern bool dispel_good(int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Dispel good monsters
 */

#####GDescription
Dispel nearby good monsters doing "dam" points of GF_DISP_GOOD
damage.

#####GParameters
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== dispel_undead ===

#####GDeclaration
    extern bool dispel_undead(int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Dispel undead monsters
 */

#####GDescription
Dispel nearby undead monsters doing "dam" points of GF_DISP_UNDEAD
damage.

#####GParameters
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== dispel_monsters ===

#####GDeclaration
    extern bool dispel_monsters(int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Dispel all monsters
 */

#####GDescription
Dispel all nearby monsters doing "dam" points of GF_DISP_ALL
damage.

#####GParameters
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== dispel_living ===

#####GDeclaration
    extern bool dispel_living(int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Dispel 'living' monsters
 */

#####GDescription
Dispel nearby living monsters doing "dam" points of GF_DISP_LIVING
damage.

#####GParameters
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== dispel_demons ===

#####GDeclaration
    extern bool dispel_demons(int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Dispel demons
 */

#####GDescription
Dispel nearby demon monsters doing "dam" points of GF_DISP_DEMON
damage.

#####GParameters
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== turn_undead ===

#####GDeclaration
    extern bool turn_undead(void);

#####GFile
    spells2.c

#####GComment
/*
 * Turn undead
 */

#####GDescription
Turn nearby undead monsters doing a point of GF_TURN_UNDEAD damage for
each player level.

----------------------------------------------------------------------

#####R=== wipe ===

#####GDeclaration
    extern void wipe(int y1, int x1, int r);

#####GFile
    spells2.c

#####GComment
/*
 * Wipe -- Empties a part of the dungeon
 */

#####GDescription
Delete monsters and objects from an area of the dungeon centred at
grid "y1,x1" for a radius "r". This does not work on special levels or
quests. The player may be blinded. The player forgets the affected
area and it becomes dark. All grids become floor.

#####GParameters
> "y1" is the y-coordinate of the wipe's origin.
> "x1" is the x-coordinate of the wipe's origin.
> "r" is the radius of the wipe.

----------------------------------------------------------------------

#####R=== destroy_area ===

#####GDeclaration
    extern void destroy_area(int y1, int x1, int r,
        bool full);

#####GFile
    spells2.c

#####GComment
/*
 * The spell of destruction
 *
 * This spell "deletes" monsters (instead of "killing" them).
 *
 * Later we may use one function for both "destruction" and
 * "earthquake" by using the "full" to select "destruction".
 */

#####GDescription
Delete monsters and objects from an area of the dungeon centred at
grid "y1,x1" for a radius "r". This does not work on special levels or
quests. The epicentre is NOT affected. The player may be blinded. The
player forgets the affected area and it becomes dark. The grids can
become granite, quartz, magma, or floor.

#####GParameters
> "y1" is the y-coordinate of the destruction's origin.
> "x1" is the x-coordinate of the destruction's origin.
> "r" is the radius of the destruction.
> "full" is currently unused.

----------------------------------------------------------------------

#####R=== earthquake ===

#####GDeclaration
    extern void earthquake(int cy, int cx, int r);

#####GFile
    spells2.c

#####GComment
/*
 * Induce an "earthquake" of the given radius at the given location.
 *
 * This will turn some walls into floors and some floors into walls.
 *
 * The player will take damage and "jump" into a safe grid if possible,
 * otherwise, he will "tunnel" through the rubble instantaneously.
 *
 * Monsters will take damage, and "jump" into a safe grid if possible,
 * otherwise they will be "buried" in the rubble, disappearing from
 * the level in the same way that they do when genocided.
 *
 * Note that thus the player and monsters (except eaters of walls and
 * passers through walls) will never occupy the same grid as a wall.
 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
 * for a single turn, unless that monster can pass_walls or kill_walls.
 * This has allowed massive simplification of the "monster" code.
 */

#####GDescription
Create an earthquake centred on grid "cy,cx" with a radius of "r".
This does not work on quest levels. The epicentre is NOT affected.
Only about 15% of the grids are affected. The player takes 300 points
of damage if they can't be moved to a safe grid, otherwise damage is
from 10 to 40 points. The player forgets the affected area and it
becomes dark. The grids can become granite, quartz, magma, or floor.

#####GParameters
Parameters:
> "cy" is the y-coordinate of the earthquake origin.
> "cx" is the x-coordinate of the earthquake origin.
> "r" is the radius of the earthquake.

----------------------------------------------------------------------

#####R=== map_area ===

#####GDeclaration
    extern void map_area(void);

#####GFile
    cave.c

#####GComment
/*
 * Hack -- map the current panel (plus some) ala "magic mapping"
 */

#####GDescription
Map the current panel plus up to 10 grids up and down, and up to 20
grids left and right.

----------------------------------------------------------------------

#####R=== wiz_lite ===

#####GDeclaration
    extern void wiz_lite(void);

#####GFile
    cave.c

#####GComment
/*
 * Light up the dungeon using "clairvoyance"
 *
 * This function "illuminates" every grid in the dungeon, memorises all
 * "objects", memorises all grids as with magic mapping, and, under the
 * standard option settings (view_perma_grids but not view_torch_grids)
 * memorises all floor grids too.
 *
 * Note that if "view_perma_grids" is not set, we do not memorise floor
 * grids, since this would defeat the purpose of "view_perma_grids", not
 * that anyone seems to play without this option.
 *
 * Note that if "view_torch_grids" is set, we do not memorise floor grids,
 * since this would prevent the use of "view_torch_grids" as a method to
 * keep track of what grids have been observed directly.
 */

#####GDescription
Light up the entire dungeon and show all monsters and objects.

----------------------------------------------------------------------

#####R=== wiz_lite_extra ===

#####GDeclaration
    extern void wiz_lite_extra(void);

#####GFile
    cave.c

#####GComment
(none)

#####GDescription
Light up the entire dungeon and show all monsters and objects. All
squares are lit and remembered.

----------------------------------------------------------------------

#####R=== wiz_dark ===

#####GDeclaration
    extern void wiz_dark(void);

#####GFile
    cave.c

#####GComment
/*
 * Forget the dungeon map (ala "Thinking of Maud...").
 */

#####GDescription
Forget all grids and objects. All grids become dark.

----------------------------------------------------------------------

#####R=== lite_room ===

#####GDeclaration
    extern void lite_room(int y1, int x1);

#####GFile
    spells2.c

#####GComment
/*
 * Illuminate any room containing the given location.
 */

#####GDescription
Light up the room (if any) of grid "y1,x1".

#####GParameters
> "y1" is the y-coordinate of the grid.
> "x1" is the x-coordinate of the grid.

----------------------------------------------------------------------

#####R=== unlite_room ===

#####GDeclaration
    extern void unlite_room(int y1, int x1);

#####GFile
    spells2.c

#####GComment
/*
 * Darken all rooms containing the given location
 */

#####GDescription
Darken all rooms (if any) of grid "y1,x1".

#####GParameters
> "y1" is the y-coordinate of the grid.
> "x1" is the x-coordinate of the grid.

----------------------------------------------------------------------

#####R=== lite_area ===

#####GDeclaration
    extern bool lite_area(int dam, int rad);

#####GFile
    spells2.c

#####GComment
/*
 * Hack -- call light around the player
 * Affect all monsters in the projection radius
 */

#####GDescription
Light up the room (if any) of the player's grid. Monsters take "dam"
points of GF_LITE_WEAK damage if they are within "r" grids of the
player.

#####GParameters
> "dam" is the number of points of damage.
> "rad" is the radius of the effect of the damage.

----------------------------------------------------------------------

#####R=== unlite_area ===

#####GDeclaration
    extern bool unlite_area(int dam, int rad);

#####GFile
    spells2.c

#####GComment
/*
 * Hack -- call darkness around the player
 * Affect all monsters in the projection radius
 */

#####GDescription
Darken the room (if any) of the player's grid. Monsters take "dam"
points of GF_DARK_WEAK damage if they are within "r" grids of the
player.

#####GParameters
> "dam" is the number of points of damage.
> "rad" is the radius of the effect of the damage.

----------------------------------------------------------------------

#####R=== fire_ball_beam ===

#####GDeclaration
    extern bool fire_ball_beam(int typ, int dir, int dam,
        int rad);

#####GFile
    spells2.c

#####GComment
/*
 * Cast a ball-beamed spell
 * Stop if we hit a monster, act as a "ball"
 * Allow "target" mode to pass over monsters
 * Affect grids, objects, and monsters
 */

#####GDescription
Cast a ball-beamed spell of type "typ" in direction "dir" for damage
"dam" points with a radius of "rad" grids.

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9.
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.
> "rad" is the radius of the effect of the damage (must be <= 16).

----------------------------------------------------------------------

#####R=== fire_ball ===

#####GDeclaration
    extern bool fire_ball(int typ, int dir, int dam, int rad);

#####GFile
    spells2.c

#####GComment
/*
 * Cast a ball spell
 * Stop if we hit a monster, act as a "ball"
 * Allow "target" mode to pass over monsters
 * Affect grids, objects, and monsters
 */

#####GDescription
Cast a ball spell of type "typ" in direction "dir" for "dam" points of
damage. The ball has a radius of "rad" grids.

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9.
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.
> "rad" is the radius of the effect of the damage (must be <= 16).

----------------------------------------------------------------------

#####R=== fire_bolt ===

#####GDeclaration
    extern bool fire_bolt(int typ, int dir, int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Cast a bolt spell
 * Stop if we hit a monster, as a "bolt"
 * Affect monsters (not grids or objects)
 */

#####GDescription
Cast a bolt spell of type "typ" in direction "dir" for "dam" points of
damage.

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== fire_beam ===

#####GDeclaration
    extern bool fire_beam(int typ, int dir, int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Cast a beam spell
 * Pass through monsters, as a "beam"
 * Affect monsters (not grids or objects)
 */

#####GDescription
Cast a beam spell of type "typ" in direction "dir" for "dam" points of
damage.

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9.
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== fire_druid_ball ===

#####GDeclaration
    extern bool fire_druid_ball(int typ, int dir, int dam,
        int rad);

#####GFile
    spells2.c

#####GComment
/*
 * Cast a druidic ball spell
 * Stop if we hit a monster, act as a "ball"
 * Allow "target" mode to pass over monsters
 * Affect grids, objects, and monsters
 */

#####GDescription
Cast a ball spell of type "typ" in direction "dir" for "dam" points of
damage. The ball has a radius of "rad" grids. The spell follows a mana
path.

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9.
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.
> "rad" is the radius of the effect of the damage (must be <= 16).

----------------------------------------------------------------------

#####R=== fire_druid_bolt ===

#####GDeclaration
    extern bool fire_druid_bolt(int typ, int dir, int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Cast a druidic bolt spell
 * Stop if we hit a monster, as a "bolt"
 * Affect monsters (not grids or objects)
 */

#####GDescription
Cast a bolt spell of type "typ" in direction "dir" for "dam" points of
damage. The spell follows a mana path.

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9.
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== fire_druid_beam ===

#####GDeclaration
    extern bool fire_druid_beam(int typ, int dir, int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Cast a druidistic beam spell
 * Pass through monsters, as a "beam"
 * Affect monsters (not grids or objects)
 */

#####GDescription
Cast a beam spell of type "typ" in direction "dir" for "dam" points of
damage. The spell follows a mana path.

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9.
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== fire_bolt_or_beam ===

#####GDeclaration
    extern bool fire_bolt_or_beam(int prob, int typ, int dir,
        int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Cast a bolt spell, or rarely, a beam spell
 */

#####GDescription
Cast a beam (chance of "prob" in 100) or bolt spell of type "typ" in
direction "dir" for "dam" points of damage.

#####GParameters
> "prob" is the number of times out of 100 that the bolt will actually
  be a beam. Obviously this value should range from 1 to 99 (0 will
  always give a beam, 100 or higher will always give a beam. There are
  separate functions for these cases).
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9.
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.

----------------------------------------------------------------------

#####R=== alchemy ===

#####GDeclaration
    extern bool alchemy(void);

#####GFile
    spells2.c

#####GComment
/* Turns an object into gold, gain some of its value in a shop */

#####GDescription
The player selects an object (and quantity if it applies) from the
inventory or the floor and attempts to turn it into gold. If the
price of the item is < 0 then the player gains nothing (fool's gold),
otherwise the player gets a third of the price in gold. Artifacts are
not affected.

----------------------------------------------------------------------

#####R=== alter_reality ===

#####GDeclaration
    extern void alter_reality(void);

#####GFile
    spells2.c

#####GComment
(none)

#####GDescription
The player leaves the level immediately.

----------------------------------------------------------------------

#####R=== teleport_swap ===

#####GDeclaration
    extern void teleport_swap(int dir);

#####GFile
    spells2.c

#####GComment
(none)

#####GDescription
Player swaps places with target in direction "dir". The target must be
a monster. It will not work if the space-time continuum can not be
disrupted or if the monster resists teleportation.

----------------------------------------------------------------------

#####R=== project_meteor ===

#####GDeclaration
    extern void project_meteor(int radius, int typ, int dam,
        u32b flg);

#####GFile
    spells2.c

#####GComment
/*
 * Apply a "project()" a la meteor shower
 */

#####GDescription
Generate between "rad" and "rad" x 2 ball spells of type "typ" for
"dam" points of damage. The ball can have various properties as
denoted by "flg".

#####GParameters
> "rad" is the minimum number of balls created. "rad" + randint("rad")
  balls are created. Each ball has a radius of 2 grids. Each target
  grid is within 5 grids of the player.
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dam" is the number of points of damage.
> "flg" is the projection effect
  *****fields.txt*0[PROJECT_fields]

----------------------------------------------------------------------

#####R=== passwall ===

#####GDeclaration
    extern bool passwall(int dir, bool safe);

#####GFile
    spells2.c

#####GComment
/*
 * Send the player shooting through walls in the given direction until
 * they reach a non-wall space, or a monster, or a permanent wall.
 */

#####GDescription
Move the player through walls in direction "dir". if "safe" then the
player can not end up in a wall - if they do, the wall is replaced by
a floor. This does not work in the wilderness, on quest levels, or if
teleport is not allowed. Stopping on monsters or inside vaults is not
allowed.

#####GParameters
> "dir" must be from 0 to 9. It can not be 5.
  *****fields.txt*0[direction]
> "safe" must be true if the player is not to be trapped in a wall
  when the movement is finished.

----------------------------------------------------------------------

#####R=== project_hook ===

#####GDeclaration
    extern bool project_hook(int typ, int dir, int dam,
        int flg);

#####GFile
    spells2.c

#####GComment
/*
 * Hack -- apply a "projection()" in a direction (or at the target)
 */

#####GDescription
Generate a beam/bolt of type "typ" in direction "dir" (or at a target)
for "dam" points of damage. The beam/bolt can have various properties
as denoted by "flg".

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dir" must be from 0 to 9. 5 means use the current target.
  *****fields.txt*0[direction]
> "dam" is the number of points of damage.
> "flg" is the projection effect
  *****fields.txt*0[PROJECT_fields]

----------------------------------------------------------------------

#####R=== reset_recall ===

#####GDeclaration
    extern bool reset_recall(void);

#####GFile
    spells2.c

#####GComment
(none)

#####GDescription
Ask the player for a dungeon and appropriate level within the dungeon.
The player can not specify a dungeon they have not gone to yet. If the
player chooses levels 99 or 100, the level is set to 98.

----------------------------------------------------------------------

#####R=== get_aim_dir ===

#####GDeclaration
    extern bool get_aim_dir(int *dp = 0);

#####GFile
    xtra2.c

#####GComment
/*
 * Get an "aiming direction" from the user.
 *
 * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and
 * "0" for "current target", and "-1" for "entry aborted".
 *
 * Note that "Force Target", if set, will pre-empt user interaction,
 * if there is a usable target already set.
 *
 * Note that confusion over-rides any (explicit?) user choice.
 */

#####GDescription
Get an aiming direction from the user and store it in "dp". A target
can be selected. If the player is confused, the direction will be
random.

#####GParameters
> "dp" = player direction.

----------------------------------------------------------------------

#####R=== project_hack ===

#####GDeclaration
    extern bool project_hack(int typ, int dam);

#####GFile
    spells2.c

#####GComment
/*
 * Apply a "project()" directly to all viewable monsters
 *
 * Note that affected monsters are NOT auto-tracked by this usage.
 */

#####GDescription
Generate beam/bolt spells of type "typ" for "dam" points of damage to
all viewable monsters in line of site.

#####GParameters
> "typ" is the type of damage
  *****fields.txt*0[GF_fields]
> "dam" is the number of points of damage.

----------------------------------------------------------------------


Back to the *****lua.hlp*0[lua help index] .

                                                     [[[[[gThis file by Chris Hadgis]