From f12082ed736f3e4b962511ef3729088592e1a922 Mon Sep 17 00:00:00 2001 From: deskull Date: Thu, 2 Jul 2020 21:33:16 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#40514=20calc=5Fcharisma=5Faddition?= =?utf8?q?()=20=E3=82=92=20calc=5Fbonuses()=E3=80=80=E3=81=8B=E3=82=89?= =?utf8?q?=E5=88=86=E9=9B=A2=EF=BC=8E=20/=20Separated=20calc=5Fcharisma=5F?= =?utf8?q?addition()=20from=20calc=5Fbonuses().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/mutation/mutation.c | 15 --------------- src/object/object-kind.c | 2 -- src/player/player-status.c | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/mutation/mutation.c b/src/mutation/mutation.c index cec470d33..9b10a0b1c 100644 --- a/src/mutation/mutation.c +++ b/src/mutation/mutation.c @@ -1896,18 +1896,9 @@ void set_mutation_flags(player_type *creature_ptr) } if (creature_ptr->muta3 & MUT3_FLESH_ROT) { - creature_ptr->stat_add[A_CHR] -= 1; creature_ptr->regenerate = FALSE; } - if (creature_ptr->muta3 & MUT3_SILLY_VOI) { - creature_ptr->stat_add[A_CHR] -= 4; - } - - if (creature_ptr->muta3 & MUT3_BLANK_FAC) { - creature_ptr->stat_add[A_CHR] -= 1; - } - if (creature_ptr->muta3 & MUT3_XTRA_LEGS) { creature_ptr->pspeed += 3; } @@ -1926,13 +1917,11 @@ void set_mutation_flags(player_type *creature_ptr) } if (creature_ptr->muta3 & MUT3_WART_SKIN) { - creature_ptr->stat_add[A_CHR] -= 2; creature_ptr->to_a += 5; creature_ptr->dis_to_a += 5; } if (creature_ptr->muta3 & MUT3_SCALES) { - creature_ptr->stat_add[A_CHR] -= 1; creature_ptr->to_a += 10; creature_ptr->dis_to_a += 10; } @@ -1961,9 +1950,5 @@ void set_mutation_flags(player_type *creature_ptr) if (creature_ptr->muta3 & MUT3_MOTION) { creature_ptr->free_act = TRUE; } - - if (creature_ptr->muta3 & MUT3_ILL_NORM) { - creature_ptr->stat_add[A_CHR] = 0; - } } } diff --git a/src/object/object-kind.c b/src/object/object-kind.c index 7901e3dbf..1518802bb 100644 --- a/src/object/object-kind.c +++ b/src/object/object-kind.c @@ -46,8 +46,6 @@ void calc_equipment_status(player_type* creature_ptr) { if (o_ptr->name1 == ART_CHAINSWORD) creature_ptr->cursed |= TRC_CHAINSWORD; - if (have_flag(flgs, TR_CHR)) - creature_ptr->stat_add[A_CHR] += o_ptr->pval; if (have_flag(flgs, TR_INFRA)) creature_ptr->see_infra += o_ptr->pval; if (have_flag(flgs, TR_TUNNEL)) diff --git a/src/player/player-status.c b/src/player/player-status.c index 4ef1481f6..bb7bad344 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -98,6 +98,7 @@ static void calc_intelligence_addition(player_type *creature_ptr); static void calc_wisdom_addition(player_type *creature_ptr); static void calc_dexterity_addition(player_type *creature_ptr); static void calc_constitution_addition(player_type *creature_ptr); +static void calc_charisma_addition(player_type *creature_ptr); /*! * @brief 能力値テーブル / Abbreviations of healthy stats @@ -1609,6 +1610,7 @@ void calc_bonuses(player_type *creature_ptr) calc_wisdom_addition(creature_ptr); calc_dexterity_addition(creature_ptr); calc_constitution_addition(creature_ptr); + calc_charisma_addition(creature_ptr); int count = 0; for (int i = 0; i < A_MAX; i++) @@ -3855,7 +3857,42 @@ static void calc_constitution_addition(player_type *creature_ptr) } } -/*! +static void calc_charisma_addition(player_type *creature_ptr) +{ + + for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) { + object_type *o_ptr; + BIT_FLAGS flgs[TR_FLAG_SIZE]; + o_ptr = &creature_ptr->inventory_list[i]; + if (!o_ptr->k_idx) + continue; + object_flags(o_ptr, flgs); + if (have_flag(flgs, TR_CHR)) + creature_ptr->stat_add[A_CHR] += o_ptr->pval; + } + + if (creature_ptr->muta3) { + if (creature_ptr->muta3 & MUT3_FLESH_ROT) { + creature_ptr->stat_add[A_CHR] -= 1; + } + if (creature_ptr->muta3 & MUT3_SILLY_VOI) { + creature_ptr->stat_add[A_CHR] -= 4; + } + if (creature_ptr->muta3 & MUT3_BLANK_FAC) { + creature_ptr->stat_add[A_CHR] -= 1; + } + if (creature_ptr->muta3 & MUT3_WART_SKIN) { + creature_ptr->stat_add[A_CHR] -= 2; + } + if (creature_ptr->muta3 & MUT3_SCALES) { + creature_ptr->stat_add[A_CHR] -= 1; + } + if (creature_ptr->muta3 & MUT3_ILL_NORM) { + creature_ptr->stat_add[A_CHR] = 0; + } + } +} + /*! * @brief プレイヤーの所持重量制限を計算する / * Computes current weight limit. * @return 制限重量(ポンド) -- 2.11.0