| 1847 | } |
| 1848 | |
| 1849 | staticfn void |
| 1850 | seffect_fire(struct obj **sobjp) |
| 1851 | { |
| 1852 | struct obj *sobj = *sobjp; |
| 1853 | int otyp = sobj->otyp; |
| 1854 | boolean sblessed = sobj->blessed; |
| 1855 | boolean confused = (Confusion != 0); |
| 1856 | boolean already_known = (sobj->oclass == SPBOOK_CLASS /* spell */ |
| 1857 | || objects[otyp].oc_name_known); |
| 1858 | coord cc; |
| 1859 | int dam, cval; |
| 1860 | |
| 1861 | cc.x = u.ux; |
| 1862 | cc.y = u.uy; |
| 1863 | cval = bcsign(sobj); |
| 1864 | dam = (2 * (rn1(3, 3) + 2 * cval) + 1) / 3; |
| 1865 | useup(sobj); |
| 1866 | *sobjp = 0; /* it's gone */ |
| 1867 | if (!already_known) |
| 1868 | (void) learnscrolltyp(SCR_FIRE); |
| 1869 | if (confused) { |
| 1870 | if (Underwater) { |
| 1871 | pline("A little %s around you vaporizes.", hliquid("water")); |
| 1872 | } |
| 1873 | else if (Fire_resistance) { |
| 1874 | shieldeff(u.ux, u.uy); |
| 1875 | monstseesu(M_SEEN_FIRE); |
| 1876 | if (!Blind) |
| 1877 | pline("Oh, look, what a pretty fire in your %s.", |
| 1878 | makeplural(body_part(HAND))); |
| 1879 | else |
| 1880 | You_feel("a pleasant warmth in your %s.", |
| 1881 | makeplural(body_part(HAND))); |
| 1882 | } else { |
| 1883 | monstunseesu(M_SEEN_FIRE); |
| 1884 | pline_The("scroll catches fire and you burn your %s.", |
| 1885 | makeplural(body_part(HAND))); |
| 1886 | losehp(1, "scroll of fire", KILLED_BY_AN); |
| 1887 | } |
| 1888 | return; |
| 1889 | } |
| 1890 | if (Underwater) { |
| 1891 | pline_The("%s around you vaporizes violently!", hliquid("water")); |
| 1892 | } else { |
| 1893 | if (sblessed) { |
| 1894 | if (!already_known) |
| 1895 | pline("This is a scroll of fire!"); |
| 1896 | dam *= 5; |
| 1897 | pline("Where do you want to center the explosion?"); |
| 1898 | getpos_sethilite(display_stinking_cloud_positions, |
| 1899 | can_center_cloud); |
| 1900 | (void) getpos(&cc, TRUE, "the desired position"); |
| 1901 | if (!can_center_cloud(cc.x, cc.y)) { |
| 1902 | /* try to reach too far, get burned */ |
| 1903 | cc.x = u.ux; |
| 1904 | cc.y = u.uy; |
| 1905 | } |
| 1906 | } |
no test coverage detected