OSDN Git Service

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