7 * @param sval オブジェクトのsval
9 * @param powerful 強力発動上の処理ならばTRUE
10 * @param magic 魔道具術上の処理ならばTRUE
11 * @return 発動により効果内容が確定したならばTRUEを返す
13 bool wand_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool powerful, bool magic)
16 PLAYER_LEVEL lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
17 POSITION rad = powerful ? 3 : 2;
19 /* XXX Hack -- Wand of wonder can do anything before it */
20 if (sval == SV_WAND_WONDER)
22 int vir = virtue_number(V_CHANCE);
23 sval = (OBJECT_SUBTYPE_VALUE)randint0(SV_WAND_WONDER);
27 if (p_ptr->virtues[vir - 1] > 0)
29 while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
30 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
34 while (randint1(300) < (0 - p_ptr->virtues[vir - 1])) sval--;
35 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
38 if (sval < SV_WAND_TELEPORT_AWAY)
39 chg_virtue(V_CHANCE, 1);
42 /* Analyze the wand */
45 case SV_WAND_HEAL_MONSTER:
47 HIT_POINT dam = damroll((powerful ? 20 : 10), 10);
48 if (heal_monster(dir, dam)) ident = TRUE;
52 case SV_WAND_HASTE_MONSTER:
54 if (speed_monster(dir, lev)) ident = TRUE;
58 case SV_WAND_CLONE_MONSTER:
60 if (clone_monster(dir)) ident = TRUE;
64 case SV_WAND_TELEPORT_AWAY:
66 int distance = MAX_SIGHT * (powerful ? 8 : 5);
67 if (teleport_monster(dir, distance)) ident = TRUE;
71 case SV_WAND_DISARMING:
73 if (disarm_trap(dir)) ident = TRUE;
74 if (powerful && disarm_traps_touch()) ident = TRUE;
78 case SV_WAND_TRAP_DOOR_DEST:
80 if (destroy_door(dir)) ident = TRUE;
81 if (powerful && destroy_doors_touch()) ident = TRUE;
85 case SV_WAND_STONE_TO_MUD:
87 HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
88 if (wall_to_mud(dir, dam)) ident = TRUE;
94 HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
95 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
96 (void)lite_line(dir, dam);
101 case SV_WAND_SLEEP_MONSTER:
103 if (sleep_monster(dir, lev)) ident = TRUE;
107 case SV_WAND_SLOW_MONSTER:
109 if (slow_monster(dir, lev)) ident = TRUE;
113 case SV_WAND_CONFUSE_MONSTER:
115 if (confuse_monster(dir, lev)) ident = TRUE;
119 case SV_WAND_FEAR_MONSTER:
121 if (fear_monster(dir, lev)) ident = TRUE;
125 case SV_WAND_HYPODYNAMIA:
127 if (hypodynamic_bolt(dir, 80 + lev)) ident = TRUE;
131 case SV_WAND_POLYMORPH:
133 if (poly_monster(dir, lev)) ident = TRUE;
137 case SV_WAND_STINKING_CLOUD:
139 fire_ball(GF_POIS, dir, 12 + lev / 4, rad);
144 case SV_WAND_MAGIC_MISSILE:
146 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
151 case SV_WAND_ACID_BOLT:
153 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
158 case SV_WAND_CHARM_MONSTER:
160 if (charm_monster(dir, MAX(20, lev)))
165 case SV_WAND_FIRE_BOLT:
167 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
172 case SV_WAND_COLD_BOLT:
174 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
179 case SV_WAND_ACID_BALL:
181 fire_ball(GF_ACID, dir, 60 + 3 * lev / 4, rad);
186 case SV_WAND_ELEC_BALL:
188 fire_ball(GF_ELEC, dir, 40 + 3 * lev / 4, rad);
193 case SV_WAND_FIRE_BALL:
195 fire_ball(GF_FIRE, dir, 70 + 3 * lev / 4, rad);
200 case SV_WAND_COLD_BALL:
202 fire_ball(GF_COLD, dir, 50 + 3 * lev / 4, rad);
209 msg_print(_("おっと、謎の魔法棒を始動させた。", "Oops. Wand of wonder activated."));
213 case SV_WAND_DRAGON_FIRE:
215 fire_breath(GF_FIRE, dir, (powerful ? 300 : 200), 3);
220 case SV_WAND_DRAGON_COLD:
222 fire_breath(GF_COLD, dir, (powerful ? 270 : 180), 3);
227 case SV_WAND_DRAGON_BREATH:
256 if (powerful) dam = (dam * 3) / 2;
258 fire_breath(typ, dir, dam, 3);
264 case SV_WAND_DISINTEGRATE:
266 fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
271 case SV_WAND_ROCKETS:
273 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
274 fire_rocket(GF_ROCKET, dir, 250 + lev * 3, rad);
279 case SV_WAND_STRIKING:
281 fire_bolt(GF_METEOR, dir, damroll(15 + lev / 3, 13));
286 case SV_WAND_GENOCIDE:
288 fire_ball_hide(GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
297 * @brief 魔法棒を使うコマンドのサブルーチン /
298 * Aim a wand (from the pack or floor).
299 * @param item 使うオブジェクトの所持品ID
303 * Use a single charge from a single item.
304 * Handle "unstacking" in a logical manner.
305 * For simplicity, you cannot use a stack of items from the
306 * ground. This would require too much nasty code.
307 * There are no wands which can "destroy" themselves, in the inventory
308 * or on the ground, so we can ignore this possibility. Note that this
309 * required giving "wand of wonder" the ability to ignore destruction
311 * All wands can be "cancelled" at the "Direction?" prompt for free.
312 * Note that the basic "bolt" wands do slightly less damage than the
313 * basic "bolt" rods, but the basic "ball" wands do the same damage
314 * as the basic "ball" rods.
317 void do_cmd_aim_wand_aux(INVENTORY_IDX item)
323 bool old_target_pet = target_pet;
325 /* Get the item (in the pack) */
328 o_ptr = &inventory[item];
331 /* Get the item (on the floor) */
334 o_ptr = &o_list[0 - item];
337 /* Mega-Hack -- refuse to aim a pile from the ground */
338 if ((item < 0) && (o_ptr->number > 1))
340 msg_print(_("まずは魔法棒を拾わなければ。", "You must first pick up the wands."));
345 /* Allow direction to be cancelled for free */
346 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
347 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
349 if (!get_aim_dir(&dir))
351 target_pet = old_target_pet;
354 target_pet = old_target_pet;
356 p_ptr->energy_use = 100;
359 lev = k_info[o_ptr->k_idx].level;
360 if (lev > 50) lev = 50 + (lev - 50) / 2;
362 /* Base chance of success */
363 chance = p_ptr->skill_dev;
365 /* Confusion hurts skill */
366 if (p_ptr->confused) chance = chance / 2;
368 /* Hight level objects are harder */
369 chance = chance - lev;
371 /* Give everyone a (slight) chance */
372 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
379 if (flush_failure) flush();
380 msg_print(_("止まった時の中ではうまく働かないようだ。", "Nothing happen. Maybe this wand is freezing too."));
386 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
388 if (flush_failure) flush();
389 msg_print(_("魔法棒をうまく使えなかった。", "You failed to use the wand properly."));
394 /* The wand is already empty! */
395 if (o_ptr->pval <= 0)
397 if (flush_failure) flush();
398 msg_print(_("この魔法棒にはもう魔力が残っていない。", "The wand has no charges left."));
399 o_ptr->ident |= (IDENT_EMPTY);
401 /* Combine / Reorder the pack (later) */
402 p_ptr->update |= (PU_COMBINE | PU_REORDER);
403 p_ptr->window |= (PW_INVEN);
410 ident = wand_effect(o_ptr->sval, dir, FALSE, FALSE);
412 /* Combine / Reorder the pack (later) */
413 p_ptr->update |= (PU_COMBINE | PU_REORDER);
415 if (!(object_is_aware(o_ptr)))
417 chg_virtue(V_PATIENCE, -1);
418 chg_virtue(V_CHANCE, 1);
419 chg_virtue(V_KNOWLEDGE, -1);
422 /* Mark it as tried */
425 /* Apply identification */
426 if (ident && !object_is_aware(o_ptr))
429 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
432 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
435 /* Use a single charge */
438 /* Describe the charges in the pack */
441 inven_item_charges(item);
444 /* Describe the charges on the floor */
447 floor_item_charges(0 - item);
452 * @brief 魔法棒を使うコマンドのメインルーチン /
455 void do_cmd_aim_wand(void)
460 if (p_ptr->wild_mode) return;
462 if (p_ptr->inside_arena)
464 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
469 /* Restrict choices to wands */
470 item_tester_tval = TV_WAND;
472 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
474 set_action(ACTION_NONE);
477 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
478 s = _("使える魔法棒がない。", "You have no wand to aim.");
479 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
481 do_cmd_aim_wand_aux(item);