| 1112 | } |
| 1113 | |
| 1114 | staticfn void |
| 1115 | seffect_enchant_armor(struct obj **sobjp) |
| 1116 | { |
| 1117 | struct obj *sobj = *sobjp; |
| 1118 | schar s; |
| 1119 | boolean special_armor; |
| 1120 | boolean same_color; |
| 1121 | struct obj *otmp = some_armor(&gy.youmonst); |
| 1122 | boolean sblessed = sobj->blessed; |
| 1123 | boolean scursed = sobj->cursed; |
| 1124 | boolean confused = (Confusion != 0); |
| 1125 | boolean old_erodeproof, new_erodeproof; |
| 1126 | |
| 1127 | if (!otmp) { |
| 1128 | strange_feeling(sobj, !Blind |
| 1129 | ? "Your skin glows then fades." |
| 1130 | : "Your skin feels warm for a moment."); |
| 1131 | *sobjp = 0; /* useup() in strange_feeling() */ |
| 1132 | exercise(A_CON, !scursed); |
| 1133 | exercise(A_STR, !scursed); |
| 1134 | return; |
| 1135 | } |
| 1136 | if (confused) { |
| 1137 | old_erodeproof = (otmp->oerodeproof != 0); |
| 1138 | new_erodeproof = !scursed; |
| 1139 | otmp->oerodeproof = 0; /* for messages */ |
| 1140 | if (Blind) { |
| 1141 | otmp->rknown = FALSE; |
| 1142 | pline("%s warm for a moment.", Yobjnam2(otmp, "feel")); |
| 1143 | } else { |
| 1144 | otmp->rknown = TRUE; |
| 1145 | pline("%s covered by a %s %s %s!", Yobjnam2(otmp, "are"), |
| 1146 | scursed ? "mottled" : "shimmering", |
| 1147 | hcolor(scursed ? NH_BLACK : NH_GOLDEN), |
| 1148 | scursed ? "glow" |
| 1149 | : (is_shield(otmp) ? "layer" : "shield")); |
| 1150 | } |
| 1151 | if (new_erodeproof && (otmp->oeroded || otmp->oeroded2)) { |
| 1152 | otmp->oeroded = otmp->oeroded2 = 0; |
| 1153 | pline("%s as good as new!", |
| 1154 | Yobjnam2(otmp, Blind ? "feel" : "look")); |
| 1155 | } |
| 1156 | if (old_erodeproof && !new_erodeproof) { |
| 1157 | /* restore old_erodeproof before shop charges */ |
| 1158 | otmp->oerodeproof = 1; |
| 1159 | costly_alteration(otmp, COST_DEGRD); |
| 1160 | } |
| 1161 | otmp->oerodeproof = new_erodeproof ? 1 : 0; |
| 1162 | return; |
| 1163 | } |
| 1164 | /* elven armor vibrates warningly when enchanted beyond a limit */ |
| 1165 | special_armor = is_elven_armor(otmp) |
| 1166 | || (Role_if(PM_WIZARD) && otmp->otyp == CORNUTHAUM); |
| 1167 | if (scursed) |
| 1168 | same_color = (otmp->otyp == BLACK_DRAGON_SCALE_MAIL |
| 1169 | || otmp->otyp == BLACK_DRAGON_SCALES); |
| 1170 | else |
| 1171 | same_color = (otmp->otyp == SILVER_DRAGON_SCALE_MAIL |
no test coverage detected