/* * shero: * restore lost abilities from cursed potion of shero */ void shero(void) { msg("You feel normal again."); chg_str(2, FALSE, TRUE); chg_dext(2, FALSE, TRUE); turn_off(player, ISUNHERO); }
/* * unbhero: * super heroism wears off, but no bad effects */ void unbhero(void) { msg("Your feeling of invincibility goes away."); turn_off(player, SUPERHERO); chg_str(-10, FALSE, FALSE); chg_dext(-5, FALSE, FALSE); }
fuse shero(fuse_arg *arg) { NOOP(arg); msg("You feel normal again."); chg_str(2, FALSE, TRUE); chg_dext(2, FALSE, TRUE); turn_off(player, ISUNHERO); }
fuse unbhero(fuse_arg *arg) { NOOP(arg); msg("Your feeling of invincibility goes away."); turn_off(player, SUPERHERO); chg_str(-10, FALSE, FALSE); chg_dext(-5, FALSE, FALSE); }
/* * unshero: * super heroism wears off, now do nasty effects */ void unshero(void) { msg("Your feeling of invulnerability goes away."); turn_off(player, SUPERHERO); chg_str(-11, FALSE, FALSE); chg_dext(-6, FALSE, FALSE); food_left -= HEROTIME + rnd(HEROTIME); no_command += 5 + rnd(5); msg("You fall asleep."); }
fuse res_strength(fuse_arg *arg) { NOOP(arg); if (lost_str) { chg_str(lost_str, FALSE, FALSE); lost_str = 0; } else pstats.s_str = max_stats.s_str + ring_value(R_ADDSTR) + (on(player, POWERSTR) ? 10 : 0) + (on(player, SUPERHERO) ? 10 : 0); updpack(); }
/* * res_strength: * Restore player's strength */ void res_strength(void) { /* If lost_str is non-zero, restore that amount of strength, * else all of it */ if (lost_str) { chg_str(lost_str, FALSE, FALSE); lost_str = 0; } /* Otherwise, put player at the maximum strength */ else { pstats.s_str = max_stats.s_str + ring_value(R_ADDSTR) + (on(player, POWERSTR) ? 10 : 0) + (on(player, SUPERHERO) ? 10 : 0); } updpack(TRUE); }
void death(int monst) { char **dp = (char **) rip, *killer; struct tm *lt; time_t date; char buf[80]; int c; if (is_wearing(R_RESURRECT) || rnd(wizard ? 3 : 67) == 0) { int die = TRUE; if (resurrect-- == 0) msg("You've run out of lives."); else if (!save_resurrect(ring_value(R_RESURRECT))) msg("Your attempt to return from the grave fails."); else { struct linked_list *item; struct linked_list *next_item; struct object *obj; int rm, flags; coord pos; die = FALSE; msg("You feel a sudden warmth and then nothingness."); teleport(); if (ring_value(R_RESURRECT) > 1 && rnd(10)) { pstats.s_hpt = 2 * pstats.s_const; pstats.s_const = max(pstats.s_const - 1, 3); } else { for (item = pack; item != NULL; item = next_item) { obj = OBJPTR(item); if (obj->o_flags & ISOWNED || obj->o_flags & ISPROT) { next_item = next(item); continue; } flags = obj->o_flags; obj->o_flags &= ~ISCURSED; dropcheck(obj); obj->o_flags = flags; next_item = next(item); rem_pack(obj); if (obj->o_type == ARTIFACT) has_artifact &= ~(1 << obj->o_which); do { rm = rnd_room(); rnd_pos(&rooms[rm], &pos); } while(winat(pos.y, pos.x) != FLOOR); obj->o_pos = pos; add_obj(item, obj->o_pos.y, obj->o_pos.x); } pstats.s_hpt = pstats.s_const; pstats.s_const = max(pstats.s_const - roll(2, 2), 3); } chg_str(roll(1, 4), TRUE, FALSE); pstats.s_lvl = max(pstats.s_lvl, 1); no_command += 2 + rnd(4); if (on(player, ISHUH)) lengthen_fuse(FUSE_UNCONFUSE, rnd(8) + HUHDURATION); else light_fuse(FUSE_UNCONFUSE, 0, rnd(8) + HUHDURATION, AFTER); turn_on(player, ISHUH); light(&hero); } if (die) { wmove(cw, mpos, 0); waddstr(cw, morestr); wrefresh(cw); wait_for(' '); } else return; } time(&date); lt = localtime(&date); clear(); wclear(cw); move(8, 0); while (*dp) printw("%s\n", *dp++); mvaddstr(14, 28 - ((int)(strlen(whoami) + 1) / 2), whoami); sprintf(buf, "%d+%ld Points", pstats.s_lvl, pstats.s_exp); mvaddstr(15, 28 - ((int)(strlen(buf) + 1) / 2), buf); killer = killname(monst,buf); mvaddstr(17, 28 - ((int)(strlen(killer) + 1) / 2), killer); mvaddstr(18, 28, (sprintf(prbuf, "%2d", lt->tm_year), prbuf)); move(LINES - 1, 0); mvaddstr(LINES - 1, 0, retstr); while ((c = readcharw(stdscr)) != '\n' && c != '\r') continue; idenpack(); wrefresh(cw); refresh(); score(pstats.s_exp, pstats.s_lvl, KILLED, monst); byebye(); }
void ring_on() { THING *obj; int ring; obj = get_item("put on", RING); /* * Make certain that it is somethings that we want to wear */ if (obj == NULL) return; if (obj->o_type != RING) { if (!terse) msg("it would be difficult to wrap that around a finger"); else msg("not a ring"); return; } /* * find out which hand to put it on */ if (is_current(obj)) return; if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL) { if ((ring = gethand()) < 0) return; } else if (cur_ring[LEFT] == NULL) ring = LEFT; else if (cur_ring[RIGHT] == NULL) ring = RIGHT; else { if (!terse) msg("you already have a ring on each hand"); else msg("wearing two"); return; } cur_ring[ring] = obj; /* * Calculate the effect it has on the poor guy. */ switch (obj->o_which) { case R_ADDSTR: chg_str(obj->o_arm); break; case R_SEEINVIS: invis_on(); break; case R_AGGR: aggravate(); break; } if (!terse) addmsg("you are now wearing "); msg("%s (%c)", inv_name(obj, TRUE), obj->o_packch); }
void quaff() { THING *obj, *tp, *mp; bool discardit = FALSE; bool show, trip; obj = get_item("quaff", POTION); /* * Make certain that it is somethings that we want to drink */ if (obj == NULL) return; if (obj->o_type != POTION) { if (!terse) msg("yuk! Why would you want to drink that?"); else msg("that's undrinkable"); return; } if (obj == cur_weapon) cur_weapon = NULL; /* * Calculate the effect it has on the poor guy. */ trip = on(player, ISHALU); discardit = (bool)(obj->o_count == 1); leave_pack(obj, FALSE, FALSE); switch (obj->o_which) { case P_CONFUSE: do_pot(P_CONFUSE, !trip); when P_POISON: pot_info[P_POISON].oi_know = TRUE; if (ISWEARING(R_SUSTSTR)) msg("you feel momentarily sick"); else { chg_str(-(rnd(3) + 1)); msg("you feel very sick now"); come_down(); } when P_HEALING: pot_info[P_HEALING].oi_know = TRUE; if ((pstats.s_hpt += roll(pstats.s_lvl, 4)) > max_hp) pstats.s_hpt = ++max_hp; sight(); msg("you begin to feel better"); when P_STRENGTH: pot_info[P_STRENGTH].oi_know = TRUE; chg_str(1); msg("you feel stronger, now. What bulging muscles!"); when P_MFIND: player.t_flags |= SEEMONST; fuse((void(*)())turn_see, TRUE, HUHDURATION, AFTER); if (!turn_see(FALSE)) msg("you have a %s feeling for a moment, then it passes", choose_str("normal", "strange")); when P_TFIND: /* * Potion of magic detection. Show the potions and scrolls */ show = FALSE; if (lvl_obj != NULL) { wclear(hw); for (tp = lvl_obj; tp != NULL; tp = next(tp)) { if (is_magic(tp)) { show = TRUE; wmove(hw, tp->o_pos.y, tp->o_pos.x); waddch(hw, MAGIC); pot_info[P_TFIND].oi_know = TRUE; } } for (mp = mlist; mp != NULL; mp = next(mp)) { for (tp = mp->t_pack; tp != NULL; tp = next(tp)) { if (is_magic(tp)) { show = TRUE; wmove(hw, mp->t_pos.y, mp->t_pos.x); waddch(hw, MAGIC); } } } } if (show) { pot_info[P_TFIND].oi_know = TRUE; show_win("You sense the presence of magic on this level.--More--"); } else msg("you have a %s feeling for a moment, then it passes", choose_str("normal", "strange")); when P_LSD: if (!trip) { if (on(player, SEEMONST)) turn_see(FALSE); start_daemon(visuals, 0, BEFORE); seenstairs = seen_stairs(); } do_pot(P_LSD, TRUE); when P_SEEINVIS: sprintf(prbuf, "this potion tastes like %s juice", fruit); show = on(player, CANSEE); do_pot(P_SEEINVIS, FALSE); if (!show) invis_on(); sight(); when P_RAISE: pot_info[P_RAISE].oi_know = TRUE; msg("you suddenly feel much more skillful"); raise_level(); when P_XHEAL: pot_info[P_XHEAL].oi_know = TRUE; if ((pstats.s_hpt += roll(pstats.s_lvl, 8)) > max_hp) { if (pstats.s_hpt > max_hp + pstats.s_lvl + 1) ++max_hp; pstats.s_hpt = ++max_hp; } sight(); come_down(); msg("you begin to feel much better"); when P_HASTE: pot_info[P_HASTE].oi_know = TRUE; after = FALSE; if (add_haste(TRUE)) msg("you feel yourself moving much faster"); when P_RESTORE: if (ISRING(LEFT, R_ADDSTR)) add_str(&pstats.s_str, -cur_ring[LEFT]->o_arm); if (ISRING(RIGHT, R_ADDSTR)) add_str(&pstats.s_str, -cur_ring[RIGHT]->o_arm); if (pstats.s_str < max_stats.s_str) pstats.s_str = max_stats.s_str; if (ISRING(LEFT, R_ADDSTR)) add_str(&pstats.s_str, cur_ring[LEFT]->o_arm); if (ISRING(RIGHT, R_ADDSTR)) add_str(&pstats.s_str, cur_ring[RIGHT]->o_arm); msg("hey, this tastes great. It make you feel warm all over"); when P_BLIND: do_pot(P_BLIND, TRUE); when P_LEVIT: do_pot(P_LEVIT, TRUE); #ifdef MASTER otherwise: msg("what an odd tasting potion!"); return; #endif } status(); /* * Throw the item away */ call_it(&pot_info[obj->o_which]); if (discardit) discard(obj); return; }
/* * quaff: * Quaff a potion from the pack */ quaff() { register THING *obj, *th; register bool discardit = FALSE; obj = get_item("quaff", POTION); /* * Make certain that it is somethings that we want to drink */ if (obj == NULL) return; if (obj->o_type != POTION) { if (!terse) msg("yuk! Why would you want to drink that?"); else msg("that's undrinkable"); return; } if (obj == cur_weapon) cur_weapon = NULL; /* * Calculate the effect it has on the poor guy. */ switch (obj->o_which) { case P_CONFUSE: p_know[P_CONFUSE] = TRUE; if (!on(player, ISHUH)) { if (on(player, ISHUH)) lengthen(unconfuse, rnd(8)+HUHDURATION); else fuse(unconfuse, 0, rnd(8)+HUHDURATION, AFTER); player.t_flags |= ISHUH; msg("wait, what's going on here. Huh? What? Who?"); } when P_POISON: p_know[P_POISON] = TRUE; if (!ISWEARING(R_SUSTSTR)) { chg_str(-(rnd(3)+1)); msg("you feel very sick now"); } else msg("you feel momentarily sick"); when P_HEALING: p_know[P_HEALING] = TRUE; if ((pstats.s_hpt += roll(pstats.s_lvl, 4)) > max_hp) pstats.s_hpt = ++max_hp; sight(); msg("you begin to feel better"); when P_STRENGTH: p_know[P_STRENGTH] = TRUE; chg_str(1); msg("you feel stronger, now. What bulging muscles!"); when P_MFIND: player.t_flags |= SEEMONST; fuse(turn_see, TRUE, HUHDURATION, AFTER); if (mlist == NULL) msg("you have a strange feeling for a moment"); else p_know[P_MFIND] |= turn_see(FALSE); when P_TFIND: /* * Potion of magic detection. Show the potions and scrolls */ if (lvl_obj != NULL) { register THING *tp; register bool show; show = FALSE; wclear(hw); for (tp = lvl_obj; tp != NULL; tp = next(tp)) { if (is_magic(tp)) { show = TRUE; mvwaddch(hw, tp->o_pos.y, tp->o_pos.x, MAGIC); p_know[P_TFIND] = TRUE; } } for (th = mlist; th != NULL; th = next(th)) { for (tp = th->t_pack; tp != NULL; tp = next(tp)) { if (is_magic(tp)) { show = TRUE; mvwaddch(hw, th->t_pos.y, th->t_pos.x, MAGIC); p_know[P_TFIND] = TRUE; } } } if (show) { show_win(hw, "You sense the presence of magic on this level.--More--"); break; } } msg("you have a strange feeling for a moment, then it passes"); when P_PARALYZE: p_know[P_PARALYZE] = TRUE; no_command = HOLDTIME; player.t_flags &= ~ISRUN; msg("you can't move"); when P_SEEINVIS: if (!on(player, CANSEE)) { fuse(unsee, 0, SEEDURATION, AFTER); look(FALSE); invis_on(); } sight(); msg("this potion tastes like %s juice", fruit); when P_RAISE: p_know[P_RAISE] = TRUE; msg("you suddenly feel much more skillful"); raise_level(); when P_XHEAL: p_know[P_XHEAL] = TRUE; if ((pstats.s_hpt += roll(pstats.s_lvl, 8)) > max_hp) { if (pstats.s_hpt > max_hp + pstats.s_lvl + 1) ++max_hp; pstats.s_hpt = ++max_hp; } sight(); msg("you begin to feel much better"); when P_HASTE: p_know[P_HASTE] = TRUE; if (add_haste(TRUE)) msg("you feel yourself moving much faster"); when P_RESTORE: if (ISRING(LEFT, R_ADDSTR)) add_str(&pstats.s_str, -cur_ring[LEFT]->o_ac); if (ISRING(RIGHT, R_ADDSTR)) add_str(&pstats.s_str, -cur_ring[RIGHT]->o_ac); if (pstats.s_str < max_stats.s_str) pstats.s_str = max_stats.s_str; if (ISRING(LEFT, R_ADDSTR)) add_str(&pstats.s_str, cur_ring[LEFT]->o_ac); if (ISRING(RIGHT, R_ADDSTR)) add_str(&pstats.s_str, cur_ring[RIGHT]->o_ac); msg("hey, this tastes great. It make you feel warm all over"); when P_BLIND: p_know[P_BLIND] = TRUE; if (!on(player, ISBLIND)) { player.t_flags |= ISBLIND; fuse(sight, 0, SEEDURATION, AFTER); look(FALSE); } msg("a cloak of darkness falls around you"); when P_NOP: msg("this potion tastes extremely dull"); otherwise: msg("what an odd tasting potion!"); return; } status(); /* * Throw the item away */ inpack--; if (obj->o_count > 1) obj->o_count--; else { detach(pack, obj); discardit = TRUE; } call_it(p_know[obj->o_which], &p_guess[obj->o_which]); if (discardit) discard(obj); }