void vampire_take_light_damage(int amt) { if (!fear_save_p(amt)) { msg_print("You fear the light!"); fear_add_p(FEAR_SCARED); } if (randint1(p_ptr->chp) < amt && !res_save_default(RES_LITE)) { int k = 0; cptr act = NULL; switch (randint1(12)) { case 1: case 2: case 3: case 4: case 5: msg_print("You feel your unlife force diminish."); lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE); break; case 6: case 7: case 8: case 9: switch (randint1(6)) { case 1: k = A_STR; act = "strong"; break; case 2: k = A_INT; act = "bright"; break; case 3: k = A_WIS; act = "wise"; break; case 4: k = A_DEX; act = "agile"; break; case 5: k = A_CON; act = "hale"; break; case 6: k = A_CHR; act = "confident"; break; } msg_format("You're not as %s as you used to be.", act); p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4; if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3; break; case 10: msg_print("You're not as powerful as you used to be."); for (k = 0; k < 6; k++) { p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8; if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3; } break; case 11: case 12: if (disenchant_player()) msg_print("You feel diminished!"); break; } p_ptr->update |= PU_BONUS; } }
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; };
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); }
/* * Attack the player via physical attacks. */ bool make_attack_normal(int m_idx) { monster_type *m_ptr = &mon_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_lore *l_ptr = &l_list[m_ptr->r_idx]; int ap_cnt; int i, k, tmp, ac, rlev; int do_cut, do_stun; s32b gold; object_type *o_ptr; char o_name[80]; char m_name[80]; char ddesc[80]; bool blinked; /* Not allowed to attack */ if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return (FALSE); /* Total armor */ ac = p_ptr->ac + p_ptr->to_a; /* Extract the effective monster level */ rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); /* Get the monster name (or "it") */ monster_desc(m_name, sizeof(m_name), m_ptr, 0); /* Get the "died from" information (i.e. "a kobold") */ monster_desc(ddesc, sizeof(ddesc), m_ptr, 0x88); /* Assume no blink */ blinked = FALSE; /* Scan through all blows */ for (ap_cnt = 0; ap_cnt < MONSTER_BLOW_MAX; ap_cnt++) { bool visible = FALSE; bool obvious = FALSE; int power = 0; int damage = 0; cptr act = NULL; /* Extract the attack infomation */ int effect = r_ptr->blow[ap_cnt].effect; int method = r_ptr->blow[ap_cnt].method; int d_dice = r_ptr->blow[ap_cnt].d_dice; int d_side = r_ptr->blow[ap_cnt].d_side; /* Hack -- no more attacks */ if (!method) break; /* Handle "leaving" */ if (p_ptr->leaving) break; /* Extract visibility (before blink) */ if (m_ptr->ml) visible = TRUE; /* Extract the attack "power" */ switch (effect) { case RBE_HURT: power = 60; break; case RBE_POISON: power = 5; break; case RBE_UN_BONUS: power = 20; break; case RBE_UN_POWER: power = 15; break; case RBE_EAT_GOLD: power = 5; break; case RBE_EAT_ITEM: power = 5; break; case RBE_EAT_FOOD: power = 5; break; case RBE_EAT_LITE: power = 5; break; case RBE_ACID: power = 0; break; case RBE_ELEC: power = 10; break; case RBE_FIRE: power = 10; break; case RBE_COLD: power = 10; break; case RBE_BLIND: power = 2; break; case RBE_CONFUSE: power = 10; break; case RBE_TERRIFY: power = 10; break; case RBE_PARALYZE: power = 2; break; case RBE_LOSE_STR: power = 0; break; case RBE_LOSE_DEX: power = 0; break; case RBE_LOSE_CON: power = 0; break; case RBE_LOSE_INT: power = 0; break; case RBE_LOSE_WIS: power = 0; break; case RBE_LOSE_CHR: power = 0; break; case RBE_LOSE_ALL: power = 2; break; case RBE_SHATTER: power = 60; break; case RBE_EXP_10: power = 5; break; case RBE_EXP_20: power = 5; break; case RBE_EXP_40: power = 5; break; case RBE_EXP_80: power = 5; break; case RBE_HALLU: power = 10; break; } /* Monster hits player */ if (!effect || check_hit(power, rlev)) { /* Always disturbing */ disturb(1, 0); /* Hack -- Apply "protection from evil" */ if ((p_ptr->protevil > 0) && (r_ptr->flags3 & (RF3_EVIL)) && (p_ptr->lev >= rlev) && ((rand_int(100) + p_ptr->lev) > 50)) { /* Remember the Evil-ness */ if (m_ptr->ml) { l_ptr->flags3 |= (RF3_EVIL); } /* Message */ msg_format("%^s is repelled.", m_name); /* Hack -- Next attack */ continue; } /* Assume no cut or stun */ do_cut = do_stun = 0; /* Describe the attack method */ switch (method) { case RBM_HIT: { act = "hits you."; do_cut = do_stun = 1; break; } case RBM_TOUCH: { act = "touches you."; break; } case RBM_PUNCH: { act = "punches you."; do_stun = 1; break; } case RBM_KICK: { act = "kicks you."; do_stun = 1; break; } case RBM_CLAW: { act = "claws you."; do_cut = 1; break; } case RBM_BITE: { act = "bites you."; do_cut = 1; break; } case RBM_STING: { act = "stings you."; break; } case RBM_XXX1: { act = "XXX1's you."; break; } case RBM_BUTT: { act = "butts you."; do_stun = 1; break; } case RBM_CRUSH: { act = "crushes you."; do_stun = 1; break; } case RBM_ENGULF: { act = "engulfs you."; break; } case RBM_XXX2: { act = "XXX2's you."; break; } case RBM_CRAWL: { act = "crawls on you."; break; } case RBM_DROOL: { act = "drools on you."; break; } case RBM_SPIT: { act = "spits on you."; break; } case RBM_XXX3: { act = "XXX3's on you."; break; } case RBM_GAZE: { act = "gazes at you."; break; } case RBM_WAIL: { act = "wails at you."; break; } case RBM_SPORE: { act = "releases spores at you."; break; } case RBM_XXX4: { act = "projects XXX4's at you."; break; } case RBM_BEG: { act = "begs you for money."; break; } case RBM_INSULT: { act = desc_insult[rand_int(MAX_DESC_INSULT)]; break; } case RBM_MOAN: { act = desc_moan[rand_int(MAX_DESC_MOAN)]; break; } case RBM_XXX5: { act = "XXX5's you."; break; } } /* Message */ if (act) msg_format("%^s %s", m_name, act); /* Hack -- assume all attacks are obvious */ obvious = TRUE; /* Roll out the damage */ damage = damroll(d_dice, d_side); /* Apply appropriate damage */ switch (effect) { case 0: { /* Hack -- Assume obvious */ obvious = TRUE; /* Hack -- No damage */ damage = 0; break; } case RBE_HURT: { /* Obvious */ obvious = TRUE; /* Hack -- Player armor reduces total damage */ damage -= (damage * ((ac < 150) ? ac : 150) / 250); /* Take damage */ take_hit(damage, ddesc); break; } case RBE_POISON: { /* Take damage */ take_hit(damage, ddesc); /* Take "poison" effect */ if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) { if (set_poisoned(p_ptr->poisoned + randint(rlev) + 5)) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_POIS); break; } case RBE_UN_BONUS: { /* Take damage */ take_hit(damage, ddesc); /* Allow complete resist */ if (!p_ptr->resist_disen) { /* Apply disenchantment */ if (apply_disenchant(0)) obvious = TRUE; } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_DISEN); break; } case RBE_UN_POWER: { /* Take damage */ take_hit(damage, ddesc); /* Find an item */ for (k = 0; k < 10; k++) { /* Pick an item */ i = rand_int(INVEN_PACK); /* Obtain the item */ o_ptr = &inventory[i]; /* Skip non-objects */ if (!o_ptr->k_idx) continue; /* Drain charged wands/staffs */ if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)) && (o_ptr->pval > 0)) { /* Calculate healed hitpoints */ int heal = rlev * o_ptr->pval * o_ptr->number; /* Don't heal more than max hp */ heal = MIN(heal, m_ptr->maxhp - m_ptr->hp); /* Message */ msg_print("Energy drains from your pack!"); /* Obvious */ obvious = TRUE; /* Heal */ m_ptr->hp += heal; /* Redraw (later) if needed */ if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH); /* Uncharge */ o_ptr->pval = 0; /* Combine / Reorder the pack */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); /* Window stuff */ p_ptr->window |= (PW_INVEN); /* Done */ break; } } break; } case RBE_EAT_GOLD: { /* Take damage */ take_hit(damage, ddesc); /* Obvious */ obvious = TRUE; /* Saving throw (unless paralyzed) based on dex and level */ if (!p_ptr->paralyzed && (rand_int(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] + p_ptr->lev))) { /* Saving throw message */ msg_print("You quickly protect your money pouch!"); /* Occasional blink anyway */ if (rand_int(3)) blinked = TRUE; } /* Eat gold */ else { gold = (p_ptr->au / 10) + randint(25); if (gold < 2) gold = 2; if (gold > 5000) gold = (p_ptr->au / 20) + randint(3000); if (gold > p_ptr->au) gold = p_ptr->au; p_ptr->au -= gold; if (gold <= 0) { msg_print("Nothing was stolen."); } else if (p_ptr->au) { msg_print("Your purse feels lighter."); msg_format("%ld coins were stolen!", (long)gold); } else { msg_print("Your purse feels lighter."); msg_print("All of your coins were stolen!"); } /* Redraw gold */ p_ptr->redraw |= (PR_GOLD); /* Window stuff */ p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1); /* Blink away */ blinked = TRUE; } break; } case RBE_EAT_ITEM: { /* Take damage */ take_hit(damage, ddesc); /* Saving throw (unless paralyzed) based on dex and level */ if (!p_ptr->paralyzed && (rand_int(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] + p_ptr->lev))) { /* Saving throw message */ msg_print("You grab hold of your backpack!"); /* Occasional "blink" anyway */ blinked = TRUE; /* Obvious */ obvious = TRUE; /* Done */ break; } /* Find an item */ for (k = 0; k < 10; k++) { object_type *i_ptr; object_type object_type_body; /* Pick an item */ i = rand_int(INVEN_PACK); /* Obtain the item */ o_ptr = &inventory[i]; /* Skip non-objects */ if (!o_ptr->k_idx) continue; /* Skip artifacts */ if (artifact_p(o_ptr)) continue; /* Get a description */ object_desc(o_name, sizeof(o_name), o_ptr, FALSE, 3); /* Message */ msg_format("%sour %s (%c) was stolen!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i)); /* Get local object */ i_ptr = &object_type_body; /* Obtain local object */ object_copy(i_ptr, o_ptr); /* Modify number */ i_ptr->number = 1; /* Carry the object */ (void)monster_carry(m_idx, i_ptr); /* Steal the items */ inven_item_increase(i, -1); inven_item_optimize(i); /* Obvious */ obvious = TRUE; /* Blink away */ blinked = TRUE; /* Done */ break; } break; } case RBE_EAT_FOOD: { /* Take damage */ take_hit(damage, ddesc); /* Steal some food */ for (k = 0; k < 10; k++) { /* Pick an item from the pack */ i = rand_int(INVEN_PACK); /* Get the item */ o_ptr = &inventory[i]; /* Skip non-objects */ if (!o_ptr->k_idx) continue; /* Skip non-food objects */ if (o_ptr->tval != TV_FOOD) continue; /* Get a description */ object_desc(o_name, sizeof(o_name), o_ptr, FALSE, 0); /* Message */ msg_format("%sour %s (%c) was eaten!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i)); /* Steal the items */ inven_item_increase(i, -1); inven_item_optimize(i); /* Obvious */ obvious = TRUE; /* Done */ break; } break; } case RBE_EAT_LITE: { /* Take damage */ take_hit(damage, ddesc); /* Get the lite */ o_ptr = &inventory[INVEN_LITE]; /* Drain fuel */ if ((o_ptr->pval > 0) && (!artifact_p(o_ptr))) { /* Reduce fuel */ o_ptr->pval -= (250 + randint(250)); if (o_ptr->pval < 1) o_ptr->pval = 1; /* Notice */ if (!p_ptr->blind) { msg_print("Your light dims."); obvious = TRUE; } /* Window stuff */ p_ptr->window |= (PW_EQUIP); } break; } case RBE_ACID: { /* Obvious */ obvious = TRUE; /* Message */ msg_print("You are covered in acid!"); /* Special damage */ acid_dam(damage, ddesc); /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_ACID); break; } case RBE_ELEC: { /* Obvious */ obvious = TRUE; /* Message */ msg_print("You are struck by electricity!"); /* Take damage (special) */ elec_dam(damage, ddesc); /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_ELEC); break; } case RBE_FIRE: { /* Obvious */ obvious = TRUE; /* Message */ msg_print("You are enveloped in flames!"); /* Take damage (special) */ fire_dam(damage, ddesc); /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_FIRE); break; } case RBE_COLD: { /* Obvious */ obvious = TRUE; /* Message */ msg_print("You are covered with frost!"); /* Take damage (special) */ cold_dam(damage, ddesc); /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_COLD); break; } case RBE_BLIND: { /* Take damage */ take_hit(damage, ddesc); /* Increase "blind" */ if (!p_ptr->resist_blind) { if (set_blind(p_ptr->blind + 10 + randint(rlev))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_BLIND); break; } case RBE_CONFUSE: { /* Take damage */ take_hit(damage, ddesc); /* Increase "confused" */ if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + 3 + randint(rlev))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_CONFU); break; } case RBE_TERRIFY: { /* Take damage */ take_hit(damage, ddesc); /* Increase "afraid" */ if (p_ptr->resist_fear) { msg_print("You stand your ground!"); obvious = TRUE; } else if (rand_int(100) < p_ptr->skill_sav) { msg_print("You stand your ground!"); obvious = TRUE; } else { if (set_afraid(p_ptr->afraid + 3 + randint(rlev))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_FEAR); break; } case RBE_PARALYZE: { /* Hack -- Prevent perma-paralysis via damage */ if (p_ptr->paralyzed && (damage < 1)) damage = 1; /* Take damage */ take_hit(damage, ddesc); /* Increase "paralyzed" */ if (p_ptr->free_act) { msg_print("You are unaffected!"); obvious = TRUE; } else if (rand_int(100) < p_ptr->skill_sav) { msg_print("You resist the effects!"); obvious = TRUE; } else { if (set_paralyzed(p_ptr->paralyzed + 3 + randint(rlev))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_FREE); break; } case RBE_LOSE_STR: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_STR)) obvious = TRUE; break; } case RBE_LOSE_INT: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_INT)) obvious = TRUE; break; } case RBE_LOSE_WIS: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_WIS)) obvious = TRUE; break; } case RBE_LOSE_DEX: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_DEX)) obvious = TRUE; break; } case RBE_LOSE_CON: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_CON)) obvious = TRUE; break; } case RBE_LOSE_CHR: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stat) */ if (do_dec_stat(A_CHR)) obvious = TRUE; break; } case RBE_LOSE_ALL: { /* Take damage */ take_hit(damage, ddesc); /* Damage (stats) */ if (do_dec_stat(A_STR)) obvious = TRUE; if (do_dec_stat(A_DEX)) obvious = TRUE; if (do_dec_stat(A_CON)) obvious = TRUE; if (do_dec_stat(A_INT)) obvious = TRUE; if (do_dec_stat(A_WIS)) obvious = TRUE; if (do_dec_stat(A_CHR)) obvious = TRUE; break; } case RBE_SHATTER: { /* Obvious */ obvious = TRUE; /* Hack -- Reduce damage based on the player armor class */ damage -= (damage * ((ac < 150) ? ac : 150) / 250); /* Take damage */ take_hit(damage, ddesc); /* Radius 8 earthquake centered at the monster */ if (damage > 23) earthquake(m_ptr->fy, m_ptr->fx, 8); break; } case RBE_EXP_10: { /* Obvious */ obvious = TRUE; /* Take damage */ take_hit(damage, ddesc); if (p_ptr->hold_life && (rand_int(100) < 95)) { msg_print("You keep hold of your life force!"); } else { s32b d = damroll(10, 6) + (p_ptr->exp/100) * MON_DRAIN_LIFE; if (p_ptr->hold_life) { msg_print("You feel your life slipping away!"); lose_exp(d/10); } else { msg_print("You feel your life draining away!"); lose_exp(d); } } break; } case RBE_EXP_20: { /* Obvious */ obvious = TRUE; /* Take damage */ take_hit(damage, ddesc); if (p_ptr->hold_life && (rand_int(100) < 90)) { msg_print("You keep hold of your life force!"); } else { s32b d = damroll(20, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; if (p_ptr->hold_life) { msg_print("You feel your life slipping away!"); lose_exp(d / 10); } else { msg_print("You feel your life draining away!"); lose_exp(d); } } break; } case RBE_EXP_40: { /* Obvious */ obvious = TRUE; /* Take damage */ take_hit(damage, ddesc); if (p_ptr->hold_life && (rand_int(100) < 75)) { msg_print("You keep hold of your life force!"); } else { s32b d = damroll(40, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; if (p_ptr->hold_life) { msg_print("You feel your life slipping away!"); lose_exp(d / 10); } else { msg_print("You feel your life draining away!"); lose_exp(d); } } break; } case RBE_EXP_80: { /* Obvious */ obvious = TRUE; /* Take damage */ take_hit(damage, ddesc); if (p_ptr->hold_life && (rand_int(100) < 50)) { msg_print("You keep hold of your life force!"); } else { s32b d = damroll(80, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; if (p_ptr->hold_life) { msg_print("You feel your life slipping away!"); lose_exp(d / 10); } else { msg_print("You feel your life draining away!"); lose_exp(d); } } break; } case RBE_HALLU: { /* Take damage */ take_hit(damage, ddesc); /* Increase "image" */ if (!p_ptr->resist_chaos) { if (set_image(p_ptr->image + 3 + randint(rlev / 2))) { obvious = TRUE; } } /* Learn about the player */ update_smart_learn(m_idx, DRS_RES_CHAOS); break; } } /* Hack -- only one of cut or stun */ if (do_cut && do_stun) { /* Cancel cut */ if (rand_int(100) < 50) { do_cut = 0; } /* Cancel stun */ else { do_stun = 0; } } /* Handle cut */ if (do_cut) { int k; /* Critical hit (zero if non-critical) */ tmp = monster_critical(d_dice, d_side, damage); /* Roll for damage */ switch (tmp) { case 0: k = 0; break; case 1: k = randint(5); break; case 2: k = randint(5) + 5; break; case 3: k = randint(20) + 20; break; case 4: k = randint(50) + 50; break; case 5: k = randint(100) + 100; break; case 6: k = 300; break; default: k = 500; break; } /* Apply the cut */ if (k) (void)set_cut(p_ptr->cut + k); } /* Handle stun */ if (do_stun) { int k; /* Critical hit (zero if non-critical) */ tmp = monster_critical(d_dice, d_side, damage); /* Roll for damage */ switch (tmp) { case 0: k = 0; break; case 1: k = randint(5); break; case 2: k = randint(10) + 10; break; case 3: k = randint(20) + 20; break; case 4: k = randint(30) + 30; break; case 5: k = randint(40) + 40; break; case 6: k = 100; break; default: k = 200; break; } /* Apply the stun */ if (k) (void)set_stun(p_ptr->stun + k); } } /* Monster missed player */ else { /* Analyze failed attacks */ switch (method) { case RBM_HIT: case RBM_TOUCH: case RBM_PUNCH: case RBM_KICK: case RBM_CLAW: case RBM_BITE: case RBM_STING: case RBM_XXX1: case RBM_BUTT: case RBM_CRUSH: case RBM_ENGULF: case RBM_XXX2: /* Visible monsters */ if (m_ptr->ml) { /* Disturbing */ disturb(1, 0); /* Message */ msg_format("%^s misses you.", m_name); } break; } } /* Analyze "visible" monsters only */ if (visible) { /* Count "obvious" attacks (and ones that cause damage) */ if (obvious || damage || (l_ptr->blows[ap_cnt] > 10)) { /* Count attacks of this type */ if (l_ptr->blows[ap_cnt] < MAX_UCHAR) { l_ptr->blows[ap_cnt]++; } } } } /* Blink away */ if (blinked) { msg_print("There is a puff of smoke!"); teleport_away(m_idx, MAX_SIGHT * 2 + 5); } /* Always notice cause of death */ if (p_ptr->is_dead && (l_ptr->deaths < MAX_SHORT)) { l_ptr->deaths++; } /* Assume we attacked */ return (TRUE); }
/* 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]; } }
/* * 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; if (effect < 1 || effect > EF_MAX) { msg("Bad effect passed to do_effect(). Please report this bug."); return FALSE; } switch (effect) { case EF_POISON: { if (!p_ptr->state.flags[OF_RES_POIS]) { if (!p_ptr->timed[TMD_OPP_POIS] && inc_timed(TMD_POISONED, damroll(2, 7) + 10, TRUE)) *ident = TRUE; } *ident = TRUE; wieldeds_notice_flag(OF_RES_POIS); return TRUE; } case EF_BLIND: { if (!p_ptr->state.flags[OF_RES_BLIND]) { if (inc_timed(TMD_BLIND, damroll(4, 25) + 75, TRUE)) *ident = TRUE; } *ident = TRUE; wieldeds_notice_flag(OF_RES_BLIND); return TRUE; } case EF_SCARE: { if (!p_ptr->state.flags[OF_RES_FEAR]) { if (inc_timed(TMD_AFRAID, randint0(10) + 10, TRUE)) *ident = TRUE; } *ident = TRUE; wieldeds_notice_flag(OF_RES_FEAR); return TRUE; } case EF_CONFUSE: { if (!p_ptr->state.flags[OF_RES_CONFU]) { if (inc_timed(TMD_CONFUSED, damroll(4, 5) + 10, TRUE)) *ident = TRUE; } *ident = TRUE; wieldeds_notice_flag(OF_RES_CONFU); return TRUE; } case EF_HALLUC: { if (!p_ptr->state.flags[OF_RES_CHAOS]) { if (inc_timed(TMD_IMAGE, randint0(250) + 250, TRUE)) *ident = TRUE; } *ident = TRUE; wieldeds_notice_flag(OF_RES_CHAOS); return TRUE; } case EF_PARALYZE: { if (!p_ptr->state.flags[OF_FREE_ACT]) { if (inc_timed(TMD_PARALYZED, randint0(5) + 5, TRUE)) *ident = TRUE; } *ident = TRUE; wieldeds_notice_flag(OF_FREE_ACT); return TRUE; } case EF_SLOW: { if (inc_timed(TMD_SLOW, randint1(25) + 15, 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 (!p_ptr->state.flags[OF_RES_CONFU] && inc_timed(TMD_OPP_CONF, damroll(4, 10), 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."); gain_exp(100000L); *ident = TRUE; } return TRUE; } case EF_LOSE_EXP: { if (!p_ptr->state.flags[OF_HOLD_LIFE] && (p_ptr->exp > 0)) { msg("You feel your memories fade."); lose_exp(p_ptr->exp / 4); *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)) *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)) *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)) *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: { if (hp_player(10)) *ident = TRUE; if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE; if (inc_timed(TMD_HERO, randint1(25) + 25, TRUE)) *ident = TRUE; return TRUE; } case EF_SHERO: { if (hp_player(30)) *ident = TRUE; if (clear_timed(TMD_AFRAID, TRUE)) *ident = TRUE; if (inc_timed(TMD_SHERO, randint1(25) + 25, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_ACID: { if (inc_timed(TMD_OPP_ACID, randint1(10) + 10, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_ELEC: { if (inc_timed(TMD_OPP_ELEC, randint1(10) + 10, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_FIRE: { if (inc_timed(TMD_OPP_FIRE, randint1(10) + 10, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_COLD: { if (inc_timed(TMD_OPP_COLD, randint1(10) + 10, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_POIS: { if (inc_timed(TMD_OPP_POIS, randint1(10) + 10, TRUE)) *ident = TRUE; return TRUE; } case EF_RESIST_ALL: { if (inc_timed(TMD_OPP_ACID, randint1(20) + 20, TRUE)) *ident = TRUE; if (inc_timed(TMD_OPP_ELEC, randint1(20) + 20, TRUE)) *ident = TRUE; if (inc_timed(TMD_OPP_FIRE, randint1(20) + 20, TRUE)) *ident = TRUE; if (inc_timed(TMD_OPP_COLD, randint1(20) + 20, TRUE)) *ident = TRUE; if (inc_timed(TMD_OPP_POIS, randint1(20) + 20, 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 ((!p_ptr->state.flags[OF_RES_BLIND]) && (!p_ptr->state.flags[OF_RES_DARK])) (void)inc_timed(TMD_BLIND, 3 + randint1(5), TRUE); unlight_area(10, 3); wieldeds_notice_flag(OF_RES_BLIND); 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)) *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)) *ident = TRUE; return TRUE; } case EF_BLESSING2: { if (inc_timed(TMD_BLESSED, randint1(24) + 12, TRUE)) *ident = TRUE; return TRUE; } case EF_BLESSING3: { if (inc_timed(TMD_BLESSED, randint1(48) + 24, 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; } 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: { *ident = TRUE; (void)hp_player(30); (void)clear_timed(TMD_AFRAID, TRUE); (void)inc_timed(TMD_SHERO, randint1(50) + 50, TRUE); (void)inc_timed(TMD_BLESSED, randint1(50) + 50, TRUE); (void)inc_timed(TMD_OPP_ACID, randint1(50) + 50, TRUE); (void)inc_timed(TMD_OPP_ELEC, randint1(50) + 50, TRUE); (void)inc_timed(TMD_OPP_FIRE, randint1(50) + 50, TRUE); (void)inc_timed(TMD_OPP_COLD, randint1(50) + 50, TRUE); (void)inc_timed(TMD_OPP_POIS, randint1(50) + 50, 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); } 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); } 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); } 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: { if (inc_timed(TMD_SHERO, randint1(50) + 50, 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)) *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); (void)inc_timed(TMD_CUT, 5000, 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); *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)) *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); 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); 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); 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); 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: case EF_TRAP_PIT: case EF_TRAP_PIT_SPIKES: case EF_TRAP_PIT_POISON: case EF_TRAP_RUNE_SUMMON: case EF_TRAP_RUNE_TELEPORT: case EF_TRAP_SPOT_FIRE: case EF_TRAP_SPOT_ACID: case EF_TRAP_DART_SLOW: case EF_TRAP_DART_LOSE_STR: case EF_TRAP_DART_LOSE_DEX: case EF_TRAP_DART_LOSE_CON: case EF_TRAP_GAS_BLIND: case EF_TRAP_GAS_CONFUSE: case EF_TRAP_GAS_POISON: case EF_TRAP_GAS_SLEEP: { break; } case EF_XXX: case EF_MAX: break; } /* Not used */ msg("Effect not handled."); return FALSE; }
/* 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; 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, 0)) { 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 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)); if (py.flags.cut>0) { py.flags.cut-=10; if (py.flags.cut<0) py.flags.cut=0; ident = TRUE; msg_print("Your wounds heal."); } break; case 14: ident = hp_player(damroll(4, 7)); if (py.flags.cut>0) { py.flags.cut=(py.flags.cut/2)-50; if (py.flags.cut<0) py.flags.cut=0; ident = TRUE; msg_print("Your wounds heal."); } break; case 15: ident = hp_player(damroll(6, 7)); if (py.flags.cut>0) { py.flags.cut=0; ident = TRUE; msg_print("Your wounds heal."); } 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("Your head stops stinging."); } break; case 16: ident = hp_player(400); 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("Your head stops stinging."); } if (py.flags.cut>0) { py.flags.cut=0; ident = TRUE; msg_print("Your wounds heal."); } 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 (!py.flags.blindness_resist) { 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->confusion_resist) { 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; } if (!f_ptr->poison_resist) f_ptr->poisoned += randint(15) + 10; break; case 23: if (py.flags.fast == 0) ident = TRUE; if (py.flags.fast <= 0) { py.flags.fast += randint(25) + 15; } else py.flags.fast += randint(5); 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; case 34: if (!py.flags.hold_life && py.misc.exp>0) { int32 m, scale; msg_print("You feel your memories fade."); 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; } else msg_print ("You feel you memories fade for a moment, but quickly return."); 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 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; case 48: wizard_light(TRUE); if (!res_stat(A_WIS)) inc_stat(A_WIS); if (!res_stat(A_INT)) inc_stat(A_INT); msg_print("You feel more enlightened!"); identify_pack(); ident=TRUE; break; case 49: msg_print("Massive explosions rupture your body!"); take_hit(damroll(50,20),"a potion of Detonation"); cut_player(5000); stun_player(75); ident=TRUE; break; case 50: msg_print("A feeling of Death flows through your body."); take_hit(5000,"a potion of Death"); ident=TRUE; break; case 51: if (restore_level() | res_stat(A_STR) | res_stat(A_CON) | res_stat(A_DEX) | res_stat(A_WIS) | res_stat(A_INT) | res_stat(A_CHR) | hp_player(5000) | cure_poison() | cure_blindness() | cure_confusion() | (py.flags.stun>0) | (py.flags.cut>0) | (py.flags.image>0) | remove_fear()) { ident=TRUE; py.flags.cut=0; py.flags.image=0; 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; } } break; case 52: if (inc_stat(A_DEX) | inc_stat(A_WIS) | inc_stat(A_INT) | inc_stat(A_STR) | inc_stat(A_CHR) | inc_stat(A_CON)) { ident=TRUE; msg_print("You feel power flow through your body!"); } break; case 53: take_hit(damroll(10,10),"a potion of Ruination"); ruin_stat(A_DEX); ruin_stat(A_WIS); ruin_stat(A_CON); ruin_stat(A_STR); ruin_stat(A_CHR); ruin_stat(A_INT); ident=TRUE; msg_print("Your nerves and muscles feel weak and lifeless"); break; case 54: wizard_light(TRUE); msg_print("An image of your surroundings forms in your mind"); ident = TRUE; break; case 55: msg_print("You feel you know yourself a little better..."); self_knowledge(); ident = TRUE; break; case 56: /* *Healing* */ ident = hp_player(1200); 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("Your head stops stinging."); } if (py.flags.cut>0) { py.flags.cut=0; ident = TRUE; msg_print("Your wounds heal."); } if (cure_blindness()) ident = TRUE; if (cure_confusion()) ident = TRUE; if (cure_poison()) ident = TRUE; break; default: if (1) { char tmp_str[100]; msg_print ("Internal error in potion()"); sprintf(tmp_str, "Number %d...", j); msg_print (tmp_str); } 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]; } }
/** * Apply side effects from a spell attack to the player * * \param spell is the attack type * \param dam is the amount of damage caused by the attack * \param m_idx is the attacking monster */ static void do_side_effects(int spell, int dam, int m_idx) { const struct spell_effect *re_ptr; const struct mon_spell *rs_ptr = &mon_spell_table[spell]; monster_type *m_ptr = &mon_list[m_idx]; int i, choice[99], dur = 0, j = 0; bool sustain = FALSE, perma = FALSE, chosen[RSE_MAX] = { 0 }; s32b d = 0; /* First we note all the effects we'll be doing. */ for (re_ptr = spell_effect_table; re_ptr->index < RSE_MAX; re_ptr++) { if ((re_ptr->method && (re_ptr->method == rs_ptr->index)) || (re_ptr->gf && (re_ptr->gf == rs_ptr->gf))) { /* If we have a choice of effects, we create a cum freq table */ if (re_ptr->chance) { for (i = j; i < (j + re_ptr->chance); i++) choice[i] = re_ptr->index; j = i; } else chosen[re_ptr->index] = TRUE; } } /* If we have built a cum freq table, choose an effect from it */ if (j) chosen[choice[randint0(j)]] = TRUE; /* Now we cycle through again to activate the chosen effects */ for (re_ptr = spell_effect_table; re_ptr->index < RSE_MAX; re_ptr++) { if (chosen[re_ptr->index]) { /* * Check for resistance - there are three possibilities: * 1. Immunity to the attack type if side_immune is TRUE * 2. Resistance to the attack type if it affords no immunity * 3. Resistance to the specific side-effect * * TODO - add interesting messages to the RSE_ and GF_ tables * to replace the generic ones below. */ if ((rs_ptr->gf && check_side_immune(rs_ptr->gf)) || p_ptr->state.flags[re_ptr->res_flag]) { msg("You resist the effect!"); if (re_ptr->res_flag) wieldeds_notice_flag(re_ptr->res_flag); continue; } /* Allow saving throw if available */ if (re_ptr->save && randint0(100) < p_ptr->state.skills[SKILL_SAVE]) { msg("You avoid the effect!"); continue; } /* Implement the effect */ if (re_ptr->timed) { /* Calculate base duration (m_bonus is not used) */ dur = randcalc(re_ptr->base, 0, RANDOMISE); /* Calculate the damage-dependent duration (m_bonus is * used as a cap) */ dur += damcalc(re_ptr->dam.dice, re_ptr->dam.sides * dam / 100, RANDOMISE); if (re_ptr->dam.m_bonus && (dur > re_ptr->dam.m_bonus)) dur = re_ptr->dam.m_bonus; /* Apply the effect */ (void)inc_timed(re_ptr->flag, dur, TRUE); } else { switch (re_ptr->flag) { case S_INV_DAM: if (dam > 0) inven_damage(re_ptr->gf, MIN(dam * randcalc(re_ptr->dam, 0, RANDOMISE), 300)); break; case S_TELEPORT: /* m_bonus is used as a clev filter */ if (!re_ptr->dam.m_bonus || randint1(re_ptr->dam.m_bonus) > p_ptr->lev) teleport_player(randcalc(re_ptr->base, 0, RANDOMISE)); break; case S_TELE_TO: teleport_player_to(m_ptr->fy, m_ptr->fx); break; case S_TELE_LEV: teleport_player_level(); break; case S_DRAIN_LIFE: d = re_ptr->base.base + (p_ptr->exp * re_ptr->base.sides / 100) * MON_DRAIN_LIFE; msg("You feel your life force draining away!"); lose_exp(d); break; case S_DRAIN_STAT: /* m_bonus is used as a flag */ if (re_ptr->dam.m_bonus > 0) sustain = TRUE; if (abs(re_ptr->dam.m_bonus) > 1) perma = TRUE; drain_stats(randcalc(re_ptr->base, 0, RANDOMISE), sustain, perma); break; case S_SWAP_STAT: swap_stats(); break; case S_DRAIN_ALL: msg("You're not as powerful as you used to be..."); for (i = 0; i < A_MAX; i++) player_stat_dec(p_ptr, i, FALSE); break; case S_DISEN: (void)apply_disenchant(0); break; case S_DRAIN_MANA: case S_HEAL: case S_BLINK: case S_DARKEN: case S_TRAPS: case S_AGGRAVATE: case S_KIN: case S_MONSTER: case S_MONSTERS: /* XXX Fixme */ default: break; } } } } return; }
void chaos_warrior_reward(void) { if (one_in_(6)) { msg_format("%^s rewards you with a mutation!", chaos_patrons[p_ptr->chaos_patron]); mut_gain_random(NULL); } else { char wrath_reason[32] = ""; int nasty_chance = 6; int dummy = 0, dummy2 = 0; int type, effect; int count = 0; if (p_ptr->lev == 13) nasty_chance = 2; else if (!(p_ptr->lev % 13)) nasty_chance = 3; else if (!(p_ptr->lev % 14)) nasty_chance = 12; if (one_in_(nasty_chance)) type = randint1(20); /* Allow the 'nasty' effects */ else type = randint1(15) + 5; /* Or disallow them */ if (type < 1) type = 1; if (type > 20) type = 20; type--; sprintf(wrath_reason, "the Wrath of %s", chaos_patrons[p_ptr->chaos_patron]); effect = chaos_rewards[p_ptr->chaos_patron][type]; switch (effect) { case REW_POLY_SLF: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou needst a new form, mortal!'"); do_poly_self(); break; case REW_GAIN_EXP: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Well done, mortal! Lead on!'"); if (p_ptr->prace == RACE_ANDROID) msg_print("But, nothing happen."); else if (p_ptr->exp < PY_MAX_EXP) { s32b ee = (p_ptr->exp / 2) + 10; if (ee > 100000L) ee = 100000L; msg_print("You feel more experienced."); gain_exp(ee); } break; case REW_LOSE_EXP: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou didst not deserve that, slave.'"); if (p_ptr->prace == RACE_ANDROID) msg_print("But, nothing happen."); else { lose_exp(p_ptr->exp / 6); } break; case REW_GOOD_OBJ: msg_format("The voice of %s whispers:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Use my gift wisely.'"); acquirement(py, px, 1, FALSE, FALSE); break; case REW_GREA_OBJ: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Use my gift wisely.'"); acquirement(py, px, 1, TRUE, FALSE); break; case REW_CHAOS_WP: { object_type forge; msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thy deed hath earned thee a worthy blade.'"); dummy = TV_SWORD; switch (randint1(p_ptr->lev)) { case 0: case 1: dummy2 = SV_DAGGER; break; case 2: case 3: dummy2 = SV_MAIN_GAUCHE; break; case 4: dummy2 = SV_TANTO; break; case 5: case 6: dummy2 = SV_RAPIER; break; case 7: case 8: dummy2 = SV_SMALL_SWORD; break; case 9: case 10: dummy2 = SV_BASILLARD; break; case 11: case 12: case 13: dummy2 = SV_SHORT_SWORD; break; case 14: case 15: dummy2 = SV_SABRE; break; case 16: case 17: dummy2 = SV_CUTLASS; break; case 18: dummy2 = SV_WAKIZASHI; break; case 19: dummy2 = SV_KHOPESH; break; case 20: dummy2 = SV_TULWAR; break; case 21: dummy2 = SV_BROAD_SWORD; break; case 22: case 23: dummy2 = SV_LONG_SWORD; break; case 24: case 25: dummy2 = SV_SCIMITAR; break; case 26: dummy2 = SV_NINJATO; break; case 27: dummy2 = SV_KATANA; break; case 28: case 29: dummy2 = SV_BASTARD_SWORD; break; case 30: dummy2 = SV_GREAT_SCIMITAR; break; case 31: dummy2 = SV_CLAYMORE; break; case 32: dummy2 = SV_ESPADON; break; case 33: dummy2 = SV_TWO_HANDED_SWORD; break; case 34: dummy2 = SV_FLAMBERGE; break; case 35: dummy2 = SV_NO_DACHI; break; case 36: dummy2 = SV_EXECUTIONERS_SWORD; break; case 37: dummy2 = SV_ZWEIHANDER; break; case 38: dummy2 = SV_HAYABUSA; break; default: dummy2 = SV_BLADE_OF_CHAOS; } object_prep(&forge, lookup_kind(dummy, dummy2)); forge.to_h = 3 + randint1(dun_level) % 10; forge.to_d = 3 + randint1(dun_level) % 10; one_resistance(&forge); forge.name2 = EGO_WEAPON_CHAOS; drop_near(&forge, -1, py, px); break; } case REW_GOOD_OBS: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thy deed hath earned thee a worthy reward.'"); acquirement(py, px, randint1(2) + 1, FALSE, FALSE); break; case REW_GREA_OBS: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Behold, mortal, how generously I reward thy loyalty.'"); acquirement(py, px, randint1(2) + 1, TRUE, FALSE); break; case REW_TY_CURSE: msg_format("The voice of %s thunders:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou art growing arrogant, mortal.'"); activate_ty_curse(FALSE, &count); break; case REW_SUMMON_M: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'My pets, destroy the arrogant mortal!'"); for (dummy = 0; dummy < randint1(5) + 1; dummy++) summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); break; case REW_H_SUMMON: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou needst worthier opponents!'"); activate_hi_summon(py, px, FALSE); break; case REW_DO_HAVOC: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Death and destruction! This pleaseth me!'"); call_chaos(100); break; case REW_GAIN_ABL: msg_format("The voice of %s rings out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Stay, mortal, and let me mold thee.'"); if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0)) do_inc_stat(chaos_stats[p_ptr->chaos_patron]); else do_inc_stat(randint0(6)); break; case REW_LOSE_ABL: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'I grow tired of thee, mortal.'"); if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0)) do_dec_stat(chaos_stats[p_ptr->chaos_patron]); else do_dec_stat(randint0(6)); break; case REW_RUIN_ABL: msg_format("The voice of %s thunders:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou needst a lesson in humility, mortal!'"); msg_print("You feel less powerful!"); for (dummy = 0; dummy < 6; dummy++) dec_stat(dummy, 10 + randint1(15), TRUE); break; case REW_POLY_WND: msg_format("You feel the power of %s touch you.", chaos_patrons[p_ptr->chaos_patron]); do_poly_wounds(); break; case REW_AUGM_ABL: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Receive this modest gift from me!'"); for (dummy = 0; dummy < 6; dummy++) do_inc_stat(dummy); break; case REW_HURT_LOT: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Suffer, pathetic fool!'"); fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4); take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1); break; case REW_HEAL_FUL: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Rise, my servant!'"); restore_level(); set_poisoned(0, TRUE); set_blind(0, TRUE); set_confused(0, TRUE); set_image(0, TRUE); set_stun(0, TRUE); set_cut(0, TRUE); hp_player(5000); for (dummy = 0; dummy < 6; dummy++) do_res_stat(dummy); break; case REW_CURSE_WP: { int slot = equip_random_slot(object_is_melee_weapon); if (slot) { msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou reliest too much on thy weapon.'"); curse_weapon(FALSE, slot); } break; } case REW_CURSE_AR: { int slot = equip_random_slot(object_is_armour); if (slot) { msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Thou reliest too much on thine equipment.'"); curse_armor(slot); } break; } case REW_PISS_OFF: msg_format("The voice of %s whispers:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Now thou shalt pay for annoying me.'"); switch (randint1(4)) { case 1: activate_ty_curse(FALSE, &count); break; case 2: activate_hi_summon(py, px, FALSE); break; case 3: if (one_in_(2)) { int slot = equip_random_slot(object_is_melee_weapon); if (slot) curse_weapon(FALSE, slot); } else { int slot = equip_random_slot(object_is_armour); if (slot) curse_armor(slot); } break; default: for (dummy = 0; dummy < 6; dummy++) dec_stat(dummy, 10 + randint1(15), TRUE); break; } break; case REW_WRATH: msg_format("The voice of %s thunders:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Die, mortal!'"); take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1); for (dummy = 0; dummy < 6; dummy++) dec_stat(dummy, 10 + randint1(15), FALSE); activate_hi_summon(py, px, FALSE); activate_ty_curse(FALSE, &count); if (one_in_(2)) { int slot = equip_random_slot(object_is_melee_weapon); if (slot) curse_weapon(FALSE, slot); } if (one_in_(2)) { int slot = equip_random_slot(object_is_armour); if (slot) curse_armor(slot); } break; case REW_DESTRUCT: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Death and destruction! This pleaseth me!'"); destroy_area(py, px, 25, 3 * p_ptr->lev); break; case REW_GENOCIDE: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Let me relieve thee of thine oppressors!'"); symbol_genocide(0, FALSE); break; case REW_MASS_GEN: msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]); msg_print("'Let me relieve thee of thine oppressors!'"); mass_genocide(0, FALSE); break; case REW_DISPEL_C: msg_format("You can feel the power of %s assault your enemies!", chaos_patrons[p_ptr->chaos_patron]); dispel_monsters(p_ptr->lev * 4); break; case REW_IGNORE: msg_format("%s ignores you.", chaos_patrons[p_ptr->chaos_patron]); break; case REW_SER_DEMO: msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]); if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET)) msg_print("Nobody ever turns up..."); break; case REW_SER_MONS: msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]); if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET)) msg_print("Nobody ever turns up..."); break; case REW_SER_UNDE: msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]); if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET)) msg_print("Nobody ever turns up..."); break; default: msg_format("The voice of %s stammers:", chaos_patrons[p_ptr->chaos_patron]); msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect); } } }
static bool quaff_potion(object_type *o_ptr, bool *ident) { /* Analyze the potion */ switch (o_ptr->sval) { case SV_POTION_WATER: case SV_POTION_APPLE_JUICE: case SV_POTION_SLIME_MOLD: { msg_print("Вы утолили жажду."); *ident = TRUE; break; } case SV_POTION_SLOWNESS: { if (set_slow(p_ptr->slow + randint(25) + 15)) *ident = TRUE; break; } case SV_POTION_SALT_WATER: { msg_print("Вя-а-а! Вас стошнило!"); (void)set_food(PY_FOOD_STARVE - 1); (void)set_poisoned(0); (void)set_paralyzed(p_ptr->paralyzed + 4); *ident = TRUE; break; } case SV_POTION_POISON: { if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) { if (set_poisoned(p_ptr->poisoned + rand_int(15) + 10)) { *ident = TRUE; } } break; } case SV_POTION_BLINDNESS: { if (!p_ptr->resist_blind) { if (set_blind(p_ptr->blind + rand_int(100) + 100)) { *ident = TRUE; } } break; } case SV_POTION_CONFUSION: { if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + rand_int(20) + 15)) { *ident = TRUE; } } break; } case SV_POTION_SLEEP: { if (!p_ptr->free_act) { if (set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4)) { *ident = TRUE; } } break; } case SV_POTION_LOSE_MEMORIES: { if (!p_ptr->hold_life && (p_ptr->exp > 0)) { msg_print("Ваша жизнь меркнет."); lose_exp(p_ptr->exp / 4); *ident = TRUE; } break; } case SV_POTION_RUINATION: { msg_print("Ваши нервы и мускулы кажутся слабыми и безжизненными!"); take_hit(damroll(10, 10), "зельем Ослабевания"); (void)dec_stat(A_DEX, 25, TRUE); (void)dec_stat(A_WIS, 25, TRUE); (void)dec_stat(A_CON, 25, TRUE); (void)dec_stat(A_STR, 25, TRUE); (void)dec_stat(A_CHR, 25, TRUE); (void)dec_stat(A_INT, 25, TRUE); *ident = TRUE; break; } case SV_POTION_DEC_STR: { if (do_dec_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_DEC_INT: { if (do_dec_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_DEC_WIS: { if (do_dec_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_DEC_DEX: { if (do_dec_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_DEC_CON: { if (do_dec_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_DEC_CHR: { if (do_dec_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_DETONATIONS: { msg_print("Массивные взрывы сотрясают ваше тело!"); take_hit(damroll(50, 20), "зельем взрыва"); (void)set_stun(p_ptr->stun + 75); (void)set_cut(p_ptr->cut + 5000); *ident = TRUE; break; } case SV_POTION_DEATH: { msg_print("Чувство Смерти протекает сквозь вас..."); take_hit(5000, "зельем Смерти"); *ident = TRUE; break; } case SV_POTION_INFRAVISION: { if (set_tim_infra(p_ptr->tim_infra + 100 + randint(100))) { *ident = TRUE; } break; } case SV_POTION_DETECT_INVIS: { if (set_tim_invis(p_ptr->tim_invis + 12 + randint(12))) { *ident = TRUE; } break; } case SV_POTION_SLOW_POISON: { if (set_poisoned(p_ptr->poisoned / 2)) *ident = TRUE; break; } case SV_POTION_CURE_POISON: { if (set_poisoned(0)) *ident = TRUE; break; } case SV_POTION_BOLDNESS: { if (set_afraid(0)) *ident = TRUE; break; } case SV_POTION_SPEED: { if (!p_ptr->fast) { if (set_fast(randint(25) + 15)) *ident = TRUE; } else { (void)set_fast(p_ptr->fast + 5); } break; } case SV_POTION_RESIST_HEAT: { if (set_oppose_fire(p_ptr->oppose_fire + randint(10) + 10)) { *ident = TRUE; } break; } case SV_POTION_RESIST_COLD: { if (set_oppose_cold(p_ptr->oppose_cold + randint(10) + 10)) { *ident = TRUE; } break; } case SV_POTION_HEROISM: { if (hp_player(10)) *ident = TRUE; if (set_afraid(0)) *ident = TRUE; if (set_hero(p_ptr->hero + randint(25) + 25)) *ident = TRUE; break; } case SV_POTION_BERSERK_STRENGTH: { if (hp_player(30)) *ident = TRUE; if (set_afraid(0)) *ident = TRUE; if (set_shero(p_ptr->shero + randint(25) + 25)) *ident = TRUE; break; } case SV_POTION_CURE_LIGHT: { if (hp_player(damroll(2, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_cut(p_ptr->cut - 10)) *ident = TRUE; break; } case SV_POTION_CURE_SERIOUS: { if (hp_player(damroll(4, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_cut((p_ptr->cut / 2) - 50)) *ident = TRUE; break; } case SV_POTION_CURE_CRITICAL: { if (hp_player(damroll(6, 8))) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_HEALING: { if (hp_player(300)) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_STAR_HEALING: { if (hp_player(1200)) *ident = TRUE; if (set_blind(0)) *ident = TRUE; if (set_confused(0)) *ident = TRUE; if (set_poisoned(0)) *ident = TRUE; if (set_stun(0)) *ident = TRUE; if (set_cut(0)) *ident = TRUE; break; } case SV_POTION_LIFE: { msg_print("Чуство Жизни протекает в вас!"); restore_level(); (void)set_poisoned(0); (void)set_blind(0); (void)set_confused(0); (void)set_image(0); (void)set_stun(0); (void)set_cut(0); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); /* Recalculate max. hitpoints */ update_stuff(); hp_player(5000); *ident = TRUE; break; } case SV_POTION_RESTORE_MANA: { if (p_ptr->csp < p_ptr->msp) { p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; msg_print("Ваша голова проясняется."); p_ptr->redraw |= (PR_MANA); p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1); *ident = TRUE; } break; } case SV_POTION_RESTORE_EXP: { if (restore_level()) *ident = TRUE; break; } case SV_POTION_RES_STR: { if (do_res_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_RES_INT: { if (do_res_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_RES_WIS: { if (do_res_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_RES_DEX: { if (do_res_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_RES_CON: { if (do_res_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_RES_CHR: { if (do_res_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_INC_STR: { if (do_inc_stat(A_STR)) *ident = TRUE; break; } case SV_POTION_INC_INT: { if (do_inc_stat(A_INT)) *ident = TRUE; break; } case SV_POTION_INC_WIS: { if (do_inc_stat(A_WIS)) *ident = TRUE; break; } case SV_POTION_INC_DEX: { if (do_inc_stat(A_DEX)) *ident = TRUE; break; } case SV_POTION_INC_CON: { if (do_inc_stat(A_CON)) *ident = TRUE; break; } case SV_POTION_INC_CHR: { if (do_inc_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_AUGMENTATION: { if (do_inc_stat(A_STR)) *ident = TRUE; if (do_inc_stat(A_INT)) *ident = TRUE; if (do_inc_stat(A_WIS)) *ident = TRUE; if (do_inc_stat(A_DEX)) *ident = TRUE; if (do_inc_stat(A_CON)) *ident = TRUE; if (do_inc_stat(A_CHR)) *ident = TRUE; break; } case SV_POTION_ENLIGHTENMENT: { msg_print("Изображение подземелья формируется у вас в голове..."); wiz_lite(); *ident = TRUE; break; } case SV_POTION_STAR_ENLIGHTENMENT: { msg_print("Вы чувствуете себя просвещенным..."); message_flush(); wiz_lite(); (void)do_inc_stat(A_INT); (void)do_inc_stat(A_WIS); (void)detect_traps(); (void)detect_doors(); (void)detect_stairs(); (void)detect_treasure(); (void)detect_objects_gold(); (void)detect_objects_normal(); identify_pack(); self_knowledge(); *ident = TRUE; break; } case SV_POTION_SELF_KNOWLEDGE: { msg_print("Вы познаете себя немного лучше..."); message_flush(); self_knowledge(); *ident = TRUE; break; } case SV_POTION_EXPERIENCE: { if (p_ptr->exp < PY_MAX_EXP) { s32b ee = (p_ptr->exp / 2) + 10; if (ee > 100000L) ee = 100000L; msg_print("Вы чувствуете себя более опытным."); gain_exp(ee); *ident = TRUE; } break; } } return (TRUE); }