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-damage.h"
21 #include "player-race.h"
22 #include "player-class.h"
24 #include "objectkind.h"
26 #include "realm-song.h"
27 #include "view-mainwindow.h"
30 * @brief 食料を食べるコマンドのサブルーチン
31 * @param item 食べるオブジェクトの所持品ID
34 void exe_eat_food(INVENTORY_IDX item)
39 if (music_singing_any()) stop_singing(p_ptr);
40 if (hex_spelling_any()) stop_hex_spell_all();
42 /* Get the item (in the pack) */
45 o_ptr = &p_ptr->inventory_list[item];
48 /* Get the item (on the floor) */
51 o_ptr = ¤t_floor_ptr->o_list[0 - item];
56 take_turn(p_ptr, 100);
58 /* Identity not known yet */
62 lev = k_info[o_ptr->k_idx].level;
64 if (o_ptr->tval == TV_FOOD)
66 /* Analyze the food */
71 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
73 if (set_poisoned(p_ptr, p_ptr->poisoned + randint0(10) + 10))
81 case SV_FOOD_BLINDNESS:
83 if (!p_ptr->resist_blind)
85 if (set_blind(p_ptr, p_ptr->blind + randint0(200) + 200))
93 case SV_FOOD_PARANOIA:
95 if (!p_ptr->resist_fear)
97 if (set_afraid(p_ptr, p_ptr->afraid + randint0(10) + 10))
105 case SV_FOOD_CONFUSION:
107 if (!p_ptr->resist_conf)
109 if (set_confused(p_ptr, p_ptr->confused + randint0(10) + 10))
117 case SV_FOOD_HALLUCINATION:
119 if (!p_ptr->resist_chaos)
121 if (set_image(p_ptr, p_ptr->image + randint0(250) + 250))
129 case SV_FOOD_PARALYSIS:
131 if (!p_ptr->free_act)
133 if (set_paralyzed(p_ptr, p_ptr->paralyzed + randint0(10) + 10))
141 case SV_FOOD_WEAKNESS:
143 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
144 (void)do_dec_stat(p_ptr, A_STR);
149 case SV_FOOD_SICKNESS:
151 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
152 (void)do_dec_stat(p_ptr, A_CON);
157 case SV_FOOD_STUPIDITY:
159 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
160 (void)do_dec_stat(p_ptr, A_INT);
165 case SV_FOOD_NAIVETY:
167 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
168 (void)do_dec_stat(p_ptr, A_WIS);
173 case SV_FOOD_UNHEALTH:
175 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
176 (void)do_dec_stat(p_ptr, A_CON);
181 case SV_FOOD_DISEASE:
183 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
184 (void)do_dec_stat(p_ptr, A_STR);
189 case SV_FOOD_CURE_POISON:
191 if (set_poisoned(p_ptr, 0)) ident = TRUE;
195 case SV_FOOD_CURE_BLINDNESS:
197 if (set_blind(p_ptr, 0)) ident = TRUE;
201 case SV_FOOD_CURE_PARANOIA:
203 if (set_afraid(p_ptr, 0)) ident = TRUE;
207 case SV_FOOD_CURE_CONFUSION:
209 if (set_confused(p_ptr, 0)) ident = TRUE;
213 case SV_FOOD_CURE_SERIOUS:
215 ident = cure_serious_wounds(4, 8);
219 case SV_FOOD_RESTORE_STR:
221 if (do_res_stat(p_ptr, A_STR)) ident = TRUE;
225 case SV_FOOD_RESTORE_CON:
227 if (do_res_stat(p_ptr, A_CON)) ident = TRUE;
231 case SV_FOOD_RESTORING:
233 ident = restore_all_status();
239 /* それぞれの食べ物の感想をオリジナルより細かく表現 */
240 case SV_FOOD_BISCUIT:
242 msg_print("甘くてサクサクしてとてもおいしい。");
249 msg_print("歯ごたえがあっておいしい。");
254 case SV_FOOD_SLIME_MOLD:
256 msg_print("これはなんとも形容しがたい味だ。");
263 msg_print("これはおいしい。");
269 case SV_FOOD_BISCUIT:
271 case SV_FOOD_SLIME_MOLD:
273 msg_print("That tastes good.");
280 case SV_FOOD_WAYBREAD:
282 msg_print(_("これはひじょうに美味だ。", "That tastes good."));
283 (void)set_poisoned(p_ptr, 0);
284 (void)hp_player(p_ptr, damroll(4, 8));
290 case SV_FOOD_PINT_OF_ALE:
292 msg_print("のどごし爽やかだ。");
297 case SV_FOOD_PINT_OF_WINE:
299 msg_print("That tastes good.");
304 case SV_FOOD_PINT_OF_ALE:
305 case SV_FOOD_PINT_OF_WINE:
307 msg_print("That tastes good.");
315 p_ptr->update |= (PU_COMBINE | PU_REORDER);
317 if (!(object_is_aware(o_ptr)))
319 chg_virtue(V_KNOWLEDGE, -1);
320 chg_virtue(V_PATIENCE, -1);
321 chg_virtue(V_CHANCE, 1);
324 /* We have tried it */
325 if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
327 /* The player is now aware of the object */
328 if (ident && !object_is_aware(o_ptr))
331 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
334 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
337 /* Food can feed the player */
338 if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
340 /* Reduced nutritional benefit */
341 (void)set_food(p_ptr, p_ptr->food + (o_ptr->pval / 10));
342 msg_print(_("あなたのような者にとって食糧など僅かな栄養にしかならない。",
343 "Mere victuals hold scant sustenance for a being such as yourself."));
345 if (p_ptr->food < PY_FOOD_ALERT) /* Hungry */
346 msg_print(_("あなたの飢えは新鮮な血によってのみ満たされる!",
347 "Your hunger can only be satisfied with fresh blood!"));
349 else if ((PRACE_IS_(p_ptr, RACE_SKELETON) ||
350 PRACE_IS_(p_ptr, RACE_GOLEM) ||
351 PRACE_IS_(p_ptr, RACE_ZOMBIE) ||
352 PRACE_IS_(p_ptr, RACE_SPECTRE)) &&
353 (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
357 if (o_ptr->tval == TV_STAFF &&
358 (item < 0) && (o_ptr->number > 1))
360 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
363 staff = (o_ptr->tval == TV_STAFF) ? _("杖", "staff") : _("魔法棒", "wand");
366 if (o_ptr->pval == 0)
368 msg_format(_("この%sにはもう魔力が残っていない。", "The %s has no charges left."), staff);
369 o_ptr->ident |= (IDENT_EMPTY);
370 p_ptr->update |= (PU_COMBINE | PU_REORDER);
371 p_ptr->window |= (PW_INVEN);
375 msg_format(_("あなたは%sの魔力をエネルギー源として吸収した。", "You absorb mana of the %s as your energy."), staff);
377 /* Use a single charge */
381 set_food(p_ptr, p_ptr->food + 5000);
383 /* XXX Hack -- unstack if necessary */
384 if (o_ptr->tval == TV_STAFF &&
385 (item >= 0) && (o_ptr->number > 1))
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);
420 /* Don't eat a staff/wand itself */
423 else if ((PRACE_IS_(p_ptr, RACE_DEMON) ||
424 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
425 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
426 my_strchr("pht", r_info[o_ptr->pval].d_char)))
428 /* Drain vitality of humanoids */
429 GAME_TEXT o_name[MAX_NLEN];
430 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
431 msg_format(_("%sは燃え上り灰になった。精力を吸収した気がする。", "%^s is burnt to ashes. You absorb its vitality!"), o_name);
432 (void)set_food(p_ptr, PY_FOOD_MAX - 1);
434 else if (PRACE_IS_(p_ptr, RACE_SKELETON))
437 if (o_ptr->tval == TV_SKELETON ||
438 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
440 msg_print(_("あなたは骨で自分の体を補った。", "Your body absorbs the bone."));
441 set_food(p_ptr, p_ptr->food + 5000);
446 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
447 (o_ptr->sval < SV_FOOD_BISCUIT)))
450 object_type *q_ptr = &forge;
452 msg_print(_("食べ物がアゴを素通りして落ちた!", "The food falls through your jaws!"));
453 object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
455 /* Drop the object from heaven */
456 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
460 msg_print(_("食べ物がアゴを素通りして落ち、消えた!", "The food falls through your jaws and vanishes!"));
463 else if (PRACE_IS_(p_ptr, RACE_GOLEM) ||
464 PRACE_IS_(p_ptr, RACE_ZOMBIE) ||
465 PRACE_IS_(p_ptr, RACE_ENT) ||
466 PRACE_IS_(p_ptr, RACE_DEMON) ||
467 PRACE_IS_(p_ptr, RACE_ANDROID) ||
468 PRACE_IS_(p_ptr, RACE_SPECTRE) ||
469 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
471 msg_print(_("生者の食物はあなたにとってほとんど栄養にならない。", "The food of mortals is poor sustenance for you."));
472 set_food(p_ptr, p_ptr->food + ((o_ptr->pval) / 20));
474 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
476 /* Waybread is always fully satisfying. */
477 set_food(p_ptr, MAX(p_ptr->food, PY_FOOD_MAX - 1));
481 /* Food can feed the player */
482 (void)set_food(p_ptr, p_ptr->food + o_ptr->pval);
485 /* Destroy a food in the pack */
488 inven_item_increase(item, -1);
489 inven_item_describe(item);
490 inven_item_optimize(item);
493 /* Destroy a food on the floor */
496 floor_item_increase(0 - item, -1);
497 floor_item_describe(0 - item);
498 floor_item_optimize(0 - item);
504 * @brief 食料を食べるコマンドのメインルーチン /
505 * Eat some food (from the pack or floor)
508 void do_cmd_eat_food(void)
513 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
515 set_action(ACTION_NONE);
518 /* Restrict choices to food */
519 item_tester_hook = item_tester_hook_eatable;
521 q = _("どれを食べますか? ", "Eat which item? ");
522 s = _("食べ物がない。", "You have nothing to eat.");
524 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0)) return;