• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: コミット

変愚蛮怒のメインリポジトリです


コミットメタ情報

リビジョン11eb214d493b3852b58723acaa8844610e66f47b (tree)
日時2020-02-27 22:30:36
作者Hourier <hourier@user...>
コミッターHourier

ログメッセージ

[Refactor] #39962 display-player.c からdisplay-player-stat-info.c/h を分離 / Separated display-player-stat-info.c/h from display-player.c

変更サマリ

差分

--- a/Hengband_vcs2017/Hengband/Hengband.vcxproj
+++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj
@@ -286,6 +286,7 @@
286286 <ClCompile Include="..\..\src\spells3.c" />
287287 <ClCompile Include="..\..\src\uid-checker.c" />
288288 <ClCompile Include="..\..\src\view\display-characteristic.c" />
289+ <ClCompile Include="..\..\src\view\display-player-stat-info.c" />
289290 <ClCompile Include="..\..\src\view\display-player.c" />
290291 <ClCompile Include="..\..\src\view\display-util.c" />
291292 <ClCompile Include="..\..\src\player\process-death.c" />
@@ -338,6 +339,7 @@
338339 <ClInclude Include="..\..\src\signal-handlers.h" />
339340 <ClInclude Include="..\..\src\uid-checker.h" />
340341 <ClInclude Include="..\..\src\view\display-characteristic.h" />
342+ <ClInclude Include="..\..\src\view\display-player-stat-info.h" />
341343 <ClInclude Include="..\..\src\view\display-player.h" />
342344 <ClInclude Include="..\..\src\view\display-util.h" />
343345 <ClInclude Include="..\..\src\player\process-death.h" />
--- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
+++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
@@ -442,6 +442,9 @@
442442 <ClCompile Include="..\..\src\io\gf-descriptions.c">
443443 <Filter>io</Filter>
444444 </ClCompile>
445+ <ClCompile Include="..\..\src\view\display-player-stat-info.c">
446+ <Filter>view</Filter>
447+ </ClCompile>
445448 </ItemGroup>
446449 <ItemGroup>
447450 <ClInclude Include="..\..\src\gamevalue.h" />
@@ -866,6 +869,9 @@
866869 <ClInclude Include="..\..\src\io\gf-descriptions.h">
867870 <Filter>io</Filter>
868871 </ClInclude>
872+ <ClInclude Include="..\..\src\view\display-player-stat-info.h">
873+ <Filter>view</Filter>
874+ </ClInclude>
869875 </ItemGroup>
870876 <ItemGroup>
871877 <None Include="..\..\src\wall.bmp" />
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,6 +14,7 @@ hengband_SOURCES = \
1414 bldg.c bldg.h chest.c chest.h chuukei.c chuukei.h \
1515 \
1616 view/display-characteristic.c view/display-characteristic.h \
17+ view/display-player-stat-info.c view/display-player-stat-info.h \
1718 view/display-player.c view/display-player.h \
1819 view/status-first-page.c view/status-first-page.h \
1920 view/display-util.c view/display-util.h \
--- /dev/null
+++ b/src/view/display-player-stat-info.c
@@ -0,0 +1,374 @@
1+/*!
2+ * @brief プレーヤーの耐性と能力値を表示する
3+ * @date 2020/02/27
4+ * @author Hourier
5+ * @details
6+ * ここにこれ以上関数を引っ越してくるのは禁止。何ならここから更に分割していく
7+ */
8+
9+#include "display-player-stat-info.h"
10+#include "term.h"
11+#include "player-personality.h"
12+#include "player/permanent-resistances.h"
13+
14+/*!
15+ * @brief プレーヤーのパラメータ基礎値 (腕力等)を18以下になるようにして返す
16+ * @param creature_ptr プレーヤーへの参照ポインタ
17+ * @param stat_num 能力値番号
18+ * @return 基礎値
19+ * @details 最大が18になるのはD&D由来
20+ */
21+static int calc_basic_stat(player_type *creature_ptr, int stat_num)
22+{
23+ int e_adj = 0;
24+ if ((creature_ptr->stat_max[stat_num] > 18) && (creature_ptr->stat_top[stat_num] > 18))
25+ e_adj = (creature_ptr->stat_top[stat_num] - creature_ptr->stat_max[stat_num]) / 10;
26+
27+ if ((creature_ptr->stat_max[stat_num] <= 18) && (creature_ptr->stat_top[stat_num] <= 18))
28+ e_adj = creature_ptr->stat_top[stat_num] - creature_ptr->stat_max[stat_num];
29+
30+ if ((creature_ptr->stat_max[stat_num] <= 18) && (creature_ptr->stat_top[stat_num] > 18))
31+ e_adj = (creature_ptr->stat_top[stat_num] - 18) / 10 - creature_ptr->stat_max[stat_num] + 18;
32+
33+ if ((creature_ptr->stat_max[stat_num] > 18) && (creature_ptr->stat_top[stat_num] <= 18))
34+ e_adj = creature_ptr->stat_top[stat_num] - (creature_ptr->stat_max[stat_num] - 19) / 10 - 19;
35+
36+ return e_adj;
37+}
38+
39+
40+/*!
41+ * @brief 特殊な種族の時、腕力等の基礎パラメータを変動させる
42+ * @param creature_ptr プレーヤーへの参照ポインタ
43+ * @param stat_num 能力値番号
44+ * @return 補正後の基礎パラメータ
45+ */
46+static int compensate_special_race(player_type *creature_ptr, int stat_num)
47+{
48+ if (!PRACE_IS_(creature_ptr, RACE_ENT)) return 0;
49+
50+ int r_adj = 0;
51+ switch (stat_num)
52+ {
53+ case A_STR:
54+ case A_CON:
55+ if (creature_ptr->lev > 25) r_adj++;
56+ if (creature_ptr->lev > 40) r_adj++;
57+ if (creature_ptr->lev > 45) r_adj++;
58+ break;
59+ case A_DEX:
60+ if (creature_ptr->lev > 25) r_adj--;
61+ if (creature_ptr->lev > 40) r_adj--;
62+ if (creature_ptr->lev > 45) r_adj--;
63+ break;
64+ }
65+
66+ return r_adj;
67+}
68+
69+
70+/*!
71+ * @brief 能力値名を(もし一時的減少なら'x'を付けて)表示する
72+ * @param creature_ptr プレーヤーへの参照ポインタ
73+ * @param stat_num 能力値番号
74+ * @param row 行数
75+ * @param stat_col 列数
76+ * @return なし
77+ */
78+static void display_basic_stat_name(player_type *creature_ptr, int stat_num, int row, int stat_col)
79+{
80+ if (creature_ptr->stat_cur[stat_num] < creature_ptr->stat_max[stat_num])
81+ c_put_str(TERM_WHITE, stat_names_reduced[stat_num], row + stat_num + 1, stat_col + 1);
82+ else
83+ c_put_str(TERM_WHITE, stat_names[stat_num], row + stat_num + 1, stat_col + 1);
84+}
85+
86+
87+/*!
88+ * @brief 能力値を、基本・種族補正・職業補正・性格補正・装備補正・合計・現在 (一時的減少のみ) の順で表示する
89+ * @param creature_ptr プレーヤーへの参照ポインタ
90+ * @param stat_num 能力値番号
91+ * @param r_adj 補正後の基礎パラメータ
92+ * @param e_adj 種族補正値
93+ * @param row 行数
94+ * @param stat_col 列数
95+ * @param buf 能力値の数値
96+ * @return なし
97+ */
98+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)
99+{
100+ (void)sprintf(buf, "%3d", r_adj);
101+ c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 13);
102+
103+ (void)sprintf(buf, "%3d", (int)cp_ptr->c_adj[stat_num]);
104+ c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 16);
105+
106+ (void)sprintf(buf, "%3d", (int)ap_ptr->a_adj[stat_num]);
107+ c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 19);
108+
109+ (void)sprintf(buf, "%3d", (int)e_adj);
110+ c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 22);
111+
112+ cnv_stat(creature_ptr->stat_top[stat_num], buf);
113+ c_put_str(TERM_L_GREEN, buf, row + stat_num + 1, stat_col + 26);
114+
115+ if (creature_ptr->stat_use[stat_num] < creature_ptr->stat_top[stat_num])
116+ {
117+ cnv_stat(creature_ptr->stat_use[stat_num], buf);
118+ c_put_str(TERM_YELLOW, buf, row + stat_num + 1, stat_col + 33);
119+ }
120+}
121+
122+
123+/*!
124+ * @brief 能力値を補正しつつ表示する
125+ * @param creature_ptr プレーヤーへの参照ポインタ
126+ * @param row 行数
127+ * @param stat_col 列数
128+ * @return なし
129+ */
130+static void process_stats(player_type *creature_ptr, int row, int stat_col)
131+{
132+ char buf[80];
133+ for (int i = 0; i < A_MAX; i++)
134+ {
135+ int r_adj = creature_ptr->mimic_form
136+ ? mimic_info[creature_ptr->mimic_form].r_adj[i]
137+ : rp_ptr->r_adj[i];
138+ int e_adj = calc_basic_stat(creature_ptr, i);
139+ r_adj += compensate_special_race(creature_ptr, i);
140+ e_adj -= r_adj;
141+ e_adj -= cp_ptr->c_adj[i];
142+ e_adj -= ap_ptr->a_adj[i];
143+
144+ display_basic_stat_name(creature_ptr, i, row, stat_col);
145+ cnv_stat(creature_ptr->stat_max[i], buf);
146+ if (creature_ptr->stat_max[i] == creature_ptr->stat_max_max[i])
147+ c_put_str(TERM_WHITE, "!", row + i + 1, _(stat_col + 6, stat_col + 4));
148+
149+ c_put_str(TERM_BLUE, buf, row + i + 1, stat_col + 13 - strlen(buf));
150+
151+ display_basic_stat_value(creature_ptr, i, r_adj, e_adj, row, stat_col, buf);
152+ }
153+}
154+
155+
156+/*!
157+ * @brief pval付きの装備に依るステータス補正を表示する
158+ * @param c 補正後の表示記号
159+ * @param a 表示色
160+ * @param o_ptr 装備品への参照ポインタ
161+ * @param stat 能力値番号
162+ * @param flags 装備品に立っているフラグ
163+ * @return なし
164+ */
165+static void compensate_stat_by_weapon(char *c, TERM_COLOR *a, object_type *o_ptr, int stat, BIT_FLAGS *flags)
166+{
167+ *c = '*';
168+
169+ if (o_ptr->pval > 0)
170+ {
171+ *a = TERM_L_GREEN;
172+ if (o_ptr->pval < 10) *c = '0' + o_ptr->pval;
173+ }
174+
175+ if (have_flag(flags, stat + TR_SUST_STR))
176+ {
177+ *a = TERM_GREEN;
178+ }
179+
180+ if (o_ptr->pval < 0)
181+ {
182+ *a = TERM_RED;
183+ if (o_ptr->pval > -10) *c = '0' - o_ptr->pval;
184+ }
185+}
186+
187+
188+/*!
189+ * @brief 装備品を走査してpval付きのものをそれと分かるように表示する
190+ * @param creature_ptr プレーヤーへの参照ポインタ
191+ * @param flags 装備品に立っているフラグ
192+ * @param row 行数
193+ * @param col 列数
194+ * @return なし
195+ */
196+static void display_equipments_compensation(player_type *creature_ptr, BIT_FLAGS *flags, int row, int *col)
197+{
198+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
199+ {
200+ object_type *o_ptr;
201+ o_ptr = &creature_ptr->inventory_list[i];
202+ object_flags_known(o_ptr, flags);
203+ for (int stat = 0; stat < A_MAX; stat++)
204+ {
205+ TERM_COLOR a = TERM_SLATE;
206+ char c = '.';
207+ if (have_flag(flags, stat))
208+ {
209+ compensate_stat_by_weapon(&c, &a, o_ptr, stat, flags);
210+ }
211+ else if (have_flag(flags, stat + TR_SUST_STR))
212+ {
213+ a = TERM_GREEN;
214+ c = 's';
215+ }
216+
217+ Term_putch(*col, row + stat + 1, a, c);
218+ }
219+
220+ (*col)++;
221+ }
222+}
223+
224+
225+/*!
226+ * @brief 各能力値の補正
227+ * @param creature_ptr プレーヤーへの参照ポインタ
228+ * @param stat 能力値番号
229+ * @return なし
230+ */
231+static int compensation_stat_by_mutation(player_type *creature_ptr, int stat)
232+{
233+ int compensation = 0;
234+ if (stat == A_STR)
235+ {
236+ if (creature_ptr->muta3 & MUT3_HYPER_STR) compensation += 4;
237+ if (creature_ptr->muta3 & MUT3_PUNY) compensation -= 4;
238+ if (creature_ptr->tsuyoshi) compensation += 4;
239+ return compensation;
240+ }
241+
242+ if (stat == A_WIS || stat == A_INT)
243+ {
244+ if (creature_ptr->muta3 & MUT3_HYPER_INT) compensation += 4;
245+ if (creature_ptr->muta3 & MUT3_MORONIC) compensation -= 4;
246+ return compensation;
247+ }
248+
249+ if (stat == A_DEX)
250+ {
251+ if (creature_ptr->muta3 & MUT3_IRON_SKIN) compensation -= 1;
252+ if (creature_ptr->muta3 & MUT3_LIMBER) compensation += 3;
253+ if (creature_ptr->muta3 & MUT3_ARTHRITIS) compensation -= 3;
254+ return compensation;
255+ }
256+
257+ if (stat == A_CON)
258+ {
259+ if (creature_ptr->muta3 & MUT3_RESILIENT) compensation += 4;
260+ if (creature_ptr->muta3 & MUT3_XTRA_FAT) compensation += 2;
261+ if (creature_ptr->muta3 & MUT3_ALBINO) compensation -= 4;
262+ if (creature_ptr->muta3 & MUT3_FLESH_ROT) compensation -= 2;
263+ if (creature_ptr->tsuyoshi) compensation += 4;
264+ return compensation;
265+ }
266+
267+ if (stat == A_CHR)
268+ {
269+ if (creature_ptr->muta3 & MUT3_SILLY_VOI) compensation -= 4;
270+ if (creature_ptr->muta3 & MUT3_BLANK_FAC) compensation -= 1;
271+ if (creature_ptr->muta3 & MUT3_FLESH_ROT) compensation -= 1;
272+ if (creature_ptr->muta3 & MUT3_SCALES) compensation -= 1;
273+ if (creature_ptr->muta3 & MUT3_WART_SKIN) compensation -= 2;
274+ if (creature_ptr->muta3 & MUT3_ILL_NORM) compensation = 0;
275+ return compensation;
276+ }
277+
278+ return 0;
279+}
280+
281+
282+/*!
283+ * @brief 突然変異 (と、つよしスペシャル)による能力値の補正有無で表示する記号を変える
284+ * @param creature_ptr プレーヤーへの参照ポインタ
285+ * @param stat 能力値番号
286+ * @param c 補正後の表示記号
287+ * @param a 表示色
288+ * @return なし
289+ */
290+static void change_display_by_mutation(player_type *creature_ptr, int stat, char *c, TERM_COLOR *a)
291+{
292+ if ((creature_ptr->muta3 != 0) && !creature_ptr->tsuyoshi) return;
293+
294+ int compensation = compensation_stat_by_mutation(creature_ptr, stat);
295+ if (compensation == 0) return;
296+
297+ *c = '*';
298+ if (compensation > 0)
299+ {
300+ *a = TERM_L_GREEN;
301+ if (compensation < 10) *c = '0' + compensation;
302+ }
303+
304+ if (compensation < 0)
305+ {
306+ *a = TERM_RED;
307+ if (compensation > -10) *c = '0' - compensation;
308+ }
309+}
310+
311+
312+/*!
313+ * @brief 能力値を走査し、突然変異 (と、つよしスペシャル)で補正をかける必要があればかける
314+ * @param creature_ptr プレーヤーへの参照ポインタ
315+ * @param stat 能力値番号
316+ * @param col 列数
317+ * @param row 行数
318+ * @return なし
319+ */
320+static void display_mutation_compensation(player_type *creature_ptr, BIT_FLAGS *flags, int row, int col)
321+{
322+ for (int stat = 0; stat < A_MAX; stat++)
323+ {
324+ byte a = TERM_SLATE;
325+ char c = '.';
326+ change_display_by_mutation(creature_ptr, stat, &c, &a);
327+
328+ if (have_flag(flags, stat + TR_SUST_STR))
329+ {
330+ a = TERM_GREEN;
331+ c = 's';
332+ }
333+
334+ Term_putch(col, row + stat + 1, a, c);
335+ }
336+}
337+
338+
339+/*!
340+ * @brief プレイヤーの特性フラグ一覧表示2b /
341+ * Special display, part 2b
342+ * @param creature_ptr プレーヤーへの参照ポインタ
343+ * @return なし
344+ * @details
345+ * <pre>
346+ * How to print out the modifications and sustains.
347+ * Positive mods with no sustain will be light green.
348+ * Positive mods with a sustain will be dark green.
349+ * Sustains (with no modification) will be a dark green 's'.
350+ * Negative mods (from a curse) will be red.
351+ * Huge mods (>9), like from MICoMorgoth, will be a '*'
352+ * No mod, no sustain, will be a slate '.'
353+ * </pre>
354+ */
355+void display_player_stat_info(player_type *creature_ptr)
356+{
357+ int stat_col = 22;
358+ int row = 3;
359+ c_put_str(TERM_WHITE, _("能力", "Stat"), row, stat_col + 1);
360+ c_put_str(TERM_BLUE, _(" 基本", " Base"), row, stat_col + 7);
361+ c_put_str(TERM_L_BLUE, _(" 種 職 性 装 ", "RacClaPerMod"), row, stat_col + 13);
362+ c_put_str(TERM_L_GREEN, _("合計", "Actual"), row, stat_col + 28);
363+ c_put_str(TERM_YELLOW, _("現在", "Current"), row, stat_col + 35);
364+ process_stats(creature_ptr, row, stat_col);
365+
366+ int col = stat_col + 41;
367+ c_put_str(TERM_WHITE, "abcdefghijkl@", row, col);
368+ c_put_str(TERM_L_GREEN, _("能力修正", "Modification"), row - 1, col);
369+
370+ BIT_FLAGS flags[TR_FLAG_SIZE];
371+ display_equipments_compensation(creature_ptr,flags, row, &col);
372+ player_flags(creature_ptr, flags);
373+ display_mutation_compensation(creature_ptr, flags, row, col);
374+}
--- /dev/null
+++ b/src/view/display-player-stat-info.h
@@ -0,0 +1,5 @@
1+#pragma once
2+
3+#include "angband.h"
4+
5+void display_player_stat_info(player_type *creature_ptr);
--- a/src/view/display-player.c
+++ b/src/view/display-player.c
@@ -15,7 +15,6 @@
1515 #include "world.h"
1616 #include "quest.h"
1717 #include "core.h" // 暫定。後で消す
18-#include "player/permanent-resistances.h" // 暫定。後で消す
1918 #include "mutation.h"
2019 #include "player-skill.h"
2120 #include "player-effects.h"
@@ -26,6 +25,7 @@
2625 #include "objectkind.h"
2726 #include "view/display-util.h"
2827 #include "view/display-characteristic.h"
28+#include "view/display-player-stat-info.h"
2929
3030 /*!
3131 * @brief プレイヤーの特性フラグ一覧表示2a /
@@ -35,17 +35,10 @@
3535 */
3636 static void display_player_misc_info(player_type *creature_ptr)
3737 {
38-#ifdef JP
39- put_str("名前 :", 1, 26);
40- put_str("性別 :", 3, 1);
41- put_str("種族 :", 4, 1);
42- put_str("職業 :", 5, 1);
43-#else
44- put_str("Name :", 1, 26);
45- put_str("Sex :", 3, 1);
46- put_str("Race :", 4, 1);
47- put_str("Class :", 5, 1);
48-#endif
38+ put_str(_("名前 :", "Name :"), 1, 26);
39+ put_str(_("性別 :", "Sex :"), 3, 1);
40+ put_str(_("種族 :", "Race :"), 4, 1);
41+ put_str(_("職業 :", "Class :"), 5, 1);
4942
5043 char buf[80];
5144 char tmp[80];
@@ -63,15 +56,9 @@ static void display_player_misc_info(player_type *creature_ptr)
6356 c_put_str(TERM_L_BLUE, (creature_ptr->mimic_form ? mimic_info[creature_ptr->mimic_form].title : rp_ptr->title), 4, 9);
6457 c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 9);
6558
66-#ifdef JP
67- put_str("レベル:", 6, 1);
68- put_str("HP :", 7, 1);
69- put_str("MP :", 8, 1);
70-#else
71- put_str("Level :", 6, 1);
72- put_str("Hits :", 7, 1);
73- put_str("Mana :", 8, 1);
74-#endif
59+ put_str(_("レベル:", "Level :"), 6, 1);
60+ put_str(_("HP :", "Hits :"), 7, 1);
61+ put_str(_("MP :", "Mana :"), 8, 1);
7562
7663 (void)sprintf(buf, "%d", (int)creature_ptr->lev);
7764 c_put_str(TERM_L_BLUE, buf, 6, 9);
@@ -83,369 +70,6 @@ static void display_player_misc_info(player_type *creature_ptr)
8370
8471
8572 /*!
86- * @brief プレーヤーのパラメータ基礎値 (腕力等)を18以下になるようにして返す
87- * @param creature_ptr プレーヤーへの参照ポインタ
88- * @param stat_num 能力値番号
89- * @return 基礎値
90- * @details 最大が18になるのはD&D由来
91- */
92-static int calc_basic_stat(player_type *creature_ptr, int stat_num)
93-{
94- int e_adj = 0;
95- if ((creature_ptr->stat_max[stat_num] > 18) && (creature_ptr->stat_top[stat_num] > 18))
96- e_adj = (creature_ptr->stat_top[stat_num] - creature_ptr->stat_max[stat_num]) / 10;
97-
98- if ((creature_ptr->stat_max[stat_num] <= 18) && (creature_ptr->stat_top[stat_num] <= 18))
99- e_adj = creature_ptr->stat_top[stat_num] - creature_ptr->stat_max[stat_num];
100-
101- if ((creature_ptr->stat_max[stat_num] <= 18) && (creature_ptr->stat_top[stat_num] > 18))
102- e_adj = (creature_ptr->stat_top[stat_num] - 18) / 10 - creature_ptr->stat_max[stat_num] + 18;
103-
104- if ((creature_ptr->stat_max[stat_num] > 18) && (creature_ptr->stat_top[stat_num] <= 18))
105- e_adj = creature_ptr->stat_top[stat_num] - (creature_ptr->stat_max[stat_num] - 19) / 10 - 19;
106-
107- return e_adj;
108-}
109-
110-
111-/*!
112- * @brief 特殊な種族の時、腕力等の基礎パラメータを変動させる
113- * @param creature_ptr プレーヤーへの参照ポインタ
114- * @param stat_num 能力値番号
115- * @return 補正後の基礎パラメータ
116- */
117-static int compensate_special_race(player_type *creature_ptr, int stat_num)
118-{
119- if (!PRACE_IS_(creature_ptr, RACE_ENT)) return 0;
120-
121- int r_adj = 0;
122- switch (stat_num)
123- {
124- case A_STR:
125- case A_CON:
126- if (creature_ptr->lev > 25) r_adj++;
127- if (creature_ptr->lev > 40) r_adj++;
128- if (creature_ptr->lev > 45) r_adj++;
129- break;
130- case A_DEX:
131- if (creature_ptr->lev > 25) r_adj--;
132- if (creature_ptr->lev > 40) r_adj--;
133- if (creature_ptr->lev > 45) r_adj--;
134- break;
135- }
136-
137- return r_adj;
138-}
139-
140-
141-/*!
142- * @brief 能力値名を(もし一時的減少なら'x'を付けて)表示する
143- * @param creature_ptr プレーヤーへの参照ポインタ
144- * @param stat_num 能力値番号
145- * @param row 行数
146- * @param stat_col 列数
147- * @return なし
148- */
149-static void display_basic_stat_name(player_type *creature_ptr, int stat_num, int row, int stat_col)
150-{
151- if (creature_ptr->stat_cur[stat_num] < creature_ptr->stat_max[stat_num])
152- c_put_str(TERM_WHITE, stat_names_reduced[stat_num], row + stat_num + 1, stat_col + 1);
153- else
154- c_put_str(TERM_WHITE, stat_names[stat_num], row + stat_num + 1, stat_col + 1);
155-}
156-
157-
158-/*!
159- * @brief 能力値を、基本・種族補正・職業補正・性格補正・装備補正・合計・現在 (一時的減少のみ) の順で表示する
160- * @param creature_ptr プレーヤーへの参照ポインタ
161- * @param stat_num 能力値番号
162- * @param r_adj 補正後の基礎パラメータ
163- * @param e_adj 種族補正値
164- * @param row 行数
165- * @param stat_col 列数
166- * @param buf 能力値の数値
167- * @return なし
168- */
169-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)
170-{
171- (void)sprintf(buf, "%3d", r_adj);
172- c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 13);
173-
174- (void)sprintf(buf, "%3d", (int)cp_ptr->c_adj[stat_num]);
175- c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 16);
176-
177- (void)sprintf(buf, "%3d", (int)ap_ptr->a_adj[stat_num]);
178- c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 19);
179-
180- (void)sprintf(buf, "%3d", (int)e_adj);
181- c_put_str(TERM_L_BLUE, buf, row + stat_num + 1, stat_col + 22);
182-
183- cnv_stat(creature_ptr->stat_top[stat_num], buf);
184- c_put_str(TERM_L_GREEN, buf, row + stat_num + 1, stat_col + 26);
185-
186- if (creature_ptr->stat_use[stat_num] < creature_ptr->stat_top[stat_num])
187- {
188- cnv_stat(creature_ptr->stat_use[stat_num], buf);
189- c_put_str(TERM_YELLOW, buf, row + stat_num + 1, stat_col + 33);
190- }
191-}
192-
193-
194-/*!
195- * @brief 能力値を補正しつつ表示する
196- * @param creature_ptr プレーヤーへの参照ポインタ
197- * @param row 行数
198- * @param stat_col 列数
199- * @return なし
200- */
201-static void process_stats(player_type *creature_ptr, int row, int stat_col)
202-{
203- char buf[80];
204- for (int i = 0; i < A_MAX; i++)
205- {
206- int r_adj = creature_ptr->mimic_form
207- ? mimic_info[creature_ptr->mimic_form].r_adj[i]
208- : rp_ptr->r_adj[i];
209- int e_adj = calc_basic_stat(creature_ptr, i);
210- r_adj += compensate_special_race(creature_ptr, i);
211- e_adj -= r_adj;
212- e_adj -= cp_ptr->c_adj[i];
213- e_adj -= ap_ptr->a_adj[i];
214-
215- display_basic_stat_name(creature_ptr, i, row, stat_col);
216- cnv_stat(creature_ptr->stat_max[i], buf);
217- if (creature_ptr->stat_max[i] == creature_ptr->stat_max_max[i])
218- c_put_str(TERM_WHITE, "!", row + i + 1, _(stat_col + 6, stat_col + 4));
219-
220- c_put_str(TERM_BLUE, buf, row + i + 1, stat_col + 13 - strlen(buf));
221-
222- display_basic_stat_value(creature_ptr, i, r_adj, e_adj, row, stat_col, buf);
223- }
224-}
225-
226-
227-/*!
228- * @brief pval付きの装備に依るステータス補正を表示する
229- * @param c 補正後の表示記号
230- * @param a 表示色
231- * @param o_ptr 装備品への参照ポインタ
232- * @param stat 能力値番号
233- * @param flags 装備品に立っているフラグ
234- * @return なし
235- */
236-static void compensate_stat_by_weapon(char *c, TERM_COLOR *a, object_type *o_ptr, int stat, BIT_FLAGS *flags)
237-{
238- *c = '*';
239-
240- if (o_ptr->pval > 0)
241- {
242- *a = TERM_L_GREEN;
243- if (o_ptr->pval < 10) *c = '0' + o_ptr->pval;
244- }
245-
246- if (have_flag(flags, stat + TR_SUST_STR))
247- {
248- *a = TERM_GREEN;
249- }
250-
251- if (o_ptr->pval < 0)
252- {
253- *a = TERM_RED;
254- if (o_ptr->pval > -10) *c = '0' - o_ptr->pval;
255- }
256-}
257-
258-
259-/*!
260- * @brief 装備品を走査してpval付きのものをそれと分かるように表示する
261- * @param creature_ptr プレーヤーへの参照ポインタ
262- * @param flags 装備品に立っているフラグ
263- * @param row 行数
264- * @param col 列数
265- * @return なし
266- */
267-static void display_equipments_compensation(player_type *creature_ptr, BIT_FLAGS *flags, int row, int *col)
268-{
269- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
270- {
271- object_type *o_ptr;
272- o_ptr = &creature_ptr->inventory_list[i];
273- object_flags_known(o_ptr, flags);
274- for (int stat = 0; stat < A_MAX; stat++)
275- {
276- TERM_COLOR a = TERM_SLATE;
277- char c = '.';
278- if (have_flag(flags, stat))
279- {
280- compensate_stat_by_weapon(&c, &a, o_ptr, stat, flags);
281- }
282- else if (have_flag(flags, stat + TR_SUST_STR))
283- {
284- a = TERM_GREEN;
285- c = 's';
286- }
287-
288- Term_putch(*col, row + stat + 1, a, c);
289- }
290-
291- (*col)++;
292- }
293-}
294-
295-
296-/*!
297- * @brief 各能力値の補正
298- * @param creature_ptr プレーヤーへの参照ポインタ
299- * @param stat 能力値番号
300- * @return なし
301- */
302-static int compensation_stat_by_mutation(player_type *creature_ptr, int stat)
303-{
304- int compensation = 0;
305- if (stat == A_STR)
306- {
307- if (creature_ptr->muta3 & MUT3_HYPER_STR) compensation += 4;
308- if (creature_ptr->muta3 & MUT3_PUNY) compensation -= 4;
309- if (creature_ptr->tsuyoshi) compensation += 4;
310- return compensation;
311- }
312-
313- if (stat == A_WIS || stat == A_INT)
314- {
315- if (creature_ptr->muta3 & MUT3_HYPER_INT) compensation += 4;
316- if (creature_ptr->muta3 & MUT3_MORONIC) compensation -= 4;
317- return compensation;
318- }
319-
320- if (stat == A_DEX)
321- {
322- if (creature_ptr->muta3 & MUT3_IRON_SKIN) compensation -= 1;
323- if (creature_ptr->muta3 & MUT3_LIMBER) compensation += 3;
324- if (creature_ptr->muta3 & MUT3_ARTHRITIS) compensation -= 3;
325- return compensation;
326- }
327-
328- if (stat == A_CON)
329- {
330- if (creature_ptr->muta3 & MUT3_RESILIENT) compensation += 4;
331- if (creature_ptr->muta3 & MUT3_XTRA_FAT) compensation += 2;
332- if (creature_ptr->muta3 & MUT3_ALBINO) compensation -= 4;
333- if (creature_ptr->muta3 & MUT3_FLESH_ROT) compensation -= 2;
334- if (creature_ptr->tsuyoshi) compensation += 4;
335- return compensation;
336- }
337-
338- if (stat == A_CHR)
339- {
340- if (creature_ptr->muta3 & MUT3_SILLY_VOI) compensation -= 4;
341- if (creature_ptr->muta3 & MUT3_BLANK_FAC) compensation -= 1;
342- if (creature_ptr->muta3 & MUT3_FLESH_ROT) compensation -= 1;
343- if (creature_ptr->muta3 & MUT3_SCALES) compensation -= 1;
344- if (creature_ptr->muta3 & MUT3_WART_SKIN) compensation -= 2;
345- if (creature_ptr->muta3 & MUT3_ILL_NORM) compensation = 0;
346- return compensation;
347- }
348-
349- return 0;
350-}
351-
352-
353-/*!
354- * @brief 突然変異 (と、つよしスペシャル)による能力値の補正有無で表示する記号を変える
355- * @param creature_ptr プレーヤーへの参照ポインタ
356- * @param stat 能力値番号
357- * @param c 補正後の表示記号
358- * @param a 表示色
359- * @return なし
360- */
361-static void change_display_by_mutation(player_type *creature_ptr, int stat, char *c, TERM_COLOR *a)
362-{
363- if ((creature_ptr->muta3 != 0) && !creature_ptr->tsuyoshi) return;
364-
365- int compensation = compensation_stat_by_mutation(creature_ptr, stat);
366- if (compensation == 0) return;
367-
368- *c = '*';
369- if (compensation > 0)
370- {
371- *a = TERM_L_GREEN;
372- if (compensation < 10) *c = '0' + compensation;
373- }
374-
375- if (compensation < 0)
376- {
377- *a = TERM_RED;
378- if (compensation > -10) *c = '0' - compensation;
379- }
380-}
381-
382-
383-/*!
384- * @brief 能力値を走査し、突然変異 (と、つよしスペシャル)で補正をかける必要があればかける
385- * @param creature_ptr プレーヤーへの参照ポインタ
386- * @param stat 能力値番号
387- * @param col 列数
388- * @param row 行数
389- * @return なし
390- */
391-static void display_mutation_compensation(player_type *creature_ptr, BIT_FLAGS *flags, int row, int col)
392-{
393- for (int stat = 0; stat < A_MAX; stat++)
394- {
395- byte a = TERM_SLATE;
396- char c = '.';
397- change_display_by_mutation(creature_ptr, stat, &c, &a);
398-
399- if (have_flag(flags, stat + TR_SUST_STR))
400- {
401- a = TERM_GREEN;
402- c = 's';
403- }
404-
405- Term_putch(col, row + stat + 1, a, c);
406- }
407-}
408-
409-
410-/*!
411- * @brief プレイヤーの特性フラグ一覧表示2b /
412- * Special display, part 2b
413- * @param creature_ptr プレーヤーへの参照ポインタ
414- * @return なし
415- * @details
416- * <pre>
417- * How to print out the modifications and sustains.
418- * Positive mods with no sustain will be light green.
419- * Positive mods with a sustain will be dark green.
420- * Sustains (with no modification) will be a dark green 's'.
421- * Negative mods (from a curse) will be red.
422- * Huge mods (>9), like from MICoMorgoth, will be a '*'
423- * No mod, no sustain, will be a slate '.'
424- * </pre>
425- */
426-static void display_player_stat_info(player_type *creature_ptr)
427-{
428- int stat_col = 22;
429- int row = 3;
430- c_put_str(TERM_WHITE, _("能力", "Stat"), row, stat_col + 1);
431- c_put_str(TERM_BLUE, _(" 基本", " Base"), row, stat_col + 7);
432- c_put_str(TERM_L_BLUE, _(" 種 職 性 装 ", "RacClaPerMod"), row, stat_col + 13);
433- c_put_str(TERM_L_GREEN, _("合計", "Actual"), row, stat_col + 28);
434- c_put_str(TERM_YELLOW, _("現在", "Current"), row, stat_col + 35);
435- process_stats(creature_ptr, row, stat_col);
436-
437- int col = stat_col + 41;
438- c_put_str(TERM_WHITE, "abcdefghijkl@", row, col);
439- c_put_str(TERM_L_GREEN, _("能力修正", "Modification"), row - 1, col);
440-
441- BIT_FLAGS flags[TR_FLAG_SIZE];
442- display_equipments_compensation(creature_ptr,flags, row, &col);
443- player_flags(creature_ptr, flags);
444- display_mutation_compensation(creature_ptr, flags, row, col);
445-}
446-
447-
448-/*!
44973 * @brief プレイヤーの打撃能力修正を表示する
45074 * @param creature_ptr プレーヤーへの参照ポインタ
45175 * @param hand 武器の装備部位ID
旧リポジトリブラウザで表示