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 "p_ptr->inventory_list 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)
175 * @brief アイテムが酸で破損するかどうかを判定する(メインルーチン) /
177 * @param o_ptr アイテムの情報参照ポインタ
178 * @return 破損するならばTRUEを返す
181 int set_acid_destroy(object_type *o_ptr)
183 BIT_FLAGS flgs[TR_FLAG_SIZE];
184 if (!hates_acid(o_ptr)) return (FALSE);
185 object_flags(o_ptr, flgs);
186 if (have_flag(flgs, TR_IGNORE_ACID)) return (FALSE);
192 * @brief アイテムが電撃で破損するかどうかを判定する(メインルーチン) /
194 * @param o_ptr アイテムの情報参照ポインタ
195 * @return 破損するならばTRUEを返す
198 int set_elec_destroy(object_type *o_ptr)
200 BIT_FLAGS flgs[TR_FLAG_SIZE];
201 if (!hates_elec(o_ptr)) return (FALSE);
202 object_flags(o_ptr, flgs);
203 if (have_flag(flgs, TR_IGNORE_ELEC)) return (FALSE);
209 * @brief アイテムが火炎で破損するかどうかを判定する(メインルーチン) /
211 * @param o_ptr アイテムの情報参照ポインタ
212 * @return 破損するならばTRUEを返す
215 int set_fire_destroy(object_type *o_ptr)
217 BIT_FLAGS flgs[TR_FLAG_SIZE];
218 if (!hates_fire(o_ptr)) return (FALSE);
219 object_flags(o_ptr, flgs);
220 if (have_flag(flgs, TR_IGNORE_FIRE)) return (FALSE);
226 * @brief アイテムが冷気で破損するかどうかを判定する(メインルーチン) /
228 * @param o_ptr アイテムの情報参照ポインタ
229 * @return 破損するならばTRUEを返す
232 int set_cold_destroy(object_type *o_ptr)
234 BIT_FLAGS flgs[TR_FLAG_SIZE];
235 if (!hates_cold(o_ptr)) return (FALSE);
236 object_flags(o_ptr, flgs);
237 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 p_ptr->inventory_list.
262 * (Not anymore -- I changed this; TY)
263 * y, x --- coordinates of the potion (or player if
264 * the potion was in her p_ptr->inventory_list);
265 * o_ptr --- pointer to the potion object.
268 bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx)
275 object_kind *k_ptr = &k_info[k_idx];
279 case SV_POTION_SALT_WATER:
280 case SV_POTION_SLIME_MOLD:
281 case SV_POTION_LOSE_MEMORIES:
282 case SV_POTION_DEC_STR:
283 case SV_POTION_DEC_INT:
284 case SV_POTION_DEC_WIS:
285 case SV_POTION_DEC_DEX:
286 case SV_POTION_DEC_CON:
287 case SV_POTION_DEC_CHR:
288 case SV_POTION_WATER: /* perhaps a 'water' attack? */
289 case SV_POTION_APPLE_JUICE:
292 case SV_POTION_INFRAVISION:
293 case SV_POTION_DETECT_INVIS:
294 case SV_POTION_SLOW_POISON:
295 case SV_POTION_CURE_POISON:
296 case SV_POTION_BOLDNESS:
297 case SV_POTION_RESIST_HEAT:
298 case SV_POTION_RESIST_COLD:
299 case SV_POTION_HEROISM:
300 case SV_POTION_BESERK_STRENGTH:
301 case SV_POTION_RES_STR:
302 case SV_POTION_RES_INT:
303 case SV_POTION_RES_WIS:
304 case SV_POTION_RES_DEX:
305 case SV_POTION_RES_CON:
306 case SV_POTION_RES_CHR:
307 case SV_POTION_INC_STR:
308 case SV_POTION_INC_INT:
309 case SV_POTION_INC_WIS:
310 case SV_POTION_INC_DEX:
311 case SV_POTION_INC_CON:
312 case SV_POTION_INC_CHR:
313 case SV_POTION_AUGMENTATION:
314 case SV_POTION_ENLIGHTENMENT:
315 case SV_POTION_STAR_ENLIGHTENMENT:
316 case SV_POTION_SELF_KNOWLEDGE:
317 case SV_POTION_EXPERIENCE:
318 case SV_POTION_RESISTANCE:
319 case SV_POTION_INVULNERABILITY:
320 case SV_POTION_NEW_LIFE:
321 /* All of the above potions have no effect when shattered */
323 case SV_POTION_SLOWNESS:
328 case SV_POTION_POISON:
333 case SV_POTION_BLINDNESS:
337 case SV_POTION_BOOZE: /* Booze */
341 case SV_POTION_SLEEP:
345 case SV_POTION_RUINATION:
346 case SV_POTION_DETONATIONS:
348 dam = damroll(25, 25);
351 case SV_POTION_DEATH:
352 dt = GF_DEATH_RAY; /* !! */
353 dam = k_ptr->level * 10;
357 case SV_POTION_SPEED:
360 case SV_POTION_CURE_LIGHT:
364 case SV_POTION_CURE_SERIOUS:
368 case SV_POTION_CURE_CRITICAL:
369 case SV_POTION_CURING:
373 case SV_POTION_HEALING:
375 dam = damroll(10, 10);
377 case SV_POTION_RESTORE_EXP:
384 dam = damroll(50, 50);
387 case SV_POTION_STAR_HEALING:
389 dam = damroll(50, 50);
392 case SV_POTION_RESTORE_MANA: /* MANA */
394 dam = damroll(10, 10);
401 (void)project(who, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
403 /* XXX those potions that explode need to become "known" */
408 * @brief 矢弾を射撃した場合の破損確率を返す /
409 * Determines the odds of an object breaking when thrown at a monster
410 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
413 * Note that artifacts never break, see the "drop_near()" function.
415 PERCENTAGE breakage_chance(object_type *o_ptr, bool has_archer_bonus, SPELL_IDX snipe_type)
417 PERCENTAGE archer_bonus = (has_archer_bonus ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
419 /* Examine the snipe type */
422 if (snipe_type == SP_KILL_WALL) return (100);
423 if (snipe_type == SP_EXPLODE) return (100);
424 if (snipe_type == SP_PIERCE) return (100);
425 if (snipe_type == SP_FINAL) return (100);
426 if (snipe_type == SP_NEEDLE) return (100);
427 if (snipe_type == SP_EVILNESS) return (40);
428 if (snipe_type == SP_HOLYNESS) return (40);
431 /* Examine the item type */
448 /* Sometimes break */
453 return (20 - archer_bonus * 2);
458 return (10 - archer_bonus);