void vampire_feed(int amt) { int food; int div = 4; if (prace_is_(MIMIC_BAT)) div = 16; if (p_ptr->food < PY_FOOD_FULL) hp_player(amt); else msg_print("You were not hungry."); /* Experimental: Scale the feeding asymptotically. Historically, vampiric feeding was too slow in the early game (low damage) hence tedious. But by the end game, a mere two bites would fill the vampire, rendering the talent rather useless. */ if (p_ptr->food < PY_FOOD_VAMP_MAX) food = p_ptr->food + (PY_FOOD_VAMP_MAX - p_ptr->food) / div; /* Exceeding PY_FOOD_VAMP_MAX is unlikely, but possible (eg. eating rations of food?!) */ else if (p_ptr->food < PY_FOOD_MAX) food = p_ptr->food + (PY_FOOD_MAX - p_ptr->food) / div; else food = p_ptr->food + amt; assert(food >= p_ptr->food); set_food(food); }
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; } }
static bool _elemental_healing(int flag) { int dir, ct = 0; if (!cave_have_flag_bold(py, px, flag)) { msg_print("Failed! You are out of your element!"); return FALSE; } for (dir = 0; dir < 8; dir++) { int x = px + ddx_ddd[dir]; int y = py + ddy_ddd[dir]; if (!in_bounds(y, x)) continue; if (cave_have_flag_bold(y, x, flag)) ct++; } if (ct < 4) { msg_print("Failed! You need to be surrounded by your element!"); return FALSE; } msg_print("You bask in your element and slowly feel your life returning ... "); hp_player(100 + p_ptr->lev * 3); return TRUE; }
static void _demeter_clw_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Cure Wounds"); break; case SPELL_DESC: var_set_string(res, "Heals cut and HP a little."); break; case SPELL_INFO: var_set_string(res, info_heal(p_ptr->lev/12 + 1, 10, 0)); break; case SPELL_CAST: if (p_ptr->pclass == CLASS_BLOOD_MAGE) msg_print("There is no effect."); else { hp_player(damroll(p_ptr->lev/12 + 1, 10)); set_cut(p_ptr->cut - 10, TRUE); } var_set_bool(res, TRUE); 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; } }
static void spell_wonder(int Ind, int dir) { /* This spell should become more useful (more controlled) as the player gains experience levels. Thus, add 1/5 of the player's level to the die roll. This eliminates the worst effects later on, while keeping the results quite random. It also allows some potent effects only at high level. */ player_type *p_ptr = Players[Ind]; int py = p_ptr->py; int px = p_ptr->px; int Depth = p_ptr->dun_depth; int plev = p_ptr->lev; int die = randint(100) + plev / 5; int beam = beam_chance(Ind); if (die > 100) msg_print(Ind, "You feel a surge of power!"); if (die < 8) clone_monster(Ind, dir); else if (die < 14) speed_monster(Ind, dir); else if (die < 26) heal_monster(Ind, dir); else if (die < 31) poly_monster(Ind, dir); else if (die < 36) fire_bolt_or_beam(Ind, beam - 10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4)); else if (die < 41) confuse_monster(Ind, dir, plev); else if (die < 46) fire_ball(Ind, GF_POIS, dir, 20 + (plev / 2), 3); else if (die < 51) lite_line(Ind, dir); else if (die < 56) fire_beam(Ind, GF_ELEC, dir, damroll(3+((plev-5)/6), 6)); else if (die < 61) fire_bolt_or_beam(Ind, beam-10, GF_COLD, dir, damroll(5+((plev-5)/4), 8)); else if (die < 66) fire_bolt_or_beam(Ind, beam, GF_ACID, dir, damroll(6+((plev-5)/4), 8)); else if (die < 71) fire_bolt_or_beam(Ind, beam, GF_FIRE, dir, damroll(8+((plev-5)/4), 8)); else if (die < 76) drain_life(Ind, dir, 75); else if (die < 81) fire_ball(Ind, GF_ELEC, dir, 30 + plev / 2, 2); else if (die < 86) fire_ball(Ind, GF_ACID, dir, 40 + plev, 2); else if (die < 91) fire_ball(Ind, GF_ICE, dir, 70 + plev, 3); else if (die < 96) fire_ball(Ind, GF_FIRE, dir, 80 + plev, 3); else if (die < 101) drain_life(Ind, dir, 100 + plev); else if (die < 104) earthquake(Depth, py, px, 12); else if (die < 106) destroy_area(Depth, py, px, 15, TRUE); else if (die < 108) banishment(Ind); else if (die < 110) dispel_monsters(Ind, 120); else /* RARE */ { dispel_monsters(Ind, 150); slow_monsters(Ind); sleep_monsters(Ind); hp_player(Ind, 300); } }
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; } }
static bool cast_mage_spell(int spell, int dir) { int py = p_ptr->py; int px = p_ptr->px; int plev = p_ptr->lev; /* Hack -- chance of "beam" instead of "bolt" */ int beam = beam_chance(); /* Spells. */ switch (spell) { case SPELL_MAGIC_MISSILE: { fire_bolt_or_beam(beam-10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4)); break; } case SPELL_DETECT_MONSTERS: { (void)detect_monsters_normal(TRUE); break; } case SPELL_PHASE_DOOR: { teleport_player(10); break; } case SPELL_LIGHT_AREA: { (void)light_area(damroll(2, (plev / 2)), (plev / 10) + 1); break; } case SPELL_TREASURE_DETECTION: { (void)detect_treasure(TRUE); break; } case SPELL_CURE_LIGHT_WOUNDS: { (void)heal_player(15, 15); (void)dec_timed(TMD_CUT, 20, TRUE); (void)dec_timed(TMD_CONFUSED, 20, TRUE); (void)clear_timed(TMD_BLIND, TRUE); break; } case SPELL_FIND_TRAPS_DOORS: { (void)detect_traps(TRUE); (void)detect_doorstairs(TRUE); break; } case SPELL_STINKING_CLOUD: { fire_ball(GF_POIS, dir, 10 + (plev / 2), 2); break; } case SPELL_CONFUSE_MONSTER: { (void)confuse_monster(dir, plev, TRUE); break; } case SPELL_LIGHTNING_BOLT: { fire_beam(GF_ELEC, dir, damroll(3+((plev-5)/6), 6)); break; } case SPELL_TRAP_DOOR_DESTRUCTION: { (void)destroy_doors_touch(); break; } case SPELL_SLEEP_MONSTER: { (void)sleep_monster(dir, TRUE); break; } case SPELL_CURE_POISON: { (void)clear_timed(TMD_POISONED, TRUE); break; } case SPELL_TELEPORT_SELF: { teleport_player(plev * 5); break; } case SPELL_SPEAR_OF_LIGHT: { msg("A line of blue shimmering light appears."); light_line(dir); break; } case SPELL_FROST_BOLT: { fire_bolt_or_beam(beam-10, GF_COLD, dir, damroll(5+((plev-5)/4), 8)); break; } case SPELL_TURN_STONE_TO_MUD: { (void)wall_to_mud(dir); break; } case SPELL_SATISFY_HUNGER: { (void)set_food(PY_FOOD_MAX - 1); break; } case SPELL_RECHARGE_ITEM_I: { return recharge(2 + plev / 5); } case SPELL_WONDER: { (void)spell_wonder(dir); break; } case SPELL_POLYMORPH_OTHER: { (void)poly_monster(dir); break; } case SPELL_IDENTIFY: { return ident_spell(); } case SPELL_MASS_SLEEP: { (void)sleep_monsters(TRUE); break; } case SPELL_FIRE_BOLT: { fire_bolt_or_beam(beam, GF_FIRE, dir, damroll(6+((plev-5)/4), 8)); break; } case SPELL_SLOW_MONSTER: { (void)slow_monster(dir); break; } case SPELL_FROST_BALL: { fire_ball(GF_COLD, dir, 30 + (plev), 2); break; } case SPELL_RECHARGE_ITEM_II: /* greater recharging */ { return recharge(50 + plev); } case SPELL_TELEPORT_OTHER: { (void)teleport_monster(dir); break; } case SPELL_BEDLAM: { fire_ball(GF_OLD_CONF, dir, plev, 4); break; } case SPELL_FIRE_BALL: { fire_ball(GF_FIRE, dir, 55 + (plev), 2); break; } case SPELL_WORD_OF_DESTRUCTION: { destroy_area(py, px, 15, TRUE); break; } case SPELL_BANISHMENT: { return banishment(); break; } case SPELL_DOOR_CREATION: { (void)door_creation(); break; } case SPELL_STAIR_CREATION: { (void)stair_creation(); break; } case SPELL_TELEPORT_LEVEL: { (void)teleport_player_level(); break; } case SPELL_EARTHQUAKE: { earthquake(py, px, 10); break; } case SPELL_WORD_OF_RECALL: { set_recall(); break; } case SPELL_ACID_BOLT: { fire_bolt_or_beam(beam, GF_ACID, dir, damroll(8+((plev-5)/4), 8)); break; } case SPELL_CLOUD_KILL: { fire_ball(GF_POIS, dir, 40 + (plev / 2), 3); break; } case SPELL_ACID_BALL: { fire_ball(GF_ACID, dir, 40 + (plev), 2); break; } case SPELL_ICE_STORM: { fire_ball(GF_ICE, dir, 50 + (plev * 2), 3); break; } case SPELL_METEOR_SWARM: { fire_swarm(2 + plev / 20, GF_METEOR, dir, 30 + plev / 2, 1); break; } case SPELL_MANA_STORM: { fire_ball(GF_MANA, dir, 300 + (plev * 2), 3); break; } case SPELL_DETECT_INVISIBLE: { (void)detect_monsters_normal(TRUE); (void)detect_monsters_invis(TRUE); break; } case SPELL_DETECT_ENCHANTMENT: { (void)detect_objects_magic(TRUE); break; } case SPELL_SHOCK_WAVE: { fire_ball(GF_SOUND, dir, 10 + plev, 2); break; } case SPELL_EXPLOSION: { fire_ball(GF_SHARD, dir, 20 + (plev * 2), 2); break; } case SPELL_MASS_BANISHMENT: { (void)mass_banishment(); break; } case SPELL_RESIST_FIRE: { (void)inc_timed(TMD_OPP_FIRE, randint1(20) + 20, TRUE); break; } case SPELL_RESIST_COLD: { (void)inc_timed(TMD_OPP_COLD, randint1(20) + 20, TRUE); break; } case SPELL_ELEMENTAL_BRAND: /* elemental brand */ { return brand_ammo(); } case SPELL_RESIST_POISON: { (void)inc_timed(TMD_OPP_POIS, randint1(20) + 20, TRUE); break; } case SPELL_RESISTANCE: { int time = randint1(20) + 20; (void)inc_timed(TMD_OPP_ACID, time, TRUE); (void)inc_timed(TMD_OPP_ELEC, time, TRUE); (void)inc_timed(TMD_OPP_FIRE, time, TRUE); (void)inc_timed(TMD_OPP_COLD, time, TRUE); (void)inc_timed(TMD_OPP_POIS, time, TRUE); break; } case SPELL_HEROISM: { (void)hp_player(10); (void)inc_timed(TMD_HERO, randint1(25) + 25, TRUE); (void)clear_timed(TMD_AFRAID, TRUE); break; } case SPELL_SHIELD: { (void)inc_timed(TMD_SHIELD, randint1(20) + 30, TRUE); break; } case SPELL_BERSERKER: { (void)hp_player(30); (void)inc_timed(TMD_SHERO, randint1(25) + 25, TRUE); (void)clear_timed(TMD_AFRAID, TRUE); break; } case SPELL_HASTE_SELF: { if (!p_ptr->timed[TMD_FAST]) { (void)set_timed(TMD_FAST, randint1(20) + plev, TRUE); } else { (void)inc_timed(TMD_FAST, randint1(5), TRUE); } break; } case SPELL_RIFT: { fire_beam(GF_GRAVITY, dir, 40 + damroll(plev, 7)); break; } case SPELL_REND_SOUL: /* rend soul */ { fire_bolt_or_beam(beam / 4, GF_NETHER, dir, damroll(11, plev)); break; } case SPELL_CHAOS_STRIKE: /* chaos strike */ { fire_bolt_or_beam(beam, GF_CHAOS, dir, damroll(13, plev)); break; } case SPELL_RUNE_OF_PROTECTION: /* rune of protection */ { (void)warding_glyph(); break; } case SPELL_ENCHANT_ARMOR: /* enchant armor */ { return enchant_spell(0, 0, randint0(3) + plev / 20); } case SPELL_ENCHANT_WEAPON: /* enchant weapon */ { return enchant_spell(randint0(4) + plev / 20, randint0(4) + plev / 20, 0); } } /* Success */ return (TRUE); }
void b__misc_effects(integer effect, boolean *idented, treas_ptr item_ptr) { integer i3, i4, loss, dur; integer dumy,y_dumy,x_dumy; integer y,x; stat_set tstat; boolean ident; char dir; ident = *idented; switch (effect) { case 1 : /*{Silver Cross}*/ msg_print("You feel secure..."); protect_evil(); ident = true; break; case 2 : /*{Gold Cross}*/ ident = zap_area(0x0400,100,c_hp); break; case 3 : /*{Mithril Cross}*/ x = char_row; y = char_col; ident = summon_undead(&x,&y); break; case 4 : /*{Cross}*/ x = char_row; y = char_col; ident = summon_demon(&x,&y); break; case 5 : /*{Cross}*/ strcat(item_ptr->data.name, "(Empty)"); msg_print("You free a Djinni from the bottle!"); msg_print("He grants you a wish..."); msg_print("'I will raise one of your stats by two...'"); msg_print("'Which stat would you like to raise?'"); ident = (get_com("1=str 2=int 3=wis 4=dex 5=con 6=cha",&dir)); if ((dir > '0') && (dir < '7')) { tstat = (integer)dir-49; ident = gain_stat(tstat,"X"); ident = gain_stat(tstat," and x2, too!"); } else { msg_print("Oh well, maybe next time."); } break; case 6 : /*{ Corked Bottle of Demons }*/ msg_print("You release several demons!"); x = char_row; y = char_col; for (i3 = 1; i3 <= 4; i3++) { summon_demon(&x,&y); } py.flags.paralysis += 2; strcat(item_ptr->data.name, "(Empty)"); ident = true; break; case 7 : ident = create_water(char_row,char_col); break; case 8 : ident = destroy_water(char_row,char_col); break; case 9 : msg_print("Many Undead appear!"); x = char_row; y = char_col; for (i3 = 1; i3 <= 8; i3++) { ident = summon_undead(&x,&y); } py.flags.paralysis += 2; break; case 10 : msg_print("Many Demons appear!"); x = char_row; y = char_col; for (i3 = 1; i3 <= 8; i3++) { ident = summon_demon(&x,&y); } py.flags.paralysis += 2; ident = true; break; case 11: //with py.stat do; for (tstat = STR; tstat <= CHR; tstat++) { if (restore_stat(tstat,"X")) { ident = true; } } if (hp_player(damroll("6d7"),"a statue.")) { ident = true; } //with py.flags do; if (PF.slow > 0) { ident = true; PF.slow = 1; } /* bitwise or, otherwise it shortcuts and not everything happens */ if (cure_me(&PF.blind) | cure_me(&PF.poisoned) | cure_me(&PF.confused) | cure_me(&PF.afraid) | restore_level()) { ident = true; } if (ident) { msg_print("The statue fills you with life and all maladies are cured."); } break; case 12: ident = true; break; case 13 : redraw = true; wizard_light(); for (i3 = (char_col + 1); i3 <= (char_col - 1); i3++) { for (i4 = (char_row + 1); i4 <= (char_row - 1); i4++) { if (test_light(i4,i3)) { redraw = false; } } } if (redraw) { wizard_light(); } break; case 14: ident = zap_area(0,2,c_speed); break; case 15: //with py.misc do; loss = 0; for (i3 = 1; i3 <= 6; i3++) { loss += (PM.money[i3]-PM.money[i3] / 2) * COIN_WEIGHT; PM.money[i3] /= 2; } inven_weight -= loss; reset_total_cash(); msg_print("most of your money turns to dust!"); prt_gold(); prt_weight(); ident = true; break; case 16 : //with py.misc do; if (PM.cmana < PM.mana) { PM.cmana = PM.mana; ident = true; msg_print("Your feel your head clear..."); } break; case 17 : ident = item_petrify(); break; case 18 : strcpy(item_ptr->data.damage,"50d5"); item_ptr->data.cost = -1; msg_print("Click!"); ident = true; break; case 19 : ident = detect_creatures(c_monster); break; case 20 : ident = zap_area(0x0004,60,c_hp); break; case 21 : ident = unlight_area(char_row,char_col); break; case 22 : if (d__get_dir("Which direction?",&dur,&dumy,&y_dumy,&x_dumy)) { i3 = char_row; i4 = char_col; ident = fire_ball(3,dur,i3,i4,40,"Acid Ball"); } else { item_ptr->data.p1++; } break; case 23 : ident = detect_creatures(c_invisible); break; case 24 : ident = ident_spell(); break; case 25 : ident = light_area(char_row,char_col); break; case 26 : for (i3 = 1; i3 <= randint(4); i3++) { /*{who"s the idiot who wrote these things anyhow? }*/ 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 27 : if (remove_curse()) { msg_print("Your junk glows black for a moment..."); ident = true; } break; case 28 : ident = destroy_area(char_row,char_col); break; case 29 : py.flags.word_recall = 10 + randint(10); msg_print("You feel dizzy for a moment..."); ident = true; break; case 30 : msg_print("The teeth flare into flames."); py.flags.ring_fire += 3+randint(3); ident = true; break; case 31 : msg_print("The Demon teeth try to possess you..."); lose_exp(100); change_rep(-10); ident = true; break; default: msg_print("Todd Gardiner is fat!"); ident = true; break; } *idented = ident; };
/* * The "wonder" effect. * * Returns TRUE if the effect is evident. */ bool effect_wonder(int dir, int die, int beam) { /* This spell should become more useful (more controlled) as the player gains experience levels. Thus, add 1/5 of the player's level to the die roll. This eliminates the worst effects later on, while keeping the results quite random. It also allows some potent effects only at high level. */ bool visible = FALSE; int py = p_ptr->py; int px = p_ptr->px; int plev = p_ptr->lev; if (die > 100) { /* above 100 the effect is always visible */ msg("You feel a surge of power!"); visible = TRUE; } if (die < 8) visible = clone_monster(dir); else if (die < 14) visible = speed_monster(dir); else if (die < 26) visible = heal_monster(dir); else if (die < 31) visible = poly_monster(dir); else if (die < 36) visible = fire_bolt_or_beam(beam - 10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4)); else if (die < 41) visible = confuse_monster(dir, plev, FALSE); else if (die < 46) visible = fire_ball(GF_POIS, dir, 20 + (plev / 2), 3); else if (die < 51) visible = light_line(dir); else if (die < 56) visible = fire_beam(GF_ELEC, dir, damroll(3+((plev-5)/6), 6)); else if (die < 61) visible = fire_bolt_or_beam(beam-10, GF_COLD, dir, damroll(5+((plev-5)/4), 8)); else if (die < 66) visible = fire_bolt_or_beam(beam, GF_ACID, dir, damroll(6+((plev-5)/4), 8)); else if (die < 71) visible = fire_bolt_or_beam(beam, GF_FIRE, dir, damroll(8+((plev-5)/4), 8)); else if (die < 76) visible = drain_life(dir, 75); else if (die < 81) visible = fire_ball(GF_ELEC, dir, 30 + plev / 2, 2); else if (die < 86) visible = fire_ball(GF_ACID, dir, 40 + plev, 2); else if (die < 91) visible = fire_ball(GF_ICE, dir, 70 + plev, 3); else if (die < 96) visible = fire_ball(GF_FIRE, dir, 80 + plev, 3); /* above 100 'visible' is already true */ else if (die < 101) drain_life(dir, 100 + plev); else if (die < 104) earthquake(py, px, 12); else if (die < 106) destroy_area(py, px, 15, TRUE); else if (die < 108) banishment(); else if (die < 110) dispel_monsters(120); else /* RARE */ { dispel_monsters(150); slow_monsters(); sleep_monsters(TRUE); hp_player(300); } return visible; }
/* Cast the specified spell */ bool spell_cast(int spell, int dir) { int chance; int plev = p_ptr->lev; bool failed = FALSE; int py = p_ptr->py; int px = p_ptr->px; /* Get the spell */ const magic_type *mt_ptr = &mp_ptr->info[spell]; /* Spell failure chance */ chance = spell_chance(spell); /* Specialty Ability */ if (player_has(PF_HEIGHTEN_MAGIC)) plev += 1 + ((p_ptr->heighten_power + 5) / 10); if (player_has(PF_CHANNELING)) plev += get_channeling_boost(); /* Failed spell */ if (randint0(100) < chance) { failed = TRUE; if (OPT(flush_failure)) flush(); msg(magic_desc[mp_ptr->spell_realm][SPELL_FAIL]); } /* Process spell */ else { /* Cast the spell */ if (!cast_spell(mp_ptr->spell_book, mt_ptr->index, dir, plev)) return FALSE; /* A spell was cast */ sound(MSG_SPELL); /* A spell was cast or a prayer prayed */ if (!(p_ptr->spell_flags[spell] & PY_SPELL_WORKED)){ int e = mt_ptr->sexp; /* The spell worked */ p_ptr->spell_flags[spell] |= PY_SPELL_WORKED; /* Gain experience */ gain_exp(e * mt_ptr->slevel); /* Redraw object recall */ p_ptr->redraw |= (PR_OBJECT); } } /* Hack - simplify rune of mana calculations by fully draining the rune * first */ if (cave_trap_specific(py, px, RUNE_MANA) && (mana_reserve <= mt_ptr->smana) && (mt_ptr->index != 60)) { p_ptr->csp += mana_reserve; mana_reserve = 0; } /* Rune of mana can take less mana than specified */ if (mt_ptr->index == 60) { /* Standard mana amount */ int mana = 40; /* Already full? */ if (mana_reserve >= MAX_MANA_RESERVE) { /* Use no mana */ mana = 0; } /* Don't put in more than we have */ else if (p_ptr->csp < mana) mana = p_ptr->csp; /* Don't put in more than it will hold */ if (mana_reserve + mana > MAX_MANA_RESERVE) mana = MAX_MANA_RESERVE - mana_reserve; /* Deduct */ p_ptr->csp -= mana; } /* Use mana from a rune if possible */ else if (cave_trap_specific(py, px, RUNE_MANA) && (mana_reserve > mt_ptr->smana)) { mana_reserve -= mt_ptr->smana; } /* Sufficient mana */ else if (mt_ptr->smana <= p_ptr->csp) { /* Use some mana */ p_ptr->csp -= mt_ptr->smana; /* Specialty ability Harmony */ if ((failed == FALSE) & (player_has(PF_HARMONY))) { int frac, boost; /* Percentage of max hp to be regained */ frac = 3 + (mt_ptr->smana / 3); /* Cap at 10 % */ if (frac > 10) frac = 10; /* Calculate fractional bonus */ boost = (frac * p_ptr->mhp) / 100; /* Apply bonus */ (void) hp_player(boost); } } /* Over-exert the player */ else { int oops = mt_ptr->smana - p_ptr->csp; /* No mana left */ p_ptr->csp = 0; p_ptr->csp_frac = 0; /* Message */ if (mp_ptr->spell_realm == REALM_NECROMANTIC) msg("You collapse after the ritual!"); else msg("You faint from the effort!"); /* Hack -- Bypass free action */ (void) inc_timed(TMD_PARALYZED, randint1(5 * oops + 1), TRUE); /* Damage CON (possibly permanently) */ if (randint0(100) < 50) { bool perm = (randint0(100) < 25); /* Message */ msg("You have damaged your health!"); /* Reduce constitution */ (void) dec_stat(A_CON, 15 + randint1(10), perm); } } /* Redraw mana */ p_ptr->redraw |= (PR_MANA); return TRUE; }
static void do_cmd_eat_food_aux(int item) { int ident, lev; object_type *o_ptr; if (music_singing_any()) bard_stop_singing(); if (hex_spelling_any()) stop_hex_spell_all(); warlock_stop_singing(); /* Get the item (in the pack) */ if (item >= 0) { o_ptr = &inventory[item]; } /* Get the item (on the floor) */ else { o_ptr = &o_list[0 - item]; } if (object_is_mushroom(o_ptr) && o_ptr->art_name && o_ptr->timeout) { msg_print("Your mushroom is still charging."); return; } /* Sound */ sound(SOUND_EAT); /* Take a turn */ energy_use = 100; /* Identity not known yet */ ident = FALSE; /* Object level */ lev = k_info[o_ptr->k_idx].level; if (o_ptr->tval == TV_FOOD) { /* Analyze the food */ switch (o_ptr->sval) { case SV_FOOD_POISON: { if (!res_save_default(RES_POIS)) { if (set_poisoned(p_ptr->poisoned + randint0(10) + 10, FALSE)) ident = TRUE; } break; } case SV_FOOD_BLINDNESS: { if (!res_save_default(RES_BLIND)) { if (set_blind(p_ptr->blind + randint0(200) + 200, FALSE)) ident = TRUE; } break; } case SV_FOOD_PARANOIA: { if (!fear_save_p(fear_threat_level())) ident = fear_add_p(FEAR_SCARED); break; } case SV_FOOD_CONFUSION: { if (!res_save_default(RES_CONF)) { if (set_confused(p_ptr->confused + randint0(10) + 10, FALSE)) ident = TRUE; } break; } case SV_FOOD_HALLUCINATION: { if (!res_save_default(RES_CHAOS)) { if (set_image(p_ptr->image + randint0(25) + 25, FALSE)) ident = TRUE; } break; } case SV_FOOD_PARALYSIS: { if (!p_ptr->free_act) { if (set_paralyzed(randint1(4), FALSE)) { ident = TRUE; } } break; } case SV_FOOD_WEAKNESS: { take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "poisonous food", -1); (void)do_dec_stat(A_STR); ident = TRUE; break; } case SV_FOOD_SICKNESS: { take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "poisonous food", -1); (void)do_dec_stat(A_CON); ident = TRUE; break; } case SV_FOOD_STUPIDITY: { take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "poisonous food", -1); (void)do_dec_stat(A_INT); ident = TRUE; break; } case SV_FOOD_NAIVETY: { take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "poisonous food", -1); (void)do_dec_stat(A_WIS); ident = TRUE; break; } case SV_FOOD_UNHEALTH: { take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "poisonous food", -1); (void)do_dec_stat(A_CON); ident = TRUE; break; } case SV_FOOD_DISEASE: { take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "poisonous food", -1); (void)do_dec_stat(A_STR); ident = TRUE; break; } case SV_FOOD_CURE_POISON: { if (set_poisoned(0, TRUE)) ident = TRUE; break; } case SV_FOOD_CURE_BLINDNESS: { if (set_blind(0, TRUE)) ident = TRUE; break; } case SV_FOOD_CURE_PARANOIA: { if (p_ptr->afraid) { fear_clear_p(); ident = TRUE; } break; } case SV_FOOD_CURE_CONFUSION: { if (set_confused(0, TRUE)) ident = TRUE; break; } case SV_FOOD_CURE_SERIOUS: { if (hp_player(damroll(6, 8))) ident = TRUE; if (set_cut((p_ptr->cut / 2) - 50, TRUE)) ident = TRUE; break; } case SV_FOOD_RESTORE_STR: { if (do_res_stat(A_STR)) ident = TRUE; break; } case SV_FOOD_RESTORE_CON: { if (do_res_stat(A_CON)) ident = TRUE; break; } case SV_FOOD_RESTORING: { 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_FOOD_RATION: case SV_FOOD_BISCUIT: case SV_FOOD_JERKY: case SV_FOOD_SLIME_MOLD: { msg_print("That tastes good."); ident = TRUE; break; } case SV_FOOD_AMBROSIA: { msg_print("That tastes divine!"); set_poisoned(0, TRUE); hp_player(damroll(15, 15)); do_res_stat(A_STR); do_res_stat(A_INT); do_res_stat(A_WIS); do_res_stat(A_DEX); do_res_stat(A_CON); do_res_stat(A_CHR); restore_level(); ident = TRUE; break; } case SV_FOOD_WAYBREAD: { msg_print("That tastes good."); (void)set_poisoned(0, TRUE); (void)hp_player(damroll(4, 8)); ident = TRUE; break; } case SV_FOOD_PINT_OF_ALE: case SV_FOOD_PINT_OF_WINE: { msg_print("That tastes good."); ident = TRUE; break; } } } if (prace_is_(RACE_SNOTLING) && object_is_mushroom(o_ptr)) { int lev = k_info[o_ptr->k_idx].level; int dur = lev + randint1(lev); set_fast(p_ptr->fast + dur, FALSE); set_shield(p_ptr->shield + dur, FALSE); set_hero(p_ptr->hero + dur, FALSE); set_tim_building_up(p_ptr->tim_building_up + dur, FALSE); } /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); if (!(object_is_aware(o_ptr))) { virtue_add(VIRTUE_KNOWLEDGE, -1); virtue_add(VIRTUE_PATIENCE, -1); virtue_add(VIRTUE_CHANCE, 1); } /* We have tried it */ if (o_ptr->tval == TV_FOOD) object_tried(o_ptr); stats_on_use(o_ptr, 1); /* The player is now aware of the object */ if (ident && !object_is_aware(o_ptr)) { object_aware(o_ptr); stats_on_notice(o_ptr, 1); gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev); }
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); }
void d__monk_effects(integer effect) { /*{ Disciplines....}*/ switch (effect+1) { case 1 : /*{ Self-Healing }*/ hp_player(damroll("4d4"),"a magic spell."); break; case 2 : /*{ Courage } */ cure_me(&py.flags.afraid); break; case 3 : /*{ Slow Poison } */ slow_poison(); break; case 4 : /*{ Negate Hunger } */ py.flags.foodc = PLAYER_FOOD_FULL + 4000; py.flags.status &= ~(IS_HUNGERY | IS_WEAK); prt_hunger(); msg_print("You are full."); break; case 5 : /*{ Sense Enemies }*/ detect_creatures(c_creature); break; case 6 : /*{ Self-Healing II } */ hp_player(damroll("8d4"),"a prayer."); break; case 7 : /*{ Night Vision }*/ py.flags.tim_infra += randint(25) + 25; break; case 8 : /*{ Poison Immunity }*/ cure_me(&(py.flags.poisoned)); break; case 9 : /*{ See Invisible } */ detect_inv2(randint(24)+24); break; case 10 : /*{ Advanced Self-Healing } */ hp_player(damroll("16d4"),"a prayer."); break; case 11 : /*{ Resist Petrification }*/ py.flags.resist_petri += randint(15) + 10; break; case 12 : /*{ Stealth }*/ py.flags.temp_stealth += randint(15)+10; break; case 13 : /*{ Free Action } */ py.flags.free_time += (randint(10) + py.misc.lev); break; case 14 : /*{ Improved Speed }*/ PF.fast += randint(20) + py.misc.lev; break; default: break; } /*{ End of Disciplines...}*/ };
/* Potions for the quaffing -RAK- */ void quaff() { int32u i, l; int j, k, item_val; int ident; register inven_type *i_ptr; register struct misc *m_ptr; register struct flags *f_ptr; #if 0 /* used by ifdefed out learn_spell potion */ register class_type *c_ptr; #endif free_turn_flag = TRUE; if (inven_ctr == 0) msg_print("But you are not carrying anything."); else if (!find_range(TV_POTION1, TV_POTION2, &j, &k)) msg_print("You are not carrying any potions."); else if (get_item(&item_val, "Quaff which potion?", j, k, CNIL, CNIL)) { i_ptr = &inventory[item_val]; i = i_ptr->flags; free_turn_flag = FALSE; ident = FALSE; if (i == 0) { msg_print ("You feel less thirsty."); ident = TRUE; } else while (i != 0) { j = bit_pos(&i) + 1; if (i_ptr->tval == TV_POTION2) j += 32; /* Potions */ switch(j) { case 1: if (inc_stat (A_STR)) { msg_print("Wow! What bulging muscles!"); ident = TRUE; } break; case 2: ident = TRUE; lose_str(); break; case 3: if (res_stat (A_STR)) { msg_print("You feel warm all over."); ident = TRUE; } break; case 4: if (inc_stat (A_INT)) { msg_print("Aren't you brilliant!"); ident = TRUE; } break; case 5: ident = TRUE; lose_int(); break; case 6: if (res_stat (A_INT)) { msg_print("You have have a warm feeling."); ident = TRUE; } break; case 7: if (inc_stat (A_WIS)) { msg_print("You suddenly have a profound thought!"); ident = TRUE; } break; case 8: ident = TRUE; lose_wis(); break; case 9: if (res_stat (A_WIS)) { msg_print("You feel your wisdom returning."); ident = TRUE; } break; case 10: if (inc_stat (A_CHR)) { msg_print("Gee, ain't you cute!"); ident = TRUE; } break; case 11: ident = TRUE; lose_chr(); break; case 12: if (res_stat (A_CHR)) { msg_print("You feel your looks returning."); ident = TRUE; } break; case 13: ident = hp_player(damroll(2, 7)); break; case 14: ident = hp_player(damroll(4, 7)); break; case 15: ident = hp_player(damroll(6, 7)); break; case 16: ident = hp_player(1000); break; case 17: if (inc_stat (A_CON)) { msg_print("You feel tingly for a moment."); ident = TRUE; } break; case 18: m_ptr = &py.misc; if (m_ptr->exp < MAX_EXP) { l = (m_ptr->exp / 2) + 10; if (l > 100000L) l = 100000L; m_ptr->exp += l; msg_print("You feel more experienced."); prt_experience(); ident = TRUE; } break; case 19: f_ptr = &py.flags; if (!f_ptr->free_act) { /* paralysis must == 0, otherwise could not drink potion */ msg_print("You fall asleep."); f_ptr->paralysis += randint(4) + 4; ident = TRUE; } break; case 20: f_ptr = &py.flags; if (f_ptr->blind == 0) { msg_print("You are covered by a veil of darkness."); ident = TRUE; } f_ptr->blind += randint(100) + 100; break; case 21: f_ptr = &py.flags; if (f_ptr->confused == 0) { msg_print("Hey! This is good stuff! * Hick! *"); ident = TRUE; } f_ptr->confused += randint(20) + 12; break; case 22: f_ptr = &py.flags; if (f_ptr->poisoned == 0) { msg_print("You feel very sick."); ident = TRUE; } f_ptr->poisoned += randint(15) + 10; break; case 23: if (py.flags.fast == 0) ident = TRUE; py.flags.fast += randint(25) + 15; break; case 24: if (py.flags.slow == 0) ident = TRUE; py.flags.slow += randint(25) + 15; break; case 26: if (inc_stat (A_DEX)) { msg_print("You feel more limber!"); ident = TRUE; } break; case 27: if (res_stat (A_DEX)) { msg_print("You feel less clumsy."); ident = TRUE; } break; case 28: if (res_stat (A_CON)) { msg_print("You feel your health returning!"); ident = TRUE; } break; case 29: ident = cure_blindness(); break; case 30: ident = cure_confusion(); break; case 31: ident = cure_poison(); break; #if 0 case 33: /* this is no longer useful, now that there is a 'G'ain magic spells command */ m_ptr = &py.misc; c_ptr = &class[m_ptr->pclass]; if (c_ptr->spell == MAGE) { calc_spells(A_INT); calc_mana(A_INT); } else if (c_ptr->spell == PRIEST) { calc_spells(A_WIS); calc_mana(A_WIS); } else { /* A warrior learns something about his equipment. -CJS- */ inven_type *w_ptr; vtype tmp_str; extern char *describe_use (); for (k = 22; k < INVEN_ARRAY_SIZE; k++) { w_ptr = &inventory[k]; if (w_ptr->tval != TV_NOTHING && enchanted (w_ptr)) { (void) sprintf (tmp_str, "There's something about what you are %s...", describe_use(k)); msg_print (tmp_str); add_inscribe(w_ptr, ID_MAGIK); ident = TRUE; } } } break; #endif case 34: if (py.misc.exp > 0) { int32 m, scale; msg_print("You feel your memories fade."); /* Lose between 1/5 and 2/5 of your experience */ m = py.misc.exp / 5; if (py.misc.exp > MAX_SHORT) { scale = MAX_LONG / py.misc.exp; m += (randint((int)scale) * py.misc.exp) / (scale * 5); } else m += randint((int)py.misc.exp) / 5; lose_exp(m); ident = TRUE; } break; case 35: f_ptr = &py.flags; (void) cure_poison(); if (f_ptr->food > 150) f_ptr->food = 150; f_ptr->paralysis = 4; msg_print("The potion makes you vomit!"); ident = TRUE; break; case 36: if (py.flags.invuln == 0) ident = TRUE; py.flags.invuln += randint(10) + 10; break; case 37: if (py.flags.hero == 0) ident = TRUE; py.flags.hero += randint(25) + 25; break; case 38: if (py.flags.shero == 0) ident = TRUE; py.flags.shero += randint(25) + 25; break; case 39: ident = remove_fear(); break; case 40: ident = restore_level(); break; case 41: f_ptr = &py.flags; if (f_ptr->resist_heat == 0) ident = TRUE; f_ptr->resist_heat += randint(10) + 10; break; case 42: f_ptr = &py.flags; if (f_ptr->resist_cold == 0) ident = TRUE; f_ptr->resist_cold += randint(10) + 10; break; case 43: if (py.flags.detect_inv == 0) ident = TRUE; detect_inv2(randint(12)+12); break; case 44: ident = slow_poison(); break; case 45: ident = cure_poison(); break; case 46: 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 47: f_ptr = &py.flags; if (f_ptr->tim_infra == 0) { msg_print("Your eyes begin to tingle."); ident = TRUE; } f_ptr->tim_infra += 100 + randint(100); break; default: msg_print ("Internal error in potion()"); break; } /* End of Potions. */ } 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]; } }
/* * Attempt to Load a "savefile" * * On multi-user systems, you may only "read" a savefile if you will be * allowed to "write" it later, this prevents painful situations in which * the player loads a savefile belonging to someone else, and then is not * allowed to save his game when he quits. * * We return "TRUE" if the savefile was usable, and we set the global * flag "character_loaded" if a real, living, character was loaded. * * Note that we always try to load the "current" savefile, even if * there is no such file, so we must check for "empty" savefile names. */ bool load_player(void) { int fd = -1; errr err = 0; byte vvv[4]; byte savefile_game; cptr what = "generic"; /* Paranoia */ turn = 0; p_ptr->p_turn = 0; /* Paranoia */ p_ptr->is_dead = FALSE; load_player_ghost_file(); /* Allow empty savefile name */ if (!savefile[0]) return (TRUE); /* Grab permissions */ safe_setuid_grab(); /* Open the savefile */ fff = file_open(savefile, MODE_READ, -1); if (fff) fd = 0; else fd = -1; /* Drop permissions */ safe_setuid_drop(); /* No file */ if (fd < 0) { /* Give a message */ msg_print("Savefile does not exist."); message_flush(); /* Allow this */ return (TRUE); } /* Close the file */ file_close(fff); /* Okay */ if (!err) { /* Grab permissions */ safe_setuid_grab(); /* Open the savefile */ fff = file_open(savefile, MODE_READ, -1); if (fff) { fd = 0; } else fd = -1; /* Drop permissions */ safe_setuid_drop(); /* No file */ if (fd < 0) err = -1; /* Message (below) */ if (err) what = "Cannot open savefile"; } /* Process file */ if (!err) { /* Read the first four bytes */ if (!file_read(fff, (char*)(vvv), 4)) err = -1; /* What */ if (err) what = "Cannot read savefile"; rd_byte(&savefile_game); /* Close the file */ file_close(fff); } /* Process file */ if (!err) { /* Extract version */ sf_major = vvv[0]; sf_minor = vvv[1]; sf_patch = vvv[2]; sf_extra = vvv[3]; /* Clear screen */ Term_clear(); if (older_than(OLD_VERSION_MAJOR, OLD_VERSION_MINOR, OLD_VERSION_PATCH)) { err = -1; what = "Savefile is too old"; } else if (!older_than(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH + 1)) { err = -1; what = "Savefile is from the future"; } else if (game_mode != savefile_game) { err = -1; if (game_mode == GAME_NPPMORIA) what = "Not a NPPMoria savefile"; else if (game_mode == GAME_NPPANGBAND) what = "Not a NPPAngband savefile"; else what = "Unknown savefile type"; } else { /* Attempt to load */ err = rd_savefile(); /* Message (below) */ if (err) what = "Cannot parse savefile"; } } /* Paranoia */ if (!err) { /* Invalid turn */ if (!turn) err = -1; /* Message (below) */ if (err) what = "Broken savefile"; } /* Okay */ if (!err) { /* Give a conversion warning */ if ((version_major != sf_major) || (version_minor != sf_minor) || (version_patch != sf_patch)) { /* Message */ msg_format("Converted a %d.%d.%d savefile.", sf_major, sf_minor, sf_patch); message_flush(); } /* Player is dead */ if (p_ptr->is_dead) { /*note, add or_true to the arg wixard if statement to resurrect character*/ /* Cheat death (unless the character retired) */ if (arg_wizard) { /*heal the player*/ hp_player(2000); /* Forget death */ p_ptr->is_dead = FALSE; /* A character was loaded */ character_loaded = TRUE; /* Done */ return (TRUE); } /* Forget death */ p_ptr->is_dead = FALSE; /* Count lives */ sf_lives++; /* Forget turns */ turn = 0; p_ptr->p_turn = 0; /* Done */ return (TRUE); } /* A character was loaded */ character_loaded = TRUE; /* Still alive */ if (p_ptr->chp >= 0) { /* Reset cause of death */ my_strcpy(p_ptr->died_from, "(alive and well)", sizeof(p_ptr->died_from)); } /* Success */ return (TRUE); } /* Message */ msg_format("Error (%s) reading %d.%d.%d savefile.", what, sf_major, sf_minor, sf_patch); message_flush(); /* Oops */ return (FALSE); }
static void do_cmd_eat_food_aux(obj_ptr obj) { int lev = k_info[obj->k_idx].level; bool ident = FALSE; if (music_singing_any()) bard_stop_singing(); if (hex_spelling_any()) stop_hex_spell_all(); warlock_stop_singing(); if (object_is_mushroom(obj) && obj->art_name && obj->timeout) { msg_print("Your mushroom is still charging."); return; } sound(SOUND_EAT); energy_use = 100; ident = FALSE; /* Food may have effects */ if (obj->tval == TV_FOOD) { switch (obj->sval) { case SV_FOOD_POISON: { if (!res_save_default(RES_POIS)) { if (set_poisoned(p_ptr->poisoned + randint0(10) + 10, FALSE)) ident = TRUE; } break; } case SV_FOOD_BLINDNESS: { if (!res_save_default(RES_BLIND)) { if (set_blind(p_ptr->blind + randint0(200) + 200, FALSE)) ident = TRUE; } break; } case SV_FOOD_PARANOIA: { if (!fear_save_p(fear_threat_level())) ident = fear_add_p(FEAR_SCARED); break; } case SV_FOOD_CONFUSION: { if (!res_save_default(RES_CONF)) { if (set_confused(p_ptr->confused + randint0(10) + 10, FALSE)) ident = TRUE; } break; } case SV_FOOD_HALLUCINATION: { if (!res_save_default(RES_CHAOS)) { if (set_image(p_ptr->image + randint0(25) + 25, FALSE)) ident = TRUE; } break; } case SV_FOOD_PARALYSIS: { if (!p_ptr->free_act) { if (set_paralyzed(randint1(4), FALSE)) { ident = TRUE; } } else equip_learn_flag(OF_FREE_ACT); break; } case SV_FOOD_WEAKNESS: { take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "poisonous food", -1); do_dec_stat(A_STR); ident = TRUE; break; } case SV_FOOD_SICKNESS: { take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "poisonous food", -1); do_dec_stat(A_CON); ident = TRUE; break; } case SV_FOOD_STUPIDITY: { take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "poisonous food", -1); do_dec_stat(A_INT); ident = TRUE; break; } case SV_FOOD_NAIVETY: { take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "poisonous food", -1); do_dec_stat(A_WIS); ident = TRUE; break; } case SV_FOOD_UNHEALTH: { take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "poisonous food", -1); do_dec_stat(A_CON); ident = TRUE; break; } case SV_FOOD_DISEASE: { take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "poisonous food", -1); do_dec_stat(A_STR); ident = TRUE; break; } case SV_FOOD_CURE_POISON: { if (set_poisoned(0, TRUE)) ident = TRUE; break; } case SV_FOOD_CURE_BLINDNESS: { if (set_blind(0, TRUE)) ident = TRUE; break; } case SV_FOOD_CURE_PARANOIA: { if (p_ptr->afraid) { fear_clear_p(); ident = TRUE; } break; } case SV_FOOD_CURE_CONFUSION: { if (set_confused(0, TRUE)) ident = TRUE; break; } case SV_FOOD_CURE_SERIOUS: { if (hp_player(damroll(6, 8))) ident = TRUE; if (set_cut((p_ptr->cut / 2) - 50, TRUE)) ident = TRUE; break; } case SV_FOOD_RESTORE_STR: { if (do_res_stat(A_STR)) ident = TRUE; break; } case SV_FOOD_RESTORE_CON: { if (do_res_stat(A_CON)) ident = TRUE; break; } case SV_FOOD_RESTORING: { 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_FOOD_RATION: case SV_FOOD_BISCUIT: case SV_FOOD_JERKY: case SV_FOOD_SLIME_MOLD: { msg_print("That tastes good."); ident = TRUE; break; } case SV_FOOD_AMBROSIA: { msg_print("That tastes divine!"); set_poisoned(0, TRUE); hp_player(damroll(15, 15)); do_res_stat(A_STR); do_res_stat(A_INT); do_res_stat(A_WIS); do_res_stat(A_DEX); do_res_stat(A_CON); do_res_stat(A_CHR); restore_level(); ident = TRUE; break; } case SV_FOOD_WAYBREAD: { msg_print("That tastes good."); set_poisoned(0, TRUE); hp_player(damroll(4, 8)); ident = TRUE; break; } case SV_FOOD_PINT_OF_ALE: case SV_FOOD_PINT_OF_WINE: { msg_print("That tastes good."); ident = TRUE; break; } } } if (prace_is_(RACE_SNOTLING) && object_is_mushroom(obj)) { int dur = lev + randint1(lev); set_fast(p_ptr->fast + dur, FALSE); set_shield(p_ptr->shield + dur, FALSE); set_hero(p_ptr->hero + dur, FALSE); set_tim_building_up(p_ptr->tim_building_up + dur, FALSE); } if (!object_is_aware(obj)) { virtue_add(VIRTUE_KNOWLEDGE, -1); virtue_add(VIRTUE_PATIENCE, -1); virtue_add(VIRTUE_CHANCE, 1); } /* We have tried it */ if (obj->tval == TV_FOOD) object_tried(obj); stats_on_use(obj, 1); /* The player is now aware of the object */ if (ident && !object_is_aware(obj)) { object_aware(obj); stats_on_notice(obj, 1); gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev); p_ptr->notice |= PN_OPTIMIZE_PACK; }
/* * 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; }
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 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); }
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; } }
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; }
/* * Do an effect, given an object. * Boost is the extent to which skill surpasses difficulty, used as % boost. It * ranges from 0 to 138. */ bool effect_do(effect_type effect, bool *ident, bool aware, int dir, int beam, int boost) { int py = p_ptr->py; int px = p_ptr->px; int dam, chance, dur; if (effect < 1 || effect > EF_MAX) { msg("Bad effect passed to do_effect(). Please report this bug."); return FALSE; } switch (effect) { case EF_POISON: { inc_timed(TMD_POISONED, damroll(2, 7) + 10, TRUE, TRUE); *ident = TRUE; return TRUE; } case EF_BLIND: { inc_timed(TMD_BLIND, damroll(4, 25) + 75, TRUE, TRUE); *ident = TRUE; return TRUE; } case EF_SCARE: { inc_timed(TMD_AFRAID, randint0(10) + 10, TRUE, TRUE); *ident = TRUE; return TRUE; } case EF_CONFUSE: { inc_timed(TMD_CONFUSED, damroll(4, 5) + 10, TRUE, TRUE); *ident = TRUE; return TRUE; } case EF_HALLUC: { inc_timed(TMD_IMAGE, randint0(250) + 250, TRUE, TRUE); *ident = TRUE; return TRUE; } case EF_PARALYZE: { inc_timed(TMD_PARALYZED, randint0(5) + 5, TRUE, TRUE); *ident = TRUE; return TRUE; } case EF_SLOW: { if (inc_timed(TMD_SLOW, randint1(25) + 15, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_POISON: { if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_BLINDNESS: { if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_PARANOIA: { if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_CONFUSION: { if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_MIND: { if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE; if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE; if (clear_timed(TMD_IMAGE, TRUE)) *ident = TRUE; if (!of_has(p_ptr->state.flags, OF_RES_CONFU) && inc_timed(TMD_OPP_CONF, damroll(4, 10), TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_BODY: { if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE; if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_LIGHT: { if (hp_player(20)) *ident = TRUE; if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; if (dec_timed(TMD_CUT, 20, TRUE)) *ident = TRUE; if (dec_timed(TMD_CONFUSED, 20, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_SERIOUS: { if (hp_player(40)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_CRITICAL: { if (hp_player(60)) *ident = TRUE; if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE; if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE; if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; if (clear_timed(TMD_AMNESIA, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_FULL: { int amt = (p_ptr->mhp * 35) / 100; if (amt < 300) amt = 300; if (hp_player(amt)) *ident = TRUE; if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE; if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE; if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; if (clear_timed(TMD_AMNESIA, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_FULL2: { if (hp_player(1200)) *ident = TRUE; if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE; if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE; if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; if (clear_timed(TMD_AMNESIA, TRUE)) *ident = TRUE; return TRUE; } case EF_CURE_TEMP: { if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE; if (clear_timed(TMD_CONFUSED, TRUE)) *ident = TRUE; if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; return TRUE; } case EF_HEAL1: { if (hp_player(500)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; return TRUE; } case EF_HEAL2: { if (hp_player(1000)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; return TRUE; } case EF_HEAL3: { if (hp_player(500)) *ident = TRUE; if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; return TRUE; } case EF_GAIN_EXP: { if (p_ptr->exp < PY_MAX_EXP) { msg("You feel more experienced."); player_exp_gain(p_ptr, 100000L); *ident = TRUE; } return TRUE; } case EF_LOSE_EXP: { if (!check_state(OF_HOLD_LIFE, p_ptr->state.flags) && (p_ptr->exp > 0)) { msg("You feel your memories fade."); player_exp_lose(p_ptr, p_ptr->exp / 4, FALSE); *ident = TRUE; } *ident = TRUE; wieldeds_notice_flag(OF_HOLD_LIFE); return TRUE; } case EF_RESTORE_EXP: { if (restore_level()) *ident = TRUE; return TRUE; } case EF_RESTORE_MANA: { if (p_ptr->csp < p_ptr->msp) { p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; msg("Your feel your head clear."); p_ptr->redraw |= (PR_MANA); *ident = TRUE; } return TRUE; } case EF_GAIN_STR: case EF_GAIN_INT: case EF_GAIN_WIS: case EF_GAIN_DEX: case EF_GAIN_CON: case EF_GAIN_CHR: { int stat = effect - EF_GAIN_STR; if (do_inc_stat(stat)) *ident = TRUE; return TRUE; } case EF_GAIN_ALL: { 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; return TRUE; } case EF_BRAWN: { /* Pick a random stat to decrease other than strength */ int stat = randint0(A_MAX-1) + 1; if (do_dec_stat(stat, TRUE)) { do_inc_stat(A_STR); *ident = TRUE; } return TRUE; } case EF_INTELLECT: { /* Pick a random stat to decrease other than intelligence */ int stat = randint0(A_MAX-1); if (stat >= A_INT) stat++; if (do_dec_stat(stat, TRUE)) { do_inc_stat(A_INT); *ident = TRUE; } return TRUE; } case EF_CONTEMPLATION: { /* Pick a random stat to decrease other than wisdom */ int stat = randint0(A_MAX-1); if (stat >= A_WIS) stat++; if (do_dec_stat(stat, TRUE)) { do_inc_stat(A_WIS); *ident = TRUE; } return TRUE; } case EF_TOUGHNESS: { /* Pick a random stat to decrease other than constitution */ int stat = randint0(A_MAX-1); if (stat >= A_CON) stat++; if (do_dec_stat(stat, TRUE)) { do_inc_stat(A_CON); *ident = TRUE; } return TRUE; } case EF_NIMBLENESS: { /* Pick a random stat to decrease other than dexterity */ int stat = randint0(A_MAX-1); if (stat >= A_DEX) stat++; if (do_dec_stat(stat, TRUE)) { do_inc_stat(A_DEX); *ident = TRUE; } return TRUE; } case EF_PLEASING: { /* Pick a random stat to decrease other than charisma */ int stat = randint0(A_MAX-1); if (do_dec_stat(stat, TRUE)) { do_inc_stat(A_CHR); *ident = TRUE; } return TRUE; } case EF_LOSE_STR: case EF_LOSE_INT: case EF_LOSE_WIS: case EF_LOSE_DEX: case EF_LOSE_CON: case EF_LOSE_CHR: { int stat = effect - EF_LOSE_STR; take_hit(damroll(5, 5), "stat drain"); (void)do_dec_stat(stat, FALSE); *ident = TRUE; return TRUE; } case EF_LOSE_CON2: { take_hit(damroll(10, 10), "poisonous food"); (void)do_dec_stat(A_CON, FALSE); *ident = TRUE; return TRUE; } case EF_RESTORE_STR: case EF_RESTORE_INT: case EF_RESTORE_WIS: case EF_RESTORE_DEX: case EF_RESTORE_CON: case EF_RESTORE_CHR: { int stat = effect - EF_RESTORE_STR; if (do_res_stat(stat)) *ident = TRUE; return TRUE; } case EF_CURE_NONORLYBIG: { msg("You feel life flow through your body!"); restore_level(); (void)clear_timed(TMD_POISONED, TRUE); (void)clear_timed(TMD_BLIND, TRUE); (void)clear_timed(TMD_CONFUSED, TRUE); (void)clear_timed(TMD_IMAGE, TRUE); (void)clear_timed(TMD_STUN, TRUE); (void)clear_timed(TMD_CUT, TRUE); (void)clear_timed(TMD_AMNESIA, 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; /* Recalculate max. hitpoints */ update_stuff(); hp_player(5000); *ident = TRUE; return TRUE; } case EF_RESTORE_ALL: { /* Life, above, also gives these effects */ 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; return TRUE; } case EF_RESTORE_ST_LEV: { 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; return TRUE; } case EF_TMD_INFRA: { if (inc_timed(TMD_SINFRA, 100 + damroll(4, 25), TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_TMD_SINVIS: { if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; if (inc_timed(TMD_SINVIS, 12 + damroll(2, 6), TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_TMD_ESP: { if (clear_timed(TMD_BLIND, TRUE)) *ident = TRUE; if (inc_timed(TMD_TELEPATHY, 12 + damroll(6, 6), TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_ENLIGHTENMENT: { msg("An image of your surroundings forms in your mind..."); wiz_light(); *ident = TRUE; return TRUE; } case EF_ENLIGHTENMENT2: { msg("You begin to feel more enlightened..."); message_flush(); wiz_light(); (void)do_inc_stat(A_INT); (void)do_inc_stat(A_WIS); (void)detect_traps(TRUE); (void)detect_doorstairs(TRUE); (void)detect_treasure(TRUE); identify_pack(); *ident = TRUE; return TRUE; } case EF_HERO: { dur = randint1(25) + 25; if (hp_player(10)) *ident = TRUE; if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE; if (inc_timed(TMD_BOLD, dur, TRUE, TRUE)) *ident = TRUE; if (inc_timed(TMD_HERO, dur, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_SHERO: { dur = randint1(25) + 25; if (hp_player(30)) *ident = TRUE; if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE; if (inc_timed(TMD_BOLD, dur, TRUE, TRUE)) *ident = TRUE; if (inc_timed(TMD_SHERO, dur, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_ACID: { if (inc_timed(TMD_OPP_ACID, randint1(10) + 10, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_ELEC: { if (inc_timed(TMD_OPP_ELEC, randint1(10) + 10, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_FIRE: { if (inc_timed(TMD_OPP_FIRE, randint1(10) + 10, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_COLD: { if (inc_timed(TMD_OPP_COLD, randint1(10) + 10, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_POIS: { if (inc_timed(TMD_OPP_POIS, randint1(10) + 10, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_ALL: { if (inc_timed(TMD_OPP_ACID, randint1(20) + 20, TRUE, TRUE)) *ident = TRUE; if (inc_timed(TMD_OPP_ELEC, randint1(20) + 20, TRUE, TRUE)) *ident = TRUE; if (inc_timed(TMD_OPP_FIRE, randint1(20) + 20, TRUE, TRUE)) *ident = TRUE; if (inc_timed(TMD_OPP_COLD, randint1(20) + 20, TRUE, TRUE)) *ident = TRUE; if (inc_timed(TMD_OPP_POIS, randint1(20) + 20, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_DETECT_TREASURE: { if (detect_treasure(aware)) *ident = TRUE; return TRUE; } case EF_DETECT_TRAP: { if (detect_traps(aware)) *ident = TRUE; return TRUE; } case EF_DETECT_DOORSTAIR: { if (detect_doorstairs(aware)) *ident = TRUE; return TRUE; } case EF_DETECT_INVIS: { if (detect_monsters_invis(aware)) *ident = TRUE; return TRUE; } case EF_DETECT_EVIL: { if (detect_monsters_evil(aware)) *ident = TRUE; return TRUE; } case EF_DETECT_ALL: { if (detect_all(aware)) *ident = TRUE; return TRUE; } case EF_ENCHANT_TOHIT: { *ident = TRUE; return enchant_spell(1, 0, 0); } case EF_ENCHANT_TODAM: { *ident = TRUE; return enchant_spell(0, 1, 0); } case EF_ENCHANT_WEAPON: { *ident = TRUE; return enchant_spell(randint1(3), randint1(3), 0); } case EF_ENCHANT_ARMOR: { *ident = TRUE; return enchant_spell(0, 0, 1); } case EF_ENCHANT_ARMOR2: { *ident = TRUE; return enchant_spell(0, 0, randint1(3) + 2); } case EF_RESTORE_ITEM: { *ident = TRUE; return restore_item(); } case EF_IDENTIFY: { *ident = TRUE; if (!ident_spell()) return FALSE; return TRUE; } case EF_REMOVE_CURSE: { if (remove_curse()) { if (!p_ptr->timed[TMD_BLIND]) msg("The air around your body glows blue for a moment..."); else msg("You feel as if someone is watching over you."); *ident = TRUE; } return TRUE; } case EF_REMOVE_CURSE2: { remove_all_curse(); *ident = TRUE; return TRUE; } case EF_LIGHT: { if (light_area(damroll(2, 8), 2)) *ident = TRUE; return TRUE; } case EF_SUMMON_MON: { int i; sound(MSG_SUM_MONSTER); for (i = 0; i < randint1(3); i++) { if (summon_specific(py, px, p_ptr->depth, 0, 1)) *ident = TRUE; } return TRUE; } case EF_SUMMON_UNDEAD: { int i; sound(MSG_SUM_UNDEAD); for (i = 0; i < randint1(3); i++) { if (summon_specific(py, px, p_ptr->depth, S_UNDEAD, 1)) *ident = TRUE; } return TRUE; } case EF_TELE_PHASE: { teleport_player(10); *ident = TRUE; return TRUE; } case EF_TELE_LONG: { teleport_player(100); *ident = TRUE; return TRUE; } case EF_TELE_LEVEL: { (void)teleport_player_level(); *ident = TRUE; return TRUE; } case EF_CONFUSING: { if (p_ptr->confusing == 0) { msg("Your hands begin to glow."); p_ptr->confusing = TRUE; *ident = TRUE; } return TRUE; } case EF_MAPPING: { map_area(); *ident = TRUE; return TRUE; } case EF_RUNE: { warding_glyph(); *ident = TRUE; return TRUE; } case EF_ACQUIRE: { acquirement(py, px, p_ptr->depth, 1, TRUE); *ident = TRUE; return TRUE; } case EF_ACQUIRE2: { acquirement(py, px, p_ptr->depth, randint1(2) + 1, TRUE); *ident = TRUE; return TRUE; } case EF_ANNOY_MON: { msg("There is a high pitched humming noise."); aggravate_monsters(0); *ident = TRUE; return TRUE; } case EF_CREATE_TRAP: { /* Hack -- no traps in the town */ if (p_ptr->depth == 0) return TRUE; trap_creation(); msg("You hear a low-pitched whistling sound."); *ident = TRUE; return TRUE; } case EF_DESTROY_TDOORS: { if (destroy_doors_touch()) *ident = TRUE; return TRUE; } case EF_RECHARGE: { *ident = TRUE; if (!recharge(60)) return FALSE; return TRUE; } case EF_BANISHMENT: { *ident = TRUE; if (!banishment()) return FALSE; return TRUE; } case EF_DARKNESS: { if (!check_state(OF_RES_DARK, p_ptr->state.flags)) (void)inc_timed(TMD_BLIND, 3 + randint1(5), TRUE, TRUE); unlight_area(10, 3); wieldeds_notice_flag(OF_RES_DARK); *ident = TRUE; return TRUE; } case EF_PROTEVIL: { if (inc_timed(TMD_PROTEVIL, randint1(25) + 3 * p_ptr->lev, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_SATISFY: { if (set_food(PY_FOOD_MAX - 1)) *ident = TRUE; return TRUE; } case EF_CURSE_WEAPON: { if (curse_weapon()) *ident = TRUE; return TRUE; } case EF_CURSE_ARMOR: { if (curse_armor()) *ident = TRUE; return TRUE; } case EF_BLESSING: { if (inc_timed(TMD_BLESSED, randint1(12) + 6, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_BLESSING2: { if (inc_timed(TMD_BLESSED, randint1(24) + 12, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_BLESSING3: { if (inc_timed(TMD_BLESSED, randint1(48) + 24, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_RECALL: { set_recall(); *ident = TRUE; return TRUE; } case EF_DEEP_DESCENT: { int i, target_depth = p_ptr->depth; /* Calculate target depth */ for (i = 2; i > 0; i--) { if (is_quest(target_depth)) break; if (target_depth >= MAX_DEPTH - 1) break; target_depth++; } if (target_depth > p_ptr->depth) { msgt(MSG_TPLEVEL, "You sink through the floor..."); dungeon_change_level(target_depth); *ident = TRUE; return TRUE; } else { msgt(MSG_TPLEVEL, "You sense a malevolent presence blocking passage to the levels below."); *ident = TRUE; return FALSE; } } case EF_LOSHASTE: { if (speed_monsters()) *ident = TRUE; return TRUE; } case EF_LOSSLEEP: { if (sleep_monsters(aware)) *ident = TRUE; return TRUE; } case EF_LOSSLOW: { if (slow_monsters()) *ident = TRUE; return TRUE; } case EF_LOSCONF: { if (confuse_monsters(aware)) *ident = TRUE; return TRUE; } case EF_LOSKILL: { (void)mass_banishment(); *ident = TRUE; return TRUE; } case EF_EARTHQUAKES: { earthquake(py, px, 10); *ident = TRUE; return TRUE; } case EF_DESTRUCTION2: { destroy_area(py, px, 15, TRUE); *ident = TRUE; return TRUE; } case EF_ILLUMINATION: { if (light_area(damroll(2, 15), 3)) *ident = TRUE; return TRUE; } case EF_CLAIRVOYANCE: { *ident = TRUE; wiz_light(); (void)detect_traps(TRUE); (void)detect_doorstairs(TRUE); return TRUE; } case EF_PROBING: { *ident = probing(); return TRUE; } case EF_STONE_TO_MUD: { if (wall_to_mud(dir)) *ident = TRUE; return TRUE; } case EF_CONFUSE2: { *ident = TRUE; confuse_monster(dir, 20, aware); return TRUE; } case EF_BIZARRE: { *ident = TRUE; ring_of_power(dir); return TRUE; } case EF_STAR_BALL: { int i; *ident = TRUE; for (i = 0; i < 8; i++) fire_ball(GF_ELEC, ddd[i], (150 * (100 + boost) / 100), 3); return TRUE; } case EF_RAGE_BLESS_RESIST: { dur = randint1(50) + 50; *ident = TRUE; (void)hp_player(30); (void)clear_timed(TMD_AFRAID, TRUE); (void)inc_timed(TMD_BOLD, dur, TRUE, TRUE); (void)inc_timed(TMD_SHERO, dur, TRUE, TRUE); (void)inc_timed(TMD_BLESSED, randint1(50) + 50, TRUE, TRUE); (void)inc_timed(TMD_OPP_ACID, randint1(50) + 50, TRUE, TRUE); (void)inc_timed(TMD_OPP_ELEC, randint1(50) + 50, TRUE, TRUE); (void)inc_timed(TMD_OPP_FIRE, randint1(50) + 50, TRUE, TRUE); (void)inc_timed(TMD_OPP_COLD, randint1(50) + 50, TRUE, TRUE); (void)inc_timed(TMD_OPP_POIS, randint1(50) + 50, TRUE, TRUE); return TRUE; } case EF_SLEEPII: { *ident = TRUE; sleep_monsters_touch(aware); return TRUE; } case EF_RESTORE_LIFE: { *ident = TRUE; restore_level(); return TRUE; } case EF_MISSILE: { *ident = TRUE; dam = damroll(3, 4) * (100 + boost) / 100; fire_bolt_or_beam(beam, GF_MISSILE, dir, dam); return TRUE; } case EF_DISPEL_EVIL: { *ident = TRUE; dam = p_ptr->lev * 5 * (100 + boost) / 100; dispel_evil(dam); return TRUE; } case EF_DISPEL_EVIL60: { dam = 60 * (100 + boost) / 100; if (dispel_evil(dam)) *ident = TRUE; return TRUE; } case EF_DISPEL_UNDEAD: { dam = 60 * (100 + boost) / 100; if (dispel_undead(dam)) *ident = TRUE; return TRUE; } case EF_DISPEL_ALL: { dam = 120 * (100 + boost) / 100; if (dispel_monsters(dam)) *ident = TRUE; return TRUE; } case EF_HASTE: { if (!p_ptr->timed[TMD_FAST]) { if (set_timed(TMD_FAST, damroll(2, 10) + 20, TRUE)) *ident = TRUE; } else { (void)inc_timed(TMD_FAST, 5, TRUE, TRUE); } return TRUE; } case EF_HASTE1: { if (!p_ptr->timed[TMD_FAST]) { if (set_timed(TMD_FAST, randint1(20) + 20, TRUE)) *ident = TRUE; } else { (void)inc_timed(TMD_FAST, 5, TRUE, TRUE); } return TRUE; } case EF_HASTE2: { if (!p_ptr->timed[TMD_FAST]) { if (set_timed(TMD_FAST, randint1(75) + 75, TRUE)) *ident = TRUE; } else { (void)inc_timed(TMD_FAST, 5, TRUE, TRUE); } return TRUE; } case EF_FIRE_BOLT: { *ident = TRUE; dam = damroll(9, 8) * (100 + boost) / 100; fire_bolt(GF_FIRE, dir, dam); return TRUE; } case EF_FIRE_BOLT2: { dam = damroll(12, 8) * (100 + boost) / 100; fire_bolt_or_beam(beam, GF_FIRE, dir, dam); *ident = TRUE; return TRUE; } case EF_FIRE_BOLT3: { dam = damroll(16, 8) * (100 + boost) / 100; fire_bolt_or_beam(beam, GF_FIRE, dir, dam); *ident = TRUE; return TRUE; } case EF_FIRE_BOLT72: { dam = 72 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_FIRE, dir, dam, 2); return TRUE; } case EF_FIRE_BALL: { dam = 144 * (100 + boost) / 100; fire_ball(GF_FIRE, dir, dam, 2); *ident = TRUE; return TRUE; } case EF_FIRE_BALL2: { dam = 120 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_FIRE, dir, dam, 3); return TRUE; } case EF_FIRE_BALL200: { dam = 200 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_FIRE, dir, dam, 3); return TRUE; } case EF_COLD_BOLT: { dam = damroll(6, 8) * (100 + boost) / 100; *ident = TRUE; fire_bolt_or_beam(beam, GF_COLD, dir, dam); return TRUE; } case EF_COLD_BOLT2: { dam = damroll(12, 8) * (100 + boost) / 100; *ident = TRUE; fire_bolt(GF_COLD, dir, dam); return TRUE; } case EF_COLD_BALL2: { dam = 200 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_COLD, dir, dam, 3); return TRUE; } case EF_COLD_BALL50: { dam = 50 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_COLD, dir, dam, 2); return TRUE; } case EF_COLD_BALL100: { dam = 100 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_COLD, dir, dam, 2); return TRUE; } case EF_COLD_BALL160: { dam = 160 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_COLD, dir, dam, 3); return TRUE; } case EF_ACID_BOLT: { dam = damroll(5, 8) * (100 + boost) / 100; *ident = TRUE; fire_bolt(GF_ACID, dir, dam); return TRUE; } case EF_ACID_BOLT2: { dam = damroll(10, 8) * (100 + boost) / 100; fire_bolt_or_beam(beam, GF_ACID, dir, dam); *ident = TRUE; return TRUE; } case EF_ACID_BOLT3: { dam = damroll(12, 8) * (100 + boost) / 100; fire_bolt_or_beam(beam, GF_ACID, dir, dam); *ident = TRUE; return TRUE; } case EF_ACID_BALL: { dam = 120 * (100 + boost) / 100; fire_ball(GF_ACID, dir, dam, 2); *ident = TRUE; return TRUE; } case EF_ELEC_BOLT: { dam = damroll(6, 6) * (100 + boost) / 100; *ident = TRUE; fire_beam(GF_ELEC, dir, dam); return TRUE; } case EF_ELEC_BALL: { dam = 64 * (100 + boost) / 100; fire_ball(GF_ELEC, dir, dam, 2); *ident = TRUE; return TRUE; } case EF_ELEC_BALL2: { dam = 250 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_ELEC, dir, dam, 3); return TRUE; } case EF_ARROW: { dam = 150 * (100 + boost) / 100; *ident = TRUE; fire_bolt(GF_ARROW, dir, dam); return TRUE; } case EF_REM_FEAR_POIS: { *ident = TRUE; (void)clear_timed(TMD_AFRAID, TRUE); (void)clear_timed(TMD_POISONED, TRUE); return TRUE; } case EF_STINKING_CLOUD: { dam = 12 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_POIS, dir, dam, 3); return TRUE; } case EF_DRAIN_LIFE1: { dam = 90 * (100 + boost) / 100; if (drain_life(dir, dam)) *ident = TRUE; return TRUE; } case EF_DRAIN_LIFE2: { dam = 120 * (100 + boost) / 100; if (drain_life(dir, dam)) *ident = TRUE; return TRUE; } case EF_DRAIN_LIFE3: { dam = 150 * (100 + boost) / 100; if (drain_life(dir, dam)) *ident = TRUE; return TRUE; } case EF_DRAIN_LIFE4: { dam = 250 * (100 + boost) / 100; if (drain_life(dir, dam)) *ident = TRUE; return TRUE; } case EF_FIREBRAND: { *ident = TRUE; if (!brand_bolts()) return FALSE; return TRUE; } case EF_MANA_BOLT: { dam = damroll(12, 8) * (100 + boost) / 100; fire_bolt(GF_MANA, dir, dam); *ident = TRUE; return TRUE; } case EF_MON_HEAL: { if (heal_monster(dir)) *ident = TRUE; return TRUE; } case EF_MON_HASTE: { if (speed_monster(dir)) *ident = TRUE; return TRUE; } case EF_MON_SLOW: { if (slow_monster(dir)) *ident = TRUE; return TRUE; } case EF_MON_CONFUSE: { if (confuse_monster(dir, 10, aware)) *ident = TRUE; return TRUE; } case EF_MON_SLEEP: { if (sleep_monster(dir, aware)) *ident = TRUE; return TRUE; } case EF_MON_CLONE: { if (clone_monster(dir)) *ident = TRUE; return TRUE; } case EF_MON_SCARE: { if (fear_monster(dir, 10, aware)) *ident = TRUE; return TRUE; } case EF_LIGHT_LINE: { msg("A line of shimmering blue light appears."); light_line(dir); *ident = TRUE; return TRUE; } case EF_TELE_OTHER: { if (teleport_monster(dir)) *ident = TRUE; return TRUE; } case EF_DISARMING: { if (disarm_trap(dir)) *ident = TRUE; return TRUE; } case EF_TDOOR_DEST: { if (destroy_door(dir)) *ident = TRUE; return TRUE; } case EF_POLYMORPH: { if (poly_monster(dir)) *ident = TRUE; return TRUE; } case EF_STARLIGHT: { int i; if (!p_ptr->timed[TMD_BLIND]) msg("Light shoots in all directions!"); for (i = 0; i < 8; i++) light_line(ddd[i]); *ident = TRUE; return TRUE; } case EF_STARLIGHT2: { int k; for (k = 0; k < 8; k++) strong_light_line(ddd[k]); *ident = TRUE; return TRUE; } case EF_BERSERKER: { dur = randint1(50) + 50; if (inc_timed(TMD_BOLD, dur, TRUE, TRUE)) *ident = TRUE; if (inc_timed(TMD_SHERO, dur, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_WONDER: { if (effect_wonder(dir, randint1(100) + p_ptr->lev / 5, beam)) *ident = TRUE; return TRUE; } case EF_WAND_BREATH: { /* table of random ball effects and their damages */ const int breath_types[] = { GF_ACID, 200, GF_ELEC, 160, GF_FIRE, 200, GF_COLD, 160, GF_POIS, 120 }; /* pick a random (type, damage) tuple in the table */ int which = 2 * randint0(sizeof(breath_types) / (2 * sizeof(int))); fire_ball(breath_types[which], dir, breath_types[which + 1], 3); *ident = TRUE; return TRUE; } case EF_STAFF_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("Your feel your head clear."); p_ptr->redraw |= (PR_MANA); } return TRUE; } case EF_STAFF_HOLY: { dam = 120 * (100 + boost) / 100; if (dispel_evil(dam)) *ident = TRUE; if (inc_timed(TMD_PROTEVIL, randint1(25) + 3 * p_ptr->lev, TRUE, TRUE)) *ident = TRUE; if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE; if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE; if (hp_player(50)) *ident = TRUE; if (clear_timed(TMD_STUN, TRUE)) *ident = TRUE; if (clear_timed(TMD_CUT, TRUE)) *ident = TRUE; return TRUE; } case EF_DRINK_BREATH: { const int breath_types[] = { GF_FIRE, 80, GF_COLD, 80, }; int which = 2 * randint0(N_ELEMENTS(breath_types) / 2); fire_ball(breath_types[which], dir, breath_types[which + 1], 2); *ident = TRUE; return TRUE; } case EF_DRINK_GOOD: { msg("You feel less thirsty."); *ident = TRUE; return TRUE; } case EF_DRINK_DEATH: { msg("A feeling of Death flows through your body."); take_hit(5000, "a potion of Death"); *ident = TRUE; return TRUE; } case EF_DRINK_RUIN: { msg("Your nerves and muscles feel weak and lifeless!"); take_hit(damroll(10, 10), "a potion of Ruination"); player_stat_dec(p_ptr, A_DEX, TRUE); player_stat_dec(p_ptr, A_WIS, TRUE); player_stat_dec(p_ptr, A_CON, TRUE); player_stat_dec(p_ptr, A_STR, TRUE); player_stat_dec(p_ptr, A_CHR, TRUE); player_stat_dec(p_ptr, A_INT, TRUE); *ident = TRUE; return TRUE; } case EF_DRINK_DETONATE: { msg("Massive explosions rupture your body!"); take_hit(damroll(50, 20), "a potion of Detonation"); (void)inc_timed(TMD_STUN, 75, TRUE, TRUE); (void)inc_timed(TMD_CUT, 5000, TRUE, TRUE); *ident = TRUE; return TRUE; } case EF_DRINK_SALT: { msg("The potion makes you vomit!"); (void)set_food(PY_FOOD_STARVE - 1); (void)clear_timed(TMD_POISONED, TRUE); (void)inc_timed(TMD_PARALYZED, 4, TRUE, FALSE); *ident = TRUE; return TRUE; } case EF_FOOD_GOOD: { msg("That tastes good."); *ident = TRUE; return TRUE; } case EF_FOOD_WAYBREAD: { msg("That tastes good."); (void)clear_timed(TMD_POISONED, TRUE); (void)hp_player(damroll(4, 8)); *ident = TRUE; return TRUE; } case EF_SHROOM_EMERGENCY: { (void)set_timed(TMD_IMAGE, rand_spread(250, 50), TRUE); (void)set_timed(TMD_OPP_FIRE, rand_spread(30, 10), TRUE); (void)set_timed(TMD_OPP_COLD, rand_spread(30, 10), TRUE); (void)hp_player(200); *ident = TRUE; return TRUE; } case EF_SHROOM_TERROR: { if (set_timed(TMD_TERROR, rand_spread(100, 20), TRUE)) *ident = TRUE; return TRUE; } case EF_SHROOM_STONE: { if (set_timed(TMD_STONESKIN, rand_spread(80, 20), TRUE)) *ident = TRUE; return TRUE; } case EF_SHROOM_DEBILITY: { int stat = one_in_(2) ? A_STR : A_CON; if (p_ptr->csp < p_ptr->msp) { p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; msg("Your feel your head clear."); p_ptr->redraw |= (PR_MANA); *ident = TRUE; } (void)do_dec_stat(stat, FALSE); *ident = TRUE; return TRUE; } case EF_SHROOM_SPRINTING: { if (inc_timed(TMD_SPRINT, 100, TRUE, TRUE)) *ident = TRUE; return TRUE; } case EF_SHROOM_PURGING: { (void)set_food(PY_FOOD_FAINT - 1); if (do_res_stat(A_STR)) *ident = TRUE; if (do_res_stat(A_CON)) *ident = TRUE; if (clear_timed(TMD_POISONED, TRUE)) *ident = TRUE; return TRUE; } case EF_RING_ACID: { dam = 70 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_ACID, dir, dam, 2); inc_timed(TMD_OPP_ACID, randint1(20) + 20, TRUE, TRUE); return TRUE; } case EF_RING_FLAMES: { dam = 80 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_FIRE, dir, dam, 2); inc_timed(TMD_OPP_FIRE, randint1(20) + 20, TRUE, TRUE); return TRUE; } case EF_RING_ICE: { dam = 75 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_COLD, dir, dam, 2); inc_timed(TMD_OPP_COLD, randint1(20) + 20, TRUE, TRUE); return TRUE; } case EF_RING_LIGHTNING: { dam = 85 * (100 + boost) / 100; *ident = TRUE; fire_ball(GF_ELEC, dir, dam, 2); inc_timed(TMD_OPP_ELEC, randint1(20) + 20, TRUE, TRUE); return TRUE; } case EF_DRAGON_BLUE: { dam = 100 * (100 + boost) / 100; msgt(MSG_BR_ELEC, "You breathe lightning."); fire_ball(GF_ELEC, dir, dam, 2); return TRUE; } case EF_DRAGON_GREEN: { dam = 150 * (100 + boost) / 100; msgt(MSG_BR_GAS, "You breathe poison gas."); fire_ball(GF_POIS, dir, dam, 2); return TRUE; } case EF_DRAGON_RED: { dam = 200 * (100 + boost) / 100; msgt(MSG_BR_FIRE, "You breathe fire."); fire_ball(GF_FIRE, dir, dam, 2); return TRUE; } case EF_DRAGON_MULTIHUED: { static const struct { int msg_sound; const char *msg; int typ; } mh[] = { { MSG_BR_ELEC, "lightning", GF_ELEC }, { MSG_BR_FROST, "frost", GF_COLD }, { MSG_BR_ACID, "acid", GF_ACID }, { MSG_BR_GAS, "poison gas", GF_POIS }, { MSG_BR_FIRE, "fire", GF_FIRE } }; int chance = randint0(5); dam = 250 * (100 + boost) / 100; msgt(mh[chance].msg_sound, "You breathe %s.", mh[chance].msg); fire_ball(mh[chance].typ, dir, dam, 2); return TRUE; } case EF_DRAGON_BRONZE: { dam = 120 * (100 + boost) / 100; msgt(MSG_BR_CONF, "You breathe confusion."); fire_ball(GF_CONFU, dir, dam, 2); return TRUE; } case EF_DRAGON_GOLD: { dam = 130 * (100 + boost) / 100; msgt(MSG_BR_SOUND, "You breathe sound."); fire_ball(GF_SOUND, dir, dam, 2); return TRUE; } case EF_DRAGON_CHAOS: { dam = 220 * (100 + boost) / 100; chance = randint0(2); msgt((chance == 1 ? MSG_BR_CHAOS : MSG_BR_DISEN), "You breathe %s.", ((chance == 1 ? "chaos" : "disenchantment"))); fire_ball((chance == 1 ? GF_CHAOS : GF_DISEN), dir, dam, 2); return TRUE; } case EF_DRAGON_LAW: { dam = 230 * (100 + boost) / 100; chance = randint0(2); msgt((chance == 1 ? MSG_BR_SOUND : MSG_BR_SHARDS), "You breathe %s.", ((chance == 1 ? "sound" : "shards"))); fire_ball((chance == 1 ? GF_SOUND : GF_SHARD), dir, dam, 2); return TRUE; } case EF_DRAGON_BALANCE: { dam = 250 * (100 + boost) / 100; chance = randint0(4); msg("You breathe %s.", ((chance == 1) ? "chaos" : ((chance == 2) ? "disenchantment" : ((chance == 3) ? "sound" : "shards")))); fire_ball(((chance == 1) ? GF_CHAOS : ((chance == 2) ? GF_DISEN : ((chance == 3) ? GF_SOUND : GF_SHARD))), dir, dam, 2); return TRUE; } case EF_DRAGON_SHINING: { dam = 200 * (100 + boost) / 100; chance = randint0(2); msgt((chance == 0 ? MSG_BR_LIGHT : MSG_BR_DARK), "You breathe %s.", ((chance == 0 ? "light" : "darkness"))); fire_ball((chance == 0 ? GF_LIGHT : GF_DARK), dir, dam, 2); return TRUE; } case EF_DRAGON_POWER: { dam = 300 * (100 + boost) / 100; msgt(MSG_BR_ELEMENTS, "You breathe the elements."); fire_ball(GF_MISSILE, dir, dam, 2); return TRUE; } case EF_TRAP_DOOR: { msg("You fall through a trap door!"); if (check_state(OF_FEATHER, p_ptr->state.flags)) { msg("You float gently down to the next level."); } else { take_hit(damroll(2, 8), "a trap"); } wieldeds_notice_flag(OF_FEATHER); dungeon_change_level(p_ptr->depth + 1); return TRUE; } case EF_TRAP_PIT: { msg("You fall into a pit!"); if (check_state(OF_FEATHER, p_ptr->state.flags)) { msg("You float gently to the bottom of the pit."); } else { take_hit(damroll(2, 6), "a trap"); } wieldeds_notice_flag(OF_FEATHER); return TRUE; } case EF_TRAP_PIT_SPIKES: { msg("You fall into a spiked pit!"); if (check_state(OF_FEATHER, p_ptr->state.flags)) { msg("You float gently to the floor of the pit."); msg("You carefully avoid touching the spikes."); } else { int dam = damroll(2, 6); /* Extra spike damage */ if (one_in_(2)) { msg("You are impaled!"); dam *= 2; (void)inc_timed(TMD_CUT, randint1(dam), TRUE, TRUE); } take_hit(dam, "a trap"); } wieldeds_notice_flag(OF_FEATHER); return TRUE; } case EF_TRAP_PIT_POISON: { msg("You fall into a spiked pit!"); if (check_state(OF_FEATHER, p_ptr->state.flags)) { msg("You float gently to the floor of the pit."); msg("You carefully avoid touching the spikes."); } else { int dam = damroll(2, 6); /* Extra spike damage */ if (one_in_(2)) { msg("You are impaled on poisonous spikes!"); (void)inc_timed(TMD_CUT, randint1(dam * 2), TRUE, TRUE); (void)inc_timed(TMD_POISONED, randint1(dam * 4), TRUE, TRUE); } take_hit(dam, "a trap"); } wieldeds_notice_flag(OF_FEATHER); return TRUE; } case EF_TRAP_RUNE_SUMMON: { int i; int num = 2 + randint1(3); msgt(MSG_SUM_MONSTER, "You are enveloped in a cloud of smoke!"); /* Remove trap */ cave->info[py][px] &= ~(CAVE_MARK); cave_set_feat(cave, py, px, FEAT_FLOOR); for (i = 0; i < num; i++) (void)summon_specific(py, px, p_ptr->depth, 0, 1); break; } case EF_TRAP_RUNE_TELEPORT: { msg("You hit a teleport trap!"); teleport_player(100); return TRUE; } case EF_TRAP_SPOT_FIRE: { int dam; msg("You are enveloped in flames!"); dam = damroll(4, 6); dam = adjust_dam(GF_FIRE, dam, RANDOMISE, check_for_resist(GF_FIRE, p_ptr->state.flags, TRUE)); if (dam) { take_hit(dam, "a fire trap"); inven_damage(GF_FIRE, MIN(dam * 5, 300)); } return TRUE; } case EF_TRAP_SPOT_ACID: { int dam; msg("You are splashed with acid!"); dam = damroll(4, 6); dam = adjust_dam(GF_ACID, dam, RANDOMISE, check_for_resist(GF_ACID, p_ptr->state.flags, TRUE)); if (dam) { take_hit(dam, "an acid trap"); inven_damage(GF_ACID, MIN(dam * 5, 300)); } return TRUE; } case EF_TRAP_DART_SLOW: { if (trap_check_hit(125)) { msg("A small dart hits you!"); take_hit(damroll(1, 4), "a trap"); (void)inc_timed(TMD_SLOW, randint0(20) + 20, TRUE, FALSE); } else { msg("A small dart barely misses you."); } return TRUE; } case EF_TRAP_DART_LOSE_STR: { if (trap_check_hit(125)) { msg("A small dart hits you!"); take_hit(damroll(1, 4), "a trap"); (void)do_dec_stat(A_STR, FALSE); } else { msg("A small dart barely misses you."); } return TRUE; } case EF_TRAP_DART_LOSE_DEX: { if (trap_check_hit(125)) { msg("A small dart hits you!"); take_hit(damroll(1, 4), "a trap"); (void)do_dec_stat(A_DEX, FALSE); } else { msg("A small dart barely misses you."); } return TRUE; } case EF_TRAP_DART_LOSE_CON: { if (trap_check_hit(125)) { msg("A small dart hits you!"); take_hit(damroll(1, 4), "a trap"); (void)do_dec_stat(A_CON, FALSE); } else { msg("A small dart barely misses you."); } return TRUE; } case EF_TRAP_GAS_BLIND: { msg("You are surrounded by a black gas!"); (void)inc_timed(TMD_BLIND, randint0(50) + 25, TRUE, TRUE); return TRUE; } case EF_TRAP_GAS_CONFUSE: { msg("You are surrounded by a gas of scintillating colors!"); (void)inc_timed(TMD_CONFUSED, randint0(20) + 10, TRUE, TRUE); return TRUE; } case EF_TRAP_GAS_POISON: { msg("You are surrounded by a pungent green gas!"); (void)inc_timed(TMD_POISONED, randint0(20) + 10, TRUE, TRUE); return TRUE; } case EF_TRAP_GAS_SLEEP: { msg("You are surrounded by a strange white mist!"); (void)inc_timed(TMD_PARALYZED, randint0(10) + 5, TRUE, TRUE); return TRUE; } case EF_XXX: case EF_MAX: break; } /* Not used */ msg("Effect not handled."); return FALSE; }
static bool eat_food(object_type *o_ptr, bool *ident) { /* Analyze the food */ switch (o_ptr->sval) { case SV_FOOD_POISON: { if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) { if (set_poisoned(p_ptr->poisoned + rand_int(10) + 10)) { *ident = TRUE; } } break; } case SV_FOOD_BLINDNESS: { if (!p_ptr->resist_blind) { if (set_blind(p_ptr->blind + rand_int(200) + 200)) { *ident = TRUE; } } break; } case SV_FOOD_PARANOIA: { if (!p_ptr->resist_fear) { if (set_afraid(p_ptr->afraid + rand_int(10) + 10)) { *ident = TRUE; } } break; } case SV_FOOD_CONFUSION: { if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + rand_int(10) + 10)) { *ident = TRUE; } } break; } case SV_FOOD_HALLUCINATION: { if (!p_ptr->resist_chaos) { if (set_image(p_ptr->image + rand_int(250) + 250)) { *ident = TRUE; } } break; } case SV_FOOD_PARALYSIS: { if (!p_ptr->free_act) { if (set_paralyzed(p_ptr->paralyzed + rand_int(10) + 10)) { *ident = TRUE; } } break; } case SV_FOOD_WEAKNESS: { take_hit(damroll(6, 6), "poisonous food"); (void)do_dec_stat(A_STR); *ident = TRUE; break; } case SV_FOOD_SICKNESS: { take_hit(damroll(6, 6), "poisonous food"); (void)do_dec_stat(A_CON); *ident = TRUE; break; } case SV_FOOD_STUPIDITY: { take_hit(damroll(8, 8), "poisonous food"); (void)do_dec_stat(A_INT); *ident = TRUE; break; } case SV_FOOD_NAIVETY: { take_hit(damroll(8, 8), "poisonous food"); (void)do_dec_stat(A_WIS); *ident = TRUE; break; } case SV_FOOD_UNHEALTH: { take_hit(damroll(10, 10), "poisonous food"); (void)do_dec_stat(A_CON); *ident = TRUE; break; } case SV_FOOD_DISEASE: { take_hit(damroll(10, 10), "poisonous food"); (void)do_dec_stat(A_STR); *ident = TRUE; break; } case SV_FOOD_CURE_POISON: { if (set_poisoned(0)) *ident = TRUE; break; } case SV_FOOD_CURE_BLINDNESS: { if (set_blind(0)) *ident = TRUE; break; } case SV_FOOD_CURE_PARANOIA: { if (set_afraid(0)) *ident = TRUE; break; } case SV_FOOD_CURE_CONFUSION: { if (set_confused(0)) *ident = TRUE; break; } case SV_FOOD_CURE_SERIOUS: { if (hp_player(damroll(4, 8))) *ident = TRUE; break; } case SV_FOOD_RESTORE_STR: { if (do_res_stat(A_STR)) *ident = TRUE; break; } case SV_FOOD_RESTORE_CON: { if (do_res_stat(A_CON)) *ident = TRUE; break; } case SV_FOOD_RESTORING: { 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_FOOD_RATION: case SV_FOOD_BISCUIT: case SV_FOOD_JERKY: case SV_FOOD_SLIME_MOLD: { msg_print("That tastes good."); *ident = TRUE; break; } case SV_FOOD_WAYBREAD: { msg_print("That tastes good."); (void)set_poisoned(0); (void)hp_player(damroll(4, 8)); *ident = TRUE; break; } case SV_FOOD_PINT_OF_ALE: case SV_FOOD_PINT_OF_WINE: { msg_print("That tastes good."); *ident = TRUE; break; } } /* Food can feed the player */ (void)set_food(p_ptr->food + o_ptr->pval); 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; } }
/* * Activate a wielded object. Wielded objects never stack. * And even if they did, activatable objects never stack. * * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated. * But one could, for example, easily make an activatable "Ring of Plasma". * * Note that it always takes a turn to activate an artifact, even if * the user hits "escape" at the "direction" prompt. */ static bool activate_object(object_type *o_ptr, bool *ident) { int k, dir, i, chance; /* Check the recharge */ if (o_ptr->timeout) { msg_print("It whines, glows and fades..."); return FALSE; } /* Activate the artifact */ message(MSG_ZAP, 0, "You activate it..."); /* Artifacts */ if (o_ptr->name1) { artifact_type *a_ptr = &a_info[o_ptr->name1]; char o_name[80]; /* Get the basic name of the object */ object_desc(o_name, sizeof(o_name), o_ptr, FALSE, 0); switch (a_ptr->activation) { case ACT_ILLUMINATION: { msg_format("The %s wells with clear light...", o_name); lite_area(damroll(2, 15), 3); break; } case ACT_MAGIC_MAP: { msg_format("The %s shines brightly...", o_name); map_area(); break; } case ACT_CLAIRVOYANCE: { msg_format("The %s glows a deep green...", o_name); wiz_lite(); (void)detect_traps(); (void)detect_doors(); (void)detect_stairs(); break; } case ACT_PROT_EVIL: { msg_format("The %s lets out a shrill wail...", o_name); k = 3 * p_ptr->lev; (void)set_protevil(p_ptr->protevil + randint(25) + k); break; } case ACT_DISP_EVIL: { msg_format("The %s floods the area with goodness...", o_name); dispel_evil(p_ptr->lev * 5); break; } case ACT_HASTE2: { msg_format("The %s glows brightly...", o_name); if (!p_ptr->fast) { (void)set_fast(randint(75) + 75); } else { (void)set_fast(p_ptr->fast + 5); } break; } case ACT_FIRE3: { msg_format("The %s glows deep red...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_ball(GF_FIRE, dir, 120, 3); break; } case ACT_FROST5: { msg_format("The %s glows bright white...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_ball(GF_COLD, dir, 200, 3); break; } case ACT_ELEC2: { msg_format("The %s glows deep blue...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_ball(GF_ELEC, dir, 250, 3); break; } case ACT_BIZZARE: { msg_format("The %s glows intensely black...", o_name); if (!get_aim_dir(&dir)) return FALSE; ring_of_power(dir); break; } case ACT_STAR_BALL: { msg_format("Your %s is surrounded by lightning...", o_name); for (i = 0; i < 8; i++) fire_ball(GF_ELEC, ddd[i], 150, 3); break; } case ACT_RAGE_BLESS_RESIST: { msg_format("Your %s glows many colours...", o_name); (void)hp_player(30); (void)set_afraid(0); (void)set_shero(p_ptr->shero + randint(50) + 50); (void)set_blessed(p_ptr->blessed + randint(50) + 50); (void)set_oppose_acid(p_ptr->oppose_acid + randint(50) + 50); (void)set_oppose_elec(p_ptr->oppose_elec + randint(50) + 50); (void)set_oppose_fire(p_ptr->oppose_fire + randint(50) + 50); (void)set_oppose_cold(p_ptr->oppose_cold + randint(50) + 50); (void)set_oppose_pois(p_ptr->oppose_pois + randint(50) + 50); break; } case ACT_HEAL2: { msg_format("Your %s glows a bright white...", o_name); msg_print("You feel much better..."); (void)hp_player(1000); (void)set_cut(0); break; } case ACT_PHASE: { msg_format("Your %s twists space around you...", o_name); teleport_player(10); break; } case ACT_BANISHMENT: { msg_format("Your %s glows deep blue...", o_name); (void)banishment(); break; } case ACT_TRAP_DOOR_DEST: { msg_format("Your %s glows bright red...", o_name); destroy_doors_touch(); break; } case ACT_DETECT: { msg_format("Your %s glows bright white...", o_name); msg_print("An image forms in your mind..."); detect_all(); break; } case ACT_HEAL1: { msg_format("Your %s glows deep blue...", o_name); msg_print("You feel a warm tingling inside..."); (void)hp_player(500); (void)set_cut(0); break; } case ACT_RESIST: { msg_format("Your %s glows many colours...", o_name); (void)set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20); (void)set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20); (void)set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20); (void)set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20); (void)set_oppose_pois(p_ptr->oppose_pois + randint(20) + 20); break; } case ACT_SLEEP: { msg_format("Your %s glows deep blue...", o_name); sleep_monsters_touch(); break; } case ACT_RECHARGE1: { msg_format("Your %s glows bright yellow...", o_name); recharge(60); break; } case ACT_TELEPORT: { msg_format("Your %s twists space around you...", o_name); teleport_player(100); break; } case ACT_RESTORE_LIFE: { msg_format("Your %s glows a deep red...", o_name); restore_level(); break; } case ACT_MISSILE: { msg_format("Your %s glows extremely brightly...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_bolt(GF_MISSILE, dir, damroll(2, 6)); break; } case ACT_FIRE1: { msg_format("Your %s is covered in fire...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_bolt(GF_FIRE, dir, damroll(9, 8)); break; } case ACT_FROST1: { msg_format("Your %s is covered in frost...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_bolt(GF_COLD, dir, damroll(6, 8)); break; } case ACT_LIGHTNING_BOLT: { msg_format("Your %s is covered in sparks...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_bolt(GF_ELEC, dir, damroll(4, 8)); break; } case ACT_ACID1: { msg_format("Your %s is covered in acid...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_bolt(GF_ACID, dir, damroll(5, 8)); break; } case ACT_ARROW: { msg_format("Your %s grows magical spikes...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_bolt(GF_ARROW, dir, 150); break; } case ACT_HASTE1: { msg_format("Your %s glows bright green...", o_name); if (!p_ptr->fast) { (void)set_fast(randint(20) + 20); } else { (void)set_fast(p_ptr->fast + 5); } break; } case ACT_REM_FEAR_POIS: { msg_format("Your %s glows deep blue...", o_name); (void)set_afraid(0); (void)set_poisoned(0); break; } case ACT_STINKING_CLOUD: { msg_format("Your %s throbs deep green...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_ball(GF_POIS, dir, 12, 3); break; } case ACT_FROST2: { msg_format("Your %s is covered in frost...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_ball(GF_COLD, dir, 48, 2); break; } case ACT_FROST4: { msg_format("Your %s glows a pale blue...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_bolt(GF_COLD, dir, damroll(12, 8)); break; } case ACT_FROST3: { msg_format("Your %s glows a intense blue...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_ball(GF_COLD, dir, 100, 2); break; } case ACT_FIRE2: { msg_format("Your %s rages in fire...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_ball(GF_FIRE, dir, 72, 2); break; } case ACT_DRAIN_LIFE2: { msg_format("Your %s glows black...", o_name); if (!get_aim_dir(&dir)) return FALSE; drain_life(dir, 120); break; } case ACT_STONE_TO_MUD: { msg_format("Your %s pulsates...", o_name); if (!get_aim_dir(&dir)) return FALSE; wall_to_mud(dir); break; } case ACT_MASS_BANISHMENT: { msg_format("Your %s lets out a long, shrill note...", o_name); (void)mass_banishment(); break; } case ACT_CURE_WOUNDS: { msg_format("Your %s radiates deep purple...", o_name); hp_player(damroll(4, 8)); (void)set_cut((p_ptr->cut / 2) - 50); break; } case ACT_TELE_AWAY: { msg_format("Your %s glows deep red...", o_name); if (!get_aim_dir(&dir)) return FALSE; teleport_monster(dir); break; } case ACT_WOR: { msg_format("Your %s glows soft white...", o_name); set_recall(); break; } case ACT_CONFUSE: { msg_format("Your %s glows in scintillating colours...", o_name); if (!get_aim_dir(&dir)) return FALSE; confuse_monster(dir, 20); break; } case ACT_IDENTIFY: { msg_format("Your %s glows yellow...", o_name); if (!ident_spell()) return FALSE; break; } case ACT_PROBE: { msg_format("Your %s glows brightly...", o_name); probing(); break; } case ACT_DRAIN_LIFE1: { msg_format("Your %s glows white...", o_name); if (!get_aim_dir(&dir)) return FALSE; drain_life(dir, 90); break; } case ACT_FIREBRAND: { msg_format("Your %s glows deep red...", o_name); (void)brand_bolts(); break; } case ACT_STARLIGHT: { msg_format("Your %s glows with the light of a thousand stars...", o_name); for (k = 0; k < 8; k++) strong_lite_line(ddd[k]); break; } case ACT_MANA_BOLT: { msg_format("Your %s glows white...", o_name); if (!get_aim_dir(&dir)) return FALSE; fire_bolt(GF_MANA, dir, damroll(12, 8)); break; } case ACT_BERSERKER: { msg_format("Your %s glows in anger...", o_name); set_shero(p_ptr->shero + randint(50) + 50); break; } } /* Set the recharge time */ if (a_ptr->randtime) o_ptr->timeout = a_ptr->time + (byte)randint(a_ptr->randtime); else o_ptr->timeout = a_ptr->time; /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP); /* Done */ return FALSE; } /* Hack -- Dragon Scale Mail can be activated as well */ if (o_ptr->tval == TV_DRAG_ARMOR) { /* Get a direction for breathing (or abort) */ if (!get_aim_dir(&dir)) return FALSE; /* Branch on the sub-type */ switch (o_ptr->sval) { case SV_DRAGON_BLUE: { msg_print("You breathe lightning."); fire_ball(GF_ELEC, dir, 100, 2); o_ptr->timeout = rand_int(450) + 450; break; } case SV_DRAGON_WHITE: { msg_print("You breathe frost."); fire_ball(GF_COLD, dir, 110, 2); o_ptr->timeout = rand_int(450) + 450; break; } case SV_DRAGON_BLACK: { msg_print("You breathe acid."); fire_ball(GF_ACID, dir, 130, 2); o_ptr->timeout = rand_int(450) + 450; break; } case SV_DRAGON_GREEN: { msg_print("You breathe poison gas."); fire_ball(GF_POIS, dir, 150, 2); o_ptr->timeout = rand_int(450) + 450; break; } case SV_DRAGON_RED: { msg_print("You breathe fire."); fire_ball(GF_FIRE, dir, 200, 2); o_ptr->timeout = rand_int(450) + 450; break; } case SV_DRAGON_MULTIHUED: { chance = rand_int(5); msg_format("You breathe %s.", ((chance == 1) ? "lightning" : ((chance == 2) ? "frost" : ((chance == 3) ? "acid" : ((chance == 4) ? "poison gas" : "fire"))))); fire_ball(((chance == 1) ? GF_ELEC : ((chance == 2) ? GF_COLD : ((chance == 3) ? GF_ACID : ((chance == 4) ? GF_POIS : GF_FIRE)))), dir, 250, 2); o_ptr->timeout = rand_int(225) + 225; break; } case SV_DRAGON_BRONZE: { msg_print("You breathe confusion."); fire_ball(GF_CONFUSION, dir, 120, 2); o_ptr->timeout = rand_int(450) + 450; break; } case SV_DRAGON_GOLD: { msg_print("You breathe sound."); fire_ball(GF_SOUND, dir, 130, 2); o_ptr->timeout = rand_int(450) + 450; break; } case SV_DRAGON_CHAOS: { chance = rand_int(2); msg_format("You breathe %s.", ((chance == 1 ? "chaos" : "disenchantment"))); fire_ball((chance == 1 ? GF_CHAOS : GF_DISENCHANT), dir, 220, 2); o_ptr->timeout = rand_int(300) + 300; break; } case SV_DRAGON_LAW: { chance = rand_int(2); msg_format("You breathe %s.", ((chance == 1 ? "sound" : "shards"))); fire_ball((chance == 1 ? GF_SOUND : GF_SHARD), dir, 230, 2); o_ptr->timeout = rand_int(300) + 300; break; } case SV_DRAGON_BALANCE: { chance = rand_int(4); msg_format("You breathe %s.", ((chance == 1) ? "chaos" : ((chance == 2) ? "disenchantment" : ((chance == 3) ? "sound" : "shards")))); fire_ball(((chance == 1) ? GF_CHAOS : ((chance == 2) ? GF_DISENCHANT : ((chance == 3) ? GF_SOUND : GF_SHARD))), dir, 250, 2); o_ptr->timeout = rand_int(300) + 300; break; } case SV_DRAGON_SHINING: { chance = rand_int(2); msg_format("You breathe %s.", ((chance == 0 ? "light" : "darkness"))); fire_ball((chance == 0 ? GF_LITE : GF_DARK), dir, 200, 2); o_ptr->timeout = rand_int(300) + 300; break; } case SV_DRAGON_POWER: { msg_print("You breathe the elements."); fire_ball(GF_MISSILE, dir, 300, 2); o_ptr->timeout = rand_int(300) + 300; break; } } /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP); /* Success */ return FALSE; } /* Hack -- some Rings can be activated for double resist and element ball */ if (o_ptr->tval == TV_RING) { /* Get a direction for firing (or abort) */ if (!get_aim_dir(&dir)) return FALSE; /* Branch on the sub-type */ switch (o_ptr->sval) { case SV_RING_ACID: { fire_ball(GF_ACID, dir, 70, 2); set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20); o_ptr->timeout = rand_int(50) + 50; break; } case SV_RING_FLAMES: { fire_ball(GF_FIRE, dir, 80, 2); set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20); o_ptr->timeout = rand_int(50) + 50; break; } case SV_RING_ICE: { fire_ball(GF_COLD, dir, 75, 2); set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20); o_ptr->timeout = rand_int(50) + 50; break; } case SV_RING_LIGHTNING: { fire_ball(GF_ELEC, dir, 85, 2); set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20); o_ptr->timeout = rand_int(50) + 50; break; } } /* Window stuff */ p_ptr->window |= (PW_EQUIP); /* Success */ return FALSE; } /* Mistake */ msg_print("Oops. That object cannot be activated."); /* Not used up */ return (FALSE); }
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 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 cast_priest_spell(int spell, int dir) { int py = p_ptr->py; int px = p_ptr->px; int plev = p_ptr->lev; int amt; switch (spell) { case PRAYER_DETECT_EVIL: { (void)detect_monsters_evil(TRUE); break; } case PRAYER_CURE_LIGHT_WOUNDS: { (void)heal_player(15, 15); (void)dec_timed(TMD_CUT, 20, TRUE); (void)dec_timed(TMD_CONFUSED, 20, TRUE); (void)clear_timed(TMD_BLIND, TRUE); break; } case PRAYER_BLESS: { (void)inc_timed(TMD_BLESSED, randint1(12) + 12, TRUE); break; } case PRAYER_REMOVE_FEAR: { (void)clear_timed(TMD_AFRAID, TRUE); break; } case PRAYER_CALL_LIGHT: { (void)light_area(damroll(2, (plev / 2)), (plev / 10) + 1); break; } case PRAYER_FIND_TRAPS_DOORS: { (void)detect_traps(TRUE); (void)detect_doorstairs(TRUE); break; } case PRAYER_SLOW_POISON: { (void)set_timed(TMD_POISONED, p_ptr->timed[TMD_POISONED] / 2, TRUE); break; } case PRAYER_SCARE_MONSTER: { (void)fear_monster(dir, plev, TRUE); break; } case PRAYER_PORTAL: { teleport_player(plev * 3); break; } case PRAYER_CURE_SERIOUS_WOUNDS: { (void)heal_player(20, 25); (void)clear_timed(TMD_CUT, TRUE); (void)clear_timed(TMD_CONFUSED, TRUE); (void)clear_timed(TMD_BLIND, TRUE); break; } case PRAYER_CHANT: { (void)inc_timed(TMD_BLESSED, randint1(24) + 24, TRUE); break; } case PRAYER_SANCTUARY: { (void)sleep_monsters_touch(TRUE); break; } case PRAYER_SATISFY_HUNGER: { (void)set_food(PY_FOOD_MAX - 1); break; } case PRAYER_REMOVE_CURSE: { remove_curse(); break; } case PRAYER_RESIST_HEAT_COLD: { (void)inc_timed(TMD_OPP_FIRE, randint1(10) + 10, TRUE); (void)inc_timed(TMD_OPP_COLD, randint1(10) + 10, TRUE); break; } case PRAYER_NEUTRALIZE_POISON: { (void)clear_timed(TMD_POISONED, TRUE); break; } case PRAYER_ORB_OF_DRAINING: { fire_ball(GF_HOLY_ORB, dir, (damroll(3, 6) + plev + (plev / (player_has(PF_BLESS_WEAPON) ? 2 : 4))), ((plev < 30) ? 2 : 3)); break; } case PRAYER_CURE_CRITICAL_WOUNDS: { (void)heal_player(25, 30); (void)clear_timed(TMD_CUT, TRUE); (void)clear_timed(TMD_AMNESIA, TRUE); (void)clear_timed(TMD_CONFUSED, TRUE); (void)clear_timed(TMD_BLIND, TRUE); (void)clear_timed(TMD_POISONED, TRUE); (void)clear_timed(TMD_STUN, TRUE); break; } case PRAYER_SENSE_INVISIBLE: { (void)inc_timed(TMD_SINVIS, randint1(24) + 24, TRUE); break; } case PRAYER_PROTECTION_FROM_EVIL: { (void)inc_timed(TMD_PROTEVIL, randint1(25) + 3 * p_ptr->lev, TRUE); break; } case PRAYER_EARTHQUAKE: { earthquake(py, px, 10); break; } case PRAYER_SENSE_SURROUNDINGS: { map_area(); break; } case PRAYER_CURE_MORTAL_WOUNDS: { (void)heal_player(30, 50); (void)clear_timed(TMD_CUT, TRUE); (void)clear_timed(TMD_AMNESIA, TRUE); (void)clear_timed(TMD_CONFUSED, TRUE); (void)clear_timed(TMD_BLIND, TRUE); (void)clear_timed(TMD_POISONED, TRUE); (void)clear_timed(TMD_STUN, TRUE); break; } case PRAYER_TURN_UNDEAD: { (void)turn_undead(TRUE); break; } case PRAYER_PRAYER: { (void)inc_timed(TMD_BLESSED, randint1(48) + 48, TRUE); break; } case PRAYER_DISPEL_UNDEAD: { (void)dispel_undead(randint1(plev * 3)); break; } case PRAYER_HEAL: { amt = (p_ptr->mhp * 35) / 100; if (amt < 300) amt = 300; (void)hp_player(amt); (void)clear_timed(TMD_CUT, TRUE); (void)clear_timed(TMD_AMNESIA, TRUE); (void)clear_timed(TMD_CONFUSED, TRUE); (void)clear_timed(TMD_BLIND, TRUE); (void)clear_timed(TMD_POISONED, TRUE); (void)clear_timed(TMD_STUN, TRUE); break; } case PRAYER_DISPEL_EVIL: { (void)dispel_evil(randint1(plev * 3)); break; } case PRAYER_GLYPH_OF_WARDING: { warding_glyph(); break; } case PRAYER_HOLY_WORD: { (void)dispel_evil(randint1(plev * 4)); (void)hp_player(1000); (void)clear_timed(TMD_AFRAID, TRUE); (void)clear_timed(TMD_POISONED, TRUE); (void)clear_timed(TMD_STUN, TRUE); (void)clear_timed(TMD_CUT, TRUE); break; } case PRAYER_DETECT_MONSTERS: { (void)detect_monsters_normal(TRUE); break; } case PRAYER_DETECTION: { (void)detect_all(TRUE); break; } case PRAYER_PERCEPTION: { return ident_spell(); } case PRAYER_PROBING: { (void)probing(); break; } case PRAYER_CLAIRVOYANCE: { wiz_light(); break; } case PRAYER_CURE_SERIOUS_WOUNDS2: { (void)heal_player(20, 25); (void)clear_timed(TMD_CUT, TRUE); (void)clear_timed(TMD_CONFUSED, TRUE); (void)clear_timed(TMD_BLIND, TRUE); break; } case PRAYER_CURE_MORTAL_WOUNDS2: { (void)heal_player(30, 50); (void)clear_timed(TMD_CUT, TRUE); (void)clear_timed(TMD_AMNESIA, TRUE); (void)clear_timed(TMD_CONFUSED, TRUE); (void)clear_timed(TMD_BLIND, TRUE); (void)clear_timed(TMD_POISONED, TRUE); (void)clear_timed(TMD_STUN, TRUE); break; } case PRAYER_HEALING: { (void)hp_player(2000); (void)clear_timed(TMD_STUN, TRUE); (void)clear_timed(TMD_CUT, TRUE); break; } case PRAYER_RESTORATION: { (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 PRAYER_REMEMBRANCE: { (void)restore_level(); break; } case PRAYER_DISPEL_UNDEAD2: { (void)dispel_undead(randint1(plev * 4)); break; } case PRAYER_DISPEL_EVIL2: { (void)dispel_evil(randint1(plev * 4)); break; } case PRAYER_BANISH_EVIL: { if (banish_evil(100)) { msg("The power of your god banishes evil!"); } break; } case PRAYER_WORD_OF_DESTRUCTION: { destroy_area(py, px, 15, TRUE); break; } case PRAYER_ANNIHILATION: { drain_life(dir, 200); break; } case PRAYER_UNBARRING_WAYS: { (void)destroy_doors_touch(); break; } case PRAYER_RECHARGING: { return recharge(15); } case PRAYER_DISPEL_CURSE: { (void)remove_all_curse(); break; } case PRAYER_ENCHANT_WEAPON: { return enchant_spell(randint0(4) + 1, randint0(4) + 1, 0); } case PRAYER_ENCHANT_ARMOUR: { return enchant_spell(0, 0, randint0(3) + 2); } case PRAYER_ELEMENTAL_BRAND: { brand_weapon(); break; } case PRAYER_BLINK: { teleport_player(10); break; } case PRAYER_TELEPORT_SELF: { teleport_player(plev * 8); break; } case PRAYER_TELEPORT_OTHER: { (void)teleport_monster(dir); break; } case PRAYER_TELEPORT_LEVEL: { (void)teleport_player_level(); break; } case PRAYER_WORD_OF_RECALL: { set_recall(); break; } case PRAYER_ALTER_REALITY: { msg("The world changes!"); /* Leaving */ p_ptr->leaving = TRUE; break; } } /* 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]; } }