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 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542
|
/*
* File: spl-cast.cc
* Summary: Spell casting and miscast functions.
* Written by: Linley Henzell
*
* Change History (most recent first):
*
* <4> 1/02/00 jmf changed values, marked //jmf:
* <3> 6/13/99 BWR Added Staff auto identify code
* <2> 5/20/99 BWR Added some screen redraws
* <1> -/--/-- LRH Created
*/
#include "AppHdr.h"
#include "spl-cast.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "externs.h"
#include "beam.h"
#include "cloud.h"
#include "effects.h"
#include "fight.h"
#include "food.h"
#include "it_use2.h"
#include "itemname.h"
#include "macro.h"
#include "monplace.h"
#include "monstuff.h"
#include "mutation.h"
#include "ouch.h"
#include "player.h"
#include "religion.h"
#include "skills.h"
#include "spells1.h"
#include "spells2.h"
#include "spells3.h"
#include "spells4.h"
#include "spl-book.h"
#include "spl-util.h"
#include "stuff.h"
#include "transfor.h"
#include "view.h"
#ifdef DOS
#include <conio.h>
#endif
#define WILD_MAGIC_NASTINESS 150
static void surge_power(int spell)
{
int enhanced = 0;
//jmf: simplified
enhanced += spell_enhancement(spell_type(spell));
if (enhanced) // one way or the other {dlb}
{
strcpy(info, "You feel a");
strcat(info, (enhanced < -2) ? "n extraordinarily" :
(enhanced == -2) ? "n extremely" :
(enhanced == 2) ? " strong" :
(enhanced > 2) ? " huge"
: "");
strcat(info, (enhanced < 0) ? " numb sensation."
: " surge of power!");
mpr(info);
}
} // end surge_power()
char list_spells(void)
{
int j;
int lines = 0;
unsigned int anything = 0;
unsigned int i;
int ki;
bool already = false;
const int num_lines = get_number_of_lines();
#ifdef DOS_TERM
char buffer[4800];
gettext(1, 1, 80, 25, buffer);
#endif
#ifdef DOS_TERM
window(1, 1, 80, 25);
#endif
clrscr();
cprintf( " Your Spells Type Success Level" );
lines++;
for (j = 0; j < 52; j++)
{
if (lines > num_lines - 2)
{
gotoxy(1, num_lines);
cprintf("-more-");
ki = getch();
if (ki == ESCAPE)
{
#ifdef DOS_TERM
puttext(1, 1, 80, 25, buffer);
#endif
return (ESCAPE);
}
if (isalpha( ki ))
{
#ifdef DOS_TERM
puttext(1, 1, 80, 25, buffer);
#endif
return (ki);
}
if (ki == 0)
ki = getch();
lines = 0;
clrscr();
gotoxy(1, 1);
anything = 0;
}
const char letter = index_to_letter(j);
const int spell = get_spell_by_letter(letter);
if (spell != SPELL_NO_SPELL)
{
anything++;
if (lines > 0)
cprintf(EOL);
lines++;
cprintf( " %c - %s", letter, spell_title( spell ) );
gotoxy(35, wherey());
already = false;
for (i = 0; i <= SPTYP_LAST_EXPONENT; i++)
{
if (spell_typematch( spell, (1 << i) ))
{
if (already)
cprintf( "/" );
cprintf( spelltype_name( 1 << i ) );
already = true;
}
}
char sval[16];
//gotoxy(58, wherey());
gotoxy(65, wherey());
int spell_f = spell_fail( spell );
cprintf( (spell_f == 100) ? "Useless" :
(spell_f > 90) ? "Terrible" :
(spell_f > 80) ? "Cruddy" :
(spell_f > 70) ? "Bad" :
(spell_f > 60) ? "Very Poor" :
(spell_f > 50) ? "Poor" :
(spell_f > 40) ? "Fair" :
(spell_f > 30) ? "Good" :
(spell_f > 20) ? "Very Good" :
(spell_f > 10) ? "Great" :
(spell_f > 0) ? "Excellent"
: "Perfect" );
gotoxy(77, wherey());
itoa( (int) spell_difficulty( spell ), sval, 10 );
cprintf(sval);
}
} // end of j loop
if (anything > 0)
{
ki = getch();
if (ki >= 'A' && ki <= 'z')
{
#ifdef DOS_TERM
puttext(1, 1, 80, 25, buffer);
#endif
return (ki);
}
if (ki == 0)
ki = getch();
#ifdef DOS_TERM
puttext(1, 1, 80, 25, buffer);
#endif
return (anything);
}
#ifdef DOS_TERM
puttext(1, 1, 80, 25, buffer);
#endif
// was 35
ki = getch();
return (ki);
} // end list_spells()
int spell_fail(int spell)
{
int chance = 60;
int chance2 = 0, armour = 0;
chance -= 6 * calc_spell_power( spell, false );
chance -= (you.intel * 2);
//chance -= (you.intel - 10) * abs(you.intel - 10);
//chance += spell_difficulty(spell) * spell_difficulty(spell) * 3; //spell_difficulty(spell);
if (you.equip[EQ_BODY_ARMOUR] != -1)
{
int ev_penalty = abs(property( you.inv[you.equip[EQ_BODY_ARMOUR]],
PARM_EVASION ));
// The minus 15 is to make the -1 light armours not so bad
armour += (20 * ev_penalty) - 15;
//jmf: armour skill now reduces failure due to armour
//bwr: this was far too good, an armour skill of 5 was
// completely negating plate mail. Plate mail should
// hardly be completely negated, it should still be
// an important consideration for even high level characters.
// Truth is, even a much worse penalty than the above can
// easily be overcome by gaining spell skills... and a lot
// faster than any reasonable rate of bonus here.
int lim_str = (you.strength > 30) ? 30 :
(you.strength < 10) ? 10 : you.strength;
armour -= ((you.skills[SK_ARMOUR] * lim_str) / 15);
int race_arm = get_equip_race( you.inv[you.equip[EQ_BODY_ARMOUR]] );
int racial_type = 0;
if (player_genus(GENPC_DWARVEN))
racial_type = ISFLAG_DWARVEN;
else if (player_genus(GENPC_ELVEN))
racial_type = ISFLAG_ELVEN;
else if (you.species == SP_HILL_ORC)
racial_type = ISFLAG_ORCISH;
// Elven armour gives everyone some benefit to spellcasting,
// Dwarven armour hinders everyone.
switch (race_arm)
{
case ISFLAG_ELVEN:
armour -= 20;
break;
case ISFLAG_DWARVEN:
armour += 10;
break;
default:
break;
}
// Armour of the same racial type reduces penalty.
if (racial_type && race_arm == racial_type)
armour -= 10;
if (armour > 0)
chance += armour;
}
if (you.equip[EQ_WEAPON] != -1
&& you.inv[you.equip[EQ_WEAPON]].base_type == OBJ_WEAPONS)
{
int wpn_penalty = (3 * (property( you.inv[you.equip[EQ_WEAPON]], PWPN_SPEED ) - 12)) / 2;
if (wpn_penalty > 0)
chance += wpn_penalty;
}
if (you.equip[EQ_SHIELD] != -1)
{
switch (you.inv[you.equip[EQ_SHIELD]].sub_type)
{
case ARM_BUCKLER:
chance += 5;
break;
case ARM_SHIELD:
chance += 15;
break;
case ARM_LARGE_SHIELD:
// *BCR* Large chars now get a lower penalty for large shields
if ((you.species >= SP_OGRE && you.species <= SP_OGRE_MAGE)
|| player_genus(GENPC_DRACONIAN))
{
chance += 20;
}
else
chance += 30;
break;
}
}
switch (spell_difficulty(spell))
{
case 1: chance += 3; break;
case 2: chance += 15; break;
case 3: chance += 35; break;
case 4: chance += 70; break;
case 5: chance += 100; break;
case 6: chance += 150; break;
case 7: chance += 200; break;
case 8: chance += 260; break;
case 9: chance += 330; break;
case 10: chance += 420; break;
case 11: chance += 500; break;
case 12: chance += 600; break;
default: chance += 750; break;
}
//if (chance < 1 ) chance = 0;
if (chance > 100)
chance = 100;
chance2 = chance;
if (chance < 45)
chance2 = 45;
if (chance < 42)
chance2 = 43;
if (chance < 38)
chance2 = 41;
if (chance < 35)
chance2 = 40;
if (chance < 32)
chance2 = 38;
if (chance < 28)
chance2 = 36;
if (chance < 22)
chance2 = 34;
if (chance < 16)
chance2 = 32;
if (chance < 10)
chance2 = 30;
if (chance < 2)
chance2 = 28;
if (chance < -7)
chance2 = 26;
if (chance < -12)
chance2 = 24;
if (chance < -18)
chance2 = 22;
if (chance < -24)
chance2 = 20;
if (chance < -30)
chance2 = 18;
if (chance < -38)
chance2 = 16;
if (chance < -46)
chance2 = 14;
if (chance < -60)
chance2 = 12;
if (chance < -80)
chance2 = 10;
if (chance < -100)
chance2 = 8;
if (chance < -120)
chance2 = 6;
if (chance < -140)
chance2 = 4;
if (chance < -160)
chance2 = 2;
if (chance < -180)
chance2 = 0;
if (you.religion == GOD_VEHUMET
&& you.duration[DUR_PRAYER]
&& (!player_under_penance() && you.piety >= 50)
&& (spell_typematch(spell, SPTYP_CONJURATION)
|| spell_typematch(spell, SPTYP_SUMMONING)))
{
chance2 /= 2;
}
if (you.duration[DUR_TRANSFORMATION] > 0)
{
switch (you.attribute[ATTR_TRANSFORMATION])
{
case TRAN_BLADE_HANDS:
chance2 += 20;
break;
case TRAN_SPIDER:
chance2 += 10;
break;
}
}
return (chance2);
} // end spell_fail()
int calc_spell_power( int spell, bool apply_intel )
{
unsigned int bit;
int ndx;
int power = (you.skills[SK_SPELLCASTING] / 2) + player_mag_abil(false);
int enhanced = 0;
unsigned int disciplines = spell_type( spell );
//jmf: evil evil evil -- exclude HOLY bit
disciplines &= (~SPTYP_HOLY);
int skillcount = count_bits( disciplines );
if (skillcount)
{
for (ndx = 0; ndx <= SPTYP_LAST_EXPONENT; ndx++)
{
bit = 1 << ndx;
if ((bit != SPTYP_HOLY) && (disciplines & bit))
{
int skill = spell_type2skill( bit );
power += (you.skills[skill] * 2) / skillcount;
}
}
}
if (apply_intel)
power = (power * you.intel) / 10;
enhanced = spell_enhancement( disciplines );
if (enhanced > 0)
{
for (ndx = 0; ndx < enhanced; ndx++)
{
power *= 15;
power /= 10;
}
}
else if (enhanced < 0)
{
for (ndx = enhanced; ndx < 0; ndx++)
power /= 2;
}
power = stepdown_value( power, 50, 50, 150, 200 );
return (power);
} // end calc_spell_power()
int spell_enhancement( unsigned int typeflags )
{
int enhanced = 0;
if (typeflags & SPTYP_CONJURATION)
enhanced += player_spec_conj();
if (typeflags & SPTYP_ENCHANTMENT)
enhanced += player_spec_ench();
if (typeflags & SPTYP_SUMMONING)
enhanced += player_spec_summ();
if (typeflags & SPTYP_POISON)
enhanced += player_spec_poison();
if (typeflags & SPTYP_NECROMANCY)
enhanced += player_spec_death() - player_spec_holy();
if (typeflags & SPTYP_FIRE)
enhanced += player_spec_fire() - player_spec_cold();
if (typeflags & SPTYP_ICE)
enhanced += player_spec_cold() - player_spec_fire();
if (typeflags & SPTYP_EARTH)
enhanced += player_spec_earth() - player_spec_air();
if (typeflags & SPTYP_AIR)
enhanced += player_spec_air() - player_spec_earth();
if (you.special_wield == SPWLD_SHADOW)
enhanced -= 2;
// These are used in an exponential way, so we'll limit them a bit. -- bwr
if (enhanced > 3)
enhanced = 3;
else if (enhanced < -3)
enhanced = -3;
return (enhanced);
} // end spell_enhancement()
// returns false if spell failed, and true otherwise
bool cast_a_spell(void)
{
char spc = 0;
char spc2 = 0;
int spellh = 0;
unsigned char keyin = 0;
char unthing = 0;
if (!you.spell_no)
{
mpr("You don't know any spells.");
return (false);
}
if (you.berserker)
{
canned_msg(MSG_TOO_BERSERK);
return (false);
}
if (silenced(you.x_pos, you.y_pos))
{
mpr("You cannot cast spells when silenced!");
return (false);
}
// first query {dlb}:
for (;;)
{
//jmf: FIXME: change to reflect range of known spells
mpr( "Cast which spell ([?*] list)? ", MSGCH_PROMPT );
keyin = get_ch();
if (keyin == '?' || keyin == '*')
{
unthing = list_spells();
redraw_screen();
if (unthing == 2)
return (false);
if (unthing >= 'a' && unthing <= 'y')
{
keyin = unthing;
break;
}
else
mesclr();
}
else
{
break;
}
}
if (keyin == ESCAPE)
return (false);
spc = (int) keyin;
if (!isalpha(spc))
{
mpr("You don't know that spell.");
return (false);
}
const int spell = get_spell_by_letter( spc );
spc2 = letter_to_index(spc);
if (spell == SPELL_NO_SPELL)
{
mpr("You don't know that spell.");
return (false);
}
if (spell_mana( spell ) > you.magic_points)
{
mpr("You don't have enough magic to cast that spell.");
return (false);
}
if (you.is_undead != US_UNDEAD
&& (you.hunger_state < HS_HUNGRY
|| you.hunger <= spell_hunger( spell )))
{
mpr("You don't have the energy to cast that spell.");
return (false);
}
dec_mp( spell_mana(spell) );
if (!player_energy() && you.is_undead != US_UNDEAD)
{
spellh = spell_hunger( spell );
// I wonder if a better algorithm is called for? {dlb}
spellh -= you.intel * you.skills[SK_SPELLCASTING];
if (spellh < 1)
spellh = 1;
else
make_hungry(spellh, true);
}
you.turn_is_over = 1;
alert_nearby_monsters();
if (you.conf)
random_uselessness( 2 + random2(7), 0 );
else
{
exercise_spell( spell, true, your_spells( spell ) );
naughty( NAUGHTY_SPELLCASTING, 1 + random2(5) );
}
return (true);
} // end cast_a_spell()
// returns true if spell if spell is successfully cast for purposes of
// exercising and false otherwise (note: false == less exercise, not none).
bool your_spells( int spc2, int powc, bool allow_fail )
{
int dem_hor = 0;
int dem_hor2 = 0;
int total_skill = 0;
struct dist spd;
struct bolt beam;
alert_nearby_monsters();
// Added this so that the passed in powc can have meaning -- bwr
if (powc == 0)
powc = calc_spell_power( spc2, true );
if (you.equip[EQ_WEAPON] != -1
&& item_is_staff( you.inv[you.equip[EQ_WEAPON]] )
&& item_not_ident( you.inv[you.equip[EQ_WEAPON]], ISFLAG_KNOW_TYPE ))
{
switch (you.inv[you.equip[EQ_WEAPON]].sub_type)
{
case STAFF_ENERGY:
case STAFF_WIZARDRY:
total_skill = you.skills[SK_SPELLCASTING];
break;
case STAFF_FIRE:
if (spell_typematch(spc2, SPTYP_FIRE))
total_skill = you.skills[SK_FIRE_MAGIC];
else if (spell_typematch(spc2, SPTYP_ICE))
total_skill = you.skills[SK_ICE_MAGIC];
break;
case STAFF_COLD:
if (spell_typematch(spc2, SPTYP_ICE))
total_skill = you.skills[SK_ICE_MAGIC];
else if (spell_typematch(spc2, SPTYP_FIRE))
total_skill = you.skills[SK_FIRE_MAGIC];
break;
case STAFF_AIR:
if (spell_typematch(spc2, SPTYP_AIR))
total_skill = you.skills[SK_AIR_MAGIC];
else if (spell_typematch(spc2, SPTYP_EARTH))
total_skill = you.skills[SK_EARTH_MAGIC];
break;
case STAFF_EARTH:
if (spell_typematch(spc2, SPTYP_EARTH))
total_skill = you.skills[SK_EARTH_MAGIC];
else if (spell_typematch(spc2, SPTYP_AIR))
total_skill = you.skills[SK_AIR_MAGIC];
break;
case STAFF_POISON:
if (spell_typematch(spc2, SPTYP_POISON))
total_skill = you.skills[SK_POISON_MAGIC];
break;
case STAFF_DEATH:
if (spell_typematch(spc2, SPTYP_NECROMANCY))
total_skill = you.skills[SK_NECROMANCY];
break;
case STAFF_CONJURATION:
if (spell_typematch(spc2, SPTYP_CONJURATION))
total_skill = you.skills[SK_CONJURATIONS];
break;
case STAFF_ENCHANTMENT:
if (spell_typematch(spc2, SPTYP_ENCHANTMENT))
total_skill = you.skills[SK_ENCHANTMENTS];
break;
case STAFF_SUMMONING:
if (spell_typematch(spc2, SPTYP_SUMMONING))
total_skill = you.skills[SK_SUMMONINGS];
break;
}
if (you.skills[SK_SPELLCASTING] > total_skill)
total_skill = you.skills[SK_SPELLCASTING];
if (random2(100) < total_skill)
{
char str_pass[ ITEMNAME_SIZE ];
set_ident_flags( you.inv[you.equip[EQ_WEAPON]], ISFLAG_KNOW_TYPE );
strcpy(info, "You are wielding ");
in_name(you.equip[EQ_WEAPON], DESC_NOCAP_A, str_pass);
strcat(info, str_pass);
strcat(info, ".");
mpr(info);
more();
you.wield_change = true;
}
}
surge_power(spc2);
if (allow_fail)
{
int spfl = random2avg(100, 3);
if (you.religion != GOD_SIF_MUNA
&& you.penance[GOD_SIF_MUNA] && one_chance_in(40))
{
god_speaks(GOD_SIF_MUNA, "You feel a surge of divine spite.");
// This will cause failure and increase the miscast effect.
spfl = -you.penance[GOD_SIF_MUNA];
// Reduced penenance reduction here because casting spells
// is a player controllable act. -- bwr
if (one_chance_in(7))
dec_penance(1);
}
if (spfl < spell_fail(spc2))
{
mpr( "You miscast the spell." );
flush_input_buffer( FLUSH_ON_FAILURE );
if (you.religion == GOD_SIF_MUNA
&& (!player_under_penance()
&& you.piety >= 100 && random2(150) <= you.piety))
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
}
unsigned int sptype = 0;
do
{
sptype = 1 << (random2(SPTYP_LAST_EXPONENT+1));
} while (!spell_typematch(spc2, sptype));
// all spell failures give a bit of magical radiation..
// failure is a function of power squared multiplied
// by how badly you missed the spell. High power
// spells can be quite nasty: 9 * 9 * 90 / 500 = 15
// points of contamination!
int nastiness = spell_mana(spc2) * spell_mana(spc2)
* (spell_fail(spc2) - spfl) + 250;
int cont_points = nastiness / 500;
// handle fraction
if (random2(500) < (nastiness % 500))
cont_points++;
contaminate_player( cont_points );
miscast_effect( sptype, spell_mana(spc2), spell_fail(spc2) - spfl, 100 );
if (you.religion == GOD_XOM && random2(75) < spell_mana(spc2))
Xom_acts(coinflip(), spell_mana(spc2), false);
return (false);
}
}
if (you.is_undead && spell_typematch( spc2, SPTYP_HOLY ))
{
mpr( "You can't use this type of magic!" );
return (false); // XXX: still gets trained!
}
// Normally undead can't memorize these spells, so this check is
// to catch those in Lich form. As such, we allow the Lich form
// to be extended here. -- bwr
if (spc2 != SPELL_NECROMUTATION
&& undead_cannot_memorise( spc2, you.is_undead ))
{
mpr( "You cannot cast that spell in your current form!" );
return (false); // XXX: still gets trained!
}
// Linley says: Condensation Shield needs some disadvantages to keep
// it from being a no-brainer... this isn't much, but its a start -- bwr
if (you.duration[DUR_CONDENSATION_SHIELD] > 0
&& spell_typematch( spc2, SPTYP_FIRE ))
{
mpr( "Your icy shield dissipates!", MSGCH_DURATION );
you.duration[DUR_CONDENSATION_SHIELD] = 0;
you.redraw_armour_class = 1;
}
if (spc2 == SPELL_SUMMON_HORRIBLE_THINGS
|| spc2 == SPELL_CALL_IMP
|| spc2 == SPELL_SUMMON_DEMON
|| spc2 == SPELL_DEMONIC_HORDE
|| spc2 == SPELL_SUMMON_GREATER_DEMON || spc2 == SPELL_HELLFIRE)
{
naughty(NAUGHTY_UNHOLY, 10 + spell_difficulty(spc2));
}
if (spell_typematch( spc2, SPTYP_NECROMANCY ))
naughty( NAUGHTY_NECROMANCY, 10 + spell_difficulty(spc2) );
if (spc2 == SPELL_NECROMUTATION
&& (you.religion == GOD_ELYVILON
|| you.religion == GOD_SHINING_ONE
|| you.religion == GOD_ZIN))
{
excommunication();
}
if (you.religion == GOD_SIF_MUNA
&& you.piety < 200 && random2(12) <= spell_difficulty(spc2))
{
gain_piety(1);
}
#if DEBUG_DIAGNOSTICS
snprintf( info, INFO_SIZE, "Spell #%d, power=%d", spc2, powc );
mpr( info, MSGCH_DIAGNOSTICS );
#endif
switch (spc2)
{
case SPELL_IDENTIFY:
identify(powc);
break;
case SPELL_TELEPORT_SELF:
you_teleport();
break;
case SPELL_CAUSE_FEAR:
mass_enchantment(ENCH_FEAR, powc, MHITYOU);
break;
case SPELL_CREATE_NOISE: // unused, the player can shout to do this - bwr
if (!silenced(you.x_pos, you.y_pos))
{
mpr("You hear a voice call your name!");
noisy( 25, you.x_pos, you.y_pos );
}
break;
case SPELL_REMOVE_CURSE:
remove_curse(false);
break;
case SPELL_MAGIC_DART:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_MAGIC_DARTS, powc, beam);
break;
case SPELL_FIREBALL:
fireball(powc);
break;
case SPELL_DELAYED_FIREBALL:
// This spell has two main advantages over Fireball:
//
// (1) The release is instantaneous, so monsters will not
// get an action before the player... this allows the
// player to hit monsters with a double fireball (this
// is why we only allow one delayed fireball at a time,
// if you want to allow for more, then the release should
// take at least some amount of time).
//
// The casting of this spell still costs a turn. So
// casting Delayed Fireball and immediately releasing
// the fireball is only slightly different than casting
// a regular Fireball (monsters act in the middle instead
// of at the end). This is why we allow for the spell
// level discount so that Fireball is free with this spell
// (so that it only costs 7 levels instead of 13 to have
// both).
//
// (2) When the fireball is released, it is guaranteed to
// go off... the spell only fails at this point. This can
// be a large advantage for characters who have difficulty
// casting Fireball in their standard equipment. However,
// the power level for the actual fireball is determined at
// release, so if you do swap out your enhancers you'll
// get a less powerful ball when its released. -- bwr
//
if (!you.attribute[ ATTR_DELAYED_FIREBALL ])
{
// okay, this message is weak but functional -- bwr
mpr( "You feel magically charged." );
you.attribute[ ATTR_DELAYED_FIREBALL ] = 1;
}
else
{
canned_msg( MSG_NOTHING_HAPPENS );
}
break;
case SPELL_STRIKING:
if (spell_direction( spd, beam ) == -1)
return (false);
zapping( ZAP_STRIKING, powc, beam );
break;
case SPELL_CONJURE_FLAME:
conjure_flame(powc);
break;
case SPELL_DIG:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
}
zapping(ZAP_DIGGING, powc, beam);
break;
case SPELL_BOLT_OF_FIRE:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_FIRE, powc, beam);
break;
case SPELL_BOLT_OF_COLD:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_COLD, powc, beam);
break;
case SPELL_LIGHTNING_BOLT:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_LIGHTNING, powc, beam);
break;
case SPELL_BOLT_OF_MAGMA:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_MAGMA, powc, beam);
break;
case SPELL_POLYMORPH_OTHER:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
mpr("Sorry, it doesn't work like that.");
return (false);
}
zapping(ZAP_POLYMORPH_OTHER, powc, beam);
break;
case SPELL_SLOW:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_SLOWING, powc, beam);
break;
case SPELL_HASTE:
if (spell_direction(spd, beam, DIR_NONE, TARG_FRIEND) == -1)
return (false);
zapping(ZAP_HASTING, powc, beam);
break;
case SPELL_PARALYZE:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_PARALYSIS, powc, beam);
break;
case SPELL_CONFUSE:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_CONFUSION, powc, beam);
break;
case SPELL_CONFUSING_TOUCH:
cast_confusing_touch(powc);
break;
case SPELL_SURE_BLADE:
cast_sure_blade(powc);
break;
case SPELL_INVISIBILITY:
if (spell_direction(spd, beam, DIR_NONE, TARG_FRIEND) == -1)
return (false);
zapping(ZAP_INVISIBILITY, powc, beam);
break;
case SPELL_THROW_FLAME:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_FLAME, powc, beam);
break;
case SPELL_THROW_FROST:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_FROST, powc, beam);
break;
case SPELL_CONTROLLED_BLINK:
blink();
break;
case SPELL_FREEZING_CLOUD:
cast_big_c(powc, CLOUD_COLD);
break;
case SPELL_MEPHITIC_CLOUD:
stinking_cloud(powc);
break;
case SPELL_RING_OF_FLAMES:
cast_ring_of_flames(powc);
break;
case SPELL_RESTORE_STRENGTH:
restore_stat(STAT_STRENGTH, false);
break;
case SPELL_RESTORE_INTELLIGENCE:
restore_stat(STAT_INTELLIGENCE, false);
break;
case SPELL_RESTORE_DEXTERITY:
restore_stat(STAT_DEXTERITY, false);
break;
case SPELL_VENOM_BOLT:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_VENOM_BOLT, powc, beam);
break;
case SPELL_OLGREBS_TOXIC_RADIANCE:
cast_toxic_radiance();
break;
case SPELL_TELEPORT_OTHER:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
mpr("Sorry, it doesn't work like that.");
return (false);
}
// teleport creature (I think)
zapping(ZAP_TELEPORTATION, powc, beam);
break;
case SPELL_LESSER_HEALING:
cast_healing(5);
break;
case SPELL_GREATER_HEALING:
cast_healing(25);
break;
case SPELL_CURE_POISON_I: //jmf: `healing' version? group w/ S_C_P_II?
cast_cure_poison(powc);
break;
case SPELL_PURIFICATION:
purification();
break;
case SPELL_DEATHS_DOOR:
cast_deaths_door(powc);
break;
case SPELL_SELECTIVE_AMNESIA:
cast_selective_amnesia(false);
break; // Sif Muna power calls with true
case SPELL_MASS_CONFUSION:
mass_enchantment(ENCH_CONFUSION, powc, MHITYOU);
break;
case SPELL_SMITING:
cast_smiting(powc);
break;
case SPELL_REPEL_UNDEAD:
turn_undead(50);
break;
case SPELL_HOLY_WORD:
holy_word(50);
break;
case SPELL_DETECT_CURSE:
detect_curse(false);
break;
case SPELL_SUMMON_SMALL_MAMMAL:
summon_small_mammals(powc); //jmf: hmm, that's definately *plural* ;-)
break;
case SPELL_ABJURATION_I: //jmf: why not group with SPELL_ABJURATION_II?
abjuration(powc);
break;
case SPELL_SUMMON_SCORPIONS:
summon_scorpions(powc);
break;
case SPELL_LEVITATION:
potion_effect( POT_LEVITATION, powc );
break;
case SPELL_BOLT_OF_DRAINING:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_NEGATIVE_ENERGY, powc, beam);
break;
case SPELL_LEHUDIBS_CRYSTAL_SPEAR:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_CRYSTAL_SPEAR, powc, beam);
break;
case SPELL_BOLT_OF_INACCURACY:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_BEAM_OF_ENERGY, powc, beam);
break;
case SPELL_POISONOUS_CLOUD:
cast_big_c(powc, CLOUD_POISON);
break;
case SPELL_POISON_ARROW:
if (spell_direction(spd, beam) == -1)
return (false);
zapping( ZAP_POISON_ARROW, powc, beam );
break;
case SPELL_FIRE_STORM:
cast_fire_storm(powc);
break;
case SPELL_DETECT_TRAPS:
strcpy(info, "You detect ");
strcat(info, (detect_traps(powc) > 0) ? "some traps!" : "nothing.");
mpr(info);
break;
case SPELL_BLINK:
random_blink(true);
break;
case SPELL_ISKENDERUNS_MYSTIC_BLAST:
if (spell_direction(spd, beam) == -1)
return (false);
zapping( ZAP_MYSTIC_BLAST, powc, beam );
break;
case SPELL_SWARM:
summon_swarm( powc, false, false );
break;
case SPELL_SUMMON_HORRIBLE_THINGS:
summon_things(powc);
break;
case SPELL_ENSLAVEMENT:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
}
zapping(ZAP_ENSLAVEMENT, powc, beam);
break;
case SPELL_MAGIC_MAPPING:
if (you.level_type == LEVEL_LABYRINTH || you.level_type == LEVEL_ABYSS)
mpr("You feel momentarily disoriented.");
else if (you.level_type == LEVEL_PANDEMONIUM)
mpr("Your Earth magic cannot map Pandemonium.");
else
{
mpr( "You feel aware of your surroundings." );
powc = stepdown_value( powc, 10, 10, 40, 45 );
magic_mapping( 5 + powc, 50 + random2avg( powc * 2, 2 ) );
}
break;
case SPELL_HEAL_OTHER:
if (spell_direction(spd, beam, DIR_NONE, TARG_FRIEND) == -1)
return (false);
if (spd.isMe)
{
mpr("Sorry, it doesn't work like that.");
return (false);
}
zapping(ZAP_HEALING, powc, beam);
break;
case SPELL_ANIMATE_DEAD:
mpr("You call on the dead to walk for you.");
animate_dead(powc + 1, BEH_FRIENDLY, you.pet_target, 1);
break;
case SPELL_PAIN:
if (spell_direction(spd, beam) == -1)
return (false);
dec_hp(1, false);
zapping(ZAP_PAIN, powc, beam);
break;
case SPELL_EXTENSION:
extension(powc);
break;
case SPELL_CONTROL_UNDEAD:
mass_enchantment(ENCH_CHARM, powc, MHITYOU);
break;
case SPELL_ANIMATE_SKELETON:
mpr("You attempt to give life to the dead...");
animate_a_corpse(you.x_pos, you.y_pos, BEH_FRIENDLY, you.pet_target,
CORPSE_SKELETON);
break;
case SPELL_VAMPIRIC_DRAINING:
vampiric_drain(powc);
break;
case SPELL_SUMMON_WRAITHS:
summon_undead(powc);
break;
case SPELL_DETECT_ITEMS:
detect_items(powc);
break;
case SPELL_BORGNJORS_REVIVIFICATION:
cast_revivification(powc);
break;
case SPELL_BURN:
burn_freeze(powc, BEAM_FIRE);
break;
case SPELL_FREEZE:
burn_freeze(powc, BEAM_COLD);
break;
case SPELL_SUMMON_ELEMENTAL:
summon_elemental(powc, 0, 2);
break;
case SPELL_OZOCUBUS_REFRIGERATION:
cast_refrigeration(powc);
break;
case SPELL_STICKY_FLAME:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_STICKY_FLAME, powc, beam);
break;
case SPELL_SUMMON_ICE_BEAST:
summon_ice_beast_etc(powc, MONS_ICE_BEAST);
break;
case SPELL_OZOCUBUS_ARMOUR:
ice_armour(powc, false);
break;
case SPELL_CALL_IMP:
if (one_chance_in(3))
summon_ice_beast_etc(powc, MONS_WHITE_IMP);
else if (one_chance_in(7))
summon_ice_beast_etc(powc, MONS_SHADOW_IMP);
else
summon_ice_beast_etc(powc, MONS_IMP);
break;
case SPELL_REPEL_MISSILES:
missile_prot(powc);
break;
case SPELL_BERSERKER_RAGE:
cast_berserk();
break;
case SPELL_DISPEL_UNDEAD:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_DISPEL_UNDEAD, powc, beam);
break;
case SPELL_GUARDIAN:
summon_ice_beast_etc(powc, MONS_ANGEL);
break;
//jmf: FIXME: SPELL_PESTILENCE?
case SPELL_THUNDERBOLT:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_LIGHTNING, powc, beam);
break;
case SPELL_FLAME_OF_CLEANSING:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_CLEANSING_FLAME, powc, beam);
break;
//jmf: FIXME: SPELL_SHINING_LIGHT?
case SPELL_SUMMON_DAEVA:
summon_ice_beast_etc(powc, MONS_DAEVA);
break;
case SPELL_ABJURATION_II:
abjuration(powc);
break;
// Remember that most holy spells above don't yet use powc!
case SPELL_TWISTED_RESURRECTION:
cast_twisted(powc, BEH_FRIENDLY, you.pet_target);
break;
case SPELL_REGENERATION:
cast_regen(powc);
break;
case SPELL_BONE_SHARDS:
cast_bone_shards(powc);
break;
case SPELL_BANISHMENT:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_BANISHMENT, powc, beam);
break;
case SPELL_CIGOTUVIS_DEGENERATION:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
}
zapping(ZAP_DEGENERATION, powc, beam);
break;
case SPELL_STING:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_STING, powc, beam);
break;
case SPELL_SUBLIMATION_OF_BLOOD:
sublimation(powc);
break;
case SPELL_TUKIMAS_DANCE:
dancing_weapon(powc, false);
break;
case SPELL_HELLFIRE:
// should only be available from:
// staff of Dispater & Sceptre of Asmodeus
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_HELLFIRE, powc, beam);
break;
case SPELL_SUMMON_DEMON:
mpr("You open a gate to Pandemonium!");
summon_ice_beast_etc(powc, summon_any_demon(DEMON_COMMON));
break;
case SPELL_DEMONIC_HORDE:
mpr("You open a gate to Pandemonium!");
dem_hor2 = 3 + random2(5);
for (dem_hor = 0; dem_hor < 4 + dem_hor2; dem_hor++)
{
summon_ice_beast_etc(powc, summon_any_demon(DEMON_LESSER));
}
break;
case SPELL_SUMMON_GREATER_DEMON:
mpr("You open a gate to Pandemonium!");
dem_hor = ((random2(powc) <= 5) ? BEH_HOSTILE : BEH_CHARMED);
if (dem_hor == BEH_CHARMED)
mpr("You don't feel so good about this...");
create_monster( summon_any_demon(DEMON_GREATER), ENCH_ABJ_V, dem_hor,
you.x_pos, you.y_pos, MHITYOU, 250 );
break;
case SPELL_CORPSE_ROT:
corpse_rot(0);
break;
case SPELL_TUKIMAS_VORPAL_BLADE:
if (!brand_weapon(SPWPN_VORPAL, powc))
canned_msg(MSG_SPELL_FIZZLES);
break;
case SPELL_FIRE_BRAND:
if (!brand_weapon(SPWPN_FLAMING, powc))
canned_msg(MSG_SPELL_FIZZLES);
break;
case SPELL_FREEZING_AURA:
if (!brand_weapon(SPWPN_FREEZING, powc))
canned_msg(MSG_SPELL_FIZZLES);
break;
case SPELL_LETHAL_INFUSION:
if (!brand_weapon(SPWPN_DRAINING, powc))
canned_msg(MSG_SPELL_FIZZLES);
break;
case SPELL_MAXWELLS_SILVER_HAMMER:
if (!brand_weapon(SPWPN_DUMMY_CRUSHING, powc))
canned_msg(MSG_SPELL_FIZZLES);
break;
case SPELL_POISON_WEAPON:
if (!brand_weapon(SPWPN_VENOM, powc))
canned_msg(MSG_SPELL_FIZZLES);
break;
case SPELL_CRUSH:
burn_freeze(powc, BEAM_MISSILE);
break;
case SPELL_BOLT_OF_IRON:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_IRON_BOLT, powc, beam);
break;
case SPELL_STONE_ARROW:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_STONE_ARROW, powc, beam);
break;
case SPELL_TOMB_OF_DOROKLOHE:
entomb();
break;
case SPELL_STONEMAIL:
stone_scales(powc);
break;
case SPELL_SHOCK:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_ELECTRICITY, powc, beam);
break;
case SPELL_SWIFTNESS:
cast_swiftness(powc);
break;
case SPELL_FLY:
cast_fly(powc);
break;
case SPELL_INSULATION:
cast_insulation(powc);
break;
case SPELL_ORB_OF_ELECTROCUTION:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_ORB_OF_ELECTRICITY, powc, beam);
break;
case SPELL_DETECT_CREATURES:
detect_creatures(powc);
break;
case SPELL_CURE_POISON_II: // poison magic version of cure poison
cast_cure_poison(powc);
break;
case SPELL_CONTROL_TELEPORT:
cast_teleport_control(powc);
break;
case SPELL_POISON_AMMUNITION:
cast_poison_ammo();
break;
case SPELL_RESIST_POISON:
cast_resist_poison(powc);
break;
case SPELL_PROJECTED_NOISE:
project_noise();
break;
case SPELL_ALTER_SELF:
if (!enough_hp( you.hp_max / 2, true ))
{
mpr( "Your body is in too poor a condition "
"for this spell to function." );
return (false);
}
mpr("Your body is suffused with transfigurative energy!");
set_hp( 1 + random2(you.hp), false );
if (!mutate(100, false))
mpr("Odd... you don't feel any different.");
break;
case SPELL_DEBUGGING_RAY:
if (spell_direction(spd, beam, DIR_NONE, TARG_ANY) == -1)
return (false);
zapping(ZAP_DEBUGGING_RAY, powc, beam);
break;
case SPELL_RECALL:
recall(0);
break;
case SPELL_PORTAL:
portal();
break;
case SPELL_AGONY:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
}
zapping(ZAP_AGONY, powc, beam);
break;
case SPELL_SPIDER_FORM:
transform(powc, TRAN_SPIDER);
break;
case SPELL_DISRUPT:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_DISRUPTION, powc, beam);
break;
case SPELL_DISINTEGRATE:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
}
zapping(ZAP_DISINTEGRATION, powc, beam);
break;
case SPELL_BLADE_HANDS:
transform(powc, TRAN_BLADE_HANDS);
break;
case SPELL_STATUE_FORM:
transform(powc, TRAN_STATUE);
break;
case SPELL_ICE_FORM:
transform(powc, TRAN_ICE_BEAST);
break;
case SPELL_DRAGON_FORM:
transform(powc, TRAN_DRAGON);
break;
case SPELL_NECROMUTATION:
transform(powc, TRAN_LICH);
break;
case SPELL_DEATH_CHANNEL:
cast_death_channel(powc);
break;
case SPELL_SYMBOL_OF_TORMENT:
if (you.is_undead || you.mutation[MUT_TORMENT_RESISTANCE])
{
mpr("To torment others, one must first know what torment means. ");
return (false);
}
torment(you.x_pos, you.y_pos);
break;
case SPELL_DEFLECT_MISSILES:
deflection(powc);
break;
case SPELL_ORB_OF_FRAGMENTATION:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_ORB_OF_FRAGMENTATION, powc, beam);
break;
case SPELL_ICE_BOLT:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_ICE_BOLT, powc, beam);
break;
case SPELL_ARC:
burn_freeze(powc, BEAM_ELECTRICITY);
break;
case SPELL_AIRSTRIKE:
airstrike(powc);
break;
case SPELL_ICE_STORM:
if (spell_direction(spd, beam) == -1)
return (false);
zapping(ZAP_ICE_STORM, powc, beam);
break;
case SPELL_SHADOW_CREATURES:
mpr( "Wisps of shadow whirl around you..." );
create_monster( RANDOM_MONSTER, ENCH_ABJ_II, BEH_FRIENDLY,
you.x_pos, you.y_pos, you.pet_target, 250 );
break;
//jmf: new spells 19mar2000
case SPELL_FLAME_TONGUE:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
}
zapping(ZAP_FLAME_TONGUE, powc, beam);
/*
// This is not the place for this sort of power adjustment,
// it just makes it harder to balance -- bwr
zapping(ZAP_FLAME_TONGUE, 2 + random2(4) + random2(4)
+ random2(powc) / 25, beam);
*/
break;
case SPELL_PASSWALL:
cast_passwall(powc);
break;
case SPELL_IGNITE_POISON:
cast_ignite_poison(powc);
break;
case SPELL_STICKS_TO_SNAKES:
cast_sticks_to_snakes(powc);
break;
case SPELL_SUMMON_LARGE_MAMMAL:
cast_summon_large_mammal(powc);
break;
case SPELL_SUMMON_DRAGON:
cast_summon_dragon(powc);
break;
case SPELL_TAME_BEASTS:
cast_tame_beasts(powc);
break;
case SPELL_SLEEP:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
}
zapping(ZAP_SLEEP, powc, beam);
break;
case SPELL_MASS_SLEEP:
cast_mass_sleep(powc);
break;
case SPELL_DETECT_MAGIC:
mpr("FIXME: implement!");
break;
case SPELL_DETECT_SECRET_DOORS:
cast_detect_secret_doors(powc);
break;
case SPELL_SEE_INVISIBLE:
cast_see_invisible(powc);
break;
case SPELL_FORESCRY:
cast_forescry(powc);
break;
case SPELL_SUMMON_BUTTERFLIES:
cast_summon_butterflies(powc);
break;
case SPELL_WARP_BRAND:
if (!brand_weapon(SPWPN_DISTORTION, powc))
canned_msg(MSG_SPELL_FIZZLES);
break;
case SPELL_SILENCE:
cast_silence(powc);
break;
case SPELL_SHATTER:
cast_shatter(powc);
break;
case SPELL_DISPERSAL:
cast_dispersal(powc);
break;
case SPELL_DISCHARGE:
cast_discharge(powc);
break;
case SPELL_BEND:
cast_bend(powc);
break;
case SPELL_BACKLIGHT:
if (spell_direction(spd, beam) == -1)
return (false);
if (spd.isMe)
{
canned_msg(MSG_UNTHINKING_ACT);
return (false);
}
zapping(ZAP_BACKLIGHT, powc + 10, beam);
break;
case SPELL_INTOXICATE:
cast_intoxicate(powc);
break;
case SPELL_GLAMOUR:
cast_glamour(powc);
break;
case SPELL_EVAPORATE:
cast_evaporate(powc);
break;
case SPELL_FULSOME_DISTILLATION:
cast_fulsome_distillation(powc);
break;
case SPELL_FRAGMENTATION:
cast_fragmentation(powc);
break;
case SPELL_AIR_WALK:
transform(powc, TRAN_AIR);
break;
case SPELL_SANDBLAST:
cast_sandblast(powc);
break;
case SPELL_ROTTING:
cast_rotting(powc);
break;
case SPELL_SHUGGOTH_SEED:
cast_shuggoth_seed(powc);
break;
case SPELL_CONDENSATION_SHIELD:
cast_condensation_shield(powc);
break;
case SPELL_SEMI_CONTROLLED_BLINK:
cast_semi_controlled_blink(powc); //jmf: powc is ignored
break;
case SPELL_STONESKIN:
cast_stoneskin(powc);
break;
case SPELL_SIMULACRUM:
simulacrum(powc);
break;
case SPELL_CONJURE_BALL_LIGHTNING:
cast_conjure_ball_lightning(powc);
break;
case SPELL_TWIST:
cast_twist(powc);
break;
case SPELL_FAR_STRIKE:
cast_far_strike(powc);
break;
case SPELL_SWAP:
cast_swap(powc);
break;
case SPELL_APPORTATION:
cast_apportation(powc);
break;
default:
mpr("Invalid spell!");
break;
} // end switch
return (true);
} // end you_spells()
void exercise_spell( int spell, bool spc, bool success )
{
// (!success) reduces skill increase for miscast spells
int ndx = 0;
int skill;
int workout = 0;
unsigned int disciplines = spell_type(spell);
//jmf: evil evil evil -- exclude HOLY bit
disciplines &= (~SPTYP_HOLY);
int skillcount = count_bits( disciplines );
if (!success)
skillcount += 4 + random2(10);
for (ndx = 0; ndx <= SPTYP_LAST_EXPONENT; ndx++)
{
if (!spell_typematch( spell, 1 << ndx ))
continue;
skill = spell_type2skill( 1 << ndx );
workout = (random2(1 + spell_difficulty(spell)) / skillcount);
if (!one_chance_in(5))
workout++; // most recently, this was an automatic add {dlb}
exercise( skill, workout );
}
/* ******************************************************************
Other recent formulae for the above:
* workout = random2(spell_difficulty(spell_ex)
* (10 + (spell_difficulty(spell_ex) * 2 )) / 10 / spellsy + 1);
* workout = spell_difficulty(spell_ex)
* (15 + spell_difficulty(spell_ex)) / 15 / spellsy;
spellcasting had also been generally exercised at the same time
****************************************************************** */
if (spc)
{
exercise(SK_SPELLCASTING, one_chance_in(3) ? 1
: random2(1 + random2(spell_difficulty(spell))));
}
//+ (coinflip() ? 1 : 0) + (skillcount ? 1 : 0));
/* ******************************************************************
3.02 was:
if ( spc && spellsy )
exercise(SK_SPELLCASTING, random2(random2(spell_difficulty(spell_ex) + 1) / spellsy)); // + 1);
else if ( spc )
exercise(SK_SPELLCASTING, random2(random2(spell_difficulty(spell_ex)))); // + 1);
****************************************************************** */
} // end exercise_spell()
/* This determines how likely it is that more powerful wild magic effects
* will occur. Set to 100 for the old probabilities (although the individual
* effects have been made much nastier since then).
*/
bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail,
int force_effect, const char *cause )
{
/* sp_type is the type of the spell
* mag_pow is overall power of the spell or effect (ie its level)
* mag_fail is the degree to which you failed
* force_effect forces a certain effect to occur. Currently unused.
*/
struct bolt beam;
bool failMsg = true;
int loopj = 0;
int spec_effect = 0;
int hurted = 0;
if (sp_type == SPTYP_RANDOM)
sp_type = 1 << (random2(12));
spec_effect = (mag_pow * mag_fail * (10 + mag_pow) / 7
* WILD_MAGIC_NASTINESS) / 100;
if (force_effect == 100
&& random2(40) > spec_effect && random2(40) > spec_effect)
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
}
// setup beam
beam.isTracer = false;
spec_effect = spec_effect / 100;
#if DEBUG_DIAGNOSTICS
const int old_fail = spec_effect;
#endif
spec_effect = random2(spec_effect);
if (spec_effect > 3)
spec_effect = 3;
else if (spec_effect < 0)
spec_effect = 0;
#if DEBUG_DIAGNOSTICS
snprintf( info, INFO_SIZE, "Sptype: %d, failure1: %d, failure2: %d",
sp_type, old_fail, spec_effect );
mpr( info, MSGCH_DIAGNOSTICS );
#endif
if (force_effect != 100)
spec_effect = force_effect;
switch (sp_type)
{
case SPTYP_CONJURATION:
switch (spec_effect)
{
case 0: // just a harmless message
switch (random2(10))
{
case 0:
snprintf( info, INFO_SIZE, "Sparks fly from your %s!",
your_hand(true) );
mpr(info);
break;
case 1:
mpr("The air around you crackles with energy!");
break;
case 2:
snprintf( info, INFO_SIZE, "Wisps of smoke drift from your %s.",
your_hand(true));
mpr(info);
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
mpr("You are momentarily dazzled by a flash of light!");
break;
case 5:
mpr("Strange energies run through your body.");
break;
case 6:
mpr("Your skin tingles.");
break;
case 7:
mpr("Your skin glows momentarily.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
// josh declares mummies cannot smell {dlb}
if (you.species != SP_MUMMY)
mpr("You smell something strange.");
else
mpr("Your bandages flutter.");
}
break;
case 1: // a bit less harmless stuff
switch (random2(2))
{
case 0:
snprintf( info, INFO_SIZE, "Smoke pours from your %s!",
your_hand(true));
mpr(info);
big_cloud( CLOUD_GREY_SMOKE, you.x_pos, you.y_pos, 20,
7 + random2(7) );
break;
case 1:
mpr("A wave of violent energy washes through your body!");
ouch(6 + random2avg(7, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
}
break;
case 2: // rather less harmless stuff
switch (random2(2))
{
case 0:
mpr("Energy rips through your body!");
ouch(9 + random2avg(17, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 1:
mpr("You are caught in a violent explosion!");
beam.type = SYM_BURST;
beam.damage = dice_def( 3, 12 );
beam.flavour = BEAM_MISSILE; // unsure about this
// BEAM_EXPLOSION instead? {dlb}
beam.target_x = you.x_pos;
beam.target_y = you.y_pos;
strcpy(beam.beam_name, "explosion");
beam.colour = random_colour();
beam.beam_source = NON_MONSTER;
beam.thrower = (cause) ? KILL_MISC : KILL_YOU;
beam.aux_source = cause;
beam.ex_size = 1;
explosion(beam);
break;
}
break;
case 3: // considerably less harmless stuff
switch (random2(2))
{
case 0:
mpr("You are blasted with magical energy!");
ouch(12 + random2avg(29, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 1:
mpr("There is a sudden explosion of magical energy!");
beam.type = SYM_BURST;
beam.damage = dice_def( 3, 20 );
beam.flavour = BEAM_MISSILE; // unsure about this
// BEAM_EXPLOSION instead? {dlb}
beam.target_x = you.x_pos;
beam.target_y = you.y_pos;
strcpy(beam.beam_name, "explosion");
beam.colour = random_colour();
beam.beam_source = NON_MONSTER;
beam.thrower = (cause) ? KILL_MISC : KILL_YOU;
beam.aux_source = cause;
beam.ex_size = coinflip()?1:2;
explosion(beam);
break;
}
break;
}
break; // end conjuration
case SPTYP_ENCHANTMENT:
switch (spec_effect)
{
case 0: // harmless messages only
switch (random2(10))
{
case 0:
snprintf( info, INFO_SIZE, "Your %s glow momentarily.",
your_hand(true) );
mpr(info);
break;
case 1:
mpr("The air around you crackles with energy!");
break;
case 2:
mpr("Multicolored lights dance before your eyes!");
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
mpr("Waves of light ripple over your body.");
break;
case 5:
mpr("Strange energies run through your body.");
break;
case 6:
mpr("Your skin tingles.");
break;
case 7:
mpr("Your skin glows momentarily.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear something strange.");
else if (you.attribute[ATTR_TRANSFORMATION] != TRAN_AIR)
mpr("Your skull vibrates slightly.");
else
canned_msg(MSG_NOTHING_HAPPENS);
break;
}
break;
case 1: // slightly annoying
switch (random2(2))
{
case 0:
potion_effect(POT_LEVITATION, 20);
break;
case 1:
random_uselessness(2 + random2(7), 0);
break;
}
break;
case 2: // much more annoying
switch (random2(7))
{
case 0:
case 1:
case 2:
mpr("You sense a malignant aura.");
curse_an_item(0, 0);
break;
case 3:
case 4:
case 5:
potion_effect(POT_SLOWING, 10);
break;
case 6:
potion_effect(POT_BERSERK_RAGE, 10);
break;
}
break;
case 3: // potentially lethal
switch (random2(4))
{
case 0:
do
{
curse_an_item(0, 0);
loopj = random2(3);
}
while (loopj != 0);
mpr("You sense an overwhelmingly malignant aura!");
break;
case 1:
potion_effect(POT_PARALYSIS, 10);
break;
case 2:
potion_effect(POT_CONFUSION, 10);
break;
case 3:
mpr("You feel saturated with unharnessed energies!");
you.magic_contamination += random2avg(19,3);
break;
}
break;
}
break; // end enchantments
case SPTYP_TRANSLOCATION:
switch (spec_effect)
{
case 0: // harmless messages only
switch (random2(10))
{
case 0:
mpr("Space warps around you.");
break;
case 1:
mpr("The air around you crackles with energy!");
break;
case 2:
mpr("You feel a wrenching sensation.");
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
mpr("You spin around.");
break;
case 5:
mpr("Strange energies run through your body.");
break;
case 6:
mpr("Your skin tingles.");
break;
case 7:
mpr("The world appears momentarily distorted!");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
mpr("You feel uncomfortable.");
break;
}
break;
case 1: // mostly harmless
switch (random2(6))
{
case 0:
case 1:
case 2:
mpr("You are caught in a localised field of spatial distortion.");
ouch(4 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 3:
case 4:
mpr("Space bends around you!");
random_blink(false);
ouch(4 + random2avg(7, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 5:
mpr("Space twists in upon itself!");
create_monster( MONS_SPATIAL_VORTEX, ENCH_ABJ_III, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250 );
break;
}
break;
case 2: // less harmless
switch (random2(7))
{
case 0:
case 1:
case 2:
mpr("You are caught in a strong localised spatial distortion.");
ouch(9 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 3:
case 4:
mpr("Space warps around you!");
if (one_chance_in(3))
you_teleport2( true );
else
random_blink( false );
ouch(5 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause);
potion_effect(POT_CONFUSION, 40);
break;
case 5:
mpr("Space twists in upon itself!");
for (loopj = 0; loopj < 2 + random2(3); loopj++)
{
create_monster( MONS_SPATIAL_VORTEX, ENCH_ABJ_III,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 );
}
break;
case 6:
mpr("You are cast into the Abyss!");
more();
banished(DNGN_ENTER_ABYSS); // sends you to the abyss
break;
}
break;
case 3: // much less harmless
switch (random2(4))
{
case 0:
mpr("You are caught in an extremely strong localised spatial distortion!");
ouch(15 + random2avg(29, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 1:
mpr("Space warps crazily around you!");
you_teleport2( true );
ouch(9 + random2avg(17, 2), 0, KILLED_BY_WILD_MAGIC, cause);
potion_effect(POT_CONFUSION, 60);
break;
case 2:
mpr("You are cast into the Abyss!");
more();
banished(DNGN_ENTER_ABYSS); // sends you to the abyss
break;
case 3:
mpr("You feel saturated with unharnessed energies!");
you.magic_contamination += random2avg(19,3);
break;
}
break;
}
break; // end translocations
case SPTYP_SUMMONING:
switch (spec_effect)
{
case 0: // harmless messages only
switch (random2(10))
{
case 0:
mpr("Shadowy shapes form in the air around you, then vanish.");
break;
case 1:
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear strange voices.");
else
mpr("You feel momentarily dizzy.");
break;
case 2:
mpr("Your head hurts.");
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
mpr("Your brain hurts!");
break;
case 5:
mpr("Strange energies run through your body.");
break;
case 6:
mpr("The world appears momentarily distorted.");
break;
case 7:
mpr("Space warps around you.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
mpr("Distant voices call out to you!");
break;
}
break;
case 1: // a little bad
switch (random2(6))
{
case 0: // identical to translocation
case 1:
case 2:
mpr("You are caught in a localised spatial distortion.");
ouch(5 + random2avg(9, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 3:
mpr("Space twists in upon itself!");
create_monster( MONS_SPATIAL_VORTEX, ENCH_ABJ_III, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250 );
break;
case 4:
case 5:
if (create_monster( summon_any_demon(DEMON_LESSER), ENCH_ABJ_V,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 ) != -1)
{
mpr("Something appears in a flash of light!");
}
break;
}
case 2: // more bad
switch (random2(6))
{
case 0:
mpr("Space twists in upon itself!");
for (loopj = 0; loopj < 2 + random2(3); loopj++)
{
create_monster( MONS_SPATIAL_VORTEX, ENCH_ABJ_III,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 );
}
break;
case 1:
case 2:
if (create_monster( summon_any_demon(DEMON_COMMON), ENCH_ABJ_V,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250) != -1)
{
mpr("Something forms out of thin air!");
}
break;
case 3:
case 4:
case 5:
mpr("A chorus of chattering voices calls out to you!");
create_monster( summon_any_demon(DEMON_LESSER), ENCH_ABJ_V,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 );
create_monster( summon_any_demon(DEMON_LESSER), ENCH_ABJ_V,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 );
if (coinflip())
{
create_monster( summon_any_demon(DEMON_LESSER), ENCH_ABJ_V,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 );
}
if (coinflip())
{
create_monster( summon_any_demon(DEMON_LESSER), ENCH_ABJ_V,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 );
}
break;
}
break;
case 3: // more bad
switch (random2(4))
{
case 0:
if (create_monster( MONS_ABOMINATION_SMALL, 0, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250 ) != -1)
{
mpr("Something forms out of thin air.");
}
break;
case 1:
if (create_monster( summon_any_demon(DEMON_GREATER), 0,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 ) != -1)
{
mpr("You sense a hostile presence.");
}
break;
case 2:
mpr("Something turns its malign attention towards you...");
create_monster( summon_any_demon(DEMON_COMMON), ENCH_ABJ_III,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250 );
create_monster( summon_any_demon(DEMON_COMMON), ENCH_ABJ_III,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250);
if (coinflip())
{
create_monster(summon_any_demon(DEMON_COMMON), ENCH_ABJ_III,
BEH_HOSTILE, you.x_pos, you.y_pos,
MHITYOU, 250);
}
break;
case 3:
mpr("You are cast into the Abyss!");
banished(DNGN_ENTER_ABYSS);
break;
}
break;
} // end Summonings
break;
case SPTYP_DIVINATION:
switch (spec_effect)
{
case 0: // just a harmless message
switch (random2(10))
{
case 0:
mpr("Weird images run through your mind.");
break;
case 1:
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear strange voices.");
else
mpr("Your nose twitches.");
break;
case 2:
mpr("Your head hurts.");
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
mpr("Your brain hurts!");
break;
case 5:
mpr("Strange energies run through your body.");
break;
case 6:
mpr("Everything looks hazy for a moment.");
break;
case 7:
mpr("You seem to have forgotten something, but you can't remember what it was!");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
mpr("You feel uncomfortable.");
break;
}
break;
case 1: // more annoying things
switch (random2(2))
{
case 0:
mpr("You feel slightly disoriented.");
forget_map(10 + random2(10));
break;
case 1:
potion_effect(POT_CONFUSION, 10);
break;
}
break;
case 2: // even more annoying things
switch (random2(2))
{
case 0:
if (you.is_undead)
mpr("You suddenly recall your previous life!");
else if (lose_stat(STAT_INTELLIGENCE, 1 + random2(3)))
mpr("You have damaged your brain!");
else
mpr("You have a terrible headache.");
break;
case 1:
mpr("You feel lost.");
forget_map(40 + random2(40));
break;
}
potion_effect(POT_CONFUSION, 1); // common to all cases here {dlb}
break;
case 3: // nasty
switch (random2(3))
{
case 0:
mpr( forget_spell() ? "You have forgotten a spell!"
: "You get a splitting headache." );
break;
case 1:
mpr("You feel completely lost.");
forget_map(100);
break;
case 2:
if (you.is_undead)
mpr("You suddenly recall your previous life.");
else if (lose_stat(STAT_INTELLIGENCE, 3 + random2(3)))
mpr("You have damaged your brain!");
else
mpr("You have a terrible headache.");
break;
}
potion_effect(POT_CONFUSION, 1); // common to all cases here {dlb}
break;
}
break; // end divinations
case SPTYP_NECROMANCY:
if (you.religion == GOD_KIKUBAAQUDGHA
&& (!player_under_penance() && you.piety >= 50
&& random2(150) <= you.piety))
{
canned_msg(MSG_NOTHING_HAPPENS);
break;
}
switch (spec_effect)
{
case 0:
switch (random2(10))
{
case 0:
// mummies cannot smell {dlb}
if (you.species != SP_MUMMY)
mpr("You smell decay.");
break;
case 1:
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear strange and distant voices.");
else
mpr("You feel homesick.");
break;
case 2:
mpr("Pain shoots through your body.");
break;
case 3:
mpr("Your bones ache.");
break;
case 4:
mpr("The world around you seems to dim momentarily.");
break;
case 5:
mpr("Strange energies run through your body.");
break;
case 6:
mpr("You shiver with cold.");
break;
case 7:
mpr("You sense a malignant aura.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
mpr("You feel very uncomfortable.");
break;
}
break;
case 1: // a bit nasty
switch (random2(3))
{
case 0:
if (you.is_undead)
{
mpr("You feel weird for a moment.");
break;
}
mpr("Pain shoots through your body!");
ouch(5 + random2avg(15, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 1:
mpr("You feel horribly lethargic.");
potion_effect(POT_SLOWING, 15);
break;
case 2:
// josh declares mummies cannot smell {dlb}
if (you.species != SP_MUMMY)
{
mpr("You smell decay."); // identical to a harmless message
you.rotting++;
}
break;
}
break;
case 2: // much nastier
switch (random2(3))
{
case 0:
mpr("Flickering shadows surround you.");
create_monster( MONS_SHADOW, ENCH_ABJ_II, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250 );
if (coinflip())
{
create_monster( MONS_SHADOW, ENCH_ABJ_II, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250 );
}
if (coinflip())
{
create_monster( MONS_SHADOW, ENCH_ABJ_II, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250 );
}
break;
case 1:
if (!player_prot_life() && one_chance_in(3))
{
drain_exp();
break;
} // otherwise it just flows through...
case 2:
if (you.is_undead)
{
mpr("You feel weird for a moment.");
break;
}
mpr("You convulse helplessly as pain tears through your body!");
ouch(15 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
}
break;
case 3: // even nastier
switch (random2(6))
{
case 0:
if (you.is_undead)
{
mpr("Something just walked over your grave. No, really!");
break;
}
mpr("Your body is wracked with pain!");
dec_hp((you.hp / 2) - 1, false);
break;
case 1:
mpr("You are engulfed in negative energy!");
if (!player_prot_life())
{
drain_exp();
break;
} // otherwise it just flows through...
case 2:
lose_stat(STAT_RANDOM, 1 + random2avg(7, 2));
break;
case 3:
if (you.is_undead)
{
mpr("You feel terrible.");
break;
}
rot_player( random2avg(7, 2) + 1 );
break;
case 4:
if (create_monster( MONS_SOUL_EATER, ENCH_ABJ_IV, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250) != -1)
{
mpr("Something reaches out for you...");
}
break;
case 5:
if (create_monster( MONS_REAPER, ENCH_ABJ_IV, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250) != -1)
{
mpr("Death has come for you...");
}
break;
}
break;
}
break; // end necromancy
case SPTYP_TRANSMIGRATION:
switch (spec_effect)
{
case 0: // just a harmless message
switch (random2(10))
{
case 0:
snprintf( info, INFO_SIZE, "Your %s glow momentarily.",
your_hand(true));
mpr(info);
break;
case 1:
mpr("The air around you crackles with energy!");
break;
case 2:
mpr("Multicolored lights dance before your eyes!");
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
mpr("Waves of light ripple over your body.");
break;
case 5:
mpr("Strange energies run through your body.");
break;
case 6:
mpr("Your skin tingles.");
break;
case 7:
mpr("Your skin glows momentarily.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
// mummies cannot smell
if (you.species != SP_MUMMY)
mpr("You smell something strange.");
break;
}
break;
case 1: // slightly annoying
switch (random2(2))
{
case 0:
mpr("Your body is twisted painfully.");
ouch(1 + random2avg(11, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 1:
random_uselessness(2 + random2(7), 0);
break;
}
break;
case 2: // much more annoying
switch (random2(4))
{
case 0:
mpr("Your body is twisted very painfully!");
ouch(3 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 1:
mpr("You feel saturated with unharnessed energies!");
you.magic_contamination += random2avg(19,3);
break;
case 2:
potion_effect(POT_PARALYSIS, 10);
break;
case 3:
potion_effect(POT_CONFUSION, 10);
break;
}
break;
case 3: // even nastier
switch (random2(3))
{
case 0:
mpr("Your body is flooded with distortional energies!");
you.magic_contamination += random2avg(35, 3);
ouch(3 + random2avg(18, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 1:
mpr("You feel very strange.");
delete_mutation(100);
ouch(5 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
case 2:
mpr("Your body is distorted in a weirdly horrible way!");
failMsg = !give_bad_mutation();
if (coinflip())
give_bad_mutation(false, failMsg);
ouch(5 + random2avg(23, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
}
break;
}
break; // end transmigrations
case SPTYP_FIRE:
switch (spec_effect)
{
case 0: // just a harmless message
switch (random2(10))
{
case 0:
snprintf( info, INFO_SIZE, "Sparks fly from your %s!",
your_hand(true));
mpr(info);
break;
case 1:
mpr("The air around you burns with energy!");
break;
case 2:
snprintf( info, INFO_SIZE, "Wisps of smoke drift from your %s.",
your_hand(true));
mpr(info);
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
// mummies cannot smell
if (you.species != SP_MUMMY)
mpr("You smell smoke.");
break;
case 5:
mpr("Heat runs through your body.");
break;
case 6:
mpr("You feel uncomfortably hot.");
break;
case 7:
mpr("Lukewarm flames ripple over your body.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear a sizzling sound.");
else
mpr("You feel like you have heartburn.");
break;
}
break;
case 1: // a bit less harmless stuff
switch (random2(2))
{
case 0:
snprintf( info, INFO_SIZE, "Smoke pours from your %s!",
your_hand(true) );
mpr(info);
big_cloud( CLOUD_GREY_SMOKE + random2(3),
you.x_pos, you.y_pos, 20, 7 + random2(7) );
break;
case 1:
mpr("Flames sear your flesh.");
scrolls_burn(3, OBJ_SCROLLS);
if (player_res_fire() < 0)
{
ouch(2 + random2avg(13, 2), 0, KILLED_BY_WILD_MAGIC, cause);
}
break;
}
break;
case 2: // rather less harmless stuff
switch (random2(2))
{
case 0:
mpr("You are blasted with fire.");
ouch( check_your_resists( 5 + random2avg(29, 2), 2 ), 0,
KILLED_BY_WILD_MAGIC, cause );
scrolls_burn( 5, OBJ_SCROLLS );
break;
case 1:
mpr("You are caught a fiery explosion!");
beam.type = SYM_BURST;
beam.damage = dice_def( 3, 14 );
beam.flavour = BEAM_FIRE;
beam.target_x = you.x_pos;
beam.target_y = you.y_pos;
strcpy(beam.beam_name, "explosion");
beam.colour = RED;
beam.beam_source = NON_MONSTER;
beam.thrower = (cause) ? KILL_MISC : KILL_YOU;
beam.aux_source = cause;
beam.ex_size = 1;
explosion(beam);
break;
}
break;
case 3: // considerably less harmless stuff
switch (random2(3))
{
case 0:
mpr("You are blasted with searing flames!");
ouch( check_your_resists( 9 + random2avg(33, 2), 2 ), 0,
KILLED_BY_WILD_MAGIC, cause );
scrolls_burn( 10, OBJ_SCROLLS );
break;
case 1:
mpr("There is a sudden and violent explosion of flames!");
beam.type = SYM_BURST;
beam.damage = dice_def( 3, 20 );
beam.flavour = BEAM_FIRE;
beam.target_x = you.x_pos;
beam.target_y = you.y_pos;
strcpy( beam.beam_name, "fireball" );
beam.colour = RED;
beam.beam_source = NON_MONSTER;
beam.thrower = (cause) ? KILL_MISC : KILL_YOU;
beam.aux_source = cause;
beam.ex_size = coinflip()?1:2;
explosion(beam);
break;
case 2:
mpr("You are covered in liquid fire!");
you.duration[DUR_LIQUID_FLAMES] += random2avg(7, 3) + 1;
break;
}
break;
}
break; // end fire
case SPTYP_ICE:
switch (spec_effect)
{
case 0: // just a harmless message
switch (random2(10))
{
case 0:
mpr("You shiver with cold.");
break;
case 1:
mpr("A chill runs through your body.");
break;
case 2:
snprintf( info, INFO_SIZE, "Wisps of condensation drift from your %s.",
your_hand(true));
mpr(info);
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
snprintf( info, INFO_SIZE,"Your %s feel numb with cold.",
your_hand(true));
mpr(info);
break;
case 5:
mpr("A chill runs through your body.");
break;
case 6:
mpr("You feel uncomfortably cold.");
break;
case 7:
mpr("Frost covers your body.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear a crackling sound.");
else
mpr("A snowflake lands on your nose.");
break;
}
break;
case 1: // a bit less harmless stuff
switch (random2(2))
{
case 0:
mpr("You feel extremely cold.");
break;
case 1:
mpr("You are covered in a thin layer of ice");
scrolls_burn(2, OBJ_POTIONS);
if (player_res_cold() < 0)
ouch(4 + random2avg(5, 2), 0, KILLED_BY_WILD_MAGIC, cause);
break;
}
break;
case 2: // rather less harmless stuff
switch (random2(2))
{
case 0:
mpr("Heat is drained from your body.");
ouch(check_your_resists(5 + random2(6) + random2(7), 3), 0,
KILLED_BY_WILD_MAGIC, cause);
scrolls_burn(4, OBJ_POTIONS);
break;
case 1:
mpr("You are caught in an explosion of ice and frost!");
beam.type = SYM_BURST;
beam.damage = dice_def( 3, 11 );
beam.flavour = BEAM_COLD;
beam.target_x = you.x_pos;
beam.target_y = you.y_pos;
strcpy(beam.beam_name, "explosion");
beam.colour = WHITE;
beam.beam_source = NON_MONSTER;
beam.thrower = (cause) ? KILL_MISC : KILL_YOU;
beam.aux_source = cause;
beam.ex_size = 1;
explosion(beam);
break;
}
break;
case 3: // less harmless stuff
switch (random2(2))
{
case 0:
mpr("You are blasted with ice!");
ouch(check_your_resists(9 + random2avg(23, 2), 3), 0,
KILLED_BY_WILD_MAGIC, cause);
scrolls_burn(9, OBJ_POTIONS);
break;
case 1:
snprintf( info, INFO_SIZE,"Freezing gasses pour from your %s!",
your_hand(true));
mpr(info);
big_cloud(CLOUD_COLD, you.x_pos, you.y_pos, 20,
8 + random2(4));
break;
}
break;
}
break; // end ice
case SPTYP_EARTH:
switch (spec_effect)
{
case 0: // just a harmless message
case 1:
switch (random2(10))
{
case 0:
mpr("You feel earthy.");
break;
case 1:
mpr("You are showered with tiny particles of grit.");
break;
case 2:
snprintf( info, INFO_SIZE,"Sand pours from your %s.",
your_hand(true));
mpr(info);
break;
case 3:
mpr("You feel a surge of energy from the ground.");
break;
case 4:
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear a distant rumble.");
else
mpr("You sympathise with the stones.");
break;
case 5:
mpr("You feel gritty.");
break;
case 6:
mpr("You feel momentarily lethargic.");
break;
case 7:
mpr("Motes of dust swirl before your eyes.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
strcpy(info, "Your ");
strcat(info, (you.species == SP_NAGA) ? "underbelly feels" :
(you.species == SP_CENTAUR) ? "hooves feel"
: "feet feel");
strcat(info, " warm.");
mpr(info);
break;
}
break;
case 2: // slightly less harmless stuff
switch (random2(1))
{
case 0:
switch (random2(3))
{
case 0:
mpr("You are hit by flying rocks!");
break;
case 1:
mpr("You are blasted with sand!");
break;
case 2:
mpr("Rocks fall onto you out of nowhere!");
break;
}
hurted = random2avg(13, 2) + 10;
hurted -= random2(1 + player_AC());
ouch(hurted, 0, KILLED_BY_WILD_MAGIC, cause);
break;
}
break;
case 3: // less harmless stuff
switch (random2(1))
{
case 0:
mpr("You are caught in an explosion of flying shrapnel!");
beam.type = SYM_BURST;
beam.damage = dice_def( 3, 15 );
beam.flavour = BEAM_FRAG;
beam.target_x = you.x_pos;
beam.target_y = you.y_pos;
strcpy(beam.beam_name, "explosion");
beam.colour = CYAN;
if (one_chance_in(5))
beam.colour = BROWN;
if (one_chance_in(5))
beam.colour = LIGHTCYAN;
beam.beam_source = NON_MONSTER;
beam.thrower = (cause) ? KILL_MISC : KILL_YOU;
beam.aux_source = cause;
beam.ex_size = 1;
explosion(beam);
break;
}
break;
}
break; // end Earth
case SPTYP_AIR:
switch (spec_effect)
{
case 0: // just a harmless message
switch (random2(10))
{
case 0:
mpr("Ouch! You gave yourself an electric shock.");
break;
case 1:
mpr("You feel momentarily weightless.");
break;
case 2:
snprintf( info, INFO_SIZE, "Wisps of vapour drift from your %s.",
your_hand(true));
mpr(info);
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
mpr("You feel electric!");
break;
case 5:
snprintf( info, INFO_SIZE, "Sparks of electricity dance between your %s.",
your_hand(true));
mpr(info);
break;
case 6:
mpr("You are blasted with air!");
break;
case 7:
// mummies cannot smell
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear a whooshing sound.");
else if (you.species != SP_MUMMY)
mpr("You smell ozone.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
// mummies cannot smell
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear a crackling sound.");
else if (you.species != SP_MUMMY)
mpr("You smell something musty.");
break;
}
break;
case 1: // a bit less harmless stuff
switch (random2(2))
{
case 0:
mpr("There is a short, sharp shower of sparks.");
break;
case 1:
snprintf( info, INFO_SIZE, "The wind %s around you!",
silenced(you.x_pos, you.y_pos) ? "whips" : "howls");
mpr(info);
break;
}
break;
case 2: // rather less harmless stuff
switch (random2(2))
{
case 0:
mpr("Electricity courses through your body.");
ouch(check_your_resists(4 + random2avg(9, 2), 5), 0,
KILLED_BY_WILD_MAGIC, cause);
break;
case 1:
snprintf( info, INFO_SIZE, "Noxious gasses pour from your %s!",
your_hand(true));
mpr(info);
big_cloud(CLOUD_STINK, you.x_pos, you.y_pos, 20,
9 + random2(4));
break;
}
break;
case 3: // less harmless stuff
switch (random2(2))
{
case 0:
mpr("You are caught in an explosion of electrical discharges!");
beam.type = SYM_BURST;
beam.damage = dice_def( 3, 8 );
beam.flavour = BEAM_ELECTRICITY;
beam.target_x = you.x_pos;
beam.target_y = you.y_pos;
strcpy(beam.beam_name, "explosion");
beam.colour = LIGHTBLUE;
beam.beam_source = NON_MONSTER;
beam.thrower = (cause) ? KILL_MISC : KILL_YOU;
beam.aux_source = cause;
beam.ex_size = one_chance_in(4)?1:2;
explosion(beam);
break;
case 1:
snprintf( info, INFO_SIZE, "Venomous gasses pour from your %s!",
your_hand(true));
mpr(info);
big_cloud( CLOUD_POISON, you.x_pos, you.y_pos, 20,
8 + random2(5) );
break;
}
break;
}
break; // end air
case SPTYP_POISON:
switch (spec_effect)
{
case 0: // just a harmless message
switch (random2(10))
{
case 0:
mpr("You feel mildly nauseous.");
break;
case 1:
mpr("You feel slightly ill.");
break;
case 2:
snprintf( info, INFO_SIZE, "Wisps of poison gas drift from your %s.",
your_hand(true) );
mpr(info);
break;
case 3:
mpr("You feel a strange surge of energy!");
break;
case 4:
mpr("You feel faint for a moment.");
break;
case 5:
mpr("You feel sick.");
break;
case 6:
mpr("You feel odd.");
break;
case 7:
mpr("You feel weak for a moment.");
break;
case 8:
canned_msg(MSG_NOTHING_HAPPENS);
break;
case 9:
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear a slurping sound.");
else if (you.species != SP_MUMMY)
mpr("You taste almonds.");
break;
}
break;
case 1: // a bit less harmless stuff
switch (random2(2))
{
case 0:
if (player_res_poison())
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
}
mpr("You feel sick.");
poison_player( 2 + random2(3) );
break;
case 1:
snprintf( info, INFO_SIZE, "Noxious gasses pour from your %s!",
your_hand(true) );
mpr(info);
place_cloud(CLOUD_STINK, you.x_pos, you.y_pos,
2 + random2(4));
break;
}
break;
case 2: // rather less harmless stuff
switch (random2(3))
{
case 0:
if (player_res_poison())
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
}
mpr("You feel very sick.");
poison_player( 3 + random2avg(9, 2) );
break;
case 1:
mpr("Noxious gasses pour from your hands!");
big_cloud(CLOUD_STINK, you.x_pos, you.y_pos, 20,
8 + random2(5));
break;
case 2:
if (player_res_poison())
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
}
lose_stat(STAT_RANDOM, 1);
break;
}
break;
case 3: // less harmless stuff
switch (random2(3))
{
case 0:
if (player_res_poison())
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
}
mpr("You feel incredibly sick.");
poison_player( 10 + random2avg(19, 2) );
break;
case 1:
snprintf( info, INFO_SIZE, "Venomous gasses pour from your %s!",
your_hand(true));
mpr(info);
big_cloud(CLOUD_POISON, you.x_pos, you.y_pos, 20,
7 + random2(7));
break;
case 2:
if (player_res_poison())
{
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
}
lose_stat(STAT_RANDOM, 1 + random2avg(5, 2));
break;
}
break;
}
break; // end poison
}
return (true);
} // end miscast_effect()
|