OSDN Git Service

Corrected spelling in English description of the hatchet of Elmi the Murderer.
[hengbandforosx/hengbandosx.git] / src / object-broken.c
1 #include "angband.h"
2 #include "projection.h"
3
4 /*!
5  * @brief 薬の破損効果処理 /
6  * Potions "smash open" and cause an area effect when
7  * @param who 薬破損の主体ID(プレイヤー所持アイテムが壊れた場合0、床上のアイテムの場合モンスターID)
8  * @param y 破壊時のY座標
9  * @param x 破壊時のX座標
10  * @param k_idx 破損した薬のアイテムID
11  * @return 薬を浴びたモンスターが起こるならばTRUEを返す
12  * @details
13  * <pre>
14  * (1) they are shattered while in the player's inventory,
15  * due to cold (etc) attacks;
16  * (2) they are thrown at a monster, or obstacle;
17  * (3) they are shattered by a "cold ball" or other such spell
18  * while lying on the floor.
19  *
20  * Arguments:
21  *    who   ---  who caused the potion to shatter (0=player)
22  *          potions that smash on the floor are assumed to
23  *          be caused by no-one (who = 1), as are those that
24  *          shatter inside the player inventory.
25  *          (Not anymore -- I changed this; TY)
26  *    y, x  --- coordinates of the potion (or player if
27  *          the potion was in her inventory);
28  *    o_ptr --- pointer to the potion object.
29  * </pre>
30  */
31 bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx)
32 {
33         int     radius = 2;
34         int     dt = 0;
35         int     dam = 0;
36         bool    angry = FALSE;
37
38         object_kind *k_ptr = &k_info[k_idx];
39
40         switch (k_ptr->sval)
41         {
42         case SV_POTION_SALT_WATER:
43         case SV_POTION_SLIME_MOLD:
44         case SV_POTION_LOSE_MEMORIES:
45         case SV_POTION_DEC_STR:
46         case SV_POTION_DEC_INT:
47         case SV_POTION_DEC_WIS:
48         case SV_POTION_DEC_DEX:
49         case SV_POTION_DEC_CON:
50         case SV_POTION_DEC_CHR:
51         case SV_POTION_WATER:   /* perhaps a 'water' attack? */
52         case SV_POTION_APPLE_JUICE:
53                 return TRUE;
54
55         case SV_POTION_INFRAVISION:
56         case SV_POTION_DETECT_INVIS:
57         case SV_POTION_SLOW_POISON:
58         case SV_POTION_CURE_POISON:
59         case SV_POTION_BOLDNESS:
60         case SV_POTION_RESIST_HEAT:
61         case SV_POTION_RESIST_COLD:
62         case SV_POTION_HEROISM:
63         case SV_POTION_BESERK_STRENGTH:
64         case SV_POTION_RES_STR:
65         case SV_POTION_RES_INT:
66         case SV_POTION_RES_WIS:
67         case SV_POTION_RES_DEX:
68         case SV_POTION_RES_CON:
69         case SV_POTION_RES_CHR:
70         case SV_POTION_INC_STR:
71         case SV_POTION_INC_INT:
72         case SV_POTION_INC_WIS:
73         case SV_POTION_INC_DEX:
74         case SV_POTION_INC_CON:
75         case SV_POTION_INC_CHR:
76         case SV_POTION_AUGMENTATION:
77         case SV_POTION_ENLIGHTENMENT:
78         case SV_POTION_STAR_ENLIGHTENMENT:
79         case SV_POTION_SELF_KNOWLEDGE:
80         case SV_POTION_EXPERIENCE:
81         case SV_POTION_RESISTANCE:
82         case SV_POTION_INVULNERABILITY:
83         case SV_POTION_NEW_LIFE:
84                 /* All of the above potions have no effect when shattered */
85                 return FALSE;
86         case SV_POTION_SLOWNESS:
87                 dt = GF_OLD_SLOW;
88                 dam = 5;
89                 angry = TRUE;
90                 break;
91         case SV_POTION_POISON:
92                 dt = GF_POIS;
93                 dam = 3;
94                 angry = TRUE;
95                 break;
96         case SV_POTION_BLINDNESS:
97                 dt = GF_DARK;
98                 angry = TRUE;
99                 break;
100         case SV_POTION_BOOZE: /* Booze */
101                 dt = GF_OLD_CONF;
102                 angry = TRUE;
103                 break;
104         case SV_POTION_SLEEP:
105                 dt = GF_OLD_SLEEP;
106                 angry = TRUE;
107                 break;
108         case SV_POTION_RUINATION:
109         case SV_POTION_DETONATIONS:
110                 dt = GF_SHARDS;
111                 dam = damroll(25, 25);
112                 angry = TRUE;
113                 break;
114         case SV_POTION_DEATH:
115                 dt = GF_DEATH_RAY;    /* !! */
116                 dam = k_ptr->level * 10;
117                 angry = TRUE;
118                 radius = 1;
119                 break;
120         case SV_POTION_SPEED:
121                 dt = GF_OLD_SPEED;
122                 break;
123         case SV_POTION_CURE_LIGHT:
124                 dt = GF_OLD_HEAL;
125                 dam = damroll(2, 3);
126                 break;
127         case SV_POTION_CURE_SERIOUS:
128                 dt = GF_OLD_HEAL;
129                 dam = damroll(4, 3);
130                 break;
131         case SV_POTION_CURE_CRITICAL:
132         case SV_POTION_CURING:
133                 dt = GF_OLD_HEAL;
134                 dam = damroll(6, 3);
135                 break;
136         case SV_POTION_HEALING:
137                 dt = GF_OLD_HEAL;
138                 dam = damroll(10, 10);
139                 break;
140         case SV_POTION_RESTORE_EXP:
141                 dt = GF_STAR_HEAL;
142                 dam = 0;
143                 radius = 1;
144                 break;
145         case SV_POTION_LIFE:
146                 dt = GF_STAR_HEAL;
147                 dam = damroll(50, 50);
148                 radius = 1;
149                 break;
150         case SV_POTION_STAR_HEALING:
151                 dt = GF_OLD_HEAL;
152                 dam = damroll(50, 50);
153                 radius = 1;
154                 break;
155         case SV_POTION_RESTORE_MANA:   /* MANA */
156                 dt = GF_MANA;
157                 dam = damroll(10, 10);
158                 radius = 1;
159                 break;
160         default:
161                 /* Do nothing */;
162         }
163
164         (void)project(who, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
165
166         /* XXX  those potions that explode need to become "known" */
167         return angry;
168 }