| 1916 | } |
| 1917 | |
| 1918 | staticfn void |
| 1919 | seffect_earth(struct obj **sobjp) |
| 1920 | { |
| 1921 | struct obj *sobj = *sobjp; |
| 1922 | boolean sblessed = sobj->blessed; |
| 1923 | boolean scursed = sobj->cursed; |
| 1924 | boolean confused = (Confusion != 0); |
| 1925 | |
| 1926 | /* TODO: handle steeds */ |
| 1927 | if (!Is_rogue_level(&u.uz) && has_ceiling(&u.uz) |
| 1928 | && (!In_endgame(&u.uz) || Is_earthlevel(&u.uz))) { |
| 1929 | coordxy x, y; |
| 1930 | int nboulders = 0; |
| 1931 | |
| 1932 | /* Identify the scroll */ |
| 1933 | if (u.uswallow) { |
| 1934 | You_hear("rumbling."); |
| 1935 | } else { |
| 1936 | if (!avoid_ceiling(&u.uz)) { |
| 1937 | pline_The("%s rumbles %s you!", ceiling(u.ux, u.uy), |
| 1938 | sblessed ? "around" : "above"); |
| 1939 | } else { |
| 1940 | char matbuf[BUFSZ]; |
| 1941 | const char *const avalanche = "avalanche"; |
| 1942 | |
| 1943 | Sprintf(matbuf, "%s", |
| 1944 | sblessed ? makeplural(avalanche) : an(avalanche)); |
| 1945 | pline("%s of boulders %s %s you!", |
| 1946 | upstart(matbuf), vtense(matbuf, "materialize"), |
| 1947 | sblessed ? "around" : "above"); |
| 1948 | } |
| 1949 | } |
| 1950 | gk.known = 1; |
| 1951 | sokoban_guilt(); |
| 1952 | |
| 1953 | /* Loop through the surrounding squares */ |
| 1954 | if (!scursed) |
| 1955 | for (x = u.ux - 1; x <= u.ux + 1; x++) { |
| 1956 | for (y = u.uy - 1; y <= u.uy + 1; y++) { |
| 1957 | /* Is this a suitable spot? */ |
| 1958 | if (isok(x, y) && !closed_door(x, y) |
| 1959 | && !IS_OBSTRUCTED(levl[x][y].typ) |
| 1960 | && !IS_AIR(levl[x][y].typ) |
| 1961 | && (x != u.ux || y != u.uy)) { |
| 1962 | nboulders += |
| 1963 | drop_boulder_on_monster(x, y, confused, TRUE); |
| 1964 | } |
| 1965 | } |
| 1966 | } |
| 1967 | /* Attack the player */ |
| 1968 | if (!sblessed) { |
| 1969 | drop_boulder_on_player(confused, !scursed, TRUE, FALSE); |
| 1970 | } else if (!nboulders) |
| 1971 | pline("But nothing else happens."); |
| 1972 | } |
| 1973 | } |
| 1974 | |
| 1975 | staticfn void |
no test coverage detected