6 #include "spells-status.h"
7 #include "player-status.h"
8 #include "player-effects.h"
9 #include "player-class.h"
10 #include "player-inventory.h"
11 #include "objectkind.h"
12 #include "object-hook.h"
13 #include "cmd-basic.h"
15 #include "targeting.h"
16 #include "view-mainwindow.h"
20 * @param sval オブジェクトのsval
22 * @param powerful 強力発動上の処理ならばTRUE
23 * @param magic 魔道具術上の処理ならばTRUE
24 * @return 発動により効果内容が確定したならばTRUEを返す
26 bool wand_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool powerful, bool magic)
29 PLAYER_LEVEL lev = powerful ? creature_ptr->lev * 2 : creature_ptr->lev;
30 POSITION rad = powerful ? 3 : 2;
32 /* XXX Hack -- Wand of wonder can do anything before it */
33 if (sval == SV_WAND_WONDER)
35 int vir = virtue_number(creature_ptr, V_CHANCE);
36 sval = (OBJECT_SUBTYPE_VALUE)randint0(SV_WAND_WONDER);
40 if (creature_ptr->virtues[vir - 1] > 0)
42 while (randint1(300) < creature_ptr->virtues[vir - 1]) sval++;
43 if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
47 while (randint1(300) < (0 - creature_ptr->virtues[vir - 1])) sval--;
48 if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
51 if (sval < SV_WAND_TELEPORT_AWAY)
52 chg_virtue(creature_ptr, V_CHANCE, 1);
55 /* Analyze the wand */
58 case SV_WAND_HEAL_MONSTER:
60 HIT_POINT dam = damroll((powerful ? 20 : 10), 10);
61 if (heal_monster(dir, dam)) ident = TRUE;
65 case SV_WAND_HASTE_MONSTER:
67 if (speed_monster(dir, lev)) ident = TRUE;
71 case SV_WAND_CLONE_MONSTER:
73 if (clone_monster(dir)) ident = TRUE;
77 case SV_WAND_TELEPORT_AWAY:
79 int distance = MAX_SIGHT * (powerful ? 8 : 5);
80 if (teleport_monster(dir, distance)) ident = TRUE;
84 case SV_WAND_DISARMING:
86 if (disarm_trap(dir)) ident = TRUE;
87 if (powerful && disarm_traps_touch()) ident = TRUE;
91 case SV_WAND_TRAP_DOOR_DEST:
93 if (destroy_door(dir)) ident = TRUE;
94 if (powerful && destroy_doors_touch()) ident = TRUE;
98 case SV_WAND_STONE_TO_MUD:
100 HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
101 if (wall_to_mud(dir, dam)) ident = TRUE;
107 HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
108 msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
109 (void)lite_line(dir, dam);
114 case SV_WAND_SLEEP_MONSTER:
116 if (sleep_monster(dir, lev)) ident = TRUE;
120 case SV_WAND_SLOW_MONSTER:
122 if (slow_monster(dir, lev)) ident = TRUE;
126 case SV_WAND_CONFUSE_MONSTER:
128 if (confuse_monster(dir, lev)) ident = TRUE;
132 case SV_WAND_FEAR_MONSTER:
134 if (fear_monster(dir, lev)) ident = TRUE;
138 case SV_WAND_HYPODYNAMIA:
140 if (hypodynamic_bolt(dir, 80 + lev)) ident = TRUE;
144 case SV_WAND_POLYMORPH:
146 if (poly_monster(dir, lev)) ident = TRUE;
150 case SV_WAND_STINKING_CLOUD:
152 fire_ball(creature_ptr, GF_POIS, dir, 12 + lev / 4, rad);
157 case SV_WAND_MAGIC_MISSILE:
159 fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + lev / 10, 6));
164 case SV_WAND_ACID_BOLT:
166 fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + lev / 7, 8));
171 case SV_WAND_CHARM_MONSTER:
173 if (charm_monster(dir, MAX(20, lev)))
178 case SV_WAND_FIRE_BOLT:
180 fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + lev / 6, 8));
185 case SV_WAND_COLD_BOLT:
187 fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + lev / 8, 8));
192 case SV_WAND_ACID_BALL:
194 fire_ball(creature_ptr, GF_ACID, dir, 60 + 3 * lev / 4, rad);
199 case SV_WAND_ELEC_BALL:
201 fire_ball(creature_ptr, GF_ELEC, dir, 40 + 3 * lev / 4, rad);
206 case SV_WAND_FIRE_BALL:
208 fire_ball(creature_ptr, GF_FIRE, dir, 70 + 3 * lev / 4, rad);
213 case SV_WAND_COLD_BALL:
215 fire_ball(creature_ptr, GF_COLD, dir, 50 + 3 * lev / 4, rad);
222 msg_print(_("おっと、謎の魔法棒を始動させた。", "Oops. Wand of wonder activated."));
226 case SV_WAND_DRAGON_FIRE:
228 fire_breath(creature_ptr, GF_FIRE, dir, (powerful ? 300 : 200), 3);
233 case SV_WAND_DRAGON_COLD:
235 fire_breath(creature_ptr, GF_COLD, dir, (powerful ? 270 : 180), 3);
240 case SV_WAND_DRAGON_BREATH:
269 if (powerful) dam = (dam * 3) / 2;
271 fire_breath(creature_ptr, typ, dir, dam, 3);
277 case SV_WAND_DISINTEGRATE:
279 fire_ball(creature_ptr, GF_DISINTEGRATE, dir, 200 + randint1(lev * 2), rad);
284 case SV_WAND_ROCKETS:
286 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
287 fire_rocket(creature_ptr, GF_ROCKET, dir, 250 + lev * 3, rad);
292 case SV_WAND_STRIKING:
294 fire_bolt(creature_ptr, GF_METEOR, dir, damroll(15 + lev / 3, 13));
299 case SV_WAND_GENOCIDE:
301 fire_ball_hide(creature_ptr, GF_GENOCIDE, dir, magic ? lev + 50 : 250, 0);
310 * @brief 魔法棒を使うコマンドのサブルーチン /
311 * Aim a wand (from the pack or floor).
312 * @param item 使うオブジェクトの所持品ID
316 * Use a single charge from a single item.
317 * Handle "unstacking" in a logical manner.
318 * For simplicity, you cannot use a stack of items from the
319 * ground. This would require too much nasty code.
320 * There are no wands which can "destroy" themselves, in the inventory
321 * or on the ground, so we can ignore this possibility. Note that this
322 * required giving "wand of wonder" the ability to ignore destruction
324 * All wands can be "cancelled" at the "Direction?" prompt for free.
325 * Note that the basic "bolt" wands do slightly less damage than the
326 * basic "bolt" rods, but the basic "ball" wands do the same damage
327 * as the basic "ball" rods.
330 void exe_aim_wand(player_type *creature_ptr, INVENTORY_IDX item)
336 bool old_target_pet = target_pet;
338 o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
340 /* Mega-Hack -- refuse to aim a pile from the ground */
341 if ((item < 0) && (o_ptr->number > 1))
343 msg_print(_("まずは魔法棒を拾わなければ。", "You must first pick up the wands."));
348 /* Allow direction to be cancelled for free */
349 if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
350 || o_ptr->sval == SV_WAND_HASTE_MONSTER))
352 if (!get_aim_dir(&dir))
354 target_pet = old_target_pet;
357 target_pet = old_target_pet;
359 take_turn(creature_ptr, 100);
362 lev = k_info[o_ptr->k_idx].level;
363 if (lev > 50) lev = 50 + (lev - 50) / 2;
365 /* Base chance of success */
366 chance = creature_ptr->skill_dev;
368 /* Confusion hurts skill */
369 if (creature_ptr->confused) chance = chance / 2;
371 /* Hight level objects are harder */
372 chance = chance - lev;
374 /* Give everyone a (slight) chance */
375 if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
380 if (cmd_limit_time_walk(creature_ptr)) return;
383 if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (creature_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);
397 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
398 creature_ptr->window |= (PW_INVEN);
405 ident = wand_effect(creature_ptr, o_ptr->sval, dir, FALSE, FALSE);
406 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
408 if (!(object_is_aware(o_ptr)))
410 chg_virtue(creature_ptr, V_PATIENCE, -1);
411 chg_virtue(creature_ptr, V_CHANCE, 1);
412 chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
415 /* Mark it as tried */
418 /* Apply identification */
419 if (ident && !object_is_aware(o_ptr))
422 gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
425 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
428 /* Use a single charge */
431 /* Describe the charges in the pack */
434 inven_item_charges(item);
437 /* Describe the charges on the floor */
440 floor_item_charges(0 - item);
445 * @brief 魔法棒を使うコマンドのメインルーチン /
448 void do_cmd_aim_wand(player_type *creature_ptr)
453 if (creature_ptr->wild_mode) return;
454 if (cmd_limit_arena(creature_ptr)) return;
455 if (creature_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
457 set_action(creature_ptr, ACTION_NONE);
460 q = _("どの魔法棒で狙いますか? ", "Aim which wand? ");
461 s = _("使える魔法棒がない。", "You have no wand to aim.");
462 if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_WAND)) return;
464 exe_aim_wand(creature_ptr, item);