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"
23 #include "player-inventory.h"
25 #include "objectkind.h"
27 #include "realm-song.h"
28 #include "view-mainwindow.h"
31 * @brief 食料を食べるコマンドのサブルーチン
32 * @param item 食べるオブジェクトの所持品ID
35 void exe_eat_food(player_type *creature_ptr, INVENTORY_IDX item)
40 if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
41 if (hex_spelling_any(creature_ptr)) stop_hex_spell_all(creature_ptr);
42 o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
46 take_turn(creature_ptr, 100);
48 /* Identity not known yet */
52 lev = k_info[o_ptr->k_idx].level;
54 if (o_ptr->tval == TV_FOOD)
56 /* Analyze the food */
61 if (!(creature_ptr->resist_pois || IS_OPPOSE_POIS()))
63 if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(10) + 10))
71 case SV_FOOD_BLINDNESS:
73 if (!creature_ptr->resist_blind)
75 if (set_blind(creature_ptr, creature_ptr->blind + randint0(200) + 200))
83 case SV_FOOD_PARANOIA:
85 if (!creature_ptr->resist_fear)
87 if (set_afraid(creature_ptr, creature_ptr->afraid + randint0(10) + 10))
95 case SV_FOOD_CONFUSION:
97 if (!creature_ptr->resist_conf)
99 if (set_confused(creature_ptr, creature_ptr->confused + randint0(10) + 10))
107 case SV_FOOD_HALLUCINATION:
109 if (!creature_ptr->resist_chaos)
111 if (set_image(creature_ptr, creature_ptr->image + randint0(250) + 250))
119 case SV_FOOD_PARALYSIS:
121 if (!creature_ptr->free_act)
123 if (set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(10) + 10))
131 case SV_FOOD_WEAKNESS:
133 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
134 (void)do_dec_stat(creature_ptr, A_STR);
139 case SV_FOOD_SICKNESS:
141 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(6, 6), _("毒入り食料", "poisonous food"), -1);
142 (void)do_dec_stat(creature_ptr, A_CON);
147 case SV_FOOD_STUPIDITY:
149 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
150 (void)do_dec_stat(creature_ptr, A_INT);
155 case SV_FOOD_NAIVETY:
157 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(8, 8), _("毒入り食料", "poisonous food"), -1);
158 (void)do_dec_stat(creature_ptr, A_WIS);
163 case SV_FOOD_UNHEALTH:
165 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
166 (void)do_dec_stat(creature_ptr, A_CON);
171 case SV_FOOD_DISEASE:
173 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 10), _("毒入り食料", "poisonous food"), -1);
174 (void)do_dec_stat(creature_ptr, A_STR);
179 case SV_FOOD_CURE_POISON:
181 if (set_poisoned(creature_ptr, 0)) ident = TRUE;
185 case SV_FOOD_CURE_BLINDNESS:
187 if (set_blind(creature_ptr, 0)) ident = TRUE;
191 case SV_FOOD_CURE_PARANOIA:
193 if (set_afraid(creature_ptr, 0)) ident = TRUE;
197 case SV_FOOD_CURE_CONFUSION:
199 if (set_confused(creature_ptr, 0)) ident = TRUE;
203 case SV_FOOD_CURE_SERIOUS:
205 ident = cure_serious_wounds(creature_ptr, 4, 8);
209 case SV_FOOD_RESTORE_STR:
211 if (do_res_stat(creature_ptr, A_STR)) ident = TRUE;
215 case SV_FOOD_RESTORE_CON:
217 if (do_res_stat(creature_ptr, A_CON)) ident = TRUE;
221 case SV_FOOD_RESTORING:
223 ident = restore_all_status(creature_ptr);
229 /* それぞれの食べ物の感想をオリジナルより細かく表現 */
230 case SV_FOOD_BISCUIT:
232 msg_print("甘くてサクサクしてとてもおいしい。");
239 msg_print("歯ごたえがあっておいしい。");
244 case SV_FOOD_SLIME_MOLD:
246 msg_print("これはなんとも形容しがたい味だ。");
253 msg_print("これはおいしい。");
259 case SV_FOOD_BISCUIT:
261 case SV_FOOD_SLIME_MOLD:
263 msg_print("That tastes good.");
270 case SV_FOOD_WAYBREAD:
272 msg_print(_("これはひじょうに美味だ。", "That tastes good."));
273 (void)set_poisoned(creature_ptr, 0);
274 (void)hp_player(creature_ptr, damroll(4, 8));
279 case SV_FOOD_PINT_OF_ALE:
281 msg_print(_("のどごし爽やかだ。", "That tastes good."));
286 case SV_FOOD_PINT_OF_WINE:
288 msg_print(_("のどごし爽やかだ。", "That tastes good."));
295 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
297 if (!(object_is_aware(o_ptr)))
299 chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
300 chg_virtue(creature_ptr, V_PATIENCE, -1);
301 chg_virtue(creature_ptr, V_CHANCE, 1);
304 /* We have tried it */
305 if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
307 /* The player is now aware of the object */
308 if (ident && !object_is_aware(o_ptr))
310 object_aware(creature_ptr, o_ptr);
311 gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
314 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
317 /* Food can feed the player */
318 if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
320 /* Reduced nutritional benefit */
321 (void)set_food(creature_ptr, creature_ptr->food + (o_ptr->pval / 10));
322 msg_print(_("あなたのような者にとって食糧など僅かな栄養にしかならない。",
323 "Mere victuals hold scant sustenance for a being such as yourself."));
325 if (creature_ptr->food < PY_FOOD_ALERT) /* Hungry */
326 msg_print(_("あなたの飢えは新鮮な血によってのみ満たされる!",
327 "Your hunger can only be satisfied with fresh blood!"));
329 else if ((PRACE_IS_(creature_ptr, RACE_SKELETON) ||
330 PRACE_IS_(creature_ptr, RACE_GOLEM) ||
331 PRACE_IS_(creature_ptr, RACE_ZOMBIE) ||
332 PRACE_IS_(creature_ptr, RACE_SPECTRE)) &&
333 (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
337 if (o_ptr->tval == TV_STAFF &&
338 (item < 0) && (o_ptr->number > 1))
340 msg_print(_("まずは杖を拾わなければ。", "You must first pick up the staffs."));
343 staff = (o_ptr->tval == TV_STAFF) ? _("杖", "staff") : _("魔法棒", "wand");
346 if (o_ptr->pval == 0)
348 msg_format(_("この%sにはもう魔力が残っていない。", "The %s has no charges left."), staff);
349 o_ptr->ident |= (IDENT_EMPTY);
350 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
351 creature_ptr->window |= (PW_INVEN);
355 msg_format(_("あなたは%sの魔力をエネルギー源として吸収した。", "You absorb mana of the %s as your energy."), staff);
357 /* Use a single charge */
361 set_food(creature_ptr, creature_ptr->food + 5000);
363 /* XXX Hack -- unstack if necessary */
364 if (o_ptr->tval == TV_STAFF &&
365 (item >= 0) && (o_ptr->number > 1))
370 object_copy(q_ptr, o_ptr);
372 /* Modify quantity */
375 /* Restore the charges */
378 /* Unstack the used item */
380 creature_ptr->total_weight -= q_ptr->weight;
381 item = inven_carry(creature_ptr, q_ptr);
383 msg_format(_("杖をまとめなおした。", "You unstack your staff."));
386 /* Describe charges in the pack */
389 inven_item_charges(item);
392 /* Describe charges on the floor */
395 floor_item_charges(0 - item);
398 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
400 /* Don't eat a staff/wand itself */
403 else if ((PRACE_IS_(creature_ptr, RACE_DEMON) ||
404 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
405 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
406 my_strchr("pht", r_info[o_ptr->pval].d_char)))
408 /* Drain vitality of humanoids */
409 GAME_TEXT o_name[MAX_NLEN];
410 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
411 msg_format(_("%sは燃え上り灰になった。精力を吸収した気がする。", "%^s is burnt to ashes. You absorb its vitality!"), o_name);
412 (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
414 else if (PRACE_IS_(creature_ptr, RACE_SKELETON))
417 if (o_ptr->tval == TV_SKELETON ||
418 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
420 msg_print(_("あなたは骨で自分の体を補った。", "Your body absorbs the bone."));
421 set_food(creature_ptr, creature_ptr->food + 5000);
426 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
427 (o_ptr->sval < SV_FOOD_BISCUIT)))
430 object_type *q_ptr = &forge;
432 msg_print(_("食べ物がアゴを素通りして落ちた!", "The food falls through your jaws!"));
433 object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
435 /* Drop the object from heaven */
436 (void)drop_near(creature_ptr, q_ptr, -1, creature_ptr->y, creature_ptr->x);
440 msg_print(_("食べ物がアゴを素通りして落ち、消えた!", "The food falls through your jaws and vanishes!"));
443 else if (PRACE_IS_(creature_ptr, RACE_GOLEM) ||
444 PRACE_IS_(creature_ptr, RACE_ZOMBIE) ||
445 PRACE_IS_(creature_ptr, RACE_ENT) ||
446 PRACE_IS_(creature_ptr, RACE_DEMON) ||
447 PRACE_IS_(creature_ptr, RACE_ANDROID) ||
448 PRACE_IS_(creature_ptr, RACE_SPECTRE) ||
449 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
451 msg_print(_("生者の食物はあなたにとってほとんど栄養にならない。", "The food of mortals is poor sustenance for you."));
452 set_food(creature_ptr, creature_ptr->food + ((o_ptr->pval) / 20));
454 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
456 /* Waybread is always fully satisfying. */
457 set_food(creature_ptr, MAX(creature_ptr->food, PY_FOOD_MAX - 1));
461 /* Food can feed the player */
462 (void)set_food(creature_ptr, creature_ptr->food + o_ptr->pval);
470 * @brief 食料を食べるコマンドのメインルーチン /
471 * Eat some food (from the pack or floor)
474 void do_cmd_eat_food(player_type *creature_ptr)
479 if (creature_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
481 set_action(creature_ptr, ACTION_NONE);
484 item_tester_hook = item_tester_hook_eatable;
486 q = _("どれを食べますか? ", "Eat which item? ");
487 s = _("食べ物がない。", "You have nothing to eat.");
489 if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0)) return;
491 exe_eat_food(creature_ptr, item);