OSDN Git Service

[Refactor] #40413 Separated display-messages.c/h from util.c/h
[hengband/hengband.git] / src / spell / spells-status.c
1 /*!
2  * @brief スピード等のステータスに影響のある魔法の処理
3  * @date 2019/01/22
4  * @author deskull
5  */
6
7 #include "spell/spells-status.h"
8 #include "cmd-action/cmd-spell.h"
9 #include "cmd-item/cmd-magiceat.h"
10 #include "core/stuff-handler.h"
11 #include "effect/effect-characteristics.h"
12 #include "floor/floor-object.h"
13 #include "inventory/inventory-object.h"
14 #include "io/targeting.h"
15 #include "mind/mind-force-trainer.h"
16 #include "monster/monster-describer.h"
17 #include "object/object-flavor.h"
18 #include "object/object-generator.h"
19 #include "object/object-kind-hook.h"
20 #include "object/object-kind.h"
21 #include "player/avatar.h"
22 #include "player/player-class.h"
23 #include "player/player-effects.h"
24 #include "player/player-status.h"
25 #include "spell-kind/spells-launcher.h"
26 #include "spell-kind/spells-teleport.h"
27 #include "spell/spell-types.h"
28 #include "view/display-main-window.h"
29 #include "view/display-messages.h"
30
31 /*!
32  * @brief モンスター回復処理
33  * @param caster_ptr プレーヤーへの参照ポインタ
34  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
35  * @param dam 威力
36  * @return 作用が実際にあった場合TRUEを返す
37  */
38 bool heal_monster(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
39 {
40         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
41         return (project_hook(caster_ptr, GF_OLD_HEAL, dir, dam, flg));
42 }
43
44
45 /*!
46  * @brief モンスター加速処理
47  * @param caster_ptr プレーヤーへの参照ポインタ
48  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
49  * @param power 効力
50  * @return 作用が実際にあった場合TRUEを返す
51  */
52 bool speed_monster(player_type *caster_ptr, DIRECTION dir, int power)
53 {
54         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
55         return (project_hook(caster_ptr, GF_OLD_SPEED, dir, power, flg));
56 }
57
58
59 /*!
60  * @brief モンスター減速処理
61  * @param caster_ptr プレーヤーへの参照ポインタ
62  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
63  * @param power 効力
64  * @return 作用が実際にあった場合TRUEを返す
65  */
66 bool slow_monster(player_type *caster_ptr, DIRECTION dir, int power)
67 {
68         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
69         return (project_hook(caster_ptr, GF_OLD_SLOW, dir, power, flg));
70 }
71
72
73 /*!
74  * @brief モンスター催眠処理
75  * @param caster_ptr プレーヤーへの参照ポインタ
76  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
77  * @param power 効力
78  * @return 作用が実際にあった場合TRUEを返す
79  */
80 bool sleep_monster(player_type *caster_ptr, DIRECTION dir, int power)
81 {
82         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
83         return (project_hook(caster_ptr, GF_OLD_SLEEP, dir, power, flg));
84 }
85
86
87 /*!
88  * @brief モンスター拘束(STASIS)処理
89  * @param caster_ptr プレーヤーへの参照ポインタ
90  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
91  * @return 作用が実際にあった場合TRUEを返す
92  * @details 威力はプレイヤーレベル*2に固定
93  */
94 bool stasis_monster(player_type *caster_ptr, DIRECTION dir)
95 {
96         return (fire_ball_hide(caster_ptr, GF_STASIS, dir, caster_ptr->lev * 2, 0));
97 }
98
99
100 /*!
101  * @brief 邪悪なモンスター拘束(STASIS)処理
102  * @param caster_ptr プレーヤーへの参照ポインタ
103  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
104  * @return 作用が実際にあった場合TRUEを返す
105  * @details 威力はプレイヤーレベル*2に固定
106  */
107 bool stasis_evil(player_type *caster_ptr, DIRECTION dir)
108 {
109         return (fire_ball_hide(caster_ptr, GF_STASIS_EVIL, dir, caster_ptr->lev * 2, 0));
110 }
111
112
113 /*!
114  * @brief モンスター混乱処理
115  * @param caster_ptr プレーヤーへの参照ポインタ
116  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
117  * @param plev プレイヤーレベル(=効力)
118  * @return 作用が実際にあった場合TRUEを返す
119  */
120 bool confuse_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
121 {
122         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
123         return (project_hook(caster_ptr, GF_OLD_CONF, dir, plev, flg));
124 }
125
126
127 /*!
128  * @brief モンスター朦朧処理
129  * @param caster_ptr プレーヤーへの参照ポインタ
130  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
131  * @param plev プレイヤーレベル(=効力)
132  * @return 作用が実際にあった場合TRUEを返す
133  */
134 bool stun_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
135 {
136         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
137         return (project_hook(caster_ptr, GF_STUN, dir, plev, flg));
138 }
139
140
141 /*!
142  * @brief チェンジモンスター処理
143  * @param caster_ptr プレーヤーへの参照ポインタ
144  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
145  * @param power 効力
146  * @return 作用が実際にあった場合TRUEを返す
147  */
148 bool poly_monster(player_type *caster_ptr, DIRECTION dir, int power)
149 {
150         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
151         bool tester = (project_hook(caster_ptr, GF_OLD_POLY, dir, power, flg));
152         if (tester)
153                 chg_virtue(caster_ptr, V_CHANCE, 1);
154         return(tester);
155 }
156
157
158 /*!
159  * @brief クローンモンスター処理
160  * @param caster_ptr プレーヤーへの参照ポインタ
161  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
162  * @return 作用が実際にあった場合TRUEを返す
163  */
164 bool clone_monster(player_type *caster_ptr, DIRECTION dir)
165 {
166         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
167         return (project_hook(caster_ptr, GF_OLD_CLONE, dir, 0, flg));
168 }
169
170
171 /*!
172  * @brief モンスター恐慌処理
173  * @param caster_ptr プレーヤーへの参照ポインタ
174  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
175  * @param plev プレイヤーレベル(=効力)
176  * @return 作用が実際にあった場合TRUEを返す
177  */
178 bool fear_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
179 {
180         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
181         return (project_hook(caster_ptr, GF_TURN_ALL, dir, plev, flg));
182 }
183
184
185 bool time_walk(player_type *creature_ptr)
186 {
187         if (creature_ptr->timewalk)
188         {
189                 msg_print(_("既に時は止まっている。", "Time is already stopped."));
190                 return FALSE;
191         }
192
193         creature_ptr->timewalk = TRUE;
194         msg_print(_("「時よ!」", "You yell 'Time!'"));
195 //      msg_print(_("「『ザ・ワールド』!時は止まった!」", "You yell 'The World! Time has stopped!'"));
196         msg_print(NULL);
197
198         creature_ptr->energy_need -= 1000 + (100 + creature_ptr->csp - 50)*TURNS_PER_TICK / 10;
199         creature_ptr->redraw |= (PR_MAP);
200         creature_ptr->update |= (PU_MONSTERS);
201         creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
202         handle_stuff(creature_ptr);
203         return TRUE;
204 }
205
206
207 /*!
208  * @brief プレイヤーのヒットダイスを振る / Role Hitpoints
209  * @param creature_ptr プレーヤーへの参照ポインタ
210  * @param options スペル共通オプション
211  * @return なし
212  */
213 void roll_hitdice(player_type *creature_ptr, spell_operation options)
214 {
215         HIT_POINT min_value = creature_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (creature_ptr->hitdie + 1)) * 3 / 8;
216         HIT_POINT max_value = creature_ptr->hitdie + ((PY_MAX_LEVEL + 2) * (creature_ptr->hitdie + 1)) * 5 / 8;
217
218         /* Rerate */
219         while (TRUE)
220         {
221                 /* Pre-calculate level 1 hitdice */
222                 creature_ptr->player_hp[0] = (HIT_POINT)creature_ptr->hitdie;
223
224                 for (int i = 1; i < 4; i++)
225                 {
226                         creature_ptr->player_hp[0] += randint1(creature_ptr->hitdie);
227                 }
228
229                 /* Roll the hitpoint values */
230                 for (int i = 1; i < PY_MAX_LEVEL; i++)
231                 {
232                         creature_ptr->player_hp[i] = creature_ptr->player_hp[i - 1] + randint1(creature_ptr->hitdie);
233                 }
234
235                 /* Require "valid" hitpoints at highest level */
236                 if ((creature_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) &&
237                         (creature_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break;
238         }
239
240         PERCENTAGE percent = (int)(((long)creature_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
241                 (2 * creature_ptr->hitdie + ((PY_MAX_LEVEL - 1 + 3) * (creature_ptr->hitdie + 1))));
242
243         /* Update and redraw hitpoints */
244         creature_ptr->update |= (PU_HP);
245         creature_ptr->redraw |= (PR_HP);
246         creature_ptr->window |= (PW_PLAYER);
247
248         if (!(options & SPOP_NO_UPDATE)) handle_stuff(creature_ptr);
249
250         if (!(options & SPOP_DISPLAY_MES)) return;
251
252         if (options & SPOP_DEBUG)
253         {
254                 msg_format(_("現在の体力ランクは %d/100 です。", "Your life rate is %d/100 now."), percent);
255                 creature_ptr->knowledge |= KNOW_HPRATE;
256                 return;
257         }
258
259         msg_print(_("体力ランクが変わった。", "Life rate is changed."));
260         creature_ptr->knowledge &= ~(KNOW_HPRATE);
261 }
262
263
264 bool life_stream(player_type *creature_ptr, bool message, bool virtue_change)
265 {
266         if (virtue_change)
267         {
268                 chg_virtue(creature_ptr, V_VITALITY, 1);
269                 chg_virtue(creature_ptr, V_UNLIFE, -5);
270         }
271
272         if (message)
273         {
274                 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
275         }
276
277         restore_level(creature_ptr);
278         (void)set_poisoned(creature_ptr, 0);
279         (void)set_blind(creature_ptr, 0);
280         (void)set_confused(creature_ptr, 0);
281         (void)set_image(creature_ptr, 0);
282         (void)set_stun(creature_ptr, 0);
283         (void)set_cut(creature_ptr,0);
284         (void)restore_all_status(creature_ptr);
285         (void)set_shero(creature_ptr, 0, TRUE);
286         handle_stuff(creature_ptr);
287         hp_player(creature_ptr, 5000);
288
289         return TRUE;
290 }
291
292
293 bool heroism(player_type *creature_ptr, int base)
294 {
295         bool ident = FALSE;
296         if (set_afraid(creature_ptr, 0)) ident = TRUE;
297         if (set_hero(creature_ptr, creature_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
298         if (hp_player(creature_ptr, 10)) ident = TRUE;
299         return ident;
300 }
301
302
303 bool berserk(player_type *creature_ptr, int base)
304 {
305         bool ident = FALSE;
306         if (set_afraid(creature_ptr, 0)) ident = TRUE;
307         if (set_shero(creature_ptr, creature_ptr->shero + randint1(base) + base, FALSE)) ident = TRUE;
308         if (hp_player(creature_ptr, 30)) ident = TRUE;
309         return ident;
310 }
311
312
313 bool cure_light_wounds(player_type *creature_ptr, DICE_NUMBER dice, DICE_SID sides)
314 {
315         bool ident = FALSE;
316         if (hp_player(creature_ptr, damroll(dice, sides))) ident = TRUE;
317         if (set_blind(creature_ptr, 0)) ident = TRUE;
318         if (set_cut(creature_ptr,creature_ptr->cut - 10)) ident = TRUE;
319         if (set_shero(creature_ptr, 0, TRUE)) ident = TRUE;
320         return ident;
321 }
322
323
324 bool cure_serious_wounds(player_type *creature_ptr, DICE_NUMBER dice, DICE_SID sides)
325 {
326         bool ident = FALSE;
327         if (hp_player(creature_ptr, damroll(dice, sides))) ident = TRUE;
328         if (set_blind(creature_ptr, 0)) ident = TRUE;
329         if (set_confused(creature_ptr, 0)) ident = TRUE;
330         if (set_cut(creature_ptr,(creature_ptr->cut / 2) - 50)) ident = TRUE;
331         if (set_shero(creature_ptr, 0, TRUE)) ident = TRUE;
332         return ident;
333 }
334
335
336 bool cure_critical_wounds(player_type *creature_ptr, HIT_POINT pow)
337 {
338         bool ident = FALSE;
339         if (hp_player(creature_ptr, pow)) ident = TRUE;
340         if (set_blind(creature_ptr, 0)) ident = TRUE;
341         if (set_confused(creature_ptr, 0)) ident = TRUE;
342         if (set_poisoned(creature_ptr, 0)) ident = TRUE;
343         if (set_stun(creature_ptr, 0)) ident = TRUE;
344         if (set_cut(creature_ptr,0)) ident = TRUE;
345         if (set_shero(creature_ptr, 0, TRUE)) ident = TRUE;
346         return ident;
347 }
348
349
350 bool true_healing(player_type *creature_ptr, HIT_POINT pow)
351 {
352         bool ident = FALSE;
353         if (hp_player(creature_ptr, pow)) ident = TRUE;
354         if (set_blind(creature_ptr, 0)) ident = TRUE;
355         if (set_confused(creature_ptr, 0)) ident = TRUE;
356         if (set_poisoned(creature_ptr, 0)) ident = TRUE;
357         if (set_stun(creature_ptr, 0)) ident = TRUE;
358         if (set_cut(creature_ptr,0)) ident = TRUE;
359         if (set_image(creature_ptr, 0)) ident = TRUE;
360         return ident;
361 }
362
363
364 bool restore_mana(player_type *creature_ptr, bool magic_eater)
365 {
366         if (creature_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
367         {
368                 int i;
369                 for (i = 0; i < EATER_EXT * 2; i++)
370                 {
371                         creature_ptr->magic_num1[i] += (creature_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : creature_ptr->magic_num2[i] * EATER_CHARGE / 3;
372                         if (creature_ptr->magic_num1[i] > creature_ptr->magic_num2[i] * EATER_CHARGE) creature_ptr->magic_num1[i] = creature_ptr->magic_num2[i] * EATER_CHARGE;
373                 }
374
375                 for (; i < EATER_EXT * 3; i++)
376                 {
377                         KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
378                         creature_ptr->magic_num1[i] -= ((creature_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : creature_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
379                         if (creature_ptr->magic_num1[i] < 0) creature_ptr->magic_num1[i] = 0;
380                 }
381
382                 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
383                 creature_ptr->window |= (PW_PLAYER);
384                 return TRUE;
385         }
386         
387         if (creature_ptr->csp >= creature_ptr->msp) return FALSE;
388
389         creature_ptr->csp = creature_ptr->msp;
390         creature_ptr->csp_frac = 0;
391         msg_print(_("頭がハッキリとした。", "You feel your head clear."));
392         creature_ptr->redraw |= (PR_MANA);
393         creature_ptr->window |= (PW_PLAYER);
394         creature_ptr->window |= (PW_SPELL);
395         return TRUE;
396 }
397
398
399 bool restore_all_status(player_type *creature_ptr)
400 {
401         bool ident = FALSE;
402         if (do_res_stat(creature_ptr, A_STR)) ident = TRUE;
403         if (do_res_stat(creature_ptr, A_INT)) ident = TRUE;
404         if (do_res_stat(creature_ptr, A_WIS)) ident = TRUE;
405         if (do_res_stat(creature_ptr, A_DEX)) ident = TRUE;
406         if (do_res_stat(creature_ptr, A_CON)) ident = TRUE;
407         if (do_res_stat(creature_ptr, A_CHR)) ident = TRUE;
408         return ident;
409 }
410
411
412 bool fishing(player_type *creature_ptr)
413 {
414         DIRECTION dir;
415         if (!get_direction(creature_ptr, &dir, FALSE, FALSE)) return FALSE;
416         POSITION y = creature_ptr->y + ddy[dir];
417         POSITION x = creature_ptr->x + ddx[dir];
418         creature_ptr->fishing_dir = dir;
419         if (!cave_have_flag_bold(creature_ptr->current_floor_ptr, y, x, FF_WATER))
420         {
421                 msg_print(_("そこは水辺ではない。", "There is no fishing place."));
422                 return FALSE;
423         }
424         
425         if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
426         {
427                 GAME_TEXT m_name[MAX_NLEN];
428                 monster_desc(creature_ptr, m_name, &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[y][x].m_idx], 0);
429                 msg_format(_("%sが邪魔だ!", "%^s is standing in your way."), m_name);
430                 free_turn(creature_ptr);
431                 return FALSE;
432         }
433
434         set_action(creature_ptr, ACTION_FISH);
435         creature_ptr->redraw |= (PR_STATE);
436         return TRUE;
437 }
438
439
440 bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
441 {
442         /* Cast off activated item */
443         INVENTORY_IDX inv;
444         for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
445         {
446                 if (o_ptr == &creature_ptr->inventory_list[inv]) break;
447         }
448
449         if (inv > INVEN_FEET) return FALSE;
450
451         object_type forge;
452         object_copy(&forge, o_ptr);
453         inven_item_increase(creature_ptr, inv, (0 - o_ptr->number));
454         inven_item_optimize(creature_ptr, inv);
455         OBJECT_IDX o_idx = drop_near(creature_ptr, &forge, 0, creature_ptr->y, creature_ptr->x);
456         o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
457
458         GAME_TEXT o_name[MAX_NLEN];
459         object_desc(creature_ptr, o_name, o_ptr, OD_NAME_ONLY);
460         msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
461
462         /* Get effects */
463         msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
464         int t = 20 + randint1(20);
465         (void)set_blind(creature_ptr, creature_ptr->blind + t);
466         (void)set_afraid(creature_ptr, 0);
467         (void)set_tim_esp(creature_ptr, creature_ptr->tim_esp + t, FALSE);
468         (void)set_tim_regen(creature_ptr, creature_ptr->tim_regen + t, FALSE);
469         (void)set_hero(creature_ptr, creature_ptr->hero + t, FALSE);
470         (void)set_blessed(creature_ptr, creature_ptr->blessed + t, FALSE);
471         (void)set_fast(creature_ptr, creature_ptr->fast + t, FALSE);
472         (void)set_shero(creature_ptr, creature_ptr->shero + t, FALSE);
473         if (creature_ptr->pclass == CLASS_FORCETRAINER)
474         {
475                 set_current_ki(creature_ptr, TRUE, creature_ptr->lev * 5 + 190);
476                 msg_print(_("気が爆発寸前になった。", "Your force absorbs the explosion."));
477         }
478
479         return TRUE;
480 }
481
482
483 /*!
484  * @brief プレイヤーの因果混乱処理 / Apply Nexus
485  * @param m_ptr 因果混乱をプレイヤーに与えたモンスターの情報参照ポインタ
486  * @return なし
487  */
488 void apply_nexus(monster_type *m_ptr, player_type *target_ptr)
489 {
490         switch (randint1(7))
491         {
492         case 1: case 2: case 3:
493         {
494                 teleport_player(target_ptr, 200, TELEPORT_PASSIVE);
495                 break;
496         }
497
498         case 4: case 5:
499         {
500                 teleport_player_to(target_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
501                 break;
502         }
503
504         case 6:
505         {
506                 if (randint0(100) < target_ptr->skill_sav)
507                 {
508                         msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
509                         break;
510                 }
511
512                 teleport_level(target_ptr, 0);
513                 break;
514         }
515
516         case 7:
517         {
518                 if (randint0(100) < target_ptr->skill_sav)
519                 {
520                         msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
521                         break;
522                 }
523
524                 msg_print(_("体がねじれ始めた...", "Your body starts to scramble..."));
525                 status_shuffle(target_ptr);
526                 break;
527         }
528         }
529 }
530
531
532 /*!
533  * @brief プレイヤーのステータスシャッフル処理
534  * @param creature_ptr プレーヤーへの参照ポインタ
535  * @return なし
536  */
537 void status_shuffle(player_type *creature_ptr)
538 {
539         /* Pick a pair of stats */
540         int i = randint0(A_MAX);
541         int j;
542
543         // todo ここのループは一体何をしている?
544         for (j = i; j == i; j = randint0(A_MAX)) /* loop */;
545
546         BASE_STATUS max1 = creature_ptr->stat_max[i];
547         BASE_STATUS cur1 = creature_ptr->stat_cur[i];
548         BASE_STATUS max2 = creature_ptr->stat_max[j];
549         BASE_STATUS cur2 = creature_ptr->stat_cur[j];
550
551         creature_ptr->stat_max[i] = max2;
552         creature_ptr->stat_cur[i] = cur2;
553         creature_ptr->stat_max[j] = max1;
554         creature_ptr->stat_cur[j] = cur1;
555
556         for (int k = 0; k < A_MAX; k++)
557         {
558                 if (creature_ptr->stat_max[k] > creature_ptr->stat_max_max[k]) creature_ptr->stat_max[k] = creature_ptr->stat_max_max[k];
559                 if (creature_ptr->stat_cur[k] > creature_ptr->stat_max_max[k]) creature_ptr->stat_cur[k] = creature_ptr->stat_max_max[k];
560         }
561
562         creature_ptr->update |= PU_BONUS;
563 }