3 * @brief プレイヤーの食べるコマンド実装
13 #include "object-flavor.h"
14 #include "object-hook.h"
16 #include "spells-status.h"
17 #include "realm-hex.h"
18 #include "player-status.h"
19 #include "player-effects.h"
20 #include "player-race.h"
22 #include "objectkind.h"
25 * @brief 食料を食べるコマンドのサブルーチン
26 * @param item 食べるオブジェクトの所持品ID
29 void do_cmd_eat_food_aux(INVENTORY_IDX item)
34 if (music_singing_any()) stop_singing(p_ptr);
35 if (hex_spelling_any()) stop_hex_spell_all();
37 /* Get the item (in the pack) */
40 o_ptr = &p_ptr->inventory_list[item];
43 /* Get the item (on the floor) */
46 o_ptr = ¤t_floor_ptr->o_list[0 - item];
51 take_turn(p_ptr, 100);
53 /* Identity not known yet */
57 lev = k_info[o_ptr->k_idx].level;
59 if (o_ptr->tval == TV_FOOD)
61 /* Analyze the food */
66 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
68 if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
76 case SV_FOOD_BLINDNESS:
78 if (!p_ptr->resist_blind)
80 if (set_blind(p_ptr->blind + randint0(200) + 200))
88 case SV_FOOD_PARANOIA:
90 if (!p_ptr->resist_fear)
92 if (set_afraid(p_ptr->afraid + randint0(10) + 10))
100 case SV_FOOD_CONFUSION:
102 if (!p_ptr->resist_conf)
104 if (set_confused(p_ptr->confused + randint0(10) + 10))
112 case SV_FOOD_HALLUCINATION:
114 if (!p_ptr->resist_chaos)
116 if (set_image(p_ptr->image + randint0(250) + 250))
124 case SV_FOOD_PARALYSIS:
126 if (!p_ptr->free_act)
128 if (set_paralyzed(p_ptr->paralyzed + randint0(10) + 10))
136 case SV_FOOD_WEAKNESS:
138 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
139 (void)do_dec_stat(A_STR);
144 case SV_FOOD_SICKNESS:
146 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
147 (void)do_dec_stat(A_CON);
152 case SV_FOOD_STUPIDITY:
154 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
155 (void)do_dec_stat(A_INT);
160 case SV_FOOD_NAIVETY:
162 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
163 (void)do_dec_stat(A_WIS);
168 case SV_FOOD_UNHEALTH:
170 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
171 (void)do_dec_stat(A_CON);
176 case SV_FOOD_DISEASE:
178 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
179 (void)do_dec_stat(A_STR);
184 case SV_FOOD_CURE_POISON:
186 if (set_poisoned(0)) ident = TRUE;
190 case SV_FOOD_CURE_BLINDNESS:
192 if (set_blind(0)) ident = TRUE;
196 case SV_FOOD_CURE_PARANOIA:
198 if (set_afraid(0)) ident = TRUE;
202 case SV_FOOD_CURE_CONFUSION:
204 if (set_confused(0)) ident = TRUE;
208 case SV_FOOD_CURE_SERIOUS:
210 ident = cure_serious_wounds(4, 8);
214 case SV_FOOD_RESTORE_STR:
216 if (do_res_stat(A_STR)) ident = TRUE;
220 case SV_FOOD_RESTORE_CON:
222 if (do_res_stat(A_CON)) ident = TRUE;
226 case SV_FOOD_RESTORING:
228 ident = restore_all_status();
234 /* それぞれの食べ物の感想をオリジナルより細かく表現 */
235 case SV_FOOD_BISCUIT:
237 msg_print("甘くてサクサクしてとてもおいしい。");
244 msg_print("歯ごたえがあっておいしい。");
249 case SV_FOOD_SLIME_MOLD:
251 msg_print("これはなんとも形容しがたい味だ。");
258 msg_print("これはおいしい。");
264 case SV_FOOD_BISCUIT:
266 case SV_FOOD_SLIME_MOLD:
268 msg_print("That tastes good.");
275 case SV_FOOD_WAYBREAD:
277 msg_print(_("これはひじょうに美味だ。", "That tastes good."));
278 (void)set_poisoned(0);
279 (void)hp_player(damroll(4, 8));
285 case SV_FOOD_PINT_OF_ALE:
287 msg_print("のどごし爽やかだ。");
292 case SV_FOOD_PINT_OF_WINE:
294 msg_print("That tastes good.");
299 case SV_FOOD_PINT_OF_ALE:
300 case SV_FOOD_PINT_OF_WINE:
302 msg_print("That tastes good.");
310 p_ptr->update |= (PU_COMBINE | PU_REORDER);
312 if (!(object_is_aware(o_ptr)))
314 chg_virtue(V_KNOWLEDGE, -1);
315 chg_virtue(V_PATIENCE, -1);
316 chg_virtue(V_CHANCE, 1);
319 /* We have tried it */
320 if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
322 /* The player is now aware of the object */
323 if (ident && !object_is_aware(o_ptr))
326 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
329 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
332 /* Food can feed the player */
333 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
335 /* Reduced nutritional benefit */
336 (void)set_food(p_ptr->food + (o_ptr->pval / 10));
337 msg_print(_("あなたのような者にとって食糧など僅かな栄養にしかならない。",
338 "Mere victuals hold scant sustenance for a being such as yourself."));
340 if (p_ptr->food < PY_FOOD_ALERT) /* Hungry */
341 msg_print(_("あなたの飢えは新鮮な血によってのみ満たされる!",
342 "Your hunger can only be satisfied with fresh blood!"));
344 else if ((prace_is_(RACE_SKELETON) ||
345 prace_is_(RACE_GOLEM) ||
346 prace_is_(RACE_ZOMBIE) ||
347 prace_is_(RACE_SPECTRE)) &&
348 (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
352 if (o_ptr->tval == TV_STAFF &&
353 (item < 0) && (o_ptr->number > 1))
355 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
358 staff = (o_ptr->tval == TV_STAFF) ? _("杖", "staff") : _("魔法棒", "wand");
361 if (o_ptr->pval == 0)
363 msg_format(_("この%sにはもう魔力が残っていない。", "The %s has no charges left."), staff);
364 o_ptr->ident |= (IDENT_EMPTY);
365 p_ptr->update |= (PU_COMBINE | PU_REORDER);
366 p_ptr->window |= (PW_INVEN);
370 msg_format(_("あなたは%sの魔力をエネルギー源として吸収した。", "You absorb mana of the %s as your energy."), staff);
372 /* Use a single charge */
376 set_food(p_ptr->food + 5000);
378 /* XXX Hack -- unstack if necessary */
379 if (o_ptr->tval == TV_STAFF &&
380 (item >= 0) && (o_ptr->number > 1))
386 /* Obtain a local object */
387 object_copy(q_ptr, o_ptr);
389 /* Modify quantity */
392 /* Restore the charges */
395 /* Unstack the used item */
397 p_ptr->total_weight -= q_ptr->weight;
398 item = inven_carry(q_ptr);
400 msg_format(_("杖をまとめなおした。", "You unstack your staff."));
403 /* Describe charges in the pack */
406 inven_item_charges(item);
409 /* Describe charges on the floor */
412 floor_item_charges(0 - item);
415 p_ptr->window |= (PW_INVEN | PW_EQUIP);
417 /* Don't eat a staff/wand itself */
420 else if ((prace_is_(RACE_DEMON) ||
421 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
422 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
423 my_strchr("pht", r_info[o_ptr->pval].d_char)))
425 /* Drain vitality of humanoids */
426 GAME_TEXT o_name[MAX_NLEN];
427 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
428 msg_format(_("%sは燃え上り灰になった。精力を吸収した気がする。", "%^s is burnt to ashes. You absorb its vitality!"), o_name);
429 (void)set_food(PY_FOOD_MAX - 1);
431 else if (prace_is_(RACE_SKELETON))
434 if (o_ptr->tval == TV_SKELETON ||
435 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
437 msg_print(_("あなたは骨で自分の体を補った。", "Your body absorbs the bone."));
438 set_food(p_ptr->food + 5000);
443 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
444 (o_ptr->sval < SV_FOOD_BISCUIT)))
447 object_type *q_ptr = &forge;
449 msg_print(_("食べ物がアゴを素通りして落ちた!", "The food falls through your jaws!"));
450 object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
452 /* Drop the object from heaven */
453 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
457 msg_print(_("食べ物がアゴを素通りして落ち、消えた!", "The food falls through your jaws and vanishes!"));
460 else if (prace_is_(RACE_GOLEM) ||
461 prace_is_(RACE_ZOMBIE) ||
462 prace_is_(RACE_ENT) ||
463 prace_is_(RACE_DEMON) ||
464 prace_is_(RACE_ANDROID) ||
465 prace_is_(RACE_SPECTRE) ||
466 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
468 msg_print(_("生者の食物はあなたにとってほとんど栄養にならない。", "The food of mortals is poor sustenance for you."));
469 set_food(p_ptr->food + ((o_ptr->pval) / 20));
471 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
473 /* Waybread is always fully satisfying. */
474 set_food(MAX(p_ptr->food, PY_FOOD_MAX - 1));
478 /* Food can feed the player */
479 (void)set_food(p_ptr->food + o_ptr->pval);
482 /* Destroy a food in the pack */
485 inven_item_increase(item, -1);
486 inven_item_describe(item);
487 inven_item_optimize(item);
490 /* Destroy a food on the floor */
493 floor_item_increase(0 - item, -1);
494 floor_item_describe(0 - item);
495 floor_item_optimize(0 - item);
501 * @brief 食料を食べるコマンドのメインルーチン /
502 * Eat some food (from the pack or floor)
505 void do_cmd_eat_food(void)
510 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
512 set_action(ACTION_NONE);
515 /* Restrict choices to food */
516 item_tester_hook = item_tester_hook_eatable;
518 q = _("どれを食べますか? ", "Eat which item? ");
519 s = _("食べ物がない。", "You have nothing to eat.");
521 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
524 do_cmd_eat_food_aux(item);