6 #include "object/object-broken.h"
7 #include "combat/snipe.h"
8 #include "effect/effect-characteristics.h"
9 #include "object/object-kind.h"
10 #include "object/object2.h"
11 #include "sv-definition/sv-potion-types.h"
12 #include "object-enchant/tr-types.h"
13 #include "spell/process-effect.h"
14 #include "spell/spells-type.h"
17 * @brief アイテムが酸で破損するかどうかを判定する
18 * @param o_ptr アイテムの情報参照ポインタ
19 * @return 破損するならばTRUEを返す
20 * Note that amulets, rods, and high-level spell books are immune
21 * to "inventory damage" of any kind. Also sling ammo and shovels.
22 * Does a given class of objects (usually) hate acid?
23 * Note that acid can either melt or corrode something.
25 bool hates_acid(object_type *o_ptr)
27 /* Analyze the type */
50 /* Staffs/Scrolls are wood/paper */
77 * @brief アイテムが電撃で破損するかどうかを判定する /
78 * Does a given object (usually) hate electricity?
79 * @param o_ptr アイテムの情報参照ポインタ
80 * @return 破損するならばTRUEを返す
82 bool hates_elec(object_type *o_ptr)
98 * @brief アイテムが火炎で破損するかどうかを判定する /
99 * Does a given object (usually) hate fire?
100 * @param o_ptr アイテムの情報参照ポインタ
101 * @return 破損するならばTRUEを返す
103 * Hafted/Polearm weapons have wooden shafts.
104 * Arrows/Bows are mostly wooden.
106 bool hates_fire(object_type *o_ptr)
108 /* Analyze the type */
127 case TV_SORCERY_BOOK:
135 case TV_CRUSADE_BOOK:
137 case TV_HISSATSU_BOOK:
149 /* Staffs/Scrolls burn */
162 * @brief アイテムが冷気で破損するかどうかを判定する /
163 * Does a given object (usually) hate cold?
164 * @param o_ptr アイテムの情報参照ポインタ
165 * @return 破損するならばTRUEを返す
167 bool hates_cold(object_type *o_ptr)
184 * @brief アイテムが酸で破損するかどうかを判定する(メインルーチン) /
186 * @param o_ptr アイテムの情報参照ポインタ
187 * @return 破損するならばTRUEを返す
190 int set_acid_destroy(object_type *o_ptr)
192 BIT_FLAGS flgs[TR_FLAG_SIZE];
193 if (!hates_acid(o_ptr)) return FALSE;
194 object_flags(o_ptr, flgs);
195 if (have_flag(flgs, TR_IGNORE_ACID)) return FALSE;
201 * @brief アイテムが電撃で破損するかどうかを判定する(メインルーチン) /
203 * @param o_ptr アイテムの情報参照ポインタ
204 * @return 破損するならばTRUEを返す
207 int set_elec_destroy(object_type *o_ptr)
209 BIT_FLAGS flgs[TR_FLAG_SIZE];
210 if (!hates_elec(o_ptr)) return FALSE;
211 object_flags(o_ptr, flgs);
212 if (have_flag(flgs, TR_IGNORE_ELEC)) return FALSE;
218 * @brief アイテムが火炎で破損するかどうかを判定する(メインルーチン) /
220 * @param o_ptr アイテムの情報参照ポインタ
221 * @return 破損するならばTRUEを返す
224 int set_fire_destroy(object_type *o_ptr)
226 BIT_FLAGS flgs[TR_FLAG_SIZE];
227 if (!hates_fire(o_ptr)) return FALSE;
228 object_flags(o_ptr, flgs);
229 if (have_flag(flgs, TR_IGNORE_FIRE)) return FALSE;
235 * @brief アイテムが冷気で破損するかどうかを判定する(メインルーチン) /
237 * @param o_ptr アイテムの情報参照ポインタ
238 * @return 破損するならばTRUEを返す
241 int set_cold_destroy(object_type *o_ptr)
243 BIT_FLAGS flgs[TR_FLAG_SIZE];
244 if (!hates_cold(o_ptr)) return FALSE;
245 object_flags(o_ptr, flgs);
246 if (have_flag(flgs, TR_IGNORE_COLD)) return FALSE;
253 * Potions "smash open" and cause an area effect when
254 * @param who 薬破損の主体ID(プレイヤー所持アイテムが壊れた場合0、床上のアイテムの場合モンスターID)
257 * @param k_idx 破損した薬のアイテムID
258 * @return 薬を浴びたモンスターが起こるならばTRUEを返す
261 * (1) they are shattered while in the player's p_ptr->inventory_list,
262 * due to cold (etc) attacks;
263 * (2) they are thrown at a monster, or obstacle;
264 * (3) they are shattered by a "cold ball" or other such spell
265 * while lying on the floor.
268 * who --- who caused the potion to shatter (0=player)
269 * potions that smash on the floor are assumed to
270 * be caused by no-one (who = 1), as are those that
271 * shatter inside the player inventory.
272 * (Not anymore -- I changed this; TY)
273 * y, x --- coordinates of the potion (or player if
274 * the potion was in her inventory);
275 * o_ptr --- pointer to the potion object.
278 bool potion_smash_effect(player_type *owner_ptr, MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx)
284 object_kind *k_ptr = &k_info[k_idx];
287 case SV_POTION_SALT_WATER:
288 case SV_POTION_SLIME_MOLD:
289 case SV_POTION_LOSE_MEMORIES:
290 case SV_POTION_DEC_STR:
291 case SV_POTION_DEC_INT:
292 case SV_POTION_DEC_WIS:
293 case SV_POTION_DEC_DEX:
294 case SV_POTION_DEC_CON:
295 case SV_POTION_DEC_CHR:
296 case SV_POTION_WATER: /* perhaps a 'water' attack? */
297 case SV_POTION_APPLE_JUICE:
300 case SV_POTION_INFRAVISION:
301 case SV_POTION_DETECT_INVIS:
302 case SV_POTION_SLOW_POISON:
303 case SV_POTION_CURE_POISON:
304 case SV_POTION_BOLDNESS:
305 case SV_POTION_RESIST_HEAT:
306 case SV_POTION_RESIST_COLD:
307 case SV_POTION_HEROISM:
308 case SV_POTION_BESERK_STRENGTH:
309 case SV_POTION_RES_STR:
310 case SV_POTION_RES_INT:
311 case SV_POTION_RES_WIS:
312 case SV_POTION_RES_DEX:
313 case SV_POTION_RES_CON:
314 case SV_POTION_RES_CHR:
315 case SV_POTION_INC_STR:
316 case SV_POTION_INC_INT:
317 case SV_POTION_INC_WIS:
318 case SV_POTION_INC_DEX:
319 case SV_POTION_INC_CON:
320 case SV_POTION_INC_CHR:
321 case SV_POTION_AUGMENTATION:
322 case SV_POTION_ENLIGHTENMENT:
323 case SV_POTION_STAR_ENLIGHTENMENT:
324 case SV_POTION_SELF_KNOWLEDGE:
325 case SV_POTION_EXPERIENCE:
326 case SV_POTION_RESISTANCE:
327 case SV_POTION_INVULNERABILITY:
328 case SV_POTION_NEW_LIFE:
329 /* All of the above potions have no effect when shattered */
331 case SV_POTION_SLOWNESS:
336 case SV_POTION_POISON:
341 case SV_POTION_BLINDNESS:
345 case SV_POTION_BOOZE:
349 case SV_POTION_SLEEP:
353 case SV_POTION_RUINATION:
354 case SV_POTION_DETONATIONS:
356 dam = damroll(25, 25);
359 case SV_POTION_DEATH:
361 dam = k_ptr->level * 10;
365 case SV_POTION_SPEED:
368 case SV_POTION_CURE_LIGHT:
372 case SV_POTION_CURE_SERIOUS:
376 case SV_POTION_CURE_CRITICAL:
377 case SV_POTION_CURING:
381 case SV_POTION_HEALING:
383 dam = damroll(10, 10);
385 case SV_POTION_RESTORE_EXP:
392 dam = damroll(50, 50);
395 case SV_POTION_STAR_HEALING:
397 dam = damroll(50, 50);
400 case SV_POTION_RESTORE_MANA:
402 dam = damroll(10, 10);
409 (void)project(owner_ptr, who, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL), -1);
414 * @brief 矢弾を射撃した場合の破損確率を返す /
415 * Determines the odds of an object breaking when thrown at a monster
416 * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
419 * Note that artifacts never break, see the "drop_near()" function.
421 PERCENTAGE breakage_chance(player_type *owner_ptr, object_type *o_ptr, bool has_archer_bonus, SPELL_IDX snipe_type)
423 /* Examine the snipe type */
426 if (snipe_type == SP_KILL_WALL) return 100;
427 if (snipe_type == SP_EXPLODE) return 100;
428 if (snipe_type == SP_PIERCE) return 100;
429 if (snipe_type == SP_FINAL) return 100;
430 if (snipe_type == SP_NEEDLE) return 100;
431 if (snipe_type == SP_EVILNESS) return 40;
432 if (snipe_type == SP_HOLYNESS) return 40;
435 /* Examine the item type */
436 PERCENTAGE archer_bonus = (has_archer_bonus ? (PERCENTAGE)(owner_ptr->lev - 1) / 7 + 4 : 0);
453 /* Sometimes break */
458 return 20 - archer_bonus * 2;
463 return 10 - archer_bonus;