TRUE: book should be destroyed by caller */
| 127 | |
| 128 | /* TRUE: book should be destroyed by caller */ |
| 129 | staticfn boolean |
| 130 | cursed_book(struct obj *bp) |
| 131 | { |
| 132 | boolean was_in_use; |
| 133 | int lev = objects[bp->otyp].oc_level; |
| 134 | int dmg = 0; |
| 135 | |
| 136 | switch (rn2(lev)) { |
| 137 | case 0: |
| 138 | You_feel("a wrenching sensation."); |
| 139 | tele(); /* teleport him */ |
| 140 | break; |
| 141 | case 1: |
| 142 | You_feel("threatened."); |
| 143 | aggravate(); |
| 144 | break; |
| 145 | case 2: |
| 146 | make_blinded(BlindedTimeout + rn1(100, 250), TRUE); |
| 147 | break; |
| 148 | case 3: |
| 149 | take_gold(); |
| 150 | break; |
| 151 | case 4: |
| 152 | pline("These runes were just too much to comprehend."); |
| 153 | make_confused(HConfusion + rn1(7, 16), FALSE); |
| 154 | break; |
| 155 | case 5: |
| 156 | pline_The("book was coated with contact poison!"); |
| 157 | if (uarmg) { |
| 158 | erode_obj(uarmg, "gloves", ERODE_CORRODE, EF_GREASE | EF_VERBOSE); |
| 159 | break; |
| 160 | } |
| 161 | /* temp disable in_use; death should not destroy the book */ |
| 162 | was_in_use = bp->in_use; |
| 163 | bp->in_use = FALSE; |
| 164 | poison_strdmg(Poison_resistance ? rn1(2, 1) : rn1(4, 3), |
| 165 | rnd(Poison_resistance ? 6 : 10), |
| 166 | "contact-poisoned spellbook", KILLED_BY_AN); |
| 167 | bp->in_use = was_in_use; |
| 168 | break; |
| 169 | case 6: |
| 170 | if (Antimagic) { |
| 171 | shieldeff(u.ux, u.uy); |
| 172 | pline_The("book %s, but you are unharmed!", explodes); |
| 173 | } else { |
| 174 | pline("As you read the book, it %s in your %s!", explodes, |
| 175 | body_part(FACE)); |
| 176 | dmg = 2 * rnd(10) + 5; |
| 177 | losehp(Maybe_Half_Phys(dmg), "exploding rune", KILLED_BY_AN); |
| 178 | } |
| 179 | return TRUE; |
| 180 | default: |
| 181 | rndcurse(); |
| 182 | break; |
| 183 | } |
| 184 | return FALSE; |
| 185 | } |
| 186 |
no test coverage detected