if (hit_body) torch_lost_fuel(q_ptr);
/* Chance of breakage (during attacks) */
- j = (hit_body ? breakage_chance(q_ptr, 0) : 0);
+ j = (hit_body ? breakage_chance(q_ptr, p_ptr->pclass == CLASS_ARCHER, 0) : 0);
/* Figurines transform */
if ((q_ptr->tval == TV_FIGURINE) && !(p_ptr->inside_arena))
#include "angband.h"
#include "spells.h"
#include "objectkind.h"
-
+#include "snipe.h"
/*!
* @brief アイテムが酸で破損するかどうかを判定する
/* XXX those potions that explode need to become "known" */
return angry;
}
+
+/*!
+ * @brief 矢弾を射撃した場合の破損確率を返す /
+ * Determines the odds of an object breaking when thrown at a monster
+ * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
+ * @return 破損確率(%)
+ * @details
+ * Note that artifacts never break, see the "drop_near()" function.
+ */
+PERCENTAGE breakage_chance(object_type *o_ptr, bool has_archer_bonus, SPELL_IDX snipe_type)
+{
+ PERCENTAGE archer_bonus = (has_archer_bonus ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
+
+ /* Examine the snipe type */
+ if (snipe_type)
+ {
+ if (snipe_type == SP_KILL_WALL) return (100);
+ if (snipe_type == SP_EXPLODE) return (100);
+ if (snipe_type == SP_PIERCE) return (100);
+ if (snipe_type == SP_FINAL) return (100);
+ if (snipe_type == SP_NEEDLE) return (100);
+ if (snipe_type == SP_EVILNESS) return (40);
+ if (snipe_type == SP_HOLYNESS) return (40);
+ }
+
+ /* Examine the item type */
+ switch (o_ptr->tval)
+ {
+ /* Always break */
+ case TV_FLASK:
+ case TV_POTION:
+ case TV_BOTTLE:
+ case TV_FOOD:
+ case TV_JUNK:
+ return (100);
+
+ /* Often break */
+ case TV_LITE:
+ case TV_SCROLL:
+ case TV_SKELETON:
+ return (50);
+
+ /* Sometimes break */
+ case TV_WAND:
+ case TV_SPIKE:
+ return (25);
+ case TV_ARROW:
+ return (20 - archer_bonus * 2);
+
+ /* Rarely break */
+ case TV_SHOT:
+ case TV_BOLT:
+ return (10 - archer_bonus);
+ default:
+ return (10);
+ }
+}
extern int set_cold_destroy(object_type *o_ptr);
extern bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx);
+PERCENTAGE breakage_chance(object_type *o_ptr, bool has_archer_bonus, SPELL_IDX snipe_type);
extern bool can_get_item(OBJECT_TYPE_VALUE tval);
extern bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval);
extern object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval);
-PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type);
extern int bow_tval_ammo(object_type *o_ptr);
}
return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
}
-
-/*!
- * @brief 矢弾を射撃した場合の破損確率を返す /
- * Determines the odds of an object breaking when thrown at a monster
- * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
- * @return 破損確率(%)
- * @details
- * Note that artifacts never break, see the "drop_near()" function.
- */
-PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
-{
- PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
-
- /* Examine the snipe type */
- if (snipe_type)
- {
- if (snipe_type == SP_KILL_WALL) return (100);
- if (snipe_type == SP_EXPLODE) return (100);
- if (snipe_type == SP_PIERCE) return (100);
- if (snipe_type == SP_FINAL) return (100);
- if (snipe_type == SP_NEEDLE) return (100);
- if (snipe_type == SP_EVILNESS) return (40);
- if (snipe_type == SP_HOLYNESS) return (40);
- }
-
- /* Examine the item type */
- switch (o_ptr->tval)
- {
- /* Always break */
- case TV_FLASK:
- case TV_POTION:
- case TV_BOTTLE:
- case TV_FOOD:
- case TV_JUNK:
- return (100);
-
- /* Often break */
- case TV_LITE:
- case TV_SCROLL:
- case TV_SKELETON:
- return (50);
-
- /* Sometimes break */
- case TV_WAND:
- case TV_SPIKE:
- return (25);
- case TV_ARROW:
- return (20 - archer_bonus * 2);
-
- /* Rarely break */
- case TV_SHOT:
- case TV_BOLT:
- return (10 - archer_bonus);
- default:
- return (10);
- }
-}
#include "player-class.h"
#include "player-personality.h"
#include "object-hook.h"
+#include "object-broken.h"
#include "floor.h"
#include "grid.h"
#include "spells.h"
}
/* Chance of breakage (during attacks) */
- j = (hit_body ? breakage_chance(q_ptr, snipe_type) : 0);
+ j = (hit_body ? breakage_chance(q_ptr, p_ptr->pclass == CLASS_ARCHER, snipe_type) : 0);
if (stick_to)
{