2 * @brief プレイヤーの職業クラスに基づく耐性・能力の判定処理等を行うクラス
5 * @details 本クラス作成時点で責務に対する余裕はかなりあるので、適宜ここへ移してくること.
7 #include "player-base/player-class.h"
8 #include "core/player-redraw-types.h"
9 #include "core/player-update-types.h"
10 #include "player-info/bard-data-type.h"
11 #include "player-info/bluemage-data-type.h"
12 #include "player-info/force-trainer-data-type.h"
13 #include "player-info/magic-eater-data-type.h"
14 #include "player-info/mane-data-type.h"
15 #include "player-info/smith-data-type.h"
16 #include "player-info/sniper-data-type.h"
17 #include "player-info/spell-hex-data-type.h"
18 #include "player/attack-defense-types.h"
19 #include "player/special-defense-types.h"
20 #include "realm/realm-types.h"
21 #include "system/player-type-definition.h"
22 #include "util/bit-flags-calculator.h"
24 PlayerClass::PlayerClass(player_type *player_ptr)
25 : player_ptr(player_ptr)
29 bool PlayerClass::can_resist_stun() const
31 return (this->player_ptr->pclass == CLASS_BERSERKER) && (this->player_ptr->lev > 34);
34 bool PlayerClass::is_wizard() const
36 auto is_wizard = this->player_ptr->pclass == CLASS_MAGE;
37 is_wizard |= this->player_ptr->pclass == CLASS_HIGH_MAGE;
38 is_wizard |= this->player_ptr->pclass == CLASS_SORCERER;
39 is_wizard |= this->player_ptr->pclass == CLASS_MAGIC_EATER;
40 is_wizard |= this->player_ptr->pclass == CLASS_BLUE_MAGE;
41 is_wizard |= this->player_ptr->pclass == CLASS_ELEMENTALIST;
45 bool PlayerClass::lose_balance()
47 if (this->player_ptr->pclass != CLASS_SAMURAI) {
51 if (none_bits(this->player_ptr->special_defense, KATA_MASK)) {
55 reset_bits(this->player_ptr->special_defense, KATA_MASK);
56 this->player_ptr->update |= PU_BONUS;
57 this->player_ptr->update |= PU_MONSTERS;
58 this->player_ptr->redraw |= PR_STATE;
59 this->player_ptr->redraw |= PR_STATUS;
60 this->player_ptr->action = ACTION_NONE;
65 * @brief プレイヤーの職業にで使用する職業固有データ領域を初期化する
66 * @details 事前条件: player_type の職業や領域が決定済みであること
68 void PlayerClass::init_specific_data()
70 switch (this->player_ptr->pclass) {
72 this->player_ptr->class_specific_data = std::make_shared<smith_data_type>();
74 case CLASS_FORCETRAINER:
75 this->player_ptr->class_specific_data = std::make_shared<force_trainer_data_type>();
78 this->player_ptr->class_specific_data = std::make_shared<bluemage_data_type>();
80 case CLASS_MAGIC_EATER:
81 this->player_ptr->class_specific_data = std::make_shared<magic_eater_data_type>();
84 this->player_ptr->class_specific_data = std::make_shared<bard_data_type>();
87 this->player_ptr->class_specific_data = std::make_shared<mane_data_type>();
90 this->player_ptr->class_specific_data = std::make_shared<sniper_data_type>();
93 if (this->player_ptr->realm1 == REALM_HEX) {
94 this->player_ptr->class_specific_data = std::make_shared<spell_hex_data_type>();
96 this->player_ptr->class_specific_data = no_class_specific_data();
100 this->player_ptr->class_specific_data = no_class_specific_data();