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/smith-data-type.h"
15 #include "player-info/spell-hex-data-type.h"
16 #include "player/attack-defense-types.h"
17 #include "player/special-defense-types.h"
18 #include "realm/realm-types.h"
19 #include "system/player-type-definition.h"
20 #include "util/bit-flags-calculator.h"
22 PlayerClass::PlayerClass(player_type *player_ptr)
23 : player_ptr(player_ptr)
27 bool PlayerClass::can_resist_stun() const
29 return (this->player_ptr->pclass == CLASS_BERSERKER) && (this->player_ptr->lev > 34);
32 bool PlayerClass::is_wizard() const
34 auto is_wizard = this->player_ptr->pclass == CLASS_MAGE;
35 is_wizard |= this->player_ptr->pclass == CLASS_HIGH_MAGE;
36 is_wizard |= this->player_ptr->pclass == CLASS_SORCERER;
37 is_wizard |= this->player_ptr->pclass == CLASS_MAGIC_EATER;
38 is_wizard |= this->player_ptr->pclass == CLASS_BLUE_MAGE;
39 is_wizard |= this->player_ptr->pclass == CLASS_ELEMENTALIST;
43 bool PlayerClass::lose_balance()
45 if (this->player_ptr->pclass != CLASS_SAMURAI) {
49 if (none_bits(this->player_ptr->special_defense, KATA_MASK)) {
53 reset_bits(this->player_ptr->special_defense, KATA_MASK);
54 this->player_ptr->update |= PU_BONUS;
55 this->player_ptr->update |= PU_MONSTERS;
56 this->player_ptr->redraw |= PR_STATE;
57 this->player_ptr->redraw |= PR_STATUS;
58 this->player_ptr->action = ACTION_NONE;
63 * @brief プレイヤーの職業にで使用する職業固有データ領域を初期化する
64 * @details 事前条件: player_type の職業や領域が決定済みであること
66 void PlayerClass::init_specific_data()
68 switch (this->player_ptr->pclass) {
70 this->player_ptr->class_specific_data = std::make_shared<smith_data_type>();
72 case CLASS_FORCETRAINER:
73 this->player_ptr->class_specific_data = std::make_shared<force_trainer_data_type>();
76 this->player_ptr->class_specific_data = std::make_shared<bluemage_data_type>();
78 case CLASS_MAGIC_EATER:
79 this->player_ptr->class_specific_data = std::make_shared<magic_eater_data_type>();
82 this->player_ptr->class_specific_data = std::make_shared<bard_data_type>();
85 if (this->player_ptr->realm1 == REALM_HEX) {
86 this->player_ptr->class_specific_data = std::make_shared<spell_hex_data_type>();
88 this->player_ptr->class_specific_data = no_class_specific_data();
92 this->player_ptr->class_specific_data = no_class_specific_data();