変愚蛮怒のメインリポジトリです
Revisão | 6626c15bf7755361690f9c02bcdb4de0cf112285 (tree) |
---|---|
Hora | 2020-02-23 23:28:28 |
Autor | Hourier <hourier@user...> |
Commiter | Hourier |
[Refactor] #39962 display_player_various() からcalc_two_hands() を分離 / Separated calc_two_hands() from display_player_various()
@@ -233,6 +233,54 @@ static concptr likert(int x, int y) | ||
233 | 233 | |
234 | 234 | |
235 | 235 | /*! |
236 | + * @brief 弓+両手の武器それぞれについてダメージを計算する | |
237 | + * @param creature_ptr プレーヤーへの参照ポインタ | |
238 | + * @param damage 直接攻撃のダメージ | |
239 | + * @param to_h 命中補正 | |
240 | + * @return なし | |
241 | + */ | |
242 | +static void calc_two_hands(player_type *creature_ptr, int *damage, int *to_h) | |
243 | +{ | |
244 | + object_type *o_ptr; | |
245 | + o_ptr = &creature_ptr->inventory_list[INVEN_BOW]; | |
246 | + BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
247 | + for (int i = 0; i < 2; i++) | |
248 | + { | |
249 | + int basedam; | |
250 | + damage[i] = creature_ptr->dis_to_d[i] * 100; | |
251 | + if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM)) | |
252 | + { | |
253 | + if (!calc_weapon_damage_limit(creature_ptr, i, damage, &basedam, o_ptr)) | |
254 | + break; | |
255 | + | |
256 | + continue; | |
257 | + } | |
258 | + | |
259 | + o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i]; | |
260 | + if (calc_weapon_one_hand(o_ptr, i, damage, &basedam)) continue; | |
261 | + | |
262 | + to_h[i] = 0; | |
263 | + bool poison_needle = FALSE; | |
264 | + if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) poison_needle = TRUE; | |
265 | + if (object_is_known(o_ptr)) | |
266 | + { | |
267 | + damage[i] += o_ptr->to_d * 100; | |
268 | + to_h[i] += o_ptr->to_h; | |
269 | + } | |
270 | + | |
271 | + basedam = ((o_ptr->dd + creature_ptr->to_dd[i]) * (o_ptr->ds + creature_ptr->to_ds[i] + 1)) * 50; | |
272 | + object_flags_known(o_ptr, flgs); | |
273 | + | |
274 | + basedam = calc_expect_crit(creature_ptr, o_ptr->weight, to_h[i], basedam, creature_ptr->dis_to_h[i], poison_needle); | |
275 | + basedam = strengthen_basedam(creature_ptr, o_ptr, basedam, flgs); | |
276 | + damage[i] += basedam; | |
277 | + if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) damage[i] = 1; | |
278 | + if (damage[i] < 0) damage[i] = 0; | |
279 | + } | |
280 | +} | |
281 | + | |
282 | + | |
283 | +/*! | |
236 | 284 | * @brief キャラ基本情報及び技能値をメインウィンドウに表示する |
237 | 285 | * @param creature_ptr プレーヤーへの参照ポインタ |
238 | 286 | * @param xthb 武器等を含めた最終命中率 |
@@ -331,40 +379,6 @@ void display_player_various(player_type *creature_ptr, void(*display_player_one_ | ||
331 | 379 | |
332 | 380 | int damage[2]; |
333 | 381 | int to_h[2]; |
334 | - BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
335 | - for (int i = 0; i < 2; i++) | |
336 | - { | |
337 | - int basedam; | |
338 | - damage[i] = creature_ptr->dis_to_d[i] * 100; | |
339 | - if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER)) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM)) | |
340 | - { | |
341 | - if (!calc_weapon_damage_limit(creature_ptr, i, damage, &basedam, o_ptr)) | |
342 | - break; | |
343 | - | |
344 | - continue; | |
345 | - } | |
346 | - | |
347 | - o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i]; | |
348 | - if (calc_weapon_one_hand(o_ptr, i, damage, &basedam)) continue; | |
349 | - | |
350 | - to_h[i] = 0; | |
351 | - bool poison_needle = FALSE; | |
352 | - if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) poison_needle = TRUE; | |
353 | - if (object_is_known(o_ptr)) | |
354 | - { | |
355 | - damage[i] += o_ptr->to_d * 100; | |
356 | - to_h[i] += o_ptr->to_h; | |
357 | - } | |
358 | - | |
359 | - basedam = ((o_ptr->dd + creature_ptr->to_dd[i]) * (o_ptr->ds + creature_ptr->to_ds[i] + 1)) * 50; | |
360 | - object_flags_known(o_ptr, flgs); | |
361 | - | |
362 | - basedam = calc_expect_crit(creature_ptr, o_ptr->weight, to_h[i], basedam, creature_ptr->dis_to_h[i], poison_needle); | |
363 | - basedam = strengthen_basedam(creature_ptr, o_ptr, basedam, flgs); | |
364 | - damage[i] += basedam; | |
365 | - if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) damage[i] = 1; | |
366 | - if (damage[i] < 0) damage[i] = 0; | |
367 | - } | |
368 | - | |
382 | + calc_two_hands(creature_ptr, damage, to_h); | |
369 | 383 | display_first_page(creature_ptr, xthb, damage, shots, shot_frac, display_player_one_line); |
370 | 384 | } |