4 #include "spells-status.h"
5 #include "player-status.h"
6 #include "object-hook.h"
12 * @param sval オブジェクトのsval
14 * @param powerful 強力発動上の処理ならばTRUE
15 * @param magic 魔道具術上の処理ならばTRUE
16 * @return 発動により効果内容が確定したならばTRUEを返す
18 bool wand_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool powerful, bool magic)
21 PLAYER_LEVEL lev = powerful ? p_ptr->lev * 2 : p_ptr->lev;
22 POSITION rad = powerful ? 3 : 2;
24 /* XXX Hack -- Wand of wonder can do anything before it */
25 if (sval == SV_WAND_WONDER)
27 int vir = virtue_number(V_CHANCE);
28 sval = (OBJECT_SUBTYPE_VALUE)randint0(SV_WAND_WONDER);
32 if (p_ptr->virtues[vir - 1] > 0)
34 while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
35 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
39 while (randint1(300) < (0 - p_ptr->virtues[vir - 1])) sval--;
40 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
43 if (sval < SV_WAND_TELEPORT_AWAY)
44 chg_virtue(V_CHANCE, 1);
47 /* Analyze the wand */
50 case SV_WAND_HEAL_MONSTER:
52 HIT_POINT dam = damroll((powerful ? 20 : 10), 10);
53 if (heal_monster(dir, dam)) ident = TRUE;
57 case SV_WAND_HASTE_MONSTER:
59 if (speed_monster(dir, lev)) ident = TRUE;
63 case SV_WAND_CLONE_MONSTER:
65 if (clone_monster(dir)) ident = TRUE;
69 case SV_WAND_TELEPORT_AWAY:
71 int distance = MAX_SIGHT * (powerful ? 8 : 5);
72 if (teleport_monster(dir, distance)) ident = TRUE;
76 case SV_WAND_DISARMING:
78 if (disarm_trap(dir)) ident = TRUE;
79 if (powerful && disarm_traps_touch()) ident = TRUE;
83 case SV_WAND_TRAP_DOOR_DEST:
85 if (destroy_door(dir)) ident = TRUE;
86 if (powerful && destroy_doors_touch()) ident = TRUE;
90 case SV_WAND_STONE_TO_MUD:
92 HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
93 if (wall_to_mud(dir, dam)) ident = TRUE;
99 HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
100 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
101 (void)lite_line(dir, dam);
106 case SV_WAND_SLEEP_MONSTER:
108 if (sleep_monster(dir, lev)) ident = TRUE;
112 case SV_WAND_SLOW_MONSTER:
114 if (slow_monster(dir, lev)) ident = TRUE;
118 case SV_WAND_CONFUSE_MONSTER:
120 if (confuse_monster(dir, lev)) ident = TRUE;
124 case SV_WAND_FEAR_MONSTER:
126 if (fear_monster(dir, lev)) ident = TRUE;
130 case SV_WAND_HYPODYNAMIA:
132 if (hypodynamic_bolt(dir, 80 + lev)) ident = TRUE;
136 case SV_WAND_POLYMORPH:
138 if (poly_monster(dir, lev)) ident = TRUE;
142 case SV_WAND_STINKING_CLOUD:
144 fire_ball(GF_POIS, dir, 12 + lev / 4, rad);
149 case SV_WAND_MAGIC_MISSILE:
151 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
156 case SV_WAND_ACID_BOLT:
158 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
163 case SV_WAND_CHARM_MONSTER:
165 if (charm_monster(dir, MAX(20, lev)))
170 case SV_WAND_FIRE_BOLT:
172 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
177 case SV_WAND_COLD_BOLT:
179 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
184 case SV_WAND_ACID_BALL:
186 fire_ball(GF_ACID, dir, 60 + 3 * lev / 4, rad);
191 case SV_WAND_ELEC_BALL:
193 fire_ball(GF_ELEC, dir, 40 + 3 * lev / 4, rad);
198 case SV_WAND_FIRE_BALL:
200 fire_ball(GF_FIRE, dir, 70 + 3 * lev / 4, rad);
205 case SV_WAND_COLD_BALL:
207 fire_ball(GF_COLD, dir, 50 + 3 * lev / 4, rad);
214 msg_print(_("おっと、謎の魔法棒を始動させた。", "Oops. Wand of wonder activated."));
218 case SV_WAND_DRAGON_FIRE:
220 fire_breath(GF_FIRE, dir, (powerful ? 300 : 200), 3);
225 case SV_WAND_DRAGON_COLD:
227 fire_breath(GF_COLD, dir, (powerful ? 270 : 180), 3);
232 case SV_WAND_DRAGON_BREATH:
261 if (powerful) dam = (dam * 3) / 2;
263 fire_breath(typ, dir, dam, 3);
269 case SV_WAND_DISINTEGRATE:
271 fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
276 case SV_WAND_ROCKETS:
278 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
279 fire_rocket(GF_ROCKET, dir, 250 + lev * 3, rad);
284 case SV_WAND_STRIKING:
286 fire_bolt(GF_METEOR, dir, damroll(15 + lev / 3, 13));
291 case SV_WAND_GENOCIDE:
293 fire_ball_hide(GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
302 * @brief 魔法棒を使うコマンドのサブルーチン /
303 * Aim a wand (from the pack or floor).
304 * @param item 使うオブジェクトの所持品ID
308 * Use a single charge from a single item.
309 * Handle "unstacking" in a logical manner.
310 * For simplicity, you cannot use a stack of items from the
311 * ground. This would require too much nasty code.
312 * There are no wands which can "destroy" themselves, in the inventory
313 * or on the ground, so we can ignore this possibility. Note that this
314 * required giving "wand of wonder" the ability to ignore destruction
316 * All wands can be "cancelled" at the "Direction?" prompt for free.
317 * Note that the basic "bolt" wands do slightly less damage than the
318 * basic "bolt" rods, but the basic "ball" wands do the same damage
319 * as the basic "ball" rods.
322 void do_cmd_aim_wand_aux(INVENTORY_IDX item)
328 bool old_target_pet = target_pet;
330 /* Get the item (in the pack) */
333 o_ptr = &inventory[item];
336 /* Get the item (on the floor) */
339 o_ptr = ¤t_floor_ptr->o_list[0 - item];
342 /* Mega-Hack -- refuse to aim a pile from the ground */
343 if ((item < 0) && (o_ptr->number > 1))
345 msg_print(_("まずは魔法棒を拾わなければ。", "You must first pick up the wands."));
350 /* Allow direction to be cancelled for free */
351 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
352 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
354 if (!get_aim_dir(&dir))
356 target_pet = old_target_pet;
359 target_pet = old_target_pet;
361 take_turn(p_ptr, 100);
364 lev = k_info[o_ptr->k_idx].level;
365 if (lev > 50) lev = 50 + (lev - 50) / 2;
367 /* Base chance of success */
368 chance = p_ptr->skill_dev;
370 /* Confusion hurts skill */
371 if (p_ptr->confused) chance = chance / 2;
373 /* Hight level objects are harder */
374 chance = chance - lev;
376 /* Give everyone a (slight) chance */
377 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
382 if (cmd_limit_time_walk(p_ptr)) return;
385 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
387 if (flush_failure) flush();
388 msg_print(_("魔法棒をうまく使えなかった。", "You failed to use the wand properly."));
393 /* The wand is already empty! */
394 if (o_ptr->pval <= 0)
396 if (flush_failure) flush();
397 msg_print(_("この魔法棒にはもう魔力が残っていない。", "The wand has no charges left."));
398 o_ptr->ident |= (IDENT_EMPTY);
399 p_ptr->update |= (PU_COMBINE | PU_REORDER);
400 p_ptr->window |= (PW_INVEN);
407 ident = wand_effect(o_ptr->sval, dir, FALSE, FALSE);
408 p_ptr->update |= (PU_COMBINE | PU_REORDER);
410 if (!(object_is_aware(o_ptr)))
412 chg_virtue(V_PATIENCE, -1);
413 chg_virtue(V_CHANCE, 1);
414 chg_virtue(V_KNOWLEDGE, -1);
417 /* Mark it as tried */
420 /* Apply identification */
421 if (ident && !object_is_aware(o_ptr))
424 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
427 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
430 /* Use a single charge */
433 /* Describe the charges in the pack */
436 inven_item_charges(item);
439 /* Describe the charges on the floor */
442 floor_item_charges(0 - item);
447 * @brief 魔法棒を使うコマンドのメインルーチン /
450 void do_cmd_aim_wand(void)
455 if (p_ptr->wild_mode) return;
456 if (cmd_limit_arena(p_ptr)) return;
458 /* Restrict choices to wands */
459 item_tester_tval = TV_WAND;
461 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
463 set_action(ACTION_NONE);
466 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
467 s = _("使える魔法棒がない。", "You have no wand to aim.");
468 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
470 do_cmd_aim_wand_aux(item);