static void _on_fail(const spell_info *spell) { if (randint1(100) < (spell->fail / 2)) { int b = randint1(100); if (b < 5) { msg_print("Oh, no! Your mind has gone blank!"); lose_all_info(); } else if (b < 15) { msg_print("Weird visions seem to dance before your eyes..."); set_image(p_ptr->image + 5 + randint1(10), FALSE); } else if (b < 45) { msg_print("Your brain is addled!"); set_confused(p_ptr->confused + randint1(8), FALSE); } else if (b < 90) { set_stun(p_ptr->stun + randint1(8), FALSE); } else { msg_print("Your mind unleashes its power in an uncontrollable storm!"); project(PROJECT_WHO_UNCTRL_POWER, 2 + p_ptr->lev / 10, py, px, p_ptr->lev * 2, GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1); p_ptr->csp = MAX(0, p_ptr->csp - p_ptr->lev * MAX(1, p_ptr->lev / 10)); } } }
static void _first_aid_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "First Aid"); break; case SPELL_DESC: if (p_ptr->lev < 8) var_set_string(res, "Heals HP and Stun."); else if (p_ptr->lev < 12) var_set_string(res, "Heals HP and Stun. Cures cuts."); else if (p_ptr->lev < 16) var_set_string(res, "Heals HP and Stun. Cures cuts and slows poison."); else if (p_ptr->lev < 20) var_set_string(res, "Heals HP and Stun. Cures cuts and poison."); else if (p_ptr->lev < 30) var_set_string(res, "Heals HP and Stun. Cures cuts, poison and blindness."); else if (p_ptr->lev < 40) var_set_string(res, "Heals HP and Stun. Cures cuts, poison and blindness. Restores Con."); else if (p_ptr->lev < 45) var_set_string(res, "Heals HP and Stun. Cures cuts, poison and blindness. Restores Con and Chr."); else var_set_string(res, "Heals HP and Stun. Cures cuts, poison and blindness. Restores Con, Chr and Str."); break; case SPELL_SPOIL_DESC: var_set_string(res, "Heals HP and Stun. Slows Poison (L12). Cures cuts (L8), poison (L16) and blindness (L20). Restores Con (L30), Chr (L40) and Str (L45)."); break; case SPELL_INFO: var_set_string(res, info_heal(0, 0, spell_power(p_ptr->lev))); break; case SPELL_CAST: hp_player(spell_power(p_ptr->lev)); set_stun(0, TRUE); if (p_ptr->lev >= 8) set_cut(0, TRUE); if (p_ptr->lev >= 12 && p_ptr->lev < 16) set_poisoned(p_ptr->poisoned / 2, TRUE); if (p_ptr->lev >= 16) set_poisoned(0, TRUE); if (p_ptr->lev >= 20) set_blind(0, TRUE); if (p_ptr->lev >= 30) do_res_stat(A_CON); if (p_ptr->lev >= 40) do_res_stat(A_CHR); if (p_ptr->lev >= 45) do_res_stat(A_STR); var_set_bool(res, TRUE); break; case SPELL_COST_EXTRA: var_set_int(res, p_ptr->lev / 5); break; default: default_spell(cmd, res); break; } }
void _adrenaline_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Adrenaline Channeling"); break; case SPELL_DESC: var_set_string(res, "Removes fear and stun. Gives heroism and speed. Heals HP a little unless " "you already have heroism and temporary speed boost."); break; case SPELL_SPOIL_DESC: var_set_string(res, "Removes stun. Heals 10 + 1d(L*3/2). Grants heroism and haste."); break; case SPELL_CAST: { int dur = spell_power(15 + randint1(p_ptr->lev*3/2)); bool heal = !IS_FAST() || !IS_HERO(); /* Prevent spamming this as a weak healing spell */ set_stun(0, TRUE); set_hero(dur, FALSE); set_fast(dur, FALSE); if (heal) /* Heal after granting Heroism to fill the +10 mhp */ hp_player(p_ptr->lev); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
/*! * @brief プレイヤーを完全回復する / * Cure everything instantly * @return なし */ static void do_cmd_wiz_cure_all(void) { /* Restore stats */ (void)res_stat(A_STR); (void)res_stat(A_INT); (void)res_stat(A_WIS); (void)res_stat(A_CON); (void)res_stat(A_DEX); (void)res_stat(A_CHR); /* Restore the level */ (void)restore_level(); /* Heal the player */ if (p_ptr->chp < p_ptr->mhp) { p_ptr->chp = p_ptr->mhp; p_ptr->chp_frac = 0; /* Redraw */ p_ptr->redraw |= (PR_HP); /* Window stuff */ p_ptr->window |= (PW_PLAYER); } /* Restore mana */ if (p_ptr->csp < p_ptr->msp) { p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; p_ptr->redraw |= (PR_MANA); p_ptr->window |= (PW_PLAYER); p_ptr->window |= (PW_SPELL); } /* Cure stuff */ (void)set_blind(0); (void)set_confused(0); (void)set_poisoned(0); (void)set_afraid(0); (void)set_paralyzed(0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); (void)set_slow(0, TRUE); /* No longer hungry */ (void)set_food(PY_FOOD_MAX - 1); }
static void _rage_strike_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Ragestrike"); break; case SPELL_DESC: var_set_string(res, "Fire a ball of pure rage at chosen foe, striking with everything you've got!"); break; case SPELL_INFO: var_set_string(res, info_damage(0, 0, _rage_strike_dam())); break; case SPELL_FAIL: sp_player(-p_ptr->csp); break; case SPELL_CAST: { int dir; var_set_bool(res, FALSE); if (p_ptr->chp < 100) { if (!get_check("Really? This will kill you!")) return; } if (!get_aim_dir(&dir)) return; fire_ball(GF_MISSILE, dir, _rage_strike_dam(), 0); take_hit(DAMAGE_NOESCAPE, 100, "Rage", -1); if (!p_ptr->shero) set_stun(99, FALSE); /* 100 is Knocked Out */ sp_player(-p_ptr->csp); /* Don't use SPELL_COST_EXTRA since we pay mana up front these days! */ var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
/* * Cure everything instantly */ static void do_cmd_wiz_cure_all(void) { /* Remove curses */ (void)remove_all_curse(); /* Restore stats */ (void)res_stat(A_STR, 200); (void)res_stat(A_INT, 200); (void)res_stat(A_WIS, 200); (void)res_stat(A_CON, 200); (void)res_stat(A_DEX, 200); (void)res_stat(A_CHR, 200); /* Restore the level */ (void)restore_level(); /* Heal the player */ p_ptr->chp = p_ptr->mhp; p_ptr->chp_frac = 0; /* Restore mana */ p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; /* Cure stuff */ (void)set_blind(0); (void)set_confused(0); (void)set_poisoned(0); (void)set_afraid(0); (void)set_paralyzed(0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); (void)set_slow(0); /* No longer hungry */ (void)set_food(PY_FOOD_MAX - 1); /* Redraw everything */ do_cmd_redraw(); }
void healing_II_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Healing"); break; case SPELL_DESC: var_set_string(res, "Powerful healing magic: heals hitpoints, cuts and stun."); break; case SPELL_INFO: var_set_string(res, format("Heals %d", spell_power(500))); break; case SPELL_CAST: hp_player(spell_power(500)); set_stun(0, TRUE); set_cut(0, TRUE); var_set_bool(res, TRUE); break; default: default_spell(cmd, res); break; } }
/* * Cure everything instantly */ static void do_cmd_wiz_cure_all(void) { /* Remove curses */ (void)remove_curse(TRUE); /* Restore stats */ (void)res_stat(A_STR, 20); (void)res_stat(A_CON, 20); (void)res_stat(A_DEX, 20); (void)res_stat(A_GRA, 20); /* Heal the player */ p_ptr->chp = p_ptr->mhp; p_ptr->chp_frac = 0; /* Restore mana */ p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; /* Cure stuff */ (void)set_blind(0); (void)set_confused(0); (void)set_poisoned(0); (void)set_afraid(0); (void)set_entranced(0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); (void)set_slow(0); /* No longer hungry */ (void)set_food(PY_FOOD_FULL - 1); /* Redraw everything */ do_cmd_redraw(); }
static bool use_staff(object_type *o_ptr, bool *ident) { int py = p_ptr->py; int px = p_ptr->px; int k; bool use_charge = TRUE; /* Analyze the staff */ switch (o_ptr->sval) { case SV_STAFF_DARKNESS: { if (!p_ptr->resist_blind) { if (set_blind(p_ptr->blind + 3 + randint(5))) *ident = TRUE; } if (unlite_area(10, 3)) *ident = TRUE; break; } case SV_STAFF_SLOWNESS: { if (set_slow(p_ptr->slow + randint(30) + 15)) *ident = TRUE; break; } case SV_STAFF_HASTE_MONSTERS: { if (speed_monsters()) *ident = TRUE; break; } case SV_STAFF_SUMMONING: { for (k = 0; k < randint(4); k++) { if (summon_specific(py, px, p_ptr->depth, 0)) { *ident = TRUE; } } break; } case SV_STAFF_TELEPORTATION: { teleport_player(100); *ident = TRUE; break; } case SV_STAFF_IDENTIFY: { if (!ident_spell()) use_charge = FALSE; *ident = TRUE; break; } case SV_STAFF_REMOVE_CURSE: { if (remove_curse()) { if (!p_ptr->blind) { msg_print("The staff glows blue for a moment..."); } *ident = TRUE; } break; } case SV_STAFF_STARLITE: { if (!p_ptr->blind) { msg_print("The end of the staff glows brightly..."); } for (k = 0; k < 8; k++) lite_line(ddd[k]); *ident = TRUE; break; } case SV_STAFF_LITE: { if (lite_area(damroll(2, 8), 2)) *ident = TRUE; break; } case SV_STAFF_MAPPING: { map_area(); *ident = TRUE; break; } case SV_STAFF_DETECT_GOLD: { if (detect_treasure()) *ident = TRUE; if (detect_objects_gold()) *ident = TRUE; break; } case SV_STAFF_DETECT_ITEM: { if (detect_objects_normal()) *ident = TRUE; break; } case SV_STAFF_DETECT_TRAP: { if (detect_traps()) *ident = TRUE; break; } case SV_STAFF_DETECT_DOOR: { if (detect_doors()) *ident = TRUE; if (detect_stairs()) *ident = TRUE; break; } case SV_STAFF_DETECT_INVIS: { if (detect_monsters_invis()) *ident = TRUE; break; } case SV_STAFF_DETECT_EVIL: { if (detect_monsters_evil()) *ident = TRUE; break; } case SV_STAFF_CURE_LIGHT: { if (hp_player(randint(8))) *ident = TRUE; break; } case SV_STAFF_CURING: { if (set_blind(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_STAFF_HEALING: { if (hp_player(300)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_STAFF_THE_MAGI: { if (do_res_stat(A_INT)) *ident = TRUE; if (p_ptr->csp < p_ptr->msp) { p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; *ident = TRUE; msg_print("Your feel your head clear."); p_ptr->redraw |= (PR_MANA); p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1); } break; } case SV_STAFF_SLEEP_MONSTERS: { if (sleep_monsters()) *ident = TRUE; break; } case SV_STAFF_SLOW_MONSTERS: { if (slow_monsters()) *ident = TRUE; break; } case SV_STAFF_SPEED: { if (!p_ptr->fast) { if (set_fast(randint(30) + 15)) *ident = TRUE; } else { (void)set_fast(p_ptr->fast + 5); } break; } case SV_STAFF_PROBING: { probing(); *ident = TRUE; break; } case SV_STAFF_DISPEL_EVIL: { if (dispel_evil(60)) *ident = TRUE; break; } case SV_STAFF_POWER: { if (dispel_monsters(120)) *ident = TRUE; break; } case SV_STAFF_HOLINESS: { if (dispel_evil(120)) *ident = TRUE; k = 3 * p_ptr->lev; if (set_protevil(p_ptr->protevil + randint(25) + k)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_afraid(0)) *ident = TRUE; if (hp_player(50)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_STAFF_BANISHMENT: { (void)banishment(); *ident = TRUE; break; } case SV_STAFF_EARTHQUAKES: { earthquake(py, px, 10); *ident = TRUE; break; } case SV_STAFF_DESTRUCTION: { destroy_area(py, px, 15, TRUE); *ident = TRUE; break; } } return (use_charge); }
/* * Attack the player via physical attacks. */ bool make_attack_normal(int m_idx) { monster_type *m_ptr = &mon_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_lore *l_ptr = &l_list[m_ptr->r_idx]; int ap_cnt; int i, k, tmp, ac, rlev; int do_cut, do_stun; s32b gold; object_type *o_ptr; char o_name[80]; char m_name[80]; char ddesc[80]; bool blinked; /* Not allowed to attack */ if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return (FALSE); /* Total armor */ ac = p_ptr->ac + p_ptr->to_a; /* Extract the effective monster level */ rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); /* Get the monster name (or "it") */ monster_desc(m_name, sizeof(m_name), m_ptr, 0); /* Get the "died from" information (i.e. "a kobold") */ monster_desc(ddesc, sizeof(ddesc), m_ptr, 0x88); /* Assume no blink */ blinked = FALSE; /* Scan through all blows */ for (ap_cnt = 0; ap_cnt < MONSTER_BLOW_MAX; ap_cnt++) { bool visible = FALSE; bool obvious = FALSE; int power = 0; int damage = 0; cptr act = NULL; /* Extract the attack infomation */ int effect = r_ptr->blow[ap_cnt].effect; int method = r_ptr->blow[ap_cnt].method; int d_dice = r_ptr->blow[ap_cnt].d_dice; int d_side = r_ptr->blow[ap_cnt].d_side; /* Hack -- no more attacks */ if (!method) break; /* Handle "leaving" */ if (p_ptr->leaving) break; /* Extract visibility (before blink) */ if (m_ptr->ml) visible = TRUE; /* Extract the attack "power" */ switch (effect) { case RBE_HURT: power = 60; break; case RBE_POISON: power = 5; break; case RBE_UN_BONUS: power = 20; break; case RBE_UN_POWER: power = 15; break; case RBE_EAT_GOLD: power = 5; break; case RBE_EAT_ITEM: power = 5; break; case RBE_EAT_FOOD: power = 5; break; case RBE_EAT_LITE: power = 5; break; case RBE_ACID: power = 0; break; case RBE_ELEC: power = 10; break; case RBE_FIRE: power = 10; break; case RBE_COLD: power = 10; break; case RBE_BLIND: power = 2; break; case RBE_CONFUSE: power = 10; break; case RBE_TERRIFY: power = 10; break; case RBE_PARALYZE: power = 2; break; case RBE_LOSE_STR: power = 0; break; case RBE_LOSE_DEX: power = 0; break; case RBE_LOSE_CON: power = 0; break; case RBE_LOSE_INT: power = 0; break; case RBE_LOSE_WIS: power = 0; break; case RBE_LOSE_CHR: power = 0; break; case RBE_LOSE_ALL: power = 2; break; case RBE_SHATTER: power = 60; break; case RBE_EXP_10: power = 5; break; case RBE_EXP_20: power = 5; break; case RBE_EXP_40: power = 5; break; case RBE_EXP_80: power = 5; break; case RBE_HALLU: power = 10; break; } /* Monster hits player */ if (!effect || check_hit(power, rlev)) { /* Always disturbing */ disturb(1, 0); /* Hack -- Apply "protection from evil" */ if ((p_ptr->protevil > 0) && (r_ptr->flags3 & (RF3_EVIL)) && (p_ptr->lev >= rlev) && ((rand_int(100) + p_ptr->lev) > 50)) { /* Remember the Evil-ness */ if (m_ptr->ml) { l_ptr->flags3 |= (RF3_EVIL); } /* Message */ msg_format("%^s is repelled.", m_name); /* Hack -- Next attack */ continue; } /* Assume no cut or stun */ do_cut = do_stun = 0; /* Describe the attack method */ switch (method) { case RBM_HIT: { act = "hits you."; do_cut = do_stun = 1; break; } case RBM_TOUCH: { act = "touches you."; break; } case RBM_PUNCH: { act = "punches you."; do_stun = 1; break; } case RBM_KICK: { act = "kicks you."; do_stun = 1; break; } case RBM_CLAW: { act = "claws you."; do_cut = 1; break; } case RBM_BITE: { act = "bites you."; do_cut = 1; break; } case RBM_STING: { act = "stings you."; break; } case RBM_XXX1: { act = "XXX1's you."; break; } case RBM_BUTT: { act = "butts you."; do_stun = 1; break; } case RBM_CRUSH: { act = "crushes you."; do_stun = 1; break; } case RBM_ENGULF: { act = "engulfs you."; break; } case RBM_XXX2: { act = "XXX2's you."; break; } case RBM_CRAWL: { act = "crawls on you."; break; } case RBM_DROOL: { act = "drools on you."; break; } case RBM_SPIT: { act = "spits on you."; break; } case RBM_XXX3: { act = "XXX3's on you."; break; } case RBM_GAZE: { act = "gazes at you."; break; } case RBM_WAIL: { act = "wails at you."; break; } case RBM_SPORE: { act = "releases spores at you."; break; } case RBM_XXX4: { act = "projects XXX4's at you."; break; } case RBM_BEG: { act = "begs you for money."; break; } case RBM_INSULT: { act = desc_insult[rand_int(MAX_DESC_INSULT)]; break; } case RBM_MOAN: { act = desc_moan[rand_int(MAX_DESC_MOAN)]; break; } case RBM_XXX5: { act = "XXX5's you."; break; } } /* Message */ if (act) msg_format("%^s %s", m_name, act); /* Hack -- assume all attacks are obvious */ obvious = TRUE; /* Roll out the damage */ damage = damroll(d_dice, d_side); /* Apply appropriate damage */ switch (effect) { case 0: { /* Hack -- Assume obvious */ obvious = TRUE; /* Hack -- No damage */ damage = 0; break; } case RBE_HURT: { /* Obvious */ obvious = TRUE; /* Hack -- Player armor reduces total damage */ damage -= (damage * ((ac < 150) ? ac : 150) / 250); /* Take damage */ take_hit(damage, ddesc); break; } case RBE_POISON: { /* Take damage */ take_hit(damage, ddesc); /* Take "poison" effect */ if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) { if (set_poisoned(p_ptr->poisoned + randint(rlev) + 5)) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_POIS); break; } case RBE_UN_BONUS: { /* Take damage */ take_hit(damage, ddesc); /* Allow complete resist */ if (!p_ptr->resist_disen) { /* Apply disenchantment */ if (apply_disenchant(0)) obvious = TRUE; } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_DISEN); break; } case RBE_UN_POWER: { /* Take damage */ take_hit(damage, ddesc); /* Find an item */ for (k = 0; k < 10; k++) { /* Pick an item */ i = rand_int(INVEN_PACK); /* Obtain the item */ o_ptr = &inventory[i]; /* Skip non-objects */ if (!o_ptr->k_idx) continue; /* Drain charged wands/staffs */ if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)) && (o_ptr->pval > 0)) { /* Calculate healed hitpoints */ int heal = rlev * o_ptr->pval * o_ptr->number; /* Don't heal more than max hp */ heal = MIN(heal, m_ptr->maxhp - m_ptr->hp); /* Message */ msg_print("Energy drains from your pack!"); /* Obvious */ obvious = TRUE; /* Heal */ m_ptr->hp += heal; /* Redraw (later) if needed */ if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH); /* Uncharge */ o_ptr->pval = 0; /* Combine / Reorder the pack */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); /* Window stuff */ p_ptr->window |= (PW_INVEN); /* Done */ break; } } break; } case RBE_EAT_GOLD: { /* Take damage */ take_hit(damage, ddesc); /* Obvious */ obvious = TRUE; /* Saving throw (unless paralyzed) based on dex and level */ if (!p_ptr->paralyzed && (rand_int(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] + p_ptr->lev))) { /* Saving throw message */ msg_print("You quickly protect your money pouch!"); /* Occasional blink anyway */ if (rand_int(3)) blinked = TRUE; } /* Eat gold */ else { gold = (p_ptr->au / 10) + randint(25); if (gold < 2) gold = 2; if (gold > 5000) gold = (p_ptr->au / 20) + randint(3000); if (gold > p_ptr->au) gold = p_ptr->au; p_ptr->au -= gold; if (gold <= 0) { msg_print("Nothing was stolen."); } else if (p_ptr->au) { msg_print("Your purse feels lighter."); msg_format("%ld coins were stolen!", (long)gold); } else { msg_print("Your purse feels lighter."); msg_print("All of your coins were stolen!"); } /* Redraw gold */ p_ptr->redraw |= (PR_GOLD); /* Window stuff */ p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1); /* Blink away */ blinked = TRUE; } break; } case RBE_EAT_ITEM: { /* Take damage */ take_hit(damage, ddesc); /* Saving throw (unless paralyzed) based on dex and level */ if (!p_ptr->paralyzed && (rand_int(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] + p_ptr->lev))) { /* Saving throw message */ msg_print("You grab hold of your backpack!"); /* Occasional "blink" anyway */ blinked = TRUE; /* Obvious */ obvious = TRUE; /* Done */ break; } /* Find an item */ for (k = 0; k < 10; k++) { object_type *i_ptr; object_type object_type_body; /* Pick an item */ i = rand_int(INVEN_PACK); /* Obtain the item */ o_ptr = &inventory[i]; /* Skip non-objects */ if (!o_ptr->k_idx) continue; /* Skip artifacts */ if (artifact_p(o_ptr)) continue; /* Get a description */ object_desc(o_name, sizeof(o_name), o_ptr, FALSE, 3); /* Message */ msg_format("%sour %s (%c) was stolen!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i)); /* Get local object */ i_ptr = &object_type_body; /* Obtain local object */ object_copy(i_ptr, o_ptr); /* Modify number */ i_ptr->number = 1; /* Carry the object */ (void)monster_carry(m_idx, i_ptr); /* Steal the items */ inven_item_increase(i, -1); inven_item_optimize(i); /* Obvious */ obvious = TRUE; /* Blink away */ blinked = TRUE; /* Done */ break; } break; } case RBE_EAT_FOOD: { /* Take damage */ take_hit(damage, ddesc); /* Steal some food */ for (k = 0; k < 10; k++) { /* Pick an item from the pack */ i = rand_int(INVEN_PACK); /* Get the item */ o_ptr = &inventory[i]; /* Skip non-objects */ if (!o_ptr->k_idx) continue; /* Skip non-food objects */ if (o_ptr->tval != TV_FOOD) continue; /* Get a description */ object_desc(o_name, sizeof(o_name), o_ptr, FALSE, 0); /* Message */ msg_format("%sour %s (%c) was eaten!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i)); /* Steal the items */ inven_item_increase(i, -1); inven_item_optimize(i); /* Obvious */ obvious = TRUE; /* Done */ break; } break; } case RBE_EAT_LITE: { /* Take damage */ take_hit(damage, ddesc); /* Get the lite */ o_ptr = &inventory[INVEN_LITE]; /* Drain fuel */ if ((o_ptr->pval > 0) && (!artifact_p(o_ptr))) { /* Reduce fuel */ o_ptr->pval -= (250 + randint(250)); if (o_ptr->pval < 1) o_ptr->pval = 1; /* Notice */ if (!p_ptr->blind) { msg_print("Your light dims."); obvious = TRUE; } /* Window stuff */ p_ptr->window |= (PW_EQUIP); } break; } case RBE_ACID: { /* Obvious */ obvious = TRUE; /* Message */ msg_print("You are covered in acid!"); /* Special damage */ acid_dam(damage, ddesc); /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_ACID); break; } case RBE_ELEC: { /* Obvious */ obvious = TRUE; /* Message */ msg_print("You are struck by electricity!"); /* Take damage (special) */ elec_dam(damage, ddesc); /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_ELEC); break; } case RBE_FIRE: { /* Obvious */ obvious = TRUE; /* Message */ msg_print("You are enveloped in flames!"); /* Take damage (special) */ fire_dam(damage, ddesc); /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_FIRE); break; } case RBE_COLD: { /* Obvious */ obvious = TRUE; /* Message */ msg_print("You are covered with frost!"); /* Take damage (special) */ cold_dam(damage, ddesc); /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_COLD); break; } case RBE_BLIND: { /* Take damage */ take_hit(damage, ddesc); /* Increase "blind" */ if (!p_ptr->resist_blind) { if (set_blind(p_ptr->blind + 10 + randint(rlev))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_BLIND); break; } case RBE_CONFUSE: { /* Take damage */ take_hit(damage, ddesc); /* Increase "confused" */ if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + 3 + randint(rlev))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_CONFU); break; } case RBE_TERRIFY: { /* Take damage */ take_hit(damage, ddesc); /* Increase "afraid" */ if (p_ptr->resist_fear) { msg_print("You stand your ground!"); obvious = TRUE; } else if (rand_int(100) < p_ptr->skill_sav) { msg_print("You stand your ground!"); obvious = TRUE; } else { if (set_afraid(p_ptr->afraid + 3 + randint(rlev))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_FEAR); break; } case RBE_PARALYZE: { /* Hack -- Prevent perma-paralysis via damage */ if (p_ptr->paralyzed && (damage < 1)) damage = 1; /* Take damage */ take_hit(damage, ddesc); /* Increase "paralyzed" */ if (p_ptr->free_act) { msg_print("You are unaffected!"); obvious = TRUE; } else if (rand_int(100) < p_ptr->skill_sav) { msg_print("You resist the effects!"); obvious = TRUE; } else { if (set_paralyzed(p_ptr->paralyzed + 3 + randint(rlev))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_FREE); break; } case RBE_LOSE_STR: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_STR)) obvious = TRUE; break; } case RBE_LOSE_INT: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_INT)) obvious = TRUE; break; } case RBE_LOSE_WIS: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_WIS)) obvious = TRUE; break; } case RBE_LOSE_DEX: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_DEX)) obvious = TRUE; break; } case RBE_LOSE_CON: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_CON)) obvious = TRUE; break; } case RBE_LOSE_CHR: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_CHR)) obvious = TRUE; break; } case RBE_LOSE_ALL: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stats) */ if (do_dec_stat(A_STR)) obvious = TRUE; if (do_dec_stat(A_DEX)) obvious = TRUE; if (do_dec_stat(A_CON)) obvious = TRUE; if (do_dec_stat(A_INT)) obvious = TRUE; if (do_dec_stat(A_WIS)) obvious = TRUE; if (do_dec_stat(A_CHR)) obvious = TRUE; break; } case RBE_SHATTER: { /* Obvious */ obvious = TRUE; /* Hack -- Reduce damage based on the player armor class */ damage -= (damage * ((ac < 150) ? ac : 150) / 250); /* Take damage */ take_hit(damage, ddesc); /* Radius 8 earthquake centered at the monster */ if (damage > 23) earthquake(m_ptr->fy, m_ptr->fx, 8); break; } case RBE_EXP_10: { /* Obvious */ obvious = TRUE; /* Take damage */ take_hit(damage, ddesc); if (p_ptr->hold_life && (rand_int(100) < 95)) { msg_print("You keep hold of your life force!"); } else { s32b d = damroll(10, 6) + (p_ptr->exp/100) * MON_DRAIN_LIFE; if (p_ptr->hold_life) { msg_print("You feel your life slipping away!"); lose_exp(d/10); } else { msg_print("You feel your life draining away!"); lose_exp(d); } } break; } case RBE_EXP_20: { /* Obvious */ obvious = TRUE; /* Take damage */ take_hit(damage, ddesc); if (p_ptr->hold_life && (rand_int(100) < 90)) { msg_print("You keep hold of your life force!"); } else { s32b d = damroll(20, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; if (p_ptr->hold_life) { msg_print("You feel your life slipping away!"); lose_exp(d / 10); } else { msg_print("You feel your life draining away!"); lose_exp(d); } } break; } case RBE_EXP_40: { /* Obvious */ obvious = TRUE; /* Take damage */ take_hit(damage, ddesc); if (p_ptr->hold_life && (rand_int(100) < 75)) { msg_print("You keep hold of your life force!"); } else { s32b d = damroll(40, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; if (p_ptr->hold_life) { msg_print("You feel your life slipping away!"); lose_exp(d / 10); } else { msg_print("You feel your life draining away!"); lose_exp(d); } } break; } case RBE_EXP_80: { /* Obvious */ obvious = TRUE; /* Take damage */ take_hit(damage, ddesc); if (p_ptr->hold_life && (rand_int(100) < 50)) { msg_print("You keep hold of your life force!"); } else { s32b d = damroll(80, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; if (p_ptr->hold_life) { msg_print("You feel your life slipping away!"); lose_exp(d / 10); } else { msg_print("You feel your life draining away!"); lose_exp(d); } } break; } case RBE_HALLU: { /* Take damage */ take_hit(damage, ddesc); /* Increase "image" */ if (!p_ptr->resist_chaos) { if (set_image(p_ptr->image + 3 + randint(rlev / 2))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_CHAOS); break; } } /* Hack -- only one of cut or stun */ if (do_cut && do_stun) { /* Cancel cut */ if (rand_int(100) < 50) { do_cut = 0; } /* Cancel stun */ else { do_stun = 0; } } /* Handle cut */ if (do_cut) { int k; /* Critical hit (zero if non-critical) */ tmp = monster_critical(d_dice, d_side, damage); /* Roll for damage */ switch (tmp) { case 0: k = 0; break; case 1: k = randint(5); break; case 2: k = randint(5) + 5; break; case 3: k = randint(20) + 20; break; case 4: k = randint(50) + 50; break; case 5: k = randint(100) + 100; break; case 6: k = 300; break; default: k = 500; break; } /* Apply the cut */ if (k) (void)set_cut(p_ptr->cut + k); } /* Handle stun */ if (do_stun) { int k; /* Critical hit (zero if non-critical) */ tmp = monster_critical(d_dice, d_side, damage); /* Roll for damage */ switch (tmp) { case 0: k = 0; break; case 1: k = randint(5); break; case 2: k = randint(10) + 10; break; case 3: k = randint(20) + 20; break; case 4: k = randint(30) + 30; break; case 5: k = randint(40) + 40; break; case 6: k = 100; break; default: k = 200; break; } /* Apply the stun */ if (k) (void)set_stun(p_ptr->stun + k); } } /* Monster missed player */ else { /* Analyze failed attacks */ switch (method) { case RBM_HIT: case RBM_TOUCH: case RBM_PUNCH: case RBM_KICK: case RBM_CLAW: case RBM_BITE: case RBM_STING: case RBM_XXX1: case RBM_BUTT: case RBM_CRUSH: case RBM_ENGULF: case RBM_XXX2: /* Visible monsters */ if (m_ptr->ml) { /* Disturbing */ disturb(1, 0); /* Message */ msg_format("%^s misses you.", m_name); } break; } } /* Analyze "visible" monsters only */ if (visible) { /* Count "obvious" attacks (and ones that cause damage) */ if (obvious || damage || (l_ptr->blows[ap_cnt] > 10)) { /* Count attacks of this type */ if (l_ptr->blows[ap_cnt] < MAX_UCHAR) { l_ptr->blows[ap_cnt]++; } } } } /* Blink away */ if (blinked) { msg_print("There is a puff of smoke!"); teleport_away(m_idx, MAX_SIGHT * 2 + 5); } /* Always notice cause of death */ if (p_ptr->is_dead && (l_ptr->deaths < MAX_SHORT)) { l_ptr->deaths++; } /* Assume we attacked */ return (TRUE); }
/* * Set a timed event (except timed resists, cutting and stunning). */ bool set_timed(int idx, int v, bool notify) { timed_effect *effect; bool override_notify = FALSE; /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; if ((idx < 0) || (idx > TMD_MAX)) return FALSE; /* No change */ if (p_ptr->timed[idx] == v) return FALSE; /* Hack -- call other functions */ if (idx == TMD_STUN) return set_stun(v); else if (idx == TMD_CUT) return set_cut(v); /* Don't mention some effects if the player has permanent protection. */ if (redundant_timed_event(idx)) { override_notify = TRUE; notify = FALSE; } /* Find the effect */ effect = &effects[idx]; /* Turning off, always mention */ if ((v == 0) && (!override_notify)) { message(MSG_RECOVER, 0, effect->on_end); notify = TRUE; } /* Turning on, always mention unless it is overridden by an immunity above */ else if ((p_ptr->timed[idx] == 0) && (!override_notify)) { if (notify) message(effect->msg, 0, effect->on_begin); notify = TRUE; } else if (notify) { /* Decrementing */ if (p_ptr->timed[idx] > v && effect->on_decrease) message(effect->msg, 0, effect->on_decrease); /* Incrementing */ else if (v > p_ptr->timed[idx] && effect->on_decrease) message(effect->msg, 0, effect->on_increase); } /* Use the value */ p_ptr->timed[idx] = v; /* Nothing to notice */ if (!notify) return FALSE; /* Disturb */ if (disturb_state) { disturb(0, 0); } /* Update the visuals, as appropriate. */ p_ptr->update |= effect->flag_update; p_ptr->redraw |= (PR_STATUS | effect->flag_redraw); /* Handle stuff */ handle_stuff(); /* Result */ return TRUE; }
/* * Set a timed event (except timed resists, cutting and stunning). */ bool player_set_timed(struct player *p, int idx, int v, bool notify) { timed_effect *effect; /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; if ((idx < 0) || (idx > TMD_MAX)) return FALSE; /* No change */ if (p->timed[idx] == v) return FALSE; /* Hack -- call other functions */ if (idx == TMD_STUN) return set_stun(p, v); else if (idx == TMD_CUT) return set_cut(p, v); /* Don't mention effects which already match the player state. */ if (idx == TMD_OPP_ACID && check_state(p, OF_IM_ACID, p->state.flags)) notify = FALSE; else if (idx == TMD_OPP_ELEC && check_state(p, OF_IM_ELEC, p->state.flags)) notify = FALSE; else if (idx == TMD_OPP_FIRE && check_state(p, OF_IM_FIRE, p->state.flags)) notify = FALSE; else if (idx == TMD_OPP_COLD && check_state(p, OF_IM_COLD, p->state.flags)) notify = FALSE; else if (idx == TMD_OPP_CONF && of_has(p->state.flags, OF_RES_CONFU)) notify = FALSE; /* Find the effect */ effect = &effects[idx]; /* Turning off, always mention */ if (v == 0) { msgt(MSG_RECOVER, "%s", effect->on_end); notify = TRUE; } /* Turning on, always mention */ else if (p->timed[idx] == 0) { msgt(effect->msg, "%s", effect->on_begin); notify = TRUE; } else if (notify) { /* Decrementing */ if (p->timed[idx] > v && effect->on_decrease) msgt(effect->msg, "%s", effect->on_decrease); /* Incrementing */ else if (v > p->timed[idx] && effect->on_increase) msgt(effect->msg, "%s", effect->on_increase); } /* Use the value */ p->timed[idx] = v; /* Sort out the sprint effect */ if (idx == TMD_SPRINT && v == 0) player_inc_timed(p, TMD_SLOW, 100, TRUE, FALSE); /* Nothing to notice */ if (!notify) return FALSE; /* Disturb */ disturb(p, 0, 0); /* Update the visuals, as appropriate. */ p->update |= effect->flag_update; p->redraw |= (PR_STATUS | effect->flag_redraw); /* Handle stuff */ handle_stuff(p); /* Result */ return TRUE; }
static void _shatter_device_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, T("Shatter Device", "")); break; case SPELL_DESC: var_set_string(res, T("Destroy a magical device in your inventory for various effects.", "")); break; case SPELL_CAST: { int item; object_type *o_ptr; var_set_bool(res, FALSE); item_tester_hook = item_tester_hook_recharge; if (!get_item(&item, "Shatter which device?", "You have nothing to shatter.", USE_INVEN)) return; o_ptr = &inventory[item]; var_set_bool(res, TRUE); if (_object_is_(o_ptr, TV_STAFF, SV_STAFF_DESTRUCTION)) { if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), 4 * p_ptr->lev)) msg_print("The dungeon collapses..."); else msg_print("The dungeon trembles."); } else if ( _object_is_(o_ptr, TV_STAFF, SV_STAFF_HEALING) || _object_is_(o_ptr, TV_ROD, SV_ROD_HEALING) || _object_is_(o_ptr, TV_ROD, SV_ROD_RESTORATION) ) { msg_print("You feel life flow through your body!"); restore_level(); (void)set_poisoned(0, TRUE); (void)set_blind(0, TRUE); (void)set_confused(0, TRUE); (void)set_image(0, TRUE); (void)set_stun(0, TRUE); (void)set_cut(0, TRUE); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); update_stuff(); hp_player(5000); } else if (_object_is_(o_ptr, TV_ROD, SV_ROD_TELEPORT_AWAY)) { banish_monsters(p_ptr->lev * 4); } else { project(0, 5, py, px, k_info[o_ptr->k_idx].level * 16, _object_dam_type(o_ptr), PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1); } inven_item_increase(item, -1); inven_item_describe(item); inven_item_optimize(item); break; } default: default_spell(cmd, res); break; } }
/* * do_cmd_cast calls this function if the player's class * is 'imitator'. */ static bool cast_learned_spell(int spell, bool success) { int dir; int plev = pseudo_plev(); int summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2); int hp = p_ptr->chp; int damage = 0; bool pet = success; bool no_trump = FALSE; u32b p_mode, u_mode = 0L, g_mode; if (pet) { p_mode = PM_FORCE_PET; g_mode = 0; } else { p_mode = PM_NO_PET; g_mode = PM_ALLOW_GROUP; } if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE; /* spell code */ switch (spell) { case MS_SHRIEK: msg_print("You make a high pitched shriek."); aggravate_monsters(0); break; case MS_XXX1: break; case MS_DISPEL: { int m_idx; if (!target_set(TARGET_KILL)) return FALSE; m_idx = cave[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(py, px, target_row, target_col)) break; dispel_monster_status(m_idx); break; } case MS_ROCKET: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You fire a rocket."); damage = hp / 4; fire_rocket(GF_ROCKET, dir, spell_power(damage), 2); break; case MS_SHOOT: { int slot; if (!get_aim_dir(&dir)) return FALSE; msg_print("You fire an arrow."); damage = 1; slot = equip_find_first(object_is_melee_weapon); if (slot) { object_type *o_ptr = equip_obj(slot); damage = damroll(o_ptr->dd, o_ptr->ds)+ o_ptr->to_d; if (damage < 1) damage = 1; } fire_bolt(GF_ARROW, dir, spell_power(damage)); break; } case MS_XXX2: break; case MS_XXX3: break; case MS_BR_STORM: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe storm."); damage = MIN(hp / 3, 300); fire_ball(GF_STORM, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_ACID: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe acid."); damage = hp / 3; fire_ball(GF_ACID, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_ELEC: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe lightning."); damage = hp / 3; fire_ball(GF_ELEC, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_FIRE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe fire."); damage = hp / 3; fire_ball(GF_FIRE, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_COLD: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe frost."); damage = hp / 3; fire_ball(GF_COLD, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_POIS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe gas."); damage = hp / 3; fire_ball(GF_POIS, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_NETHER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe nether."); damage = hp / 6; fire_ball(GF_NETHER, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_LITE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe light."); damage = hp / 6; fire_ball(GF_LITE, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_DARK: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe darkness."); damage = hp / 6; fire_ball(GF_DARK, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_CONF: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe confusion."); damage = hp / 6; fire_ball(GF_CONFUSION, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_SOUND: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe sound."); damage = hp / 6; fire_ball(GF_SOUND, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_CHAOS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe chaos."); damage = hp / 6; fire_ball(GF_CHAOS, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_DISEN: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe disenchantment."); damage = hp / 6; fire_ball(GF_DISENCHANT, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_NEXUS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe nexus."); damage = MIN(hp / 3, 250); fire_ball(GF_NEXUS, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_TIME: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe time."); damage = MIN(hp / 3, 150); fire_ball(GF_TIME, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_INERTIA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe inertia."); damage = MIN(hp / 6, 200); fire_ball(GF_INERT, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_GRAVITY: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe gravity."); damage = MIN(hp / 3, 200); fire_ball(GF_GRAVITY, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_SHARDS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe shards."); damage = hp / 6; fire_ball(GF_SHARDS, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_PLASMA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe plasma."); damage = MIN(hp / 6, 150); fire_ball(GF_PLASMA, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_FORCE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe force."); damage = MIN(hp / 6, 200); fire_ball(GF_FORCE, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BR_MANA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe mana."); damage = MIN(hp / 3, 250); fire_ball(GF_MANA, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BALL_NUKE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a ball of radiation."); damage = plev * 2 + damroll(10, 6); fire_ball(GF_NUKE, dir, spell_power(damage), 2); break; case MS_BR_NUKE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe toxic waste."); damage = hp / 3; fire_ball(GF_NUKE, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BALL_CHAOS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke a raw Logrus."); damage = plev * 4 + damroll(10, 10); fire_ball(GF_CHAOS, dir, spell_power(damage), 4); break; case MS_BR_DISI: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe disintegration."); damage = MIN(hp / 6, 150); fire_ball(GF_DISINTEGRATE, dir, spell_power(damage), (plev > 40 ? -3 : -2)); break; case MS_BALL_ACID: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast an acid ball."); damage = randint1(plev * 6) + 15; fire_ball(GF_ACID, dir, spell_power(damage), 2); break; case MS_BALL_ELEC: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a lightning ball."); damage = randint1(plev * 3) + 8; fire_ball(GF_ELEC, dir, spell_power(damage), 2); break; case MS_BALL_FIRE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a fire ball."); damage = randint1(plev * 7) + 10; fire_ball(GF_FIRE, dir, spell_power(damage), 2); break; case MS_BALL_COLD: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a frost ball."); damage = randint1(plev * 3) + 10; fire_ball(GF_COLD, dir, spell_power(damage), 2); break; case MS_BALL_POIS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a stinking cloud."); damage = damroll(12,2); fire_ball(GF_POIS, dir, spell_power(damage), 2); break; case MS_BALL_NETHER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a nether ball."); damage = plev * 2 + 50 + damroll(10, 10); fire_ball(GF_NETHER, dir, spell_power(damage), 2); break; case MS_BALL_WATER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You gesture fluidly."); damage = randint1(plev * 4) + 50; fire_ball(GF_WATER, dir, spell_power(damage), 4); break; case MS_BALL_MANA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke a mana storm."); damage = plev * 8 + 50 + damroll(10, 10); fire_ball(GF_MANA, dir, spell_power(damage), 4); break; case MS_BALL_DARK: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke a darkness storm."); damage = plev * 8 + 50 + damroll(10, 10); fire_ball(GF_DARK, dir, spell_power(damage), 4); break; case MS_DRAIN_MANA: if (!get_aim_dir(&dir)) return FALSE; fire_ball_hide(GF_DRAIN_MANA, dir, spell_power(randint1(plev)+plev), 0); break; case MS_MIND_BLAST: if (!get_aim_dir(&dir)) return FALSE; damage = damroll(7, 7); fire_ball_hide(GF_MIND_BLAST, dir, spell_power(damage), 0); break; case MS_BRAIN_SMASH: if (!get_aim_dir(&dir)) return FALSE; damage = damroll(12, 12); fire_ball_hide(GF_BRAIN_SMASH, dir, spell_power(damage), 0); break; case MS_CAUSE_1: if (!get_aim_dir(&dir)) return FALSE; damage = damroll(3, 8); fire_ball_hide(GF_CAUSE_1, dir, spell_power(damage), 0); break; case MS_CAUSE_2: if (!get_aim_dir(&dir)) return FALSE; damage = damroll(8, 8); fire_ball_hide(GF_CAUSE_2, dir, spell_power(damage), 0); break; case MS_CAUSE_3: if (!get_aim_dir(&dir)) return FALSE; damage = damroll(10, 15); fire_ball_hide(GF_CAUSE_3, dir, spell_power(damage), 0); break; case MS_CAUSE_4: if (!get_aim_dir(&dir)) return FALSE; damage = damroll(15, 15); fire_ball_hide(GF_CAUSE_4, dir, spell_power(damage), 0); break; case MS_BOLT_ACID: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast an acid bolt."); damage = damroll(7, 8) + plev * 2 / 3; fire_bolt(GF_ACID, dir, spell_power(damage)); break; case MS_BOLT_ELEC: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a lightning bolt."); damage = damroll(4, 8) + plev * 2 / 3; fire_bolt(GF_ELEC, dir, spell_power(damage)); break; case MS_BOLT_FIRE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a fire bolt."); damage = damroll(9, 8) + plev * 2 / 3; fire_bolt(GF_FIRE, dir, spell_power(damage)); break; case MS_BOLT_COLD: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a frost bolt."); damage = damroll(6, 8) + plev * 2 / 3; fire_bolt(GF_COLD, dir, spell_power(damage)); break; case MS_STARBURST: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke a starburst."); damage = plev * 8 + 50 + damroll(10, 10); fire_ball(GF_LITE, dir, spell_power(damage), 4); break; case MS_BOLT_NETHER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a nether bolt."); damage = 30 + damroll(5, 5) + plev * 8 / 3; fire_bolt(GF_NETHER, dir, spell_power(damage)); break; case MS_BOLT_WATER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a water bolt."); damage = damroll(10, 10) + plev * 2; fire_bolt(GF_WATER, dir, spell_power(damage)); break; case MS_BOLT_MANA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a mana bolt."); damage = randint1(plev * 7) + 50; fire_bolt(GF_MANA, dir, spell_power(damage)); break; case MS_BOLT_PLASMA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a plasma bolt."); damage = 10 + damroll(8, 7) + plev * 2; fire_bolt(GF_PLASMA, dir, spell_power(damage)); break; case MS_BOLT_ICE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a ice bolt."); damage = damroll(6, 6) + plev * 2; fire_bolt(GF_ICE, dir, spell_power(damage)); break; case MS_MAGIC_MISSILE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a magic missile."); damage = damroll(2, 6) + plev * 2 / 3; fire_bolt(GF_MISSILE, dir, spell_power(damage)); break; case MS_SCARE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a fearful illusion."); fear_monster(dir, spell_power(plev+10)); break; case MS_BLIND: if (!get_aim_dir(&dir)) return FALSE; confuse_monster(dir, spell_power(plev * 2)); break; case MS_CONF: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a mesmerizing illusion."); confuse_monster(dir, spell_power(plev * 2)); break; case MS_SLOW: if (!get_aim_dir(&dir)) return FALSE; slow_monster(dir); break; case MS_SLEEP: if (!get_aim_dir(&dir)) return FALSE; sleep_monster(dir, plev*3); break; case MS_SPEED: (void)set_fast(randint1(20 + plev) + plev, FALSE); break; case MS_HAND_DOOM: { if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke the Hand of Doom!"); fire_ball_hide(GF_HAND_DOOM, dir, spell_power(plev * 3), 0); break; } case MS_HEAL: msg_print("You concentrate on your wounds!"); (void)hp_player(spell_power(plev*4)); (void)set_stun(0, TRUE); (void)set_cut(0, TRUE); break; case MS_INVULNER: msg_print("You cast a Globe of Invulnerability."); (void)set_invuln(spell_power(randint1(4) + 4), FALSE); break; case MS_BLINK: teleport_player(10, 0L); break; case MS_TELEPORT: teleport_player(plev * 5, 0L); break; case MS_WORLD: world_player = TRUE; msg_print("'Time!'"); msg_print(NULL); /* Hack */ p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10; /* Redraw map */ p_ptr->redraw |= (PR_MAP | PR_STATUS); /* Update monsters */ p_ptr->update |= (PU_MONSTERS); /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); handle_stuff(); break; case MS_SPECIAL: break; case MS_TELE_TO: { monster_type *m_ptr; monster_race *r_ptr; char m_name[80]; if (!target_set(TARGET_KILL)) return FALSE; if (!cave[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(py, px, target_row, target_col)) break; m_ptr = &m_list[cave[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); if (r_ptr->flagsr & RFR_RES_TELE) { if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; msg_format("%s is unaffected!", m_name); break; } else if (r_ptr->level > randint1(100)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; msg_format("%s resists!", m_name); break; } } msg_format("You command %s to return.", m_name); teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: if (!get_aim_dir(&dir)) return FALSE; (void)fire_beam(GF_AWAY_ALL, dir, spell_power(100)); break; case MS_TELE_LEVEL: { int target_m_idx; monster_type *m_ptr; monster_race *r_ptr; char m_name[80]; if (!target_set(TARGET_KILL)) return FALSE; target_m_idx = cave[target_row][target_col].m_idx; if (!target_m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(py, px, target_row, target_col)) break; m_ptr = &m_list[target_m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); msg_format("You gesture at %^s's feet.", m_name); if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60))) { msg_format("%^s is unaffected!", m_name); } else teleport_level(target_m_idx); break; } case MS_PSY_SPEAR: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You throw a psycho-spear."); damage = randint1(plev * 3) + 100; (void)fire_beam(GF_PSY_SPEAR, dir, spell_power(damage)); break; case MS_DARKNESS: msg_print("You gesture in shadow."); (void)unlite_area(10, 3); break; case MS_MAKE_TRAP: if (!target_set(TARGET_KILL)) return FALSE; msg_print("You cast a spell and cackle evilly."); trap_creation(target_row, target_col); break; case MS_FORGET: msg_print("Nothing happen."); break; case MS_RAISE_DEAD: msg_print("You cast a animate dead."); (void)animate_dead(0, py, px); break; case MS_S_KIN: { int k; msg_print("You summon minions."); for (k = 0;k < 1; k++) { if (summon_kin_player(summon_lev, py, px, (pet ? PM_FORCE_PET : 0L))) { if (!pet) msg_print("Summoned fellows are angry!"); } else { no_trump = TRUE; } } break; } case MS_S_CYBER: { int k; msg_print("You summon a Cyberdemon!"); for (k = 0 ;k < 1 ; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, p_mode)) { if (!pet) msg_print("The summoned Cyberdemon are angry!"); } else { no_trump = TRUE; } break; } case MS_S_MONSTER: { int k; msg_print("You summon help."); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, p_mode)) { if (!pet) msg_print("The summoned monster is angry!"); } else { no_trump = TRUE; } break; } case MS_S_MONSTERS: { int k; msg_print("You summon monsters!"); for (k = 0;k < plev / 15 + 2; k++) if(summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, (p_mode | u_mode))) { if (!pet) msg_print("Summoned monsters are angry!"); } else { no_trump = TRUE; } break; } case MS_S_ANT: { int k; msg_print("You summon ants."); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print("Summoned ants are angry!"); } else { no_trump = TRUE; } break; } case MS_S_SPIDER: { int k; msg_print("You summon spiders."); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print("Summoned spiders are angry!"); } else { no_trump = TRUE; } break; } case MS_S_HOUND: { int k; msg_print("You summon hounds."); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print("Summoned hounds are angry!"); } else { no_trump = TRUE; } break; } case MS_S_HYDRA: { int k; msg_print("You summon a hydras."); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, (g_mode | p_mode))) { if (!pet) msg_print("Summoned hydras are angry!"); } else { no_trump = TRUE; } break; } case MS_S_ANGEL: { int k; msg_print("You summon an angel!"); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANGEL, (g_mode | p_mode))) { if (!pet) msg_print("Summoned angels are angry!"); } else { no_trump = TRUE; } break; } case MS_S_DEMON: { int k; msg_print("You summon a demon from the Courts of Chaos!"); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, (g_mode | p_mode))) { if (!pet) msg_print("Summoned demons are angry!"); } else { no_trump = TRUE; } break; } case MS_S_UNDEAD: { int k; msg_print("You summon an undead adversary!"); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode))) { if (!pet) msg_print("Summoned undeads are angry!"); } else { no_trump = TRUE; } break; } case MS_S_DRAGON: { int k; msg_print("You summon a dragon!"); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, (g_mode | p_mode))) { if (!pet) msg_print("Summoned dragons are angry!"); } else { no_trump = TRUE; } break; } case MS_S_HI_UNDEAD: { int k; msg_print("You summon a greater undead!"); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode))) { if (!pet) msg_print("Summoned greater undeads are angry!"); } else { no_trump = TRUE; } break; } case MS_S_HI_DRAGON: { int k; msg_print("You summon an ancient dragon!"); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode))) { if (!pet) msg_print("Summoned ancient dragons are angry!"); } else { no_trump = TRUE; } break; } case MS_S_AMBERITE: { int k; msg_print("You summon a Lord of Amber!"); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_AMBERITE, (g_mode | p_mode | u_mode))) { if (!pet) msg_print("Summoned Lords of Amber are angry!"); } else { no_trump = TRUE; } break; } case MS_S_UNIQUE: { int k, count = 0; msg_print("You summon a special opponent!"); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE))) { count++; if (!pet) msg_print("Summoned special opponents are angry!"); } for (k = count;k < 1; k++) if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE))) { count++; if (!pet) msg_print("Summoned greater undeads are angry!"); } if (!count) { no_trump = TRUE; } break; } default: msg_print("hoge?"); } if (no_trump) { msg_print("No one have appeared."); } return TRUE; }
static bool cast_priest_spell(int Ind, int spell) { player_type *p_ptr = Players[Ind]; object_type *o_ptr; int py = p_ptr->py; int px = p_ptr->px; int Depth = p_ptr->dun_depth; int dir; int plev = p_ptr->lev; switch (spell) { case PRAYER_DETECT_EVIL: { (void)detect_evil(Ind); break; } case PRAYER_CURE_LIGHT_WOUNDS: { (void)hp_player(Ind, damroll(2, 10)); (void)set_cut(Ind, p_ptr->cut - 10); break; } /* MAngband-specific: Heal Projectile */ case PRAYER_CURE_LIGHT_WOUNDS + SPELL_PROJECTED: { if (!get_aim_dir(Ind, &dir)) return FALSE; (void)heal_player_ball(Ind, dir, damroll(2, 8)); break; } case PRAYER_BLESS: { (void)set_blessed(Ind, p_ptr->blessed + randint(12) + 12); break; } case PRAYER_REMOVE_FEAR: { (void)set_afraid(Ind, 0); break; } case PRAYER_CALL_LIGHT: { msg_prayer("%s calls light."); (void)lite_area(Ind, damroll(2, (plev / 2)), (plev / 10) + 1); break; } case PRAYER_FIND_TRAPS: { (void)detect_trap(Ind);//detect_traps(Ind) break; } case PRAYER_DETECT_DOORS_STAIRS: { (void)detect_sdoor(Ind);//detect_doors(Ind); //(void)detect_stairs(); break; } case PRAYER_SLOW_POISON: { (void)set_poisoned(Ind, p_ptr->poisoned / 2); break; } case PRAYER_SCARE_MONSTER: { if (!get_aim_dir(Ind, &dir)) return (FALSE); (void)fear_monster(Ind, dir, plev); break; } case PRAYER_PORTAL: { msg_prayer("%s blinks away!"); teleport_player(Ind, plev * 3); break; } case PRAYER_CURE_SERIOUS_WOUNDS: { (void)hp_player(Ind, damroll(4, 10)); (void)set_cut(Ind, (p_ptr->cut / 2) - 20); break; } /* MAngband-specific: Heal Projectile */ case PRAYER_CURE_SERIOUS_WOUNDS + SPELL_PROJECTED: { if (!get_aim_dir(Ind, &dir)) return FALSE; (void)heal_player_ball(Ind, dir, damroll(4, 10)); break; } case PRAYER_CHANT: { (void)set_blessed(Ind, p_ptr->blessed + randint(24) + 24); break; } case PRAYER_SANCTUARY: { msg_prayer("For a brief moment, %s is enclosed by a deep blue aura."); (void)sleep_monsters_touch(Ind); break; } case PRAYER_SATISFY_HUNGER: { (void)set_food(Ind, PY_FOOD_MAX - 1); break; } case PRAYER_REMOVE_CURSE: { remove_curse(Ind); break; } case PRAYER_RESIST_HEAT_COLD: { (void)set_oppose_fire(Ind, p_ptr->oppose_fire + randint(10) + 10); (void)set_oppose_cold(Ind, p_ptr->oppose_cold + randint(10) + 10); break; } case PRAYER_NEUTRALIZE_POISON: { (void)set_poisoned(Ind, 0); break; } case PRAYER_ORB_OF_DRAINING: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_prayer("%s fires a holy orb!"); fire_ball(Ind, GF_HOLY_ORB, dir, (damroll(3, 6) + plev + (plev / ((p_ptr->cp_ptr->flags & CF_BLESS_WEAPON) ? 2 : 4))), ((plev < 30) ? 2 : 3)); break; } case PRAYER_CURE_CRITICAL_WOUNDS: { (void)hp_player(Ind, damroll(6, 10)); (void)set_cut(Ind, 0); break; } /* MAngband-specific: Heal Projectile */ case PRAYER_CURE_CRITICAL_WOUNDS + SPELL_PROJECTED: { if (!get_aim_dir(Ind, &dir)) return FALSE; (void)heal_player_ball(Ind, dir, damroll(6, 10)); break; } case PRAYER_SENSE_INVISIBLE: { (void)set_tim_invis(Ind, p_ptr->tim_invis + randint(24) + 24); break; } case PRAYER_PROTECTION_FROM_EVIL: { (void)set_protevil(Ind, p_ptr->protevil + randint(25) + 3 * p_ptr->lev); break; } case PRAYER_EARTHQUAKE: { msg_prayer("%s murmurs, and the ground shakes!"); earthquake(Depth, py, px, 10); break; } case PRAYER_SENSE_SURROUNDINGS: { map_area(Ind); break; } case PRAYER_CURE_MORTAL_WOUNDS: { (void)hp_player(Ind, damroll(8, 10)); (void)set_stun(Ind, 0); (void)set_cut(Ind, 0); break; } /* MAngband-specific: Heal Projectile */ case PRAYER_CURE_MORTAL_WOUNDS + SPELL_PROJECTED: { if (!get_aim_dir(Ind, &dir)) return FALSE; (void)heal_player_ball(Ind, dir, damroll(8, 10)); break; } case PRAYER_TURN_UNDEAD: { msg_prayer("%s tries to turn undead."); (void)turn_undead(Ind); break; } case PRAYER_PRAYER: { (void)set_blessed(Ind, p_ptr->blessed + randint(48) + 48); break; } case PRAYER_DISPEL_UNDEAD: { msg_prayer("%s dispells undead."); (void)dispel_undead(Ind, randint(plev * 3)); break; } case PRAYER_HEAL: { (void)hp_player(Ind, 300); (void)set_stun(Ind, 0); (void)set_cut(Ind, 0); break; } /* MAngband-specific: Heal Projectile */ case PRAYER_HEAL + SPELL_PROJECTED: { if (!get_aim_dir(Ind, &dir)) return FALSE; (void)heal_player_ball(Ind, dir, 300); break; } case PRAYER_DISPEL_EVIL: { msg_prayer("%s dispells evil."); (void)dispel_evil(Ind, randint(plev * 3)); break; } case PRAYER_GLYPH_OF_WARDING: { if (warding_glyph(Ind)) { msg_prayer("%s lays down a glyph of warding."); } break; } case PRAYER_HOLY_WORD: { msg_prayer("%s shouts the holy word."); (void)dispel_evil(Ind, randint(plev * 4)); (void)hp_player(Ind, 1000); (void)set_afraid(Ind, 0); (void)set_poisoned(Ind, 0); (void)set_stun(Ind, 0); (void)set_cut(Ind, 0); break; } case PRAYER_DETECT_MONSTERS: { (void)detect_creatures(Ind, TRUE); break; } case PRAYER_DETECTION: { (void)detection(Ind);//detect_all(Ind) break; } case PRAYER_PERCEPTION: { return ident_spell(Ind); } case PRAYER_PROBING: { (void)probing(Ind); break; } case PRAYER_CLAIRVOYANCE: { msg_prayer("An image of your surroundings forms in your mind..."); wiz_lite(Ind); break; } case PRAYER_CURE_SERIOUS_WOUNDS2: { (void)hp_player(Ind, damroll(4, 10)); (void)set_cut(Ind, 0); break; } /* MAngband-specific: Heal Projectile */ case PRAYER_CURE_SERIOUS_WOUNDS2 + SPELL_PROJECTED: { if (!get_aim_dir(Ind, &dir)) return FALSE; (void)heal_player_ball(Ind, dir, damroll(4, 10)); break; } case PRAYER_CURE_MORTAL_WOUNDS2: { (void)hp_player(Ind, damroll(8, 10)); (void)set_stun(Ind, 0); (void)set_cut(Ind, 0); break; } /* MAngband-specific: Heal Projectile */ case PRAYER_CURE_MORTAL_WOUNDS2 + SPELL_PROJECTED: { if (!get_aim_dir(Ind, &dir)) return FALSE; (void)heal_player_ball(Ind, dir, damroll(8, 10)); break; } case PRAYER_HEALING: { (void)hp_player(Ind, 2000); (void)set_stun(Ind, 0); (void)set_cut(Ind, 0); break; } /* MAngband-specific: Heal Projectile */ case PRAYER_HEALING + SPELL_PROJECTED: { if (!get_aim_dir(Ind, &dir)) return FALSE; (void)heal_player_ball(Ind, dir, 2000); break; } /* With MAngband-specific addon: ressurect ghosts */ case PRAYER_RESTORATION: { if (!do_scroll_life(Ind)) { (void)do_res_stat(Ind, A_STR); (void)do_res_stat(Ind, A_INT); (void)do_res_stat(Ind, A_WIS); (void)do_res_stat(Ind, A_DEX); (void)do_res_stat(Ind, A_CON); (void)do_res_stat(Ind, A_CHR); } break; } /* With Mangband-sepcific addon: restore others */ case PRAYER_REMEMBRANCE: { if (!do_restoreXP_other(Ind)) { (void)restore_level(Ind); } break; } case PRAYER_DISPEL_UNDEAD2: { msg_prayer("%s dispells undead."); (void)dispel_undead(Ind, randint(plev * 4)); break; } case PRAYER_DISPEL_EVIL2: { msg_prayer("%s dispells evil."); (void)dispel_evil(Ind, randint(plev * 4)); break; } case PRAYER_BANISH_EVIL: { msg_prayer("%s speaks a holy curse on nearby evil!"); if (banish_evil(Ind, 100)) { msg_print(Ind, "The power of your god banishes evil!"); } break; } case PRAYER_WORD_OF_DESTRUCTION: { msg_prayer("%s unleashes a spell of great power!"); destroy_area(Depth, py, px, 15, TRUE); break; } case PRAYER_ANNIHILATION: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_prayer("%s fires a massive bolt filled with pure energy!"); drain_life(Ind, dir, 200); break; } case PRAYER_UNBARRING_WAYS: { msg_prayer("%s sways his hands."); (void)destroy_doors_touch(Ind); break; } case PRAYER_RECHARGING: { return recharge(Ind, 15); } case PRAYER_DISPEL_CURSE: { (void)remove_all_curse(Ind); break; } case PRAYER_ENCHANT_WEAPON: { return enchant_spell(Ind, rand_int(4) + 1, rand_int(4) + 1, 0); } case PRAYER_ENCHANT_ARMOUR: { return enchant_spell(Ind, 0, 0, rand_int(3) + 2); } case PRAYER_ELEMENTAL_BRAND: { brand_weapon(Ind); break; } case PRAYER_BLINK: { msg_prayer("%s blinks away!"); teleport_player(Ind, 10); break; } case PRAYER_TELEPORT_SELF: { msg_prayer("%s teleports away!"); teleport_player(Ind, plev * 8); break; } case PRAYER_TELEPORT_OTHER: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_prayer("%s prays for divine intervention."); (void)teleport_monster(Ind, dir); break; } case PRAYER_TELEPORT_LEVEL: { (void)teleport_player_level(Ind); break; } case PRAYER_WORD_OF_RECALL: { o_ptr = &p_ptr->inventory[get_spell_book(Ind, spell)]; set_recall(Ind, o_ptr); break; } case PRAYER_ALTER_REALITY: { (void)alter_reality(Ind, FALSE); break; } /* Paranoia: shouldn't happen with safe clients */ default: { msg_print(Ind, "You cannot project that spell on other players."); return (FALSE); } } /* Success */ return (TRUE); }
void chaos_warrior_reward(void) { if (one_in_(6)) { msg_format("%^s rewards you with a mutation!", chaos_patrons[p_ptr->chaos_patron]); mut_gain_random(NULL); } else { char wrath_reason[32] = ""; int nasty_chance = 6; int dummy = 0, dummy2 = 0; int type, effect; int count = 0; if (p_ptr->lev == 13) nasty_chance = 2; else if (!(p_ptr->lev % 13)) nasty_chance = 3; else if (!(p_ptr->lev % 14)) nasty_chance = 12; if (one_in_(nasty_chance)) type = randint1(20); /* Allow the 'nasty' effects */ else type = randint1(15) + 5; /* Or disallow them */ if (type < 1) type = 1; if (type > 20) type = 20; type--; sprintf(wrath_reason, "the Wrath of %s", chaos_patrons[p_ptr->chaos_patron]); effect = chaos_rewards[p_ptr->chaos_patron][type]; switch (effect) { case REW_POLY_SLF: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou needst a new form, mortal!'"); do_poly_self(); break; case REW_GAIN_EXP: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Well done, mortal! Lead on!'"); if (p_ptr->prace == RACE_ANDROID) msg_print("But, nothing happen."); else if (p_ptr->exp < PY_MAX_EXP) { s32b ee = (p_ptr->exp / 2) + 10; if (ee > 100000L) ee = 100000L; msg_print("You feel more experienced."); gain_exp(ee); } break; case REW_LOSE_EXP: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou didst not deserve that, slave.'"); if (p_ptr->prace == RACE_ANDROID) msg_print("But, nothing happen."); else { lose_exp(p_ptr->exp / 6); } break; case REW_GOOD_OBJ: msg_format("The voice of %s whispers:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Use my gift wisely.'"); acquirement(py, px, 1, FALSE, FALSE); break; case REW_GREA_OBJ: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Use my gift wisely.'"); acquirement(py, px, 1, TRUE, FALSE); break; case REW_CHAOS_WP: { object_type forge; msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thy deed hath earned thee a worthy blade.'"); dummy = TV_SWORD; switch (randint1(p_ptr->lev)) { case 0: case 1: dummy2 = SV_DAGGER; break; case 2: case 3: dummy2 = SV_MAIN_GAUCHE; break; case 4: dummy2 = SV_TANTO; break; case 5: case 6: dummy2 = SV_RAPIER; break; case 7: case 8: dummy2 = SV_SMALL_SWORD; break; case 9: case 10: dummy2 = SV_BASILLARD; break; case 11: case 12: case 13: dummy2 = SV_SHORT_SWORD; break; case 14: case 15: dummy2 = SV_SABRE; break; case 16: case 17: dummy2 = SV_CUTLASS; break; case 18: dummy2 = SV_WAKIZASHI; break; case 19: dummy2 = SV_KHOPESH; break; case 20: dummy2 = SV_TULWAR; break; case 21: dummy2 = SV_BROAD_SWORD; break; case 22: case 23: dummy2 = SV_LONG_SWORD; break; case 24: case 25: dummy2 = SV_SCIMITAR; break; case 26: dummy2 = SV_NINJATO; break; case 27: dummy2 = SV_KATANA; break; case 28: case 29: dummy2 = SV_BASTARD_SWORD; break; case 30: dummy2 = SV_GREAT_SCIMITAR; break; case 31: dummy2 = SV_CLAYMORE; break; case 32: dummy2 = SV_ESPADON; break; case 33: dummy2 = SV_TWO_HANDED_SWORD; break; case 34: dummy2 = SV_FLAMBERGE; break; case 35: dummy2 = SV_NO_DACHI; break; case 36: dummy2 = SV_EXECUTIONERS_SWORD; break; case 37: dummy2 = SV_ZWEIHANDER; break; case 38: dummy2 = SV_HAYABUSA; break; default: dummy2 = SV_BLADE_OF_CHAOS; } object_prep(&forge, lookup_kind(dummy, dummy2)); forge.to_h = 3 + randint1(dun_level) % 10; forge.to_d = 3 + randint1(dun_level) % 10; one_resistance(&forge); forge.name2 = EGO_WEAPON_CHAOS; drop_near(&forge, -1, py, px); break; } case REW_GOOD_OBS: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thy deed hath earned thee a worthy reward.'"); acquirement(py, px, randint1(2) + 1, FALSE, FALSE); break; case REW_GREA_OBS: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Behold, mortal, how generously I reward thy loyalty.'"); acquirement(py, px, randint1(2) + 1, TRUE, FALSE); break; case REW_TY_CURSE: msg_format("The voice of %s thunders:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou art growing arrogant, mortal.'"); activate_ty_curse(FALSE, &count); break; case REW_SUMMON_M: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'My pets, destroy the arrogant mortal!'"); for (dummy = 0; dummy < randint1(5) + 1; dummy++) summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); break; case REW_H_SUMMON: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou needst worthier opponents!'"); activate_hi_summon(py, px, FALSE); break; case REW_DO_HAVOC: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Death and destruction! This pleaseth me!'"); call_chaos(100); break; case REW_GAIN_ABL: msg_format("The voice of %s rings out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Stay, mortal, and let me mold thee.'"); if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0)) do_inc_stat(chaos_stats[p_ptr->chaos_patron]); else do_inc_stat(randint0(6)); break; case REW_LOSE_ABL: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'I grow tired of thee, mortal.'"); if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0)) do_dec_stat(chaos_stats[p_ptr->chaos_patron]); else do_dec_stat(randint0(6)); break; case REW_RUIN_ABL: msg_format("The voice of %s thunders:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou needst a lesson in humility, mortal!'"); msg_print("You feel less powerful!"); for (dummy = 0; dummy < 6; dummy++) dec_stat(dummy, 10 + randint1(15), TRUE); break; case REW_POLY_WND: msg_format("You feel the power of %s touch you.", chaos_patrons[p_ptr->chaos_patron]); do_poly_wounds(); break; case REW_AUGM_ABL: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Receive this modest gift from me!'"); for (dummy = 0; dummy < 6; dummy++) do_inc_stat(dummy); break; case REW_HURT_LOT: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Suffer, pathetic fool!'"); fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4); take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1); break; case REW_HEAL_FUL: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Rise, my servant!'"); restore_level(); set_poisoned(0, TRUE); set_blind(0, TRUE); set_confused(0, TRUE); set_image(0, TRUE); set_stun(0, TRUE); set_cut(0, TRUE); hp_player(5000); for (dummy = 0; dummy < 6; dummy++) do_res_stat(dummy); break; case REW_CURSE_WP: { int slot = equip_random_slot(object_is_melee_weapon); if (slot) { msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou reliest too much on thy weapon.'"); curse_weapon(FALSE, slot); } break; } case REW_CURSE_AR: { int slot = equip_random_slot(object_is_armour); if (slot) { msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou reliest too much on thine equipment.'"); curse_armor(slot); } break; } case REW_PISS_OFF: msg_format("The voice of %s whispers:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Now thou shalt pay for annoying me.'"); switch (randint1(4)) { case 1: activate_ty_curse(FALSE, &count); break; case 2: activate_hi_summon(py, px, FALSE); break; case 3: if (one_in_(2)) { int slot = equip_random_slot(object_is_melee_weapon); if (slot) curse_weapon(FALSE, slot); } else { int slot = equip_random_slot(object_is_armour); if (slot) curse_armor(slot); } break; default: for (dummy = 0; dummy < 6; dummy++) dec_stat(dummy, 10 + randint1(15), TRUE); break; } break; case REW_WRATH: msg_format("The voice of %s thunders:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Die, mortal!'"); take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1); for (dummy = 0; dummy < 6; dummy++) dec_stat(dummy, 10 + randint1(15), FALSE); activate_hi_summon(py, px, FALSE); activate_ty_curse(FALSE, &count); if (one_in_(2)) { int slot = equip_random_slot(object_is_melee_weapon); if (slot) curse_weapon(FALSE, slot); } if (one_in_(2)) { int slot = equip_random_slot(object_is_armour); if (slot) curse_armor(slot); } break; case REW_DESTRUCT: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Death and destruction! This pleaseth me!'"); destroy_area(py, px, 25, 3 * p_ptr->lev); break; case REW_GENOCIDE: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Let me relieve thee of thine oppressors!'"); symbol_genocide(0, FALSE); break; case REW_MASS_GEN: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Let me relieve thee of thine oppressors!'"); mass_genocide(0, FALSE); break; case REW_DISPEL_C: msg_format("You can feel the power of %s assault your enemies!", chaos_patrons[p_ptr->chaos_patron]); dispel_monsters(p_ptr->lev * 4); break; case REW_IGNORE: msg_format("%s ignores you.", chaos_patrons[p_ptr->chaos_patron]); break; case REW_SER_DEMO: msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]); if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET)) msg_print("Nobody ever turns up..."); break; case REW_SER_MONS: msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]); if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET)) msg_print("Nobody ever turns up..."); break; case REW_SER_UNDE: msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]); if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET)) msg_print("Nobody ever turns up..."); break; default: msg_format("The voice of %s stammers:", chaos_patrons[p_ptr->chaos_patron]); msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect); } } }
static void _shatter_device_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Shatter Device"); break; case SPELL_DESC: var_set_string(res, "Destroy a magical device in your inventory for various effects."); break; case SPELL_CAST: { obj_prompt_t prompt = {0}; var_set_bool(res, FALSE); prompt.prompt = "Shatter which device?"; prompt.error = "You have nothing to shatter."; prompt.filter = object_is_device; prompt.where[0] = INV_PACK; prompt.where[1] = INV_FLOOR; obj_prompt(&prompt); if (!prompt.obj) return; var_set_bool(res, TRUE); if (prompt.obj->activation.type == EFFECT_NONE) { msg_print("Nothing happens."); } else if (prompt.obj->activation.type == EFFECT_DESTRUCTION) { if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), 4 * p_ptr->lev)) msg_print("The dungeon collapses..."); else msg_print("The dungeon trembles."); } else if ( prompt.obj->activation.type == EFFECT_HEAL_CURING || prompt.obj->activation.type == EFFECT_HEAL_CURING_HERO || prompt.obj->activation.type == EFFECT_RESTORING ) { msg_print("You feel life flow through your body!"); restore_level(); (void)set_poisoned(0, TRUE); (void)set_blind(0, TRUE); (void)set_confused(0, TRUE); (void)set_image(0, TRUE); (void)set_stun(0, TRUE); (void)set_cut(0, TRUE); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); update_stuff(); /* hp may change if Con was drained ... */ hp_player(5000); } else if ( prompt.obj->activation.type == EFFECT_TELEPORT_AWAY || prompt.obj->activation.type == EFFECT_BANISH_EVIL || prompt.obj->activation.type == EFFECT_BANISH_ALL ) { banish_monsters(p_ptr->lev * 4); } else { project(0, 5, py, px, prompt.obj->activation.difficulty * 16, _object_dam_type(prompt.obj), PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1); } prompt.obj->number--; obj_release(prompt.obj, 0); break; } default: default_spell(cmd, res); break; } }
/* * Set a timed event (except timed resists, cutting and stunning). */ bool set_timed(int idx, int v, bool notify) { timed_effect *effect; /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; if ((idx < 0) || (idx > TMD_MAX)) return FALSE; /* No change */ if (p_ptr->timed[idx] == v) return FALSE; /* Hack -- call other functions */ if (idx == TMD_STUN) return set_stun(v); else if (idx == TMD_CUT) return set_cut(v); /* Don't mention some effects. */ if (idx == TMD_OPP_ACID && p_ptr->state.immune_acid) notify = FALSE; else if (idx == TMD_OPP_ELEC && p_ptr->state.immune_elec) notify = FALSE; else if (idx == TMD_OPP_FIRE && p_ptr->state.immune_fire) notify = FALSE; else if (idx == TMD_OPP_COLD && p_ptr->state.immune_cold) notify = FALSE; else if (idx == TMD_OPP_CONF && p_ptr->state.resist_confu) notify = FALSE; /* Find the effect */ effect = &effects[idx]; /* Turning off, always mention */ if (v == 0) { message(MSG_RECOVER, 0, effect->on_end); notify = TRUE; } /* Turning on, always mention */ else if (p_ptr->timed[idx] == 0) { message(effect->msg, 0, effect->on_begin); notify = TRUE; } else if (notify) { /* Decrementing */ if (p_ptr->timed[idx] > v && effect->on_decrease) message(effect->msg, 0, effect->on_decrease); /* Incrementing */ else if (v > p_ptr->timed[idx] && effect->on_increase) message(effect->msg, 0, effect->on_increase); } /* Use the value */ p_ptr->timed[idx] = v; /* Sort out the sprint effect */ if (idx == TMD_SPRINT && v == 0) inc_timed(TMD_SLOW, 100, TRUE); /* Nothing to notice */ if (!notify) return FALSE; /* Disturb */ if (OPT(disturb_state)) disturb(0, 0); /* Update the visuals, as appropriate. */ p_ptr->update |= effect->flag_update; p_ptr->redraw |= (PR_STATUS | effect->flag_redraw); /* Handle stuff */ handle_stuff(); /* Result */ return TRUE; }
static void cmd_racial_power_aux(const mutation_type *mut_ptr) { s16b plev = p_ptr->lev; int dir = 0; if (racial_aux(mut_ptr->level, mut_ptr->cost, mut_ptr->stat, mut_ptr->diff)) { switch (p_ptr->prace) { case RACE_DWARF: { msg_print("You examine your surroundings."); (void)detect_traps(); (void)detect_doors(); (void)detect_stairs(); break; } case RACE_HOBBIT: { object_type *q_ptr; object_type forge; /* Get local object */ q_ptr = &forge; /* Create the food ration */ object_prep(q_ptr, 21); /* Drop the object from heaven */ (void)drop_near(q_ptr, -1, p_ptr->py, p_ptr->px); msg_print("You cook some food."); break; } case RACE_GNOME: { msg_print("Blink!"); teleport_player(10 + plev); break; } case RACE_HALF_ORC: { msg_print("You play tough."); (void)set_afraid(0); break; } case RACE_HALF_TROLL: { msg_print("RAAAGH!"); if (!p_ptr->shero) { (void)hp_player(30); } (void)set_afraid(0); (void)set_shero(p_ptr->shero + 10 + randint1(plev)); break; } case RACE_AMBERITE: { /* Hack - use levels to choose ability */ if (mut_ptr->level == 30) { msg_print("You picture the Pattern in your mind and walk it..."); (void)set_poisoned(0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); (void)set_blind(0); (void)set_afraid(0); (void)do_res_stat(A_STR, 200); (void)do_res_stat(A_INT, 200); (void)do_res_stat(A_WIS, 200); (void)do_res_stat(A_DEX, 200); (void)do_res_stat(A_CON, 200); (void)do_res_stat(A_CHR, 200); (void)restore_level(); } else if (mut_ptr->level == 40) { /* No effect in arena or quest */ if (p_ptr->inside_quest) { msg_print("There is no effect."); } else { msg_print("You start walking around. Your surroundings change."); if (autosave_l) do_cmd_save_game(TRUE); /* Leaving */ p_ptr->leaving = TRUE; } } break; } case RACE_BARBARIAN: { msg_print("Raaagh!"); if (!p_ptr->shero) { (void)hp_player(30); } (void)set_afraid(0); (void)set_shero(p_ptr->shero + 10 + randint1(plev)); break; } case RACE_HALF_OGRE: { msg_print("You carefully set an explosive rune..."); (void)explosive_rune(); break; } case RACE_HALF_GIANT: { if (!get_aim_dir(&dir)) break; msg_print("You bash at a stone wall."); (void)wall_to_mud(dir); break; } case RACE_HALF_TITAN: { msg_print("You examine your foes..."); (void)probing(); break; } case RACE_CYCLOPS: { if (!get_aim_dir(&dir)) break; msg_print("You throw a huge boulder."); (void)fire_bolt(GF_MISSILE, dir, (3 * plev) / 2); break; } case RACE_YEEK: { if (!get_aim_dir(&dir)) break; msg_print("You make a horrible scream!"); (void)fear_monster(dir, plev); break; } case RACE_KLACKON: { if (!get_aim_dir(&dir)) break; msg_print("You spit acid."); if (plev < 25) (void)fire_bolt(GF_ACID, dir, plev); else (void)fire_ball(GF_ACID, dir, plev, 2); break; } case RACE_KOBOLD: { if (!get_aim_dir(&dir)) break; msg_print("You throw a dart of poison."); (void)fire_bolt(GF_POIS, dir, plev); break; } case RACE_NIBELUNG: { msg_print("You examine your surroundings."); (void)detect_traps(); (void)detect_doors(); (void)detect_stairs(); break; } case RACE_DARK_ELF: { if (!get_aim_dir(&dir)) break; msg_print("You cast a magic missile."); (void)fire_bolt_or_beam(10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4)); break; } case RACE_DRACONIAN: { int Type = (one_in_(3) ? GF_COLD : GF_FIRE); cptr Type_desc = ((Type == GF_COLD) ? "cold" : "fire"); if (randint1(100) < plev) { switch (p_ptr->pclass) { case CLASS_WARRIOR: case CLASS_RANGER: if (one_in_(3)) { Type = GF_MISSILE; Type_desc = "the elements"; } else { Type = GF_SHARDS; Type_desc = "shards"; } break; case CLASS_MAGE: case CLASS_WARRIOR_MAGE: case CLASS_HIGH_MAGE: if (one_in_(3)) { Type = GF_MANA; Type_desc = "mana"; } else { Type = GF_DISENCHANT; Type_desc = "disenchantment"; } break; case CLASS_CHAOS_WARRIOR: if (!one_in_(3)) { Type = GF_CONFUSION; Type_desc = "confusion"; } else { Type = GF_CHAOS; Type_desc = "chaos"; } break; case CLASS_MONK: if (!one_in_(3)) { Type = GF_CONFUSION; Type_desc = "confusion"; } else { Type = GF_SOUND; Type_desc = "sound"; } break; case CLASS_MINDCRAFTER: if (!one_in_(3)) { Type = GF_CONFUSION; Type_desc = "confusion"; } else { Type = GF_PSI; Type_desc = "mental energy"; } break; case CLASS_PRIEST: case CLASS_PALADIN: if (one_in_(3)) { Type = GF_HELL_FIRE; Type_desc = "hellfire"; } else { Type = GF_HOLY_FIRE; Type_desc = "holy fire"; } break; case CLASS_ROGUE: if (one_in_(3)) { Type = GF_DARK; Type_desc = "darkness"; } else { Type = GF_POIS; Type_desc = "poison"; } break; } } if (!get_aim_dir(&dir)) break; msg_format("You breathe %s.", Type_desc); (void)fire_ball(Type, dir, plev * 2, (plev / 15) + 1); break; } case RACE_MIND_FLAYER: { if (!get_aim_dir(&dir)) break; else { msg_print("You concentrate and your eyes glow red..."); (void)fire_bolt(GF_PSI, dir, plev); } break; } case RACE_IMP: { if (!get_aim_dir(&dir)) break; if (plev >= 30) { msg_print("You cast a ball of fire."); (void)fire_ball(GF_FIRE, dir, plev, 2); } else { msg_print("You cast a bolt of fire."); (void)fire_bolt(GF_FIRE, dir, plev); } break; } case RACE_GOLEM: { (void)set_shield(p_ptr->shield + rand_range(30, 50)); break; } case RACE_SKELETON: case RACE_ZOMBIE: { msg_print("You attempt to restore your lost energies."); (void)restore_level(); break; } case RACE_VAMPIRE: { int y, x, dummy; cave_type *c_ptr; /* Only works on adjacent monsters */ if (!get_rep_dir(&dir)) break; y = p_ptr->py + ddy[dir]; x = p_ptr->px + ddx[dir]; /* Paranoia */ if (!in_bounds2(y, x)) break; c_ptr = area(y, x); if (!c_ptr->m_idx) { msg_print("You bite into thin air!"); break; } msg_print("You grin and bare your fangs..."); dummy = plev + randint1(plev) * MAX(1, plev / 10); /* Dmg */ if (drain_gain_life(dir, dummy)) { /* Gain nutritional sustenance: 150/hp drained */ /* A Food ration gives 5000 food points (by contrast) */ /* Don't ever get more than "Full" this way */ /* But if we ARE Gorged, it won't cure us */ dummy = p_ptr->food + MIN(5000, 100 * dummy); if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */ (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy); } else msg_print("Yechh. That tastes foul."); break; } case RACE_SPECTRE: { msg_print("You emit an eldritch howl!"); if (!get_aim_dir(&dir)) break; (void)fear_monster(dir, plev); break; } case RACE_SPRITE: { msg_print("You throw some magic dust..."); if (plev < 25) (void)sleep_monsters_touch(); else (void)sleep_monsters(); break; } case RACE_GHOUL: { if (mut_ptr->level == 30) { /* Sense living */ (void)detect_monsters_living(); } else { eat_corpse(); } break; } default: msg_print("This race has no bonus power."); p_ptr->energy_use = 0; } } /* Redraw mana and hp */ p_ptr->redraw |= (PR_HP | PR_MANA); /* Window stuff */ p_ptr->window |= (PW_PLAYER | PW_SPELL); }
/*! * @brief 青魔法の発動 / * do_cmd_cast calls this function if the player's class is 'blue-mage'. * @param spell 発動するモンスター攻撃のID * @param success TRUEは成功時、FALSEは失敗時の処理を行う * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。 */ static bool cast_learned_spell(int spell, bool success) { int dir; int plev = pseudo_plev(); int summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2); int damage = 0; bool pet = success; bool no_trump = FALSE; u32b p_mode, u_mode = 0L, g_mode; if (pet) { p_mode = PM_FORCE_PET; g_mode = 0; } else { p_mode = PM_NO_PET; g_mode = PM_ALLOW_GROUP; } if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE; /* spell code */ switch (spell) { case MS_SHRIEK: msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek.")); aggravate_monsters(0); break; case MS_XXX1: break; case MS_DISPEL: { int m_idx; if (!target_set(TARGET_KILL)) return FALSE; m_idx = cave[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; dispel_monster_status(m_idx); break; } case MS_ROCKET: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("ロケットを発射した。", "You fire a rocket.")); damage = monspell_bluemage_damage((MS_ROCKET), plev, DAM_ROLL); fire_rocket(GF_ROCKET, dir, damage, 2); break; case MS_SHOOT: { if (!get_aim_dir(&dir)) return FALSE; msg_print(_("矢を放った。", "You fire an arrow.")); damage = monspell_bluemage_damage((MS_SHOOT), plev, DAM_ROLL); fire_bolt(GF_ARROW, dir, damage); break; } case MS_XXX2: break; case MS_XXX3: break; case MS_XXX4: break; case MS_BR_ACID: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("酸のブレスを吐いた。", "You breathe acid.")); damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL); fire_ball(GF_ACID, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_ELEC: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning.")); damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL); fire_ball(GF_ELEC, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_FIRE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("火炎のブレスを吐いた。", "You breathe fire.")); damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL); fire_ball(GF_FIRE, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_COLD: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("冷気のブレスを吐いた。", "You breathe frost.")); damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL); fire_ball(GF_COLD, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_POIS: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("ガスのブレスを吐いた。", "You breathe gas.")); damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL); fire_ball(GF_POIS, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_NETHER: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("地獄のブレスを吐いた。", "You breathe nether.")); damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL); fire_ball(GF_NETHER, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_LITE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("閃光のブレスを吐いた。", "You breathe light.")); damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL); fire_ball(GF_LITE, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_DARK: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness.")); damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL); fire_ball(GF_DARK, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_CONF: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("混乱のブレスを吐いた。", "You breathe confusion.")); damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL); fire_ball(GF_CONFUSION, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_SOUND: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("轟音のブレスを吐いた。", "You breathe sound.")); damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL); fire_ball(GF_SOUND, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_CHAOS: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("カオスのブレスを吐いた。", "You breathe chaos.")); damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL); fire_ball(GF_CHAOS, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_DISEN: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment.")); damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL); fire_ball(GF_DISENCHANT, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_NEXUS: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus.")); damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL); fire_ball(GF_NEXUS, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_TIME: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("時間逆転のブレスを吐いた。", "You breathe time.")); damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL); fire_ball(GF_TIME, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_INERTIA: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia.")); damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL); fire_ball(GF_INERTIAL, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_GRAVITY: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("重力のブレスを吐いた。", "You breathe gravity.")); damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL); fire_ball(GF_GRAVITY, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_SHARDS: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("破片のブレスを吐いた。", "You breathe shards.")); damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL); fire_ball(GF_SHARDS, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_PLASMA: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma.")); damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL); fire_ball(GF_PLASMA, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_FORCE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("フォースのブレスを吐いた。", "You breathe force.")); damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL); fire_ball(GF_FORCE, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BR_MANA: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("魔力のブレスを吐いた。", "You breathe mana.")); damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL); fire_ball(GF_MANA, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BALL_NUKE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("放射能球を放った。", "You cast a ball of radiation.")); damage = monspell_bluemage_damage((MS_BALL_NUKE), plev, DAM_ROLL); fire_ball(GF_NUKE, dir, damage, 2); break; case MS_BR_NUKE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste.")); damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL); fire_ball(GF_NUKE, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BALL_CHAOS: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("純ログルスを放った。", "You invoke a raw Logrus.")); damage = monspell_bluemage_damage((MS_BALL_CHAOS), plev, DAM_ROLL); fire_ball(GF_CHAOS, dir, damage, 4); break; case MS_BR_DISI: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("分解のブレスを吐いた。", "You breathe disintegration.")); damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL); fire_ball(GF_DISINTEGRATE, dir, damage, (plev > 40 ? -3 : -2)); break; case MS_BALL_ACID: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball.")); damage = monspell_bluemage_damage((MS_BALL_ACID), plev, DAM_ROLL); fire_ball(GF_ACID, dir, damage, 2); break; case MS_BALL_ELEC: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball.")); damage = monspell_bluemage_damage((MS_BALL_ELEC), plev, DAM_ROLL); fire_ball(GF_ELEC, dir, damage, 2); break; case MS_BALL_FIRE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball.")); damage = monspell_bluemage_damage((MS_BALL_FIRE), plev, DAM_ROLL); fire_ball(GF_FIRE, dir, damage, 2); break; case MS_BALL_COLD: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball.")); damage = monspell_bluemage_damage((MS_BALL_COLD), plev, DAM_ROLL); fire_ball(GF_COLD, dir, damage, 2); break; case MS_BALL_POIS: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud.")); damage = monspell_bluemage_damage((MS_BALL_POIS), plev, DAM_ROLL); fire_ball(GF_POIS, dir, damage, 2); break; case MS_BALL_NETHER: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball.")); damage = monspell_bluemage_damage((MS_BALL_NETHER), plev, DAM_ROLL); fire_ball(GF_NETHER, dir, damage, 2); break; case MS_BALL_WATER: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("流れるような身振りをした。", "You gesture fluidly.")); damage = monspell_bluemage_damage((MS_BALL_WATER), plev, DAM_ROLL); fire_ball(GF_WATER, dir, damage, 4); break; case MS_BALL_MANA: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm.")); damage = monspell_bluemage_damage((MS_BALL_MANA), plev, DAM_ROLL); fire_ball(GF_MANA, dir, damage, 4); break; case MS_BALL_DARK: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm.")); damage = monspell_bluemage_damage((MS_BALL_DARK), plev, DAM_ROLL); fire_ball(GF_DARK, dir, damage, 4); break; case MS_DRAIN_MANA: if (!get_aim_dir(&dir)) return FALSE; damage = monspell_bluemage_damage((MS_DRAIN_MANA), plev, DAM_ROLL); fire_ball_hide(GF_DRAIN_MANA, dir, damage, 0); break; case MS_MIND_BLAST: if (!get_aim_dir(&dir)) return FALSE; damage = monspell_bluemage_damage((MS_MIND_BLAST), plev, DAM_ROLL); fire_ball_hide(GF_MIND_BLAST, dir, damage, 0); break; case MS_BRAIN_SMASH: if (!get_aim_dir(&dir)) return FALSE; damage = monspell_bluemage_damage((MS_BRAIN_SMASH), plev, DAM_ROLL); fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0); break; case MS_CAUSE_1: if (!get_aim_dir(&dir)) return FALSE; damage = monspell_bluemage_damage((MS_CAUSE_1), plev, DAM_ROLL); fire_ball_hide(GF_CAUSE_1, dir, damage, 0); break; case MS_CAUSE_2: if (!get_aim_dir(&dir)) return FALSE; damage = monspell_bluemage_damage((MS_CAUSE_2), plev, DAM_ROLL); fire_ball_hide(GF_CAUSE_2, dir, damage, 0); break; case MS_CAUSE_3: if (!get_aim_dir(&dir)) return FALSE; damage = monspell_bluemage_damage((MS_CAUSE_3), plev, DAM_ROLL); fire_ball_hide(GF_CAUSE_3, dir, damage, 0); break; case MS_CAUSE_4: if (!get_aim_dir(&dir)) return FALSE; damage = monspell_bluemage_damage((MS_CAUSE_4), plev, DAM_ROLL); fire_ball_hide(GF_CAUSE_4, dir, damage, 0); break; case MS_BOLT_ACID: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt.")); damage = monspell_bluemage_damage((MS_BOLT_ACID), plev, DAM_ROLL); fire_bolt(GF_ACID, dir, damage); break; case MS_BOLT_ELEC: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt.")); damage = monspell_bluemage_damage((MS_BOLT_ELEC), plev, DAM_ROLL); fire_bolt(GF_ELEC, dir, damage); break; case MS_BOLT_FIRE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt.")); damage = monspell_bluemage_damage((MS_BOLT_FIRE), plev, DAM_ROLL); fire_bolt(GF_FIRE, dir, damage); break; case MS_BOLT_COLD: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt.")); damage = monspell_bluemage_damage((MS_BOLT_COLD), plev, DAM_ROLL); fire_bolt(GF_COLD, dir, damage); break; case MS_STARBURST: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst.")); damage = monspell_bluemage_damage((MS_STARBURST), plev, DAM_ROLL); fire_ball(GF_LITE, dir, damage, 4); break; case MS_BOLT_NETHER: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt.")); damage = monspell_bluemage_damage((MS_BOLT_NETHER), plev, DAM_ROLL); fire_bolt(GF_NETHER, dir, damage); break; case MS_BOLT_WATER: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt.")); damage = monspell_bluemage_damage((MS_BOLT_WATER), plev, DAM_ROLL); fire_bolt(GF_WATER, dir, damage); break; case MS_BOLT_MANA: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt.")); damage = monspell_bluemage_damage((MS_BOLT_MANA), plev, DAM_ROLL); fire_bolt(GF_MANA, dir, damage); break; case MS_BOLT_PLASMA: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt.")); damage = monspell_bluemage_damage((MS_BOLT_PLASMA), plev, DAM_ROLL); fire_bolt(GF_PLASMA, dir, damage); break; case MS_BOLT_ICE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt.")); damage = monspell_bluemage_damage((MS_BOLT_ICE), plev, DAM_ROLL); fire_bolt(GF_ICE, dir, damage); break; case MS_MAGIC_MISSILE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile.")); damage = monspell_bluemage_damage((MS_MAGIC_MISSILE), plev, DAM_ROLL); fire_bolt(GF_MISSILE, dir, damage); break; case MS_SCARE: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion.")); fear_monster(dir, plev+10); break; case MS_BLIND: if (!get_aim_dir(&dir)) return FALSE; confuse_monster(dir, plev * 2); break; case MS_CONF: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion.")); confuse_monster(dir, plev * 2); break; case MS_SLOW: if (!get_aim_dir(&dir)) return FALSE; slow_monster(dir, plev); break; case MS_SLEEP: if (!get_aim_dir(&dir)) return FALSE; sleep_monster(dir, plev); break; case MS_SPEED: (void)set_fast(randint1(20 + plev) + plev, FALSE); break; case MS_HAND_DOOM: { if (!get_aim_dir(&dir)) return FALSE; msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!")); fire_ball_hide(GF_HAND_DOOM, dir, plev * 3, 0); break; } case MS_HEAL: msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!")); (void)hp_player(plev*4); (void)set_stun(0); (void)set_cut(0); break; case MS_INVULNER: msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability.")); (void)set_invuln(randint1(4) + 4, FALSE); break; case MS_BLINK: teleport_player(10, 0L); break; case MS_TELEPORT: teleport_player(plev * 5, 0L); break; case MS_WORLD: world_player = TRUE; msg_print(_("「時よ!」", "'Time!'")); msg_print(NULL); /* Hack */ p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10; /* Redraw map */ p_ptr->redraw |= (PR_MAP); /* Update monsters */ p_ptr->update |= (PU_MONSTERS); /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); handle_stuff(); break; case MS_SPECIAL: break; case MS_TELE_TO: { monster_type *m_ptr; monster_race *r_ptr; char m_name[80]; if (!target_set(TARGET_KILL)) return FALSE; if (!cave[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; m_ptr = &m_list[cave[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); if (r_ptr->flagsr & RFR_RES_TELE) { if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name); break; } else if (r_ptr->level > randint1(100)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; msg_format(_("%sには耐性がある!", "%s resists!"), m_name); break; } } msg_format(_("%sを引き戻した。", "You command %s to return."), m_name); teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: if (!get_aim_dir(&dir)) return FALSE; (void)fire_beam(GF_AWAY_ALL, dir, 100); break; case MS_TELE_LEVEL: { int target_m_idx; monster_type *m_ptr; monster_race *r_ptr; char m_name[80]; if (!target_set(TARGET_KILL)) return FALSE; target_m_idx = cave[target_row][target_col].m_idx; if (!target_m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; m_ptr = &m_list[target_m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name); if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60))) { msg_format(_("しかし効果がなかった!", "%^s is unaffected!"), m_name); } else teleport_level(target_m_idx); break; } case MS_PSY_SPEAR: if (!get_aim_dir(&dir)) return FALSE; msg_print(_("光の剣を放った。", "You throw a psycho-spear.")); damage = monspell_bluemage_damage((MS_PSY_SPEAR), plev, DAM_ROLL); (void)fire_beam(GF_PSY_SPEAR, dir, damage); break; case MS_DARKNESS: msg_print(_("暗闇の中で手を振った。", "You gesture in shadow.")); (void)unlite_area(10, 3); break; case MS_MAKE_TRAP: if (!target_set(TARGET_KILL)) return FALSE; msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly.")); trap_creation(target_row, target_col); break; case MS_FORGET: msg_print(_("しかし何も起きなかった。", "Nothing happen.")); break; case MS_RAISE_DEAD: msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead.")); (void)animate_dead(0, p_ptr->y, p_ptr->x); break; case MS_S_KIN: { int k; msg_print(_("援軍を召喚した。", "You summon minions.")); for (k = 0;k < 1; k++) { if (summon_kin_player(summon_lev, p_ptr->y, p_ptr->x, (pet ? PM_FORCE_PET : 0L))) { if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!")); } else { no_trump = TRUE; } } break; } case MS_S_CYBER: { int k; msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!")); for (k = 0 ;k < 1 ; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_CYBER, p_mode)) { if (!pet) msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!")); } else { no_trump = TRUE; } break; } case MS_S_MONSTER: { int k; msg_print(_("仲間を召喚した。", "You summon help.")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, p_mode)) { if (!pet) msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!")); } else { no_trump = TRUE; } break; } case MS_S_MONSTERS: { int k; msg_print(_("モンスターを召喚した!", "You summon monsters!")); for (k = 0;k < plev / 15 + 2; k++) if(summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, (p_mode | u_mode))) { if (!pet) msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!")); } else { no_trump = TRUE; } break; } case MS_S_ANT: { int k; msg_print(_("アリを召喚した。", "You summon ants.")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!")); } else { no_trump = TRUE; } break; } case MS_S_SPIDER: { int k; msg_print(_("蜘蛛を召喚した。", "You summon spiders.")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!")); } else { no_trump = TRUE; } break; } case MS_S_HOUND: { int k; msg_print(_("ハウンドを召喚した。", "You summon hounds.")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!")); } else { no_trump = TRUE; } break; } case MS_S_HYDRA: { int k; msg_print(_("ヒドラを召喚した。", "You summon a hydras.")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!")); } else { no_trump = TRUE; } break; } case MS_S_ANGEL: { int k; msg_print(_("天使を召喚した!", "You summon an angel!")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!")); } else { no_trump = TRUE; } break; } case MS_S_DEMON: { int k; msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!")); } else { no_trump = TRUE; } break; } case MS_S_UNDEAD: { int k; msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!")); } else { no_trump = TRUE; } break; } case MS_S_DRAGON: { int k; msg_print(_("ドラゴンを召喚した!", "You summon a dragon!")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!")); } else { no_trump = TRUE; } break; } case MS_S_HI_UNDEAD: { int k; msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode))) { if (!pet) msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!")); } else { no_trump = TRUE; } break; } case MS_S_HI_DRAGON: { int k; msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode))) { if (!pet) msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!")); } else { no_trump = TRUE; } break; } case MS_S_AMBERITE: { int k; msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode))) { if (!pet) msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!")); } else { no_trump = TRUE; } break; } case MS_S_UNIQUE: { int k, count = 0; msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!")); for (k = 0;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE))) { count++; if (!pet) msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!")); } for (k = count;k < 1; k++) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE))) { count++; if (!pet) msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!")); } if (!count) { no_trump = TRUE; } break; } default: msg_print("hoge?"); } if (no_trump) { msg_print(_("何も現れなかった。", "No one have appeared.")); } return TRUE; }
/* * do_cmd_cast calls this function if the player's class * is 'imitator'. */ static bool use_mane(int spell) { int dir; int plev = p_ptr->lev; u32b mode = (PM_ALLOW_GROUP | PM_FORCE_PET); u32b u_mode = 0L; if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE; /* spell code */ switch (spell) { case MS_SHRIEK: msg_print("You make a high pitched shriek."); aggravate_monsters(0); break; case MS_XXX1: break; case MS_DISPEL: { int m_idx; if (!target_set(TARGET_KILL)) return FALSE; m_idx = cave[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(py, px, target_row, target_col)) break; dispel_monster_status(m_idx); break; } case MS_ROCKET: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You fire a rocket."); fire_rocket(GF_ROCKET, dir, damage, 2); break; case MS_SHOOT: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You fire an arrow."); fire_bolt(GF_ARROW, dir, damage); break; case MS_XXX2: break; case MS_XXX3: break; case MS_BR_STORM: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe storm."); fire_ball(GF_STORM, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_ACID: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe acid."); fire_ball(GF_ACID, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_ELEC: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe lightning."); fire_ball(GF_ELEC, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_FIRE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe fire."); fire_ball(GF_FIRE, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_COLD: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe frost."); fire_ball(GF_COLD, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_POIS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe gas."); fire_ball(GF_POIS, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_NETHER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe nether."); fire_ball(GF_NETHER, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_LITE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe light."); fire_ball(GF_LITE, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_DARK: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe darkness."); fire_ball(GF_DARK, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_CONF: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe confusion."); fire_ball(GF_CONFUSION, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_SOUND: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe sound."); fire_ball(GF_SOUND, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_CHAOS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe chaos."); fire_ball(GF_CHAOS, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_DISEN: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe disenchantment."); fire_ball(GF_DISENCHANT, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_NEXUS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe nexus."); fire_ball(GF_NEXUS, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_TIME: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe time."); fire_ball(GF_TIME, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_INERTIA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe inertia."); fire_ball(GF_INERT, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_GRAVITY: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe gravity."); fire_ball(GF_GRAVITY, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_SHARDS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe shards."); fire_ball(GF_SHARDS, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_PLASMA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe plasma."); fire_ball(GF_PLASMA, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_FORCE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe force."); fire_ball(GF_FORCE, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BR_MANA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe mana."); fire_ball(GF_MANA, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BALL_NUKE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a ball of radiation."); fire_ball(GF_NUKE, dir, damage, 2); break; case MS_BR_NUKE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe toxic waste."); fire_ball(GF_NUKE, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BALL_CHAOS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke a raw Logrus."); fire_ball(GF_CHAOS, dir, damage, 4); break; case MS_BR_DISI: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You breathe disintegration."); fire_ball(GF_DISINTEGRATE, dir, damage, (plev > 35 ? -3 : -2)); break; case MS_BALL_ACID: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast an acid ball."); fire_ball(GF_ACID, dir, damage, 2); break; case MS_BALL_ELEC: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a lightning ball."); fire_ball(GF_ELEC, dir, damage, 2); break; case MS_BALL_FIRE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a fire ball."); fire_ball(GF_FIRE, dir, damage, 2); break; case MS_BALL_COLD: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a frost ball."); fire_ball(GF_COLD, dir, damage, 2); break; case MS_BALL_POIS: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a stinking cloud."); fire_ball(GF_POIS, dir, damage, 2); break; case MS_BALL_NETHER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a nether ball."); fire_ball(GF_NETHER, dir, damage, 2); break; case MS_BALL_WATER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You gesture fluidly."); fire_ball(GF_WATER, dir, damage, 4); break; case MS_BALL_MANA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke a mana storm."); fire_ball(GF_MANA, dir, damage, 4); break; case MS_BALL_DARK: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke a darkness storm."); fire_ball(GF_DARK, dir, damage, 4); break; case MS_DRAIN_MANA: if (!get_aim_dir(&dir)) return FALSE; fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0); break; case MS_MIND_BLAST: if (!get_aim_dir(&dir)) return FALSE; fire_ball_hide(GF_MIND_BLAST, dir, damage, 0); break; case MS_BRAIN_SMASH: if (!get_aim_dir(&dir)) return FALSE; fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0); break; case MS_CAUSE_1: if (!get_aim_dir(&dir)) return FALSE; fire_ball_hide(GF_CAUSE_1, dir, damage, 0); break; case MS_CAUSE_2: if (!get_aim_dir(&dir)) return FALSE; fire_ball_hide(GF_CAUSE_2, dir, damage, 0); break; case MS_CAUSE_3: if (!get_aim_dir(&dir)) return FALSE; fire_ball_hide(GF_CAUSE_3, dir, damage, 0); break; case MS_CAUSE_4: if (!get_aim_dir(&dir)) return FALSE; fire_ball_hide(GF_CAUSE_4, dir, damage, 0); break; case MS_BOLT_ACID: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast an acid bolt."); fire_bolt(GF_ACID, dir, damage); break; case MS_BOLT_ELEC: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a lightning bolt."); fire_bolt(GF_ELEC, dir, damage); break; case MS_BOLT_FIRE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a fire bolt."); fire_bolt(GF_FIRE, dir, damage); break; case MS_BOLT_COLD: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a frost bolt."); fire_bolt(GF_COLD, dir, damage); break; case MS_STARBURST: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke a starburst."); fire_ball(GF_LITE, dir, damage, 4); break; case MS_BOLT_NETHER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a nether bolt."); fire_bolt(GF_NETHER, dir, damage); break; case MS_BOLT_WATER: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a water bolt."); fire_bolt(GF_WATER, dir, damage); break; case MS_BOLT_MANA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a mana bolt."); fire_bolt(GF_MANA, dir, damage); break; case MS_BOLT_PLASMA: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a plasma bolt."); fire_bolt(GF_PLASMA, dir, damage); break; case MS_BOLT_ICE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a ice bolt."); fire_bolt(GF_ICE, dir, damage); break; case MS_MAGIC_MISSILE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a magic missile."); fire_bolt(GF_MISSILE, dir, damage); break; case MS_SCARE: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a fearful illusion."); fear_monster(dir, plev+10); break; case MS_BLIND: if (!get_aim_dir(&dir)) return FALSE; confuse_monster(dir, plev * 2); break; case MS_CONF: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You cast a mesmerizing illusion."); confuse_monster(dir, plev * 2); break; case MS_SLOW: if (!get_aim_dir(&dir)) return FALSE; slow_monster(dir); break; case MS_SLEEP: if (!get_aim_dir(&dir)) return FALSE; sleep_monster(dir, plev*3); break; case MS_SPEED: (void)set_fast(randint1(20 + plev) + plev, FALSE); break; case MS_HAND_DOOM: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You invoke the Hand of Doom!"); fire_ball_hide(GF_HAND_DOOM, dir, 200, 0); break; case MS_HEAL: msg_print("You concentrate on your wounds!"); (void)hp_player(plev*6); (void)set_stun(0, TRUE); (void)set_cut(0, TRUE); break; case MS_INVULNER: msg_print("You cast a Globe of Invulnerability."); (void)set_invuln(randint1(7) + 7, FALSE); break; case MS_BLINK: if (mut_present(MUT_ASTRAL_GUIDE)) energy_use = 30; teleport_player(10, 0L); break; case MS_TELEPORT: if (mut_present(MUT_ASTRAL_GUIDE)) energy_use = 30; teleport_player(plev * 5, 0L); break; case MS_WORLD: world_player = TRUE; if (damage == 1 || damage == 2) msg_print("You yell 'The World! Time has stopped!'"); else if (damage == 3 || damage == 6) msg_print("You yell 'Time!'"); else msg_print("hek!"); msg_print(NULL); p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10; p_ptr->redraw |= (PR_MAP); p_ptr->update |= (PU_MONSTERS); p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); handle_stuff(); break; case MS_SPECIAL: break; case MS_TELE_TO: { monster_type *m_ptr; monster_race *r_ptr; char m_name[80]; if (!target_set(TARGET_KILL)) return FALSE; if (!cave[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(py, px, target_row, target_col)) break; m_ptr = &m_list[cave[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); if (r_ptr->flagsr & RFR_RES_TELE) { if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; msg_format("%s is unaffected!", m_name); break; } else if (r_ptr->level > randint1(100)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; msg_format("%s resists!", m_name); break; } } msg_format("You command %s to return.", m_name); teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: if (!get_aim_dir(&dir)) return FALSE; (void)fire_beam(GF_AWAY_ALL, dir, plev); break; case MS_TELE_LEVEL: { int target_m_idx; monster_type *m_ptr; monster_race *r_ptr; char m_name[80]; if (!target_set(TARGET_KILL)) return FALSE; target_m_idx = cave[target_row][target_col].m_idx; if (!target_m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(py, px, target_row, target_col)) break; m_ptr = &m_list[target_m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); msg_format("You gesture at %^s's feet.", m_name); if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60))) { msg_format("%^s is unaffected!", m_name); } else teleport_level(target_m_idx); break; } case MS_PSY_SPEAR: if (!get_aim_dir(&dir)) return FALSE; else msg_print("You throw a psycho-spear."); fire_beam(GF_PSY_SPEAR, dir, damage); break; case MS_DARKNESS: msg_print("You gesture in shadow."); unlite_area(10, 3); break; case MS_MAKE_TRAP: if (!target_set(TARGET_KILL)) return FALSE; msg_print("You cast a spell and cackle evilly."); trap_creation(target_row, target_col); break; case MS_FORGET: msg_print("Nothing happens."); /* TODO: forget_spell(m_idx) ... */ break; case MS_RAISE_DEAD: msg_print("You cast a animate dead."); animate_dead(0, py, px); break; case MS_S_KIN: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon minions."); for (k = 0;k < 4; k++) { (void)summon_kin_player(plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP)); } break; } case MS_S_CYBER: { int k; int max_cyber = (dun_level / 50) + randint1(3); if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon Cyberdemons!"); if (max_cyber > 4) max_cyber = 4; for (k = 0;k < max_cyber; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_CYBER, mode); break; } case MS_S_MONSTER: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon help."); for (k = 0;k < 1; k++) summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode)); break; } case MS_S_MONSTERS: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon monsters!"); for (k = 0;k < 6; k++) summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode)); break; } case MS_S_ANT: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon ants."); for (k = 0;k < 6; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_ANT, mode); break; } case MS_S_SPIDER: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon spiders."); for (k = 0;k < 6; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_SPIDER, mode); break; } case MS_S_HOUND: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon hounds."); for (k = 0;k < 4; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_HOUND, mode); break; } case MS_S_HYDRA: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon hydras."); for (k = 0;k < 4; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_HYDRA, mode); break; } case MS_S_ANGEL: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon angel!"); for (k = 0;k < 1; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_ANGEL, mode); break; } case MS_S_DEMON: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon a demon from the Courts of Chaos!"); for (k = 0;k < 1; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode)); break; } case MS_S_UNDEAD: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon an undead adversary!"); for (k = 0;k < 1; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode)); break; } case MS_S_DRAGON: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon dragon!"); for (k = 0;k < 1; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode)); break; } case MS_S_HI_UNDEAD: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon greater undead!"); for (k = 0;k < 6; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode)); break; } case MS_S_HI_DRAGON: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon ancient dragons!"); for (k = 0;k < 4; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode)); break; } case MS_S_AMBERITE: { int k; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon Lords of Amber!"); for (k = 0;k < 4; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_AMBERITE, (mode | PM_ALLOW_UNIQUE)); break; } case MS_S_UNIQUE: { int k, count = 0; if (!target_set(TARGET_KILL)) return FALSE; msg_print("You summon special opponents!"); for (k = 0;k < 4; k++) if (summon_specific(-1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++; for (k = count;k < 4; k++) summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode)); break; } default: msg_print("hoge?"); } return TRUE; }
static bool zap_rod(object_type *o_ptr, bool *ident) { int chance, dir, lev; /* Get a direction (unless KNOWN not to need it) */ if ((o_ptr->sval >= SV_ROD_MIN_DIRECTION) || !object_aware_p(o_ptr)) { /* Get a direction, allow cancel */ if (!get_aim_dir(&dir)) return FALSE; } /* Take a turn */ p_ptr->energy_use = 100; /* Not identified yet */ *ident = FALSE; /* Extract the item level */ lev = k_info[o_ptr->k_idx].level; /* Base chance of success */ chance = p_ptr->skill_dev; /* Confusion hurts skill */ if (p_ptr->confused) chance = chance / 2; /* High level objects are harder */ chance = chance - ((lev > 50) ? 50 : lev); /* Give everyone a (slight) chance */ if ((chance < USE_DEVICE) && (rand_int(USE_DEVICE - chance + 1) == 0)) { chance = USE_DEVICE; } /* Roll for usage */ if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE)) { if (flush_failure) flush(); msg_print("You failed to use the rod properly."); return FALSE; } /* Still charging */ if (o_ptr->pval) { if (flush_failure) flush(); msg_print("The rod is still charging."); return FALSE; } /* Sound */ sound(MSG_ZAP); /* Analyze the rod */ switch (o_ptr->sval) { case SV_ROD_DETECT_TRAP: { if (detect_traps()) *ident = TRUE; o_ptr->pval = 50; break; } case SV_ROD_DETECT_DOOR: { if (detect_doors()) *ident = TRUE; if (detect_stairs()) *ident = TRUE; o_ptr->pval = 70; break; } case SV_ROD_IDENTIFY: { *ident = TRUE; if (ident_spell()) o_ptr->pval = 10; break; } case SV_ROD_RECALL: { set_recall(); *ident = TRUE; o_ptr->pval = 60; break; } case SV_ROD_ILLUMINATION: { if (lite_area(damroll(2, 8), 2)) *ident = TRUE; o_ptr->pval = 30; break; } case SV_ROD_MAPPING: { map_area(); *ident = TRUE; o_ptr->pval = 99; break; } case SV_ROD_DETECTION: { detect_all(); *ident = TRUE; o_ptr->pval = 99; break; } case SV_ROD_PROBING: { probing(); *ident = TRUE; o_ptr->pval = 50; break; } case SV_ROD_CURING: { if (set_blind(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; o_ptr->pval = 999; break; } case SV_ROD_HEALING: { if (hp_player(500)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; o_ptr->pval = 999; break; } case SV_ROD_RESTORATION: { if (restore_level()) *ident = TRUE; if (do_res_stat(A_STR)) *ident = TRUE; if (do_res_stat(A_INT)) *ident = TRUE; if (do_res_stat(A_WIS)) *ident = TRUE; if (do_res_stat(A_DEX)) *ident = TRUE; if (do_res_stat(A_CON)) *ident = TRUE; if (do_res_stat(A_CHR)) *ident = TRUE; o_ptr->pval = 999; break; } case SV_ROD_SPEED: { if (!p_ptr->fast) { if (set_fast(randint(30) + 15)) *ident = TRUE; } else { (void)set_fast(p_ptr->fast + 5); } o_ptr->pval = 99; break; } case SV_ROD_TELEPORT_AWAY: { if (teleport_monster(dir)) *ident = TRUE; o_ptr->pval = 25; break; } case SV_ROD_DISARMING: { if (disarm_trap(dir)) *ident = TRUE; o_ptr->pval = 30; break; } case SV_ROD_LITE: { msg_print("A line of blue shimmering light appears."); lite_line(dir); *ident = TRUE; o_ptr->pval = 9; break; } case SV_ROD_SLEEP_MONSTER: { if (sleep_monster(dir)) *ident = TRUE; o_ptr->pval = 18; break; } case SV_ROD_SLOW_MONSTER: { if (slow_monster(dir)) *ident = TRUE; o_ptr->pval = 20; break; } case SV_ROD_DRAIN_LIFE: { if (drain_life(dir, 150)) *ident = TRUE; o_ptr->pval = 23; break; } case SV_ROD_POLYMORPH: { if (poly_monster(dir)) *ident = TRUE; o_ptr->pval = 25; break; } case SV_ROD_ACID_BOLT: { fire_bolt_or_beam(10, GF_ACID, dir, damroll(12, 8)); *ident = TRUE; o_ptr->pval = 12; break; } case SV_ROD_ELEC_BOLT: { fire_bolt_or_beam(10, GF_ELEC, dir, damroll(6, 6)); *ident = TRUE; o_ptr->pval = 11; break; } case SV_ROD_FIRE_BOLT: { fire_bolt_or_beam(10, GF_FIRE, dir, damroll(16, 8)); *ident = TRUE; o_ptr->pval = 15; break; } case SV_ROD_COLD_BOLT: { fire_bolt_or_beam(10, GF_COLD, dir, damroll(10, 8)); *ident = TRUE; o_ptr->pval = 13; break; } case SV_ROD_ACID_BALL: { fire_ball(GF_ACID, dir, 120, 2); *ident = TRUE; o_ptr->pval = 27; break; } case SV_ROD_ELEC_BALL: { fire_ball(GF_ELEC, dir, 64, 2); *ident = TRUE; o_ptr->pval = 23; break; } case SV_ROD_FIRE_BALL: { fire_ball(GF_FIRE, dir, 144, 2); *ident = TRUE; o_ptr->pval = 30; break; } case SV_ROD_COLD_BALL: { fire_ball(GF_COLD, dir, 96, 2); *ident = TRUE; o_ptr->pval = 25; break; } } return TRUE; }
static bool quaff_potion(object_type *o_ptr, bool *ident) { /* Analyze the potion */ switch (o_ptr->sval) { case SV_POTION_WATER: case SV_POTION_APPLE_JUICE: case SV_POTION_SLIME_MOLD: { msg_print("You feel less thirsty."); *ident = TRUE; break; } case SV_POTION_SLOWNESS: { if (set_slow(p_ptr->slow + randint(25) + 15)) *ident = TRUE; break; } case SV_POTION_SALT_WATER: { msg_print("The potion makes you vomit!"); (void)set_food(PY_FOOD_STARVE - 1); (void)set_poisoned(0); (void)set_paralyzed(p_ptr->paralyzed + 4); *ident = TRUE; break; } case SV_POTION_POISON: { if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) { if (set_poisoned(p_ptr->poisoned + rand_int(15) + 10)) { *ident = TRUE; } } break; } case SV_POTION_BLINDNESS: { if (!p_ptr->resist_blind) { if (set_blind(p_ptr->blind + rand_int(100) + 100)) { *ident = TRUE; } } break; } case SV_POTION_CONFUSION: { if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + rand_int(20) + 15)) { *ident = TRUE; } } break; } case SV_POTION_SLEEP: { if (!p_ptr->free_act) { if (set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4)) { *ident = TRUE; } } break; } case SV_POTION_LOSE_MEMORIES: { if (!p_ptr->hold_life && (p_ptr->exp > 0)) { msg_print("You feel your memories fade."); lose_exp(p_ptr->exp / 4); *ident = TRUE; } break; } case SV_POTION_RUINATION: { msg_print("Your nerves and muscles feel weak and lifeless!"); take_hit(damroll(10, 10), "a potion of Ruination"); (void)dec_stat(A_DEX, 25, TRUE); (void)dec_stat(A_WIS, 25, TRUE); (void)dec_stat(A_CON, 25, TRUE); (void)dec_stat(A_STR, 25, TRUE); (void)dec_stat(A_CHR, 25, TRUE); (void)dec_stat(A_INT, 25, TRUE); *ident = TRUE; break; } case SV_POTION_DEC_STR: { if (do_dec_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_DEC_INT: { if (do_dec_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_DEC_WIS: { if (do_dec_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_DEC_DEX: { if (do_dec_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_DEC_CON: { if (do_dec_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_DEC_CHR: { if (do_dec_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_DETONATIONS: { msg_print("Massive explosions rupture your body!"); take_hit(damroll(50, 20), "a potion of Detonation"); (void)set_stun(p_ptr->stun + 75); (void)set_cut(p_ptr->cut + 5000); *ident = TRUE; break; } case SV_POTION_DEATH: { msg_print("A feeling of Death flows through your body."); take_hit(5000, "a potion of Death"); *ident = TRUE; break; } case SV_POTION_INFRAVISION: { if (set_tim_infra(p_ptr->tim_infra + 100 + randint(100))) { *ident = TRUE; } break; } case SV_POTION_DETECT_INVIS: { if (set_tim_invis(p_ptr->tim_invis + 12 + randint(12))) { *ident = TRUE; } break; } case SV_POTION_SLOW_POISON: { if (set_poisoned(p_ptr->poisoned / 2)) *ident = TRUE; break; } case SV_POTION_CURE_POISON: { if (set_poisoned(0)) *ident = TRUE; break; } case SV_POTION_BOLDNESS: { if (set_afraid(0)) *ident = TRUE; break; } case SV_POTION_SPEED: { if (!p_ptr->fast) { if (set_fast(randint(25) + 15)) *ident = TRUE; } else { (void)set_fast(p_ptr->fast + 5); } break; } case SV_POTION_RESIST_HEAT: { if (set_oppose_fire(p_ptr->oppose_fire + randint(10) + 10)) { *ident = TRUE; } break; } case SV_POTION_RESIST_COLD: { if (set_oppose_cold(p_ptr->oppose_cold + randint(10) + 10)) { *ident = TRUE; } break; } case SV_POTION_HEROISM: { if (hp_player(10)) *ident = TRUE; if (set_afraid(0)) *ident = TRUE; if (set_hero(p_ptr->hero + randint(25) + 25)) *ident = TRUE; break; } case SV_POTION_BERSERK_STRENGTH: { if (hp_player(30)) *ident = TRUE; if (set_afraid(0)) *ident = TRUE; if (set_shero(p_ptr->shero + randint(25) + 25)) *ident = TRUE; break; } case SV_POTION_CURE_LIGHT: { if (hp_player(damroll(2, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_cut(p_ptr->cut - 10)) *ident = TRUE; break; } case SV_POTION_CURE_SERIOUS: { if (hp_player(damroll(4, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_cut((p_ptr->cut / 2) - 50)) *ident = TRUE; break; } case SV_POTION_CURE_CRITICAL: { if (hp_player(damroll(6, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_HEALING: { if (hp_player(300)) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_STAR_HEALING: { if (hp_player(1200)) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_LIFE: { msg_print("You feel life flow through your body!"); restore_level(); (void)set_poisoned(0); (void)set_blind(0); (void)set_confused(0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); /* Recalculate max. hitpoints */ update_stuff(); hp_player(5000); *ident = TRUE; break; } case SV_POTION_RESTORE_MANA: { if (p_ptr->csp < p_ptr->msp) { p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; msg_print("Your feel your head clear."); p_ptr->redraw |= (PR_MANA); p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1); *ident = TRUE; } break; } case SV_POTION_RESTORE_EXP: { if (restore_level()) *ident = TRUE; break; } case SV_POTION_RES_STR: { if (do_res_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_RES_INT: { if (do_res_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_RES_WIS: { if (do_res_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_RES_DEX: { if (do_res_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_RES_CON: { if (do_res_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_RES_CHR: { if (do_res_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_INC_STR: { if (do_inc_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_INC_INT: { if (do_inc_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_INC_WIS: { if (do_inc_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_INC_DEX: { if (do_inc_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_INC_CON: { if (do_inc_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_INC_CHR: { if (do_inc_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_AUGMENTATION: { if (do_inc_stat(A_STR)) *ident = TRUE; if (do_inc_stat(A_INT)) *ident = TRUE; if (do_inc_stat(A_WIS)) *ident = TRUE; if (do_inc_stat(A_DEX)) *ident = TRUE; if (do_inc_stat(A_CON)) *ident = TRUE; if (do_inc_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_ENLIGHTENMENT: { msg_print("An image of your surroundings forms in your mind..."); wiz_lite(); *ident = TRUE; break; } case SV_POTION_STAR_ENLIGHTENMENT: { msg_print("You begin to feel more enlightened..."); message_flush(); wiz_lite(); (void)do_inc_stat(A_INT); (void)do_inc_stat(A_WIS); (void)detect_traps(); (void)detect_doors(); (void)detect_stairs(); (void)detect_treasure(); (void)detect_objects_gold(); (void)detect_objects_normal(); identify_pack(); self_knowledge(); *ident = TRUE; break; } case SV_POTION_SELF_KNOWLEDGE: { msg_print("You begin to know yourself a little better..."); message_flush(); self_knowledge(); *ident = TRUE; break; } case SV_POTION_EXPERIENCE: { if (p_ptr->exp < PY_MAX_EXP) { s32b ee = (p_ptr->exp / 2) + 10; if (ee > 100000L) ee = 100000L; msg_print("You feel more experienced."); gain_exp(ee); *ident = TRUE; } break; } } return (TRUE); }
static bool quaff_potion(object_type *o_ptr, bool *ident) { /* Analyze the potion */ switch (o_ptr->sval) { case SV_POTION_WATER: case SV_POTION_APPLE_JUICE: case SV_POTION_SLIME_MOLD: { msg_print("Вы утолили жажду."); *ident = TRUE; break; } case SV_POTION_SLOWNESS: { if (set_slow(p_ptr->slow + randint(25) + 15)) *ident = TRUE; break; } case SV_POTION_SALT_WATER: { msg_print("Вя-а-а! Вас стошнило!"); (void)set_food(PY_FOOD_STARVE - 1); (void)set_poisoned(0); (void)set_paralyzed(p_ptr->paralyzed + 4); *ident = TRUE; break; } case SV_POTION_POISON: { if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) { if (set_poisoned(p_ptr->poisoned + rand_int(15) + 10)) { *ident = TRUE; } } break; } case SV_POTION_BLINDNESS: { if (!p_ptr->resist_blind) { if (set_blind(p_ptr->blind + rand_int(100) + 100)) { *ident = TRUE; } } break; } case SV_POTION_CONFUSION: { if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + rand_int(20) + 15)) { *ident = TRUE; } } break; } case SV_POTION_SLEEP: { if (!p_ptr->free_act) { if (set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4)) { *ident = TRUE; } } break; } case SV_POTION_LOSE_MEMORIES: { if (!p_ptr->hold_life && (p_ptr->exp > 0)) { msg_print("Ваша жизнь меркнет."); lose_exp(p_ptr->exp / 4); *ident = TRUE; } break; } case SV_POTION_RUINATION: { msg_print("Ваши нервы и мускулы кажутся слабыми и безжизненными!"); take_hit(damroll(10, 10), "зельем Ослабевания"); (void)dec_stat(A_DEX, 25, TRUE); (void)dec_stat(A_WIS, 25, TRUE); (void)dec_stat(A_CON, 25, TRUE); (void)dec_stat(A_STR, 25, TRUE); (void)dec_stat(A_CHR, 25, TRUE); (void)dec_stat(A_INT, 25, TRUE); *ident = TRUE; break; } case SV_POTION_DEC_STR: { if (do_dec_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_DEC_INT: { if (do_dec_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_DEC_WIS: { if (do_dec_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_DEC_DEX: { if (do_dec_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_DEC_CON: { if (do_dec_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_DEC_CHR: { if (do_dec_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_DETONATIONS: { msg_print("Массивные взрывы сотрясают ваше тело!"); take_hit(damroll(50, 20), "зельем взрыва"); (void)set_stun(p_ptr->stun + 75); (void)set_cut(p_ptr->cut + 5000); *ident = TRUE; break; } case SV_POTION_DEATH: { msg_print("Чувство Смерти протекает сквозь вас..."); take_hit(5000, "зельем Смерти"); *ident = TRUE; break; } case SV_POTION_INFRAVISION: { if (set_tim_infra(p_ptr->tim_infra + 100 + randint(100))) { *ident = TRUE; } break; } case SV_POTION_DETECT_INVIS: { if (set_tim_invis(p_ptr->tim_invis + 12 + randint(12))) { *ident = TRUE; } break; } case SV_POTION_SLOW_POISON: { if (set_poisoned(p_ptr->poisoned / 2)) *ident = TRUE; break; } case SV_POTION_CURE_POISON: { if (set_poisoned(0)) *ident = TRUE; break; } case SV_POTION_BOLDNESS: { if (set_afraid(0)) *ident = TRUE; break; } case SV_POTION_SPEED: { if (!p_ptr->fast) { if (set_fast(randint(25) + 15)) *ident = TRUE; } else { (void)set_fast(p_ptr->fast + 5); } break; } case SV_POTION_RESIST_HEAT: { if (set_oppose_fire(p_ptr->oppose_fire + randint(10) + 10)) { *ident = TRUE; } break; } case SV_POTION_RESIST_COLD: { if (set_oppose_cold(p_ptr->oppose_cold + randint(10) + 10)) { *ident = TRUE; } break; } case SV_POTION_HEROISM: { if (hp_player(10)) *ident = TRUE; if (set_afraid(0)) *ident = TRUE; if (set_hero(p_ptr->hero + randint(25) + 25)) *ident = TRUE; break; } case SV_POTION_BERSERK_STRENGTH: { if (hp_player(30)) *ident = TRUE; if (set_afraid(0)) *ident = TRUE; if (set_shero(p_ptr->shero + randint(25) + 25)) *ident = TRUE; break; } case SV_POTION_CURE_LIGHT: { if (hp_player(damroll(2, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_cut(p_ptr->cut - 10)) *ident = TRUE; break; } case SV_POTION_CURE_SERIOUS: { if (hp_player(damroll(4, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_cut((p_ptr->cut / 2) - 50)) *ident = TRUE; break; } case SV_POTION_CURE_CRITICAL: { if (hp_player(damroll(6, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_HEALING: { if (hp_player(300)) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_STAR_HEALING: { if (hp_player(1200)) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_LIFE: { msg_print("Чуство Жизни протекает в вас!"); restore_level(); (void)set_poisoned(0); (void)set_blind(0); (void)set_confused(0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); /* Recalculate max. hitpoints */ update_stuff(); hp_player(5000); *ident = TRUE; break; } case SV_POTION_RESTORE_MANA: { if (p_ptr->csp < p_ptr->msp) { p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; msg_print("Ваша голова проясняется."); p_ptr->redraw |= (PR_MANA); p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1); *ident = TRUE; } break; } case SV_POTION_RESTORE_EXP: { if (restore_level()) *ident = TRUE; break; } case SV_POTION_RES_STR: { if (do_res_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_RES_INT: { if (do_res_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_RES_WIS: { if (do_res_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_RES_DEX: { if (do_res_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_RES_CON: { if (do_res_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_RES_CHR: { if (do_res_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_INC_STR: { if (do_inc_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_INC_INT: { if (do_inc_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_INC_WIS: { if (do_inc_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_INC_DEX: { if (do_inc_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_INC_CON: { if (do_inc_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_INC_CHR: { if (do_inc_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_AUGMENTATION: { if (do_inc_stat(A_STR)) *ident = TRUE; if (do_inc_stat(A_INT)) *ident = TRUE; if (do_inc_stat(A_WIS)) *ident = TRUE; if (do_inc_stat(A_DEX)) *ident = TRUE; if (do_inc_stat(A_CON)) *ident = TRUE; if (do_inc_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_ENLIGHTENMENT: { msg_print("Изображение подземелья формируется у вас в голове..."); wiz_lite(); *ident = TRUE; break; } case SV_POTION_STAR_ENLIGHTENMENT: { msg_print("Вы чувствуете себя просвещенным..."); message_flush(); wiz_lite(); (void)do_inc_stat(A_INT); (void)do_inc_stat(A_WIS); (void)detect_traps(); (void)detect_doors(); (void)detect_stairs(); (void)detect_treasure(); (void)detect_objects_gold(); (void)detect_objects_normal(); identify_pack(); self_knowledge(); *ident = TRUE; break; } case SV_POTION_SELF_KNOWLEDGE: { msg_print("Вы познаете себя немного лучше..."); message_flush(); self_knowledge(); *ident = TRUE; break; } case SV_POTION_EXPERIENCE: { if (p_ptr->exp < PY_MAX_EXP) { s32b ee = (p_ptr->exp / 2) + 10; if (ee > 100000L) ee = 100000L; msg_print("Вы чувствуете себя более опытным."); gain_exp(ee); *ident = TRUE; } break; } } return (TRUE); }
/* * do_cmd_mind calls this function if the player's class * is 'Officer'. */ static bool cast_officer_spell(int spell) { /* this will vary based on the spells, and what they depend on */ int plev = p_ptr->lev; int dir; int time = randint(20) + 20; /* spell code */ switch (spell) { case 0: if (!get_aim_dir(&dir)) return FALSE; (void)fear_monster(dir, plev); break; case 1: if (!get_aim_dir(&dir)) return FALSE; (void)fire_bolt(GF_STUN, dir, damroll(plev, 5)); break; case 2: if (!get_aim_dir(&dir)) return FALSE; (void)fire_bolt(GF_CHARM, dir, damroll(plev, plev)); break; case 3: (void)hp_player(damroll((plev / 2), (plev * 2))); (void)set_afraid(0); (void)set_stun(0); (void)set_cut(0); (void)do_res_stat(A_STR); (void)do_res_stat(A_INT); (void)do_res_stat(A_WIS); (void)do_res_stat(A_DEX); (void)do_res_stat(A_CON); (void)do_res_stat(A_CHR); break; case 4: (void)detect_monsters_normal(); break; case 5: (void)set_protevil(p_ptr->protevil + randint(25) + 3 * p_ptr->lev); if (!p_ptr->fast) { (void)set_fast(randint(20) + plev); } else { (void)set_fast(p_ptr->fast + randint(5)); } (void)set_oppose_acid(p_ptr->oppose_acid + time); (void)set_oppose_elec(p_ptr->oppose_elec + time); (void)set_oppose_fire(p_ptr->oppose_fire + time); (void)set_oppose_cold(p_ptr->oppose_cold + time); (void)set_oppose_pois(p_ptr->oppose_pois + time); (void)set_invuln(p_ptr->invuln + ((plev / 20) + randint(2))); break; case 6: if (!get_aim_dir(&dir)) return FALSE; fire_ball(GF_CHARM, dir, (plev * 4), (plev / 8)); break; case 7: break; case 8: break; case 9: break; case 10: break; case 11: break; case 12: break; case 13: break; case 14: break; case 15: break; case 16: break; case 17: break; case 18: break; case 19: break; case 20: break; } return TRUE; }
/* * Attack the player via physical attacks. */ bool make_attack_normal(int m_idx) { monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_lore *l_ptr = &l_list[m_ptr->r_idx]; int ap_cnt; int tmp, ac, rlev; int do_cut, do_stun, touched; char m_name[80]; char ddesc[80]; bool blinked; /* Not allowed to attack */ if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return (FALSE); /* Total armor */ ac = p_ptr->ac + p_ptr->to_a; /* Extract the effective monster level */ rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); /* Get the monster name (or "it") */ monster_desc(m_name, m_ptr, 0); /* Get the "died from" information (i.e. "a goblin") */ monster_desc(ddesc, m_ptr, 0x88); /* Assume no blink */ blinked = FALSE; /* Scan through all four blows */ for (ap_cnt = 0; ap_cnt < 4; ap_cnt++) { bool visible = FALSE; bool obvious = FALSE; int power = 0; int damage = 0; cptr act = NULL; /* Extract the attack infomation */ int effect = r_ptr->blow[ap_cnt].effect; int method = r_ptr->blow[ap_cnt].method; int d_dice = r_ptr->blow[ap_cnt].d_dice; int d_side = r_ptr->blow[ap_cnt].d_side; /* Hack -- no more attacks */ if (!method) break; /* Handle "leaving" */ if (p_ptr->leaving) break; /* Extract visibility (before blink) */ if (m_ptr->ml) visible = TRUE; /* Skip 'tricky' attacks */ if (method > RBM_MAX_NORMAL) continue; /* Assume no cut or stun or touched */ do_cut = do_stun = touched = 0; /* Extract the attack "power". Elemental attacks upgraded. */ switch (effect) { case GF_HURT: power = 60; break; case GF_WOUND: power = 60; break; case GF_BATTER: power = 60; break; case GF_SHATTER: power = 60; break; case GF_UN_BONUS: power = 20; break; case GF_UN_POWER: power = 15; break; case GF_LOSE_MANA: power = 45; break; case GF_EAT_GOLD: power = 5; break; case GF_EAT_ITEM: power = 5; break; case GF_EAT_FOOD: power = 45; break; case GF_EAT_LITE: power = 45; break; case GF_HUNGER: power = 45; break; case GF_POIS: power = 25; break; case GF_ACID: power = 50; break; case GF_ELEC: power = 50; break; case GF_FIRE: power = 50; break; case GF_COLD: power = 50; break; case GF_BLIND: power = 5; break; case GF_CONFUSION: power = 10; break; case GF_TERRIFY: power = 10; break; case GF_PARALYZE: power = 5; break; case GF_HALLU: power = 10; break; case GF_DISEASE: power = 10; break; case GF_LOSE_STR: power = 0; break; case GF_LOSE_DEX: power = 0; break; case GF_LOSE_CON: power = 0; break; case GF_LOSE_INT: power = 0; break; case GF_LOSE_WIS: power = 0; break; case GF_LOSE_CHR: power = 0; break; case GF_LOSE_ALL: power = 2; break; case GF_EXP_10: power = 5; break; case GF_EXP_20: power = 5; break; case GF_EXP_40: power = 5; break; case GF_EXP_80: power = 5; break; /* Need to add extra flavours in here */ } /* Roll out the damage */ damage = damroll(d_dice, d_side); /* Describe the attack method */ switch (method) { case RBM_HIT: { /* Handle special effect types */ if (effect == GF_WOUND) { if (damage >= 30) act = "gouges you"; else if (damage >= 20) act = "slashes you"; else if (damage >= 5) act = "cuts you"; else act = "scratches you"; /* Usually don't stun */ if (!rand_int(5)) do_stun = 1; do_cut = touched = 1; } else if (effect == GF_BATTER) { if (damage >= 30) act = "bludgeons you"; else if (damage >= 20) act = "batters you"; else if (damage >= 5) act = "bashes you"; else act = "hits you"; /* Usually don't cut */ if (!rand_int(5)) do_cut = 1; do_stun = touched = 1; } else { act = "hits you"; do_cut = do_stun = touched = 1; } break; } case RBM_TOUCH: { act = "touches you"; touched = 1; break; } case RBM_PUNCH: { act = "punches you"; do_stun = touched = 1; break; } case RBM_KICK: { act = "kicks you"; do_stun = touched = 1; break; } case RBM_CLAW: { if (damage >= 25) act = "slashes you"; else if (damage >= 5) act = "claws you"; else act = "scratches you"; do_cut = touched = 1; break; } case RBM_BITE: { if (damage >= 5) act = "bites you"; else act = "nips you"; do_cut = touched = 1; break; } case RBM_PECK: { act = "pecks you"; do_stun = touched = 1; break; } case RBM_STING: { act = "stings you"; touched = 1; break; } case RBM_VOMIT: { act = "vomits on you"; touched = 1; break; } case RBM_BUTT: { if (damage >= rand_range(10, 20)) act = "tramples you"; else act = "butts you"; do_stun = touched = 1; break; } case RBM_CRUSH: { if (damage >= 10) act = "crushes you"; else act = "squeezes you"; do_stun = touched = 1; break; } case RBM_ENGULF: { if (damage >= randint(50)) act = "envelops you"; else act = "engulfs you"; touched = 1; break; } case RBM_CRAWL: { act = "crawls on you"; touched = 1; break; } case RBM_DROOL: { act = "drools on you"; break; } case RBM_SLIME: { act = "slimes you!"; break; } case RBM_SPIT: { act = "spits on you"; break; } case RBM_GAZE: { if (damage >= rand_range(20, 30)) act = "glares at you terribly"; else if (damage >= rand_range(5, 30)) act = "gazes upon you"; else act = "gazes at you"; break; } case RBM_WAIL: { act = "wails horribly"; break; } case RBM_SPORE: { act = "releases a cloud of spores"; break; } case RBM_LASH: { act = "lashes you with a whip"; touched = 1; break; } case RBM_BEG: { act = "begs you for money"; break; } case RBM_INSULT: { act = desc_insult[rand_int(8)]; break; } case RBM_MOAN: { act = desc_moan[rand_int(4)]; break; } } /* Monster hits player */ if (!effect || check_hit(power, rlev, m_idx)) { /* Always disturbing */ disturb(1, 0); /* Hack -- Apply "protection from evil" */ if ((p_ptr->protevil > 0) && (r_ptr->flags3 & (RF3_EVIL)) && (p_ptr->lev >= rlev) && ((rand_int(100) + p_ptr->lev) > 50)) { /* Remember the Evil-ness */ if (m_ptr->ml) { l_ptr->flags3 |= (RF3_EVIL); } /* Message */ msg_format("%^s is repelled.", m_name); /* Hack -- Next attack */ continue; } /* Message */ if (act) { if (damage > p_ptr->chp / 3) msg_format("%^s %s!", m_name, act); else msg_format("%^s %s.", m_name, act); } /* Check for usage */ if (rand_int(100)<damage) { int slot; /* Pick a (possibly empty) inventory slot */ switch (randint(6)) { case 1: slot = INVEN_BODY; break; case 2: slot = INVEN_ARM; break; case 3: slot = INVEN_OUTER; break; case 4: slot = INVEN_HANDS; break; case 5: slot = INVEN_HEAD; break; case 6: slot = INVEN_FEET; break; } /* Object used? */ object_usage(INVEN_WIELD); } if (effect) { /* New result routine */ obvious = project_p(m_idx,0,p_ptr->py,p_ptr->px,damage,effect); } else { obvious = TRUE; } /* Hack -- only one of cut or stun */ if (do_cut && do_stun) { /* Cancel cut */ if (rand_int(100) < 50) { do_cut = 0; } /* Cancel stun */ else { do_stun = 0; } } /* Handle cut */ if (do_cut) { int k; /* Critical hit (zero if non-critical) */ tmp = monster_critical(d_dice, d_side, damage, effect); /* Roll for damage */ switch (tmp) { case 0: k = 0; break; case 1: k = randint(5); break; case 2: k = randint(5) + 5; break; case 3: k = randint(20) + 20; break; case 4: k = randint(50) + 50; break; case 5: k = randint(100) + 100; break; case 6: k = 300; break; default: k = 500; break; } /* Apply the cut */ if (k) (void)set_cut(p_ptr->cut + k); } /* Handle stun */ if (do_stun) { int k; /* Critical hit (zero if non-critical) */ tmp = monster_critical(d_dice, d_side, damage, effect); /* Roll for damage */ switch (tmp) { case 0: k = 0; break; case 1: k = randint(5); break; case 2: k = randint(8) + 8; break; case 3: k = randint(15) + 15; break; case 4: k = randint(25) + 25; break; case 5: k = randint(35) + 35; break; case 6: k = randint(45) + 45; break; default: k = 100; break; } /* Apply the stun */ if (k) (void)set_stun(p_ptr->stun + k); } } /* Monster missed player */ else if (touched) { /* Visible monsters */ if (m_ptr->ml) { /* Disturbing */ disturb(1, 0); /* Message */ msg_format("%^s misses you.", m_name); } } /* Analyze "visible" monsters only */ if (visible) { /* Count "obvious" attacks (and ones that cause damage) */ if (obvious || damage || (l_ptr->blows[ap_cnt] > 10)) { /* Count attacks of this type */ if (l_ptr->blows[ap_cnt] < MAX_UCHAR) { l_ptr->blows[ap_cnt]++; } } } } /* Blink away */ if (blinked) { msg_print("There is a puff of smoke!"); teleport_away(m_idx, MAX_SIGHT * 2 + 5); } /* Always notice cause of death */ if (p_ptr->is_dead && (l_ptr->deaths < MAX_SHORT)) { l_ptr->deaths++; } /* Assume we attacked */ return (TRUE); }
/* * Chests have traps too. High-level chests can be very dangerous, no * matter what level they are opened at. Various traps added in Oangband. -LM- * * Exploding chest destroys contents (and traps). * Note that the chest itself is never destroyed. */ static void chest_trap(int y, int x, s16b o_idx) { int i, trap, nasty_tricks_count; int j; object_type *o_ptr = &o_list[o_idx]; /* Compensate for the averaging routine in the summon monster function. */ int summon_level = o_ptr->pval + o_ptr->pval - p_ptr->depth; /* Ignore disarmed chests */ if (o_ptr->pval <= 0) return; /* Obtain the traps */ trap = chest_traps[o_ptr->pval]; /* Lose strength */ if (trap & (CHEST_LOSE_STR)) { msg_print("A small needle has pricked you!"); take_hit(damroll(1, 4), "a poison needle"); (void)do_dec_stat(A_STR); } /* Lose constitution */ if (trap & (CHEST_LOSE_CON)) { msg_print("A small needle has pricked you!"); take_hit(damroll(1, 4), "a poison needle"); (void)do_dec_stat(A_CON); } /* Poison */ if (trap & (CHEST_POISON)) { msg_print("A puff of green gas surrounds you!"); pois_hit(25); } /* Paralyze */ if (trap & (CHEST_PARALYZE)) { msg_print("A puff of yellow gas surrounds you!"); if (!p_ptr->free_act) { (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20)); } } /* Summon monsters */ if (trap & (CHEST_SUMMON)) { int num = 2 + randint1(3); msg_print("You are enveloped in a cloud of smoke!"); (void)summon_specific(y, x, FALSE, summon_level, 0, num); } /* Explode */ if (trap & (CHEST_EXPLODE)) { msg_print("There is a sudden explosion!"); msg_print("Everything inside the chest is destroyed!"); o_ptr->pval = 0; take_hit(damroll(5, 8), "an exploding chest"); } /* Scatter contents. */ if (trap & (CHEST_SCATTER)) { msg_print("The contents of the chest scatter all over the dungeon!"); chest_death(TRUE, y, x, o_idx); o_ptr->pval = 0; } /* Elemental summon. */ if (trap & (CHEST_E_SUMMON)) { j = randint1(3) + 5; msg_print("Elemental beings appear to protect their treasures!"); (void) summon_specific(y, x, FALSE, summon_level, SUMMON_ELEMENTAL, j); } /* Force clouds, then summon birds. */ if (trap & (CHEST_BIRD_STORM)) { msg_print("A storm of birds swirls around you!"); j = randint1(3) + 3; for (i = 0; i < j; i++) (void)fire_meteor(0, GF_FORCE, y, x, o_ptr->pval / 5, 7, TRUE); j = randint1(5) + o_ptr->pval /5; (void)summon_specific(y, x, TRUE, summon_level, SUMMON_BIRD, j); } /* Various colorful summonings. */ if (trap & (CHEST_H_SUMMON)) { /* Summon demons. */ if (randint0(4) == 0) { msg_print("Demons materialize in clouds of fire and brimstone!"); j = randint1(3) + 2; for (i = 0; i < j; i++) { (void)fire_meteor(0, GF_FIRE, y, x, 10, 5, TRUE); (void)summon_specific(y, x, FALSE, summon_level, SUMMON_DEMON, 1); } } /* Summon dragons. */ else if (randint0(3) == 0) { msg_print("Draconic forms loom out of the darkness!"); j = randint1(3) + 2; (void)summon_specific(y, x, FALSE, summon_level, SUMMON_DRAGON, j); } /* Summon hybrids. */ else if (randint0(2) == 0) { msg_print("Creatures strange and twisted assault you!"); j = randint1(5) + 3; (void)summon_specific(y, x, FALSE, summon_level, SUMMON_HYBRID, j); } /* Summon vortices (scattered) */ else { msg_print("Vortices coalesce and wreak destruction!"); j = randint1(3) + 2; (void)summon_specific(y, x, TRUE, summon_level, SUMMON_VORTEX, j); } } /* Dispel player. */ if (trap & (CHEST_RUNES_OF_EVIL)) { /* Message. */ msg_print("Hideous voices bid: 'Let the darkness have thee!'"); /* Determine how many nasty tricks can be played. */ nasty_tricks_count = 4 + randint0(3); /* This is gonna hurt... */ for (; nasty_tricks_count > 0; nasty_tricks_count--) { /* ...but a high saving throw does help a little. */ if (!check_save(2 * o_ptr->pval)) { if (randint0(6) == 0) take_hit(damroll(5, 20), "a chest dispel-player trap"); else if (randint0(5) == 0) (void)set_cut(p_ptr->cut + 200); else if (randint0(4) == 0) { if (!p_ptr->free_act) (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(6)); else (void)set_stun(p_ptr->stun + 10 + randint0(100)); } else if (randint0(3) == 0) apply_disenchant(0); else if (randint0(2) == 0) { (void)do_dec_stat(A_STR); (void)do_dec_stat(A_DEX); (void)do_dec_stat(A_CON); (void)do_dec_stat(A_INT); (void)do_dec_stat(A_WIS); (void)do_dec_stat(A_CHR); } else (void)fire_meteor(0, GF_NETHER, y, x, 150, 1, TRUE); } } } }
/* * do_cmd_mind calls this function if the player's class * is 'Medium'. */ static bool cast_medium_spell(int spell) { /* this will vary based on the spells, and what they depend on */ int b = 0; int dir; int plev = p_ptr->lev; /* spell code */ switch (spell) { case 0: /* Mindblast */ if (!get_aim_dir(&dir)) return FALSE; if (randint(100) < plev * 2) (void)fire_bolt_or_beam(100, GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15))); else (void)fire_ball(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)), 0); break; case 1: if (plev > 44) wiz_lite(); else if (plev > 19) map_area(); if (plev < 30) { b = detect_monsters_normal(); if (plev > 14) b |= detect_monsters_invis(); if (plev > 4) { b |= detect_traps(); b |= detect_doors(); } } else { b = detect_all(); } if (plev > 24) { (void)set_tim_esp(p_ptr->tim_esp + plev); } if (!b) msg_print("You feel safe."); break; case 2: /* Minor displace */ teleport_player(plev); break; case 3: /* Major displace */ teleport_player(plev * 5); break; case 4: /* Psychic Disturbance */ msg_print("You disturb specters from beyond the veil!"); (void)project(-1, 2 + plev / 8, p_ptr->py, p_ptr->px, damroll((plev / 2), plev), GF_CONFUSION, PROJECT_KILL); break; case 5: /* spirit blast --- not 'true' TK */ if (!get_aim_dir(&dir)) return FALSE; (void)fire_ball(GF_SOUND, dir, damroll(8 + ((plev - 5) / 4), 8), (plev > 20 ? (plev - 20) / 8 + 1 : 0)); break; case 6: /* Character Armour */ (void)set_shield(p_ptr->shield + plev); if (plev > 14) (void)set_oppose_acid(p_ptr->oppose_acid + plev); if (plev > 19) (void)set_oppose_fire(p_ptr->oppose_fire + plev); if (plev > 24) (void)set_oppose_cold(p_ptr->oppose_cold + plev); if (plev > 29) (void)set_oppose_elec(p_ptr->oppose_elec + plev); if (plev > 34) (void)set_oppose_pois(p_ptr->oppose_pois + plev); break; case 7: ident_spell(); break; case 8: if (!get_aim_dir(&dir)) return FALSE; (void)fire_bolt(GF_DOMINATION, dir, damroll((plev / 2), (3 + plev / 3))); break; case 9: /* Soul Purge */ msg_print("The anguish of the dead emanates from your brain!"); (void)project(-1, 2 + plev / 10, p_ptr->py, p_ptr->px, damroll(plev, 4), GF_PSI, PROJECT_KILL); break; case 10: /* Adrenaline */ (void)set_afraid(0); (void)set_stun(0); /* * Only heal when Adrenalin Channeling is not active. We check * that by checking if the player isn't fast and 'heroed' atm. */ if (!p_ptr->fast || !(p_ptr->hero || p_ptr->shero)) { (void)hp_player(plev); } b = 10 + randint((plev * 3) / 2); if (plev < 35) (void)set_hero(p_ptr->hero + b); else (void)set_shero(p_ptr->shero + b); if (!p_ptr->fast) { /* Haste */ (void)set_fast(b); } else { (void)set_fast(p_ptr->fast + b); } break; case 11: /* Psychic Drain Turned into MEGA-STUN*/ if (!get_aim_dir(&dir)) return FALSE; b = damroll(plev * 2, 3); /* This is always a radius-0 ball now */ if (fire_ball(GF_STUN, dir, b, 0)) p_ptr->energy -= randint(150); break; case 12: /* Entropic Blast */ msg_print ("A wave of pure entropic force blasts out from your spirit!"); (void)project(-1, 3 + plev / 10, p_ptr->py, p_ptr->px, plev * (plev > 39 ? 4 : 3), GF_FORCE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID); break; default: msg_print("Unknown Mindcrafter power!"); } return TRUE; }
static void _shatter_device_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Shatter Device"); break; case SPELL_DESC: var_set_string(res, "Destroy a magical device in your inventory for various effects."); break; case SPELL_CAST: { int item; object_type *o_ptr; var_set_bool(res, FALSE); item_tester_hook = object_is_device; if (!get_item(&item, "Shatter which device?", "You have nothing to shatter.", USE_INVEN)) return; o_ptr = &inventory[item]; var_set_bool(res, TRUE); if (o_ptr->activation.type == EFFECT_NONE) { msg_print("Nothing happens."); } else if (o_ptr->activation.type == EFFECT_DESTRUCTION) { if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), 4 * p_ptr->lev)) msg_print("The dungeon collapses..."); else msg_print("The dungeon trembles."); } else if ( o_ptr->activation.type == EFFECT_HEAL_CURING || o_ptr->activation.type == EFFECT_HEAL_CURING_HERO || o_ptr->activation.type == EFFECT_RESTORING ) { msg_print("You feel life flow through your body!"); restore_level(); (void)set_poisoned(0, TRUE); (void)set_blind(0, TRUE); (void)set_confused(0, TRUE); (void)set_image(0, TRUE); (void)set_stun(0, TRUE); (void)set_cut(0, TRUE); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); update_stuff(); /* hp may change if Con was drained ... */ hp_player(5000); } else if ( o_ptr->activation.type == EFFECT_TELEPORT_AWAY || o_ptr->activation.type == EFFECT_BANISH_EVIL || o_ptr->activation.type == EFFECT_BANISH_ALL ) { banish_monsters(p_ptr->lev * 4); } else { project(0, 5, py, px, o_ptr->activation.difficulty * 16, _object_dam_type(o_ptr), PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1); } inven_item_increase(item, -1); inven_item_describe(item); inven_item_optimize(item); break; } default: default_spell(cmd, res); break; } }
static bool zap_rod(object_type *o_ptr, bool *ident) { int chance, dir, lev; bool used_charge = TRUE; object_kind *k_ptr = &k_info[o_ptr->k_idx]; /* Get a direction (unless KNOWN not to need it) */ if ((o_ptr->sval >= SV_ROD_MIN_DIRECTION) || !object_aware_p(o_ptr)) { /* Get a direction, allow cancel */ if (!get_aim_dir(&dir)) return FALSE; } /* Take a turn */ p_ptr->energy_use = 100; /* Not identified yet */ *ident = FALSE; /* Extract the item level */ lev = k_info[o_ptr->k_idx].level; /* Base chance of success */ chance = p_ptr->skill_dev; /* Confusion hurts skill */ if (p_ptr->confused) chance = chance / 2; /* High level objects are harder */ chance = chance - ((lev > 50) ? 50 : lev); /* Give everyone a (slight) chance */ if ((chance < USE_DEVICE) && (rand_int(USE_DEVICE - chance + 1) == 0)) { chance = USE_DEVICE; } /* Roll for usage */ if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE)) { if (flush_failure) flush(); msg_print("Вы не смогли использовать жезл."); return FALSE; } /* Still charging? */ if (o_ptr->timeout > (o_ptr->pval - k_ptr->pval)) { if (flush_failure) flush(); if (o_ptr->number == 1) msg_print("Жезл все еще заряжается."); else msg_print("Все жезлы все еще заряжаются."); return FALSE; } /* Sound */ sound(MSG_ZAP); /* Analyze the rod */ switch (o_ptr->sval) { case SV_ROD_DETECT_TRAP: { if (detect_traps()) *ident = TRUE; break; } case SV_ROD_DETECT_DOOR: { if (detect_doors()) *ident = TRUE; if (detect_stairs()) *ident = TRUE; break; } case SV_ROD_IDENTIFY: { *ident = TRUE; if (ident_spell()) used_charge = FALSE; break; } case SV_ROD_RECALL: { set_recall(); *ident = TRUE; break; } case SV_ROD_ILLUMINATION: { if (lite_area(damroll(2, 8), 2)) *ident = TRUE; break; } case SV_ROD_MAPPING: { map_area(); *ident = TRUE; break; } case SV_ROD_DETECTION: { detect_all(); *ident = TRUE; break; } case SV_ROD_PROBING: { probing(); *ident = TRUE; break; } case SV_ROD_CURING: { if (set_blind(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_ROD_HEALING: { if (hp_player(500)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_ROD_RESTORATION: { if (restore_level()) *ident = TRUE; if (do_res_stat(A_STR)) *ident = TRUE; if (do_res_stat(A_INT)) *ident = TRUE; if (do_res_stat(A_WIS)) *ident = TRUE; if (do_res_stat(A_DEX)) *ident = TRUE; if (do_res_stat(A_CON)) *ident = TRUE; if (do_res_stat(A_CHR)) *ident = TRUE; break; } case SV_ROD_SPEED: { if (!p_ptr->fast) { if (set_fast(randint(30) + 15)) *ident = TRUE; } else { (void)set_fast(p_ptr->fast + 5); } break; } case SV_ROD_TELEPORT_AWAY: { if (teleport_monster(dir)) *ident = TRUE; break; } case SV_ROD_DISARMING: { if (disarm_trap(dir)) *ident = TRUE; break; } case SV_ROD_LITE: { msg_print("Появляется коридор синего мерцающего света."); lite_line(dir); *ident = TRUE; break; } case SV_ROD_SLEEP_MONSTER: { if (sleep_monster(dir)) *ident = TRUE; break; } case SV_ROD_SLOW_MONSTER: { if (slow_monster(dir)) *ident = TRUE; break; } case SV_ROD_DRAIN_LIFE: { if (drain_life(dir, 150)) *ident = TRUE; break; } case SV_ROD_POLYMORPH: { if (poly_monster(dir)) *ident = TRUE; break; } case SV_ROD_ACID_BOLT: { fire_bolt_or_beam(10, GF_ACID, dir, damroll(12, 8)); *ident = TRUE; break; } case SV_ROD_ELEC_BOLT: { fire_bolt_or_beam(10, GF_ELEC, dir, damroll(6, 6)); *ident = TRUE; break; } case SV_ROD_FIRE_BOLT: { fire_bolt_or_beam(10, GF_FIRE, dir, damroll(16, 8)); *ident = TRUE; break; } case SV_ROD_COLD_BOLT: { fire_bolt_or_beam(10, GF_COLD, dir, damroll(10, 8)); *ident = TRUE; break; } case SV_ROD_ACID_BALL: { fire_ball(GF_ACID, dir, 120, 2); *ident = TRUE; break; } case SV_ROD_ELEC_BALL: { fire_ball(GF_ELEC, dir, 64, 2); *ident = TRUE; break; } case SV_ROD_FIRE_BALL: { fire_ball(GF_FIRE, dir, 144, 2); *ident = TRUE; break; } case SV_ROD_COLD_BALL: { fire_ball(GF_COLD, dir, 96, 2); *ident = TRUE; break; } } /* Drain the charge */ if (used_charge) o_ptr->timeout += k_ptr->pval; return TRUE; }