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(player_type *creature_ptr, INVENTORY_IDX item)
39 if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
40 if (hex_spelling_any(creature_ptr)) stop_hex_spell_all();
41 o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item);
45 take_turn(creature_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 (!(creature_ptr->resist_pois || IS_OPPOSE_POIS()))
62 if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(10) + 10))
70 case SV_FOOD_BLINDNESS:
72 if (!creature_ptr->resist_blind)
74 if (set_blind(creature_ptr, creature_ptr->blind + randint0(200) + 200))
82 case SV_FOOD_PARANOIA:
84 if (!creature_ptr->resist_fear)
86 if (set_afraid(creature_ptr, creature_ptr->afraid + randint0(10) + 10))
94 case SV_FOOD_CONFUSION:
96 if (!creature_ptr->resist_conf)
98 if (set_confused(creature_ptr, creature_ptr->confused + randint0(10) + 10))
106 case SV_FOOD_HALLUCINATION:
108 if (!creature_ptr->resist_chaos)
110 if (set_image(creature_ptr, creature_ptr->image + randint0(250) + 250))
118 case SV_FOOD_PARALYSIS:
120 if (!creature_ptr->free_act)
122 if (set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(10) + 10))
130 case SV_FOOD_WEAKNESS:
132 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
133 (void)do_dec_stat(creature_ptr, A_STR);
138 case SV_FOOD_SICKNESS:
140 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
141 (void)do_dec_stat(creature_ptr, A_CON);
146 case SV_FOOD_STUPIDITY:
148 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
149 (void)do_dec_stat(creature_ptr, A_INT);
154 case SV_FOOD_NAIVETY:
156 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
157 (void)do_dec_stat(creature_ptr, A_WIS);
162 case SV_FOOD_UNHEALTH:
164 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
165 (void)do_dec_stat(creature_ptr, A_CON);
170 case SV_FOOD_DISEASE:
172 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
173 (void)do_dec_stat(creature_ptr, A_STR);
178 case SV_FOOD_CURE_POISON:
180 if (set_poisoned(creature_ptr, 0)) ident = TRUE;
184 case SV_FOOD_CURE_BLINDNESS:
186 if (set_blind(creature_ptr, 0)) ident = TRUE;
190 case SV_FOOD_CURE_PARANOIA:
192 if (set_afraid(creature_ptr, 0)) ident = TRUE;
196 case SV_FOOD_CURE_CONFUSION:
198 if (set_confused(creature_ptr, 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(creature_ptr, A_STR)) ident = TRUE;
214 case SV_FOOD_RESTORE_CON:
216 if (do_res_stat(creature_ptr, 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(creature_ptr, 0);
273 (void)hp_player(creature_ptr, damroll(4, 8));
278 case SV_FOOD_PINT_OF_ALE:
280 msg_print(_("のどごし爽やかだ。", "That tastes good."));
285 case SV_FOOD_PINT_OF_WINE:
287 msg_print(_("のどごし爽やかだ。", "That tastes good."));
294 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
296 if (!(object_is_aware(o_ptr)))
298 chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
299 chg_virtue(creature_ptr, V_PATIENCE, -1);
300 chg_virtue(creature_ptr, V_CHANCE, 1);
303 /* We have tried it */
304 if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
306 /* The player is now aware of the object */
307 if (ident && !object_is_aware(o_ptr))
310 gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
313 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
316 /* Food can feed the player */
317 if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
319 /* Reduced nutritional benefit */
320 (void)set_food(creature_ptr, creature_ptr->food + (o_ptr->pval / 10));
321 msg_print(_("あなたのような者にとって食糧など僅かな栄養にしかならない。",
322 "Mere victuals hold scant sustenance for a being such as yourself."));
324 if (creature_ptr->food < PY_FOOD_ALERT) /* Hungry */
325 msg_print(_("あなたの飢えは新鮮な血によってのみ満たされる!",
326 "Your hunger can only be satisfied with fresh blood!"));
328 else if ((PRACE_IS_(creature_ptr, RACE_SKELETON) ||
329 PRACE_IS_(creature_ptr, RACE_GOLEM) ||
330 PRACE_IS_(creature_ptr, RACE_ZOMBIE) ||
331 PRACE_IS_(creature_ptr, RACE_SPECTRE)) &&
332 (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
336 if (o_ptr->tval == TV_STAFF &&
337 (item < 0) && (o_ptr->number > 1))
339 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
342 staff = (o_ptr->tval == TV_STAFF) ? _("杖", "staff") : _("魔法棒", "wand");
345 if (o_ptr->pval == 0)
347 msg_format(_("この%sにはもう魔力が残っていない。", "The %s has no charges left."), staff);
348 o_ptr->ident |= (IDENT_EMPTY);
349 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
350 creature_ptr->window |= (PW_INVEN);
354 msg_format(_("あなたは%sの魔力をエネルギー源として吸収した。", "You absorb mana of the %s as your energy."), staff);
356 /* Use a single charge */
360 set_food(creature_ptr, creature_ptr->food + 5000);
362 /* XXX Hack -- unstack if necessary */
363 if (o_ptr->tval == TV_STAFF &&
364 (item >= 0) && (o_ptr->number > 1))
369 object_copy(q_ptr, o_ptr);
371 /* Modify quantity */
374 /* Restore the charges */
377 /* Unstack the used item */
379 creature_ptr->total_weight -= q_ptr->weight;
380 item = inven_carry(q_ptr);
382 msg_format(_("杖をまとめなおした。", "You unstack your staff."));
385 /* Describe charges in the pack */
388 inven_item_charges(item);
391 /* Describe charges on the floor */
394 floor_item_charges(0 - item);
397 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
399 /* Don't eat a staff/wand itself */
402 else if ((PRACE_IS_(creature_ptr, RACE_DEMON) ||
403 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
404 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
405 my_strchr("pht", r_info[o_ptr->pval].d_char)))
407 /* Drain vitality of humanoids */
408 GAME_TEXT o_name[MAX_NLEN];
409 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
410 msg_format(_("%sは燃え上り灰になった。精力を吸収した気がする。", "%^s is burnt to ashes. You absorb its vitality!"), o_name);
411 (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
413 else if (PRACE_IS_(creature_ptr, RACE_SKELETON))
416 if (o_ptr->tval == TV_SKELETON ||
417 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
419 msg_print(_("あなたは骨で自分の体を補った。", "Your body absorbs the bone."));
420 set_food(creature_ptr, creature_ptr->food + 5000);
425 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
426 (o_ptr->sval < SV_FOOD_BISCUIT)))
429 object_type *q_ptr = &forge;
431 msg_print(_("食べ物がアゴを素通りして落ちた!", "The food falls through your jaws!"));
432 object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
434 /* Drop the object from heaven */
435 (void)drop_near(q_ptr, -1, creature_ptr->y, creature_ptr->x);
439 msg_print(_("食べ物がアゴを素通りして落ち、消えた!", "The food falls through your jaws and vanishes!"));
442 else if (PRACE_IS_(creature_ptr, RACE_GOLEM) ||
443 PRACE_IS_(creature_ptr, RACE_ZOMBIE) ||
444 PRACE_IS_(creature_ptr, RACE_ENT) ||
445 PRACE_IS_(creature_ptr, RACE_DEMON) ||
446 PRACE_IS_(creature_ptr, RACE_ANDROID) ||
447 PRACE_IS_(creature_ptr, RACE_SPECTRE) ||
448 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
450 msg_print(_("生者の食物はあなたにとってほとんど栄養にならない。", "The food of mortals is poor sustenance for you."));
451 set_food(creature_ptr, creature_ptr->food + ((o_ptr->pval) / 20));
453 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
455 /* Waybread is always fully satisfying. */
456 set_food(creature_ptr, MAX(creature_ptr->food, PY_FOOD_MAX - 1));
460 /* Food can feed the player */
461 (void)set_food(creature_ptr, creature_ptr->food + o_ptr->pval);
466 inven_item_increase(item, -1);
467 inven_item_describe(item);
468 inven_item_optimize(item);
472 floor_item_increase(0 - item, -1);
473 floor_item_describe(0 - item);
474 floor_item_optimize(0 - item);
480 * @brief 食料を食べるコマンドのメインルーチン /
481 * Eat some food (from the pack or floor)
484 void do_cmd_eat_food(player_type *creature_ptr)
489 if (creature_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
491 set_action(creature_ptr, ACTION_NONE);
494 item_tester_hook = item_tester_hook_eatable;
496 q = _("どれを食べますか? ", "Eat which item? ");
497 s = _("食べ物がない。", "You have nothing to eat.");
499 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0)) return;
501 exe_eat_food(creature_ptr, item);