3 * @brief プレイヤーの食べるコマンド実装
11 #include "object-hook.h"
13 #include "spells-status.h"
14 #include "realm-hex.h"
15 #include "player-status.h"
18 * @brief 食料を食べるコマンドのサブルーチン
19 * @param item 食べるオブジェクトの所持品ID
22 void do_cmd_eat_food_aux(INVENTORY_IDX item)
25 BIT_FLAGS inventory_flags;
28 if (music_singing_any()) stop_singing(p_ptr);
29 if (hex_spelling_any()) stop_hex_spell_all();
31 /* Get the item (in the pack) */
34 o_ptr = &inventory[item];
37 /* Get the item (on the floor) */
40 o_ptr = ¤t_floor_ptr->o_list[0 - item];
45 take_turn(p_ptr, 100);
47 /* Identity not known yet */
51 lev = k_info[o_ptr->k_idx].level;
53 if (o_ptr->tval == TV_FOOD)
55 /* Analyze the food */
60 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
62 if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
70 case SV_FOOD_BLINDNESS:
72 if (!p_ptr->resist_blind)
74 if (set_blind(p_ptr->blind + randint0(200) + 200))
82 case SV_FOOD_PARANOIA:
84 if (!p_ptr->resist_fear)
86 if (set_afraid(p_ptr->afraid + randint0(10) + 10))
94 case SV_FOOD_CONFUSION:
96 if (!p_ptr->resist_conf)
98 if (set_confused(p_ptr->confused + randint0(10) + 10))
106 case SV_FOOD_HALLUCINATION:
108 if (!p_ptr->resist_chaos)
110 if (set_image(p_ptr->image + randint0(250) + 250))
118 case SV_FOOD_PARALYSIS:
120 if (!p_ptr->free_act)
122 if (set_paralyzed(p_ptr->paralyzed + randint0(10) + 10))
130 case SV_FOOD_WEAKNESS:
132 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
133 (void)do_dec_stat(A_STR);
138 case SV_FOOD_SICKNESS:
140 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
141 (void)do_dec_stat(A_CON);
146 case SV_FOOD_STUPIDITY:
148 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
149 (void)do_dec_stat(A_INT);
154 case SV_FOOD_NAIVETY:
156 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
157 (void)do_dec_stat(A_WIS);
162 case SV_FOOD_UNHEALTH:
164 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
165 (void)do_dec_stat(A_CON);
170 case SV_FOOD_DISEASE:
172 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
173 (void)do_dec_stat(A_STR);
178 case SV_FOOD_CURE_POISON:
180 if (set_poisoned(0)) ident = TRUE;
184 case SV_FOOD_CURE_BLINDNESS:
186 if (set_blind(0)) ident = TRUE;
190 case SV_FOOD_CURE_PARANOIA:
192 if (set_afraid(0)) ident = TRUE;
196 case SV_FOOD_CURE_CONFUSION:
198 if (set_confused(0)) ident = TRUE;
202 case SV_FOOD_CURE_SERIOUS:
204 ident = cure_serious_wounds(4, 8);
208 case SV_FOOD_RESTORE_STR:
210 if (do_res_stat(A_STR)) ident = TRUE;
214 case SV_FOOD_RESTORE_CON:
216 if (do_res_stat(A_CON)) ident = TRUE;
220 case SV_FOOD_RESTORING:
222 ident = restore_all_status();
228 /* それぞれの食べ物の感想をオリジナルより細かく表現 */
229 case SV_FOOD_BISCUIT:
231 msg_print("甘くてサクサクしてとてもおいしい。");
238 msg_print("歯ごたえがあっておいしい。");
243 case SV_FOOD_SLIME_MOLD:
245 msg_print("これはなんとも形容しがたい味だ。");
252 msg_print("これはおいしい。");
258 case SV_FOOD_BISCUIT:
260 case SV_FOOD_SLIME_MOLD:
262 msg_print("That tastes good.");
269 case SV_FOOD_WAYBREAD:
271 msg_print(_("これはひじょうに美味だ。", "That tastes good."));
272 (void)set_poisoned(0);
273 (void)hp_player(damroll(4, 8));
279 case SV_FOOD_PINT_OF_ALE:
281 msg_print("のどごし爽やかだ。");
286 case SV_FOOD_PINT_OF_WINE:
288 msg_print("That tastes good.");
293 case SV_FOOD_PINT_OF_ALE:
294 case SV_FOOD_PINT_OF_WINE:
296 msg_print("That tastes good.");
305 * Store what may have to be updated for the inventory (including
306 * autodestroy if set by something else). Then turn off those flags
307 * so that updates triggered by calling gain_exp() or set_food() below
308 * do not rearrange the inventory before the food item is destroyed in
311 inventory_flags = (PU_COMBINE | PU_REORDER |
312 (p_ptr->update & PU_AUTODESTROY));
313 p_ptr->update &= ~(PU_COMBINE | PU_REORDER | PU_AUTODESTROY);
315 if (!(object_is_aware(o_ptr)))
317 chg_virtue(V_KNOWLEDGE, -1);
318 chg_virtue(V_PATIENCE, -1);
319 chg_virtue(V_CHANCE, 1);
322 /* We have tried it */
323 if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
325 /* The player is now aware of the object */
326 if (ident && !object_is_aware(o_ptr))
329 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
332 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
334 /* Food can feed the player */
335 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
337 /* Reduced nutritional benefit */
338 (void)set_food(p_ptr->food + (o_ptr->pval / 10));
339 msg_print(_("あなたのような者にとって食糧など僅かな栄養にしかならない。",
340 "Mere victuals hold scant sustenance for a being such as yourself."));
342 if (p_ptr->food < PY_FOOD_ALERT) /* Hungry */
343 msg_print(_("あなたの飢えは新鮮な血によってのみ満たされる!",
344 "Your hunger can only be satisfied with fresh blood!"));
346 else if ((prace_is_(RACE_SKELETON) ||
347 prace_is_(RACE_GOLEM) ||
348 prace_is_(RACE_ZOMBIE) ||
349 prace_is_(RACE_SPECTRE)) &&
350 (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
354 if (o_ptr->tval == TV_STAFF &&
355 (item < 0) && (o_ptr->number > 1))
357 p_ptr->update |= inventory_flags;
358 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
361 staff = (o_ptr->tval == TV_STAFF) ? _("杖", "staff") : _("魔法棒", "wand");
364 if (o_ptr->pval == 0)
366 msg_format(_("この%sにはもう魔力が残っていない。", "The %s has no charges left."), staff);
367 o_ptr->ident |= (IDENT_EMPTY);
368 p_ptr->update |= inventory_flags;
369 p_ptr->window |= (PW_INVEN);
373 msg_format(_("あなたは%sの魔力をエネルギー源として吸収した。", "You absorb mana of the %s as your energy."), staff);
375 /* Use a single charge */
379 set_food(p_ptr->food + 5000);
381 /* XXX Hack -- unstack if necessary */
382 if (o_ptr->tval == TV_STAFF &&
383 (item >= 0) && (o_ptr->number > 1))
389 /* Obtain a local object */
390 object_copy(q_ptr, o_ptr);
392 /* Modify quantity */
395 /* Restore the charges */
398 /* Unstack the used item */
400 p_ptr->total_weight -= q_ptr->weight;
401 item = inven_carry(q_ptr);
403 msg_format(_("杖をまとめなおした。", "You unstack your staff."));
406 /* Describe charges in the pack */
409 inven_item_charges(item);
412 /* Describe charges on the floor */
415 floor_item_charges(0 - item);
418 p_ptr->window |= (PW_INVEN | PW_EQUIP);
419 p_ptr->update |= inventory_flags;
421 /* Don't eat a staff/wand itself */
424 else if ((prace_is_(RACE_DEMON) ||
425 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
426 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
427 my_strchr("pht", r_info[o_ptr->pval].d_char)))
429 /* Drain vitality of humanoids */
430 GAME_TEXT o_name[MAX_NLEN];
431 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
432 msg_format(_("%sは燃え上り灰になった。精力を吸収した気がする。", "%^s is burnt to ashes. You absorb its vitality!"), o_name);
433 (void)set_food(PY_FOOD_MAX - 1);
435 else if (prace_is_(RACE_SKELETON))
438 if (o_ptr->tval == TV_SKELETON ||
439 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
441 msg_print(_("あなたは骨で自分の体を補った。", "Your body absorbs the bone."));
442 set_food(p_ptr->food + 5000);
447 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
448 (o_ptr->sval < SV_FOOD_BISCUIT)))
451 object_type *q_ptr = &forge;
453 msg_print(_("食べ物がアゴを素通りして落ちた!", "The food falls through your jaws!"));
454 object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
456 /* Drop the object from heaven */
457 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
461 msg_print(_("食べ物がアゴを素通りして落ち、消えた!", "The food falls through your jaws and vanishes!"));
464 else if (prace_is_(RACE_GOLEM) ||
465 prace_is_(RACE_ZOMBIE) ||
466 prace_is_(RACE_ENT) ||
467 prace_is_(RACE_DEMON) ||
468 prace_is_(RACE_ANDROID) ||
469 prace_is_(RACE_SPECTRE) ||
470 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
472 msg_print(_("生者の食物はあなたにとってほとんど栄養にならない。", "The food of mortals is poor sustenance for you."));
473 set_food(p_ptr->food + ((o_ptr->pval) / 20));
475 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
477 /* Waybread is always fully satisfying. */
478 set_food(MAX(p_ptr->food, PY_FOOD_MAX - 1));
482 /* Food can feed the player */
483 (void)set_food(p_ptr->food + o_ptr->pval);
486 p_ptr->update |= inventory_flags;
488 /* Destroy a food in the pack */
491 inven_item_increase(item, -1);
492 inven_item_describe(item);
493 inven_item_optimize(item);
496 /* Destroy a food on the floor */
499 floor_item_increase(0 - item, -1);
500 floor_item_describe(0 - item);
501 floor_item_optimize(0 - item);
507 * @brief 食料を食べるコマンドのメインルーチン /
508 * Eat some food (from the pack or floor)
511 void do_cmd_eat_food(void)
516 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
518 set_action(ACTION_NONE);
521 /* Restrict choices to food */
522 item_tester_hook = item_tester_hook_eatable;
524 q = _("どれを食べますか? ", "Eat which item? ");
525 s = _("食べ物がない。", "You have nothing to eat.");
527 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
530 do_cmd_eat_food_aux(item);