• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision6d158f8e1169aa35a567405e200455da096e00d1 (tree)
Time2020-05-23 13:44:46
AuthorHourier <hourier@user...>
CommiterHourier

Log Message

[Refactor] #40416 Incorporated drain_result int player_attack_type

Change Summary

Incremental Difference

--- a/src/combat/player-attack-util.h
+++ b/src/combat/player-attack-util.h
@@ -28,4 +28,5 @@ typedef struct player_attack_type {
2828 chaotic_effect chaos_effect;
2929 bool can_drain;
3030 const martial_arts *ma_ptr;
31+ int drain_result;
3132 } player_attack_type;
--- a/src/combat/player-attack.c
+++ b/src/combat/player-attack.c
@@ -42,6 +42,7 @@ static player_attack_type *initialize_player_attack_type(player_attack_type *pa_
4242 pa_ptr->attack_damage = 0;
4343 pa_ptr->can_drain = FALSE;
4444 pa_ptr->ma_ptr = &ma_blows[0];
45+ pa_ptr->drain_result = 0;
4546 return pa_ptr;
4647 }
4748
@@ -274,7 +275,6 @@ void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITIO
274275 bool do_quake = FALSE;
275276 bool weak = FALSE;
276277 bool drain_msg = TRUE;
277- int drain_result = 0;
278278 int drain_heal = 0;
279279 int drain_left = MAX_VAMPIRIC_DRAIN;
280280
@@ -346,7 +346,7 @@ void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITIO
346346 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_POISON_NEEDLE)) && !(mode == HISSATSU_KYUSHO))
347347 pa_ptr->attack_damage = critical_norm(attacker_ptr, o_ptr->weight, o_ptr->to_h, pa_ptr->attack_damage, attacker_ptr->to_h[hand], mode);
348348
349- drain_result = pa_ptr->attack_damage;
349+ pa_ptr->drain_result = pa_ptr->attack_damage;
350350
351351 if (vorpal_cut) {
352352 int mult = 2;
@@ -399,16 +399,16 @@ void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITIO
399399 break;
400400 }
401401 }
402- drain_result = drain_result * 3 / 2;
402+ pa_ptr->drain_result = pa_ptr->drain_result * 3 / 2;
403403 }
404404
405405 pa_ptr->attack_damage += o_ptr->to_d;
406- drain_result += o_ptr->to_d;
406+ pa_ptr->drain_result += o_ptr->to_d;
407407 }
408408
409409 /* Apply the player damage bonuses */
410410 pa_ptr->attack_damage += attacker_ptr->to_d[hand];
411- drain_result += attacker_ptr->to_d[hand];
411+ pa_ptr->drain_result += attacker_ptr->to_d[hand];
412412
413413 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN))
414414 pa_ptr->attack_damage *= 2;
@@ -469,12 +469,12 @@ void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITIO
469469 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
470470 if (one_in_(pa_ptr->backstab ? 13 : (pa_ptr->stab_fleeing || pa_ptr->suprise_attack) ? 15 : 27)) {
471471 pa_ptr->attack_damage *= 5;
472- drain_result *= 2;
472+ pa_ptr->drain_result *= 2;
473473 msg_format(_("刃が%sに深々と突き刺さった!", "You critically injured %s!"), pa_ptr->m_name);
474474 } else if (((m_ptr->hp < maxhp / 2) && one_in_((attacker_ptr->num_blow[0] + attacker_ptr->num_blow[1] + 1) * 10)) || ((one_in_(666) || ((pa_ptr->backstab || pa_ptr->suprise_attack) && one_in_(11))) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))) {
475475 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp / 2)) {
476476 pa_ptr->attack_damage = MAX(pa_ptr->attack_damage * 5, m_ptr->hp / 2);
477- drain_result *= 2;
477+ pa_ptr->drain_result *= 2;
478478 msg_format(_("%sに致命傷を負わせた!", "You fatally injured %s!"), pa_ptr->m_name);
479479 } else {
480480 pa_ptr->attack_damage = m_ptr->hp + 1;
@@ -490,8 +490,8 @@ void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITIO
490490 if (pa_ptr->attack_damage <= 0)
491491 pa_ptr->can_drain = FALSE;
492492
493- if (drain_result > m_ptr->hp)
494- drain_result = m_ptr->hp;
493+ if (pa_ptr->drain_result > m_ptr->hp)
494+ pa_ptr->drain_result = m_ptr->hp;
495495
496496 /* Damage, check for fear and death */
497497 if (mon_take_hit(attacker_ptr, g_ptr->m_idx, pa_ptr->attack_damage, fear, NULL)) {
@@ -520,7 +520,7 @@ void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITIO
520520 /* Are we draining it? A little note: If the monster is
521521 dead, the drain does not work... */
522522
523- if (pa_ptr->can_drain && (drain_result > 0)) {
523+ if (pa_ptr->can_drain && (pa_ptr->drain_result > 0)) {
524524 if (o_ptr->name1 == ART_MURAMASA) {
525525 if (is_human) {
526526 HIT_PROB to_h = o_ptr->to_h;
@@ -548,9 +548,9 @@ void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITIO
548548 }
549549 }
550550 } else {
551- if (drain_result > 5) /* Did we really hurt it? */
551+ if (pa_ptr->drain_result > 5) /* Did we really hurt it? */
552552 {
553- drain_heal = damroll(2, drain_result / 6);
553+ drain_heal = damroll(2, pa_ptr->drain_result / 6);
554554
555555 if (hex_spelling(attacker_ptr, HEX_VAMP_BLADE))
556556 drain_heal *= 2;
@@ -589,7 +589,7 @@ void exe_player_attack_to_monster(player_type *attacker_ptr, POSITION y, POSITIO
589589 }
590590
591591 pa_ptr->can_drain = FALSE;
592- drain_result = 0;
592+ pa_ptr->drain_result = 0;
593593
594594 /* Confusion attack */
595595 if ((attacker_ptr->special_attack & ATTACK_CONFUSE) || (pa_ptr->chaos_effect == CE_CONFUSION) || (mode == HISSATSU_CONF) || hex_spelling(attacker_ptr, HEX_CONFUSION)) {
Show on old repository browser