Blindfold removal fix
[slashemextended.git] / src / wield.c
blob16661e5e10d964156ef63e335453489fb3e08e50
1 /* SCCS Id: @(#)wield.c 3.4 2003/01/29 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #include "hack.h"
7 /* KMH -- Differences between the three weapon slots.
9 * The main weapon (uwep):
10 * 1. Is filled by the (w)ield command.
11 * 2. Can be filled with any type of item.
12 * 3. May be carried in one or both hands.
13 * 4. Is used as the melee weapon and as the launcher for
14 * ammunition.
15 * 5. Only conveys intrinsics when it is a weapon, weapon-tool,
16 * or artifact.
17 * 6. Certain cursed items will weld to the hand and cannot be
18 * unwielded or dropped. See erodeable_wep() and will_weld()
19 * below for the list of which items apply.
21 * The secondary weapon (uswapwep):
22 * 1. Is filled by the e(x)change command, which swaps this slot
23 * with the main weapon. If the "pushweapon" option is set,
24 * the (w)ield command will also store the old weapon in the
25 * secondary slot.
26 * 2. Can be field with anything that will fit in the main weapon
27 * slot; that is, any type of item.
28 * 3. Is usually NOT considered to be carried in the hands.
29 * That would force too many checks among the main weapon,
30 * second weapon, shield, gloves, and rings; and it would
31 * further be complicated by bimanual weapons. A special
32 * exception is made for two-weapon combat.
33 * 4. Is used as the second weapon for two-weapon combat, and as
34 * a convenience to swap with the main weapon.
35 * 5. Never conveys intrinsics.
36 * 6. Cursed items never weld (see #3 for reasons), but they also
37 * prevent two-weapon combat.
39 * The quiver (uquiver):
40 * 1. Is filled by the (Q)uiver command.
41 * 2. Can be filled with any type of item.
42 * 3. Is considered to be carried in a special part of the pack.
43 * 4. Is used as the item to throw with the (f)ire command.
44 * This is a convenience over the normal (t)hrow command.
45 * 5. Never conveys intrinsics.
46 * 6. Cursed items never weld; their effect is handled by the normal
47 * throwing code.
49 * No item may be in more than one of these slots.
52 /*STATIC_DCL int ready_weapon(struct obj *, BOOLEAN_P);*/
53 static const char all_count[] = { ALLOW_COUNT, ALL_CLASSES, 0 };
54 static const char allnoncount[] = { ALL_CLASSES, 0 };
56 /* used by will_weld() */
57 /* probably should be renamed */
58 #define erodeable_wep(optr) ((optr)->oclass == WEAPON_CLASS \
59 || is_weptool(optr) \
60 || (optr)->oclass == BALL_CLASS \
61 || (optr)->oclass == GEM_CLASS \
62 || (optr)->oclass == VENOM_CLASS \
63 || (optr)->oclass == CHAIN_CLASS)
65 /* used by welded(), and also while wielding */
66 #define will_weld(optr) ((optr)->cursed \
67 && (erodeable_wep(optr) \
68 || (optr)->otyp == TIN_OPENER || (optr)->otyp == BUDO_NO_SASU || (optr)->otyp == JEONTU_GEOM))
71 /*** Functions that place a given item in a slot ***/
72 /* Proper usage includes:
73 * 1. Initializing the slot during character generation or a
74 * restore.
75 * 2. Setting the slot due to a player's actions.
76 * 3. If one of the objects in the slot are split off, these
77 * functions can be used to put the remainder back in the slot.
78 * 4. Putting an item that was thrown and returned back into the slot.
79 * 5. Emptying the slot, by passing a null object. NEVER pass
80 * zeroobj!
82 * If the item is being moved from another slot, it is the caller's
83 * responsibility to handle that. It's also the caller's responsibility
84 * to print the appropriate messages.
86 * MRKR: It now takes an extra flag put_away which is true if the
87 * unwielded weapon is being put back into the inventory
88 * (rather than dropped, destroyed, etc)
90 void
91 setuwep(obj, put_away, cancurseshit)
92 register struct obj *obj;
93 boolean put_away;
94 boolean cancurseshit; /* otherwise, saving and loading would trigger it every time! --Amy */
96 struct obj *olduwep = uwep;
98 if (obj == uwep) return; /* necessary to not set unweapon */
99 /* This message isn't printed in the caller because it happens
100 * *whenever* Sunsword is unwielded, from whatever cause.
102 setworn(obj, W_WEP);
103 if (uwep == obj && olduwep && (olduwep->oartifact == ART_SUNSWORD || olduwep->oartifact == ART_SUNSCREEN || olduwep->oartifact == ART_SUNTINOPENER || olduwep->oartifact == ART_SUNRUBBERHOSE) &&
104 olduwep->lamplit) {
105 end_burn(olduwep, FALSE);
106 if (!Blind) pline("%s glowing.", Tobjnam(olduwep, "stop"));
108 if (uwep && obj && olduwep && olduwep->oartifact == ART_WIRE_OF_LUCK) set_moreluck();
110 /* Note: Explicitly wielding a pick-axe will not give a "bashing"
111 * message. Wielding one via 'a'pplying it will.
112 * 3.2.2: Wielding arbitrary objects will give bashing message too.
114 if (obj) {
115 unweapon = (obj->oclass == WEAPON_CLASS) ?
116 is_launcher(obj) || is_ammo(obj) ||
117 is_missile(obj) || (is_pole(obj) && !u.usteed
118 ) : !is_weptool(obj);
119 } else
120 unweapon = TRUE; /* for "bare hands" message */
122 if (uwep && uwep->oartifact == ART_WIRE_OF_LUCK) set_moreluck();
124 if (!cancurseshit) goto cursingdone;
126 if (uwep && uwep->oartifact == ART_UEH_THE_PART_IS___) {
127 uwep->spe = 3;
130 if (uwep && uwep->oartifact == ART_FEETSERN) {
131 u.martialstyle = MARTIALSTYLE_TAEKWONDO;
132 Your("martial style is 'taekwondo' now.");
135 if (uwep && uwep->oartifact == ART_BAT_FROM_BALTIMORE) {
136 if (CurseuseEffect < 5000L) CurseuseEffect = 5000L;
137 if (AutocursingEquipment < 5000L) AutocursingEquipment = 5000L;
140 if (uwep && objects[uwep->otyp].oc_skill == P_TRIDENT && Race_if(PM_NEMESIS) && !uwep->nemtrident && uwep->spe < 1) {
141 uwep->nemtrident = 1;
142 uwep->spe += rne(2);
143 pline_The("trident glows in your %s for a moment.", body_part(HAND));
144 if (uwep->spe > 120) uwep->spe = 120; /* fail safe */
147 if (uwep && uwep->oartifact == ART_ARS_TECHNICA && Role_if(PM_ARTIST) && !u.arstechnicadone) {
148 u.arstechnicadone = TRUE;
150 if (P_MAX_SKILL(P_PADDLE) == P_ISRESTRICTED) {
151 unrestrict_weapon_skill(P_PADDLE);
152 pline("You can now learn the paddle skill!");
153 } else if (P_MAX_SKILL(P_PADDLE) == P_UNSKILLED) {
154 unrestrict_weapon_skill(P_PADDLE);
155 pline("You can now learn the paddle skill!");
156 P_MAX_SKILL(P_PADDLE) = P_BASIC;
157 } else if (P_MAX_SKILL(P_PADDLE) == P_BASIC) {
158 P_MAX_SKILL(P_PADDLE) = P_SKILLED;
159 pline("You can now become skilled with paddles!");
160 } else if (P_MAX_SKILL(P_PADDLE) == P_SKILLED) {
161 P_MAX_SKILL(P_PADDLE) = P_EXPERT;
162 pline("You can now become expert with paddles!");
163 } else if (P_MAX_SKILL(P_PADDLE) == P_EXPERT) {
164 P_MAX_SKILL(P_PADDLE) = P_MASTER;
165 pline("You can now become master with paddles!");
166 } else if (P_MAX_SKILL(P_PADDLE) == P_MASTER) {
167 P_MAX_SKILL(P_PADDLE) = P_GRAND_MASTER;
168 pline("You can now become grand master with paddles!");
169 } else if (P_MAX_SKILL(P_PADDLE) == P_GRAND_MASTER) {
170 P_MAX_SKILL(P_PADDLE) = P_SUPREME_MASTER;
171 pline("You can now become supreme master with paddles!");
172 } else pline("Sadly your knowledge of the paddle skill is already maxed.");
176 if (uwep && uwep->oartifact == ART_WHY_ALWAYS_CONUNDRUM && objects[uwep->otyp].oc_material == MT_CONUNDRUM) {
177 objects[uwep->otyp].oc_material = rn2(LASTMATERIAL + 1);
178 Your("weapon's material morphs to a different one!");
181 if (uwep && uwep->oartifact == ART_MR__OF_HIGH_HEELS && objects[uwep->otyp].oc_color != CLR_BLACK) {
182 objects[uwep->otyp].oc_color = CLR_BLACK;
183 Your("wielded shoe is painted black!");
186 if (uwep && uwep->oartifact == ART_LOVE_THE_COLOR_PURPLE && objects[uwep->otyp].oc_color != CLR_BRIGHT_MAGENTA) {
187 objects[uwep->otyp].oc_color = CLR_BRIGHT_MAGENTA;
188 Your("cuuuuute girl sandal is pink now! Awwww <3 <3 <3 So lovely!");
191 if (uwep && uwep->oartifact == ART_EVA_S_COLORCHANGE && objects[uwep->otyp].oc_color != CLR_ORANGE) {
192 objects[uwep->otyp].oc_color = CLR_ORANGE;
193 Your("spear is colored orange now!");
196 if (uwep && uwep->oartifact == ART_SPACEL_SWIM) {
197 if (objects[uwep->otyp].oc_material != MT_IRON) {
198 objects[uwep->otyp].oc_material = MT_IRON;
199 Your("weapon is made of iron now.");
201 if (uwep->oerodeproof) {
202 uwep->oerodeproof = 0;
203 Your("weapon is no longer erosionproof.");
207 if (uwep && uwep->oartifact == ART_IRONIT) {
208 if (objects[uwep->otyp].oc_material != MT_IRON) {
209 objects[uwep->otyp].oc_material = MT_IRON;
210 Your("container is made of iron now.");
214 if (uwep && uwep->oartifact == ART_FONLAUSCHI && objects[uwep->otyp].oc_material != MT_SILK) {
215 objects[uwep->otyp].oc_material = MT_SILK;
216 Your("weapon is made of silk now.");
218 if (uwep && uwep->oartifact == ART_GORMALER && objects[uwep->otyp].oc_material != MT_CHROME) {
219 objects[uwep->otyp].oc_material = MT_CHROME;
220 Your("weapon is made of chrome now.");
222 if (uwep && uwep->oartifact == ART_GRISGREN && objects[uwep->otyp].oc_material != MT_GREEN_STEEL) {
223 objects[uwep->otyp].oc_material = MT_GREEN_STEEL;
224 Your("weapon is made of green steel now.");
226 if (uwep && uwep->oartifact == ART_EWW_THAT_S_DISGUSTING && objects[uwep->otyp].oc_material != MT_SECREE) {
227 objects[uwep->otyp].oc_material = MT_SECREE;
228 Your("weapon is made of secree now (eww, that's disgusting!).");
231 if (uwep && uwep->otyp == HONOR_KATANA && !uwep->cursed) {
232 curse(uwep);
233 Your("katana welds itself to your %s!", body_part(HAND));
236 if (uwep && uwep->oartifact == ART_OZYZEVPDWTVP && !uwep->cursed) {
237 curse(uwep);
238 Your("bow becomes cursed, hahaha.");
241 if (uwep && uwep->oartifact == ART_KRASCHEEP && !uwep->cursed) {
242 curse(uwep);
243 Your("bow becomes cursed, hahaha.");
246 if (uwep && uwep->oartifact == ART_GREAT_MATRON && !Role_if(PM_AMAZON) && !uwep->cursed) {
247 curse(uwep);
248 pline("Your fault, only amazons are allowed to use this weapon!");
251 if (uwep && uwep->oartifact == ART_RIDGET_PHASTO) {
252 curse(uwep);
253 uwep->hvycurse = uwep->prmcurse = uwep->stckcurse = TRUE;
256 if (uwep && uwep->oartifact == ART_SMASHIN) {
257 curse(uwep);
258 if (!Role_if(PM_SAGE)) uwep->hvycurse = uwep->stckcurse = TRUE;
261 if (uwep && uwep->oartifact == ART_HOL_ON_MAN && !uwep->cursed) {
262 curse(uwep);
264 if (uwep && uwep->oartifact == ART_GONNA_BE_ANOTHER_BLOODBATH && !uwep->cursed) {
265 curse(uwep);
266 pline("Raaaaaaahhh, your weapon became cursed!");
268 if (uwep && uwep->oartifact == ART_SIYID && !uwep->cursed) {
269 curse(uwep);
270 pline("Whoops, your weapon became cursed.");
272 if (uwep && uwep->oartifact == ART_WOMAN_UP_CJ && !uwep->cursed) {
273 curse(uwep);
274 pline("Whoops, your weapon became cursed.");
276 if (uwep && uwep->oartifact == ART_POST_OFFICE_COURSE && !uwep->cursed) {
277 curse(uwep);
278 pline("Whoops, your weapon became cursed.");
281 if (uwep && uwep->oartifact == ART_KATI_GAVE_YOU_THE_ENGLISH_) {
282 CovidTrapEffect |= FROMOUTSIDE;
283 You("are infected with the English flu! Oh no!!");
284 if (!uwep->cursed) curse(uwep);
287 if (uwep && uwep->oartifact == ART_MAILIE_S_SELF_CENTRATION && !uwep->cursed) {
288 curse(uwep);
289 pline("Whoops, your weapon became cursed.");
291 if (uwep && uwep->oartifact == ART_SAT___TRASHING && !uwep->cursed) {
292 curse(uwep);
293 pline("Whoops, your weapon became cursed.");
296 if (uwep && uwep->oartifact == ART_ARABELLA_S_THINNER) {
297 curse(uwep);
298 uwep->hvycurse = uwep->prmcurse = TRUE;
301 if (uwep && uwep->oartifact == ART_TONA_S_GAMES && !uwep->hvycurse) {
302 curse(uwep);
303 uwep->hvycurse = TRUE;
304 pline("Now you gotta play Tona's games.");
307 if (uwep && uwep->oartifact == ART_LORD_S_LASH) {
308 u.lifesavepenalty++;
309 pline("Careful, the lord has noticed your deed.");
312 if (uwep && uwep->oartifact == ART_HIE_HUEHEI_FLUEMEI_SGLWLN) {
313 if (HConfusion < 5000) HConfusion = 5000;
314 set_itimeout(&HeavyConfusion, HConfusion);
317 if (uwep && uwep->oartifact == ART_MAGYAR_IDEA) {
318 curse(uwep);
319 contaminate(100, TRUE);
320 increasesanity(100);
321 pline_The("magyars had an idea.");
324 if (uwep && uwep->oartifact == ART_MAGE_STAFF_OF_ETERNITY) {
325 if (!Role_if(PM_UNBELIEVER)) increasesanity(1000);
326 curse(uwep);
327 uwep->stckcurse = TRUE;
328 Your("weapon is quite cursed now, but also very powerful!");
331 if (uwep && uwep->oartifact == ART_LONG_SWORD_OF_ETERNITY) {
332 if (!Role_if(PM_UNBELIEVER)) increasesanity(1000);
333 curse(uwep);
334 uwep->hvycurse = TRUE;
335 Your("weapon is quite cursed now, but also very powerful!");
338 if (uwep && uwep->oartifact == ART_HEAVY_CROSSBOW_OF_ETERNITY) {
339 if (!Role_if(PM_UNBELIEVER)) increasesanity(1000);
340 curse(uwep);
341 uwep->stckcurse = uwep->hvycurse = TRUE;
342 Your("weapon is quite cursed now, but also very powerful!");
345 if (uwep && uwep->oartifact == ART_ALASSEA_TELEMNAR && !uwep->hvycurse) {
346 curse(uwep);
347 uwep->hvycurse = 1;
348 pline("A terrible black aura surrounds your sickle...");
351 if (uwep && uwep->oartifact == ART_PROFANED_GREATSCYTHE && !uwep->hvycurse) {
352 curse(uwep);
353 uwep->hvycurse = 1;
354 pline("A terrible black aura surrounds your scythe...");
357 if (uwep && uwep->oartifact == ART_OXIDIZED_ALLOY && uwep->oeroded < 2) {
358 uwep->oeroded = 2;
359 Your("bar is covered with rust.");
362 if (uwep && uwep->oartifact == ART_FREAK_VERSUS_BANGER && !uwep->hvycurse) {
363 curse(uwep);
364 uwep->hvycurse = 1;
365 pline("A terrible black aura surrounds your axe...");
368 if (uwep && uwep->oartifact == ART_SEXCALIBUR && !uwep->hvycurse) {
369 curse(uwep);
370 uwep->hvycurse = 1;
371 pline("A terrible black aura surrounds your whip...");
374 if (uwep && uwep->oartifact == ART_RAFSCHAR_S_SUPERWEAPON && !uwep->cursed) {
375 curse(uwep);
377 if (uwep && uwep->oartifact == ART_WAR_S_SWORD && !uwep->cursed) {
378 curse(uwep);
379 pline("Whoops, the weapon cursed itself.");
381 if (uwep && uwep->oartifact == ART_GONDOLIN_S_HIDDEN_PASSAGE && !uwep->cursed) {
382 curse(uwep);
383 pline("Whoops, the weapon cursed itself.");
385 if (uwep && uwep->oartifact == ART_SHADOWBLADE_BASED_ON_STORM && !uwep->cursed) {
386 curse(uwep);
387 pline("Whoops, the weapon cursed itself.");
389 if (uwep && uwep->oartifact == ART_DE_SID && !uwep->cursed) {
390 curse(uwep);
391 pline("Whoops, the weapon cursed itself.");
393 if (uwep && uwep->oartifact == ART_GODAWFUL_ENCHANTMENT && !uwep->cursed) {
394 curse(uwep);
395 pline("Whoops, the weapon cursed itself.");
397 if (uwep && uwep->oartifact == ART_BARDICHE_ASSALT && !uwep->cursed) {
398 curse(uwep);
399 pline("Whoops, the weapon cursed itself.");
401 if (uwep && uwep->oartifact == ART_RASSCHEN_TAAK && !uwep->cursed) {
402 curse(uwep);
404 if (uwep && uwep->oartifact == ART_YOU_RE_STUCCO && !uwep->cursed) {
405 curse(uwep);
406 pline("Great. You're stucco now.");
409 if (uwep && uwep->oartifact == ART_FIRE_IS_GOOD) {
410 if (uwep->spe < 9) uwep->spe = 9;
413 if (uwep && uwep->oartifact == ART_DAMN_HARD) uwep->oerodeproof = TRUE;
415 if (uwep && uwep->oartifact == ART_KLONG_RIGHT) {
416 uwep->oerodeproof = TRUE;
417 uwep->oeroded = uwep->oeroded2 = FALSE;
420 if (uwep && uwep->oartifact == ART_CERULEAN_SMASH && !Role_if(PM_HUSSY) && !uwep->hvycurse) {
421 curse(uwep);
422 uwep->hvycurse = 1;
423 if (uwep->spe > -10) uwep->spe = -10;
426 if (uwep && uwep->oartifact == ART_NOW_THAT_S_A_GOOD_ENCHANTM) {
427 if (uwep->spe < 7) uwep->spe = 7;
430 if (uwep && uwep->oartifact == ART_SANDRA_S_EVIL_MINDDRILL) {
431 if (uwep->spe > -20) uwep->spe--;
434 if (uwep && uwep->oartifact == ART_ATLUS_HEAVE) {
435 if (uwep->spe > -20) uwep->spe--;
436 if (uwep->spe <= -20) {
437 curse(uwep); uwep->hvycurse = uwep->prmcurse = uwep->stckcurse = TRUE;
439 pline("Your weapon seems less effective.");
440 if (PlayerHearsSoundEffects) pline(issoviet ? "Vse, chto vy vladeyete budet razocharovalsya v zabveniye, kha-kha-kha!" : "Klatsch!");
443 if (uwep && uwep->oartifact == ART_HENRIETTA_S_MISTAKE && !uwep->hvycurse) {
444 curse(uwep);
445 uwep->hvycurse = 1;
446 if (!strncmpi(plname, "Henrietta", 10) || !strncmpi(plalias, "Henrietta", 10)) pline("Dear Henrietta, the dogs produced plenty of heaps of shit specially for you to step into! Please make sure you don't miss any of them.");
447 else pline("Apparently you want to repeat Henrietta's mistake. Oh well. Good luck avoiding all the heaps of shit now!");
450 if (uwep && uwep->oartifact == ART_BLADE_OF_GOTHMOG && !uwep->hvycurse) {
451 curse(uwep);
452 uwep->hvycurse = 1;
453 pline("A terrible black aura surrounds your sword...");
456 if (uwep && uwep->oartifact == ART_DJA_A_A_A_UEUEUEI && !uwep->nemtrident) {
457 uwep->nemtrident = TRUE;
459 if (P_MAX_SKILL(P_QUARTERSTAFF) == P_ISRESTRICTED) {
460 unrestrict_weapon_skill(P_QUARTERSTAFF);
461 pline("You can now learn the quarterstaff skill!");
462 } else if (P_MAX_SKILL(P_QUARTERSTAFF) == P_UNSKILLED) {
463 unrestrict_weapon_skill(P_QUARTERSTAFF);
464 pline("You can now learn the quarterstaff skill!");
465 P_MAX_SKILL(P_QUARTERSTAFF) = P_BASIC;
466 } else if (P_MAX_SKILL(P_QUARTERSTAFF) == P_BASIC) {
467 P_MAX_SKILL(P_QUARTERSTAFF) = P_SKILLED;
468 pline("You can now become skilled with quarterstaves!");
469 } else if (P_MAX_SKILL(P_QUARTERSTAFF) == P_SKILLED) {
470 P_MAX_SKILL(P_QUARTERSTAFF) = P_EXPERT;
471 pline("You can now become expert with quarterstaves!");
472 } else if (P_MAX_SKILL(P_QUARTERSTAFF) == P_EXPERT) {
473 P_MAX_SKILL(P_QUARTERSTAFF) = P_MASTER;
474 pline("You can now become master with quarterstaves!");
475 } else if (P_MAX_SKILL(P_QUARTERSTAFF) == P_MASTER) {
476 P_MAX_SKILL(P_QUARTERSTAFF) = P_GRAND_MASTER;
477 pline("You can now become grand master with quarterstaves!");
478 } else if (P_MAX_SKILL(P_QUARTERSTAFF) == P_GRAND_MASTER) {
479 P_MAX_SKILL(P_QUARTERSTAFF) = P_SUPREME_MASTER;
480 pline("You can now become supreme master with quarterstaves!");
481 } else pline("Sadly your knowledge of the quarterstaff skill is already maxed.");
485 if (uwep && uwep->oartifact == ART_ARABELLA_S_MELEE_POWER) {
486 (void) makemon(&mons[PM_GUNNHILD_S_GENERAL_STORE], 0, 0, NO_MM_FLAGS);
489 if (uwep && uwep->oartifact == ART_ARABELLA_S_WARDING_HOE) {
490 curse(uwep);
491 uwep->hvycurse = uwep->prmcurse = uwep->evilcurse = 1;
494 if (uwep && uwep->oartifact == ART_ATOMIC_MISSING) {
495 curse(uwep);
496 pline("The ballista becomes cursed as you wield it.");
499 if (uwep && uwep->oartifact == ART_XIUHCOATL) {
500 curse(uwep);
501 pline("The atlatl becomes cursed as you wield it.");
504 if (uwep && uwep->oartifact == ART_MCCAULEY_S_INTELLIGENCE) {
505 curse(uwep);
506 pline("Broad weapons are better than narrow weapons because their effect applies to more types of monsters.");
509 if (uwep && uwep->oartifact == ART_MCCAULEY_S_ARGUMENT) {
510 curse(uwep);
511 pline("Narrow weapons are worse than broad weapons because their effect applies to only a few types of monsters.");
514 if (uwep && uwep->oartifact == ART_FADED_USELESSNESS) {
515 curse(uwep);
516 pline("In order to prevent it from falling off, your knife curses itself.");
519 if (uwep && uwep->oartifact == ART_BERSERK_RAGE) {
520 curse(uwep);
521 pline("Well, you cannot easily stop your berserk rage now.");
524 if (uwep && uwep->oartifact == ART_THRANDUIL_LOSSEHELIN && !uwep->hvycurse) {
525 curse(uwep);
526 uwep->hvycurse = 1;
527 pline("A terrible black aura surrounds your weapon...");
530 if (uwep && uwep->oartifact == ART_MANUELA_S_PRACTICANT_TERRO && !uwep->cursed) {
531 curse(uwep);
532 pline("The riding crop welds itself to your %s and forces you to terrorize innocent practicants!", body_part(HAND));
535 if (uwep && uwep->oartifact == ART_LUISA_S_CHARMING_BEAUTY && !uwep->cursed) {
536 curse(uwep);
537 pline("Luisa's beautiful high-heeled lady boot refuses to be put away. Use it wisely!");
540 if (uwep && uwep->oartifact == ART_AND_IT_KEEPS_ON_MOVING && !uwep->cursed) {
541 curse(uwep);
542 pline("Your weapon is cursed now, and you will keep on moving.");
545 if (uwep && uwep->oartifact == ART_AMY_S_FIRST_GIRLFRIEND && !uwep->cursed) {
546 curse(uwep);
547 pline("You let out a deep sigh as the beautiful, soft girl shoe welds itself to your %s.", body_part(HAND));
550 if (uwep && uwep->oartifact == ART_BANG_BANG && uwep->spe < 2) uwep->spe = 2;
552 if (uwep && uwep->oartifact == ART_DEADLY_GAMBLING && !rn2(100) ) {
553 u.youaredead = 1;
554 pline("BANG! You die.");
555 killer_format = KILLED_BY;
556 killer = "deadly gambling";
557 done(DIED);
558 u.youaredead = 0;
561 if (uwep && uwep->oartifact == ART_POINT_DEXTER) FemaleTrapGreta |= FROMOUTSIDE;
563 if (uwep && uwep->oartifact == ART_GUN_CONTROL_LAWS && !uwep->cursed) {
564 curse(uwep);
565 pline("Oh no! Morgoth curses your gun as you wield it!");
568 if (uwep && uwep->oartifact == ART_OVERHEATER && !uwep->cursed) {
569 curse(uwep);
570 pline("Your weapon becomes cursed!");
573 if (uwep && uwep->oartifact == ART_KINGS_RANSOM_FOR_YOU) {
574 curse(uwep);
575 uwep->hvycurse = uwep->prmcurse = uwep->evilcurse = 1;
576 pline("You realize that you've made a horrible mistake.");
579 if (uwep && (AutocursingEquipment || u.uprops[AUTOCURSE_EQUIP].extrinsic || have_autocursestone())) {
580 curse(uwep);
582 if (AutocursingXtra) {
583 if (!rn2(2)) {
584 uwep->cursed = uwep->hvycurse = TRUE;
585 if (!rn2(5)) uwep->prmcurse = TRUE;
587 if (!rn2(2)) {
588 uwep->cursed = uwep->stckcurse = TRUE;
594 if (uwep && uwep->spe > -10 && (TrashingBugEffect || u.uprops[TRASHING_EFFECT].extrinsic || have_trashstone())) uwep->spe--;
596 cursingdone:
598 /* MRKR: Handle any special effects of unwielding a weapon */
599 if (olduwep && olduwep != uwep)
600 unwield(olduwep, put_away);
602 update_inventory();
605 void
606 swaptech()
608 register struct obj *otmp;
609 struct obj *oldswapwep = uswapwep;
611 if (CannotSelectItemsInPrompts) return;
612 swapweaponchoice:
613 otmp = getobj(allnoncount, "put into your swap weapon slot");
614 if (!otmp) {
615 if (yn("Really exit with no object selected?") == 'y')
616 pline("You just wasted the opportunity to put something into your swap weapon slot.");
617 else goto swapweaponchoice;
618 pline("Nothing selected.");
619 return;
621 if (otmp->owornmask) {
622 You("can't set an item as your secondary weapon that's already equipped in a different slot!");
623 return;
626 if (oldswapwep)
627 unwield(oldswapwep, TRUE);
629 setworn(otmp, W_SWAPWEP);
630 update_inventory();
632 if (PlayerCannotUseSkills || (P_SKILL(P_TWO_WEAPON_COMBAT) < P_MASTER) ) {
634 if (uswapwep && uswapwep->oartifact == ART_ALASSEA_TELEMNAR && !uswapwep->hvycurse) {
635 curse(uswapwep);
636 uswapwep->hvycurse = 1;
637 pline("A terrible black aura surrounds your sickle...");
640 if (uswapwep && uswapwep->oartifact == ART_MAGE_STAFF_OF_ETERNITY) {
641 if (!Role_if(PM_UNBELIEVER)) increasesanity(1000);
642 curse(uswapwep);
643 uswapwep->stckcurse = TRUE;
644 Your("weapon is quite cursed now, but also very powerful!");
647 if (uswapwep && uswapwep->oartifact == ART_LONG_SWORD_OF_ETERNITY) {
648 if (!Role_if(PM_UNBELIEVER)) increasesanity(1000);
649 curse(uswapwep);
650 uswapwep->hvycurse = TRUE;
651 Your("weapon is quite cursed now, but also very powerful!");
654 if (uswapwep && uswapwep->oartifact == ART_HEAVY_CROSSBOW_OF_ETERNITY) {
655 if (!Role_if(PM_UNBELIEVER)) increasesanity(1000);
656 curse(uswapwep);
657 uswapwep->stckcurse = uswapwep->hvycurse = TRUE;
658 Your("weapon is quite cursed now, but also very powerful!");
661 if (uswapwep && uswapwep->oartifact == ART_MAGYAR_IDEA) {
662 curse(uswapwep);
663 contaminate(100, TRUE);
664 increasesanity(100);
665 pline_The("magyars had an idea.");
668 if (uswapwep && uswapwep->oartifact == ART_HIE_HUEHEI_FLUEMEI_SGLWLN) {
669 if (HConfusion < 5000) HConfusion = 5000;
670 set_itimeout(&HeavyConfusion, HConfusion);
673 if (uswapwep && uswapwep->oartifact == ART_PROFANED_GREATSCYTHE && !uswapwep->hvycurse) {
674 curse(uswapwep);
675 uswapwep->hvycurse = 1;
676 pline("A terrible black aura surrounds your scythe...");
679 if (uswapwep && uswapwep->oartifact == ART_OXIDIZED_ALLOY && uswapwep->oeroded < 2) {
680 uswapwep->oeroded = 2;
681 Your("bar is covered with rust.");
684 if (uswapwep && uswapwep->oartifact == ART_LORD_S_LASH) {
685 u.lifesavepenalty++;
686 pline("Careful, the lord has noticed your deed.");
689 if (uswapwep && uswapwep->oartifact == ART_FREAK_VERSUS_BANGER && !uswapwep->hvycurse) {
690 curse(uswapwep);
691 uswapwep->hvycurse = 1;
692 pline("A terrible black aura surrounds your axe...");
695 if (uswapwep && uswapwep->otyp == HONOR_KATANA && !uswapwep->cursed) {
696 curse(uswapwep);
697 Your("katana welds itself to your other %s!", body_part(HAND));
700 if (uswapwep && uswapwep->oartifact == ART_OZYZEVPDWTVP && !uswapwep->cursed) {
701 curse(uswapwep);
702 Your("bow becomes cursed, hahaha.");
705 if (uswapwep && uswapwep->oartifact == ART_KRASCHEEP && !uswapwep->cursed) {
706 curse(uswapwep);
707 Your("bow becomes cursed, hahaha.");
710 if (uswapwep && uswapwep->oartifact == ART_BAT_FROM_BALTIMORE) {
711 if (CurseuseEffect < 5000L) CurseuseEffect = 5000L;
712 if (AutocursingEquipment < 5000L) AutocursingEquipment = 5000L;
715 if (uswapwep && uswapwep->oartifact == ART_GREAT_MATRON && !Role_if(PM_AMAZON) && !uswapwep->cursed) {
716 curse(uswapwep);
717 pline("Your fault, only amazons are allowed to use this weapon!");
720 if (uswapwep && uswapwep->oartifact == ART_RIDGET_PHASTO) {
721 curse(uswapwep);
722 uswapwep->hvycurse = uswapwep->prmcurse = uswapwep->stckcurse = TRUE;
725 if (uswapwep && uswapwep->oartifact == ART_SMASHIN) {
726 curse(uswapwep);
727 if (!Role_if(PM_SAGE)) uswapwep->hvycurse = uswapwep->stckcurse = TRUE;
730 if (uswapwep && uswapwep->oartifact == ART_HOL_ON_MAN && !uswapwep->cursed) {
731 curse(uswapwep);
733 if (uswapwep && uswapwep->oartifact == ART_GONNA_BE_ANOTHER_BLOODBATH && !uswapwep->cursed) {
734 curse(uswapwep);
735 pline("Raaaaaaahhh, your weapon became cursed!");
737 if (uswapwep && uswapwep->oartifact == ART_SIYID && !uswapwep->cursed) {
738 curse(uswapwep);
739 pline("Whoops, your secondary weapon became cursed.");
741 if (uswapwep && uswapwep->oartifact == ART_WOMAN_UP_CJ && !uswapwep->cursed) {
742 curse(uswapwep);
743 pline("Whoops, your secondary weapon became cursed.");
745 if (uswapwep && uswapwep->oartifact == ART_POST_OFFICE_COURSE && !uswapwep->cursed) {
746 curse(uswapwep);
747 pline("Whoops, your secondary weapon became cursed.");
750 if (uswapwep && uswapwep->oartifact == ART_KATI_GAVE_YOU_THE_ENGLISH_) {
751 CovidTrapEffect |= FROMOUTSIDE;
752 You("are infected with the English flu! Oh no!!");
753 if (!uswapwep->cursed) curse(uswapwep);
756 if (uswapwep && uswapwep->oartifact == ART_MAILIE_S_SELF_CENTRATION && !uswapwep->cursed) {
757 curse(uswapwep);
758 pline("Whoops, your secondary weapon became cursed.");
760 if (uswapwep && uswapwep->oartifact == ART_SAT___TRASHING && !uswapwep->cursed) {
761 curse(uswapwep);
762 pline("Whoops, your secondary weapon became cursed.");
765 if (uswapwep && uswapwep->oartifact == ART_ARABELLA_S_THINNER) {
766 curse(uswapwep);
767 uswapwep->hvycurse = uswapwep->prmcurse = TRUE;
770 if (uswapwep && uswapwep->oartifact == ART_TONA_S_GAMES && !uswapwep->hvycurse) {
771 curse(uswapwep);
772 uswapwep->hvycurse = TRUE;
773 pline("Now you gotta play Tona's games.");
776 if (uswapwep && uswapwep->oartifact == ART_SEXCALIBUR && !uswapwep->hvycurse) {
777 curse(uswapwep);
778 uswapwep->hvycurse = 1;
779 pline("A terrible black aura surrounds your whip...");
782 if (uswapwep && uswapwep->oartifact == ART_RAFSCHAR_S_SUPERWEAPON && !uswapwep->cursed) {
783 curse(uswapwep);
785 if (uswapwep && uswapwep->oartifact == ART_WAR_S_SWORD && !uswapwep->cursed) {
786 curse(uswapwep);
787 pline("Whoops, the weapon cursed itself.");
789 if (uswapwep && uswapwep->oartifact == ART_GONDOLIN_S_HIDDEN_PASSAGE && !uswapwep->cursed) {
790 curse(uswapwep);
791 pline("Whoops, the weapon cursed itself.");
793 if (uswapwep && uswapwep->oartifact == ART_SHADOWBLADE_BASED_ON_STORM && !uswapwep->cursed) {
794 curse(uswapwep);
795 pline("Whoops, the weapon cursed itself.");
797 if (uswapwep && uswapwep->oartifact == ART_DE_SID && !uswapwep->cursed) {
798 curse(uswapwep);
799 pline("Whoops, the weapon cursed itself.");
801 if (uswapwep && uswapwep->oartifact == ART_GODAWFUL_ENCHANTMENT && !uswapwep->cursed) {
802 curse(uswapwep);
803 pline("Whoops, the weapon cursed itself.");
805 if (uswapwep && uswapwep->oartifact == ART_BARDICHE_ASSALT && !uswapwep->cursed) {
806 curse(uswapwep);
807 pline("Whoops, the weapon cursed itself.");
809 if (uswapwep && uswapwep->oartifact == ART_RASSCHEN_TAAK && !uswapwep->cursed) {
810 curse(uswapwep);
812 if (uswapwep && uswapwep->oartifact == ART_YOU_RE_STUCCO && !uswapwep->cursed) {
813 curse(uswapwep);
814 pline("Great. You're stucco now.");
817 if (uswapwep && uswapwep->oartifact == ART_CERULEAN_SMASH && !Role_if(PM_HUSSY) && !uswapwep->hvycurse) {
818 curse(uswapwep);
819 uswapwep->hvycurse = 1;
820 if (uswapwep->spe > -10) uswapwep->spe = -10;
823 if (uswapwep && uswapwep->oartifact == ART_SANDRA_S_EVIL_MINDDRILL) {
824 if (uswapwep->spe > -20) uswapwep->spe--;
827 if (uswapwep && uswapwep->oartifact == ART_ATLUS_HEAVE) {
828 if (uswapwep->spe > -20) uswapwep->spe--;
829 if (uswapwep->spe <= -20) {
830 curse(uswapwep); uswapwep->hvycurse = uswapwep->prmcurse = uswapwep->stckcurse = TRUE;
832 pline("Your weapon seems less effective.");
833 if (PlayerHearsSoundEffects) pline(issoviet ? "Vse, chto vy vladeyete budet razocharovalsya v zabveniye, kha-kha-kha!" : "Klatsch!");
836 if (uswapwep && uswapwep->oartifact == ART_HENRIETTA_S_MISTAKE && !uswapwep->hvycurse) {
837 curse(uswapwep);
838 uswapwep->hvycurse = 1;
839 if (!strncmpi(plname, "Henrietta", 10) || !strncmpi(plalias, "Henrietta", 10)) pline("Dear Henrietta, the dogs produced plenty of heaps of shit specially for you to step into! Please make sure you don't miss any of them.");
840 else pline("Apparently you want to repeat Henrietta's mistake. Oh well. Good luck avoiding all the heaps of shit now!");
843 if (uswapwep && uswapwep->oartifact == ART_BLADE_OF_GOTHMOG && !uswapwep->hvycurse) {
844 curse(uswapwep);
845 uswapwep->hvycurse = 1;
846 pline("A terrible black aura surrounds your sword...");
849 if (uswapwep && uswapwep->oartifact == ART_ARABELLA_S_MELEE_POWER) {
850 (void) makemon(&mons[PM_GUNNHILD_S_GENERAL_STORE], 0, 0, NO_MM_FLAGS);
853 if (uswapwep && uswapwep->oartifact == ART_ARABELLA_S_WARDING_HOE) {
854 curse(uswapwep);
855 uswapwep->hvycurse = uswapwep->prmcurse = uswapwep->evilcurse = 1;
858 if (uswapwep && uswapwep->oartifact == ART_ATOMIC_MISSING) {
859 curse(uswapwep);
860 pline("The ballista becomes cursed as you wield it.");
863 if (uswapwep && uswapwep->oartifact == ART_XIUHCOATL) {
864 curse(uswapwep);
865 pline("The atlatl becomes cursed as you wield it.");
868 if (uswapwep && uswapwep->oartifact == ART_FADED_USELESSNESS) {
869 curse(uswapwep);
870 pline("In order to prevent it from falling off, your knife curses itself.");
873 if (uswapwep && uswapwep->oartifact == ART_MCCAULEY_S_INTELLIGENCE) {
874 curse(uswapwep);
875 pline("Broad weapons are better than narrow weapons because their effect applies to more types of monsters.");
878 if (uswapwep && uswapwep->oartifact == ART_MCCAULEY_S_ARGUMENT) {
879 curse(uswapwep);
880 pline("Narrow weapons are worse than broad weapons because their effect applies to only a few types of monsters.");
884 if (uswapwep && uswapwep->oartifact == ART_BERSERK_RAGE) {
885 curse(uswapwep);
886 pline("Well, you cannot easily stop your berserk rage now.");
889 if (uswapwep && uswapwep->oartifact == ART_THRANDUIL_LOSSEHELIN && !uswapwep->hvycurse) {
890 curse(uswapwep);
891 uswapwep->hvycurse = 1;
892 pline("A terrible black aura surrounds your weapon...");
895 if (uswapwep && uswapwep->oartifact == ART_MANUELA_S_PRACTICANT_TERRO && !uswapwep->cursed) {
896 curse(uswapwep);
897 pline("The riding crop glows with an evil aura and forces you to terrorize innocent practicants!");
900 if (uswapwep && uswapwep->oartifact == ART_LUISA_S_CHARMING_BEAUTY && !uswapwep->cursed) {
901 curse(uswapwep);
902 pline("Luisa's beautiful high-heeled lady boot refuses to be put away. Use it wisely!");
905 if (uswapwep && uswapwep->oartifact == ART_AND_IT_KEEPS_ON_MOVING && !uswapwep->cursed) {
906 curse(uswapwep);
907 pline("Your weapon is cursed now, and you will keep on moving.");
910 if (uswapwep && uswapwep->oartifact == ART_AMY_S_FIRST_GIRLFRIEND && !uswapwep->cursed) {
911 curse(uswapwep);
912 pline("You let out a deep sigh as the beautiful, soft girl shoe becomes cursed.");
915 if (uswapwep && uswapwep->oartifact == ART_BANG_BANG && uswapwep->spe < 2) uswapwep->spe = 2;
917 if (uswapwep && uswapwep->oartifact == ART_DEADLY_GAMBLING && !rn2(100) ) {
918 u.youaredead = 1;
919 pline("BANG! You die.");
920 killer_format = KILLED_BY;
921 killer = "deadly gambling";
922 done(DIED);
923 u.youaredead = 0;
926 if (uswapwep && uswapwep->oartifact == ART_GUN_CONTROL_LAWS && !uswapwep->cursed) {
927 curse(uswapwep);
928 pline("Oh no! Morgoth curses your gun as you wield it!");
931 if (uswapwep && uswapwep->oartifact == ART_POINT_DEXTER) FemaleTrapGreta |= FROMOUTSIDE;
933 if (uswapwep && uswapwep->oartifact == ART_OVERHEATER && !uswapwep->cursed) {
934 curse(uswapwep);
935 pline("Your weapon becomes cursed!");
938 if (uswapwep && uswapwep->oartifact == ART_KINGS_RANSOM_FOR_YOU) {
939 curse(uswapwep);
940 uswapwep->hvycurse = uswapwep->prmcurse = uswapwep->evilcurse = 1;
941 pline("You realize that you've made a horrible mistake.");
944 if (uswapwep && (AutocursingEquipment || u.uprops[AUTOCURSE_EQUIP].extrinsic || have_autocursestone())) {
945 curse(uswapwep);
947 if (AutocursingXtra) {
948 if (!rn2(2)) {
949 uswapwep->cursed = uswapwep->hvycurse = TRUE;
950 if (!rn2(5)) uswapwep->prmcurse = TRUE;
952 if (!rn2(2)) {
953 uswapwep->cursed = uswapwep->stckcurse = TRUE;
959 if (uswapwep && uswapwep->spe > -10 && (TrashingBugEffect || u.uprops[TRASHING_EFFECT].extrinsic || have_trashstone())) uswapwep->spe--;
966 ready_weapon(wep, put_away)
967 struct obj *wep;
968 boolean put_away;
970 /* Separated function so swapping works easily */
971 int res = 0;
973 if (!wep) {
974 /* No weapon */
975 if (uwep) {
977 You("are empty %s.", body_part(HANDED));
979 /* BUG: doing this while the secondary hand has a lit lightsaber doesn't turn it off! fix that! --Amy */
980 if (u.twoweap && uswapwep) {
981 if (yn("Unwield your secondary weapon too?") == 'y') {
982 unwield(uswapwep, TRUE);
983 untwoweapon();
987 setuwep((struct obj *) 0, put_away, TRUE);
989 /* You can just drop your weapon and pick it back up in zero turns, so unwielding something should not
990 * take time either.
991 * Except in Soviet Russia of course, where dropping and picking up items isn't free, because nothing done
992 * by the player is allowed to be free in communism. --Amy */
993 if (issoviet) {
994 res++;
995 pline("Teper' vy s pustymi rukami. Eto stoit povorot, tak kak tip bloka l'da KHE-KHE nenavidit vas.");
997 } else
998 You("are already empty %s.", body_part(HANDED));
999 } else if ( (!uarmg || FingerlessGloves) && (!Stone_resistance || (!IntStone_resistance && !rn2(20)) ) && wep->otyp == CORPSE
1000 && touch_petrifies(&mons[wep->corpsenm])) {
1001 /* Prevent wielding cockatrice when not wearing gloves --KAA */
1002 static char kbuf[BUFSZ];
1004 You("wield the %s corpse in your bare %s.",
1005 mons[wep->corpsenm].mname, makeplural(body_part(HAND)));
1006 sprintf(kbuf, "wielding a petrifying corpse");
1007 instapetrify(kbuf);
1008 } else if ( (!uarmg || FingerlessGloves) && (!Stone_resistance || (!IntStone_resistance && !rn2(20)) ) && wep->otyp == EGG && wep->corpsenm != PM_PLAYERMON
1009 && touch_petrifies(&mons[wep->corpsenm])) {
1010 /* Prevent wielding cockatrice when not wearing gloves --KAA */
1011 static char kbuf[BUFSZ];
1013 You("wield the %s egg in your bare %s.",
1014 mons[wep->corpsenm].mname, makeplural(body_part(HAND)));
1015 sprintf(kbuf, "wielding a petrifying egg");
1016 instapetrify(kbuf);
1017 } else if ( (!uarmg || FingerlessGloves) && (!Stone_resistance || (!IntStone_resistance && !rn2(20)) ) && wep->otyp == PETRIFYIUM_BAR) {
1018 /* Prevent wielding cockatrice when not wearing gloves --KAA */
1019 static char kbuf[BUFSZ];
1021 You("wield the petrifyium bar in your bare %s.", makeplural(body_part(HAND)));
1022 sprintf(kbuf, "wielding a petrifyium bar");
1023 instapetrify(kbuf);
1024 } else if ( (!uarmg || FingerlessGloves) && (!Stone_resistance || (!IntStone_resistance && !rn2(20)) ) && wep->otyp == PETRIFYIUM_BRA) {
1025 /* Prevent wielding cockatrice when not wearing gloves --KAA */
1026 static char kbuf[BUFSZ];
1028 You("wield the petrifyium bra in your bare %s.", body_part(HAND));
1029 sprintf(kbuf, "wielding a petrifyium bra");
1030 instapetrify(kbuf);
1031 } else if (uarms && (uarms->otyp != GRIM_SHIELD && !Race_if(PM_THRALL) && !Race_if(PM_URGOTH) && !Race_if(PM_ZAUR) && !Race_if(PM_WYLVAN)) && bimanual(wep))
1032 You("cannot wield a two-handed %s while wearing a shield.",
1033 is_sword(wep) ? "sword" :
1034 wep->otyp == BATTLE_AXE ? "axe" : "weapon");
1036 else if (bimanual(wep) && Race_if(PM_LICH_WARRIOR) && !Upolyd )
1037 pline("As a lich, you cannot wield a two-handed weapon.");
1038 /* Yes I know, a lich barbarian will start out wielding that axe. --Amy */
1040 else if (bimanual(wep) && Race_if(PM_HAND) && !Upolyd )
1041 pline("As a hand, you cannot wield a two-handed weapon.");
1043 else if (!is_launcher(wep) && Race_if(PM_ELONA_SNAIL) && !Upolyd )
1044 pline("As a snail, you can only wield launchers.");
1045 /* in Elona, launchers have their separate slot, but not so here --Amy */
1047 else if (wep->oartifact && !touch_artifact(wep, &youmonst)) {
1048 res++; /* takes a turn even though it doesn't get wielded */
1049 } else if (tech_inuse(T_EVISCERATE)) {
1050 /* WAC - if you have 'L' has claws out and wields weapon,
1051 * can't retract claws
1053 You("can't retract your claws!");
1054 } else {
1055 /* Weapon WILL be wielded after this point */
1056 res++;
1057 if (will_weld(wep)) {
1058 const char *tmp = xname(wep), *thestr = "The ";
1059 if (strncmp(tmp, thestr, 4) && !strncmp(The(tmp),thestr,4))
1060 tmp = thestr;
1061 else tmp = "";
1062 pline("%s%s %s to your %s!", tmp, aobjnam(wep, "weld"),
1063 (wep->quan == 1L) ? "itself" : "themselves", /* a3 */
1064 bimanual(wep) ?
1065 (const char *)makeplural(body_part(HAND))
1066 : body_part(HAND));
1067 wep->bknown = TRUE;
1068 } else {
1069 /* The message must be printed before setuwep (since
1070 * you might die and be revived from changing weapons),
1071 * and the message must be before the death message and
1072 * Lifesaved rewielding. Yet we want the message to
1073 * say "weapon in hand", thus this kludge.
1075 long dummy = wep->owornmask;
1076 wep->owornmask |= W_WEP;
1077 if (Race_if(PM_ELEMENTAL) && wep && weapon_type(wep) != P_NONE) wep->known = TRUE; /* elementals will recognize enchantment --Amy */
1078 prinv((char *)0, wep, 0L);
1079 wep->owornmask = dummy;
1081 setuwep(wep, put_away, TRUE);
1083 /* KMH -- Talking artifacts are finally implemented */
1084 arti_speak(wep);
1086 if ((wep->oartifact == ART_SUNSWORD || wep->oartifact == ART_SUNSCREEN || wep->oartifact == ART_SUNTINOPENER || wep->oartifact == ART_SUNRUBBERHOSE) && !wep->lamplit) {
1087 begin_burn(wep, FALSE);
1088 if (!Blind)
1089 pline("%s to glow brilliantly!", Tobjnam(wep, "begin"));
1092 if (wep->oartifact == ART_WIRE_OF_LUCK) set_moreluck();
1094 #if 0
1095 /* we'll get back to this someday, but it's not balanced yet */
1096 if (Race_if(PM_ELF) && !wep->oartifact &&
1097 objects[wep->otyp].oc_material == MT_IRON) {
1098 /* Elves are averse to wielding cold iron */
1099 You("have an uneasy feeling about wielding cold iron.");
1100 change_luck(-1);
1102 #endif
1104 if (wep->unpaid) {
1105 struct monst *this_shkp;
1107 if ((this_shkp = shop_keeper(inside_shop(u.ux, u.uy))) !=
1108 (struct monst *)0) {
1109 pline("%s says \"You be careful with my %s!\"",
1110 shkname(this_shkp),
1111 xname(wep));
1115 return(res);
1118 void
1119 setuqwep(obj)
1120 register struct obj *obj;
1122 setworn(obj, W_QUIVER);
1123 update_inventory();
1126 void
1127 setuswapwep(obj, put_away)
1128 register struct obj *obj;
1129 boolean put_away;
1131 struct obj *oldswapwep = uswapwep;
1132 setworn(obj, W_SWAPWEP);
1134 if (oldswapwep && oldswapwep != uswapwep)
1135 unwield(oldswapwep, put_away);
1136 update_inventory();
1140 /*** Commands to change particular slot(s) ***/
1142 static NEARDATA const char wield_objs[] =
1143 { ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, TOOL_CLASS, BALL_CLASS, CHAIN_CLASS, VENOM_CLASS, 0 };
1144 static NEARDATA const char ready_objs[] =
1145 { ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, VENOM_CLASS, 0 };
1146 static NEARDATA const char bullets[] = /* (note: different from dothrow.c) */
1147 { ALL_CLASSES, ALLOW_NONE, GEM_CLASS, WEAPON_CLASS, VENOM_CLASS, 0 };
1150 dowield()
1152 register struct obj *wep, *oldwep;
1153 int result;
1155 /* May we attempt this? */
1156 multi = 0;
1157 if (cantwield(youmonst.data) && !Race_if(PM_TRANSFORMER) && !Race_if(PM_HUMAN_WRAITH) ) {
1158 pline("Don't be ridiculous! Your current form cannot realistically wield a weapon!");
1160 if (yn("Try anyway?") == 'y') {
1161 if (rn2(3) && !polyskillchance()) {
1162 make_confused(HConfusion + rnd(40),FALSE);
1163 pline("Uhh... that didn't seem to work.");
1164 if (!rn2(20)) badeffect();
1165 return 1;
1168 else {return(0);}
1172 if (Race_if(PM_HUMAN_WRAITH) && (u.uhpmax < 2 || u.uhp < 2) ) {pline("You don't have enough health to wield weapons!");
1173 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1174 return 0;
1177 if (Race_if(PM_HUMAN_WRAITH)) {
1179 if (yn("Wielding a weapon as a wraith will permanently damage your health. Do it anyway?") == 'y') {
1181 u.uhp -= 1;
1182 u.uhpmax -= 1;
1183 if (Upolyd) {
1184 u.mh -= 1;
1185 u.mhmax -= 1;
1189 else return 0;
1193 /* Prompt for a new weapon */
1194 if (!(wep = getobj(wield_objs, "wield")))
1195 /* Cancelled */
1196 return (0);
1197 else if (wep == uwep) {
1198 You("are already wielding that!");
1199 if (is_weptool(wep)) unweapon = FALSE; /* [see setuwep()] */
1200 return (0);
1201 } else if (welded(uwep)) {
1202 weldmsg(uwep);
1203 /* previously interrupted armor removal mustn't be resumed */
1204 reset_remarm();
1205 return (0);
1208 /* Handle no object, or object in other slot */
1209 if (wep == &zeroobj)
1210 wep = (struct obj *) 0;
1211 else if (wep == uswapwep && !Race_if(PM_HUMAN_WRAITH) && !cantwield(youmonst.data) ) {
1212 if (powerfulimplants() && uimplant && uimplant->oartifact == ART_REAL_TIME_SWITCHING) {
1213 doswapweapon();
1214 return 0;
1215 } else {
1216 return (doswapweapon());
1218 }else if (wep == uswapwep && Race_if(PM_HUMAN_WRAITH) ) {
1220 pline("You now have no secondary weapon readied.");
1221 setuswapwep((struct obj *) 0, FALSE);
1223 else if (wep == uquiver)
1224 setuqwep((struct obj *) 0);
1225 else if (wep->owornmask & (W_ARMOR | W_RING | W_AMUL | W_IMPLANT | W_TOOL
1226 | W_SADDLE
1227 )) {
1228 You("cannot wield that!");
1229 return (0);
1232 if (EpviProblemActive && wep && (objects[wep->otyp].oc_minlvl > (u.ulevel + u.xtralevelmult - 1) ) ) {
1233 verbalize("I cannot use that yet.");
1234 return(0);
1237 /* Set your new primary weapon */
1238 oldwep = uwep;
1239 result = ready_weapon(wep, TRUE);
1240 if (flags.pushweapon && oldwep && uwep != oldwep)
1241 setuswapwep(oldwep, TRUE);
1242 if (uwep && bimanual(uwep)) untwoweapon();
1243 if (!(InterfaceScrewed || u.uprops[INTERFACE_SCREW].extrinsic || have_interfacescrewstone())) (void)doredraw();
1245 if (powerfulimplants() && uimplant && uimplant->oartifact == ART_REAL_TIME_SWITCHING) return 0;
1246 return (result);
1250 doswapweapon()
1252 register struct obj *oldwep, *oldswap;
1253 int result = 0;
1256 /* May we attempt this? */
1257 multi = 0;
1258 if (cantwield(youmonst.data) && !Race_if(PM_TRANSFORMER) && !Race_if(PM_HUMAN_WRAITH) ) {
1260 pline("Don't be ridiculous! Your current form cannot realistically wield a weapon!");
1262 if (yn("Try anyway?") == 'y') {
1263 if (rn2(3) && !polyskillchance()) {
1264 make_confused(HConfusion + rnd(40),FALSE);
1265 pline("Uhh... that didn't seem to work.");
1266 if (!rn2(20)) badeffect();
1267 return 1;
1270 else {return(0);}
1273 if (Race_if(PM_HUMAN_WRAITH) && (u.uhpmax < 2 || u.uhp < 2) ) {pline("You don't have enough health to wield weapons!");
1274 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1275 return 0;
1278 if (Race_if(PM_HUMAN_WRAITH)) {
1280 if (yn("Wielding a weapon as a wraith will permanently damage your health. Do it anyway?") == 'y') {
1282 u.uhp -= 1;
1283 u.uhpmax -= 1;
1284 if (Upolyd) {
1285 u.mh -= 1;
1286 u.mhmax -= 1;
1290 else return 0;
1294 if (welded(uwep)) {
1295 weldmsg(uwep);
1296 return (0);
1299 /* Unwield your current secondary weapon */
1300 oldwep = uwep;
1301 oldswap = uswapwep;
1302 if (uswapwep) {
1303 unwield(uswapwep, FALSE);
1304 if (wizard) pline("swapweapon was unwielded.");
1306 if (u.twoweap) {
1307 if (wizard) pline("twoweap was forcibly set to zero.");
1309 u.twoweap = 0;
1310 setuswapwep((struct obj *) 0, FALSE);
1312 /* Set your new primary weapon */
1313 result = ready_weapon(oldswap, TRUE);
1315 /* Set your new secondary weapon */
1316 if (uwep == oldwep)
1317 /* Wield failed for some reason */
1318 setuswapwep(oldswap, FALSE);
1319 else {
1320 setuswapwep(oldwep, FALSE);
1321 if (uswapwep)
1322 prinv((char *)0, uswapwep, 0L);
1323 else
1324 You("have no secondary weapon readied.");
1327 if (u.twoweap && !can_twoweapon())
1328 untwoweapon();
1329 if (!(InterfaceScrewed || u.uprops[INTERFACE_SCREW].extrinsic || have_interfacescrewstone())) (void)doredraw();
1331 if (powerfulimplants() && uimplant && uimplant->oartifact == ART_REAL_TIME_SWITCHING) return 0;
1332 return (result);
1336 dowieldquiver()
1338 register struct obj *newquiver;
1339 const char *quivee_types = (uslinging() ||
1340 (uswapwep && objects[uswapwep->otyp].oc_skill == P_SLING)) ?
1341 bullets : ready_objs;
1343 /* Since the quiver isn't in your hands, don't check cantwield(), */
1344 /* will_weld(), touch_petrifies(), etc. */
1345 multi = 0;
1347 /* Slash'EM has used Q for quiver since it started */
1348 /* Because 'Q' used to be quit... */
1349 if (flags.suppress_alert < FEATURE_NOTICE_VER(0,0,0))
1350 pline("Note: Please use #quit if you wish to exit the game.");
1352 /* Prompt for a new quiver */
1353 if (!(newquiver = getobj(quivee_types, "ready")))
1354 /* Cancelled */
1355 return (0);
1357 /* Handle no object, or object in other slot */
1358 /* Any type is okay, since we give no intrinsics anyways */
1359 if (newquiver == &zeroobj) {
1360 /* Explicitly nothing */
1361 if (uquiver) {
1362 You("now have no ammunition readied.");
1363 setuqwep(newquiver = (struct obj *) 0);
1364 } else {
1365 You("already have no ammunition readied!");
1366 return(0);
1368 } else if (newquiver == uquiver) {
1369 pline("That ammunition is already readied!");
1370 return(0);
1371 } else if (newquiver == uwep) {
1372 /* Prevent accidentally readying the main weapon */
1373 pline("%s already being used as a weapon!",
1374 !is_plural(uwep) ? "That is" : "They are");
1375 return(0);
1376 } else if (newquiver->owornmask & (W_ARMOR | W_RING | W_AMUL | W_IMPLANT | W_TOOL
1377 | W_SADDLE
1378 )) {
1379 You("cannot ready that!");
1380 return (0);
1381 } else {
1382 long dummy;
1385 /* Check if it's the secondary weapon */
1386 if (newquiver == uswapwep) {
1387 setuswapwep((struct obj *) 0, TRUE);
1388 untwoweapon();
1391 /* Okay to put in quiver; print it */
1392 dummy = newquiver->owornmask;
1393 newquiver->owornmask |= W_QUIVER;
1394 prinv((char *)0, newquiver, 0L);
1395 newquiver->owornmask = dummy;
1398 if (EpviProblemActive && newquiver && (objects[newquiver->otyp].oc_minlvl > (u.ulevel + u.xtralevelmult - 1) ) ) {
1399 verbalize("I cannot use that yet.");
1400 return(0);
1403 /* Finally, place it in the quiver */
1404 setuqwep(newquiver);
1405 /* Take no time since this is a convenience slot */
1406 return (0);
1409 /* used for #rub and for applying pick-axe, whip, grappling hook, or polearm */
1410 /* (moved from apply.c) */
1411 boolean
1412 wield_tool(obj, verb)
1413 struct obj *obj;
1414 const char *verb; /* "rub",&c */
1416 const char *what;
1417 boolean more_than_1;
1419 if (obj == uwep) return TRUE; /* nothing to do if already wielding it */
1421 if (!verb) verb = "wield";
1422 what = xname(obj);
1423 more_than_1 = (obj->quan > 1L ||
1424 strstri(what, "pair of ") != 0 ||
1425 strstri(what, "s of ") != 0);
1427 if (obj->owornmask & (W_ARMOR|W_RING|W_AMUL|W_IMPLANT|W_TOOL)) {
1428 char yourbuf[BUFSZ];
1430 You_cant("%s %s %s while wearing %s.",
1431 verb, shk_your(yourbuf, obj), what,
1432 more_than_1 ? "them" : "it");
1433 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1434 return FALSE;
1436 if (welded(uwep)) {
1437 if (flags.verbose) {
1438 const char *hand = body_part(HAND);
1440 if (bimanual(uwep)) hand = makeplural(hand);
1441 if (strstri(what, "pair of ") != 0) more_than_1 = FALSE;
1442 pline(
1443 "Since your weapon is welded to your %s, you cannot %s %s %s.",
1444 hand, verb, more_than_1 ? "those" : "that", xname(obj));
1445 } else {
1446 You_cant("do that.");
1448 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1449 return FALSE;
1451 if (cantwield(youmonst.data) && !Race_if(PM_TRANSFORMER) ) {
1452 You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
1453 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1454 return FALSE;
1456 /* check shield */
1458 if (bimanual(obj) && Race_if(PM_LICH_WARRIOR) && !Upolyd ) {
1459 pline("As a lich, you cannot wield a two-handed weapon.");
1460 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1461 return FALSE;
1464 if (bimanual(obj) && Race_if(PM_HAND) && !Upolyd ) {
1465 pline("As a lich, you cannot wield a two-handed weapon.");
1466 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1467 return FALSE;
1470 if (!is_launcher(obj) && Race_if(PM_ELONA_SNAIL) && !Upolyd ) {
1471 pline("As a snail, you can only wield launchers.");
1472 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1473 return FALSE;
1476 if (uarms && (uarms->otyp != GRIM_SHIELD && !Race_if(PM_THRALL) && !Race_if(PM_URGOTH) && !Race_if(PM_ZAUR) && !Race_if(PM_WYLVAN)) && bimanual(obj)) {
1477 You("cannot %s a two-handed %s while wearing a shield.",
1478 verb, (obj->oclass == WEAPON_CLASS) ? "weapon" : "tool");
1479 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1480 return FALSE;
1483 if (Race_if(PM_HUMAN_WRAITH) && (u.uhpmax < 2 || u.uhp < 2) ) {pline("You don't have enough health to wield tools!");
1484 if (flags.moreforced && !MessagesSuppressed) display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1485 return FALSE;
1488 if (Race_if(PM_HUMAN_WRAITH)) {
1490 if (yn("Wielding a tool as a wraith will permanently damage your health. Do it anyway?") == 'y') {
1492 u.uhp -= 1;
1493 u.uhpmax -= 1;
1494 if (Upolyd) {
1495 u.mh -= 1;
1496 u.mhmax -= 1;
1500 else return FALSE;
1504 if (uquiver == obj) setuqwep((struct obj *)0);
1505 if (uswapwep == obj) {
1506 (void) doswapweapon();
1507 /* doswapweapon might fail */
1508 if (uswapwep == obj) return FALSE;
1509 } else {
1510 You("now wield %s.", doname(obj));
1511 setuwep(obj, TRUE, TRUE);
1513 if (uwep != obj) return FALSE; /* rewielded old object after dying */
1514 /* applying weapon or tool that gets wielded ends two-weapon combat */
1515 if (u.twoweap && uwep && bimanual(uwep))
1516 untwoweapon();
1517 if (obj->oclass != WEAPON_CLASS && !is_weptool(obj))
1518 unweapon = TRUE;
1519 return TRUE;
1522 /* WAC
1523 * For the purposes of SLASH'EM, artifacts should be wieldable in either hand
1526 can_twoweapon()
1528 char buf[BUFSZ];
1529 const char *what;
1530 boolean disallowed_by_race;
1531 boolean disallowed_by_role;
1532 struct obj *otmp;
1534 #define NOT_WEAPON(obj) (obj && !is_weptool(obj) && obj->oclass != WEAPON_CLASS && obj->oclass != BALL_CLASS && obj->oclass != GEM_CLASS && obj->oclass != CHAIN_CLASS && obj->oclass != VENOM_CLASS)
1535 if (!could_twoweap(youmonst.data) && !(uactivesymbiosis && mons[u.usymbiote.mnum].mattk[1].aatyp == AT_WEAP ) && (uwep || uswapwep)) {
1536 what = uwep && uswapwep ? "two weapons" : "more than one weapon";
1537 if (cantwield(youmonst.data) && !Race_if(PM_TRANSFORMER) )
1538 pline("Don't be ridiculous! Your current form has enough trouble wielding ONE weapon!");
1539 else if (Upolyd)
1540 You_cant("use %s in your current form.", what);
1541 else {
1542 disallowed_by_role = P_MAX_SKILL(P_TWO_WEAPON_COMBAT) < P_BASIC;
1543 disallowed_by_race = youmonst.data->mattk[1].aatyp != AT_WEAP;
1544 *buf = '\0';
1545 if (!disallowed_by_role)
1546 strcpy(buf, disallowed_by_race ? urace.noun : urace.adj);
1547 if (disallowed_by_role || !disallowed_by_race) {
1548 if (!disallowed_by_role)
1549 strcat(buf, " ");
1550 strcat(buf, (flags.female && urole.name.f) ?
1551 urole.name.f : urole.name.m);
1553 pline("%s aren't able to use %s at once.",
1554 makeplural(upstart(buf)), what);
1556 } else if (cantwield(youmonst.data) && !Race_if(PM_TRANSFORMER) )
1557 pline("Don't be ridiculous! Your current form has enough trouble wielding ONE weapon!");
1558 else if (youmonst.data->mattk[1].aatyp != AT_WEAP &&
1559 youmonst.data->mattk[1].aatyp != AT_CLAW &&
1560 !(uactivesymbiosis && mons[u.usymbiote.mnum].mattk[1].aatyp == AT_WEAP ) ) {
1561 if (Upolyd)
1562 You_cant("fight with two %s in your current form.",
1563 makeplural(body_part(HAND)));
1564 else
1565 pline("%s aren't able to fight two-handed.",
1566 upstart(makeplural(urace.noun)));
1567 } else if ((NOT_WEAPON(uwep) && issoviet) || NOT_WEAPON(uswapwep)) {
1568 otmp = NOT_WEAPON(uwep) ? uwep : uswapwep;
1569 pline("%s %s.", Yname2(otmp),
1570 is_plural(otmp) ? "aren't weapons" : "isn't a weapon");
1571 if (issoviet && NOT_WEAPON(uwep)) pline("Zamedlit'! Pochemu ty voobshche igrayesh' v etu duratskuyu igru?");
1572 } else if ((uwep && bimanual(uwep)) || (uswapwep && bimanual(uswapwep))) {
1573 otmp = (uwep && bimanual(uwep)) ? uwep : uswapwep;
1574 pline("%s isn't one-handed.", Yname2(otmp));
1575 } else if (uarms && uarms->otyp != GRIM_SHIELD && !Race_if(PM_THRALL) && !Race_if(PM_URGOTH) && !Race_if(PM_ZAUR) && !Race_if(PM_WYLVAN)) {
1576 if (uwep || uswapwep)
1577 what = uwep && uswapwep ? "use two weapons" :
1578 "use more than one weapon";
1579 else {
1580 sprintf(buf, "fight with two %s", makeplural(body_part(HAND)));
1581 what = buf;
1583 You_cant("%s while wearing a shield.", what);
1585 /* WAC: TODO: cannot wield conflicting alignment artifacts*/
1586 #if 0
1587 else if (uswapwep->oartifact && ...)
1588 pline("%s resists being held second to another weapon!",
1589 Yname2(uswapwep));
1590 #endif
1591 else if ( (!uarmg || FingerlessGloves) && (!Stone_resistance || (!IntStone_resistance && !rn2(20)) ) &&
1592 (uswapwep && uswapwep->otyp == CORPSE &&
1593 (touch_petrifies(&mons[uswapwep->corpsenm])))) {
1594 static char kbuf[BUFSZ];
1596 You("wield the %s corpse with your bare %s.",
1597 mons[uswapwep->corpsenm].mname, body_part(HAND));
1598 sprintf(kbuf, "wielding a petrifying corpse");
1599 instapetrify(kbuf);
1600 } else if ( (!uarmg || FingerlessGloves) && (!Stone_resistance || (!IntStone_resistance && !rn2(20)) ) &&
1601 (uswapwep && uswapwep->otyp == EGG && uswapwep->corpsenm != PM_PLAYERMON &&
1602 (touch_petrifies(&mons[uswapwep->corpsenm])))) {
1603 static char kbuf[BUFSZ];
1605 You("wield the %s egg with your bare %s.",
1606 mons[uswapwep->corpsenm].mname, body_part(HAND));
1607 sprintf(kbuf, "wielding a petrifying egg");
1608 instapetrify(kbuf);
1609 } else if ( (!uarmg || FingerlessGloves) && (!Stone_resistance || (!IntStone_resistance && !rn2(20)) ) &&
1610 (uswapwep && uswapwep->otyp == PETRIFYIUM_BAR)) {
1611 static char kbuf[BUFSZ];
1613 You("wield the petrifyium bar with your bare %s.", body_part(HAND));
1614 sprintf(kbuf, "wielding a petrifyium bar");
1615 instapetrify(kbuf);
1616 } else if ( (!uarmg || FingerlessGloves) && (!Stone_resistance || (!IntStone_resistance && !rn2(20)) ) &&
1617 (uswapwep && uswapwep->otyp == PETRIFYIUM_BRA)) {
1618 static char kbuf[BUFSZ];
1620 You("wield the petrifyium bra with your bare %s.", body_part(HAND));
1621 sprintf(kbuf, "wielding a petrifyium bra");
1622 instapetrify(kbuf);
1623 } else if (uswapwep && (IsGlib || (uswapwep->cursed && (PlayerCannotUseSkills || (P_SKILL(P_TWO_WEAPON_COMBAT) < P_EXPERT) ) ) )) {
1624 if (!IsGlib)
1625 uswapwep->bknown = TRUE;
1626 drop_uswapwep();
1627 } else
1628 return (TRUE); /* Passes all the checks */
1630 /* Otherwise */
1631 return (FALSE);
1634 void
1635 drop_uswapwep()
1637 char str[BUFSZ];
1638 struct obj *obj = uswapwep;
1640 /* Avoid trashing makeplural's static buffer */
1641 strcpy(str, makeplural(body_part(HAND)));
1642 Your("%s from your %s!", aobjnam(obj, "slip"), str);
1643 setuswapwep((struct obj *) 0, FALSE);
1644 dropx(obj);
1648 dotwoweapon()
1650 /* You can always toggle it off */
1651 if (u.twoweap) {
1652 if (uwep)
1653 You("switch to your primary weapon.");
1654 else if (uswapwep) {
1655 You("are empty %s.", body_part(HANDED));
1656 unweapon = TRUE;
1657 } else
1658 You("switch to your right %s.", body_part(HAND));
1659 if (uswapwep)
1660 unwield(uswapwep, TRUE);
1661 u.twoweap = 0;
1662 update_inventory();
1663 return (0);
1666 /* May we use two weapons? */
1667 if (can_twoweapon()) {
1668 /* Success! */
1669 if (uwep && uswapwep)
1670 You("begin two-weapon combat.");
1671 else if (uwep || uswapwep) {
1672 You("begin fighting with a weapon and your %s %s.",
1673 uwep ? "left" : "right", body_part(HAND));
1674 unweapon = FALSE;
1675 } else if (Upolyd)
1676 You("begin fighting with two %s.",
1677 makeplural(body_part(HAND)));
1678 else
1679 You("begin two-handed combat.");
1680 u.twoweap = 1;
1681 update_inventory();
1682 return (rnd(20) > ACURR(A_DEX));
1684 return (0);
1687 /*** Functions to empty a given slot ***/
1688 /* These should be used only when the item can't be put back in
1689 * the slot by life saving. Proper usage includes:
1690 * 1. The item has been eaten, stolen, burned away, or rotted away.
1691 * 2. Making an item disappear for a bones pile.
1693 void
1694 uwepgone()
1696 if (uwep) {
1698 if (artifact_light(uwep) && uwep->lamplit) {
1699 end_burn(uwep, FALSE);
1700 if (!Blind) pline("%s glowing.", Tobjnam(uwep, "stop"));
1702 unwield(uwep, FALSE);
1703 setworn((struct obj *)0, W_WEP);
1704 unweapon = TRUE;
1705 update_inventory();
1706 if (!(InterfaceScrewed || u.uprops[INTERFACE_SCREW].extrinsic || have_interfacescrewstone())) (void)doredraw();
1710 void
1711 uswapwepgone()
1713 if (uswapwep) {
1714 setworn((struct obj *)0, W_SWAPWEP);
1715 update_inventory();
1719 void
1720 uqwepgone()
1722 if (uquiver) {
1723 setworn((struct obj *)0, W_QUIVER);
1724 update_inventory();
1728 void
1729 untwoweapon()
1731 if (u.twoweap) {
1732 if (uwep && uswapwep)
1733 You("can no longer use two weapons at once.");
1734 else if (cantwield(youmonst.data))
1735 You("can no longer control which %s to fight with.",
1736 body_part(HAND));
1737 else
1738 You("can no longer use two %s to fight.",
1739 makeplural(body_part(HAND)));
1740 if (uswapwep)
1741 unwield(uswapwep, TRUE);
1742 u.twoweap = FALSE;
1744 if (wizard) pline("untwoweapon was called");
1746 update_inventory();
1748 return;
1751 /* Maybe rust object, or corrode it if acid damage is called for */
1752 void
1753 erode_obj(target, acid_dmg, fade_scrolls)
1754 struct obj *target; /* object (e.g. weapon or armor) to erode */
1755 boolean acid_dmg;
1756 boolean fade_scrolls;
1758 int erosion;
1759 struct monst *victim;
1760 boolean vismon;
1761 boolean visobj;
1763 if (!target)
1764 return;
1765 victim = carried(target) ? &youmonst :
1766 mcarried(target) ? target->ocarry : (struct monst *)0;
1767 vismon = victim && (victim != &youmonst) && canseemon(victim);
1768 visobj = !victim && cansee(bhitpos.x, bhitpos.y); /* assume thrown */
1770 erosion = acid_dmg ? target->oeroded2 : target->oeroded;
1772 if (stack_too_big(target)) return;
1774 if (target->oartifact && rn2(4)) return;
1776 if (itemhasappearance(target, APP_BRAND_NEW_GLOVES) && rn2(4) ) return;
1778 if (itemhasappearance(target, APP_IMAGINARY_HEELS) ) return;
1780 if (target->oartifact == ART_RATCH_CLOSURE_SCRATCHING && rn2(4) ) return;
1782 if (target->oartifact == ART_SARTIRO ) return;
1783 if (target->oartifact == ART_CUMBERSOME_DESC ) return;
1784 if (target->oartifact == ART_GOODRES_ELVEN ) return;
1785 if (target->oartifact == ART_PARTICULARLY_SOLID_SKULL ) return;
1787 if (target->oartifact == ART_EXTENDED_DURABILITY && rn2(4)) return;
1789 if (uarm && uarm->oartifact == ART_CANNOT_BE_HARMED_BLA_BLA && (target->owornmask & W_ARMOR) ) return;
1791 if (uwep && uwep->oartifact == ART_SLAM_ && rn2(10) && (target->owornmask & W_ARMOR) ) return;
1793 if (target->oartifact == ART_PROOFINGNESS_POOFS && !target->rknown) return;
1795 if (itemhasappearance(target, APP_WITHERED_CLOAK) ) return;
1797 if (uarmf && !rn2(2) && uarmf->oartifact == ART_LUISA_S_IRRESISTIBLE_CHARM) return;
1799 if (target->greased && (!issoviet || !rn2(2)) ) {
1800 grease_protect(target,(char *)0,victim);
1801 } else if (target->oclass == SCROLL_CLASS) {
1802 if(fade_scrolls && target->otyp != SCR_BLANK_PAPER && !target->oartifact && target->otyp != SCR_HEALING && target->otyp != SCR_EXTRA_HEALING && target->otyp != SCR_STANDARD_ID && target->otyp != SCR_HEAL_OTHER && target->otyp != SCR_MANA && target->otyp != SCR_GREATER_MANA_RESTORATION && target->otyp != SCR_CURE && target->otyp != SCR_PHASE_DOOR
1803 #ifdef MAIL
1804 && target->otyp != SCR_MAIL
1805 #endif
1808 if (!Blind) {
1809 if (victim == &youmonst)
1810 Your("%s.", aobjnam(target, "fade"));
1811 else if (vismon)
1812 pline("%s's %s.", Monnam(victim),
1813 aobjnam(target, "fade"));
1814 else if (visobj)
1815 pline_The("%s.", aobjnam(target, "fade"));
1817 target->otyp = SCR_BLANK_PAPER;
1818 target->spe = 0;
1820 } else if (target->oerodeproof || (Race_if(PM_CHIQUAI) && rn2(4)) ||
1821 (acid_dmg ? (!is_corrodeable(target) || (objects[target->otyp].oc_material == MT_GREEN_STEEL && rn2(2))) : (!is_rustprone(target) || (objects[target->otyp].oc_material == MT_COBALT && rn2(2) ) || (objects[target->otyp].oc_material == MT_BRONZE && rn2(2) ) )) ) {
1822 if (flags.verbose || !(target->oerodeproof && target->rknown)) {
1823 if (victim == &youmonst)
1824 Your("%s not affected.", aobjnam(target, "are"));
1825 else if (vismon)
1826 pline("%s's %s not affected.", Monnam(victim),
1827 aobjnam(target, "are"));
1828 /* no message if not carried */
1830 if (target->oerodeproof) target->rknown = TRUE;
1831 } else if (erosion < MAX_ERODE) {
1832 if (victim == &youmonst) {
1833 Your("%s%s!", aobjnam(target, acid_dmg ? "corrode" : "rust"),
1834 erosion+1 == MAX_ERODE ? " completely" :
1835 erosion ? " further" : "");
1836 if (issoviet && target->greased) pline("Sovetskiy khochet vash detal' byt' povrezhden, nesmotrya na smazku, potomu chto on takoy mudak!");
1837 } else if (vismon)
1838 pline("%s's %s%s!", Monnam(victim),
1839 aobjnam(target, acid_dmg ? "corrode" : "rust"),
1840 erosion+1 == MAX_ERODE ? " completely" :
1841 erosion ? " further" : "");
1842 else if (visobj)
1843 pline_The("%s%s!",
1844 aobjnam(target, acid_dmg ? "corrode" : "rust"),
1845 erosion+1 == MAX_ERODE ? " completely" :
1846 erosion ? " further" : "");
1847 if (acid_dmg)
1848 target->oeroded2++;
1849 else
1850 target->oeroded++;
1851 } else /*if (!target->oartifact)*/ {
1853 if (victim == &youmonst && !hard_to_destruct(target) && (!rn2(2) || !(uarmf && uarmf->oartifact == ART_LUISA_S_IRRESISTIBLE_CHARM) ) ) {
1854 pline("One of your items got vaporized!"),
1855 remove_worn_item(target, FALSE);
1856 if (target == uball) unpunish();
1857 useupall(target);
1858 uwepgone();
1859 update_inventory();
1862 /* the following code always crashes the game, unfortunately... --Amy */
1863 /*else {
1865 lethe_damage(target, TRUE, FALSE);*/
1867 /*pline("An item got vaporized!"),
1868 delobj(target);
1869 update_inventory();*/
1872 /* if (flags.verbose) {
1873 if (victim == &youmonst)
1874 Your("%s completely %s.",
1875 aobjnam(target, Blind ? "feel" : "look"),
1876 acid_dmg ? "corroded" : "rusty");
1877 else if (vismon)
1878 pline("%s's %s completely %s.", Monnam(victim),
1879 aobjnam(target, "look"),
1880 acid_dmg ? "corroded" : "rusty");
1881 else if (visobj)
1882 pline_The("%s completely %s.",
1883 aobjnam(target, "look"),
1884 acid_dmg ? "corroded" : "rusty");
1885 } */
1890 void
1891 wither_obj(target, acid_dmg, fade_scrolls)
1892 struct obj *target;
1893 boolean acid_dmg;
1894 boolean fade_scrolls;
1896 int erosion;
1897 struct monst *victim;
1898 boolean vismon;
1899 boolean visobj;
1901 if (!target)
1902 return;
1903 victim = carried(target) ? &youmonst :
1904 mcarried(target) ? target->ocarry : (struct monst *)0;
1905 vismon = victim && (victim != &youmonst) && canseemon(victim);
1906 visobj = !victim && cansee(bhitpos.x, bhitpos.y); /* assume thrown */
1908 erosion = (rn2(2) ? target->oeroded2 : target->oeroded);
1910 if (stack_too_big(target)) return;
1912 if (target->oartifact && rn2(4)) return;
1914 if (itemhasappearance(target, APP_BRAND_NEW_GLOVES) && rn2(4) ) return;
1916 if (itemhasappearance(target, APP_IMAGINARY_HEELS) ) return;
1918 if (target->oartifact == ART_SARTIRO ) return;
1919 if (target->oartifact == ART_CUMBERSOME_DESC ) return;
1920 if (target->oartifact == ART_GOODRES_ELVEN ) return;
1921 if (target->oartifact == ART_PARTICULARLY_SOLID_SKULL ) return;
1923 if (target->oartifact == ART_EXTENDED_DURABILITY && rn2(4)) return;
1925 if (uarm && uarm->oartifact == ART_CANNOT_BE_HARMED_BLA_BLA && (target->owornmask & W_ARMOR) ) return;
1927 if (uwep && uwep->oartifact == ART_SLAM_ && rn2(10) && (target->owornmask & W_ARMOR) ) return;
1929 if (target->oartifact == ART_PROOFINGNESS_POOFS && !target->rknown) return;
1931 if (target->oartifact == ART_RATCH_CLOSURE_SCRATCHING && rn2(4) ) return;
1933 if (itemhasappearance(target, APP_WITHERED_CLOAK) ) return;
1935 if (uarmf && !rn2(2) && uarmf->oartifact == ART_LUISA_S_IRRESISTIBLE_CHARM) return;
1937 if (target->greased && (!issoviet || !rn2(2)) ) {
1938 grease_protect(target,(char *)0,victim);
1939 } else if (target->oclass == SCROLL_CLASS) {
1940 if(fade_scrolls && target->otyp != SCR_BLANK_PAPER && !target->oartifact && target->otyp != SCR_HEALING && target->otyp != SCR_EXTRA_HEALING && target->otyp != SCR_STANDARD_ID && target->otyp != SCR_HEAL_OTHER && target->otyp != SCR_MANA && target->otyp != SCR_GREATER_MANA_RESTORATION && target->otyp != SCR_CURE && target->otyp != SCR_PHASE_DOOR
1941 #ifdef MAIL
1942 && target->otyp != SCR_MAIL
1943 #endif
1946 if (!Blind) {
1947 if (victim == &youmonst)
1948 Your("%s.", aobjnam(target, "fade"));
1949 else if (vismon)
1950 pline("%s's %s.", Monnam(victim),
1951 aobjnam(target, "fade"));
1952 else if (visobj)
1953 pline_The("%s.", aobjnam(target, "fade"));
1955 target->otyp = SCR_BLANK_PAPER;
1956 target->spe = 0;
1958 } else if (is_unwitherable(target) || (Race_if(PM_CHIQUAI) && rn2(4)) ) {
1959 if (flags.verbose || !(target->oerodeproof && target->rknown)) {
1960 if (victim == &youmonst)
1961 Your("%s not affected.", aobjnam(target, "are"));
1962 else if (vismon)
1963 pline("%s's %s not affected.", Monnam(victim),
1964 aobjnam(target, "are"));
1965 /* no message if not carried */
1967 if (target->oerodeproof) target->rknown = TRUE;
1968 } else if (erosion < MAX_ERODE) {
1969 if (victim == &youmonst) {
1970 Your("%s%s!", aobjnam(target, acid_dmg ? "corrode" : "rust"),
1971 erosion+1 == MAX_ERODE ? " completely" :
1972 erosion ? " further" : "");
1973 if (issoviet && target->greased) pline("Sovetskiy khochet vash detal' byt' povrezhden, nesmotrya na smazku, potomu chto on takoy mudak!");
1974 } else if (vismon)
1975 pline("%s's %s%s!", Monnam(victim),
1976 aobjnam(target, acid_dmg ? "corrode" : "rust"),
1977 erosion+1 == MAX_ERODE ? " completely" :
1978 erosion ? " further" : "");
1979 else if (visobj)
1980 pline_The("%s%s!",
1981 aobjnam(target, acid_dmg ? "corrode" : "rust"),
1982 erosion+1 == MAX_ERODE ? " completely" :
1983 erosion ? " further" : "");
1984 if (acid_dmg)
1985 target->oeroded2++;
1986 else
1987 target->oeroded++;
1988 } else {
1990 if (victim == &youmonst && !hard_to_destruct(target) && (!rn2(2) || !(uarmf && uarmf->oartifact == ART_LUISA_S_IRRESISTIBLE_CHARM) ) ) {
1991 pline("One of your items got vaporized!"),
1992 remove_worn_item(target, FALSE);
1993 if (target == uball) unpunish();
1994 useupall(target);
1995 uwepgone();
1996 update_inventory();
2002 void
2003 enchantarmor_prompt()
2005 register schar s;
2006 boolean special_armor;
2007 boolean same_color;
2008 struct obj *otmp;
2010 if (CannotSelectItemsInPrompts) return;
2011 pline("You may enchant a worn piece of armor.");
2012 enchantarmorchoice:
2013 otmp = getobj(allnoncount, "magically enchant");
2015 if(!otmp) {
2016 if (yn("Really exit with no object selected?") == 'y')
2017 pline("You just wasted the opportunity to enchant your armor.");
2018 else goto enchantarmorchoice;
2019 pline((!Blind) ? "Your skin glows then fades." : "Your skin feels warm for a moment.");
2020 exercise(A_CON, TRUE);
2021 exercise(A_STR, TRUE);
2022 return;
2024 if (!(otmp->owornmask & W_ARMOR) ) {
2025 You("have a feeling of loss.");
2026 return;
2029 /* elven armor vibrates warningly when enchanted beyond a limit */
2030 special_armor = is_elven_armor(otmp) || otmp->otyp == KYRT_SHIRT ||
2031 (Role_if(PM_WIZARD) && otmp->otyp == CORNUTHAUM) ||
2032 (Role_if(PM_VANILLA_VALK) && otmp->otyp == GAUNTLETS_OF_POWER) ||
2033 (Role_if(PM_VALKYRIE) && otmp->otyp == GAUNTLETS_OF_POWER);
2035 same_color =
2036 (otmp->otyp == SILVER_DRAGON_SCALE_MAIL ||
2037 otmp->otyp == SILVER_DRAGON_SCALES ||
2038 otmp->otyp == SHIELD_OF_REFLECTION);
2039 if (Blind) same_color = FALSE;
2041 /* KMH -- catch underflow */
2042 s = otmp->spe;
2044 if (s > (is_droven_armor(otmp) ? 8 : special_armor ? 5 : 3) && rn2(s) && !rn2(3) ) {
2046 if (otmp->oartifact) {
2047 otmp->spe = 0;
2048 Your("%s violently %s%s%s for a while, then %s.", xname(otmp),
2049 otense(otmp, Blind ? "vibrate" : "glow"),
2050 (!Blind && !same_color) ? " " : nul,
2051 (Blind || same_color) ? nul : NH_SILVER,
2052 otense(otmp, "fade"));
2054 return;
2057 Your("%s violently %s%s%s for a while, then %s.",
2058 xname(otmp), otense(otmp, Blind ? "vibrate" : "glow"),
2059 (!Blind && !same_color) ? " " : nul,
2060 (Blind || same_color) ? nul :
2061 hcolor(NH_SILVER),
2062 otense(otmp, "evaporate"));
2063 if(is_cloak(otmp)) (void) Cloak_off();
2064 if(is_boots(otmp)) (void) Boots_off();
2065 if(is_helmet(otmp)) (void) Helmet_off();
2066 if(is_gloves(otmp)) (void) Gloves_off();
2067 if(is_shield(otmp)) (void) Shield_off();
2068 if(otmp == uarm) (void) Armor_gone();
2069 useup(otmp);
2070 return;
2073 if (otmp && objects[(otmp)->otyp].oc_material == MT_CELESTIUM && !stack_too_big(otmp)) {
2074 if (!otmp->cursed) bless(otmp);
2075 else uncurse(otmp, FALSE);
2078 /* KMH, balance patch -- Restore the NetHack success rate */
2079 /* We'll introduce a disenchantment attack later */
2080 s = 1;
2081 if (s >= 0 && otmp->otyp >= GRAY_DRAGON_SCALES && otmp->otyp <= YELLOW_DRAGON_SCALES) {
2082 /* dragon scales get turned into dragon scale mail */
2083 Your("%s merges and hardens!", xname(otmp));
2084 setworn((struct obj *)0, W_ARM);
2085 /* assumes same order */
2086 otmp->otyp = GRAY_DRAGON_SCALE_MAIL + otmp->otyp - GRAY_DRAGON_SCALES;
2088 if ((otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(100) ) {
2089 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2091 else if (otmp->prmcurse && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(10) ) {
2092 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2094 else if (!(otmp->prmcurse) && otmp->hvycurse && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(3) ) {
2095 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2097 else if (!(otmp->prmcurse) && !(otmp->hvycurse) && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) ) otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2099 otmp->known = 1;
2100 setworn(otmp, W_ARM);
2101 return;
2103 if (s >= 0 && otmp->otyp == LIZARD_SCALES) {
2104 Your("%s merges and hardens!", xname(otmp));
2105 setworn((struct obj *)0, W_ARM);
2106 otmp->otyp = LIZARD_SCALE_MAIL;
2108 if ((otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(100) ) {
2109 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2111 else if (otmp->prmcurse && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(10) ) {
2112 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2114 else if (!(otmp->prmcurse) && otmp->hvycurse && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(3) ) {
2115 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2117 else if (!(otmp->prmcurse) && !(otmp->hvycurse) && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) ) otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2119 otmp->known = 1;
2120 setworn(otmp, W_ARM);
2121 return;
2124 Your("%s %s%s%s%s for a %s.",
2125 xname(otmp), s == 0 ? "violently " : nul,
2126 otense(otmp, Blind ? "vibrate" : "glow"),
2127 (!Blind && !same_color) ? " " : nul,
2128 (Blind || same_color) ? nul : hcolor(NH_SILVER),
2129 (s*s>1) ? "while" : "moment");
2130 otmp->cursed = ( ((otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && rn2(100)) || (otmp->prmcurse && rn2(10)) || (otmp->hvycurse && rn2(3)) ) ;
2131 if ((!otmp->blessed) && !otmp->cursed)
2132 otmp->blessed = FALSE;
2133 if (s) {
2134 otmp->spe += s;
2135 if (Race_if(PM_SPARD) && s > 0) otmp->spe++;
2138 if ((otmp->spe > (is_droven_armor(otmp) ? 8 : special_armor ? 5 : 3)) &&
2139 (special_armor || !rn2(7)))
2140 Your("%s suddenly %s %s.",
2141 xname(otmp), otense(otmp, "vibrate"),
2142 Blind ? "again" : "unexpectedly");
2144 if (practicantterror && otmp && otmp->spe >= 5 && !u.pract_enchantarmor) {
2145 pline("%s rings out: 'I told you that you may not disguise as a tank! Just for that it costs 1000 zorkmids and 1000 stones now.'", noroelaname());
2146 fineforpracticant(1000, 1000, 0);
2147 u.pract_enchantarmor = TRUE;
2153 chwepon(otmp, amount)
2154 register struct obj *otmp;
2155 register int amount;
2157 const char *color = hcolor((amount < 0) ? NH_BLACK : NH_BLUE);
2158 const char *xtime;
2159 int otyp = STRANGE_OBJECT;
2161 if(!uwep || (uwep->oclass != WEAPON_CLASS && uwep->oclass != BALL_CLASS && uwep->oclass != GEM_CLASS && uwep->oclass != CHAIN_CLASS && uwep->oclass != VENOM_CLASS && !is_weptool(uwep))) {
2162 char buf[BUFSZ];
2164 sprintf(buf, "Your %s %s.", makeplural(body_part(HAND)),
2165 (amount >= 0) ? "twitch" : "itch");
2166 strange_feeling(otmp, buf);
2167 exercise(A_DEX, (boolean) (amount >= 0));
2168 return(0);
2171 if (otmp && otmp->oclass == SCROLL_CLASS) otyp = otmp->otyp;
2173 if(uwep->otyp == WORM_TOOTH && amount >= 0) {
2174 uwep->otyp = CRYSKNIFE;
2175 uwep->oerodeproof = 0;
2176 Your("weapon seems sharper now.");
2178 if ((uwep->morgcurse || uwep->evilcurse || uwep->bbrcurse) && !rn2(100) ) {
2179 uwep->prmcurse = uwep->hvycurse = uwep->cursed = uwep->morgcurse = uwep->evilcurse = uwep->bbrcurse = uwep->stckcurse = 0;
2181 else if (uwep->prmcurse && !(uwep->morgcurse || uwep->evilcurse || uwep->bbrcurse) && !rn2(10) ) {
2182 uwep->prmcurse = uwep->hvycurse = uwep->cursed = uwep->morgcurse = uwep->evilcurse = uwep->bbrcurse = uwep->stckcurse = 0;
2184 else if (!(uwep->prmcurse) && !(uwep->morgcurse || uwep->evilcurse || uwep->bbrcurse) && uwep->hvycurse && !rn2(3) ) {
2185 uwep->prmcurse = uwep->hvycurse = uwep->cursed = uwep->morgcurse = uwep->evilcurse = uwep->bbrcurse = uwep->stckcurse = 0;
2187 else if (!(uwep->prmcurse) && !(uwep->hvycurse) && !(uwep->morgcurse || uwep->evilcurse || uwep->bbrcurse) ) uwep->prmcurse = uwep->hvycurse = uwep->cursed = uwep->morgcurse = uwep->evilcurse = uwep->bbrcurse = uwep->stckcurse = 0;
2189 if (otyp != STRANGE_OBJECT) makeknown(otyp);
2190 return(1);
2193 if(uwep->otyp == CRYSKNIFE && amount < 0) {
2194 if (!uwep->oartifact) uwep->otyp = WORM_TOOTH;
2195 uwep->oerodeproof = 0;
2196 Your("weapon seems duller now.");
2197 if (otyp != STRANGE_OBJECT && otmp->bknown) makeknown(otyp);
2198 return(1);
2201 if (amount < 0 && uwep->oartifact && restrict_name(uwep, ONAME(uwep))) {
2202 if (!Blind)
2203 Your("%s %s.", aobjnam(uwep, "faintly glow"), color);
2204 return(1);
2206 /* there is a (soft) upper and lower limit to uwep->spe */
2207 if(((uwep->spe > ((uwep->oartifact == ART_MIDDLING_PIDDLING) ? 19 : is_droven_weapon(uwep) ? 10 : is_elven_weapon(uwep) ? 8 : 5) && amount >= 0) || (uwep->spe < -5 && amount < 0)) && rn2(3) && !rn2(3) ) {
2209 if (uwep->oartifact) {
2210 uwep->spe = 0;
2211 Your("%s %s for a while and then %s.",
2212 aobjnam(uwep, "violently glow"), color,
2213 otense(uwep, "fade"));
2214 return(1);
2216 if (!Blind)
2217 Your("%s %s for a while and then %s.",
2218 aobjnam(uwep, "violently glow"), color,
2219 otense(uwep, "evaporate"));
2220 else
2221 Your("%s.", aobjnam(uwep, "evaporate"));
2223 useupall(uwep); /* let all of them disappear */
2224 return(1);
2226 if (!Blind) {
2227 xtime = (amount*amount == 1) ? "moment" : "while";
2228 Your("%s %s for a %s.",
2229 aobjnam(uwep, amount == 0 ? "violently glow" : "glow"),
2230 color, xtime);
2231 if (otyp != STRANGE_OBJECT && uwep->known &&
2232 (amount > 0 || (amount < 0 && otmp->bknown)))
2233 makeknown(otyp);
2235 uwep->spe += amount;
2236 if (uwep && uwep->oartifact == ART_BOARDED_SHELF && amount > 0 && uwep->spe < 22) uwep->spe += 4;
2237 if (Race_if(PM_SPARD) && amount > 0) uwep->spe++;
2238 if(amount > 0) {
2240 if (uwep && objects[(uwep)->otyp].oc_material == MT_CELESTIUM) {
2241 if (!uwep->cursed) bless(uwep);
2242 else uncurse(uwep, FALSE);
2245 if ((uwep->morgcurse || uwep->evilcurse || uwep->bbrcurse) && !rn2(100) ) {
2246 uwep->prmcurse = uwep->hvycurse = uwep->cursed = uwep->morgcurse = uwep->evilcurse = uwep->bbrcurse = uwep->stckcurse = 0;
2248 else if (uwep->prmcurse && !(uwep->morgcurse || uwep->evilcurse || uwep->bbrcurse) && !rn2(10) ) {
2249 uwep->prmcurse = uwep->hvycurse = uwep->cursed = uwep->morgcurse = uwep->evilcurse = uwep->bbrcurse = uwep->stckcurse = 0;
2251 else if (!(uwep->prmcurse) && !(uwep->morgcurse || uwep->evilcurse || uwep->bbrcurse) && uwep->hvycurse && !rn2(3) ) {
2252 uwep->prmcurse = uwep->hvycurse = uwep->cursed = uwep->morgcurse = uwep->evilcurse = uwep->bbrcurse = uwep->stckcurse = 0;
2254 else if (!(uwep->prmcurse) && !(uwep->hvycurse) && !(uwep->morgcurse || uwep->evilcurse || uwep->bbrcurse) ) uwep->prmcurse = uwep->hvycurse = uwep->cursed = uwep->morgcurse = uwep->evilcurse = uwep->bbrcurse = uwep->stckcurse = 0;
2259 * Enchantment, which normally improves a weapon, has an
2260 * addition adverse reaction on Magicbane whose effects are
2261 * spe dependent. Give an obscure clue here.
2263 if (uwep->oartifact == ART_MAGICBANE && uwep->spe >= 0) {
2264 Your("right %s %sches!",
2265 body_part(HAND),
2266 (((amount > 1) && (uwep->spe > 1)) ? "flin" : "it"));
2269 /* an elven magic clue, cookie@keebler */
2270 /* elven weapons vibrate warningly when enchanted beyond a limit */
2271 if ((uwep->spe > ((uwep->oartifact == ART_MIDDLING_PIDDLING) ? 19 : is_droven_weapon(uwep) ? 10 : is_elven_weapon(uwep) ? 8 : 5) )
2272 && (is_elven_weapon(uwep) || uwep->oartifact || !rn2(7)))
2273 Your("%s unexpectedly.",
2274 aobjnam(uwep, "suddenly vibrate"));
2276 return(1);
2280 chwepon_other(otmp, amount)
2281 register struct obj *otmp;
2282 register int amount;
2284 const char *color = hcolor((amount < 0) ? NH_BLACK : NH_BLUE);
2285 const char *xtime;
2287 if(!otmp || (otmp->oclass != WEAPON_CLASS && otmp->oclass != BALL_CLASS && otmp->oclass != GEM_CLASS && otmp->oclass != CHAIN_CLASS && otmp->oclass != VENOM_CLASS && !is_weptool(otmp))) {
2288 char buf[BUFSZ];
2290 sprintf(buf, "Your %s %s.", makeplural(body_part(HAND)),
2291 (amount >= 0) ? "twitch" : "itch");
2292 exercise(A_DEX, (boolean) (amount >= 0));
2293 return(0);
2296 if(otmp->otyp == WORM_TOOTH && amount >= 0) {
2297 otmp->otyp = CRYSKNIFE;
2298 otmp->oerodeproof = 0;
2299 Your("weapon seems sharper now.");
2301 if ((otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(100) ) {
2302 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2304 else if (otmp->prmcurse && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(10) ) {
2305 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2307 else if (!(otmp->prmcurse) && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && otmp->hvycurse && !rn2(3) ) {
2308 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2310 else if (!(otmp->prmcurse) && !(otmp->hvycurse) && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) ) otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2312 return(1);
2315 if(otmp->otyp == CRYSKNIFE && amount < 0) {
2316 if (!otmp->oartifact) otmp->otyp = WORM_TOOTH;
2317 otmp->oerodeproof = 0;
2318 Your("weapon seems duller now.");
2319 return(1);
2322 if (amount < 0 && otmp->oartifact && restrict_name(otmp, ONAME(otmp))) {
2323 if (!Blind)
2324 Your("%s %s.", aobjnam(otmp, "faintly glow"), color);
2325 return(1);
2327 /* there is a (soft) upper and lower limit to otmp->spe */
2328 if(((otmp->spe > ((uwep->oartifact == ART_MIDDLING_PIDDLING) ? 19 : is_droven_weapon(otmp) ? 10 : is_elven_weapon(otmp) ? 8 : 5) && amount >= 0) || (otmp->spe < -5 && amount < 0)) && rn2(3) && !rn2(3) ) {
2330 if (otmp->oartifact) {
2331 otmp->spe = 0;
2332 Your("%s %s for a while and then %s.",
2333 aobjnam(otmp, "violently glow"), color,
2334 otense(otmp, "fade"));
2335 return(1);
2337 if (!Blind)
2338 Your("%s %s for a while and then %s.",
2339 aobjnam(otmp, "violently glow"), color,
2340 otense(otmp, "evaporate"));
2341 else
2342 Your("%s.", aobjnam(otmp, "evaporate"));
2344 useupall(otmp); /* let all of them disappear */
2345 return(1);
2347 if (!Blind) {
2348 xtime = (amount*amount == 1) ? "moment" : "while";
2349 Your("%s %s for a %s.",
2350 aobjnam(otmp, amount == 0 ? "violently glow" : "glow"),
2351 color, xtime);
2353 otmp->spe += amount;
2354 if (otmp && otmp->oartifact == ART_BOARDED_SHELF && amount > 0 && otmp->spe < 22) otmp->spe += 4;
2355 if (Race_if(PM_SPARD) && amount > 0) otmp->spe++;
2356 if(amount > 0) {
2358 if (otmp && objects[(otmp)->otyp].oc_material == MT_CELESTIUM) {
2359 if (!otmp->cursed) bless(otmp);
2360 else uncurse(otmp, FALSE);
2363 if ((otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(100) ) {
2364 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2366 else if (otmp->prmcurse && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && !rn2(10) ) {
2367 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2369 else if (!(otmp->prmcurse) && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) && otmp->hvycurse && !rn2(3) ) {
2370 otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2372 else if (!(otmp->prmcurse) && !(otmp->hvycurse) && !(otmp->morgcurse || otmp->evilcurse || otmp->bbrcurse) ) otmp->prmcurse = otmp->hvycurse = otmp->cursed = otmp->morgcurse = otmp->evilcurse = otmp->bbrcurse = otmp->stckcurse = 0;
2377 * Enchantment, which normally improves a weapon, has an
2378 * addition adverse reaction on Magicbane whose effects are
2379 * spe dependent. Give an obscure clue here.
2381 if (otmp->oartifact == ART_MAGICBANE && otmp->spe >= 0) {
2382 Your("right %s %sches!",
2383 body_part(HAND),
2384 (((amount > 1) && (otmp->spe > 1)) ? "flin" : "it"));
2387 /* an elven magic clue, cookie@keebler */
2388 /* elven weapons vibrate warningly when enchanted beyond a limit */
2389 if ((otmp->spe > ((uwep->oartifact == ART_MIDDLING_PIDDLING) ? 19 : is_droven_weapon(otmp) ? 10 : is_elven_weapon(otmp) ? 8 : 5) )
2390 && (is_elven_weapon(otmp) || otmp->oartifact || !rn2(7)))
2391 Your("%s unexpectedly.",
2392 aobjnam(otmp, "suddenly vibrate"));
2394 return(1);
2398 welded(obj)
2399 register struct obj *obj;
2401 if (obj && obj == uwep && will_weld(obj)) {
2402 obj->bknown = TRUE;
2403 return 1;
2405 return 0;
2408 void
2409 weldmsg(obj)
2410 register struct obj *obj;
2412 long savewornmask;
2414 savewornmask = obj->owornmask;
2415 Your("%s %s welded to your %s!",
2416 xname(obj), otense(obj, "are"),
2417 bimanual(obj) ? (const char *)makeplural(body_part(HAND))
2418 : body_part(HAND));
2419 obj->owornmask = savewornmask;
2422 void
2423 unwield(obj, put_away)
2424 register struct obj *obj;
2425 boolean put_away;
2427 if (obj && obj->oartifact == ART_HYPER_INTELLIGENCE) {
2428 if (u.superdebt < 10000000) { /* filthy exploit exploiter who thinks he can overflow the counter! FU! --Amy */
2429 addplayerdebt(rnd(100), TRUE);
2430 Your("debts have increased to %d because you're not allowed to put this weapon away.", u.moneydebt + u.superdebt);
2434 /* MRKR: Extinguish torches when they are put away */
2435 if (put_away && obj->otyp == TORCH && obj->lamplit) {
2436 You("extinguish %s before putting it away.", yname(obj));
2437 end_burn(obj, TRUE);
2439 else if (put_away && is_lightsaber(obj) && obj->lamplit &&
2440 !artifact_light(obj)){
2441 char yourbuf[BUFSZ];
2442 You("deactivate %s %s before putting it away.", shk_your(yourbuf, obj), xname(obj));
2443 end_burn(obj, TRUE);
2446 if (!(InterfaceScrewed || u.uprops[INTERFACE_SCREW].extrinsic || have_interfacescrewstone())) (void)doredraw();
2449 /*wield.c*/