4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
15 static bool eat_food(object_type
*o_ptr
, bool *ident
)
17 /* Analyze the food */
22 if (!(p_ptr
->resist_pois
|| p_ptr
->timed
[TMD_OPP_POIS
]))
24 if (inc_timed(TMD_POISONED
, rand_int(10) + 10))
32 case SV_FOOD_BLINDNESS
:
34 if (!p_ptr
->resist_blind
)
36 if (inc_timed(TMD_BLIND
, rand_int(200) + 200))
44 case SV_FOOD_PARANOIA
:
46 if (!p_ptr
->resist_fear
)
48 if (inc_timed(TMD_AFRAID
, rand_int(10) + 10))
56 case SV_FOOD_CONFUSION
:
58 if (!p_ptr
->resist_confu
)
60 if (inc_timed(TMD_CONFUSED
, rand_int(10) + 10))
68 case SV_FOOD_HALLUCINATION
:
70 if (!p_ptr
->resist_chaos
)
72 if (inc_timed(TMD_IMAGE
, rand_int(250) + 250))
80 case SV_FOOD_PARALYSIS
:
84 if (inc_timed(TMD_PARALYZED
, rand_int(10) + 10))
92 case SV_FOOD_WEAKNESS
:
94 take_hit(damroll(6, 6), "poisonous food");
95 (void)do_dec_stat(A_STR
);
100 case SV_FOOD_SICKNESS
:
102 take_hit(damroll(6, 6), "poisonous food");
103 (void)do_dec_stat(A_CON
);
108 case SV_FOOD_STUPIDITY
:
110 take_hit(damroll(8, 8), "poisonous food");
111 (void)do_dec_stat(A_INT
);
116 case SV_FOOD_NAIVETY
:
118 take_hit(damroll(8, 8), "poisonous food");
119 (void)do_dec_stat(A_WIS
);
124 case SV_FOOD_UNHEALTH
:
126 take_hit(damroll(10, 10), "poisonous food");
127 (void)do_dec_stat(A_CON
);
132 case SV_FOOD_DISEASE
:
134 take_hit(damroll(10, 10), "poisonous food");
135 (void)do_dec_stat(A_STR
);
140 case SV_FOOD_CURE_POISON
:
142 if (clear_timed(TMD_POISONED
)) *ident
= TRUE
;
146 case SV_FOOD_CURE_BLINDNESS
:
148 if (clear_timed(TMD_BLIND
)) *ident
= TRUE
;
152 case SV_FOOD_CURE_PARANOIA
:
154 if (clear_timed(TMD_AFRAID
)) *ident
= TRUE
;
158 case SV_FOOD_CURE_CONFUSION
:
160 if (clear_timed(TMD_CONFUSED
)) *ident
= TRUE
;
164 case SV_FOOD_CURE_SERIOUS
:
166 if (hp_player(damroll(4, 8))) *ident
= TRUE
;
170 case SV_FOOD_RESTORE_STR
:
172 if (do_res_stat(A_STR
)) *ident
= TRUE
;
176 case SV_FOOD_RESTORE_CON
:
178 if (do_res_stat(A_CON
)) *ident
= TRUE
;
182 case SV_FOOD_RESTORING
:
184 if (do_res_stat(A_STR
)) *ident
= TRUE
;
185 if (do_res_stat(A_INT
)) *ident
= TRUE
;
186 if (do_res_stat(A_WIS
)) *ident
= TRUE
;
187 if (do_res_stat(A_DEX
)) *ident
= TRUE
;
188 if (do_res_stat(A_CON
)) *ident
= TRUE
;
189 if (do_res_stat(A_CHR
)) *ident
= TRUE
;
195 case SV_FOOD_BISCUIT
:
197 case SV_FOOD_SLIME_MOLD
:
199 msg_print("That tastes good.");
204 case SV_FOOD_WAYBREAD
:
206 msg_print("That tastes good.");
207 (void)clear_timed(TMD_POISONED
);
208 (void)hp_player(damroll(4, 8));
213 case SV_FOOD_PINT_OF_ALE
:
214 case SV_FOOD_PINT_OF_WINE
:
216 msg_print("That tastes good.");
222 /* Food can feed the player */
223 (void)set_food(p_ptr
->food
+ o_ptr
->pval
);
229 static bool quaff_potion(object_type
*o_ptr
, bool *ident
)
231 /* Analyze the potion */
234 case SV_POTION_WATER
:
235 case SV_POTION_APPLE_JUICE
:
236 case SV_POTION_SLIME_MOLD
:
238 msg_print("You feel less thirsty.");
243 case SV_POTION_SLOWNESS
:
245 if (inc_timed(TMD_SLOW
, randint(25) + 15)) *ident
= TRUE
;
249 case SV_POTION_SALT_WATER
:
251 msg_print("The potion makes you vomit!");
252 (void)set_food(PY_FOOD_STARVE
- 1);
253 (void)clear_timed(TMD_POISONED
);
254 (void)inc_timed(TMD_PARALYZED
, 4);
259 case SV_POTION_POISON
:
261 if (!(p_ptr
->resist_pois
|| p_ptr
->timed
[TMD_OPP_POIS
]))
263 if (inc_timed(TMD_POISONED
, rand_int(15) + 10))
271 case SV_POTION_BLINDNESS
:
273 if (!p_ptr
->resist_blind
)
275 if (inc_timed(TMD_BLIND
, rand_int(100) + 100))
283 case SV_POTION_CONFUSION
:
285 if (!p_ptr
->resist_confu
)
287 if (inc_timed(TMD_CONFUSED
, rand_int(20) + 15))
295 case SV_POTION_SLEEP
:
297 if (!p_ptr
->free_act
)
299 if (inc_timed(TMD_PARALYZED
, rand_int(4) + 4))
307 case SV_POTION_LOSE_MEMORIES
:
309 if (!p_ptr
->hold_life
&& (p_ptr
->exp
> 0))
311 msg_print("You feel your memories fade.");
312 lose_exp(p_ptr
->exp
/ 4);
318 case SV_POTION_RUINATION
:
320 msg_print("Your nerves and muscles feel weak and lifeless!");
321 take_hit(damroll(10, 10), "a potion of Ruination");
322 (void)dec_stat(A_DEX
, 25, TRUE
);
323 (void)dec_stat(A_WIS
, 25, TRUE
);
324 (void)dec_stat(A_CON
, 25, TRUE
);
325 (void)dec_stat(A_STR
, 25, TRUE
);
326 (void)dec_stat(A_CHR
, 25, TRUE
);
327 (void)dec_stat(A_INT
, 25, TRUE
);
332 case SV_POTION_DEC_STR
:
334 if (do_dec_stat(A_STR
)) *ident
= TRUE
;
338 case SV_POTION_DEC_INT
:
340 if (do_dec_stat(A_INT
)) *ident
= TRUE
;
344 case SV_POTION_DEC_WIS
:
346 if (do_dec_stat(A_WIS
)) *ident
= TRUE
;
350 case SV_POTION_DEC_DEX
:
352 if (do_dec_stat(A_DEX
)) *ident
= TRUE
;
356 case SV_POTION_DEC_CON
:
358 if (do_dec_stat(A_CON
)) *ident
= TRUE
;
362 case SV_POTION_DEC_CHR
:
364 if (do_dec_stat(A_CHR
)) *ident
= TRUE
;
368 case SV_POTION_DETONATIONS
:
370 msg_print("Massive explosions rupture your body!");
371 take_hit(damroll(50, 20), "a potion of Detonation");
372 (void)inc_timed(TMD_STUN
, 75);
373 (void)inc_timed(TMD_CUT
, 5000);
378 case SV_POTION_DEATH
:
380 msg_print("A feeling of Death flows through your body.");
381 take_hit(5000, "a potion of Death");
386 case SV_POTION_INFRAVISION
:
388 if (inc_timed(TMD_SINFRA
, 100 + randint(100)))
395 case SV_POTION_DETECT_INVIS
:
397 if (inc_timed(TMD_SINVIS
, 12 + randint(12)))
404 case SV_POTION_SLOW_POISON
:
406 if (set_timed(TMD_POISONED
, p_ptr
->timed
[TMD_POISONED
] / 2)) *ident
= TRUE
;
410 case SV_POTION_CURE_POISON
:
412 if (clear_timed(TMD_POISONED
)) *ident
= TRUE
;
416 case SV_POTION_BOLDNESS
:
418 if (clear_timed(TMD_AFRAID
)) *ident
= TRUE
;
422 case SV_POTION_SPEED
:
424 if (!p_ptr
->timed
[TMD_FAST
])
426 if (set_timed(TMD_FAST
, randint(25) + 15)) *ident
= TRUE
;
430 (void)inc_timed(TMD_FAST
, 5);
435 case SV_POTION_RESIST_HEAT
:
437 if (inc_timed(TMD_OPP_FIRE
, randint(10) + 10))
444 case SV_POTION_RESIST_COLD
:
446 if (inc_timed(TMD_OPP_COLD
, randint(10) + 10))
453 case SV_POTION_HEROISM
:
455 if (hp_player(10)) *ident
= TRUE
;
456 if (clear_timed(TMD_AFRAID
)) *ident
= TRUE
;
457 if (inc_timed(TMD_HERO
, randint(25) + 25)) *ident
= TRUE
;
461 case SV_POTION_BERSERK_STRENGTH
:
463 if (hp_player(30)) *ident
= TRUE
;
464 if (clear_timed(TMD_AFRAID
)) *ident
= TRUE
;
465 if (inc_timed(TMD_SHERO
, randint(25) + 25)) *ident
= TRUE
;
469 case SV_POTION_CURE_LIGHT
:
471 if (hp_player(damroll(2, 8))) *ident
= TRUE
;
472 if (clear_timed(TMD_BLIND
)) *ident
= TRUE
;
473 if (dec_timed(TMD_CUT
, 10)) *ident
= TRUE
;
477 case SV_POTION_CURE_SERIOUS
:
479 if (hp_player(damroll(4, 8))) *ident
= TRUE
;
480 if (clear_timed(TMD_BLIND
)) *ident
= TRUE
;
481 if (clear_timed(TMD_CONFUSED
)) *ident
= TRUE
;
482 if (set_timed(TMD_CUT
, (p_ptr
->timed
[TMD_CUT
] / 2) - 50)) *ident
= TRUE
;
486 case SV_POTION_CURE_CRITICAL
:
488 if (hp_player(damroll(6, 8))) *ident
= TRUE
;
489 if (clear_timed(TMD_BLIND
)) *ident
= TRUE
;
490 if (clear_timed(TMD_CONFUSED
)) *ident
= TRUE
;
491 if (clear_timed(TMD_POISONED
)) *ident
= TRUE
;
492 if (clear_timed(TMD_STUN
)) *ident
= TRUE
;
493 if (clear_timed(TMD_CUT
)) *ident
= TRUE
;
494 if (clear_timed(TMD_AMNESIA
)) *ident
= TRUE
;
498 case SV_POTION_HEALING
:
500 if (hp_player(300)) *ident
= TRUE
;
501 if (clear_timed(TMD_BLIND
)) *ident
= TRUE
;
502 if (clear_timed(TMD_CONFUSED
)) *ident
= TRUE
;
503 if (clear_timed(TMD_POISONED
)) *ident
= TRUE
;
504 if (clear_timed(TMD_STUN
)) *ident
= TRUE
;
505 if (clear_timed(TMD_CUT
)) *ident
= TRUE
;
506 if (clear_timed(TMD_AMNESIA
)) *ident
= TRUE
;
510 case SV_POTION_STAR_HEALING
:
512 if (hp_player(1200)) *ident
= TRUE
;
513 if (clear_timed(TMD_BLIND
)) *ident
= TRUE
;
514 if (clear_timed(TMD_CONFUSED
)) *ident
= TRUE
;
515 if (clear_timed(TMD_POISONED
)) *ident
= TRUE
;
516 if (clear_timed(TMD_STUN
)) *ident
= TRUE
;
517 if (clear_timed(TMD_CUT
)) *ident
= TRUE
;
518 if (clear_timed(TMD_AMNESIA
)) *ident
= TRUE
;
524 msg_print("You feel life flow through your body!");
526 (void)clear_timed(TMD_POISONED
);
527 (void)clear_timed(TMD_BLIND
);
528 (void)clear_timed(TMD_CONFUSED
);
529 (void)clear_timed(TMD_IMAGE
);
530 (void)clear_timed(TMD_STUN
);
531 (void)clear_timed(TMD_CUT
);
532 (void)clear_timed(TMD_AMNESIA
);
533 (void)do_res_stat(A_STR
);
534 (void)do_res_stat(A_CON
);
535 (void)do_res_stat(A_DEX
);
536 (void)do_res_stat(A_WIS
);
537 (void)do_res_stat(A_INT
);
538 (void)do_res_stat(A_CHR
);
540 /* Recalculate max. hitpoints */
549 case SV_POTION_RESTORE_MANA
:
551 if (p_ptr
->csp
< p_ptr
->msp
)
553 p_ptr
->csp
= p_ptr
->msp
;
555 msg_print("Your feel your head clear.");
556 p_ptr
->redraw
|= (PR_MANA
);
557 p_ptr
->window
|= (PW_PLAYER_0
| PW_PLAYER_1
);
563 case SV_POTION_RESTORE_EXP
:
565 if (restore_level()) *ident
= TRUE
;
569 case SV_POTION_RES_STR
:
571 if (do_res_stat(A_STR
)) *ident
= TRUE
;
575 case SV_POTION_RES_INT
:
577 if (do_res_stat(A_INT
)) *ident
= TRUE
;
581 case SV_POTION_RES_WIS
:
583 if (do_res_stat(A_WIS
)) *ident
= TRUE
;
587 case SV_POTION_RES_DEX
:
589 if (do_res_stat(A_DEX
)) *ident
= TRUE
;
593 case SV_POTION_RES_CON
:
595 if (do_res_stat(A_CON
)) *ident
= TRUE
;
599 case SV_POTION_RES_CHR
:
601 if (do_res_stat(A_CHR
)) *ident
= TRUE
;
605 case SV_POTION_INC_STR
:
607 if (do_inc_stat(A_STR
)) *ident
= TRUE
;
611 case SV_POTION_INC_INT
:
613 if (do_inc_stat(A_INT
)) *ident
= TRUE
;
617 case SV_POTION_INC_WIS
:
619 if (do_inc_stat(A_WIS
)) *ident
= TRUE
;
623 case SV_POTION_INC_DEX
:
625 if (do_inc_stat(A_DEX
)) *ident
= TRUE
;
629 case SV_POTION_INC_CON
:
631 if (do_inc_stat(A_CON
)) *ident
= TRUE
;
635 case SV_POTION_INC_CHR
:
637 if (do_inc_stat(A_CHR
)) *ident
= TRUE
;
641 case SV_POTION_AUGMENTATION
:
643 if (do_inc_stat(A_STR
)) *ident
= TRUE
;
644 if (do_inc_stat(A_INT
)) *ident
= TRUE
;
645 if (do_inc_stat(A_WIS
)) *ident
= TRUE
;
646 if (do_inc_stat(A_DEX
)) *ident
= TRUE
;
647 if (do_inc_stat(A_CON
)) *ident
= TRUE
;
648 if (do_inc_stat(A_CHR
)) *ident
= TRUE
;
652 case SV_POTION_ENLIGHTENMENT
:
654 msg_print("An image of your surroundings forms in your mind...");
660 case SV_POTION_STAR_ENLIGHTENMENT
:
662 msg_print("You begin to feel more enlightened...");
665 (void)do_inc_stat(A_INT
);
666 (void)do_inc_stat(A_WIS
);
667 (void)detect_traps();
668 (void)detect_doors();
669 (void)detect_stairs();
670 (void)detect_treasure();
671 (void)detect_objects_gold();
672 (void)detect_objects_normal();
674 self_knowledge(TRUE
);
679 case SV_POTION_SELF_KNOWLEDGE
:
681 msg_print("You begin to know yourself a little better...");
683 self_knowledge(TRUE
);
688 case SV_POTION_EXPERIENCE
:
690 if (p_ptr
->exp
< PY_MAX_EXP
)
692 s32b ee
= (p_ptr
->exp
/ 2) + 10;
693 if (ee
> 100000L) ee
= 100000L;
694 msg_print("You feel more experienced.");
706 static bool read_scroll(object_type
*o_ptr
, bool *ident
)
716 /* Analyze the scroll */
719 case SV_SCROLL_DARKNESS
:
721 if (!p_ptr
->resist_blind
)
723 (void)inc_timed(TMD_BLIND
, 3 + randint(5));
725 if (unlite_area(10, 3)) *ident
= TRUE
;
729 case SV_SCROLL_AGGRAVATE_MONSTER
:
731 msg_print("There is a high pitched humming noise.");
732 aggravate_monsters(0);
737 case SV_SCROLL_CURSE_ARMOR
:
739 if (curse_armor()) *ident
= TRUE
;
743 case SV_SCROLL_CURSE_WEAPON
:
745 if (curse_weapon()) *ident
= TRUE
;
749 case SV_SCROLL_SUMMON_MONSTER
:
751 sound(MSG_SUM_MONSTER
);
752 for (k
= 0; k
< randint(3); k
++)
754 if (summon_specific(py
, px
, p_ptr
->depth
, 0))
762 case SV_SCROLL_SUMMON_UNDEAD
:
764 sound(MSG_SUM_UNDEAD
);
765 for (k
= 0; k
< randint(3); k
++)
767 if (summon_specific(py
, px
, p_ptr
->depth
, SUMMON_UNDEAD
))
775 case SV_SCROLL_TRAP_CREATION
:
777 if (trap_creation()) *ident
= TRUE
;
781 case SV_SCROLL_PHASE_DOOR
:
788 case SV_SCROLL_TELEPORT
:
790 teleport_player(100);
795 case SV_SCROLL_TELEPORT_LEVEL
:
797 (void)teleport_player_level();
802 case SV_SCROLL_WORD_OF_RECALL
:
809 case SV_SCROLL_IDENTIFY
:
812 if (!ident_spell()) used_up
= FALSE
;
816 case SV_SCROLL_STAR_IDENTIFY
:
819 if (!identify_fully()) used_up
= FALSE
;
823 case SV_SCROLL_REMOVE_CURSE
:
827 msg_print("You feel as if someone is watching over you.");
833 case SV_SCROLL_STAR_REMOVE_CURSE
:
840 case SV_SCROLL_ENCHANT_ARMOR
:
843 if (!enchant_spell(0, 0, 1)) used_up
= FALSE
;
847 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT
:
849 if (!enchant_spell(1, 0, 0)) used_up
= FALSE
;
854 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM
:
856 if (!enchant_spell(0, 1, 0)) used_up
= FALSE
;
861 case SV_SCROLL_STAR_ENCHANT_ARMOR
:
863 if (!enchant_spell(0, 0, randint(3) + 2)) used_up
= FALSE
;
868 case SV_SCROLL_STAR_ENCHANT_WEAPON
:
870 if (!enchant_spell(randint(3), randint(3), 0)) used_up
= FALSE
;
875 case SV_SCROLL_RECHARGING
:
877 if (!recharge(60)) used_up
= FALSE
;
882 case SV_SCROLL_LIGHT
:
884 if (lite_area(damroll(2, 8), 2)) *ident
= TRUE
;
888 case SV_SCROLL_MAPPING
:
895 case SV_SCROLL_DETECT_GOLD
:
897 if (detect_treasure()) *ident
= TRUE
;
898 if (detect_objects_gold()) *ident
= TRUE
;
902 case SV_SCROLL_DETECT_ITEM
:
904 if (detect_objects_normal()) *ident
= TRUE
;
908 case SV_SCROLL_DETECT_TRAP
:
910 if (detect_traps()) *ident
= TRUE
;
914 case SV_SCROLL_DETECT_DOOR
:
916 if (detect_doors()) *ident
= TRUE
;
917 if (detect_stairs()) *ident
= TRUE
;
921 case SV_SCROLL_DETECT_INVIS
:
923 if (detect_monsters_invis()) *ident
= TRUE
;
927 case SV_SCROLL_SATISFY_HUNGER
:
929 if (set_food(PY_FOOD_MAX
- 1)) *ident
= TRUE
;
933 case SV_SCROLL_BLESSING
:
935 if (inc_timed(TMD_BLESSED
, randint(12) + 6)) *ident
= TRUE
;
939 case SV_SCROLL_HOLY_CHANT
:
941 if (inc_timed(TMD_BLESSED
, randint(24) + 12)) *ident
= TRUE
;
945 case SV_SCROLL_HOLY_PRAYER
:
947 if (inc_timed(TMD_BLESSED
, randint(48) + 24)) *ident
= TRUE
;
951 case SV_SCROLL_MONSTER_CONFUSION
:
953 if (p_ptr
->confusing
== 0)
955 msg_print("Your hands begin to glow.");
956 p_ptr
->confusing
= TRUE
;
962 case SV_SCROLL_PROTECTION_FROM_EVIL
:
965 if (inc_timed(TMD_PROTEVIL
, randint(25) + k
)) *ident
= TRUE
;
969 case SV_SCROLL_RUNE_OF_PROTECTION
:
976 case SV_SCROLL_TRAP_DOOR_DESTRUCTION
:
978 if (destroy_doors_touch()) *ident
= TRUE
;
982 case SV_SCROLL_STAR_DESTRUCTION
:
984 destroy_area(py
, px
, 15, TRUE
);
989 case SV_SCROLL_DISPEL_UNDEAD
:
991 if (dispel_undead(60)) *ident
= TRUE
;
995 case SV_SCROLL_BANISHMENT
:
997 if (!banishment()) used_up
= FALSE
;
1002 case SV_SCROLL_MASS_BANISHMENT
:
1004 (void)mass_banishment();
1009 case SV_SCROLL_ACQUIREMENT
:
1011 acquirement(py
, px
, 1, TRUE
);
1016 case SV_SCROLL_STAR_ACQUIREMENT
:
1018 acquirement(py
, px
, randint(2) + 1, TRUE
);
1028 static bool use_staff(object_type
*o_ptr
, bool *ident
)
1035 bool use_charge
= TRUE
;
1037 /* Analyze the staff */
1038 switch (o_ptr
->sval
)
1040 case SV_STAFF_DARKNESS
:
1042 if (!p_ptr
->resist_blind
)
1044 if (inc_timed(TMD_BLIND
, 3 + randint(5))) *ident
= TRUE
;
1046 if (unlite_area(10, 3)) *ident
= TRUE
;
1050 case SV_STAFF_SLOWNESS
:
1052 if (inc_timed(TMD_SLOW
, randint(30) + 15)) *ident
= TRUE
;
1056 case SV_STAFF_HASTE_MONSTERS
:
1058 if (speed_monsters()) *ident
= TRUE
;
1062 case SV_STAFF_SUMMONING
:
1064 sound(MSG_SUM_MONSTER
);
1065 for (k
= 0; k
< randint(4); k
++)
1067 if (summon_specific(py
, px
, p_ptr
->depth
, 0))
1075 case SV_STAFF_TELEPORTATION
:
1077 teleport_player(100);
1082 case SV_STAFF_IDENTIFY
:
1084 if (!ident_spell()) use_charge
= FALSE
;
1089 case SV_STAFF_REMOVE_CURSE
:
1093 if (!p_ptr
->timed
[TMD_BLIND
])
1095 msg_print("The staff glows blue for a moment...");
1102 case SV_STAFF_STARLITE
:
1104 if (!p_ptr
->timed
[TMD_BLIND
])
1106 msg_print("The end of the staff glows brightly...");
1108 for (k
= 0; k
< 8; k
++) lite_line(ddd
[k
]);
1115 if (lite_area(damroll(2, 8), 2)) *ident
= TRUE
;
1119 case SV_STAFF_MAPPING
:
1126 case SV_STAFF_DETECT_GOLD
:
1128 if (detect_treasure()) *ident
= TRUE
;
1129 if (detect_objects_gold()) *ident
= TRUE
;
1133 case SV_STAFF_DETECT_ITEM
:
1135 if (detect_objects_normal()) *ident
= TRUE
;
1139 case SV_STAFF_DETECT_TRAP
:
1141 if (detect_traps()) *ident
= TRUE
;
1145 case SV_STAFF_DETECT_DOOR
:
1147 if (detect_doors()) *ident
= TRUE
;
1148 if (detect_stairs()) *ident
= TRUE
;
1152 case SV_STAFF_DETECT_INVIS
:
1154 if (detect_monsters_invis()) *ident
= TRUE
;
1158 case SV_STAFF_DETECT_EVIL
:
1160 if (detect_monsters_evil()) *ident
= TRUE
;
1164 case SV_STAFF_CURE_LIGHT
:
1166 if (hp_player(randint(8))) *ident
= TRUE
;
1170 case SV_STAFF_CURING
:
1172 if (clear_timed(TMD_BLIND
)) *ident
= TRUE
;
1173 if (clear_timed(TMD_POISONED
)) *ident
= TRUE
;
1174 if (clear_timed(TMD_CONFUSED
)) *ident
= TRUE
;
1175 if (clear_timed(TMD_STUN
)) *ident
= TRUE
;
1176 if (clear_timed(TMD_CUT
)) *ident
= TRUE
;
1180 case SV_STAFF_HEALING
:
1182 if (hp_player(300)) *ident
= TRUE
;
1183 if (clear_timed(TMD_STUN
)) *ident
= TRUE
;
1184 if (clear_timed(TMD_CUT
)) *ident
= TRUE
;
1188 case SV_STAFF_THE_MAGI
:
1190 if (do_res_stat(A_INT
)) *ident
= TRUE
;
1191 if (p_ptr
->csp
< p_ptr
->msp
)
1193 p_ptr
->csp
= p_ptr
->msp
;
1194 p_ptr
->csp_frac
= 0;
1196 msg_print("Your feel your head clear.");
1197 p_ptr
->redraw
|= (PR_MANA
);
1198 p_ptr
->window
|= (PW_PLAYER_0
| PW_PLAYER_1
);
1203 case SV_STAFF_SLEEP_MONSTERS
:
1205 if (sleep_monsters()) *ident
= TRUE
;
1209 case SV_STAFF_SLOW_MONSTERS
:
1211 if (slow_monsters()) *ident
= TRUE
;
1215 case SV_STAFF_SPEED
:
1217 if (!p_ptr
->timed
[TMD_FAST
])
1219 if (set_timed(TMD_FAST
, randint(30) + 15)) *ident
= TRUE
;
1223 (void)inc_timed(TMD_FAST
, 5);
1228 case SV_STAFF_PROBING
:
1235 case SV_STAFF_DISPEL_EVIL
:
1237 if (dispel_evil(60)) *ident
= TRUE
;
1241 case SV_STAFF_POWER
:
1243 if (dispel_monsters(120)) *ident
= TRUE
;
1247 case SV_STAFF_HOLINESS
:
1249 if (dispel_evil(120)) *ident
= TRUE
;
1251 if (inc_timed(TMD_PROTEVIL
, randint(25) + k
)) *ident
= TRUE
;
1252 if (clear_timed(TMD_POISONED
)) *ident
= TRUE
;
1253 if (clear_timed(TMD_AFRAID
)) *ident
= TRUE
;
1254 if (hp_player(50)) *ident
= TRUE
;
1255 if (clear_timed(TMD_STUN
)) *ident
= TRUE
;
1256 if (clear_timed(TMD_CUT
)) *ident
= TRUE
;
1260 case SV_STAFF_BANISHMENT
:
1262 if (!banishment()) use_charge
= FALSE
;
1267 case SV_STAFF_EARTHQUAKES
:
1269 earthquake(py
, px
, 10);
1274 case SV_STAFF_DESTRUCTION
:
1276 destroy_area(py
, px
, 15, TRUE
);
1282 return (use_charge
);
1286 static bool aim_wand(object_type
*o_ptr
, bool *ident
)
1288 int lev
, chance
, dir
, sval
;
1291 /* Allow direction to be cancelled for free */
1292 if (!get_aim_dir(&dir
)) return (FALSE
);
1295 p_ptr
->energy_use
= 100;
1297 /* Not identified yet */
1301 lev
= k_info
[o_ptr
->k_idx
].level
;
1303 /* Base chance of success */
1304 chance
= p_ptr
->skills
[SKILL_DEV
];
1306 /* Confusion hurts skill */
1307 if (p_ptr
->timed
[TMD_CONFUSED
]) chance
= chance
/ 2;
1309 /* High level objects are harder */
1310 chance
= chance
- ((lev
> 50) ? 50 : lev
);
1312 /* Give everyone a (slight) chance */
1313 if ((chance
< USE_DEVICE
) && (rand_int(USE_DEVICE
- chance
+ 1) == 0))
1315 chance
= USE_DEVICE
;
1318 /* Roll for usage */
1319 if ((chance
< USE_DEVICE
) || (randint(chance
) < USE_DEVICE
))
1321 if (flush_failure
) flush();
1322 msg_print("You failed to use the wand properly.");
1326 /* The wand is already empty! */
1327 if (o_ptr
->pval
<= 0)
1329 if (flush_failure
) flush();
1330 msg_print("The wand has no charges left.");
1331 o_ptr
->ident
|= (IDENT_EMPTY
);
1332 p_ptr
->notice
|= (PN_COMBINE
| PN_REORDER
);
1333 p_ptr
->window
|= (PW_INVEN
);
1339 /* TODO: Create wand sound? Do the individual effects have sounds? */
1340 /* sound(MSG_ZAP_ROD); */
1343 /* XXX Hack -- Extract the "sval" effect */
1346 /* XXX Hack -- Wand of wonder can do anything before it */
1347 if (sval
== SV_WAND_WONDER
) sval
= rand_int(SV_WAND_WONDER
);
1349 /* Analyze the wand */
1352 case SV_WAND_HEAL_MONSTER
:
1354 if (heal_monster(dir
)) *ident
= TRUE
;
1358 case SV_WAND_HASTE_MONSTER
:
1360 if (speed_monster(dir
)) *ident
= TRUE
;
1364 case SV_WAND_CLONE_MONSTER
:
1366 if (clone_monster(dir
)) *ident
= TRUE
;
1370 case SV_WAND_TELEPORT_AWAY
:
1372 if (teleport_monster(dir
)) *ident
= TRUE
;
1376 case SV_WAND_DISARMING
:
1378 if (disarm_trap(dir
)) *ident
= TRUE
;
1382 case SV_WAND_TRAP_DOOR_DEST
:
1384 if (destroy_door(dir
)) *ident
= TRUE
;
1388 case SV_WAND_STONE_TO_MUD
:
1390 if (wall_to_mud(dir
)) *ident
= TRUE
;
1396 msg_print("A line of blue shimmering light appears.");
1402 case SV_WAND_SLEEP_MONSTER
:
1404 if (sleep_monster(dir
)) *ident
= TRUE
;
1408 case SV_WAND_SLOW_MONSTER
:
1410 if (slow_monster(dir
)) *ident
= TRUE
;
1414 case SV_WAND_CONFUSE_MONSTER
:
1416 if (confuse_monster(dir
, 10)) *ident
= TRUE
;
1420 case SV_WAND_FEAR_MONSTER
:
1422 if (fear_monster(dir
, 10)) *ident
= TRUE
;
1426 case SV_WAND_DRAIN_LIFE
:
1428 if (drain_life(dir
, 150)) *ident
= TRUE
;
1432 case SV_WAND_POLYMORPH
:
1434 if (poly_monster(dir
)) *ident
= TRUE
;
1438 case SV_WAND_STINKING_CLOUD
:
1440 fire_ball(GF_POIS
, dir
, 12, 2);
1445 case SV_WAND_MAGIC_MISSILE
:
1447 fire_bolt_or_beam(20, GF_MISSILE
, dir
, damroll(3, 4));
1452 case SV_WAND_ACID_BOLT
:
1454 fire_bolt_or_beam(20, GF_ACID
, dir
, damroll(10, 8));
1459 case SV_WAND_ELEC_BOLT
:
1461 fire_bolt_or_beam(20, GF_ELEC
, dir
, damroll(6, 6));
1466 case SV_WAND_FIRE_BOLT
:
1468 fire_bolt_or_beam(20, GF_FIRE
, dir
, damroll(12, 8));
1473 case SV_WAND_COLD_BOLT
:
1475 fire_bolt_or_beam(20, GF_COLD
, dir
, damroll(6, 8));
1480 case SV_WAND_ACID_BALL
:
1482 fire_ball(GF_ACID
, dir
, 120, 2);
1487 case SV_WAND_ELEC_BALL
:
1489 fire_ball(GF_ELEC
, dir
, 64, 2);
1494 case SV_WAND_FIRE_BALL
:
1496 fire_ball(GF_FIRE
, dir
, 144, 2);
1501 case SV_WAND_COLD_BALL
:
1503 fire_ball(GF_COLD
, dir
, 96, 2);
1508 case SV_WAND_WONDER
:
1510 msg_print("Oops. Wand of wonder activated.");
1514 case SV_WAND_DRAGON_FIRE
:
1516 fire_ball(GF_FIRE
, dir
, 200, 3);
1521 case SV_WAND_DRAGON_COLD
:
1523 fire_ball(GF_COLD
, dir
, 160, 3);
1528 case SV_WAND_DRAGON_BREATH
:
1534 fire_ball(GF_ACID
, dir
, 200, 3);
1540 fire_ball(GF_ELEC
, dir
, 160, 3);
1546 fire_ball(GF_FIRE
, dir
, 200, 3);
1552 fire_ball(GF_COLD
, dir
, 160, 3);
1558 fire_ball(GF_POIS
, dir
, 120, 3);
1567 case SV_WAND_ANNIHILATION
:
1569 if (drain_life(dir
, 250)) *ident
= TRUE
;
1578 static bool zap_rod(object_type
*o_ptr
, bool *ident
)
1580 int chance
, dir
, lev
;
1581 bool used_charge
= TRUE
;
1582 object_kind
*k_ptr
= &k_info
[o_ptr
->k_idx
];
1585 /* Get a direction (unless KNOWN not to need it) */
1586 if ((o_ptr
->sval
>= SV_ROD_MIN_DIRECTION
) || !object_aware_p(o_ptr
))
1588 /* Get a direction, allow cancel */
1589 if (!get_aim_dir(&dir
)) return FALSE
;
1594 p_ptr
->energy_use
= 100;
1596 /* Not identified yet */
1599 /* Extract the item level */
1600 lev
= k_info
[o_ptr
->k_idx
].level
;
1602 /* Base chance of success */
1603 chance
= p_ptr
->skills
[SKILL_DEV
];
1605 /* Confusion hurts skill */
1606 if (p_ptr
->timed
[TMD_CONFUSED
]) chance
= chance
/ 2;
1608 /* High level objects are harder */
1609 chance
= chance
- ((lev
> 50) ? 50 : lev
);
1611 /* Give everyone a (slight) chance */
1612 if ((chance
< USE_DEVICE
) && (rand_int(USE_DEVICE
- chance
+ 1) == 0))
1614 chance
= USE_DEVICE
;
1617 /* Roll for usage */
1618 if ((chance
< USE_DEVICE
) || (randint(chance
) < USE_DEVICE
))
1620 if (flush_failure
) flush();
1621 msg_print("You failed to use the rod properly.");
1625 /* Still charging? */
1626 if (o_ptr
->timeout
> (o_ptr
->pval
- k_ptr
->pval
))
1628 if (flush_failure
) flush();
1630 if (o_ptr
->number
== 1)
1631 msg_print("The rod is still charging");
1633 msg_print("The rods are all still charging");
1641 /* Analyze the rod */
1642 switch (o_ptr
->sval
)
1644 case SV_ROD_DETECT_TRAP
:
1646 if (detect_traps()) *ident
= TRUE
;
1650 case SV_ROD_DETECT_DOOR
:
1652 if (detect_doors()) *ident
= TRUE
;
1653 if (detect_stairs()) *ident
= TRUE
;
1657 case SV_ROD_IDENTIFY
:
1660 if (!ident_spell()) used_charge
= FALSE
;
1671 case SV_ROD_ILLUMINATION
:
1673 if (lite_area(damroll(2, 8), 2)) *ident
= TRUE
;
1677 case SV_ROD_MAPPING
:
1684 case SV_ROD_DETECTION
:
1691 case SV_ROD_PROBING
:
1700 if (clear_timed(TMD_BLIND
)) *ident
= TRUE
;
1701 if (clear_timed(TMD_POISONED
)) *ident
= TRUE
;
1702 if (clear_timed(TMD_CONFUSED
)) *ident
= TRUE
;
1703 if (clear_timed(TMD_STUN
)) *ident
= TRUE
;
1704 if (clear_timed(TMD_CUT
)) *ident
= TRUE
;
1708 case SV_ROD_HEALING
:
1710 if (hp_player(500)) *ident
= TRUE
;
1711 if (clear_timed(TMD_STUN
)) *ident
= TRUE
;
1712 if (clear_timed(TMD_CUT
)) *ident
= TRUE
;
1716 case SV_ROD_RESTORATION
:
1718 if (restore_level()) *ident
= TRUE
;
1719 if (do_res_stat(A_STR
)) *ident
= TRUE
;
1720 if (do_res_stat(A_INT
)) *ident
= TRUE
;
1721 if (do_res_stat(A_WIS
)) *ident
= TRUE
;
1722 if (do_res_stat(A_DEX
)) *ident
= TRUE
;
1723 if (do_res_stat(A_CON
)) *ident
= TRUE
;
1724 if (do_res_stat(A_CHR
)) *ident
= TRUE
;
1730 if (!p_ptr
->timed
[TMD_FAST
])
1732 if (set_timed(TMD_FAST
, randint(30) + 15)) *ident
= TRUE
;
1736 (void)inc_timed(TMD_FAST
, 5);
1741 case SV_ROD_TELEPORT_AWAY
:
1743 if (teleport_monster(dir
)) *ident
= TRUE
;
1747 case SV_ROD_DISARMING
:
1749 if (disarm_trap(dir
)) *ident
= TRUE
;
1755 msg_print("A line of blue shimmering light appears.");
1761 case SV_ROD_SLEEP_MONSTER
:
1763 if (sleep_monster(dir
)) *ident
= TRUE
;
1767 case SV_ROD_SLOW_MONSTER
:
1769 if (slow_monster(dir
)) *ident
= TRUE
;
1773 case SV_ROD_DRAIN_LIFE
:
1775 if (drain_life(dir
, 150)) *ident
= TRUE
;
1779 case SV_ROD_POLYMORPH
:
1781 if (poly_monster(dir
)) *ident
= TRUE
;
1785 case SV_ROD_ACID_BOLT
:
1787 fire_bolt_or_beam(10, GF_ACID
, dir
, damroll(12, 8));
1792 case SV_ROD_ELEC_BOLT
:
1794 fire_bolt_or_beam(10, GF_ELEC
, dir
, damroll(6, 6));
1799 case SV_ROD_FIRE_BOLT
:
1801 fire_bolt_or_beam(10, GF_FIRE
, dir
, damroll(16, 8));
1806 case SV_ROD_COLD_BOLT
:
1808 fire_bolt_or_beam(10, GF_COLD
, dir
, damroll(10, 8));
1813 case SV_ROD_ACID_BALL
:
1815 fire_ball(GF_ACID
, dir
, 120, 2);
1820 case SV_ROD_ELEC_BALL
:
1822 fire_ball(GF_ELEC
, dir
, 64, 2);
1827 case SV_ROD_FIRE_BALL
:
1829 fire_ball(GF_FIRE
, dir
, 144, 2);
1834 case SV_ROD_COLD_BALL
:
1836 fire_ball(GF_COLD
, dir
, 96, 2);
1842 /* Drain the charge */
1843 if (used_charge
) o_ptr
->timeout
+= k_ptr
->pval
;
1850 * Activate a wielded object. Wielded objects never stack.
1851 * And even if they did, activatable objects never stack.
1853 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
1854 * But one could, for example, easily make an activatable "Ring of Plasma".
1856 * Note that it always takes a turn to activate an artifact, even if
1857 * the user hits "escape" at the "direction" prompt.
1859 static bool activate_object(object_type
*o_ptr
, bool *ident
)
1861 int k
, dir
, i
, chance
;
1864 /* Check the recharge */
1867 msg_print("It whines, glows and fades...");
1871 /* Activate the artifact */
1872 message(MSG_ACT_ARTIFACT
, 0, "You activate it...");
1877 artifact_type
*a_ptr
= &a_info
[o_ptr
->name1
];
1880 /* Get the basic name of the object */
1881 object_desc(o_name
, sizeof(o_name
), o_ptr
, FALSE
, 0);
1883 switch (a_ptr
->activation
)
1885 case ACT_ILLUMINATION
:
1887 msg_format("The %s wells with clear light...", o_name
);
1888 lite_area(damroll(2, 15), 3);
1894 msg_format("The %s shines brightly...", o_name
);
1899 case ACT_CLAIRVOYANCE
:
1901 msg_format("The %s glows a deep green...", o_name
);
1903 (void)detect_traps();
1904 (void)detect_doors();
1905 (void)detect_stairs();
1911 msg_format("The %s lets out a shrill wail...", o_name
);
1913 (void)inc_timed(TMD_PROTEVIL
, randint(25) + k
);
1919 msg_format("The %s floods the area with goodness...", o_name
);
1920 dispel_evil(p_ptr
->lev
* 5);
1926 msg_format("The %s glows brightly...", o_name
);
1927 if (!p_ptr
->timed
[TMD_FAST
])
1929 (void)set_timed(TMD_FAST
, randint(75) + 75);
1933 (void)inc_timed(TMD_FAST
, 5);
1940 msg_format("The %s glows deep red...", o_name
);
1941 if (!get_aim_dir(&dir
)) return FALSE
;
1942 fire_ball(GF_FIRE
, dir
, 120, 3);
1948 msg_format("The %s glows bright white...", o_name
);
1949 if (!get_aim_dir(&dir
)) return FALSE
;
1950 fire_ball(GF_COLD
, dir
, 200, 3);
1956 msg_format("The %s glows deep blue...", o_name
);
1957 if (!get_aim_dir(&dir
)) return FALSE
;
1958 fire_ball(GF_ELEC
, dir
, 250, 3);
1964 msg_format("The %s glows intensely black...", o_name
);
1965 if (!get_aim_dir(&dir
)) return FALSE
;
1973 msg_format("Your %s is surrounded by lightning...", o_name
);
1974 for (i
= 0; i
< 8; i
++) fire_ball(GF_ELEC
, ddd
[i
], 150, 3);
1978 case ACT_RAGE_BLESS_RESIST
:
1980 msg_format("Your %s glows many colours...", o_name
);
1981 (void)hp_player(30);
1982 (void)clear_timed(TMD_AFRAID
);
1983 (void)inc_timed(TMD_SHERO
, randint(50) + 50);
1984 (void)inc_timed(TMD_BLESSED
, randint(50) + 50);
1985 (void)inc_timed(TMD_OPP_ACID
, randint(50) + 50);
1986 (void)inc_timed(TMD_OPP_ELEC
, randint(50) + 50);
1987 (void)inc_timed(TMD_OPP_FIRE
, randint(50) + 50);
1988 (void)inc_timed(TMD_OPP_COLD
, randint(50) + 50);
1989 (void)inc_timed(TMD_OPP_POIS
, randint(50) + 50);
1995 msg_format("Your %s glows a bright white...", o_name
);
1996 msg_print("You feel much better...");
1997 (void)hp_player(1000);
1998 (void)clear_timed(TMD_CUT
);
2004 msg_format("Your %s twists space around you...", o_name
);
2005 teleport_player(10);
2009 case ACT_BANISHMENT
:
2011 msg_format("Your %s glows deep blue...", o_name
);
2012 if (!banishment()) return FALSE
;
2016 case ACT_TRAP_DOOR_DEST
:
2018 msg_format("Your %s glows bright red...", o_name
);
2019 destroy_doors_touch();
2025 msg_format("Your %s glows bright white...", o_name
);
2026 msg_print("An image forms in your mind...");
2033 msg_format("Your %s glows deep blue...", o_name
);
2034 msg_print("You feel a warm tingling inside...");
2035 (void)hp_player(500);
2036 (void)clear_timed(TMD_CUT
);
2042 msg_format("Your %s glows many colours...", o_name
);
2043 (void)inc_timed(TMD_OPP_ACID
, randint(20) + 20);
2044 (void)inc_timed(TMD_OPP_ELEC
, randint(20) + 20);
2045 (void)inc_timed(TMD_OPP_FIRE
, randint(20) + 20);
2046 (void)inc_timed(TMD_OPP_COLD
, randint(20) + 20);
2047 (void)inc_timed(TMD_OPP_POIS
, randint(20) + 20);
2053 msg_format("Your %s glows deep blue...", o_name
);
2054 sleep_monsters_touch();
2060 msg_format("Your %s glows bright yellow...", o_name
);
2061 if (!recharge(60)) return FALSE
;
2067 msg_format("Your %s twists space around you...", o_name
);
2068 teleport_player(100);
2072 case ACT_RESTORE_LIFE
:
2074 msg_format("Your %s glows a deep red...", o_name
);
2081 msg_format("Your %s glows extremely brightly...", o_name
);
2082 if (!get_aim_dir(&dir
)) return FALSE
;
2083 fire_bolt(GF_MISSILE
, dir
, damroll(2, 6));
2089 msg_format("Your %s is covered in fire...", o_name
);
2090 if (!get_aim_dir(&dir
)) return FALSE
;
2091 fire_bolt(GF_FIRE
, dir
, damroll(9, 8));
2097 msg_format("Your %s is covered in frost...", o_name
);
2098 if (!get_aim_dir(&dir
)) return FALSE
;
2099 fire_bolt(GF_COLD
, dir
, damroll(6, 8));
2103 case ACT_LIGHTNING_BOLT
:
2105 msg_format("Your %s is covered in sparks...", o_name
);
2106 if (!get_aim_dir(&dir
)) return FALSE
;
2107 fire_bolt(GF_ELEC
, dir
, damroll(4, 8));
2113 msg_format("Your %s is covered in acid...", o_name
);
2114 if (!get_aim_dir(&dir
)) return FALSE
;
2115 fire_bolt(GF_ACID
, dir
, damroll(5, 8));
2121 msg_format("Your %s grows magical spikes...", o_name
);
2122 if (!get_aim_dir(&dir
)) return FALSE
;
2123 fire_bolt(GF_ARROW
, dir
, 150);
2129 msg_format("Your %s glows bright green...", o_name
);
2130 if (!p_ptr
->timed
[TMD_FAST
])
2132 (void)set_timed(TMD_FAST
, randint(20) + 20);
2136 (void)inc_timed(TMD_FAST
, 5);
2141 case ACT_REM_FEAR_POIS
:
2143 msg_format("Your %s glows deep blue...", o_name
);
2144 (void)clear_timed(TMD_AFRAID
);
2145 (void)clear_timed(TMD_POISONED
);
2149 case ACT_STINKING_CLOUD
:
2151 msg_format("Your %s throbs deep green...", o_name
);
2152 if (!get_aim_dir(&dir
)) return FALSE
;
2153 fire_ball(GF_POIS
, dir
, 12, 3);
2159 msg_format("Your %s is covered in frost...", o_name
);
2160 if (!get_aim_dir(&dir
)) return FALSE
;
2161 fire_ball(GF_COLD
, dir
, 48, 2);
2167 msg_format("Your %s glows a pale blue...", o_name
);
2168 if (!get_aim_dir(&dir
)) return FALSE
;
2169 fire_bolt(GF_COLD
, dir
, damroll(12, 8));
2175 msg_format("Your %s glows a intense blue...", o_name
);
2176 if (!get_aim_dir(&dir
)) return FALSE
;
2177 fire_ball(GF_COLD
, dir
, 100, 2);
2183 msg_format("Your %s rages in fire...", o_name
);
2184 if (!get_aim_dir(&dir
)) return FALSE
;
2185 fire_ball(GF_FIRE
, dir
, 72, 2);
2189 case ACT_DRAIN_LIFE2
:
2191 msg_format("Your %s glows black...", o_name
);
2192 if (!get_aim_dir(&dir
)) return FALSE
;
2193 drain_life(dir
, 120);
2197 case ACT_STONE_TO_MUD
:
2199 msg_format("Your %s pulsates...", o_name
);
2200 if (!get_aim_dir(&dir
)) return FALSE
;
2205 case ACT_MASS_BANISHMENT
:
2207 msg_format("Your %s lets out a long, shrill note...", o_name
);
2208 (void)mass_banishment();
2212 case ACT_CURE_WOUNDS
:
2214 msg_format("Your %s radiates deep purple...", o_name
);
2215 hp_player(damroll(4, 8));
2216 (void)set_timed(TMD_CUT
, (p_ptr
->timed
[TMD_CUT
] / 2) - 50);
2222 msg_format("Your %s glows deep red...", o_name
);
2223 if (!get_aim_dir(&dir
)) return FALSE
;
2224 teleport_monster(dir
);
2230 msg_format("Your %s glows soft white...", o_name
);
2237 msg_format("Your %s glows in scintillating colours...", o_name
);
2238 if (!get_aim_dir(&dir
)) return FALSE
;
2239 confuse_monster(dir
, 20);
2245 msg_format("Your %s glows yellow...", o_name
);
2246 if (!ident_spell()) return FALSE
;
2252 msg_format("Your %s glows brightly...", o_name
);
2257 case ACT_DRAIN_LIFE1
:
2259 msg_format("Your %s glows white...", o_name
);
2260 if (!get_aim_dir(&dir
)) return FALSE
;
2261 drain_life(dir
, 90);
2267 msg_format("Your %s glows deep red...", o_name
);
2268 if (!brand_bolts()) return FALSE
;
2274 msg_format("Your %s glows with the light of a thousand stars...", o_name
);
2275 for (k
= 0; k
< 8; k
++) strong_lite_line(ddd
[k
]);
2281 msg_format("Your %s glows white...", o_name
);
2282 if (!get_aim_dir(&dir
)) return FALSE
;
2283 fire_bolt(GF_MANA
, dir
, damroll(12, 8));
2289 msg_format("Your %s glows in anger...", o_name
);
2290 inc_timed(TMD_SHERO
, randint(50) + 50);
2295 /* Set the recharge time */
2296 if (a_ptr
->randtime
)
2297 o_ptr
->timeout
= a_ptr
->time
+ (byte
)randint(a_ptr
->randtime
);
2299 o_ptr
->timeout
= a_ptr
->time
;
2302 p_ptr
->window
|= (PW_INVEN
| PW_EQUIP
);
2309 /* Hack -- Dragon Scale Mail can be activated as well */
2310 if (o_ptr
->tval
== TV_DRAG_ARMOR
)
2312 /* Get a direction for breathing (or abort) */
2313 if (!get_aim_dir(&dir
)) return FALSE
;
2315 /* Branch on the sub-type */
2316 switch (o_ptr
->sval
)
2318 case SV_DRAGON_BLUE
:
2321 msg_print("You breathe lightning.");
2322 fire_ball(GF_ELEC
, dir
, 100, 2);
2323 o_ptr
->timeout
= rand_int(450) + 450;
2327 case SV_DRAGON_WHITE
:
2329 sound(MSG_BR_FROST
);
2330 msg_print("You breathe frost.");
2331 fire_ball(GF_COLD
, dir
, 110, 2);
2332 o_ptr
->timeout
= rand_int(450) + 450;
2336 case SV_DRAGON_BLACK
:
2339 msg_print("You breathe acid.");
2340 fire_ball(GF_ACID
, dir
, 130, 2);
2341 o_ptr
->timeout
= rand_int(450) + 450;
2345 case SV_DRAGON_GREEN
:
2348 msg_print("You breathe poison gas.");
2349 fire_ball(GF_POIS
, dir
, 150, 2);
2350 o_ptr
->timeout
= rand_int(450) + 450;
2357 msg_print("You breathe fire.");
2358 fire_ball(GF_FIRE
, dir
, 200, 2);
2359 o_ptr
->timeout
= rand_int(450) + 450;
2363 case SV_DRAGON_MULTIHUED
:
2365 chance
= rand_int(5);
2366 sound( ((chance
== 1) ? MSG_BR_ELEC
:
2367 ((chance
== 2) ? MSG_BR_FROST
:
2368 ((chance
== 3) ? MSG_BR_ACID
:
2369 ((chance
== 4) ? MSG_BR_GAS
: MSG_BR_FIRE
)))));
2370 msg_format("You breathe %s.",
2371 ((chance
== 1) ? "lightning" :
2372 ((chance
== 2) ? "frost" :
2373 ((chance
== 3) ? "acid" :
2374 ((chance
== 4) ? "poison gas" : "fire")))));
2375 fire_ball(((chance
== 1) ? GF_ELEC
:
2376 ((chance
== 2) ? GF_COLD
:
2377 ((chance
== 3) ? GF_ACID
:
2378 ((chance
== 4) ? GF_POIS
: GF_FIRE
)))),
2380 o_ptr
->timeout
= rand_int(225) + 225;
2384 case SV_DRAGON_BRONZE
:
2387 msg_print("You breathe confusion.");
2388 fire_ball(GF_CONFUSION
, dir
, 120, 2);
2389 o_ptr
->timeout
= rand_int(450) + 450;
2393 case SV_DRAGON_GOLD
:
2395 sound(MSG_BR_SOUND
);
2396 msg_print("You breathe sound.");
2397 fire_ball(GF_SOUND
, dir
, 130, 2);
2398 o_ptr
->timeout
= rand_int(450) + 450;
2402 case SV_DRAGON_CHAOS
:
2404 chance
= rand_int(2);
2405 sound(((chance
== 1 ? MSG_BR_CHAOS
: MSG_BR_DISENCHANT
)));
2406 msg_format("You breathe %s.",
2407 ((chance
== 1 ? "chaos" : "disenchantment")));
2408 fire_ball((chance
== 1 ? GF_CHAOS
: GF_DISENCHANT
),
2410 o_ptr
->timeout
= rand_int(300) + 300;
2416 chance
= rand_int(2);
2417 sound(((chance
== 1 ? MSG_BR_SOUND
: MSG_BR_SHARDS
)));
2418 msg_format("You breathe %s.",
2419 ((chance
== 1 ? "sound" : "shards")));
2420 fire_ball((chance
== 1 ? GF_SOUND
: GF_SHARD
),
2422 o_ptr
->timeout
= rand_int(300) + 300;
2426 case SV_DRAGON_BALANCE
:
2428 chance
= rand_int(4);
2429 msg_format("You breathe %s.",
2430 ((chance
== 1) ? "chaos" :
2431 ((chance
== 2) ? "disenchantment" :
2432 ((chance
== 3) ? "sound" : "shards"))));
2433 fire_ball(((chance
== 1) ? GF_CHAOS
:
2434 ((chance
== 2) ? GF_DISENCHANT
:
2435 ((chance
== 3) ? GF_SOUND
: GF_SHARD
))),
2437 o_ptr
->timeout
= rand_int(300) + 300;
2441 case SV_DRAGON_SHINING
:
2443 chance
= rand_int(2);
2444 sound(((chance
== 0 ? MSG_BR_LIGHT
: MSG_BR_DARK
)));
2445 msg_format("You breathe %s.",
2446 ((chance
== 0 ? "light" : "darkness")));
2447 fire_ball((chance
== 0 ? GF_LITE
: GF_DARK
), dir
, 200, 2);
2448 o_ptr
->timeout
= rand_int(300) + 300;
2452 case SV_DRAGON_POWER
:
2454 sound(MSG_BR_ELEMENTS
);
2455 msg_print("You breathe the elements.");
2456 fire_ball(GF_MISSILE
, dir
, 300, 2);
2457 o_ptr
->timeout
= rand_int(300) + 300;
2463 p_ptr
->window
|= (PW_INVEN
| PW_EQUIP
);
2469 /* Hack -- some Rings can be activated for double resist and element ball */
2470 if (o_ptr
->tval
== TV_RING
)
2472 /* Get a direction for firing (or abort) */
2473 if (!get_aim_dir(&dir
)) return FALSE
;
2475 /* Branch on the sub-type */
2476 switch (o_ptr
->sval
)
2480 fire_ball(GF_ACID
, dir
, 70, 2);
2481 inc_timed(TMD_OPP_ACID
, randint(20) + 20);
2482 o_ptr
->timeout
= rand_int(50) + 50;
2486 case SV_RING_FLAMES
:
2488 fire_ball(GF_FIRE
, dir
, 80, 2);
2489 inc_timed(TMD_OPP_FIRE
, randint(20) + 20);
2490 o_ptr
->timeout
= rand_int(50) + 50;
2496 fire_ball(GF_COLD
, dir
, 75, 2);
2497 inc_timed(TMD_OPP_COLD
, randint(20) + 20);
2498 o_ptr
->timeout
= rand_int(50) + 50;
2502 case SV_RING_LIGHTNING
:
2504 fire_ball(GF_ELEC
, dir
, 85, 2);
2505 inc_timed(TMD_OPP_ELEC
, randint(20) + 20);
2506 o_ptr
->timeout
= rand_int(50) + 50;
2512 p_ptr
->window
|= (PW_EQUIP
);
2519 msg_print("Oops. That object cannot be activated.");
2526 bool use_object(object_type
*o_ptr
, bool *ident
)
2530 /* Analyze the object */
2531 switch (o_ptr
->tval
)
2535 used
= eat_food(o_ptr
, ident
);
2541 used
= quaff_potion(o_ptr
, ident
);
2547 used
= read_scroll(o_ptr
, ident
);
2553 used
= use_staff(o_ptr
, ident
);
2559 used
= aim_wand(o_ptr
, ident
);
2565 used
= zap_rod(o_ptr
, ident
);
2571 used
= activate_object(o_ptr
, ident
);
2580 static cptr act_description
[ACT_MAX
] =
2585 "protection from evil",
2589 "cure wounds (4d8)",
2590 "haste self (20+d20 turns)",
2591 "haste self (75+d75 turns)",
2594 "large fire ball (120)",
2598 "frost bolt (12d8)",
2599 "large frost ball (200)",
2603 "lightning bolt (4d8)",
2604 "large lightning ball (250)",
2612 "berserk rage, bless, and resistance",
2614 "door and trap destruction",
2616 "resistance (20+d20 turns)",
2618 "restore life levels",
2619 "magic missile (2d6)",
2620 "a magical arrow (150)",
2621 "remove fear and cure poison",
2622 "stinking cloud (12)",
2628 "fire branding of bolts",
2631 "berserk rage (50+d50 turns)"
2637 * Determine the "Activation" (if any) for an artifact
2639 void describe_item_activation(const object_type
*o_ptr
)
2643 /* Extract the flags */
2644 object_flags(o_ptr
, &f1
, &f2
, &f3
);
2646 /* Require activation ability */
2647 if (!(f3
& TR3_ACTIVATE
)) return;
2649 /* Artifact activations */
2652 artifact_type
*a_ptr
= &a_info
[o_ptr
->name1
];
2655 if (a_ptr
->activation
>= ACT_MAX
) return;
2657 /* Some artifacts can be activated */
2658 text_out(act_description
[a_ptr
->activation
]);
2660 /* Output the number of turns */
2661 if (a_ptr
->time
&& a_ptr
->randtime
)
2662 text_out(format(" every %d+d%d turns", a_ptr
->time
, a_ptr
->randtime
));
2663 else if (a_ptr
->time
)
2664 text_out(format(" every %d turns", a_ptr
->time
));
2665 else if (a_ptr
->randtime
)
2666 text_out(format(" every d%d turns", a_ptr
->randtime
));
2671 /* Ring activations */
2672 if (o_ptr
->tval
== TV_RING
)
2674 /* Branch on the sub-type */
2675 switch (o_ptr
->sval
)
2679 text_out("acid resistance (20+d20 turns) and acid ball (70) every 50+d50 turns");
2682 case SV_RING_FLAMES
:
2684 text_out("fire resistance (20+d20 turns) and fire ball (80) every 50+d50 turns");
2689 text_out("cold resistance (20+d20 turns) and cold ball (75) every 50+d50 turns");
2693 case SV_RING_LIGHTNING
:
2695 text_out("electricity resistance (20+d20 turns) and electricity ball (85) every 50+d50 turns");
2703 /* Require dragon scale mail */
2704 if (o_ptr
->tval
!= TV_DRAG_ARMOR
) return;
2706 /* Branch on the sub-type */
2707 switch (o_ptr
->sval
)
2709 case SV_DRAGON_BLUE
:
2711 text_out("breathe lightning (100) every 450+d450 turns");
2714 case SV_DRAGON_WHITE
:
2716 text_out("breathe frost (110) every 450+d450 turns");
2719 case SV_DRAGON_BLACK
:
2721 text_out("breathe acid (130) every 450+d450 turns");
2724 case SV_DRAGON_GREEN
:
2726 text_out("breathe poison gas (150) every 450+d450 turns");
2731 text_out("breathe fire (200) every 450+d450 turns");
2734 case SV_DRAGON_MULTIHUED
:
2736 text_out("breathe multi-hued (250) every 225+d225 turns");
2739 case SV_DRAGON_BRONZE
:
2741 text_out("breathe confusion (120) every 450+d450 turns");
2744 case SV_DRAGON_GOLD
:
2746 text_out("breathe sound (130) every 450+d450 turns");
2749 case SV_DRAGON_CHAOS
:
2751 text_out("breathe chaos/disenchant (220) every 300+d300 turns");
2756 text_out("breathe sound/shards (230) every 300+d300 turns");
2759 case SV_DRAGON_BALANCE
:
2761 text_out("breathe balance (250) every 300+d300 turns");
2764 case SV_DRAGON_SHINING
:
2766 text_out("breathe light/darkness (200) every 300+d300 turns");
2769 case SV_DRAGON_POWER
:
2771 text_out("breathe the elements (300) every 300+d300 turns");