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)
27 if (music_singing_any()) stop_singing(p_ptr);
28 if (hex_spelling_any()) stop_hex_spell_all();
30 /* Get the item (in the pack) */
33 o_ptr = &inventory[item];
36 /* Get the item (on the floor) */
39 o_ptr = ¤t_floor_ptr->o_list[0 - item];
44 take_turn(p_ptr, 100);
46 /* Identity not known yet */
50 lev = k_info[o_ptr->k_idx].level;
52 if (o_ptr->tval == TV_FOOD)
54 /* Analyze the food */
59 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
61 if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
69 case SV_FOOD_BLINDNESS:
71 if (!p_ptr->resist_blind)
73 if (set_blind(p_ptr->blind + randint0(200) + 200))
81 case SV_FOOD_PARANOIA:
83 if (!p_ptr->resist_fear)
85 if (set_afraid(p_ptr->afraid + randint0(10) + 10))
93 case SV_FOOD_CONFUSION:
95 if (!p_ptr->resist_conf)
97 if (set_confused(p_ptr->confused + randint0(10) + 10))
105 case SV_FOOD_HALLUCINATION:
107 if (!p_ptr->resist_chaos)
109 if (set_image(p_ptr->image + randint0(250) + 250))
117 case SV_FOOD_PARALYSIS:
119 if (!p_ptr->free_act)
121 if (set_paralyzed(p_ptr->paralyzed + randint0(10) + 10))
129 case SV_FOOD_WEAKNESS:
131 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
132 (void)do_dec_stat(A_STR);
137 case SV_FOOD_SICKNESS:
139 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
140 (void)do_dec_stat(A_CON);
145 case SV_FOOD_STUPIDITY:
147 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
148 (void)do_dec_stat(A_INT);
153 case SV_FOOD_NAIVETY:
155 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
156 (void)do_dec_stat(A_WIS);
161 case SV_FOOD_UNHEALTH:
163 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
164 (void)do_dec_stat(A_CON);
169 case SV_FOOD_DISEASE:
171 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
172 (void)do_dec_stat(A_STR);
177 case SV_FOOD_CURE_POISON:
179 if (set_poisoned(0)) ident = TRUE;
183 case SV_FOOD_CURE_BLINDNESS:
185 if (set_blind(0)) ident = TRUE;
189 case SV_FOOD_CURE_PARANOIA:
191 if (set_afraid(0)) ident = TRUE;
195 case SV_FOOD_CURE_CONFUSION:
197 if (set_confused(0)) ident = TRUE;
201 case SV_FOOD_CURE_SERIOUS:
203 ident = cure_serious_wounds(4, 8);
207 case SV_FOOD_RESTORE_STR:
209 if (do_res_stat(A_STR)) ident = TRUE;
213 case SV_FOOD_RESTORE_CON:
215 if (do_res_stat(A_CON)) ident = TRUE;
219 case SV_FOOD_RESTORING:
221 ident = restore_all_status();
227 /* それぞれの食べ物の感想をオリジナルより細かく表現 */
228 case SV_FOOD_BISCUIT:
230 msg_print("甘くてサクサクしてとてもおいしい。");
237 msg_print("歯ごたえがあっておいしい。");
242 case SV_FOOD_SLIME_MOLD:
244 msg_print("これはなんとも形容しがたい味だ。");
251 msg_print("これはおいしい。");
257 case SV_FOOD_BISCUIT:
259 case SV_FOOD_SLIME_MOLD:
261 msg_print("That tastes good.");
268 case SV_FOOD_WAYBREAD:
270 msg_print(_("これはひじょうに美味だ。", "That tastes good."));
271 (void)set_poisoned(0);
272 (void)hp_player(damroll(4, 8));
278 case SV_FOOD_PINT_OF_ALE:
280 msg_print("のどごし爽やかだ。");
285 case SV_FOOD_PINT_OF_WINE:
287 msg_print("That tastes good.");
292 case SV_FOOD_PINT_OF_ALE:
293 case SV_FOOD_PINT_OF_WINE:
295 msg_print("That tastes good.");
303 p_ptr->update |= (PU_COMBINE | PU_REORDER);
305 if (!(object_is_aware(o_ptr)))
307 chg_virtue(V_KNOWLEDGE, -1);
308 chg_virtue(V_PATIENCE, -1);
309 chg_virtue(V_CHANCE, 1);
312 /* We have tried it */
313 if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
315 /* The player is now aware of the object */
316 if (ident && !object_is_aware(o_ptr))
319 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
322 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
325 /* Food can feed the player */
326 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
328 /* Reduced nutritional benefit */
329 (void)set_food(p_ptr->food + (o_ptr->pval / 10));
330 msg_print(_("あなたのような者にとって食糧など僅かな栄養にしかならない。",
331 "Mere victuals hold scant sustenance for a being such as yourself."));
333 if (p_ptr->food < PY_FOOD_ALERT) /* Hungry */
334 msg_print(_("あなたの飢えは新鮮な血によってのみ満たされる!",
335 "Your hunger can only be satisfied with fresh blood!"));
337 else if ((prace_is_(RACE_SKELETON) ||
338 prace_is_(RACE_GOLEM) ||
339 prace_is_(RACE_ZOMBIE) ||
340 prace_is_(RACE_SPECTRE)) &&
341 (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
345 if (o_ptr->tval == TV_STAFF &&
346 (item < 0) && (o_ptr->number > 1))
348 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
351 staff = (o_ptr->tval == TV_STAFF) ? _("杖", "staff") : _("魔法棒", "wand");
354 if (o_ptr->pval == 0)
356 msg_format(_("この%sにはもう魔力が残っていない。", "The %s has no charges left."), staff);
357 o_ptr->ident |= (IDENT_EMPTY);
358 p_ptr->update |= (PU_COMBINE | PU_REORDER);
359 p_ptr->window |= (PW_INVEN);
363 msg_format(_("あなたは%sの魔力をエネルギー源として吸収した。", "You absorb mana of the %s as your energy."), staff);
365 /* Use a single charge */
369 set_food(p_ptr->food + 5000);
371 /* XXX Hack -- unstack if necessary */
372 if (o_ptr->tval == TV_STAFF &&
373 (item >= 0) && (o_ptr->number > 1))
379 /* Obtain a local object */
380 object_copy(q_ptr, o_ptr);
382 /* Modify quantity */
385 /* Restore the charges */
388 /* Unstack the used item */
390 p_ptr->total_weight -= q_ptr->weight;
391 item = inven_carry(q_ptr);
393 msg_format(_("杖をまとめなおした。", "You unstack your staff."));
396 /* Describe charges in the pack */
399 inven_item_charges(item);
402 /* Describe charges on the floor */
405 floor_item_charges(0 - item);
408 p_ptr->window |= (PW_INVEN | PW_EQUIP);
410 /* Don't eat a staff/wand itself */
413 else if ((prace_is_(RACE_DEMON) ||
414 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
415 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
416 my_strchr("pht", r_info[o_ptr->pval].d_char)))
418 /* Drain vitality of humanoids */
419 GAME_TEXT o_name[MAX_NLEN];
420 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
421 msg_format(_("%sは燃え上り灰になった。精力を吸収した気がする。", "%^s is burnt to ashes. You absorb its vitality!"), o_name);
422 (void)set_food(PY_FOOD_MAX - 1);
424 else if (prace_is_(RACE_SKELETON))
427 if (o_ptr->tval == TV_SKELETON ||
428 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
430 msg_print(_("あなたは骨で自分の体を補った。", "Your body absorbs the bone."));
431 set_food(p_ptr->food + 5000);
436 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
437 (o_ptr->sval < SV_FOOD_BISCUIT)))
440 object_type *q_ptr = &forge;
442 msg_print(_("食べ物がアゴを素通りして落ちた!", "The food falls through your jaws!"));
443 object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
445 /* Drop the object from heaven */
446 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
450 msg_print(_("食べ物がアゴを素通りして落ち、消えた!", "The food falls through your jaws and vanishes!"));
453 else if (prace_is_(RACE_GOLEM) ||
454 prace_is_(RACE_ZOMBIE) ||
455 prace_is_(RACE_ENT) ||
456 prace_is_(RACE_DEMON) ||
457 prace_is_(RACE_ANDROID) ||
458 prace_is_(RACE_SPECTRE) ||
459 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
461 msg_print(_("生者の食物はあなたにとってほとんど栄養にならない。", "The food of mortals is poor sustenance for you."));
462 set_food(p_ptr->food + ((o_ptr->pval) / 20));
464 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
466 /* Waybread is always fully satisfying. */
467 set_food(MAX(p_ptr->food, PY_FOOD_MAX - 1));
471 /* Food can feed the player */
472 (void)set_food(p_ptr->food + o_ptr->pval);
475 /* Destroy a food in the pack */
478 inven_item_increase(item, -1);
479 inven_item_describe(item);
480 inven_item_optimize(item);
483 /* Destroy a food on the floor */
486 floor_item_increase(0 - item, -1);
487 floor_item_describe(0 - item);
488 floor_item_optimize(0 - item);
494 * @brief 食料を食べるコマンドのメインルーチン /
495 * Eat some food (from the pack or floor)
498 void do_cmd_eat_food(void)
503 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
505 set_action(ACTION_NONE);
508 /* Restrict choices to food */
509 item_tester_hook = item_tester_hook_eatable;
511 q = _("どれを食べますか? ", "Eat which item? ");
512 s = _("食べ物がない。", "You have nothing to eat.");
514 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
517 do_cmd_eat_food_aux(item);