1 #include "object-hook/hook-weapon.h"
2 #include "object-enchant/tr-types.h"
3 #include "object-hook/hook-armor.h"
4 #include "object/object-flags.h"
5 #include "player/player-skill.h"
6 #include "sv-definition/sv-weapon-types.h"
7 #include "system/object-type-definition.h"
8 #include "system/player-type-definition.h"
9 #include "util/bit-flags-calculator.h"
12 * @brief オブジェクトがプレイヤーの職業に応じた適正武器か否かを返す / Favorite weapons
13 * @param o_ptr 対象のオブジェクト構造体ポインタ
14 * @return オブジェクトが適正武器ならばTRUEを返す
16 bool object_is_favorite(player_type *player_ptr, const object_type *o_ptr)
18 /* Only melee weapons match */
19 if (!(o_ptr->tval == TV_POLEARM || o_ptr->tval == TV_SWORD || o_ptr->tval == TV_DIGGING || o_ptr->tval == TV_HAFTED)) {
23 /* Favorite weapons are varied depend on the class */
24 switch (player_ptr->pclass) {
27 object_flags_known(o_ptr, flgs);
29 if (!has_flag(flgs, TR_BLESSED) && !(o_ptr->tval == TV_HAFTED))
35 case CLASS_FORCETRAINER:
37 if (!(s_info[player_ptr->pclass].w_max[o_ptr->tval - TV_WEAPON_BEGIN][o_ptr->sval]))
41 case CLASS_BEASTMASTER:
44 object_flags_known(o_ptr, flgs);
46 /* Is it known to be suitable to using while riding? */
47 if (!(has_flag(flgs, TR_RIDING)))
54 if (s_info[player_ptr->pclass].w_max[o_ptr->tval - TV_WEAPON_BEGIN][o_ptr->sval] < WEAPON_EXP_MASTER)
60 if (s_info[player_ptr->pclass].w_max[o_ptr->tval - TV_WEAPON_BEGIN][o_ptr->sval] <= WEAPON_EXP_BEGINNER)
65 /* All weapons are okay for non-special classes */
73 * @brief オブジェクトが両手持ち可能な武器かを返す /
74 * Check if an object is melee weapon and allows wielding with two-hands
75 * @param o_ptr 対象のオブジェクト構造体ポインタ
76 * @return 両手持ち可能ならばTRUEを返す
78 bool object_allow_two_hands_wielding(const object_type *o_ptr)
80 if (o_ptr->is_melee_weapon() && ((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)))