OSDN Git Service

[Implement] #960 自己変容の薬を実装した (飲んだ場合のみ。割れた場合は未実装)
[hengbandforosx/hengbandosx.git] / src / object-use / quaff-execution.cpp
1 /*!
2  * @brief 薬を飲んだ時の各種効果処理
3  * @date 2020/07/04
4  * @author Hourier
5  * @todo 少し長い。switch/case文と効果処理を分離してもいいかも
6  */
7
8 #include "object-use/quaff-execution.h"
9 #include "birth/birth-stat.h"
10 #include "core/player-update-types.h"
11 #include "core/window-redrawer.h"
12 #include "game-option/birth-options.h"
13 #include "game-option/disturbance-options.h"
14 #include "inventory/inventory-object.h"
15 #include "main/sound-definitions-table.h"
16 #include "main/sound-of-music.h"
17 #include "mutation/mutation-investor-remover.h"
18 #include "object/object-broken.h"
19 #include "object/object-generator.h"
20 #include "object/object-info.h"
21 #include "object/object-kind.h"
22 #include "perception/object-perception.h"
23 #include "player-info/avatar.h"
24 #include "player-info/self-info.h"
25 #include "player-status/player-energy.h"
26 #include "player/attack-defense-types.h"
27 #include "player/digestion-processor.h"
28 #include "player/eldritch-horror.h"
29 #include "player/mimic-info-table.h"
30 #include "player/player-damage.h"
31 #include "player/player-status-flags.h"
32 #include "realm/realm-hex-numbers.h"
33 #include "spell-kind/spells-detection.h"
34 #include "spell-kind/spells-floor.h"
35 #include "spell-kind/spells-perception.h"
36 #include "spell-kind/spells-teleport.h"
37 #include "spell-realm/spells-hex.h"
38 #include "spell-realm/spells-song.h"
39 #include "spell/spells-status.h"
40 #include "status/bad-status-setter.h"
41 #include "status/base-status.h"
42 #include "status/body-improvement.h"
43 #include "status/buff-setter.h"
44 #include "status/element-resistance.h"
45 #include "status/experience.h"
46 #include "status/shape-changer.h"
47 #include "status/sight-setter.h"
48 #include "sv-definition/sv-potion-types.h"
49 #include "system/object-type-definition.h"
50 #include "system/player-type-definition.h"
51 #include "term/screen-processor.h"
52 #include "view/display-messages.h"
53
54 /*!
55  * @brief 酔っ払いの薬
56  * @param creature_ptr プレーヤーへの参照ポインタ
57  * @return カオス耐性があるかその他の一部確率でFALSE、それ以外はTRUE
58  */
59 static bool booze(player_type *creature_ptr)
60 {
61     bool ident = false;
62     if (creature_ptr->pclass != CLASS_MONK)
63         chg_virtue(creature_ptr, V_HARMONY, -1);
64     else if (!has_resist_conf(creature_ptr))
65         creature_ptr->special_attack |= ATTACK_SUIKEN;
66
67     if (!has_resist_conf(creature_ptr) && set_confused(creature_ptr, randint0(20) + 15)) {
68         ident = true;
69     }
70
71     if (has_resist_chaos(creature_ptr)) {
72         return ident;
73     }
74
75     if (one_in_(2) && set_image(creature_ptr, creature_ptr->image + randint0(150) + 150)) {
76         ident = true;
77     }
78
79     if (one_in_(13) && (creature_ptr->pclass != CLASS_MONK)) {
80         ident = true;
81         if (one_in_(3))
82             lose_all_info(creature_ptr);
83         else
84             wiz_dark(creature_ptr);
85
86         (void)teleport_player_aux(creature_ptr, 100, false, static_cast<teleport_flags>(TELEPORT_NONMAGICAL | TELEPORT_PASSIVE));
87         wiz_dark(creature_ptr);
88         msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));
89         msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing or how you got here!"));
90     }
91
92     return ident;
93 }
94
95 /*!
96  * @brief 爆発の薬の効果処理 / Fumble ramble
97  * @param creature_ptr プレーヤーへの参照ポインタ
98  * @return 常にTRUE
99  */
100 static bool detonation(player_type *creature_ptr)
101 {
102     msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
103     take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"));
104     (void)set_stun(creature_ptr, creature_ptr->stun + 75);
105     (void)set_cut(creature_ptr, creature_ptr->cut + 5000);
106     return TRUE;
107 }
108
109 /*!
110  * @brief 薬を飲むコマンドのサブルーチン /
111  * Quaff a potion (from the pack or the floor)
112  * @param creature_ptr プレーヤーへの参照ポインタ
113  * @param item 飲む薬オブジェクトの所持品ID
114  * @return なし
115  */
116 void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
117 {
118     object_type *o_ptr;
119     object_type forge;
120     object_type *q_ptr;
121
122     PlayerEnergy(creature_ptr).set_player_turn_energy(100);
123
124     if (creature_ptr->timewalk) {
125         if (flush_failure)
126             flush();
127
128         msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from the bottle."));
129         sound(SOUND_FAIL);
130         return;
131     }
132
133     if (music_singing_any(creature_ptr))
134         stop_singing(creature_ptr);
135
136     if (hex_spelling_any(creature_ptr) && !hex_spelling(creature_ptr, HEX_INHAIL))
137         stop_hex_spell_all(creature_ptr);
138
139     o_ptr = ref_item(creature_ptr, item);
140     q_ptr = &forge;
141     object_copy(q_ptr, o_ptr);
142     q_ptr->number = 1;
143     vary_item(creature_ptr, item, -1);
144     sound(SOUND_QUAFF);
145     bool ident = false;
146     DEPTH lev = k_info[q_ptr->k_idx].level;
147     if (q_ptr->tval == TV_POTION) {
148         switch (q_ptr->sval) {
149             /* 飲みごたえをオリジナルより細かく表現 */
150         case SV_POTION_WATER:
151             msg_print(_("口の中がさっぱりした。", "That was refreshing."));
152             msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
153             ident = true;
154             break;
155
156         case SV_POTION_APPLE_JUICE:
157             msg_print(_("甘くてサッパリとしていて、とてもおいしい。", "It's sweet, refreshing and very tasty."));
158             msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
159             ident = true;
160             break;
161
162         case SV_POTION_SLIME_MOLD:
163             msg_print(_("なんとも不気味な味だ。", "That was strange."));
164             msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
165             ident = true;
166             break;
167
168         case SV_POTION_SLOWNESS:
169             if (set_slow(creature_ptr, randint1(25) + 15, false))
170                 ident = true;
171             break;
172
173         case SV_POTION_SALT_WATER:
174             msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
175
176             if (!(is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ZOMBIE)
177                     || is_specific_player_race(creature_ptr, RACE_BALROG) || is_specific_player_race(creature_ptr, RACE_ANDROID)
178                     || is_specific_player_race(creature_ptr, RACE_SPECTRE) || (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))) {
179                 /* Only living creatures get thirsty */
180                 (void)set_food(creature_ptr, PY_FOOD_STARVE - 1);
181             }
182
183             (void)set_poisoned(creature_ptr, 0);
184             (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 4);
185             ident = true;
186             break;
187
188         case SV_POTION_POISON:
189             if (!(has_resist_pois(creature_ptr) || is_oppose_pois(creature_ptr))) {
190                 if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(15) + 10)) {
191                     ident = true;
192                 }
193             }
194             break;
195
196         case SV_POTION_BLINDNESS:
197             if (!has_resist_blind(creature_ptr)) {
198                 if (set_blind(creature_ptr, creature_ptr->blind + randint0(100) + 100)) {
199                     ident = true;
200                 }
201             }
202             break;
203
204         case SV_POTION_BOOZE:
205             ident = booze(creature_ptr);
206             break;
207
208         case SV_POTION_SLEEP:
209             if (!creature_ptr->free_act) {
210                 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
211
212                 if (ironman_nightmare) {
213                     msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
214
215                     /* Have some nightmares */
216                     sanity_blast(creature_ptr, NULL, false);
217                 }
218                 if (set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4)) {
219                     ident = true;
220                 }
221             }
222             break;
223
224         case SV_POTION_LOSE_MEMORIES:
225             if (!creature_ptr->hold_exp && (creature_ptr->exp > 0)) {
226                 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
227                 chg_virtue(creature_ptr, V_KNOWLEDGE, -5);
228
229                 lose_exp(creature_ptr, creature_ptr->exp / 4);
230                 ident = true;
231             }
232             break;
233
234         case SV_POTION_RUINATION:
235             msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
236             take_hit(creature_ptr, DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"));
237
238             (void)dec_stat(creature_ptr, A_DEX, 25, TRUE);
239             (void)dec_stat(creature_ptr, A_WIS, 25, TRUE);
240             (void)dec_stat(creature_ptr, A_CON, 25, TRUE);
241             (void)dec_stat(creature_ptr, A_STR, 25, TRUE);
242             (void)dec_stat(creature_ptr, A_CHR, 25, TRUE);
243             (void)dec_stat(creature_ptr, A_INT, 25, TRUE);
244             ident = true;
245             break;
246
247         case SV_POTION_DEC_STR:
248             if (do_dec_stat(creature_ptr, A_STR))
249                 ident = true;
250             break;
251
252         case SV_POTION_DEC_INT:
253             if (do_dec_stat(creature_ptr, A_INT))
254                 ident = true;
255             break;
256
257         case SV_POTION_DEC_WIS:
258             if (do_dec_stat(creature_ptr, A_WIS))
259                 ident = true;
260             break;
261
262         case SV_POTION_DEC_DEX:
263             if (do_dec_stat(creature_ptr, A_DEX))
264                 ident = true;
265             break;
266
267         case SV_POTION_DEC_CON:
268             if (do_dec_stat(creature_ptr, A_CON))
269                 ident = true;
270             break;
271
272         case SV_POTION_DEC_CHR:
273             if (do_dec_stat(creature_ptr, A_CHR))
274                 ident = true;
275             break;
276
277         case SV_POTION_DETONATIONS:
278             ident = detonation(creature_ptr);
279             break;
280
281         case SV_POTION_DEATH:
282             chg_virtue(creature_ptr, V_VITALITY, -1);
283             chg_virtue(creature_ptr, V_UNLIFE, 5);
284             msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
285             take_hit(creature_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"));
286             ident = true;
287             break;
288
289         case SV_POTION_INFRAVISION:
290             if (set_tim_infra(creature_ptr, creature_ptr->tim_infra + 100 + randint1(100), false)) {
291                 ident = true;
292             }
293             break;
294
295         case SV_POTION_DETECT_INVIS:
296             if (set_tim_invis(creature_ptr, creature_ptr->tim_invis + 12 + randint1(12), false)) {
297                 ident = true;
298             }
299             break;
300
301         case SV_POTION_SLOW_POISON:
302             if (set_poisoned(creature_ptr, creature_ptr->poisoned / 2))
303                 ident = true;
304             break;
305
306         case SV_POTION_CURE_POISON:
307             if (set_poisoned(creature_ptr, 0))
308                 ident = true;
309             break;
310
311         case SV_POTION_BOLDNESS:
312             if (set_afraid(creature_ptr, 0))
313                 ident = true;
314             break;
315
316         case SV_POTION_SPEED:
317             if (!creature_ptr->fast) {
318                 if (set_fast(creature_ptr, randint1(25) + 15, false))
319                     ident = true;
320             } else {
321                 (void)set_fast(creature_ptr, creature_ptr->fast + 5, false);
322             }
323             break;
324
325         case SV_POTION_RESIST_HEAT:
326             if (set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(10) + 10, false)) {
327                 ident = true;
328             }
329             break;
330
331         case SV_POTION_RESIST_COLD:
332             if (set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(10) + 10, false)) {
333                 ident = true;
334             }
335             break;
336
337         case SV_POTION_HEROISM:
338             ident = heroism(creature_ptr, 25);
339             break;
340
341         case SV_POTION_BESERK_STRENGTH:
342             ident = berserk(creature_ptr, randint1(25) + 25);
343             break;
344
345         case SV_POTION_CURE_LIGHT:
346             ident = cure_light_wounds(creature_ptr, 2, 8);
347             break;
348
349         case SV_POTION_CURE_SERIOUS:
350             ident = cure_serious_wounds(creature_ptr, 4, 8);
351             break;
352
353         case SV_POTION_CURE_CRITICAL:
354             ident = cure_critical_wounds(creature_ptr, damroll(6, 8));
355             break;
356
357         case SV_POTION_HEALING:
358             ident = cure_critical_wounds(creature_ptr, 300);
359             break;
360
361         case SV_POTION_STAR_HEALING:
362             ident = cure_critical_wounds(creature_ptr, 1200);
363             break;
364
365         case SV_POTION_LIFE:
366             ident = life_stream(creature_ptr, TRUE, TRUE);
367             break;
368
369         case SV_POTION_RESTORE_MANA:
370             ident = restore_mana(creature_ptr, TRUE);
371             break;
372
373         case SV_POTION_RESTORE_EXP:
374             if (restore_level(creature_ptr))
375                 ident = true;
376             break;
377
378         case SV_POTION_RES_STR:
379             if (do_res_stat(creature_ptr, A_STR))
380                 ident = true;
381             break;
382
383         case SV_POTION_RES_INT:
384             if (do_res_stat(creature_ptr, A_INT))
385                 ident = true;
386             break;
387
388         case SV_POTION_RES_WIS:
389             if (do_res_stat(creature_ptr, A_WIS))
390                 ident = true;
391             break;
392
393         case SV_POTION_RES_DEX:
394             if (do_res_stat(creature_ptr, A_DEX))
395                 ident = true;
396             break;
397
398         case SV_POTION_RES_CON:
399             if (do_res_stat(creature_ptr, A_CON))
400                 ident = true;
401             break;
402
403         case SV_POTION_RES_CHR:
404             if (do_res_stat(creature_ptr, A_CHR))
405                 ident = true;
406             break;
407
408         case SV_POTION_INC_STR:
409             if (do_inc_stat(creature_ptr, A_STR))
410                 ident = true;
411             break;
412
413         case SV_POTION_INC_INT:
414             if (do_inc_stat(creature_ptr, A_INT))
415                 ident = true;
416             break;
417
418         case SV_POTION_INC_WIS:
419             if (do_inc_stat(creature_ptr, A_WIS))
420                 ident = true;
421             break;
422
423         case SV_POTION_INC_DEX:
424             if (do_inc_stat(creature_ptr, A_DEX))
425                 ident = true;
426             break;
427
428         case SV_POTION_INC_CON:
429             if (do_inc_stat(creature_ptr, A_CON))
430                 ident = true;
431             break;
432
433         case SV_POTION_INC_CHR:
434             if (do_inc_stat(creature_ptr, A_CHR))
435                 ident = true;
436             break;
437
438         case SV_POTION_POLY_SELF:
439             do_poly_self(creature_ptr);
440             ident = true;
441             break;
442
443         case SV_POTION_AUGMENTATION:
444             if (do_inc_stat(creature_ptr, A_STR))
445                 ident = true;
446             if (do_inc_stat(creature_ptr, A_INT))
447                 ident = true;
448             if (do_inc_stat(creature_ptr, A_WIS))
449                 ident = true;
450             if (do_inc_stat(creature_ptr, A_DEX))
451                 ident = true;
452             if (do_inc_stat(creature_ptr, A_CON))
453                 ident = true;
454             if (do_inc_stat(creature_ptr, A_CHR))
455                 ident = true;
456             break;
457
458         case SV_POTION_ENLIGHTENMENT:
459             msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
460             chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
461             chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
462             wiz_lite(creature_ptr, false);
463             ident = true;
464             break;
465
466         case SV_POTION_STAR_ENLIGHTENMENT:
467             msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
468             chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
469             chg_virtue(creature_ptr, V_ENLIGHTEN, 2);
470             msg_print(NULL);
471             wiz_lite(creature_ptr, false);
472             (void)do_inc_stat(creature_ptr, A_INT);
473             (void)do_inc_stat(creature_ptr, A_WIS);
474             (void)detect_traps(creature_ptr, DETECT_RAD_DEFAULT, TRUE);
475             (void)detect_doors(creature_ptr, DETECT_RAD_DEFAULT);
476             (void)detect_stairs(creature_ptr, DETECT_RAD_DEFAULT);
477             (void)detect_treasure(creature_ptr, DETECT_RAD_DEFAULT);
478             (void)detect_objects_gold(creature_ptr, DETECT_RAD_DEFAULT);
479             (void)detect_objects_normal(creature_ptr, DETECT_RAD_DEFAULT);
480             identify_pack(creature_ptr);
481             self_knowledge(creature_ptr);
482             ident = true;
483             break;
484
485         case SV_POTION_SELF_KNOWLEDGE:
486             msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
487             msg_print(NULL);
488             self_knowledge(creature_ptr);
489             ident = true;
490             break;
491
492         case SV_POTION_EXPERIENCE:
493             if (creature_ptr->prace == RACE_ANDROID)
494                 break;
495             chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
496             if (creature_ptr->exp < PY_MAX_EXP) {
497                 EXP ee = (creature_ptr->exp / 2) + 10;
498                 if (ee > 100000L)
499                     ee = 100000L;
500                 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
501                 gain_exp(creature_ptr, ee);
502                 ident = true;
503             }
504             break;
505
506         case SV_POTION_RESISTANCE:
507             (void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid + randint1(20) + 20, false);
508             (void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec + randint1(20) + 20, false);
509             (void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(20) + 20, false);
510             (void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(20) + 20, false);
511             (void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois + randint1(20) + 20, false);
512             ident = true;
513             break;
514
515         case SV_POTION_CURING:
516             if (true_healing(creature_ptr, 50))
517                 ident = true;
518             break;
519
520         case SV_POTION_INVULNERABILITY:
521             (void)set_invuln(creature_ptr, creature_ptr->invuln + randint1(4) + 4, false);
522             ident = true;
523             break;
524
525         case SV_POTION_NEW_LIFE:
526             roll_hitdice(creature_ptr, SPOP_NONE);
527             get_max_stats(creature_ptr);
528             creature_ptr->update |= PU_BONUS;
529             lose_all_mutations(creature_ptr);
530             ident = true;
531             break;
532
533         case SV_POTION_NEO_TSUYOSHI:
534             (void)set_image(creature_ptr, 0);
535             (void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi + randint1(100) + 100, false);
536             ident = true;
537             break;
538
539         case SV_POTION_TSUYOSHI:
540             msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
541             msg_print(NULL);
542             creature_ptr->tsuyoshi = 1;
543             (void)set_tsuyoshi(creature_ptr, 0, TRUE);
544             if (!has_resist_chaos(creature_ptr)) {
545                 (void)set_image(creature_ptr, 50 + randint1(50));
546             }
547             ident = true;
548             break;
549
550         case SV_POTION_POLYMORPH:
551             if (creature_ptr->muta.any() && one_in_(23)) {
552                 lose_all_mutations(creature_ptr);
553             } else {
554                 do {
555                     if (one_in_(2)) {
556                         if (gain_mutation(creature_ptr, 0))
557                             ident = true;
558                     } else if (lose_mutation(creature_ptr, 0))
559                         ident = true;
560                 } while (!ident || one_in_(2));
561             }
562             break;
563         }
564     }
565
566     if (is_specific_player_race(creature_ptr, RACE_SKELETON)) {
567         msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
568         (void)potion_smash_effect(creature_ptr, 0, creature_ptr->y, creature_ptr->x, q_ptr->k_idx);
569     }
570     creature_ptr->update |= (PU_COMBINE | PU_REORDER);
571
572     if (!(object_is_aware(q_ptr))) {
573         chg_virtue(creature_ptr, V_PATIENCE, -1);
574         chg_virtue(creature_ptr, V_CHANCE, 1);
575         chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
576     }
577
578     /* The item has been tried */
579     object_tried(q_ptr);
580
581     /* An identification was made */
582     if (ident && !object_is_aware(q_ptr)) {
583         object_aware(creature_ptr, q_ptr);
584         gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
585     }
586
587     creature_ptr->window_flags |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
588
589     /* Potions can feed the player */
590     switch (creature_ptr->mimic_form) {
591     case MIMIC_NONE:
592         switch (creature_ptr->prace) {
593         case RACE_VAMPIRE:
594             (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
595             break;
596         case RACE_SKELETON:
597             /* Do nothing */
598             break;
599         case RACE_GOLEM:
600         case RACE_ZOMBIE:
601         case RACE_BALROG:
602         case RACE_SPECTRE:
603             set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
604             break;
605         case RACE_ANDROID:
606             if (q_ptr->tval == TV_FLASK) {
607                 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
608                 set_food(creature_ptr, creature_ptr->food + 5000);
609             } else {
610                 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
611             }
612             break;
613         case RACE_ENT:
614             msg_print(_("水分を取り込んだ。", "You are moistened."));
615             set_food(creature_ptr, MIN(creature_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
616             break;
617         default:
618             (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);
619             break;
620         }
621         break;
622     case MIMIC_DEMON:
623     case MIMIC_DEMON_LORD:
624         set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
625         break;
626     case MIMIC_VAMPIRE:
627         (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
628         break;
629     default:
630         (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);
631         break;
632     }
633 }