6 * @param sval オブジェクトのsval
8 * @param powerful 強力発動上の処理ならばTRUE
9 * @param magic 魔道具術上の処理ならばTRUE
10 * @return 発動により効果内容が確定したならばTRUEを返す
12 int wand_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool powerful, bool magic)
15 PLAYER_LEVEL lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
16 POSITION rad = powerful ? 3 : 2;
18 /* XXX Hack -- Wand of wonder can do anything before it */
19 if (sval == SV_WAND_WONDER)
21 int vir = virtue_number(V_CHANCE);
22 sval = (OBJECT_SUBTYPE_VALUE)randint0(SV_WAND_WONDER);
26 if (p_ptr->virtues[vir - 1] > 0)
28 while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
29 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
33 while (randint1(300) < (0 - p_ptr->virtues[vir - 1])) sval--;
34 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
37 if (sval < SV_WAND_TELEPORT_AWAY)
38 chg_virtue(V_CHANCE, 1);
41 /* Analyze the wand */
44 case SV_WAND_HEAL_MONSTER:
46 HIT_POINT dam = damroll((powerful ? 20 : 10), 10);
47 if (heal_monster(dir, dam)) ident = TRUE;
51 case SV_WAND_HASTE_MONSTER:
53 if (speed_monster(dir, lev)) ident = TRUE;
57 case SV_WAND_CLONE_MONSTER:
59 if (clone_monster(dir)) ident = TRUE;
63 case SV_WAND_TELEPORT_AWAY:
65 int distance = MAX_SIGHT * (powerful ? 8 : 5);
66 if (teleport_monster(dir, distance)) ident = TRUE;
70 case SV_WAND_DISARMING:
72 if (disarm_trap(dir)) ident = TRUE;
73 if (powerful && disarm_traps_touch()) ident = TRUE;
77 case SV_WAND_TRAP_DOOR_DEST:
79 if (destroy_door(dir)) ident = TRUE;
80 if (powerful && destroy_doors_touch()) ident = TRUE;
84 case SV_WAND_STONE_TO_MUD:
86 HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
87 if (wall_to_mud(dir, dam)) ident = TRUE;
93 HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
94 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
95 (void)lite_line(dir, dam);
100 case SV_WAND_SLEEP_MONSTER:
102 if (sleep_monster(dir, lev)) ident = TRUE;
106 case SV_WAND_SLOW_MONSTER:
108 if (slow_monster(dir, lev)) ident = TRUE;
112 case SV_WAND_CONFUSE_MONSTER:
114 if (confuse_monster(dir, lev)) ident = TRUE;
118 case SV_WAND_FEAR_MONSTER:
120 if (fear_monster(dir, lev)) ident = TRUE;
124 case SV_WAND_HYPODYNAMIA:
126 if (hypodynamic_bolt(dir, 80 + lev)) ident = TRUE;
130 case SV_WAND_POLYMORPH:
132 if (poly_monster(dir, lev)) ident = TRUE;
136 case SV_WAND_STINKING_CLOUD:
138 fire_ball(GF_POIS, dir, 12 + lev / 4, rad);
143 case SV_WAND_MAGIC_MISSILE:
145 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
150 case SV_WAND_ACID_BOLT:
152 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
157 case SV_WAND_CHARM_MONSTER:
159 if (charm_monster(dir, MAX(20, lev)))
164 case SV_WAND_FIRE_BOLT:
166 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
171 case SV_WAND_COLD_BOLT:
173 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
178 case SV_WAND_ACID_BALL:
180 fire_ball(GF_ACID, dir, 60 + 3 * lev / 4, rad);
185 case SV_WAND_ELEC_BALL:
187 fire_ball(GF_ELEC, dir, 40 + 3 * lev / 4, rad);
192 case SV_WAND_FIRE_BALL:
194 fire_ball(GF_FIRE, dir, 70 + 3 * lev / 4, rad);
199 case SV_WAND_COLD_BALL:
201 fire_ball(GF_COLD, dir, 50 + 3 * lev / 4, rad);
208 msg_print(_("おっと、謎の魔法棒を始動させた。", "Oops. Wand of wonder activated."));
212 case SV_WAND_DRAGON_FIRE:
214 fire_breath(GF_FIRE, dir, (powerful ? 300 : 200), 3);
219 case SV_WAND_DRAGON_COLD:
221 fire_breath(GF_COLD, dir, (powerful ? 270 : 180), 3);
226 case SV_WAND_DRAGON_BREATH:
255 if (powerful) dam = (dam * 3) / 2;
257 fire_breath(typ, dir, dam, 3);
263 case SV_WAND_DISINTEGRATE:
265 fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
270 case SV_WAND_ROCKETS:
272 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
273 fire_rocket(GF_ROCKET, dir, 250 + lev * 3, rad);
278 case SV_WAND_STRIKING:
280 fire_bolt(GF_METEOR, dir, damroll(15 + lev / 3, 13));
285 case SV_WAND_GENOCIDE:
287 fire_ball_hide(GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
296 * @brief 魔法棒を使うコマンドのサブルーチン /
297 * Aim a wand (from the pack or floor).
298 * @param item 使うオブジェクトの所持品ID
302 * Use a single charge from a single item.
303 * Handle "unstacking" in a logical manner.
304 * For simplicity, you cannot use a stack of items from the
305 * ground. This would require too much nasty code.
306 * There are no wands which can "destroy" themselves, in the inventory
307 * or on the ground, so we can ignore this possibility. Note that this
308 * required giving "wand of wonder" the ability to ignore destruction
310 * All wands can be "cancelled" at the "Direction?" prompt for free.
311 * Note that the basic "bolt" wands do slightly less damage than the
312 * basic "bolt" rods, but the basic "ball" wands do the same damage
313 * as the basic "ball" rods.
316 void do_cmd_aim_wand_aux(INVENTORY_IDX item)
318 int lev, ident, chance, dir;
320 bool old_target_pet = target_pet;
322 /* Get the item (in the pack) */
325 o_ptr = &inventory[item];
328 /* Get the item (on the floor) */
331 o_ptr = &o_list[0 - item];
334 /* Mega-Hack -- refuse to aim a pile from the ground */
335 if ((item < 0) && (o_ptr->number > 1))
337 msg_print(_("まずは魔法棒を拾わなければ。", "You must first pick up the wands."));
342 /* Allow direction to be cancelled for free */
343 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
344 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
346 if (!get_aim_dir(&dir))
348 target_pet = old_target_pet;
351 target_pet = old_target_pet;
353 p_ptr->energy_use = 100;
356 lev = k_info[o_ptr->k_idx].level;
357 if (lev > 50) lev = 50 + (lev - 50) / 2;
359 /* Base chance of success */
360 chance = p_ptr->skill_dev;
362 /* Confusion hurts skill */
363 if (p_ptr->confused) chance = chance / 2;
365 /* Hight level objects are harder */
366 chance = chance - lev;
368 /* Give everyone a (slight) chance */
369 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
376 if (flush_failure) flush();
377 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this wand is freezing too."));
383 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
385 if (flush_failure) flush();
386 msg_print(_("魔法棒をうまく使えなかった。", "You failed to use the wand properly."));
391 /* The wand is already empty! */
392 if (o_ptr->pval <= 0)
394 if (flush_failure) flush();
395 msg_print(_("この魔法棒にはもう魔力が残っていない。", "The wand has no charges left."));
396 o_ptr->ident |= (IDENT_EMPTY);
398 /* Combine / Reorder the pack (later) */
399 p_ptr->update |= (PU_COMBINE | PU_REORDER);
400 p_ptr->window |= (PW_INVEN);
407 ident = wand_effect(o_ptr->sval, dir, FALSE, FALSE);
409 /* Combine / Reorder the pack (later) */
410 p_ptr->update |= (PU_COMBINE | PU_REORDER);
412 if (!(object_is_aware(o_ptr)))
414 chg_virtue(V_PATIENCE, -1);
415 chg_virtue(V_CHANCE, 1);
416 chg_virtue(V_KNOWLEDGE, -1);
419 /* Mark it as tried */
422 /* Apply identification */
423 if (ident && !object_is_aware(o_ptr))
426 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
429 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
432 /* Use a single charge */
435 /* Describe the charges in the pack */
438 inven_item_charges(item);
441 /* Describe the charges on the floor */
444 floor_item_charges(0 - item);
449 * @brief 魔法棒を使うコマンドのメインルーチン /
452 void do_cmd_aim_wand(void)
457 /* Restrict choices to wands */
458 item_tester_tval = TV_WAND;
460 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
462 set_action(ACTION_NONE);
465 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
466 s = _("使える魔法棒がない。", "You have no wand to aim.");
467 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
469 do_cmd_aim_wand_aux(item);