/*!
- * @brief ã\83\97ã\83¬ã\83¼ヤーの耐性と能力値を表示する
+ * @brief ã\83\97ã\83¬ã\82¤ヤーの耐性と能力値を表示する
* @date 2020/02/27
* @author Hourier
* @details
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
#include "object/object-flags.h"
-#include "player/mimic-info-table.h"
+#include "player-base/player-race.h"
+#include "player-info/class-info.h"
+#include "player-info/mimic-info-table.h"
#include "player/permanent-resistances.h"
-#include "player/player-class.h"
#include "player/player-personality.h"
-#include "player/player-race-types.h"
#include "player/player-status-table.h"
#include "player/player-status.h"
#include "system/object-type-definition.h"
#include "util/bit-flags-calculator.h"
/*!
- * @brief ã\83\97ã\83¬ã\83¼ヤーのパラメータ基礎値 (腕力等)を18以下になるようにして返す
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @brief ã\83\97ã\83¬ã\82¤ヤーのパラメータ基礎値 (腕力等)を18以下になるようにして返す
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param stat_num 能力値番号
* @return 基礎値
* @details 最大が18になるのはD&D由来
*/
-static int calc_basic_stat(player_type *creature_ptr, int stat_num)
+static int calc_basic_stat(PlayerType *player_ptr, int stat_num)
{
int e_adj = 0;
- if ((creature_ptr->stat_max[stat_num] > 18) && (creature_ptr->stat_top[stat_num] > 18))
- e_adj = (creature_ptr->stat_top[stat_num] - creature_ptr->stat_max[stat_num]) / 10;
+ if ((player_ptr->stat_max[stat_num] > 18) && (player_ptr->stat_top[stat_num] > 18))
+ e_adj = (player_ptr->stat_top[stat_num] - player_ptr->stat_max[stat_num]) / 10;
- if ((creature_ptr->stat_max[stat_num] <= 18) && (creature_ptr->stat_top[stat_num] <= 18))
- e_adj = creature_ptr->stat_top[stat_num] - creature_ptr->stat_max[stat_num];
+ if ((player_ptr->stat_max[stat_num] <= 18) && (player_ptr->stat_top[stat_num] <= 18))
+ e_adj = player_ptr->stat_top[stat_num] - player_ptr->stat_max[stat_num];
- if ((creature_ptr->stat_max[stat_num] <= 18) && (creature_ptr->stat_top[stat_num] > 18))
- e_adj = (creature_ptr->stat_top[stat_num] - 18) / 10 - creature_ptr->stat_max[stat_num] + 18;
+ if ((player_ptr->stat_max[stat_num] <= 18) && (player_ptr->stat_top[stat_num] > 18))
+ e_adj = (player_ptr->stat_top[stat_num] - 18) / 10 - player_ptr->stat_max[stat_num] + 18;
- if ((creature_ptr->stat_max[stat_num] > 18) && (creature_ptr->stat_top[stat_num] <= 18))
- e_adj = creature_ptr->stat_top[stat_num] - (creature_ptr->stat_max[stat_num] - 19) / 10 - 19;
+ if ((player_ptr->stat_max[stat_num] > 18) && (player_ptr->stat_top[stat_num] <= 18))
+ e_adj = player_ptr->stat_top[stat_num] - (player_ptr->stat_max[stat_num] - 19) / 10 - 19;
return e_adj;
}
/*!
* @brief 特殊な種族の時、腕力等の基礎パラメータを変動させる
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param stat_num 能力値番号
* @return 補正後の基礎パラメータ
*/
-static int compensate_special_race(player_type *creature_ptr, int stat_num)
+static int compensate_special_race(PlayerType *player_ptr, int stat_num)
{
- if (!is_specific_player_race(creature_ptr, RACE_ENT))
+ if (!PlayerRace(player_ptr).equals(PlayerRaceType::ENT))
return 0;
int r_adj = 0;
switch (stat_num) {
case A_STR:
case A_CON:
- if (creature_ptr->lev > 25)
+ if (player_ptr->lev > 25)
r_adj++;
- if (creature_ptr->lev > 40)
+ if (player_ptr->lev > 40)
r_adj++;
- if (creature_ptr->lev > 45)
+ if (player_ptr->lev > 45)
r_adj++;
break;
case A_DEX:
- if (creature_ptr->lev > 25)
+ if (player_ptr->lev > 25)
r_adj--;
- if (creature_ptr->lev > 40)
+ if (player_ptr->lev > 40)
r_adj--;
- if (creature_ptr->lev > 45)
+ if (player_ptr->lev > 45)
r_adj--;
break;
}
/*!
* @brief 能力値名を(もし一時的減少なら'x'を付けて)表示する
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param stat_num 能力値番号
* @param row 行数
* @param stat_col 列数
*/
-static void display_basic_stat_name(player_type *creature_ptr, int stat_num, int row, int stat_col)
+static void display_basic_stat_name(PlayerType *player_ptr, int stat_num, int row, int stat_col)
{
- if (creature_ptr->stat_cur[stat_num] < creature_ptr->stat_max[stat_num])
+ if (player_ptr->stat_cur[stat_num] < player_ptr->stat_max[stat_num])
c_put_str(TERM_WHITE, stat_names_reduced[stat_num], row + stat_num + 1, stat_col + 1);
else
c_put_str(TERM_WHITE, stat_names[stat_num], row + stat_num + 1, stat_col + 1);
/*!
* @brief 能力値を、基本・種族補正・職業補正・性格補正・装備補正・合計・現在 (一時的減少のみ) の順で表示する
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param stat_num 能力値番号
* @param r_adj 補正後の基礎パラメータ
* @param e_adj 種族補正値
* @param stat_col 列数
* @param buf 能力値の数値
*/
-static void display_basic_stat_value(player_type *creature_ptr, int stat_num, int r_adj, int e_adj, int row, int stat_col, char *buf)
+static void display_basic_stat_value(PlayerType *player_ptr, int stat_num, int r_adj, int e_adj, int row, int stat_col, char *buf)
{
(void)sprintf(buf, "%3d", r_adj);
c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 13);
(void)sprintf(buf, "%3d", (int)e_adj);
c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 22);
- cnv_stat(creature_ptr->stat_top[stat_num], buf);
+ cnv_stat(player_ptr->stat_top[stat_num], buf);
c_put_str(TERM_L_GREEN, buf, row + stat_num + 1, stat_col + 26);
- if (creature_ptr->stat_use[stat_num] < creature_ptr->stat_top[stat_num]) {
- cnv_stat(creature_ptr->stat_use[stat_num], buf);
+ if (player_ptr->stat_use[stat_num] < player_ptr->stat_top[stat_num]) {
+ cnv_stat(player_ptr->stat_use[stat_num], buf);
c_put_str(TERM_YELLOW, buf, row + stat_num + 1, stat_col + 33);
}
}
/*!
* @brief 能力値を補正しつつ表示する
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param row 行数
* @param stat_col 列数
*/
-static void process_stats(player_type *creature_ptr, int row, int stat_col)
+static void process_stats(PlayerType *player_ptr, int row, int stat_col)
{
char buf[80];
for (int i = 0; i < A_MAX; i++) {
- int r_adj = creature_ptr->mimic_form ? mimic_info[creature_ptr->mimic_form].r_adj[i] : rp_ptr->r_adj[i];
- int e_adj = calc_basic_stat(creature_ptr, i);
- r_adj += compensate_special_race(creature_ptr, i);
+ int r_adj = player_ptr->mimic_form ? mimic_info[player_ptr->mimic_form].r_adj[i] : rp_ptr->r_adj[i];
+ int e_adj = calc_basic_stat(player_ptr, i);
+ r_adj += compensate_special_race(player_ptr, i);
e_adj -= r_adj;
e_adj -= cp_ptr->c_adj[i];
e_adj -= ap_ptr->a_adj[i];
- display_basic_stat_name(creature_ptr, i, row, stat_col);
- cnv_stat(creature_ptr->stat_max[i], buf);
- if (creature_ptr->stat_max[i] == creature_ptr->stat_max_max[i])
+ display_basic_stat_name(player_ptr, i, row, stat_col);
+ cnv_stat(player_ptr->stat_max[i], buf);
+ if (player_ptr->stat_max[i] == player_ptr->stat_max_max[i])
c_put_str(TERM_WHITE, "!", row + i + 1, _(stat_col + 6, stat_col + 4));
c_put_str(TERM_BLUE, buf, row + i + 1, stat_col + 13 - strlen(buf));
- display_basic_stat_value(creature_ptr, i, r_adj, e_adj, row, stat_col, buf);
+ display_basic_stat_value(player_ptr, i, r_adj, e_adj, row, stat_col, buf);
}
}
* @param stat 能力値番号
* @param flags 装備品に立っているフラグ
*/
-static void compensate_stat_by_weapon(char *c, TERM_COLOR *a, object_type *o_ptr, int stat, BIT_FLAGS *flags)
+static void compensate_stat_by_weapon(char *c, TERM_COLOR *a, object_type *o_ptr, tr_type tr_flag, const TrFlags &flags)
{
*c = '*';
*c = '0' + o_ptr->pval;
}
- if (has_flag(flags, stat + TR_SUST_STR)) {
+ if (flags.has(tr_flag)) {
*a = TERM_GREEN;
}
/*!
* @brief 装備品を走査してpval付きのものをそれと分かるように表示する
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param flags 装備品に立っているフラグ
* @param row 行数
* @param col 列数
*/
-static void display_equipments_compensation(player_type *creature_ptr, BIT_FLAGS *flags, int row, int *col)
+static void display_equipments_compensation(PlayerType *player_ptr, int row, int *col)
{
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
- o_ptr = &creature_ptr->inventory_list[i];
- object_flags_known(creature_ptr, o_ptr, flags);
+ o_ptr = &player_ptr->inventory_list[i];
+ auto flags = object_flags_known(o_ptr);
for (int stat = 0; stat < A_MAX; stat++) {
TERM_COLOR a = TERM_SLATE;
char c = '.';
- if (has_flag(flags, stat)) {
- compensate_stat_by_weapon(&c, &a, o_ptr, stat, flags);
- } else if (has_flag(flags, stat + TR_SUST_STR)) {
+ if (flags.has(TR_STATUS_LIST[stat])) {
+ compensate_stat_by_weapon(&c, &a, o_ptr, TR_SUST_STATUS_LIST[stat], flags);
+ } else if (flags.has(TR_SUST_STATUS_LIST[stat])) {
a = TERM_GREEN;
c = 's';
}
/*!
* @brief 各能力値の補正
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param stat 能力値番号
*/
-static int compensation_stat_by_mutation(player_type *creature_ptr, int stat)
+static int compensation_stat_by_mutation(PlayerType *player_ptr, int stat)
{
int compensation = 0;
if (stat == A_STR) {
- if (creature_ptr->muta.has(MUTA::HYPER_STR))
+ if (player_ptr->muta.has(PlayerMutationType::HYPER_STR))
compensation += 4;
- if (creature_ptr->muta.has(MUTA::PUNY))
+ if (player_ptr->muta.has(PlayerMutationType::PUNY))
compensation -= 4;
- if (creature_ptr->tsuyoshi)
+ if (player_ptr->tsuyoshi)
compensation += 4;
return compensation;
}
if (stat == A_WIS || stat == A_INT) {
- if (creature_ptr->muta.has(MUTA::HYPER_INT))
+ if (player_ptr->muta.has(PlayerMutationType::HYPER_INT))
compensation += 4;
- if (creature_ptr->muta.has(MUTA::MORONIC))
+ if (player_ptr->muta.has(PlayerMutationType::MORONIC))
compensation -= 4;
return compensation;
}
if (stat == A_DEX) {
- if (creature_ptr->muta.has(MUTA::IRON_SKIN))
+ if (player_ptr->muta.has(PlayerMutationType::IRON_SKIN))
compensation -= 1;
- if (creature_ptr->muta.has(MUTA::LIMBER))
+ if (player_ptr->muta.has(PlayerMutationType::LIMBER))
compensation += 3;
- if (creature_ptr->muta.has(MUTA::ARTHRITIS))
+ if (player_ptr->muta.has(PlayerMutationType::ARTHRITIS))
compensation -= 3;
return compensation;
}
if (stat == A_CON) {
- if (creature_ptr->muta.has(MUTA::RESILIENT))
+ if (player_ptr->muta.has(PlayerMutationType::RESILIENT))
compensation += 4;
- if (creature_ptr->muta.has(MUTA::XTRA_FAT))
+ if (player_ptr->muta.has(PlayerMutationType::XTRA_FAT))
compensation += 2;
- if (creature_ptr->muta.has(MUTA::ALBINO))
+ if (player_ptr->muta.has(PlayerMutationType::ALBINO))
compensation -= 4;
- if (creature_ptr->muta.has(MUTA::FLESH_ROT))
+ if (player_ptr->muta.has(PlayerMutationType::FLESH_ROT))
compensation -= 2;
- if (creature_ptr->tsuyoshi)
+ if (player_ptr->tsuyoshi)
compensation += 4;
return compensation;
}
if (stat == A_CHR) {
- if (creature_ptr->muta.has(MUTA::SILLY_VOI))
+ if (player_ptr->muta.has(PlayerMutationType::SILLY_VOI))
compensation -= 4;
- if (creature_ptr->muta.has(MUTA::BLANK_FAC))
+ if (player_ptr->muta.has(PlayerMutationType::BLANK_FAC))
compensation -= 1;
- if (creature_ptr->muta.has(MUTA::FLESH_ROT))
+ if (player_ptr->muta.has(PlayerMutationType::FLESH_ROT))
compensation -= 1;
- if (creature_ptr->muta.has(MUTA::SCALES))
+ if (player_ptr->muta.has(PlayerMutationType::SCALES))
compensation -= 1;
- if (creature_ptr->muta.has(MUTA::WART_SKIN))
+ if (player_ptr->muta.has(PlayerMutationType::WART_SKIN))
compensation -= 2;
- if (creature_ptr->muta.has(MUTA::ILL_NORM))
+ if (player_ptr->muta.has(PlayerMutationType::ILL_NORM))
compensation = 0;
return compensation;
}
/*!
* @brief 突然変異 (と、つよしスペシャル)による能力値の補正有無で表示する記号を変える
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param stat 能力値番号
* @param c 補正後の表示記号
* @param a 表示色
*/
-static void change_display_by_mutation(player_type *creature_ptr, int stat, char *c, TERM_COLOR *a)
+static void change_display_by_mutation(PlayerType *player_ptr, int stat, char *c, TERM_COLOR *a)
{
- int compensation = compensation_stat_by_mutation(creature_ptr, stat);
+ int compensation = compensation_stat_by_mutation(player_ptr, stat);
if (compensation == 0)
return;
/*!
* @brief 能力値を走査し、突然変異 (と、つよしスペシャル)で補正をかける必要があればかける
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param stat 能力値番号
+ * @param player_ptr プレイヤーへの参照ポインタ
* @param col 列数
* @param row 行数
*/
-static void display_mutation_compensation(player_type *creature_ptr, BIT_FLAGS *flags, int row, int col)
+static void display_mutation_compensation(PlayerType *player_ptr, int row, int col)
{
+ TrFlags flags;
+ player_flags(player_ptr, flags);
+
for (int stat = 0; stat < A_MAX; stat++) {
byte a = TERM_SLATE;
char c = '.';
- change_display_by_mutation(creature_ptr, stat, &c, &a);
+ change_display_by_mutation(player_ptr, stat, &c, &a);
- if (has_flag(flags, stat + TR_SUST_STR)) {
+ if (flags.has(TR_SUST_STATUS_LIST[stat])) {
a = TERM_GREEN;
c = 's';
}
/*!
* @brief プレイヤーの特性フラグ一覧表示2b /
* Special display, part 2b
- * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param player_ptr プレイヤーへの参照ポインタ
* @details
* <pre>
* How to print out the modifications and sustains.
* No mod, no sustain, will be a slate '.'
* </pre>
*/
-void display_player_stat_info(player_type *creature_ptr)
+void display_player_stat_info(PlayerType *player_ptr)
{
int stat_col = 22;
int row = 3;
c_put_str(TERM_L_BLUE, _(" 種 職 性 装 ", "RacClaPerMod"), row, stat_col + 13);
c_put_str(TERM_L_GREEN, _("合計", "Actual"), row, stat_col + 28);
c_put_str(TERM_YELLOW, _("現在", "Current"), row, stat_col + 35);
- process_stats(creature_ptr, row, stat_col);
+ process_stats(player_ptr, row, stat_col);
int col = stat_col + 41;
c_put_str(TERM_WHITE, "abcdefghijkl@", row, col);
c_put_str(TERM_L_GREEN, _("能力修正", "Modification"), row - 1, col);
- BIT_FLAGS flags[TR_FLAG_SIZE];
- display_equipments_compensation(creature_ptr, flags, row, &col);
- player_flags(creature_ptr, flags);
- display_mutation_compensation(creature_ptr, flags, row, col);
+ display_equipments_compensation(player_ptr, row, &col);
+ display_mutation_compensation(player_ptr, row, col);
}