• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisionee61056625bd377007dd6f2932bdeb22abe3a7fd (tree)
Time2019-07-09 23:57:50
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38997 calc_hitpoints() に player_type * 引数を追加.

Change Summary

Incremental Difference

--- a/src/player-status.c
+++ b/src/player-status.c
@@ -4015,30 +4015,30 @@ static void calc_alignment(void)
40154015 * @return なし
40164016 * @details
40174017 */
4018-static void calc_hitpoints(void)
4018+static void calc_hitpoints(player_type *creature_ptr)
40194019 {
40204020 int bonus, mhp;
40214021 byte tmp_hitdie;
40224022
40234023 /* Un-inflate "half-hitpoint bonus per level" value */
4024- bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128) * p_ptr->lev / 4;
4024+ bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
40254025
40264026 /* Calculate hitpoints */
4027- mhp = p_ptr->player_hp[p_ptr->lev - 1];
4027+ mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
40284028
4029- if (p_ptr->mimic_form)
4029+ if (creature_ptr->mimic_form)
40304030 {
4031- if (p_ptr->pclass == CLASS_SORCERER)
4032- tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
4031+ if (creature_ptr->pclass == CLASS_SORCERER)
4032+ tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
40334033 else
4034- tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
4035- mhp = mhp * tmp_hitdie / p_ptr->hitdie;
4034+ tmp_hitdie = mimic_info[creature_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
4035+ mhp = mhp * tmp_hitdie / creature_ptr->hitdie;
40364036 }
40374037
4038- if (p_ptr->pclass == CLASS_SORCERER)
4038+ if (creature_ptr->pclass == CLASS_SORCERER)
40394039 {
4040- if (p_ptr->lev < 30)
4041- mhp = (mhp * (45 + p_ptr->lev) / 100);
4040+ if (creature_ptr->lev < 30)
4041+ mhp = (mhp * (45 + creature_ptr->lev) / 100);
40424042 else
40434043 mhp = (mhp * 75 / 100);
40444044 bonus = (bonus * 65 / 100);
@@ -4046,46 +4046,46 @@ static void calc_hitpoints(void)
40464046
40474047 mhp += bonus;
40484048
4049- if (p_ptr->pclass == CLASS_BERSERKER)
4049+ if (creature_ptr->pclass == CLASS_BERSERKER)
40504050 {
4051- mhp = mhp * (110 + (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 110)) / 100;
4051+ mhp = mhp * (110 + (((creature_ptr->lev + 40) * (creature_ptr->lev + 40) - 1550) / 110)) / 100;
40524052 }
40534053
40544054 /* Always have at least one hitpoint per level */
4055- if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1;
4055+ if (mhp < creature_ptr->lev + 1) mhp = creature_ptr->lev + 1;
40564056
40574057 /* Factor in the hero / superhero settings */
40584058 if (IS_HERO()) mhp += 10;
4059- if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
4060- if (p_ptr->tsuyoshi) mhp += 50;
4059+ if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
4060+ if (creature_ptr->tsuyoshi) mhp += 50;
40614061
40624062 /* Factor in the hex spell settings */
40634063 if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15;
40644064 if (hex_spelling(HEX_BUILDING)) mhp += 60;
40654065
40664066 /* New maximum hitpoints */
4067- if (p_ptr->mhp != mhp)
4067+ if (creature_ptr->mhp != mhp)
40684068 {
40694069 /* Enforce maximum */
4070- if (p_ptr->chp >= mhp)
4070+ if (creature_ptr->chp >= mhp)
40714071 {
4072- p_ptr->chp = mhp;
4073- p_ptr->chp_frac = 0;
4072+ creature_ptr->chp = mhp;
4073+ creature_ptr->chp_frac = 0;
40744074 }
40754075
40764076 #ifdef JP
40774077 /* レベルアップの時は上昇量を表示する */
4078- if (p_ptr->level_up_message && (mhp > p_ptr->mhp))
4078+ if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp))
40794079 {
4080- msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - p_ptr->mhp));
4080+ msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
40814081 }
40824082 #endif
40834083 /* Save the new max-hitpoints */
4084- p_ptr->mhp = mhp;
4084+ creature_ptr->mhp = mhp;
40854085
40864086 /* Display hitpoints (later) */
4087- p_ptr->redraw |= (PR_HP);
4088- p_ptr->window |= (PW_PLAYER);
4087+ creature_ptr->redraw |= (PR_HP);
4088+ creature_ptr->window |= (PW_PLAYER);
40894089 }
40904090 }
40914091
@@ -5020,7 +5020,7 @@ void update_creature(player_type *creature_ptr)
50205020 if (creature_ptr->update & (PU_HP))
50215021 {
50225022 creature_ptr->update &= ~(PU_HP);
5023- calc_hitpoints();
5023+ calc_hitpoints(creature_ptr);
50245024 }
50255025
50265026 if (creature_ptr->update & (PU_MANA))
Show on old repository browser