void b__chime_and_horn_effects(integer effect, boolean *idented) { /*{ Chimes... }*/ boolean ident; integer y,x; integer i3; ident = *idented; switch (effect) { case 1 : /*{ Chime of Light }*/ ident = light_area(char_row,char_col); break; case 2 : /*{ Chime of Detect Doors/Stairs }*/ ident = detect_sdoor(); break; case 3 : /*{ Chime of Detect Traps }*/ ident = detect_trap(); break; case 4 : /*{ Chime of Teleportation }*/ teleport(100); ident = true; break; case 5 : /*{ Chime of Thunderblasts }*/ ident = earthquake(); break; case 6 : /*{ Chime of Summon Monster }*/ for (i3 = 1; i3 <= randint(4); i3++) { y = char_row; x = char_col; if (is_in(cave[y][x].fval, water_set)) { summon_water_monster(&y,&x,false); } else { summon_land_monster(&y,&x,false); } } ident = true; break; case 7 : /*{ Chime of Disarming }*/ ident = true; for (i3 = 1; i3 <= 9; i3++) { if (i3 != 5) { disarm_all(i3,char_row,char_col); } } break; case 8 : /*{ Chime of Aggravation }*/ ident = aggravate_monster(20); break; case 9 : /*{ Chime of Slow Monster }*/ ident = zap_area(0,-1,c_speed); break; case 10 : /*{ Chime of Sooth Monster }*/ ident = zap_area(0,0,c_sleep); break; case 11 : /*{ Chime of Cure Light Wounds }*/ ident = hp_player(randint(8),"a chime."); break; case 12 : /*{ Chime of Changing }*/ ident = mass_poly(); break; case 13 : /*{ Chime of Remove Curse }*/ if (remove_curse()) { msg_print("Your equipment glows blue for a moment..."); ident = true; } break; case 14 : /*{ Chime of Curing }*/ //with py.flags do; ident = cure_me(&PF.blind); ident |= cure_me(&PF.poisoned); ident |= cure_me(&PF.confused); break; case 15 : /*{ Chime of Dispell Evil }*/ ident = zap_area(0x0004,60,c_hp); break; case 16 : /*{ Chime of Darkness }*/ ident = unlight_area(char_row,char_col); break; /*{ Horns... }*/ case 17 : /*{ Horn of Bubbles }*/ msg_print("Bubbles stream forth and surround you!"); py.flags.blind += (randint(20) +5); ident = unlight_area(char_row,char_col); break; case 18 : /*{ Horn of Calling }*/ for (i3 = 1; i3 <= randint(4); i3++) { y = char_row; x = char_col; if (is_in(cave[y][x].fval, water_set)) { summon_water_monster(&y,&x,false); } else { summon_land_monster(&y,&x,false); } } ident = true; break; case 19 : /*{ Horn of Soft Sounds }*/ ident = sleep_monsters1(char_row,char_col); break; case 20 : /*{ Horn of *Blasting* }*/ ident = destroy_area(char_row,char_col); break; case 21 : /*{ Horn of Cold }*/ msg_print("A wave of cold pours forth..."); ident = zap_area(0x0010,60,c_hp); break; case 22 : /*{ Horn of Heat }*/ msg_print("A blast of warm air pours forth..."); ident = zap_area(0x0020,60,c_hp); break; case 23 : /*{ Horn of Gas }*/ msg_print("Gas streams out ...!"); ident = zap_area(0x0040,60,c_hp); py.flags.poisoned += randint(10); break; case 24 : /*{ Horn of Recall }*/ py.flags.word_recall = (randint(20) + 20); ident = true; break; case 25 : /*{ Horn of *Chaos* }*/ ident = earthquake(); ident = unlight_area(char_row,char_col); for (i3 = 1; i3 <= randint(4); i3++) { y = char_row; x = char_col; if (is_in(cave[y][x].fval, water_set)) { summon_water_monster(&y,&x,false); } else { summon_land_monster(&y,&x,false); } } break; case 26 : /*{ Horn of Glue }*/ msg_print("glue pours out of the horn!"); msg_print("all of your equipment is stuck!"); for (i3 = Equipment_primary; i3 <= Equipment_cloak; i3++) { //with equipment[i3] do; equipment[i3].flags |= 0x80000000; } //with equipment[Equipment_secondary]. do; equipment[Equipment_secondary].flags |= 0x80000000; ident = true; break; case 27 : /*{ Horn of Valhalla }*/ msg_print("The Voice of Odin (oh brother...) smites evil!"); ident = zap_area(0x0004,70,c_hp); light_area(char_row,char_col); hp_player(randint(20)+20,"a horn."); break; case 28 : /*{ Horn of Tritons }*/ //with py.flags do; ident = true; msg_print("All of the seas of the world still (yeah, right)!"); msg_print("The gods of the ocean hear you..." ); PF.blessed += randint(20); cure_me(&PF.blind); cure_me(&PF.poisoned); break; case 29 : /*{ Horn of Fog }*/ msg_print("Thick fog billows out..."); ident = unlight_area(char_row,char_col); msg_print("The nearby creatures are confused"); ident = zap_area(0,0,c_confuse); break; default: break; } *idented = ident; };
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); }
static bool cast_mage_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; /* Hack -- chance of "beam" instead of "bolt" */ int beam = beam_chance(Ind); /* MAngband-specific: Projected */ if (spell >= SPELL_PROJECTED) { if (!get_aim_dir(Ind, &dir)) return (FALSE); (void)project_spell_ball(Ind, dir, spell - SPELL_PROJECTED); return (TRUE); } /* Spells. */ switch (spell) { case SPELL_MAGIC_MISSILE: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s fires a magic missile."); fire_bolt_or_beam(Ind, beam-10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4)); break; } case SPELL_DETECT_MONSTERS: { (void)detect_creatures(Ind, TRUE); break; } case SPELL_PHASE_DOOR: { msg_spell("%s blinks away!"); teleport_player(Ind, 10); break; } case SPELL_LIGHT_AREA: { (void)lite_area(Ind, damroll(2, (plev / 2)), (plev / 10) + 1); break; } case SPELL_TREASURE_DETECTION: { (void)detect_treasure(Ind); //(void)detect_objects_gold(Ind); break; } case SPELL_CURE_LIGHT_WOUNDS: { (void)hp_player(Ind, damroll(2, 8)); (void)set_cut(Ind, p_ptr->cut - 15); break; } case SPELL_OBJECT_DETECTION: { (void)detect_objects_normal(Ind); break; } case SPELL_FIND_TRAPS_DOORS: { (void)detect_trap(Ind);//detect_traps(Ind); (void)detect_sdoor(Ind);//detect_doors(Ind); //(void)detect_stairs(Ind); break; } case SPELL_STINKING_CLOUD: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a stinking cloud."); fire_ball(Ind, GF_POIS, dir, 10 + (plev / 2), 2); break; } case SPELL_CONFUSE_MONSTER: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s makes a complicated gesture."); (void)confuse_monster(Ind, dir, plev); break; } case SPELL_LIGHTNING_BOLT: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a lightning bolt."); fire_beam(Ind, GF_ELEC, dir, damroll(3+((plev-5)/6), 6)); break; } case SPELL_TRAP_DOOR_DESTRUCTION: { (void)destroy_doors_touch(Ind); break; } case SPELL_SLEEP_MONSTER: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s gestures and mumbles calmly."); (void)sleep_monster(Ind, dir); break; } case SPELL_CURE_POISON: { (void)set_poisoned(Ind, 0); break; } case SPELL_TELEPORT_SELF: { msg_spell("%s teleports away!"); teleport_player(Ind, plev * 5); break; } case SPELL_SPEAR_OF_LIGHT: /* spear of light */ { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_print(Ind, "A line of blue shimmering light appears."); msg_spell("A line of blue shimmering light appears out of %s's hands."); lite_line(Ind, dir); break; } case SPELL_FROST_BOLT: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a frost bolt."); fire_bolt_or_beam(Ind, beam-10, GF_COLD, dir, damroll(5+((plev-5)/4), 8)); break; } case SPELL_TURN_STONE_TO_MUD: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s makes a moving gesture."); (void)wall_to_mud(Ind, dir); break; } case SPELL_SATISFY_HUNGER: { (void)set_food(Ind, PY_FOOD_MAX - 1); break; } case SPELL_RECHARGE_ITEM_I: { return recharge(Ind, 2 + plev / 5); } case SPELL_WONDER: /* wonder */ { if (!get_aim_dir(Ind, &dir)) return (FALSE); (void)spell_wonder(Ind, dir); break; } case SPELL_POLYMORPH_OTHER: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s discharges an everchanging blast of energy."); (void)poly_monster(Ind, dir); break; } case SPELL_IDENTIFY: { return ident_spell(Ind); } case SPELL_MASS_SLEEP: { (void)sleep_monsters(Ind); break; } case SPELL_FIRE_BOLT: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a fire bolt."); fire_bolt_or_beam(Ind, beam, GF_FIRE, dir, damroll(6+((plev-5)/4), 8)); break; } case SPELL_SLOW_MONSTER: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s makes a lengthy gesture."); (void)slow_monster(Ind, dir); break; } case SPELL_FROST_BALL: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a frost ball."); fire_ball(Ind, GF_COLD, dir, 30 + (plev), 2); break; } case SPELL_RECHARGE_ITEM_II: /* greater recharging */ { return recharge(Ind, 50 + plev); } case SPELL_TELEPORT_OTHER: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s makes a rush gesture."); (void)teleport_monster(Ind, dir); break; } case SPELL_BEDLAM: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s creates confusion."); fire_ball(Ind, GF_OLD_CONF, dir, plev, 4); break; } case SPELL_FIRE_BALL: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a fire ball."); fire_ball(Ind, GF_FIRE, dir, 55 + (plev), 2); break; } case SPELL_WORD_OF_DESTRUCTION: { msg_spell("%s unleashes great power!"); destroy_area(Depth, py, px, 15, TRUE); break; } case SPELL_BANISHMENT: { return banishment(Ind); break; } case SPELL_DOOR_CREATION: { (void)door_creation(Ind); break; } case SPELL_STAIR_CREATION: { (void)stair_creation(Ind); break; } case SPELL_TELEPORT_LEVEL: { (void)teleport_player_level(Ind); break; } case SPELL_EARTHQUAKE: { msg_spell("%s casts a spell, and the ground shakes!"); earthquake(Depth, py, px, 10); break; } case SPELL_WORD_OF_RECALL: { o_ptr = &p_ptr->inventory[get_spell_book(Ind, spell)]; set_recall(Ind, o_ptr); break; } case SPELL_ACID_BOLT: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts an acid bolt."); fire_bolt_or_beam(Ind, beam, GF_ACID, dir, damroll(8+((plev-5)/4), 8)); break; } case SPELL_CLOUD_KILL: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a cloud of death."); fire_ball(Ind, GF_POIS, dir, 40 + (plev / 2), 3); break; } case SPELL_ACID_BALL: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts an acid ball."); fire_ball(Ind, GF_ACID, dir, 40 + (plev), 2); break; } case SPELL_ICE_STORM: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s invokes an ice storm."); fire_ball(Ind, GF_ICE, dir, 50 + (plev * 2), 3); break; } case SPELL_METEOR_SWARM: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a meteor shower."); fire_swarm(Ind, 2 + plev / 20, GF_METEOR, dir, 30 + plev / 2, 1); break; } case SPELL_MANA_STORM: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a mana ball."); fire_ball(Ind, GF_MANA, dir, 300 + (plev * 2), 3); break; } case SPELL_DETECT_INVISIBLE: { (void)detect_invisible(Ind, TRUE); break; } case SPELL_DETECT_ENCHANTMENT: { (void)detect_objects_magic(Ind); break; } case SPELL_SHOCK_WAVE: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a shock wave."); fire_ball(Ind, GF_SOUND, dir, 10 + plev, 2); break; } case SPELL_EXPLOSION: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts an explosion."); fire_ball(Ind, GF_SHARDS, dir, 20 + (plev * 2), 2); break; } case SPELL_MASS_BANISHMENT: { (void)mass_banishment(Ind); break; } case SPELL_RESIST_FIRE: { (void)set_oppose_fire(Ind, p_ptr->oppose_fire + randint(20) + 20); break; } case SPELL_RESIST_COLD: { (void)set_oppose_cold(Ind, p_ptr->oppose_cold + randint(20) + 20); break; } case SPELL_ELEMENTAL_BRAND: /* elemental brand */ { if (!get_item(Ind, &dir, item_test(AMMO))) return (FALSE); (void)brand_ammo(Ind, dir); break; } case SPELL_RESIST_POISON: { (void)set_oppose_pois(Ind, p_ptr->oppose_pois + randint(20) + 20); break; } case SPELL_RESISTANCE: { int time = randint(20) + 20; (void)set_oppose_acid(Ind, p_ptr->oppose_acid + time); (void)set_oppose_elec(Ind, p_ptr->oppose_elec + time); (void)set_oppose_fire(Ind, p_ptr->oppose_fire + time); (void)set_oppose_cold(Ind, p_ptr->oppose_cold + time); (void)set_oppose_pois(Ind, p_ptr->oppose_pois + time); break; } case SPELL_HEROISM: { (void)hp_player(Ind, 10); (void)set_hero(Ind, p_ptr->hero + randint(25) + 25); (void)set_afraid(Ind, 0); break; } case SPELL_SHIELD: { msg_spell("%s forms a mystic shield."); (void)set_shield(Ind, p_ptr->shield + randint(20) + 30); break; } case SPELL_BERSERKER: { msg_spell("%s enters a battle rage!"); (void)hp_player(Ind, 30); (void)set_shero(Ind, p_ptr->shero + randint(25) + 25); (void)set_afraid(Ind, 0); break; } case SPELL_HASTE_SELF: { msg_spell("%s starts moving faster."); if (!p_ptr->fast) { (void)set_fast(Ind, randint(20) + plev); } else { (void)set_fast(Ind, p_ptr->fast + randint(5)); } break; } case SPELL_RIFT: { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("Space warps in a beam from %s."); fire_beam(Ind, GF_GRAVITY, dir, 40 + damroll(plev, 7)); break; } case SPELL_REND_SOUL: /* rend soul */ { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a nether ball."); fire_bolt_or_beam(Ind, beam / 4, GF_NETHER, dir, damroll(11, plev)); break; } case SPELL_CHAOS_STRIKE: /* chaos strike */ { if (!get_aim_dir(Ind, &dir)) return (FALSE); msg_spell("%s casts a ball of chaos."); fire_bolt_or_beam(Ind, beam, GF_CHAOS, dir, damroll(13, plev)); break; } case SPELL_RUNE_OF_PROTECTION: /* rune of protection */ { if (warding_glyph(Ind)) { msg_spell("%s lays down a rune of protection."); } break; } case SPELL_ENCHANT_ARMOR: /* enchant armor */ { return enchant_spell(Ind, 0, 0, rand_int(3) + plev / 20); } case SPELL_ENCHANT_WEAPON: /* enchant weapon */ { return enchant_spell(Ind, rand_int(4) + plev / 20, rand_int(4) + plev / 20, 0); } } /* Success */ return (TRUE); }
/* Use a staff. -RAK- */ void use() { int32u i; int j, k, item_val, chance, y, x; register int ident; register struct misc *m_ptr; register inven_type *i_ptr; free_turn_flag = TRUE; if (inven_ctr == 0) msg_print("But you are not carrying anything."); else if (!find_range(TV_STAFF, TV_NEVER, &j, &k)) msg_print("You are not carrying any staffs."); else if (get_item(&item_val, "Use which staff?", j, k, 0)) { i_ptr = &inventory[item_val]; free_turn_flag = FALSE; m_ptr = &py.misc; chance = m_ptr->save + stat_adj(A_INT) - (int)i_ptr->level - 5 + (class_level_adj[m_ptr->pclass][CLA_DEVICE] * m_ptr->lev / 3); if (py.flags.confused > 0) chance = chance / 2; if (chance <= 0) chance = 1; if (randint(chance) < USE_DEVICE) msg_print("You failed to use the staff properly."); else if (i_ptr->p1 > 0) { i = i_ptr->flags; ident = FALSE; (i_ptr->p1)--; switch(i) { case ST_HEALING: ident = hp_player(300); if (py.flags.stun>0) { if (py.flags.stun>50) { py.misc.ptohit+=20; py.misc.ptodam+=20; } else { py.misc.ptohit+=5; py.misc.ptodam+=5; } py.flags.stun=0; ident = TRUE; msg_print("You're head stops stinging."); } if (py.flags.cut>0) { py.flags.cut=0; ident = TRUE; msg_print("You feel better."); } break; case ST_GENOCIDE: genocide(FALSE); ident = TRUE; break; case ST_PROBE: probing(); ident = TRUE; break; case ST_IDENTIFY: ident_spell(); ident = TRUE; break; case ST_HOLYNESS: dispel_creature(EVIL,120); protect_evil(); cure_poison(); remove_fear(); hp_player(50); if (py.flags.stun>0) { if (py.flags.stun>50) { py.misc.ptohit+=20; py.misc.ptodam+=20; } else { py.misc.ptohit+=5; py.misc.ptodam+=5; } py.flags.stun=0; ident = TRUE; msg_print("You're head stops stinging."); } if (py.flags.cut>0) { py.flags.cut=0; ident = TRUE; msg_print("You feel better."); } ident = TRUE; break; case ST_MAGI: if (res_stat(A_INT)) { msg_print("You have a warm feeling."); ident = TRUE; } m_ptr = &py.misc; if (m_ptr->cmana < m_ptr->mana) { m_ptr->cmana = m_ptr->mana; ident = TRUE; msg_print("Your feel your head clear."); prt_cmana(); } break; case ST_POWER: dispel_creature(0xFFFFFFFFL,120); break; case ST_SURROUND: map_area(); ident = TRUE; break; case ST_LIGHT: ident = light_area(char_row, char_col); break; case ST_DR_LC: ident = detect_sdoor(); break; case ST_TRP_LC: ident = detect_trap(); break; case ST_TRE_LC: ident = detect_treasure(); break; case ST_OBJ_LC: ident = detect_object(); break; case ST_TELE: teleport(100); ident = TRUE; break; case ST_EARTH: ident = TRUE; earthquake(); break; case ST_SUMMON: ident = FALSE; for (k = 0; k < randint(4); k++) { y = char_row; x = char_col; ident |= summon_monster(&y, &x, FALSE); } break; case ST_DEST: ident = TRUE; destroy_area(char_row, char_col); break; case ST_STAR: ident = TRUE; starlite(char_row, char_col); break; case ST_HAST_MN: ident = speed_monsters(1); break; case ST_SLOW_MN: ident = speed_monsters(-1); break; case ST_SLEE_MN: ident = sleep_monsters2(); break; case ST_CURE_LT: ident = hp_player(randint(8)); break; case ST_DET_INV: ident = detect_invisible(); break; case ST_SPEED: if (py.flags.fast == 0) ident = TRUE; if (py.flags.fast <= 0) py.flags.fast += randint(30) + 15; else py.flags.fast += randint(5); break; case ST_SLOW: if (py.flags.slow == 0) ident = TRUE; py.flags.slow += randint(30) + 15; break; case ST_REMOVE: if (remove_curse()) { if (py.flags.blind < 1) msg_print("The staff glows blue for a moment.."); ident = TRUE; } break; case ST_DET_EVI: ident = detect_evil(); break; case ST_CURING: if ((cure_blindness()) || (cure_poison()) || (cure_confusion()) || (py.flags.stun>0) || (py.flags.cut>0)) ident = TRUE; if (py.flags.stun>0) { if (py.flags.stun>50) { py.misc.ptohit+=20; py.misc.ptodam+=20; } else { py.misc.ptohit+=5; py.misc.ptodam+=5; } py.flags.stun=0; msg_print("You're head stops stinging."); } else if (py.flags.cut>0) { py.flags.cut=0; msg_print("You feel better."); } break; case ST_DSP_EVI: ident = dispel_creature(EVIL, 60); break; case ST_DARK: ident = unlight_area(char_row, char_col); break; default: msg_print("Internal error in staffs()"); break; } if (ident) { if (!known1_p(i_ptr)) { m_ptr = &py.misc; /* round half-way case up */ m_ptr->exp += (i_ptr->level + (m_ptr->lev >> 1)) / m_ptr->lev; prt_experience(); identify(&item_val); i_ptr = &inventory[item_val]; } }
/* Scrolls for the reading -RAK- */ void read_scroll() { int32u i; int j, k, item_val, y, x; int tmp[6], flag, used_up; bigvtype out_val, tmp_str; register int ident, l; register inven_type *i_ptr; register struct misc *m_ptr; free_turn_flag = TRUE; if (py.flags.blind > 0) msg_print("You can't see to read the scroll."); else if (no_light()) msg_print("You have no light to read by."); else if (py.flags.confused > 0) msg_print("You are too confused to read a scroll."); else if (inven_ctr == 0) msg_print("You are not carrying anything!"); else if (!find_range(TV_SCROLL1, TV_SCROLL2, &j, &k)) msg_print ("You are not carrying any scrolls!"); else if (get_item(&item_val, "Read which scroll?", j, k, 0)) { i_ptr = &inventory[item_val]; free_turn_flag = FALSE; used_up = TRUE; i = i_ptr->flags; ident = FALSE; while (i != 0) { j = bit_pos(&i) + 1; if (i_ptr->tval == TV_SCROLL2) j += 32; /* Scrolls. */ switch(j) { case 1: i_ptr = &inventory[INVEN_WIELD]; if (i_ptr->tval != TV_NOTHING) { objdes(tmp_str, i_ptr, FALSE); (void) sprintf(out_val, "Your %s glows faintly!", tmp_str); msg_print(out_val); if (enchant(&i_ptr->tohit)) { i_ptr->flags &= ~TR_CURSED; calc_bonuses(); } else msg_print("The enchantment fails."); ident = TRUE; } break; case 2: i_ptr = &inventory[INVEN_WIELD]; if (i_ptr->tval != TV_NOTHING) { objdes(tmp_str, i_ptr, FALSE); (void) sprintf(out_val, "Your %s glows faintly!", tmp_str); msg_print(out_val); if (enchant(&i_ptr->todam)) { i_ptr->flags &= ~TR_CURSED; calc_bonuses (); } else msg_print("The enchantment fails."); ident = TRUE; } break; case 3: k = 0; l = 0; if (inventory[INVEN_BODY].tval != TV_NOTHING) tmp[k++] = INVEN_BODY; if (inventory[INVEN_ARM].tval != TV_NOTHING) tmp[k++] = INVEN_ARM; if (inventory[INVEN_OUTER].tval != TV_NOTHING) tmp[k++] = INVEN_OUTER; if (inventory[INVEN_HANDS].tval != TV_NOTHING) tmp[k++] = INVEN_HANDS; if (inventory[INVEN_HEAD].tval != TV_NOTHING) tmp[k++] = INVEN_HEAD; /* also enchant boots */ if (inventory[INVEN_FEET].tval != TV_NOTHING) tmp[k++] = INVEN_FEET; if (k > 0) l = tmp[randint(k)-1]; if (TR_CURSED & inventory[INVEN_BODY].flags) l = INVEN_BODY; else if (TR_CURSED & inventory[INVEN_ARM].flags) l = INVEN_ARM; else if (TR_CURSED & inventory[INVEN_OUTER].flags) l = INVEN_OUTER; else if (TR_CURSED & inventory[INVEN_HEAD].flags) l = INVEN_HEAD; else if (TR_CURSED & inventory[INVEN_HANDS].flags) l = INVEN_HANDS; else if (TR_CURSED & inventory[INVEN_FEET].flags) l = INVEN_FEET; if (l > 0) { i_ptr = &inventory[l]; objdes(tmp_str, i_ptr, FALSE); (void) sprintf(out_val, "Your %s glows faintly!", tmp_str); msg_print(out_val); if (enchant(&i_ptr->toac)) { i_ptr->flags &= ~TR_CURSED; calc_bonuses (); } else msg_print("The enchantment fails."); ident = TRUE; } break; case 4: msg_print("This is an identify scroll."); ident = TRUE; used_up = ident_spell(); /* the identify may merge objects, causing the identify scroll to move to a different place. Check for that here. */ if (i_ptr->tval != TV_SCROLL1 || i_ptr->flags != 0x00000008) { item_val--; i_ptr = &inventory[item_val]; if (i_ptr->tval != TV_SCROLL1 || i_ptr->flags != 0x00000008) { msg_print("internal error with identify spell."); msg_print("Please tell the wizard!"); return; } } break; case 5: if (remove_curse()) { msg_print("You feel as if someone is watching over you."); ident = TRUE; } break; case 6: ident = light_area(char_row, char_col); break; case 7: for (k = 0; k < randint(3); k++) { y = char_row; x = char_col; ident |= summon_monster(&y, &x, FALSE); } break; case 8: teleport(10); ident = TRUE; break; case 9: teleport(100); ident = TRUE; break; case 10: (void) tele_level(); ident = TRUE; break; case 11: if (py.flags.confuse_monster == 0) { msg_print("Your hands begin to glow."); py.flags.confuse_monster = TRUE; ident = TRUE; } break; case 12: ident = TRUE; map_area(); break; case 13: ident = sleep_monsters1(char_row, char_col); break; case 14: ident = TRUE; warding_glyph(); break; case 15: ident = detect_treasure(); break; case 16: ident = detect_object(); break; case 17: ident = detect_trap(); break; case 18: ident = detect_sdoor(); break; case 19: msg_print("This is a mass genocide scroll."); ident = mass_genocide(TRUE); break; case 20: ident = detect_invisible(); break; case 21: ident = aggravate_monster(20); if (ident) msg_print("There is a high pitched humming noise."); break; case 22: ident = trap_creation(); break; case 23: ident = td_destroy(); break; case 24: /* Not Used , used to be door creation */ break; case 25: msg_print("This is a Recharge-Item scroll."); ident = TRUE; used_up = recharge(60); break; case 26: msg_print("This is a genocide scroll."); ident = genocide(TRUE); break; case 27: ident = unlight_area(char_row, char_col); break; case 28: ident = protect_evil(); break; case 29: ident = TRUE; create_food(); break; case 30: ident = dispel_creature(UNDEAD, 60); break; case 31: remove_all_curse(); ident = TRUE; break; case 33: i_ptr = &inventory[INVEN_WIELD]; if (i_ptr->tval != TV_NOTHING) { objdes(tmp_str, i_ptr, FALSE); (void) sprintf(out_val, "Your %s glows brightly!", tmp_str); msg_print(out_val); flag = FALSE; for (k = 0; k < randint(2); k++) if (enchant(&i_ptr->tohit)) flag = TRUE; for (k = 0; k < randint(2); k++) if (enchant(&i_ptr->todam)) flag = TRUE; if (flag) { i_ptr->flags &= ~TR_CURSED; calc_bonuses (); } else msg_print("The enchantment fails."); ident = TRUE; } break; case 34: i_ptr = &inventory[INVEN_WIELD]; if (i_ptr->tval != TV_NOTHING) { objdes(tmp_str, i_ptr, FALSE); (void)sprintf(out_val,"Your %s glows black, fades.",tmp_str); msg_print(out_val); unmagic_name(i_ptr); i_ptr->tohit = -randint(5) - randint(5); i_ptr->todam = -randint(5) - randint(5); i_ptr->flags = TR_CURSED; py_bonuses(i_ptr, -1); calc_bonuses (); ident = TRUE; } break; case 35: k = 0; l = 0; if (inventory[INVEN_BODY].tval != TV_NOTHING) tmp[k++] = INVEN_BODY; if (inventory[INVEN_ARM].tval != TV_NOTHING) tmp[k++] = INVEN_ARM; if (inventory[INVEN_OUTER].tval != TV_NOTHING) tmp[k++] = INVEN_OUTER; if (inventory[INVEN_HANDS].tval != TV_NOTHING) tmp[k++] = INVEN_HANDS; if (inventory[INVEN_HEAD].tval != TV_NOTHING) tmp[k++] = INVEN_HEAD; /* also enchant boots */ if (inventory[INVEN_FEET].tval != TV_NOTHING) tmp[k++] = INVEN_FEET; if (k > 0) l = tmp[randint(k)-1]; if (TR_CURSED & inventory[INVEN_BODY].flags) l = INVEN_BODY; else if (TR_CURSED & inventory[INVEN_ARM].flags) l = INVEN_ARM; else if (TR_CURSED & inventory[INVEN_OUTER].flags) l = INVEN_OUTER; else if (TR_CURSED & inventory[INVEN_HEAD].flags) l = INVEN_HEAD; else if (TR_CURSED & inventory[INVEN_HANDS].flags) l = INVEN_HANDS; else if (TR_CURSED & inventory[INVEN_FEET].flags) l = INVEN_FEET; if (l > 0) { i_ptr = &inventory[l]; objdes(tmp_str, i_ptr, FALSE); (void) sprintf(out_val,"Your %s glows brightly!", tmp_str); msg_print(out_val); flag = FALSE; for (k = 0; k < randint(2) + 1; k++) if (enchant(&i_ptr->toac)) flag = TRUE; if (flag) { i_ptr->flags &= ~TR_CURSED; calc_bonuses (); } else msg_print("The enchantment fails."); ident = TRUE; } break; case 36: if ((inventory[INVEN_BODY].tval != TV_NOTHING) && (randint(4) == 1)) k = INVEN_BODY; else if ((inventory[INVEN_ARM].tval != TV_NOTHING) && (randint(3) ==1)) k = INVEN_ARM; else if ((inventory[INVEN_OUTER].tval != TV_NOTHING) && (randint(3) ==1)) k = INVEN_OUTER; else if ((inventory[INVEN_HEAD].tval != TV_NOTHING) && (randint(3) ==1)) k = INVEN_HEAD; else if ((inventory[INVEN_HANDS].tval != TV_NOTHING) && (randint(3) ==1)) k = INVEN_HANDS; else if ((inventory[INVEN_FEET].tval != TV_NOTHING) && (randint(3) ==1)) k = INVEN_FEET; else if (inventory[INVEN_BODY].tval != TV_NOTHING) k = INVEN_BODY; else if (inventory[INVEN_ARM].tval != TV_NOTHING) k = INVEN_ARM; else if (inventory[INVEN_OUTER].tval != TV_NOTHING) k = INVEN_OUTER; else if (inventory[INVEN_HEAD].tval != TV_NOTHING) k = INVEN_HEAD; else if (inventory[INVEN_HANDS].tval != TV_NOTHING) k = INVEN_HANDS; else if (inventory[INVEN_FEET].tval != TV_NOTHING) k = INVEN_FEET; else k = 0; if (k > 0) { i_ptr = &inventory[k]; objdes(tmp_str, i_ptr, FALSE); (void)sprintf(out_val,"Your %s glows black, fades.",tmp_str); msg_print(out_val); unmagic_name(i_ptr); i_ptr->flags = TR_CURSED; i_ptr->toac = -randint(5) - randint(5); calc_bonuses (); ident = TRUE; } break; case 37: ident = FALSE; for (k = 0; k < randint(3); k++) { y = char_row; x = char_col; ident |= summon_undead(&y, &x); } break; case 38: ident = TRUE; bless(randint(12)+6); break; case 39: ident = TRUE; bless(randint(24)+12); break; case 40: ident = TRUE; bless(randint(48)+24); break; case 41: ident = TRUE; if (py.flags.word_recall == 0) py.flags.word_recall = 25 + randint(30); msg_print("The air about you becomes charged."); break; case 42: destroy_area(char_row, char_col); ident = TRUE; break; case 43: place_special(char_row, char_col, SPECIAL); prt_map(); break; case 44: special_random_object(char_row, char_col, 1); prt_map(); break; default: msg_print("Internal error in scroll()"); break; } /* End of Scrolls. */ } i_ptr = &inventory[item_val]; if (ident) { if (!known1_p(i_ptr)) { m_ptr = &py.misc; /* round half-way case up */ m_ptr->exp += (i_ptr->level +(m_ptr->lev >> 1)) / m_ptr->lev; prt_experience(); identify(&item_val); i_ptr = &inventory[item_val]; } }
/* Use a staff. -RAK- */ void use() { int32u i; int j, k, item_val, chance, y, x; register int ident; register struct misc *m_ptr; register inven_type *i_ptr; free_turn_flag = TRUE; if (inven_ctr == 0) msg_print("But you are not carrying anything."); else if (!find_range(TV_STAFF, TV_NEVER, &j, &k)) msg_print("You are not carrying any staffs."); else if (get_item(&item_val, "Use which staff?", j, k, CNIL, CNIL)) { i_ptr = &inventory[item_val]; free_turn_flag = FALSE; m_ptr = &py.misc; chance = m_ptr->save + stat_adj(A_INT) - (int)i_ptr->level - 5 + (class_level_adj[m_ptr->pclass][CLA_DEVICE] * m_ptr->lev / 3); if (py.flags.confused > 0) chance = chance / 2; if ((chance < USE_DEVICE) && (randint(USE_DEVICE - chance + 1) == 1)) chance = USE_DEVICE; /* Give everyone a slight chance */ if (chance <= 0) chance = 1; if (randint(chance) < USE_DEVICE) msg_print("You failed to use the staff properly."); else if (i_ptr->p1 > 0) { i = i_ptr->flags; ident = FALSE; (i_ptr->p1)--; while (i != 0) { j = bit_pos(&i) + 1; /* Staffs. */ switch(j) { case 1: ident = light_area(char_row, char_col); break; case 2: ident = detect_sdoor(); break; case 3: ident = detect_trap(); break; case 4: ident = detect_treasure(); break; case 5: ident = detect_object(); break; case 6: teleport(100); ident = TRUE; break; case 7: ident = TRUE; earthquake(); break; case 8: ident = FALSE; for (k = 0; k < randint(4); k++) { y = char_row; x = char_col; ident |= summon_monster(&y, &x, FALSE); } break; case 10: ident = TRUE; destroy_area(char_row, char_col); break; case 11: ident = TRUE; starlite(char_row, char_col); break; case 12: ident = speed_monsters(1); break; case 13: ident = speed_monsters(-1); break; case 14: ident = sleep_monsters2(); break; case 15: ident = hp_player(randint(8)); break; case 16: ident = detect_invisible(); break; case 17: if (py.flags.fast == 0) ident = TRUE; py.flags.fast += randint(30) + 15; break; case 18: if (py.flags.slow == 0) ident = TRUE; py.flags.slow += randint(30) + 15; break; case 19: ident = mass_poly(); break; case 20: if (remove_curse()) { if (py.flags.blind < 1) msg_print("The staff glows blue for a moment.."); ident = TRUE; } break; case 21: ident = detect_evil(); break; case 22: if ((cure_blindness()) || (cure_poison()) || (cure_confusion())) ident = TRUE; break; case 23: ident = dispel_creature(CD_EVIL, 60); break; case 25: ident = unlight_area(char_row, char_col); break; case 32: /* store bought flag */ break; default: msg_print("Internal error in staffs()"); break; } /* End of staff actions. */ } if (ident) { if (!known1_p(i_ptr)) { m_ptr = &py.misc; /* round half-way case up */ m_ptr->exp += (i_ptr->level + (m_ptr->lev >> 1)) / m_ptr->lev; prt_experience(); identify(&item_val); i_ptr = &inventory[item_val]; } }