-#include "player-status/player-stealth.h"
+#include "player-status/player-stealth.h"
#include "mind/mind-ninja.h"
#include "mutation/mutation-flag-types.h"
+#include "player-base/player-class.h"
+#include "player-base/player-race.h"
#include "player-info/class-info.h"
#include "player-info/equipment-info.h"
#include "player-info/mimic-info-table.h"
#include "player/player-status.h"
#include "player/race-info-table.h"
#include "spell-realm/spells-hex.h"
-#include "system/object-type-definition.h"
+#include "system/item-entity.h"
#include "system/player-type-definition.h"
#include "util/bit-flags-calculator.h"
#include "util/enum-converter.h"
+PlayerStealth::PlayerStealth(PlayerType *player_ptr)
+ : PlayerStatusBase(player_ptr)
+{
+}
+
/*!
* @brief 隠密能力計算 - 種族
* @return 隠密能力の増分
* @details
* * 種族による加算
*/
-int16_t PlayerStealth::race_value()
+int16_t PlayerStealth::race_bonus()
{
- const player_race_info *tmp_rp_ptr;
-
- if (this->player_ptr->mimic_form)
- tmp_rp_ptr = &mimic_info[this->player_ptr->mimic_form];
- else
- tmp_rp_ptr = &race_info[enum2i(this->player_ptr->prace)];
-
- return tmp_rp_ptr->r_stl;
+ return PlayerRace(this->player_ptr).get_info()->r_stl;
}
/*!
* @details
* * 性格による加算
*/
-int16_t PlayerStealth::personality_value()
+int16_t PlayerStealth::personality_bonus()
{
const player_personality *a_ptr = &personality_info[this->player_ptr->ppersonality];
return a_ptr->a_stl;
* @details
* * 職業による加算
*/
-int16_t PlayerStealth::class_base_value()
+int16_t PlayerStealth::class_base_bonus()
{
const player_class_info *c_ptr = &class_info[enum2i(this->player_ptr->pclass)];
return c_ptr->c_stl + (c_ptr->x_stl * this->player_ptr->lev / 10);
* * 忍者がheavy_armorならば減算(-レベル/10)
* * 忍者がheavy_armorでなく適正な武器を持っていれば加算(+レベル/10)
*/
-int16_t PlayerStealth::class_value()
+int16_t PlayerStealth::class_bonus()
{
- ACTION_SKILL_POWER result = 0;
-
- if (this->player_ptr->pclass == PlayerClassType::NINJA) {
- if (heavy_armor(this->player_ptr)) {
- result -= (this->player_ptr->lev) / 10;
- } else if ((!this->player_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(this->player_ptr))
- && (!this->player_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(this->player_ptr))) {
- result += (this->player_ptr->lev) / 10;
- }
+ PlayerClass pc(this->player_ptr);
+ if (!pc.equals(PlayerClassType::NINJA)) {
+ return 0;
+ }
+
+ int16_t bonus = 0;
+ if (heavy_armor(this->player_ptr)) {
+ bonus -= (this->player_ptr->lev) / 10;
+ } else if (pc.has_ninja_speed()) {
+ bonus += (this->player_ptr->lev) / 10;
}
- return result;
+ return bonus;
}
/*!
* * 変異MUT3_XTRA_NOISで減算(-3)
* * 変異MUT3_MOTIONで加算(+1)
*/
-int16_t PlayerStealth::mutation_value()
+int16_t PlayerStealth::mutation_bonus()
{
- int16_t result = 0;
+ int16_t bonus = 0;
const auto &muta = this->player_ptr->muta;
- if (muta.has(MUTA::XTRA_NOIS)) {
- result -= 3;
+ if (muta.has(PlayerMutationType::XTRA_NOIS)) {
+ bonus -= 3;
}
- if (muta.has(MUTA::MOTION)) {
- result += 1;
+
+ if (muta.has(PlayerMutationType::MOTION)) {
+ bonus += 1;
}
- return result;
+
+ return bonus;
}
/*!
* * 狂戦士化で減算(-7)
* * 隠密の歌で加算(+999)
*/
-int16_t PlayerStealth::time_effect_value()
+int16_t PlayerStealth::time_effect_bonus()
{
- int16_t result = 0;
+ int16_t bonus = 0;
if (this->player_ptr->realm1 == REALM_HEX) {
SpellHex spell_hex(this->player_ptr);
if (spell_hex.is_spelling_any()) {
- result -= spell_hex.get_casting_num() + 1;
+ bonus -= spell_hex.get_casting_num() + 1;
}
}
if (is_shero(this->player_ptr)) {
- result -= 7;
+ bonus -= 7;
}
if (is_time_limit_stealth(this->player_ptr)) {
- result += 999;
+ bonus += 999;
}
- return result;
+ return bonus;
}
bool PlayerStealth::is_aggravated_s_fairy()
* @details
* * セクシーギャルでない影フェアリーがTRC_AGGRAVATE持ちの時、別処理でTRC_AGGRAVATEを無効にする代わりに減算(-3か3未満なら(現在値+2)/2)
*/
-int16_t PlayerStealth::set_exception_value(int16_t value)
+int16_t PlayerStealth::set_exception_bonus(int16_t value)
{
if (this->is_aggravated_s_fairy()) {
- value = MIN(value - 3, (value + 2) / 2);
+ value = std::min<int16_t>(value - 3, (value + 2) / 2);
}
+
return value;
}
*/
BIT_FLAGS PlayerStealth::get_bad_flags()
{
- BIT_FLAGS result = PlayerStatusBase::get_bad_flags();
-
- if (this->is_aggravated_s_fairy())
- set_bits(result, FLAG_CAUSE_RACE);
+ auto flags = PlayerStatusBase::get_bad_flags();
+ if (this->is_aggravated_s_fairy()) {
+ set_bits(flags, FLAG_CAUSE_RACE);
+ }
- return result;
+ return flags;
}
/*!