called when you're hit by fire (dofiretrap,buzz,zapyourself,explode); returns TRUE if hit on torso */
| 85 | /* called when you're hit by fire (dofiretrap,buzz,zapyourself,explode); |
| 86 | returns TRUE if hit on torso */ |
| 87 | boolean |
| 88 | burnarmor(struct monst *victim) |
| 89 | { |
| 90 | struct obj *item; |
| 91 | char buf[BUFSZ]; |
| 92 | int mat_idx, oldspe; |
| 93 | boolean hitting_u; |
| 94 | |
| 95 | if (!victim) |
| 96 | return 0; |
| 97 | hitting_u = (victim == &gy.youmonst); |
| 98 | |
| 99 | /* burning damage may dry wet towel */ |
| 100 | item = hitting_u ? carrying(TOWEL) : m_carrying(victim, TOWEL); |
| 101 | while (item) { |
| 102 | if (is_wet_towel(item)) { /* True => (item->spe > 0) */ |
| 103 | oldspe = item->spe; |
| 104 | dry_a_towel(item, rn2(oldspe + 1), TRUE); |
| 105 | if (item->spe != oldspe) |
| 106 | break; /* stop once one towel has been affected */ |
| 107 | } |
| 108 | item = item->nobj; |
| 109 | } |
| 110 | |
| 111 | #define burn_dmg(obj, descr) erode_obj(obj, descr, ERODE_BURN, EF_GREASE) |
| 112 | while (1) { |
| 113 | switch (rn2(5)) { |
| 114 | case 0: |
| 115 | item = hitting_u ? uarmh : which_armor(victim, W_ARMH); |
| 116 | if (item) { |
| 117 | mat_idx = objects[item->otyp].oc_material; |
| 118 | Sprintf(buf, "%s %s", materialnm[mat_idx], |
| 119 | helm_simple_name(item)); |
| 120 | } |
| 121 | if (!burn_dmg(item, item ? buf : "helmet")) |
| 122 | continue; |
| 123 | break; |
| 124 | case 1: |
| 125 | item = hitting_u ? uarmc : which_armor(victim, W_ARMC); |
| 126 | if (item) { |
| 127 | (void) burn_dmg(item, cloak_simple_name(item)); |
| 128 | return TRUE; |
| 129 | } |
| 130 | item = hitting_u ? uarm : which_armor(victim, W_ARM); |
| 131 | if (item) { |
| 132 | (void) burn_dmg(item, xname(item)); |
| 133 | return TRUE; |
| 134 | } |
| 135 | item = hitting_u ? uarmu : which_armor(victim, W_ARMU); |
| 136 | if (item) |
| 137 | (void) burn_dmg(item, "shirt"); |
| 138 | return TRUE; |
| 139 | case 2: |
| 140 | item = hitting_u ? uarms : which_armor(victim, W_ARMS); |
| 141 | if (!burn_dmg(item, "wooden shield")) |
| 142 | continue; |
| 143 | break; |
| 144 | case 3: |
no test coverage detected