Skip to content

Commit

Permalink
[Refactor] hengband#1498 Replaced direct damage-decrease calculation …
Browse files Browse the repository at this point in the history
…to decrease_damage()
  • Loading branch information
Hourier committed Sep 18, 2021
1 parent 7088106 commit 4b4b185
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions src/player/player-status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1968,12 +1968,8 @@ static int16_t calc_to_damage(player_type *player_ptr, INVENTORY_IDX slot, bool
damage += 3 + (player_ptr->lev / 5);
}

if (player_ptr->stun > 50) {
damage -= 20;
} else if (player_ptr->stun) {
damage -= 5;
}

auto player_stun = player_ptr->effects()->stun();
damage -= player_stun->decrease_damage();
if ((player_ptr->pclass == CLASS_PRIEST) && (flgs.has_not(TR_BLESSED)) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
damage -= 2;
} else if (player_ptr->pclass == CLASS_BERSERKER) {
Expand Down Expand Up @@ -2117,12 +2113,8 @@ static int16_t calc_to_hit(player_type *player_ptr, INVENTORY_IDX slot, bool is_
hit += 12;
}

if (player_ptr->stun > 50) {
hit -= 20;
} else if (player_ptr->stun) {
hit -= 5;
}

auto player_stun = player_ptr->effects()->stun();
hit -= player_stun->decrease_damage();
player_hand calc_hand = PLAYER_HAND_OTHER;
if (slot == INVEN_MAIN_HAND)
calc_hand = PLAYER_HAND_MAIN;
Expand Down Expand Up @@ -2342,12 +2334,8 @@ static int16_t calc_to_hit_bow(player_type *player_ptr, bool is_real_value)
}
}

if (player_ptr->stun > 50) {
pow -= 20;
} else if (player_ptr->stun) {
pow -= 5;
}

auto player_stun = player_ptr->effects()->stun();
pow -= player_stun->decrease_damage();
if (is_blessed(player_ptr)) {
pow += 10;
}
Expand Down Expand Up @@ -2421,12 +2409,8 @@ static int16_t calc_to_damage_misc(player_type *player_ptr)
to_dam += 3 + (player_ptr->lev / 5);
}

if (player_ptr->stun > 50) {
to_dam -= 20;
} else if (player_ptr->stun) {
to_dam -= 5;
}

auto player_stun = player_ptr->effects()->stun();
to_dam -= player_stun->decrease_damage();
to_dam += ((int)(adj_str_td[player_ptr->stat_index[A_STR]]) - 128);
return to_dam;
}
Expand Down Expand Up @@ -2462,12 +2446,8 @@ static int16_t calc_to_hit_misc(player_type *player_ptr)
to_hit += 12;
}

if (player_ptr->stun > 50) {
to_hit -= 20;
} else if (player_ptr->stun) {
to_hit -= 5;
}

auto player_stun = player_ptr->effects()->stun();
to_hit -= player_stun->decrease_damage();
to_hit += ((int)(adj_dex_th[player_ptr->stat_index[A_DEX]]) - 128);
to_hit += ((int)(adj_str_th[player_ptr->stat_index[A_STR]]) - 128);

Expand Down

0 comments on commit 4b4b185

Please sign in to comment.