| 1844 | } |
| 1845 | |
| 1846 | void |
| 1847 | do_storms(void) |
| 1848 | { |
| 1849 | int nstrike; |
| 1850 | int x, y; |
| 1851 | int dirx, diry; |
| 1852 | int count; |
| 1853 | |
| 1854 | /* no lightning if not stormy level or too often, even then */ |
| 1855 | if (!svl.level.flags.stormy || rn2(8)) |
| 1856 | return; |
| 1857 | |
| 1858 | /* the number of strikes is 8-log2(nstrike) */ |
| 1859 | for (nstrike = rnd(64); nstrike <= 64; nstrike *= 2) { |
| 1860 | count = 0; |
| 1861 | do { |
| 1862 | x = rnd(COLNO - 1); |
| 1863 | y = rn2(ROWNO); |
| 1864 | } while (++count < 100 && levl[x][y].typ != CLOUD); |
| 1865 | |
| 1866 | if (count < 100) { |
| 1867 | dirx = rn2(3) - 1; |
| 1868 | diry = rn2(3) - 1; |
| 1869 | if (dirx != 0 || diry != 0) { |
| 1870 | /* BZ_M_SPELL(BZ_OFS_AD(AD_ELEC)): monster LIGHTNING spell */ |
| 1871 | gb.buzzer = 0; /* unspecified attacker */ |
| 1872 | buzz(BZ_M_SPELL(BZ_OFS_AD(AD_ELEC)), 8, x, y, dirx, diry); |
| 1873 | } |
| 1874 | } |
| 1875 | } |
| 1876 | |
| 1877 | if (levl[u.ux][u.uy].typ == CLOUD) { |
| 1878 | /* Inside a cloud during a thunderstorm is deafening. */ |
| 1879 | /* Even if already deaf, we sense the thunder's vibrations. */ |
| 1880 | Soundeffect(se_kaboom_boom_boom, 80); |
| 1881 | pline("Kaboom!!! Boom!! Boom!!"); |
| 1882 | incr_itimeout(&HDeaf, rn1(20, 30)); |
| 1883 | disp.botl = TRUE; |
| 1884 | if (!u.uinvulnerable) { |
| 1885 | stop_occupation(); |
| 1886 | nomul(-3); |
| 1887 | gm.multi_reason = "hiding from thunderstorm"; |
| 1888 | gn.nomovemsg = 0; |
| 1889 | } |
| 1890 | } else |
| 1891 | You_hear("a rumbling noise."); |
| 1892 | } |
| 1893 | |
| 1894 | /* ------------------------------------------------------------------------- |
| 1895 | */ |
no test coverage detected