3 #include "objectkind.h"
7 * @brief アイテムが酸で破損するかどうかを判定する
8 * @param o_ptr アイテムの情報参照ポインタ
9 * @return 破損するならばTRUEを返す
10 * Note that amulets, rods, and high-level spell books are immune
11 * to "inventory damage" of any kind. Also sling ammo and shovels.
12 * Does a given class of objects (usually) hate acid?
13 * Note that acid can either melt or corrode something.
15 bool hates_acid(object_type *o_ptr)
17 /* Analyze the type */
40 /* Staffs/Scrolls are wood/paper */
67 * @brief アイテムが電撃で破損するかどうかを判定する /
68 * Does a given object (usually) hate electricity?
69 * @param o_ptr アイテムの情報参照ポインタ
70 * @return 破損するならばTRUEを返す
72 bool hates_elec(object_type *o_ptr)
88 * @brief アイテムが火炎で破損するかどうかを判定する /
89 * Does a given object (usually) hate fire?
90 * @param o_ptr アイテムの情報参照ポインタ
91 * @return 破損するならばTRUEを返す
93 * Hafted/Polearm weapons have wooden shafts.
94 * Arrows/Bows are mostly wooden.
96 bool hates_fire(object_type *o_ptr)
98 /* Analyze the type */
117 case TV_SORCERY_BOOK:
125 case TV_CRUSADE_BOOK:
127 case TV_HISSATSU_BOOK:
139 /* Staffs/Scrolls burn */
152 * @brief アイテムが冷気で破損するかどうかを判定する /
153 * Does a given object (usually) hate cold?
154 * @param o_ptr アイテムの情報参照ポインタ
155 * @return 破損するならばTRUEを返す
157 bool hates_cold(object_type *o_ptr)
174 * @brief アイテムが酸で破損するかどうかを判定する(メインルーチン) /
176 * @param o_ptr アイテムの情報参照ポインタ
177 * @return 破損するならばTRUEを返す
180 int set_acid_destroy(object_type *o_ptr)
182 BIT_FLAGS flgs[TR_FLAG_SIZE];
183 if (!hates_acid(o_ptr)) return FALSE;
184 object_flags(o_ptr, flgs);
185 if (have_flag(flgs, TR_IGNORE_ACID)) return FALSE;
191 * @brief アイテムが電撃で破損するかどうかを判定する(メインルーチン) /
193 * @param o_ptr アイテムの情報参照ポインタ
194 * @return 破損するならばTRUEを返す
197 int set_elec_destroy(object_type *o_ptr)
199 BIT_FLAGS flgs[TR_FLAG_SIZE];
200 if (!hates_elec(o_ptr)) return FALSE;
201 object_flags(o_ptr, flgs);
202 if (have_flag(flgs, TR_IGNORE_ELEC)) return FALSE;
208 * @brief アイテムが火炎で破損するかどうかを判定する(メインルーチン) /
210 * @param o_ptr アイテムの情報参照ポインタ
211 * @return 破損するならばTRUEを返す
214 int set_fire_destroy(object_type *o_ptr)
216 BIT_FLAGS flgs[TR_FLAG_SIZE];
217 if (!hates_fire(o_ptr)) return FALSE;
218 object_flags(o_ptr, flgs);
219 if (have_flag(flgs, TR_IGNORE_FIRE)) return FALSE;
225 * @brief アイテムが冷気で破損するかどうかを判定する(メインルーチン) /
227 * @param o_ptr アイテムの情報参照ポインタ
228 * @return 破損するならばTRUEを返す
231 int set_cold_destroy(object_type *o_ptr)
233 BIT_FLAGS flgs[TR_FLAG_SIZE];
234 if (!hates_cold(o_ptr)) return FALSE;
235 object_flags(o_ptr, flgs);
236 if (have_flag(flgs, TR_IGNORE_COLD)) return FALSE;
243 * Potions "smash open" and cause an area effect when
244 * @param who 薬破損の主体ID(プレイヤー所持アイテムが壊れた場合0、床上のアイテムの場合モンスターID)
247 * @param k_idx 破損した薬のアイテムID
248 * @return 薬を浴びたモンスターが起こるならばTRUEを返す
251 * (1) they are shattered while in the player's p_ptr->inventory_list,
252 * due to cold (etc) attacks;
253 * (2) they are thrown at a monster, or obstacle;
254 * (3) they are shattered by a "cold ball" or other such spell
255 * while lying on the floor.
258 * who --- who caused the potion to shatter (0=player)
259 * potions that smash on the floor are assumed to
260 * be caused by no-one (who = 1), as are those that
261 * shatter inside the player inventory.
262 * (Not anymore -- I changed this; TY)
263 * y, x --- coordinates of the potion (or player if
264 * the potion was in her inventory);
265 * o_ptr --- pointer to the potion object.
268 bool potion_smash_effect(player_type *owner_ptr, MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx)
274 object_kind *k_ptr = &k_info[k_idx];
277 case SV_POTION_SALT_WATER:
278 case SV_POTION_SLIME_MOLD:
279 case SV_POTION_LOSE_MEMORIES:
280 case SV_POTION_DEC_STR:
281 case SV_POTION_DEC_INT:
282 case SV_POTION_DEC_WIS:
283 case SV_POTION_DEC_DEX:
284 case SV_POTION_DEC_CON:
285 case SV_POTION_DEC_CHR:
286 case SV_POTION_WATER: /* perhaps a 'water' attack? */
287 case SV_POTION_APPLE_JUICE:
290 case SV_POTION_INFRAVISION:
291 case SV_POTION_DETECT_INVIS:
292 case SV_POTION_SLOW_POISON:
293 case SV_POTION_CURE_POISON:
294 case SV_POTION_BOLDNESS:
295 case SV_POTION_RESIST_HEAT:
296 case SV_POTION_RESIST_COLD:
297 case SV_POTION_HEROISM:
298 case SV_POTION_BESERK_STRENGTH:
299 case SV_POTION_RES_STR:
300 case SV_POTION_RES_INT:
301 case SV_POTION_RES_WIS:
302 case SV_POTION_RES_DEX:
303 case SV_POTION_RES_CON:
304 case SV_POTION_RES_CHR:
305 case SV_POTION_INC_STR:
306 case SV_POTION_INC_INT:
307 case SV_POTION_INC_WIS:
308 case SV_POTION_INC_DEX:
309 case SV_POTION_INC_CON:
310 case SV_POTION_INC_CHR:
311 case SV_POTION_AUGMENTATION:
312 case SV_POTION_ENLIGHTENMENT:
313 case SV_POTION_STAR_ENLIGHTENMENT:
314 case SV_POTION_SELF_KNOWLEDGE:
315 case SV_POTION_EXPERIENCE:
316 case SV_POTION_RESISTANCE:
317 case SV_POTION_INVULNERABILITY:
318 case SV_POTION_NEW_LIFE:
319 /* All of the above potions have no effect when shattered */
321 case SV_POTION_SLOWNESS:
326 case SV_POTION_POISON:
331 case SV_POTION_BLINDNESS:
335 case SV_POTION_BOOZE:
339 case SV_POTION_SLEEP:
343 case SV_POTION_RUINATION:
344 case SV_POTION_DETONATIONS:
346 dam = damroll(25, 25);
349 case SV_POTION_DEATH:
351 dam = k_ptr->level * 10;
355 case SV_POTION_SPEED:
358 case SV_POTION_CURE_LIGHT:
362 case SV_POTION_CURE_SERIOUS:
366 case SV_POTION_CURE_CRITICAL:
367 case SV_POTION_CURING:
371 case SV_POTION_HEALING:
373 dam = damroll(10, 10);
375 case SV_POTION_RESTORE_EXP:
382 dam = damroll(50, 50);
385 case SV_POTION_STAR_HEALING:
387 dam = damroll(50, 50);
390 case SV_POTION_RESTORE_MANA:
392 dam = damroll(10, 10);
399 (void)project(owner_ptr, who, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
404 * @brief 矢弾を射撃した場合の破損確率を返す /
405 * Determines the odds of an object breaking when thrown at a monster
406 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
409 * Note that artifacts never break, see the "drop_near()" function.
411 PERCENTAGE breakage_chance(player_type *owner_ptr, object_type *o_ptr, bool has_archer_bonus, SPELL_IDX snipe_type)
413 /* Examine the snipe type */
416 if (snipe_type == SP_KILL_WALL) return 100;
417 if (snipe_type == SP_EXPLODE) return 100;
418 if (snipe_type == SP_PIERCE) return 100;
419 if (snipe_type == SP_FINAL) return 100;
420 if (snipe_type == SP_NEEDLE) return 100;
421 if (snipe_type == SP_EVILNESS) return 40;
422 if (snipe_type == SP_HOLYNESS) return 40;
425 /* Examine the item type */
426 PERCENTAGE archer_bonus = (has_archer_bonus ? (PERCENTAGE)(owner_ptr->lev - 1) / 7 + 4 : 0);
443 /* Sometimes break */
448 return 20 - archer_bonus * 2;
453 return 10 - archer_bonus;