変愚蛮怒のメインリポジトリです
Revision | e2ab1c33527a2f0e7d57e5b7edb2d92d74190ff9 (tree) |
---|---|
Zeit | 2019-04-01 23:40:54 |
Autor | deskull <deskull@user...> |
Commiter | deskull |
[Refactor] #37353 cnv_stat() と modify_stat_value() を player-status.c/h へ移動。
@@ -1038,8 +1038,6 @@ extern int inkey_special(bool numpad_cursor); | ||
1038 | 1038 | |
1039 | 1039 | |
1040 | 1040 | /* xtra1.c */ |
1041 | -extern void cnv_stat(int val, char *out_val); | |
1042 | -extern s16b modify_stat_value(int value, int amount); | |
1043 | 1041 | extern void prt_time(void); |
1044 | 1042 | extern concptr map_name(void); |
1045 | 1043 | extern int bow_tval_ammo(object_type *o_ptr); |
@@ -4513,3 +4513,90 @@ void check_experience(void) | ||
4513 | 4513 | if (old_lev != p_ptr->lev) autopick_load_pref(FALSE); |
4514 | 4514 | } |
4515 | 4515 | |
4516 | +/*! | |
4517 | + * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string | |
4518 | + * @param val 能力値 | |
4519 | + * @param out_val 出力先文字列ポインタ | |
4520 | + * @return なし | |
4521 | + */ | |
4522 | +void cnv_stat(int val, char *out_val) | |
4523 | +{ | |
4524 | + /* Above 18 */ | |
4525 | + if (val > 18) | |
4526 | + { | |
4527 | + int bonus = (val - 18); | |
4528 | + | |
4529 | + if (bonus >= 220) | |
4530 | + { | |
4531 | + sprintf(out_val, "18/%3s", "***"); | |
4532 | + } | |
4533 | + else if (bonus >= 100) | |
4534 | + { | |
4535 | + sprintf(out_val, "18/%03d", bonus); | |
4536 | + } | |
4537 | + else | |
4538 | + { | |
4539 | + sprintf(out_val, " 18/%02d", bonus); | |
4540 | + } | |
4541 | + } | |
4542 | + | |
4543 | + /* From 3 to 18 */ | |
4544 | + else | |
4545 | + { | |
4546 | + sprintf(out_val, " %2d", val); | |
4547 | + } | |
4548 | +} | |
4549 | + | |
4550 | +/*! | |
4551 | + * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。 | |
4552 | + * Modify a stat value by a "modifier", return new value | |
4553 | + * @param value 現在値 | |
4554 | + * @param amount 加減算値 | |
4555 | + * @return 加減算後の値 | |
4556 | + * @details | |
4557 | + * <pre> | |
4558 | + * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220 | |
4559 | + * Or even: 18/13, 18/23, 18/33, ..., 18/220 | |
4560 | + * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3 | |
4561 | + * Or even: 18/13, 18/03, 18, 17, ..., 3 | |
4562 | + * </pre> | |
4563 | + */ | |
4564 | +s16b modify_stat_value(int value, int amount) | |
4565 | +{ | |
4566 | + int i; | |
4567 | + | |
4568 | + /* Reward */ | |
4569 | + if (amount > 0) | |
4570 | + { | |
4571 | + /* Apply each point */ | |
4572 | + for (i = 0; i < amount; i++) | |
4573 | + { | |
4574 | + /* One point at a time */ | |
4575 | + if (value < 18) value++; | |
4576 | + | |
4577 | + /* Ten "points" at a time */ | |
4578 | + else value += 10; | |
4579 | + } | |
4580 | + } | |
4581 | + | |
4582 | + /* Penalty */ | |
4583 | + else if (amount < 0) | |
4584 | + { | |
4585 | + /* Apply each point */ | |
4586 | + for (i = 0; i < (0 - amount); i++) | |
4587 | + { | |
4588 | + /* Ten points at a time */ | |
4589 | + if (value >= 18 + 10) value -= 10; | |
4590 | + | |
4591 | + /* Hack -- prevent weirdness */ | |
4592 | + else if (value > 18) value = 18; | |
4593 | + | |
4594 | + /* One point at a time */ | |
4595 | + else if (value > 3) value--; | |
4596 | + } | |
4597 | + } | |
4598 | + | |
4599 | + /* Return new value */ | |
4600 | + return (s16b)(value); | |
4601 | +} | |
4602 | + |
@@ -20,9 +20,9 @@ extern bool player_place(POSITION y, POSITION x); | ||
20 | 20 | extern void sanity_blast(monster_type *m_ptr, bool necro); |
21 | 21 | |
22 | 22 | extern void check_experience(void); |
23 | - | |
24 | - | |
25 | 23 | extern void wreck_the_pattern(void); |
24 | +extern void cnv_stat(int val, char *out_val); | |
25 | +extern s16b modify_stat_value(int value, int amount); | |
26 | 26 | |
27 | 27 | /* Temporary flags macro */ |
28 | 28 | #define IS_FAST() (p_ptr->fast || music_singing(MUSIC_SPEED) || music_singing(MUSIC_SHERO)) |
@@ -99,92 +99,6 @@ | ||
99 | 99 | #define ROW_STATBAR (-1) |
100 | 100 | #define COL_STATBAR 0 |
101 | 101 | #define MAX_COL_STATBAR (-26) |
102 | -/*! | |
103 | - * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string | |
104 | - * @param val 能力値 | |
105 | - * @param out_val 出力先文字列ポインタ | |
106 | - * @return なし | |
107 | - */ | |
108 | -void cnv_stat(int val, char *out_val) | |
109 | -{ | |
110 | - /* Above 18 */ | |
111 | - if (val > 18) | |
112 | - { | |
113 | - int bonus = (val - 18); | |
114 | - | |
115 | - if (bonus >= 220) | |
116 | - { | |
117 | - sprintf(out_val, "18/%3s", "***"); | |
118 | - } | |
119 | - else if (bonus >= 100) | |
120 | - { | |
121 | - sprintf(out_val, "18/%03d", bonus); | |
122 | - } | |
123 | - else | |
124 | - { | |
125 | - sprintf(out_val, " 18/%02d", bonus); | |
126 | - } | |
127 | - } | |
128 | - | |
129 | - /* From 3 to 18 */ | |
130 | - else | |
131 | - { | |
132 | - sprintf(out_val, " %2d", val); | |
133 | - } | |
134 | -} | |
135 | - | |
136 | -/*! | |
137 | - * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。 | |
138 | - * Modify a stat value by a "modifier", return new value | |
139 | - * @param value 現在値 | |
140 | - * @param amount 加減算値 | |
141 | - * @return 加減算後の値 | |
142 | - * @details | |
143 | - * <pre> | |
144 | - * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220 | |
145 | - * Or even: 18/13, 18/23, 18/33, ..., 18/220 | |
146 | - * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3 | |
147 | - * Or even: 18/13, 18/03, 18, 17, ..., 3 | |
148 | - * </pre> | |
149 | - */ | |
150 | -s16b modify_stat_value(int value, int amount) | |
151 | -{ | |
152 | - int i; | |
153 | - | |
154 | - /* Reward */ | |
155 | - if (amount > 0) | |
156 | - { | |
157 | - /* Apply each point */ | |
158 | - for (i = 0; i < amount; i++) | |
159 | - { | |
160 | - /* One point at a time */ | |
161 | - if (value < 18) value++; | |
162 | - | |
163 | - /* Ten "points" at a time */ | |
164 | - else value += 10; | |
165 | - } | |
166 | - } | |
167 | - | |
168 | - /* Penalty */ | |
169 | - else if (amount < 0) | |
170 | - { | |
171 | - /* Apply each point */ | |
172 | - for (i = 0; i < (0 - amount); i++) | |
173 | - { | |
174 | - /* Ten points at a time */ | |
175 | - if (value >= 18+10) value -= 10; | |
176 | - | |
177 | - /* Hack -- prevent weirdness */ | |
178 | - else if (value > 18) value = 18; | |
179 | - | |
180 | - /* One point at a time */ | |
181 | - else if (value > 3) value--; | |
182 | - } | |
183 | - } | |
184 | - | |
185 | - /* Return new value */ | |
186 | - return (s16b)(value); | |
187 | -} | |
188 | 102 | |
189 | 103 | |
190 | 104 |