• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision74452e9855a912690aa90014a2dd11c025211fb2 (tree)
Time2019-06-20 23:27:10
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -208,12 +208,12 @@ void exe_quaff_potion(INVENTORY_IDX item)
208208 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
209209 take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
210210
211- (void)dec_stat(A_DEX, 25, TRUE);
212- (void)dec_stat(A_WIS, 25, TRUE);
213- (void)dec_stat(A_CON, 25, TRUE);
214- (void)dec_stat(A_STR, 25, TRUE);
215- (void)dec_stat(A_CHR, 25, TRUE);
216- (void)dec_stat(A_INT, 25, TRUE);
211+ (void)dec_stat(p_ptr, A_DEX, 25, TRUE);
212+ (void)dec_stat(p_ptr, A_WIS, 25, TRUE);
213+ (void)dec_stat(p_ptr, A_CON, 25, TRUE);
214+ (void)dec_stat(p_ptr, A_STR, 25, TRUE);
215+ (void)dec_stat(p_ptr, A_CHR, 25, TRUE);
216+ (void)dec_stat(p_ptr, A_INT, 25, TRUE);
217217 ident = TRUE;
218218 break;
219219
--- a/src/cmd-spell.c
+++ b/src/cmd-spell.c
@@ -1463,7 +1463,7 @@ void do_cmd_cast(void)
14631463 msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
14641464
14651465 /* Reduce constitution */
1466- (void)dec_stat(A_CON, 15 + randint1(10), perm);
1466+ (void)dec_stat(p_ptr, A_CON, 15 + randint1(10), perm);
14671467 }
14681468 }
14691469
--- a/src/core.c
+++ b/src/core.c
@@ -2438,7 +2438,7 @@ static void process_world_aux_mutation(void)
24382438 disturb(FALSE, TRUE);
24392439 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
24402440 msg_print(NULL);
2441- (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2441+ (void)dec_stat(p_ptr, which_stat, randint1(6) + 6, one_in_(3));
24422442 }
24432443 }
24442444 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
--- a/src/melee1.c
+++ b/src/melee1.c
@@ -3462,7 +3462,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
34623462 {
34633463 /* 1% chance for perm. damage */
34643464 bool perm = one_in_(10);
3465- if (dec_stat(A_CON, randint1(10), perm))
3465+ if (dec_stat(p_ptr, A_CON, randint1(10), perm))
34663466 {
34673467 msg_print(_("病があなたを蝕んでいる気がする。", "You feel strange sickness."));
34683468 obvious = TRUE;
--- a/src/mind.c
+++ b/src/mind.c
@@ -2051,7 +2051,7 @@ void do_cmd_mind(void)
20512051 msg_print(_("自分の精神を攻撃してしまった!", "You have damaged your mind!"));
20522052
20532053 /* Reduce constitution */
2054- (void)dec_stat(A_WIS, 15 + randint1(10), perm);
2054+ (void)dec_stat(p_ptr, A_WIS, 15 + randint1(10), perm);
20552055 }
20562056 }
20572057 p_ptr->redraw |= (PR_MANA);
--- a/src/mspells3.c
+++ b/src/mspells3.c
@@ -1759,7 +1759,7 @@ bool do_cmd_cast_learned(void)
17591759 msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
17601760
17611761 /* Reduce constitution */
1762- (void)dec_stat(A_CON, 15 + randint1(10), perm);
1762+ (void)dec_stat(p_ptr, A_CON, 15 + randint1(10), perm);
17631763 }
17641764 }
17651765
--- a/src/patron.c
+++ b/src/patron.c
@@ -444,7 +444,7 @@ void gain_level_reward(int chosen_reward)
444444
445445 for (dummy = 0; dummy < A_MAX; dummy++)
446446 {
447- (void)dec_stat(dummy, 10 + randint1(15), TRUE);
447+ (void)dec_stat(p_ptr, dummy, 10 + randint1(15), TRUE);
448448 }
449449 reward = _("全能力値が下がった。", "decreasing all stats");
450450 break;
@@ -557,7 +557,7 @@ void gain_level_reward(int chosen_reward)
557557 default:
558558 for (dummy = 0; dummy < A_MAX; dummy++)
559559 {
560- (void)dec_stat(dummy, 10 + randint1(15), TRUE);
560+ (void)dec_stat(p_ptr, dummy, 10 + randint1(15), TRUE);
561561 }
562562 reward = _("全能力値が下がった。", "decreasing all stats");
563563 break;
@@ -572,7 +572,7 @@ void gain_level_reward(int chosen_reward)
572572 take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
573573 for (dummy = 0; dummy < A_MAX; dummy++)
574574 {
575- (void)dec_stat(dummy, 10 + randint1(15), FALSE);
575+ (void)dec_stat(p_ptr, dummy, 10 + randint1(15), FALSE);
576576 }
577577 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
578578 (void)activate_ty_curse(FALSE, &count);
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -2266,8 +2266,8 @@ bool set_tsuyoshi(TIME_EFFECT v, bool do_dec)
22662266 {
22672267 msg_print(_("肉体が急速にしぼんでいった。", "Your body had quickly shriveled."));
22682268
2269- (void)dec_stat(A_CON, 20, TRUE);
2270- (void)dec_stat(A_STR, 20, TRUE);
2269+ (void)dec_stat(p_ptr, A_CON, 20, TRUE);
2270+ (void)dec_stat(p_ptr, A_STR, 20, TRUE);
22712271
22722272 notice = TRUE;
22732273 chg_virtue(V_VITALITY, -3);
@@ -3285,16 +3285,15 @@ bool inc_stat(int stat)
32853285 * if your stat is already drained, the "max" value will not drop all\n
32863286 * the way down to the "cur" value.\n
32873287 */
3288-bool dec_stat(int stat, int amount, int permanent)
3288+bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent)
32893289 {
32903290 BASE_STATUS cur, max;
32913291 int loss, same;
32923292 bool res = FALSE;
32933293
3294-
32953294 /* Acquire current value */
3296- cur = p_ptr->stat_cur[stat];
3297- max = p_ptr->stat_max[stat];
3295+ cur = creature_ptr->stat_cur[stat];
3296+ max = creature_ptr->stat_max[stat];
32983297
32993298 /* Note when the values are identical */
33003299 same = (cur == max);
@@ -3337,7 +3336,7 @@ bool dec_stat(int stat, int amount, int permanent)
33373336 if (cur < 3) cur = 3;
33383337
33393338 /* Something happened */
3340- if (cur != p_ptr->stat_cur[stat]) res = TRUE;
3339+ if (cur != creature_ptr->stat_cur[stat]) res = TRUE;
33413340 }
33423341
33433342 /* Damage "max" value */
@@ -3377,17 +3376,17 @@ bool dec_stat(int stat, int amount, int permanent)
33773376 if (same || (max < cur)) max = cur;
33783377
33793378 /* Something happened */
3380- if (max != p_ptr->stat_max[stat]) res = TRUE;
3379+ if (max != creature_ptr->stat_max[stat]) res = TRUE;
33813380 }
33823381
33833382 if (res)
33843383 {
33853384 /* Actually set the stat to its new value. */
3386- p_ptr->stat_cur[stat] = cur;
3387- p_ptr->stat_max[stat] = max;
3385+ creature_ptr->stat_cur[stat] = cur;
3386+ creature_ptr->stat_max[stat] = max;
33883387
3389- p_ptr->redraw |= (PR_STATS);
3390- p_ptr->update |= (PU_BONUS);
3388+ creature_ptr->redraw |= (PR_STATS);
3389+ creature_ptr->update |= (PU_BONUS);
33913390 }
33923391
33933392 return (res);
@@ -3539,7 +3538,7 @@ bool do_dec_stat(player_type *creature_ptr, int stat)
35393538 }
35403539
35413540 /* Attempt to reduce the stat */
3542- if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
3541+ if (dec_stat(p_ptr, stat, 10, (ironman_nightmare && !randint0(13))))
35433542 {
35443543 msg_format(_("ひどく%sなった気がする。", "You feel very %s."), desc_stat_neg[stat]);
35453544
@@ -3817,14 +3816,14 @@ void do_poly_self(void)
38173816 {
38183817 if (one_in_(2))
38193818 {
3820- (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
3819+ (void)dec_stat(p_ptr, tmp, randint1(6) + 6, one_in_(3));
38213820 power -= 1;
38223821 }
38233822 tmp++;
38243823 }
38253824
38263825 /* Deformities are discriminated against! */
3827- (void)dec_stat(A_CHR, randint1(6), TRUE);
3826+ (void)dec_stat(p_ptr, A_CHR, randint1(6), TRUE);
38283827
38293828 if (effect_msg[0])
38303829 {
@@ -3866,7 +3865,7 @@ void do_poly_self(void)
38663865
38673866 while (tmp < A_MAX)
38683867 {
3869- (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
3868+ (void)dec_stat(p_ptr, tmp, randint1(6) + 6, one_in_(3));
38703869 tmp++;
38713870 }
38723871 if (one_in_(6))
--- a/src/player-effects.h
+++ b/src/player-effects.h
@@ -58,7 +58,7 @@ extern bool set_stun(TIME_EFFECT v);
5858 extern bool set_cut(TIME_EFFECT v);
5959 extern bool set_food(TIME_EFFECT v);
6060 extern bool inc_stat(int stat);
61-extern bool dec_stat(int stat, int amount, int permanent);
61+extern bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent);
6262 extern bool res_stat(player_type *creature_ptr, int stat);
6363 extern bool hp_player(int num);
6464 extern bool do_dec_stat(player_type *creature_ptr, int stat);
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -3143,12 +3143,12 @@ void ring_of_power(DIRECTION dir)
31433143 sound(SOUND_EVIL);
31443144
31453145 /* Decrease all stats (permanently) */
3146- (void)dec_stat(A_STR, 50, TRUE);
3147- (void)dec_stat(A_INT, 50, TRUE);
3148- (void)dec_stat(A_WIS, 50, TRUE);
3149- (void)dec_stat(A_DEX, 50, TRUE);
3150- (void)dec_stat(A_CON, 50, TRUE);
3151- (void)dec_stat(A_CHR, 50, TRUE);
3146+ (void)dec_stat(p_ptr, A_STR, 50, TRUE);
3147+ (void)dec_stat(p_ptr, A_INT, 50, TRUE);
3148+ (void)dec_stat(p_ptr, A_WIS, 50, TRUE);
3149+ (void)dec_stat(p_ptr, A_DEX, 50, TRUE);
3150+ (void)dec_stat(p_ptr, A_CON, 50, TRUE);
3151+ (void)dec_stat(p_ptr, A_CHR, 50, TRUE);
31523152
31533153 /* Lose some experience (permanently) */
31543154 p_ptr->exp -= (p_ptr->exp / 4);
Show on old repository browser