{
return k_info[k_idx].tval == TV_POTION;
}
+
+/*!
+ * @brief ベースアイテムが上質として扱われるかどうかを返す。
+ * Hack -- determine if a template is "good"
+ * @param k_idx 判定したいベースアイテムのID
+ * @return ベースアイテムが上質ならばTRUEを返す。
+ */
+bool kind_is_good(KIND_OBJECT_IDX k_idx)
+{
+ object_kind *k_ptr = &k_info[k_idx];
+
+ /* Analyze the item type */
+ switch (k_ptr->tval)
+ {
+ /* Armor -- Good unless damaged */
+ case TV_HARD_ARMOR:
+ case TV_SOFT_ARMOR:
+ case TV_DRAG_ARMOR:
+ case TV_SHIELD:
+ case TV_CLOAK:
+ case TV_BOOTS:
+ case TV_GLOVES:
+ case TV_HELM:
+ case TV_CROWN:
+ {
+ if (k_ptr->to_a < 0) return (FALSE);
+ return (TRUE);
+ }
+
+ /* Weapons -- Good unless damaged */
+ case TV_BOW:
+ case TV_SWORD:
+ case TV_HAFTED:
+ case TV_POLEARM:
+ case TV_DIGGING:
+ {
+ if (k_ptr->to_h < 0) return (FALSE);
+ if (k_ptr->to_d < 0) return (FALSE);
+ return (TRUE);
+ }
+
+ /* Ammo -- Arrows/Bolts are good */
+ case TV_BOLT:
+ case TV_ARROW:
+ {
+ return (TRUE);
+ }
+
+ /* Books -- High level books are good (except Arcane books) */
+ case TV_LIFE_BOOK:
+ case TV_SORCERY_BOOK:
+ case TV_NATURE_BOOK:
+ case TV_CHAOS_BOOK:
+ case TV_DEATH_BOOK:
+ case TV_TRUMP_BOOK:
+ case TV_CRAFT_BOOK:
+ case TV_DAEMON_BOOK:
+ case TV_CRUSADE_BOOK:
+ case TV_MUSIC_BOOK:
+ case TV_HISSATSU_BOOK:
+ case TV_HEX_BOOK:
+ {
+ if (k_ptr->sval >= SV_BOOK_MIN_GOOD) return (TRUE);
+ return (FALSE);
+ }
+
+ /* Rings -- Rings of Speed are good */
+ case TV_RING:
+ {
+ if (k_ptr->sval == SV_RING_SPEED) return (TRUE);
+ if (k_ptr->sval == SV_RING_LORDLY) return (TRUE);
+ return (FALSE);
+ }
+
+ /* Amulets -- Amulets of the Magi and Resistance are good */
+ case TV_AMULET:
+ {
+ if (k_ptr->sval == SV_AMULET_THE_MAGI) return (TRUE);
+ if (k_ptr->sval == SV_AMULET_RESISTANCE) return (TRUE);
+ return (FALSE);
+ }
+ }
+
+ /* Assume not good */
+ return (FALSE);
+}