* @param o_ptr 対象のオブジェクト構造体ポインタ
* @return オブジェクトが適正武器ならばTRUEを返す
*/
-bool object_is_favorite(player_type *player_ptr, const object_type *o_ptr)
+bool object_is_favorite(PlayerType *player_ptr, const object_type *o_ptr)
{
/* Only melee weapons match */
- if (!(o_ptr->tval == TV_POLEARM || o_ptr->tval == TV_SWORD || o_ptr->tval == TV_DIGGING || o_ptr->tval == TV_HAFTED)) {
+ if (!(o_ptr->tval == ItemKindType::POLEARM || o_ptr->tval == ItemKindType::SWORD || o_ptr->tval == ItemKindType::DIGGING || o_ptr->tval == ItemKindType::HAFTED)) {
return false;
}
/* Favorite weapons are varied depend on the class */
+ auto short_pclass = enum2i(player_ptr->pclass);
switch (player_ptr->pclass) {
- case CLASS_PRIEST: {
- TrFlags flgs;
- object_flags_known(o_ptr, flgs);
+ case PlayerClassType::PRIEST: {
+ auto flgs = object_flags_known(o_ptr);
- if (!has_flag(flgs, TR_BLESSED) && !(o_ptr->tval == TV_HAFTED))
+ if (flgs.has_not(TR_BLESSED) && !(o_ptr->tval == ItemKindType::HAFTED))
return false;
break;
}
- case CLASS_MONK:
- case CLASS_FORCETRAINER:
+ case PlayerClassType::MONK:
+ case PlayerClassType::FORCETRAINER:
/* Icky to wield? */
- if (!(s_info[player_ptr->pclass].w_max[o_ptr->tval - TV_WEAPON_BEGIN][o_ptr->sval]))
+ if (!(s_info[short_pclass].w_max[o_ptr->tval][o_ptr->sval]))
return false;
break;
- case CLASS_BEASTMASTER:
- case CLASS_CAVALRY: {
- TrFlags flgs;
- object_flags_known(o_ptr, flgs);
+ case PlayerClassType::BEASTMASTER:
+ case PlayerClassType::CAVALRY: {
+ auto flgs = object_flags_known(o_ptr);
/* Is it known to be suitable to using while riding? */
- if (!(has_flag(flgs, TR_RIDING)))
+ if (flgs.has_not(TR_RIDING))
return false;
break;
}
- case CLASS_SORCERER:
- if (s_info[player_ptr->pclass].w_max[o_ptr->tval - TV_WEAPON_BEGIN][o_ptr->sval] < WEAPON_EXP_MASTER)
+ case PlayerClassType::SORCERER:
+ if (s_info[short_pclass].w_max[o_ptr->tval][o_ptr->sval] < PlayerSkill::weapon_exp_at(PlayerSkillRank::MASTER))
return false;
break;
- case CLASS_NINJA:
+ case PlayerClassType::NINJA:
/* Icky to wield? */
- if (s_info[player_ptr->pclass].w_max[o_ptr->tval - TV_WEAPON_BEGIN][o_ptr->sval] <= WEAPON_EXP_BEGINNER)
+ if (s_info[short_pclass].w_max[o_ptr->tval][o_ptr->sval] <= PlayerSkill::weapon_exp_at(PlayerSkillRank::BEGINNER))
return false;
break;
return true;
}
-
-/*!
- * @brief オブジェクトが強化不能武器であるかを返す / Poison needle can not be enchanted
- * @param o_ptr 対象のオブジェクト構造体ポインタ
- * @return 強化不能ならばTRUEを返す
- */
-bool object_refuse_enchant_weapon(const object_type *o_ptr)
-{
- if (o_ptr->tval == TV_SWORD && o_ptr->sval == SV_POISON_NEEDLE)
- return true;
-
- return false;
-}
-
-/*!
- * @brief オブジェクトが強化可能武器であるかを返す /
- * Check if an object is weapon (including bows and ammo) and allows enchantment
- * @param o_ptr 対象のオブジェクト構造体ポインタ
- * @return 強化可能ならばTRUEを返す
- */
-bool object_allow_enchant_weapon(const object_type *o_ptr)
-{
- if (o_ptr->is_weapon_ammo() && !object_refuse_enchant_weapon(o_ptr))
- return true;
-
- return false;
-}
-
-/*!
- * @brief オブジェクトが強化可能な近接武器であるかを返す /
- * Check if an object is melee weapon and allows enchantment
- * @param o_ptr 対象のオブジェクト構造体ポインタ
- * @return 強化可能な近接武器ならばTRUEを返す
- */
-bool object_allow_enchant_melee_weapon(const object_type *o_ptr)
-{
- if (o_ptr->is_melee_weapon() && !object_refuse_enchant_weapon(o_ptr))
- return true;
-
- return false;
-}
-
-/*!
- * @brief オブジェクトが両手持ち可能な武器かを返す /
- * Check if an object is melee weapon and allows wielding with two-hands
- * @param o_ptr 対象のオブジェクト構造体ポインタ
- * @return 両手持ち可能ならばTRUEを返す
- */
-bool object_allow_two_hands_wielding(const object_type *o_ptr)
-{
- if (o_ptr->is_melee_weapon() && ((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)))
- return true;
-
- return false;
-}