• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision8c905fe81fab3b66034923679430a9299467682a (tree)
Time2019-06-20 23:20:00
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/chest.c
+++ b/src/chest.c
@@ -155,7 +155,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
155155 {
156156 msg_print(_("仕掛けられていた小さな針に刺されてしまった!", "A small needle has pricked you!"));
157157 take_hit(DAMAGE_NOESCAPE, damroll(1, 4), _("毒針", "a poison needle"), -1);
158- (void)do_dec_stat(A_STR);
158+ (void)do_dec_stat(p_ptr, A_STR);
159159 }
160160
161161 /* Lose constitution */
@@ -163,7 +163,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
163163 {
164164 msg_print(_("仕掛けられていた小さな針に刺されてしまった!", "A small needle has pricked you!"));
165165 take_hit(DAMAGE_NOESCAPE, damroll(1, 4), _("毒針", "a poison needle"), -1);
166- (void)do_dec_stat(A_CON);
166+ (void)do_dec_stat(p_ptr, A_CON);
167167 }
168168
169169 /* Poison */
@@ -296,12 +296,12 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx)
296296 else if (one_in_(3)) apply_disenchant(0);
297297 else if (one_in_(2))
298298 {
299- (void)do_dec_stat(A_STR);
300- (void)do_dec_stat(A_DEX);
301- (void)do_dec_stat(A_CON);
302- (void)do_dec_stat(A_INT);
303- (void)do_dec_stat(A_WIS);
304- (void)do_dec_stat(A_CHR);
299+ (void)do_dec_stat(p_ptr, A_STR);
300+ (void)do_dec_stat(p_ptr, A_DEX);
301+ (void)do_dec_stat(p_ptr, A_CON);
302+ (void)do_dec_stat(p_ptr, A_INT);
303+ (void)do_dec_stat(p_ptr, A_WIS);
304+ (void)do_dec_stat(p_ptr, A_CHR);
305305 }
306306 else (void)fire_meteor(-1, GF_NETHER, y, x, 150, 1);
307307 }
--- a/src/cmd-eat.c
+++ b/src/cmd-eat.c
@@ -141,7 +141,7 @@ void exe_eat_food(INVENTORY_IDX item)
141141 case SV_FOOD_WEAKNESS:
142142 {
143143 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
144- (void)do_dec_stat(A_STR);
144+ (void)do_dec_stat(p_ptr, A_STR);
145145 ident = TRUE;
146146 break;
147147 }
@@ -149,7 +149,7 @@ void exe_eat_food(INVENTORY_IDX item)
149149 case SV_FOOD_SICKNESS:
150150 {
151151 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
152- (void)do_dec_stat(A_CON);
152+ (void)do_dec_stat(p_ptr, A_CON);
153153 ident = TRUE;
154154 break;
155155 }
@@ -157,7 +157,7 @@ void exe_eat_food(INVENTORY_IDX item)
157157 case SV_FOOD_STUPIDITY:
158158 {
159159 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
160- (void)do_dec_stat(A_INT);
160+ (void)do_dec_stat(p_ptr, A_INT);
161161 ident = TRUE;
162162 break;
163163 }
@@ -165,7 +165,7 @@ void exe_eat_food(INVENTORY_IDX item)
165165 case SV_FOOD_NAIVETY:
166166 {
167167 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
168- (void)do_dec_stat(A_WIS);
168+ (void)do_dec_stat(p_ptr, A_WIS);
169169 ident = TRUE;
170170 break;
171171 }
@@ -173,7 +173,7 @@ void exe_eat_food(INVENTORY_IDX item)
173173 case SV_FOOD_UNHEALTH:
174174 {
175175 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
176- (void)do_dec_stat(A_CON);
176+ (void)do_dec_stat(p_ptr, A_CON);
177177 ident = TRUE;
178178 break;
179179 }
@@ -181,7 +181,7 @@ void exe_eat_food(INVENTORY_IDX item)
181181 case SV_FOOD_DISEASE:
182182 {
183183 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
184- (void)do_dec_stat(A_STR);
184+ (void)do_dec_stat(p_ptr, A_STR);
185185 ident = TRUE;
186186 break;
187187 }
--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -218,27 +218,27 @@ void exe_quaff_potion(INVENTORY_IDX item)
218218 break;
219219
220220 case SV_POTION_DEC_STR:
221- if (do_dec_stat(A_STR)) ident = TRUE;
221+ if (do_dec_stat(p_ptr, A_STR)) ident = TRUE;
222222 break;
223223
224224 case SV_POTION_DEC_INT:
225- if (do_dec_stat(A_INT)) ident = TRUE;
225+ if (do_dec_stat(p_ptr, A_INT)) ident = TRUE;
226226 break;
227227
228228 case SV_POTION_DEC_WIS:
229- if (do_dec_stat(A_WIS)) ident = TRUE;
229+ if (do_dec_stat(p_ptr, A_WIS)) ident = TRUE;
230230 break;
231231
232232 case SV_POTION_DEC_DEX:
233- if (do_dec_stat(A_DEX)) ident = TRUE;
233+ if (do_dec_stat(p_ptr, A_DEX)) ident = TRUE;
234234 break;
235235
236236 case SV_POTION_DEC_CON:
237- if (do_dec_stat(A_CON)) ident = TRUE;
237+ if (do_dec_stat(p_ptr, A_CON)) ident = TRUE;
238238 break;
239239
240240 case SV_POTION_DEC_CHR:
241- if (do_dec_stat(A_CHR)) ident = TRUE;
241+ if (do_dec_stat(p_ptr, A_CHR)) ident = TRUE;
242242 break;
243243
244244 case SV_POTION_DETONATIONS:
--- a/src/melee1.c
+++ b/src/melee1.c
@@ -3296,7 +3296,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
32963296 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
32973297
32983298 if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
3299- if (do_dec_stat(A_STR)) obvious = TRUE;
3299+ if (do_dec_stat(p_ptr, A_STR)) obvious = TRUE;
33003300
33013301 break;
33023302 }
@@ -3306,7 +3306,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
33063306 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
33073307
33083308 if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
3309- if (do_dec_stat(A_INT)) obvious = TRUE;
3309+ if (do_dec_stat(p_ptr, A_INT)) obvious = TRUE;
33103310
33113311 break;
33123312 }
@@ -3316,7 +3316,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
33163316 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
33173317
33183318 if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
3319- if (do_dec_stat(A_WIS)) obvious = TRUE;
3319+ if (do_dec_stat(p_ptr, A_WIS)) obvious = TRUE;
33203320
33213321 break;
33223322 }
@@ -3326,7 +3326,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
33263326 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
33273327
33283328 if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
3329- if (do_dec_stat(A_DEX)) obvious = TRUE;
3329+ if (do_dec_stat(p_ptr, A_DEX)) obvious = TRUE;
33303330
33313331 break;
33323332 }
@@ -3336,7 +3336,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
33363336 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
33373337
33383338 if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
3339- if (do_dec_stat(A_CON)) obvious = TRUE;
3339+ if (do_dec_stat(p_ptr, A_CON)) obvious = TRUE;
33403340
33413341 break;
33423342 }
@@ -3346,7 +3346,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
33463346 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
33473347
33483348 if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
3349- if (do_dec_stat(A_CHR)) obvious = TRUE;
3349+ if (do_dec_stat(p_ptr, A_CHR)) obvious = TRUE;
33503350
33513351 break;
33523352 }
@@ -3358,12 +3358,12 @@ bool make_attack_normal(MONSTER_IDX m_idx)
33583358 if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
33593359
33603360 /* Damage (stats) */
3361- if (do_dec_stat(A_STR)) obvious = TRUE;
3362- if (do_dec_stat(A_DEX)) obvious = TRUE;
3363- if (do_dec_stat(A_CON)) obvious = TRUE;
3364- if (do_dec_stat(A_INT)) obvious = TRUE;
3365- if (do_dec_stat(A_WIS)) obvious = TRUE;
3366- if (do_dec_stat(A_CHR)) obvious = TRUE;
3361+ if (do_dec_stat(p_ptr, A_STR)) obvious = TRUE;
3362+ if (do_dec_stat(p_ptr, A_DEX)) obvious = TRUE;
3363+ if (do_dec_stat(p_ptr, A_CON)) obvious = TRUE;
3364+ if (do_dec_stat(p_ptr, A_INT)) obvious = TRUE;
3365+ if (do_dec_stat(p_ptr, A_WIS)) obvious = TRUE;
3366+ if (do_dec_stat(p_ptr, A_CHR)) obvious = TRUE;
33673367
33683368 break;
33693369 }
--- a/src/patron.c
+++ b/src/patron.c
@@ -429,9 +429,9 @@ void gain_level_reward(int chosen_reward)
429429 msg_print(_("「下僕よ、余は汝に飽みたり。」", "'I grow tired of thee, mortal.'"));
430430
431431 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
432- do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
432+ do_dec_stat(p_ptr, chaos_stats[p_ptr->chaos_patron]);
433433 else
434- (void)do_dec_stat(randint0(6));
434+ (void)do_dec_stat(p_ptr, randint0(6));
435435 reward = _("能力値が下がった。", "decreasing a stat");
436436 break;
437437
--- a/src/player-damage.c
+++ b/src/player-damage.c
@@ -449,7 +449,7 @@ HIT_POINT acid_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura)
449449 {
450450 if ((!(double_resist || p_ptr->resist_acid)) &&
451451 one_in_(HURT_CHANCE))
452- (void)do_dec_stat(A_CHR);
452+ (void)do_dec_stat(p_ptr, A_CHR);
453453
454454 /* If any armor gets hit, defend the player */
455455 if (acid_minus_ac()) dam = (dam + 1) / 2;
@@ -499,7 +499,7 @@ HIT_POINT elec_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura)
499499 {
500500 if ((!(double_resist || p_ptr->resist_elec)) &&
501501 one_in_(HURT_CHANCE))
502- (void)do_dec_stat(A_DEX);
502+ (void)do_dec_stat(p_ptr, A_DEX);
503503 }
504504
505505 get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
@@ -547,7 +547,7 @@ HIT_POINT fire_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura)
547547 {
548548 if ((!(double_resist || p_ptr->resist_fire)) &&
549549 one_in_(HURT_CHANCE))
550- (void)do_dec_stat(A_STR);
550+ (void)do_dec_stat(p_ptr, A_STR);
551551 }
552552
553553 get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
@@ -594,7 +594,7 @@ HIT_POINT cold_dam(HIT_POINT dam, concptr kb_str, int monspell, bool aura)
594594 {
595595 if ((!(double_resist || p_ptr->resist_cold)) &&
596596 one_in_(HURT_CHANCE))
597- (void)do_dec_stat(A_STR);
597+ (void)do_dec_stat(p_ptr, A_STR);
598598 }
599599
600600 get_damage = take_hit(aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -2758,16 +2758,16 @@ bool set_stun(TIME_EFFECT v)
27582758
27592759 if (one_in_(3))
27602760 {
2761- if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
2762- if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
2761+ if (!p_ptr->sustain_int) (void)do_dec_stat(p_ptr, A_INT);
2762+ if (!p_ptr->sustain_wis) (void)do_dec_stat(p_ptr, A_WIS);
27632763 }
27642764 else if (one_in_(2))
27652765 {
2766- if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
2766+ if (!p_ptr->sustain_int) (void)do_dec_stat(p_ptr, A_INT);
27672767 }
27682768 else
27692769 {
2770- if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
2770+ if (!p_ptr->sustain_wis) (void)do_dec_stat(p_ptr, A_WIS);
27712771 }
27722772 }
27732773 if (p_ptr->special_defense & KATA_MASK)
@@ -2976,7 +2976,7 @@ bool set_cut(TIME_EFFECT v)
29762976 if (!p_ptr->sustain_chr)
29772977 {
29782978 msg_print(_("ひどい傷跡が残ってしまった。", "You have been horribly scarred."));
2979- do_dec_stat(A_CHR);
2979+ do_dec_stat(p_ptr, A_CHR);
29802980 }
29812981 }
29822982 }
@@ -3513,19 +3513,19 @@ static concptr desc_stat_neg[] =
35133513 /*
35143514 * Lose a "point"
35153515 */
3516-bool do_dec_stat(int stat)
3516+bool do_dec_stat(player_type *creature_ptr, int stat)
35173517 {
35183518 bool sust = FALSE;
35193519
35203520 /* Access the "sustain" */
35213521 switch (stat)
35223522 {
3523- case A_STR: if (p_ptr->sustain_str) sust = TRUE; break;
3524- case A_INT: if (p_ptr->sustain_int) sust = TRUE; break;
3525- case A_WIS: if (p_ptr->sustain_wis) sust = TRUE; break;
3526- case A_DEX: if (p_ptr->sustain_dex) sust = TRUE; break;
3527- case A_CON: if (p_ptr->sustain_con) sust = TRUE; break;
3528- case A_CHR: if (p_ptr->sustain_chr) sust = TRUE; break;
3523+ case A_STR: if (creature_ptr->sustain_str) sust = TRUE; break;
3524+ case A_INT: if (creature_ptr->sustain_int) sust = TRUE; break;
3525+ case A_WIS: if (creature_ptr->sustain_wis) sust = TRUE; break;
3526+ case A_DEX: if (creature_ptr->sustain_dex) sust = TRUE; break;
3527+ case A_CON: if (creature_ptr->sustain_con) sust = TRUE; break;
3528+ case A_CHR: if (creature_ptr->sustain_chr) sust = TRUE; break;
35293529 }
35303530
35313531 /* Sustain */
--- a/src/player-effects.h
+++ b/src/player-effects.h
@@ -61,7 +61,7 @@ extern bool inc_stat(int stat);
6161 extern bool dec_stat(int stat, int amount, int permanent);
6262 extern bool res_stat(int stat);
6363 extern bool hp_player(int num);
64-extern bool do_dec_stat(int stat);
64+extern bool do_dec_stat(player_type *creature_ptr, int stat);
6565 extern bool do_res_stat(int stat);
6666 extern bool do_inc_stat(int stat);
6767 extern bool restore_level(void);
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -5374,11 +5374,11 @@ void sanity_blast(monster_type *m_ptr, bool necro)
53745374 }
53755375
53765376 do {
5377- (void)do_dec_stat(A_INT);
5377+ (void)do_dec_stat(p_ptr, A_INT);
53785378 } while (randint0(100) > p_ptr->skill_sav && one_in_(2));
53795379
53805380 do {
5381- (void)do_dec_stat(A_WIS);
5381+ (void)do_dec_stat(p_ptr, A_WIS);
53825382 } while (randint0(100) > p_ptr->skill_sav && one_in_(2));
53835383
53845384 switch (randint1(21))
--- a/src/spells1.c
+++ b/src/spells1.c
@@ -4160,7 +4160,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
41604160
41614161 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
41624162 {
4163- do_dec_stat(A_CON);
4163+ do_dec_stat(p_ptr, A_CON);
41644164 }
41654165
41664166 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
@@ -4939,9 +4939,9 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
49394939 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
49404940
49414941 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4942- (void)do_dec_stat(A_INT);
4942+ (void)do_dec_stat(p_ptr, A_INT);
49434943 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4944- (void)do_dec_stat(A_WIS);
4944+ (void)do_dec_stat(p_ptr, A_WIS);
49454945
49464946 if (!p_ptr->resist_chaos)
49474947 {
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -2615,7 +2615,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
26152615 }
26162616 if (!one_in_(6)) break;
26172617 case 21: case 22: case 23:
2618- (void)do_dec_stat(randint0(6));
2618+ (void)do_dec_stat(p_ptr, randint0(6));
26192619 if (!one_in_(6)) break;
26202620 case 24:
26212621 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
@@ -2637,7 +2637,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
26372637 {
26382638 do
26392639 {
2640- (void)do_dec_stat(i);
2640+ (void)do_dec_stat(p_ptr, i);
26412641 }
26422642 while (one_in_(2));
26432643
@@ -3725,8 +3725,8 @@ void cast_shuffle(void)
37253725 else if (die < 26)
37263726 {
37273727 msg_print(_("《愚者》だ。", "It's the Fool."));
3728- do_dec_stat(A_INT);
3729- do_dec_stat(A_WIS);
3728+ do_dec_stat(p_ptr, A_INT);
3729+ do_dec_stat(p_ptr, A_WIS);
37303730 }
37313731 else if (die < 30)
37323732 {
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -3544,7 +3544,7 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
35443544 {
35453545 do
35463546 {
3547- (void)do_dec_stat(i);
3547+ (void)do_dec_stat(p_ptr, i);
35483548 } while (one_in_(2));
35493549
35503550 i++;
@@ -3552,7 +3552,7 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
35523552 }
35533553 else
35543554 {
3555- (void)do_dec_stat(randint0(6));
3555+ (void)do_dec_stat(p_ptr, randint0(6));
35563556 }
35573557 break;
35583558 }
--- a/src/trap.c
+++ b/src/trap.c
@@ -354,7 +354,7 @@ static void hit_trap_lose_stat(int stat)
354354 {
355355 if (hit_trap_dart())
356356 {
357- do_dec_stat(stat);
357+ do_dec_stat(p_ptr, stat);
358358 }
359359 }
360360
Show on old repository browser