games@tekred.TEK.COM (07/29/88)
Submitted by: "James E. Wilson" <wilson@ji.berkeley.edu>
Comp.sources.games: Volume 5, Issue 43
Archive-name: umoria2/Part09
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 9 (of 18)."
# Contents: Moria_hours dungeon.c potions.c shar.script
# Wrapped by billr@saab on Wed Jul 13 11:16:27 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Moria_hours' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Moria_hours'\"
else
echo shar: Extracting \"'Moria_hours'\" \(352 characters\)
sed "s/^X//" >'Moria_hours' <<'END_OF_FILE'
X Moria operating hours are:
X | AM | PM |
X 1 111 111
X 2123456789012123456789012
XSUN:XXXXXXXXXXXXXXXXXXXXXXXX
XMON:XXXXXXXX.........XXXXXXX
XTUE:XXXXXXXX.........XXXXXXX
XWED:XXXXXXXX.........XXXXXXX
XTHU:XXXXXXXX.........XXXXXXX
XFRI:XXXXXXXX.........XXXXXXX
XSAT:XXXXXXXXXXXXXXXXXXXXXXXX
X (X==Open; .==Closed)
END_OF_FILE
if test 352 -ne `wc -c <'Moria_hours'`; then
echo shar: \"'Moria_hours'\" unpacked with wrong size!
fi
# end of 'Moria_hours'
fi
if test -f 'dungeon.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'dungeon.c'\"
else
echo shar: Extracting \"'dungeon.c'\" \(41566 characters\)
sed "s/^X//" >'dungeon.c' <<'END_OF_FILE'
X#include <stdio.h>
X
X#include "constants.h"
X#include "config.h"
X#include "types.h"
X#include "externs.h"
X
X#ifdef USG
X#include <string.h>
X#else
X#include <strings.h>
X#endif
X
X#ifdef sun /* correct SUN stupidity in the stdio.h file */
Xchar *sprintf();
X#endif
X
X#ifdef USG
Xunsigned sleep();
X#endif
X
X#ifdef ultrix
Xvoid sleep();
X#endif
X
X/* global flags */
Xint moria_flag; /* Next level when true */
Xint search_flag; /* Player is searching */
Xint teleport_flag; /* Handle teleport traps */
Xint player_light; /* Player carrying light */
Xint cave_flag; /* used in get_panel */
Xint light_flag; /* used in move_light */
X
X/* value of msg_flag at start of turn */
Xint save_msg_flag;
X
X/* Moria game module -RAK- */
X/* The code in this section has gone through many revisions, and */
X/* some of it could stand some more hard work... -RAK- */
Xdungeon()
X{
X int old_chp, old_cmana; /* Detect change */
X double regen_amount; /* Regenerate hp and mana*/
X char command; /* Last command */
X register struct misc *p_ptr;
X register treasure_type *i_ptr;
X register struct flags *f_ptr;
X int set_floor();
X
X /* Main procedure for dungeon... -RAK- */
X /* Note: There is a lot of preliminary magic going on here at first*/
X
X /* Check light status for setup */
X i_ptr = &inventory[INVEN_LIGHT];
X if (i_ptr->p1 > 0)
X player_light = TRUE;
X else
X player_light = FALSE;
X /* Check for a maximum level */
X p_ptr = &py.misc;
X if (dun_level > p_ptr->max_lev) p_ptr->max_lev = dun_level;
X /* Set up the character co-ords */
X if ((char_row == -1) || (char_col == -1))
X new_spot(&char_row, &char_col);
X /* Reset flags and initialize variables */
X moria_flag = FALSE;
X cave_flag = FALSE;
X find_flag = FALSE;
X search_flag = FALSE;
X teleport_flag = FALSE;
X mon_tot_mult = 0;
X cave[char_row][char_col].cptr = 1;
X old_chp = (int)py.misc.chp;
X old_cmana = (int)py.misc.cmana;
X /* Light up the area around character */
X move_char(5);
X /* Light, but do not move critters */
X creatures(FALSE);
X /* Print the depth */
X prt_depth();
X
X /* Loop until dead, or new level */
X do
X {
X /* Increment turn counter */
X turn++;
X /* Check for game hours */
X if (!wizard1)
X if ((turn % 250) == 1)
X if (!check_time())
X if (closing_flag > 4)
X {
X if (search_flag)
X search_off();
X if (py.flags.rest > 0)
X rest_off();
X find_flag = FALSE;
X msg_print("The gates to Moria are now closed.");
X /* make sure player sees the message */
X msg_print(" ");
X do
X {
X save_char(TRUE, FALSE);
X }
X while (TRUE);
X }
X else
X {
X if (search_flag)
X search_off();
X if (py.flags.rest > 0)
X rest_off();
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X closing_flag++;
X msg_print("The gates to Moria are closing...");
X msg_print("Please finish up or save your game.");
X /* make sure the player sees the message */
X msg_print(" ");
X }
X
X /* turn over the store contents every, say, 1000 turns */
X if ((dun_level != 0) && ((turn % 1000) == 0))
X store_maint();
X
X /* Check for creature generation */
X if (randint(MAX_MALLOC_CHANCE) == 1)
X alloc_monster(set_floor, 1, MAX_SIGHT, FALSE);
X /* Screen may need updating, used mostly for stats*/
X if (print_stat != 0)
X {
X if (0x0001 & print_stat)
X prt_strength();
X if (0x0002 & print_stat)
X prt_dexterity();
X if (0x0004 & print_stat)
X prt_constitution();
X if (0x0008 & print_stat)
X prt_intelligence();
X if (0x0010 & print_stat)
X prt_wisdom();
X if (0x0020 & print_stat)
X prt_charisma();
X if (0x0040 & print_stat)
X prt_pac();
X if (0x0100 & print_stat)
X prt_mhp();
X if (0x0200 & print_stat)
X prt_title();
X if (0x0400 & print_stat)
X prt_level();
X }
X /* Check light status */
X i_ptr = &inventory[INVEN_LIGHT];
X if (player_light)
X if (i_ptr->p1 > 0)
X {
X i_ptr->p1--;
X if (i_ptr->p1 == 0)
X {
X player_light = FALSE;
X find_flag = FALSE;
X msg_print("Your light has gone out!");
X move_light(char_row, char_col, char_row, char_col);
X }
X else if (i_ptr->p1 < 40)
X if (randint(5) == 1)
X {
X if (find_flag)
X {
X find_flag = FALSE;
X move_light(char_row, char_col, char_row, char_col);
X }
X msg_print("Your light is growing faint.");
X }
X }
X else
X {
X player_light = FALSE;
X find_flag = FALSE;
X move_light(char_row, char_col, char_row, char_col);
X }
X else if (i_ptr->p1 > 0)
X {
X i_ptr->p1--;
X player_light = TRUE;
X move_light(char_row, char_col, char_row, char_col);
X }
X
X /* Update counters and messages */
X f_ptr = &py.flags;
X /* Check food status */
X regen_amount = PLAYER_REGEN_NORMAL;
X if (f_ptr->food < PLAYER_FOOD_ALERT)
X {
X if (f_ptr->food < PLAYER_FOOD_WEAK)
X {
X if (f_ptr->food < 0)
X regen_amount = 0;
X else if (f_ptr->food < PLAYER_FOOD_FAINT)
X regen_amount = PLAYER_REGEN_FAINT;
X else if (f_ptr->food < PLAYER_FOOD_WEAK)
X regen_amount = PLAYER_REGEN_WEAK;
X if ((0x00000002 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00000003;
X msg_print("You are getting weak from hunger.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X prt_hunger();
X }
X if (f_ptr->food < PLAYER_FOOD_FAINT)
X if (randint(8) == 1)
X {
X f_ptr->paralysis += randint(5);
X msg_print("You faint from the lack of food.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X }
X }
X else
X {
X if ((0x00000001 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00000001;
X msg_print("You are getting hungry.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X prt_hunger();
X }
X }
X }
X /* Food consumption */
X /* Note: Speeded up characters really burn up the food! */
X if (f_ptr->speed < 0)
X f_ptr->food += -(f_ptr->speed*f_ptr->speed) -
X f_ptr->food_digested;
X else
X f_ptr->food -= f_ptr->food_digested;
X /* Regenerate */
X p_ptr = &py.misc;
X if (f_ptr->regenerate) regen_amount = regen_amount * 1.5;
X if (f_ptr->rest > 0) regen_amount = regen_amount * 2;
X if (py.flags.poisoned < 1)
X if (p_ptr->chp < p_ptr->mhp)
X regenhp(regen_amount);
X if (p_ptr->cmana < p_ptr->mana)
X regenmana(regen_amount);
X /* Blindness */
X if (f_ptr->blind > 0)
X {
X if ((0x00000004 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00000004;
X prt_map();
X prt_blind();
X if (search_flag)
X search_off();
X }
X f_ptr->blind--;
X if (f_ptr->blind == 0)
X {
X f_ptr->status &= 0xFFFFFFFB;
X prt_blind();
X prt_map();
X msg_print("The veil of darkness lifts.");
X if (find_flag)
X {
X find_flag = FALSE;
X }
X /* turn light back on */
X move_char(5);
X /* light creatures */
X creatures(FALSE);
X }
X }
X /* Confusion */
X if (f_ptr->confused > 0)
X {
X if ((0x00000008 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00000008;
X prt_confused();
X }
X f_ptr->confused--;
X if (f_ptr->confused == 0)
X {
X f_ptr->status &= 0xFFFFFFF7;
X prt_confused();
X msg_print("You feel less confused now.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X }
X }
X /* Afraid */
X if (f_ptr->afraid > 0)
X {
X if ((0x00000010 & f_ptr->status) == 0)
X {
X if ((f_ptr->shero+f_ptr->hero) > 0)
X f_ptr->afraid = 0;
X else
X {
X f_ptr->status |= 0x00000010;
X prt_afraid();
X }
X }
X else if ((f_ptr->shero+f_ptr->hero) > 0)
X f_ptr->afraid = 1;
X f_ptr->afraid--;
X if (f_ptr->afraid == 0)
X {
X f_ptr->status &= 0xFFFFFFEF;
X prt_afraid();
X msg_print("You feel bolder now.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X }
X }
X /* Poisoned */
X if (f_ptr->poisoned > 0)
X {
X if ((0x00000020 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00000020;
X prt_poisoned();
X }
X f_ptr->poisoned--;
X if (f_ptr->poisoned == 0)
X {
X f_ptr->status &= 0xFFFFFFDF;
X prt_poisoned();
X msg_print("You feel better.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X }
X else
X {
X switch(con_adj())
X {
X case -4:
X take_hit(4, "poison.");
X break;
X case -3: case -2:
X take_hit(3, "poison.");
X break;
X case -1:
X take_hit(2, "poison.");
X break;
X case 0:
X take_hit(1, "poison.");
X break;
X case 1: case 2: case 3:
X if ((turn % 2) == 0)
X take_hit(1, "poison.");
X break;
X case 4: case 5:
X if ((turn % 3) == 0)
X take_hit(1, "poison.");
X break;
X case 6:
X if ((turn % 4) == 0)
X take_hit(1, "poison.");
X break;
X }
X }
X }
X /* Fast */
X if (f_ptr->fast > 0)
X {
X if ((0x00000040 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00000040;
X change_speed(-1);
X msg_print("You feel yourself moving faster.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X }
X f_ptr->fast--;
X if (f_ptr->fast == 0)
X {
X f_ptr->status &= 0xFFFFFFBF;
X change_speed(1);
X msg_print("You feel yourself slow down.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X }
X }
X /* Slow */
X if (f_ptr->slow > 0)
X {
X if ((0x00000080 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00000080;
X change_speed(1);
X msg_print("You feel yourself moving slower.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X }
X f_ptr->slow--;
X if (f_ptr->slow == 0)
X {
X f_ptr->status &= 0xFFFFFF7F;
X change_speed(-1);
X msg_print("You feel yourself speed up.");
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X }
X }
X /* Resting is over? */
X if (f_ptr->rest > 0)
X {
X#ifdef SLOW
X /* Hibernate every 20 iterations so that process does */
X /* not eat up system... */
X if ((f_ptr->rest % 20) == 1) (void) sleep(1);
X#endif
X f_ptr->rest--;
X /* do not need to refresh screen here, if any movement/hit occurs
X update_mon/take_hit will turn off resting and screen refreshes */
X /* put_qio(); */
X if (f_ptr->rest == 0) /* Resting over */
X rest_off();
X }
X /* Hallucinating? (Random characters appear!)*/
X if (f_ptr->image > 0)
X {
X f_ptr->image--;
X if (f_ptr->image == 0)
X draw_cave();
X }
X /* Paralysis */
X if (f_ptr->paralysis > 0)
X {
X /* when paralysis true, you can not see any movement that occurs */
X f_ptr->paralysis--;
X if (f_ptr->rest > 0)
X rest_off();
X if (search_flag)
X search_off();
X }
X /* Protection from evil counter*/
X if (f_ptr->protevil > 0) f_ptr->protevil--;
X /* Invulnerability */
X if (f_ptr->invuln > 0)
X {
X if ((0x00001000 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00001000;
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X py.misc.pac += 100;
X py.misc.dis_ac += 100;
X prt_pac();
X msg_print("Your skin turns into steel!");
X }
X f_ptr->invuln--;
X if (f_ptr->invuln == 0)
X {
X f_ptr->status &= 0xFFFFEFFF;
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X py.misc.pac -= 100;
X py.misc.dis_ac -= 100;
X prt_pac();
X msg_print("Your skin returns to normal...");
X }
X }
X /* Heroism */
X if (f_ptr->hero > 0)
X {
X if ((0x00002000 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00002000;
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X p_ptr = &py.misc;
X p_ptr->mhp += 10;
X p_ptr->chp += 10.0;
X p_ptr->bth += 12;
X p_ptr->bthb+= 12;
X msg_print("You feel like a HERO!");
X prt_mhp();
X }
X f_ptr->hero--;
X if (f_ptr->hero == 0)
X {
X f_ptr->status &= 0xFFFFDFFF;
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X p_ptr = &py.misc;
X p_ptr->mhp -= 10;
X if (p_ptr->chp > p_ptr->mhp) p_ptr->chp = p_ptr->mhp;
X p_ptr->bth -= 12;
X p_ptr->bthb-= 12;
X msg_print("The heroism wears off.");
X prt_mhp();
X }
X }
X /* Super Heroism */
X if (f_ptr->shero > 0)
X {
X if ((0x00004000 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00004000;
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X p_ptr = &py.misc;
X p_ptr->mhp += 20;
X p_ptr->chp += 20.0;
X p_ptr->bth += 24;
X p_ptr->bthb+= 24;
X msg_print("You feel like a SUPER HERO!");
X prt_mhp();
X }
X f_ptr->shero--;
X if (f_ptr->shero == 0)
X {
X f_ptr->status &= 0xFFFFBFFF;
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X p_ptr = &py.misc;
X p_ptr->mhp -= 20;
X if (p_ptr->chp > p_ptr->mhp) p_ptr->chp = p_ptr->mhp;
X p_ptr->bth -= 24;
X p_ptr->bthb-= 24;
X msg_print("The super heroism wears off.");
X prt_mhp();
X }
X }
X /* Blessed */
X if (f_ptr->blessed > 0)
X {
X if ((0x00008000 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00008000;
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X p_ptr = &py.misc;
X p_ptr->bth += 5;
X p_ptr->bthb+= 5;
X p_ptr->pac += 2;
X p_ptr->dis_ac+= 2;
X msg_print("You feel righteous!");
X prt_pac();
X }
X f_ptr->blessed--;
X if (f_ptr->blessed == 0)
X {
X f_ptr->status &= 0xFFFF7FFF;
X if (find_flag)
X {
X find_flag = FALSE;
X move_light (char_row, char_col, char_row, char_col);
X }
X p_ptr = &py.misc;
X p_ptr->bth -= 5;
X p_ptr->bthb-= 5;
X p_ptr->pac -= 2;
X p_ptr->dis_ac -= 2;
X msg_print("The prayer has expired.");
X prt_pac();
X }
X }
X /* Resist Heat */
X if (f_ptr->resist_heat > 0) f_ptr->resist_heat--;
X /* Resist Cold */
X if (f_ptr->resist_cold > 0) f_ptr->resist_cold--;
X /* Detect Invisible */
X if (f_ptr->detect_inv > 0)
X {
X if ((0x00010000 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00010000;
X f_ptr->see_inv = TRUE;
X }
X f_ptr->detect_inv--;
X if (f_ptr->detect_inv == 0)
X {
X f_ptr->status &= 0xFFFEFFFF;
X f_ptr->see_inv = FALSE;
X py_bonuses(blank_treasure, 0);
X }
X }
X /* Timed infra-vision */
X if (f_ptr->tim_infra > 0)
X {
X if ((0x00020000 & f_ptr->status) == 0)
X {
X f_ptr->status |= 0x00020000;
X f_ptr->see_infra++;
X }
X f_ptr->tim_infra--;
X if (f_ptr->tim_infra == 0)
X {
X f_ptr->status &= 0xFFFDFFFF;
X f_ptr->see_infra--;
X }
X }
X /* Word-of-Recall Note: Word-of-Recall is a delayed action */
X if (f_ptr->word_recall > 0)
X if (f_ptr->word_recall == 1)
X {
X moria_flag = TRUE;
X f_ptr->paralysis++;
X f_ptr->word_recall = 0;
X if (dun_level > 0)
X {
X dun_level = 0;
X msg_print("You feel yourself yanked upwards!");
X }
X else if (py.misc.max_lev != 0)
X {
X dun_level = py.misc.max_lev;
X msg_print("You feel yourself yanked downwards!");
X }
X }
X else
X f_ptr->word_recall--;
X
X /* Check hit points for adjusting... */
X p_ptr = &py.misc;
X if (!find_flag)
X if (py.flags.rest < 1)
X {
X if (old_chp != (int)(p_ptr->chp))
X {
X if (p_ptr->chp > p_ptr->mhp)
X p_ptr->chp = (double)p_ptr->mhp;
X prt_chp();
X old_chp = (int)p_ptr->chp;
X }
X if (old_cmana != (int)(p_ptr->cmana))
X {
X if (p_ptr->cmana > p_ptr->mana)
X p_ptr->cmana = (double)p_ptr->mana;
X prt_cmana();
X old_cmana = (int)p_ptr->cmana;
X }
X }
X
X if ((py.flags.paralysis < 1) && /* Accept a command? */
X (py.flags.rest < 1) &&
X (!death))
X /* Accept a command and execute it */
X {
X do
X {
X print_stat = 0;
X reset_flag = FALSE;
X /* Random teleportation */
X if (py.flags.teleport)
X if (randint(100) == 1)
X {
X find_flag = FALSE; /* no need for move_char(5) */
X teleport(40);
X }
X if (!find_flag)
X {
X /* move the cursor to the players character */
X print("", char_row, char_col);
X save_msg_flag = msg_flag;
X do
X {
X inkey(&command);
X }
X while (command == ' ');
X if (save_msg_flag) erase_line(MSG_LINE, 0);
X global_com_val = (command);
X }
X /* Commands are executed in following subroutines */
X if (key_bindings == ORIGINAL)
X original_commands(&global_com_val);
X else
X rogue_like_commands(&global_com_val);
X /* End of commands */
X }
X while ((reset_flag) && (!moria_flag));
X }
X /* Teleport? */
X if (teleport_flag) teleport(100);
X /* Move the creatures */
X if (!moria_flag) creatures(TRUE);
X /* Exit when moria_flag is set */
X }
X while (!moria_flag);
X if (search_flag) search_off(); /* Fixed "SLOW" bug; 06-11-86 RAK */
X}
X
X
Xoriginal_commands(com_val)
Xint *com_val;
X{
X int y, x, dir_val;
X char command;
X int i;
X vtype out_val, tmp_str;
X register struct stats *s_ptr;
X register struct flags *f_ptr;
X int set_floor();
X
X switch(*com_val)
X {
X case 0: case 11: /*^K == exit */
X flush();
X if (get_com("Enter 'Q' to quit", &command))
X switch(command)
X {
X case 'q': case 'Q':
X moria_flag = TRUE;
X death = TRUE;
X /* need dot on the end to be consistent with creature.c */
X (void) strcpy(died_from, "Quitting.");
X break;
X default:
X break;
X }
X reset_flag = TRUE;
X break;
X case 16: /*^P == repeat */
X repeat_msg ();
X reset_flag = TRUE;
X break;
X case 23:
X if (wizard1) /*^W == password*/
X {
X wizard1 = FALSE;
X wizard2 = FALSE;
X msg_print("Wizard mode off.");
X }
X else
X {
X if (check_pswd())
X {
X msg_print("Wizard mode on.");
X }
X }
X reset_flag = TRUE;
X break;
X case 18: /*^R == redraw */
X really_clear_screen();
X draw_cave();
X reset_flag = TRUE;
X break;
X case 24: /*^X == save */
X if (total_winner)
X {
X msg_print("You are a Total Winner, your character must be retired...");
X msg_print("Use <Control>-K to when you are ready to quit.");
X }
X else
X {
X if (search_flag) search_off();
X save_char(TRUE, FALSE);
X }
X reset_flag = TRUE;
X break;
X case 32: /*SPACE do nothing */
X reset_flag = TRUE;
X break;
X case '!': /*! == Shell */
X shell_out();
X reset_flag = TRUE;
X break;
X case 46: /*. == find */
X y = char_row;
X x = char_col;
X if (get_dir("Which direction?", &dir_val, com_val, &y, &x))
X {
X find_flag = TRUE;
X move_char(dir_val);
X }
X break;
X case 47: /* / == identify */
X ident_char();
X reset_flag = TRUE;
X break;
X case 49:
X move_char(*com_val - 48); /* Move dir 1 */
X break;
X case 50:
X move_char(*com_val - 48); /* Move dir 2 */
X break;
X case 51:
X move_char(*com_val - 48); /* Move dir 3 */
X break;
X case 52:
X move_char(*com_val - 48); /* Move dir 4 */
X break;
X case 53: /* Rest one turn */
X move_char(*com_val - 48);
X#ifdef SLOW
X (void) sleep(0); /* Sleep 1/10 a second*/
X#endif
X flush();
X break;
X case 54:
X move_char(*com_val - 48); /* Move dir 6 */
X break;
X case 55:
X move_char(*com_val - 48); /* Move dir 7 */
X break;
X case 56:
X move_char(*com_val - 48); /* Move dir 8 */
X break;
X case 57:
X move_char(*com_val - 48); /* Move dir 9 */
X break;
X case 60:
X go_up(); /*< == go up */
X break;
X case 62:
X go_down(); /*> == go down */
X break;
X case 63: /*? == help */
X original_help();
X reset_flag = TRUE; /* Free move */
X break;
X case 66:
X bash(); /*B == bash */
X break;
X case 67: /*C == character*/
X if (get_com("Print to file? (Y/N)", &command))
X switch(command)
X {
X case 'y': case 'Y':
X file_character();
X break;
X case 'n': case 'N':
X change_name();
X draw_cave();
X break;
X default:
X break;
X }
X reset_flag = TRUE; /* Free move */
X break;
X case 68:
X disarm_trap(); /*D == disarm */
X break;
X case 69:
X eat(); /*E == eat */
X break;
X case 70:
X refill_lamp(); /*F == refill */
X break;
X case 76: /*L == location */
X if ((py.flags.blind > 0) || (no_light()))
X msg_print("You can't see your map.");
X else
X {
X (void) sprintf(out_val,
X "Section [%d,%d]; Location == [%d,%d]",
X (((char_row-1)/OUTPAGE_HEIGHT)+1),
X (((char_col-1)/OUTPAGE_WIDTH )+1),
X char_row, char_col);
X msg_print(out_val);
X }
X reset_flag = TRUE; /* Free move */
X break;
X case 80: /*P == print map*/
X if ((py.flags.blind > 0) || (no_light()))
X msg_print("You can't see to draw a map.");
X else
X print_map();
X reset_flag = TRUE; /* Free move */
X break;
X case 82:
X rest(); /*R == rest */
X break;
X case 83:
X if (search_flag) /*S == srh mode */
X {
X search_off();
X reset_flag = TRUE; /* Free move */
X }
X else if (py.flags.blind > 0)
X msg_print("You are incapable of searching while blind.");
X else
X {
X search_on();
X reset_flag = TRUE; /* Free move */
X }
X break;
X case 84:
X y = char_row;
X x = char_col;
X if (get_dir("Which direction?", &dir_val, com_val, &y, &x))
X {
X tunnel(y, x); /*T == tunnel */
X }
X break;
X case 97:
X aim(); /*a == aim */
X break;
X case 98:
X examine_book(); /*b == browse */
X reset_flag = TRUE;
X break;
X case 99:
X closeobject(); /*c == close */
X break;
X case 100:
X drop(); /*d == drop */
X break;
X case 101: /*e == equipment*/
X reset_flag = TRUE; /* Free move */
X if (inven_command('e', 0, 0)) draw_cave();
X break;
X case 102:
X throw_object(); /*f == throw */
X break;
X#if 0
X case 104: /*h == moria hlp */
X moria_help("");
X draw_cave();
X reset_flag = TRUE; /* Free move */
X break;
X#endif
X case 105: /*i == inventory*/
X reset_flag = TRUE; /* Free move */
X if (inven_command('i', 0, 0)) draw_cave();
X break;
X case 106:
X jamdoor(); /*j == jam */
X break;
X case 108: /*l == look */
X look();
X reset_flag = TRUE; /* Free move */
X break;
X case 109:
X cast(); /*m == magick */
X break;
X case 111:
X openobject(); /*o == open */
X break;
X case 112:
X pray(); /*p == pray */
X break;
X case 113:
X quaff(); /*q == quaff */
X break;
X case 114:
X read_scroll(); /*r == read */
X break;
X case 115:
X if (py.flags.blind > 0) /*s == search */
X msg_print("You are incapable of searching while blind.");
X else
X search(char_row, char_col, py.misc.srh);
X break;
X case 116: /*t == unwear */
X reset_flag = TRUE;
X if (inven_command('t', 0, 0)) draw_cave();
X break;
X case 117:
X use(); /*u == use staff*/
X break;
X case 118:
X game_version(); /*v == version */
X reset_flag = TRUE;
X break;
X case 119: /*w == wear */
X reset_flag = TRUE;
X if (inven_command('w', 0, 0)) draw_cave();
X break;
X case 120: /*x == exchange */
X reset_flag = TRUE;
X if (inven_command('x', 0, 0)) draw_cave();
X break;
X default:
X if (wizard1)
X {
X reset_flag = TRUE; /* Wizard commands are free moves*/
X switch(*com_val)
X {
X case 1: /*^A == Cure all*/
X (void) remove_curse();
X (void) cure_blindness();
X (void) cure_confusion();
X (void) cure_poison();
X (void) remove_fear();
X s_ptr = &py.stats;
X s_ptr->cstr = s_ptr->str;
X s_ptr->cint = s_ptr->intel;
X s_ptr->cwis = s_ptr->wis;
X s_ptr->cdex = s_ptr->dex;
X s_ptr->ccon = s_ptr->con;
X s_ptr->cchr = s_ptr->chr;
X f_ptr = &py.flags;
X if (f_ptr->slow > 1)
X f_ptr->slow = 1;
X if (f_ptr->image > 1)
X f_ptr->image = 1;
X /* put_qio(); */
X /* adjust misc stats */
X py_bonuses(blank_treasure, 0);
X break;
X case 2:
X print_objects(); /*^B == objects */
X break;
X case 4: /*^D == up/down */
X prt("Go to which level (0 -1200) ? ", 0, 0);
X i = -1;
X if (get_string(tmp_str, 0, 30, 10))
X (void) sscanf(tmp_str, "%d", &i);
X if (i > -1)
X {
X dun_level = i;
X if (dun_level > 1200)
X dun_level = 1200;
X moria_flag = TRUE;
X }
X else
X erase_line(MSG_LINE, 0);
X break;
X case 8:
X original_wizard_help(); /*^H == wizhelp */
X break;
X case 9:
X (void) ident_spell(); /*^I == identify*/
X break;
X case 14:
X print_monsters(); /*^N == mon map */
X break;
X case 12:
X wizard_light(); /*^L == wizlight*/
X break;
X case 20:
X teleport(100); /*^T == teleport*/
X break;
X case 22:
X restore_char(); /*^V == restore */
X prt_stat_block();
X moria_flag = TRUE;
X break;
X default:
X if (wizard2)
X switch(*com_val)
X {
X case 5:
X change_character(); /*^E == wizchar */
X break;
X case 6:
X (void) mass_genocide(); /*^F == genocide*/
X /* put_qio(); */
X break;
X case 7: /*^G == treasure*/
X alloc_object(set_floor, 5, 10);
X /* put_qio(); */
X break;
X case 10: /*^J == gain exp*/
X if (py.misc.exp == 0)
X py.misc.exp = 1;
X else
X py.misc.exp = py.misc.exp * 2;
X prt_experience();
X break;
X case 21: /*^U == summon */
X y = char_row;
X x = char_col;
X (void) summon_monster(&y, &x, TRUE);
X creatures(FALSE);
X break;
X case '@':
X wizard_create(); /*^Q == create */
X break;
X default:
X prt("Type '?' or '^H' for help...", 0, 0);
X break;
X }
X else
X prt("Type '?' or '^H' for help...", 0, 0);
X }
X }
X else
X {
X prt("Type '?' for help...", 0, 0);
X reset_flag = TRUE;
X }
X }
X}
X
X
Xrogue_like_commands(com_val)
Xint *com_val;
X{
X int y, x;
X char command;
X int i;
X vtype out_val, tmp_str;
X register struct stats *s_ptr;
X register struct flags *f_ptr;
X int set_floor();
X
X switch(*com_val)
X {
X case 0: case 'Q': /*Q == exit */
X flush();
X if (get_com("Do you really want to quit?", &command))
X switch(command)
X {
X case 'y': case 'Y':
X moria_flag = TRUE;
X death = TRUE;
X /* need dot on the end to be consistent with creature.c */
X (void) strcpy(died_from, "Quitting.");
X break;
X default:
X break;
X }
X reset_flag = TRUE;
X break;
X case 16: /*^P == repeat */
X repeat_msg ();
X reset_flag = TRUE;
X break;
X case 23:
X if (wizard1) /*^W == password*/
X {
X wizard1 = FALSE;
X wizard2 = FALSE;
X msg_print("Wizard mode off.");
X }
X else
X {
X if (check_pswd())
X {
X msg_print("Wizard mode on.");
X }
X }
X reset_flag = TRUE;
X break;
X case 18: /*^R == redraw */
X really_clear_screen();
X draw_cave();
X reset_flag = TRUE;
X break;
X case 24: /*^X == save */
X if (total_winner)
X {
X msg_print("You are a Total Winner, your character must be retired...");
X msg_print("Use 'Q' to when you are ready to quit.");
X }
X else
X {
X if (search_flag) search_off();
X save_char(TRUE, FALSE);
X }
X reset_flag = TRUE;
X break;
X case ' ': /*SPACE do nothing */
X reset_flag = TRUE;
X break;
X case '!': /*! == Shell */
X shell_out();
X reset_flag = TRUE;
X break;
X case 'b':
X move_char(1);
X break;
X case 'j':
X move_char(2);
X break;
X case 'n':
X move_char(3);
X break;
X case 'h':
X move_char(4);
X break;
X case 'l':
X move_char(6);
X break;
X case 'y':
X move_char(7);
X break;
X case 'k':
X move_char(8);
X break;
X case 'u':
X move_char(9);
X break;
X case 'B': /*. == find */
X find_flag = TRUE;
X move_char(1);
X break;
X case 'J': /*. == find */
X find_flag = TRUE;
X move_char(2);
X break;
X case 'N': /*. == find */
X find_flag = TRUE;
X move_char(3);
X break;
X case 'H': /*. == find */
X find_flag = TRUE;
X move_char(4);
X break;
X case 'L': /*. == find */
X find_flag = TRUE;
X move_char(6);
X break;
X case 'Y': /*. == find */
X find_flag = TRUE;
X move_char(7);
X break;
X case 'K': /*. == find */
X find_flag = TRUE;
X move_char(8);
X break;
X case 'U': /*. == find */
X find_flag = TRUE;
X move_char(9);
X break;
X case '/': /* / == identify */
X ident_char();
X reset_flag = TRUE;
X break;
X case '1':
X move_char(1); /* Move dir 1 */
X break;
X case '2':
X move_char(2); /* Move dir 2 */
X break;
X case '3':
X move_char(3); /* Move dir 3 */
X break;
X case '4':
X move_char(4); /* Move dir 4 */
X break;
X case '5': /* Rest one turn */
X case '.':
X move_char(5);
X#ifdef SLOW
X (void) sleep(0); /* Sleep 1/10 a second*/
X#endif
X flush();
X break;
X case '6':
X move_char(6); /* Move dir 6 */
X break;
X case '7':
X move_char(7); /* Move dir 7 */
X break;
X case '8':
X move_char(8); /* Move dir 8 */
X break;
X case '9':
X move_char(9); /* Move dir 9 */
X break;
X case '<':
X go_up(); /*< == go up */
X break;
X case '>':
X go_down(); /*> == go down */
X break;
X case '?': /*? == help */
X rogue_like_help();
X reset_flag = TRUE; /* Free move */
X break;
X case 'f':
X bash(); /*f == bash */
X break;
X case 'C': /*C == character*/
X if (get_com("Print to file? (Y/N)", &command))
X switch(command)
X {
X case 'y': case 'Y':
X file_character();
X break;
X case 'n': case 'N':
X change_name();
X draw_cave();
X break;
X default:
X break;
X }
X reset_flag = TRUE; /* Free move */
X break;
X case 'D':
X disarm_trap(); /*D == disarm */
X break;
X case 'E':
X eat(); /*E == eat */
X break;
X case 'F':
X refill_lamp(); /*F == refill */
X break;
X case 'W': /*W == location */
X if ((py.flags.blind > 0) || (no_light()))
X msg_print("You can't see your map.");
X else
X {
X (void) sprintf(out_val,
X "Section [%d,%d]; Location == [%d,%d]",
X (((char_row-1)/OUTPAGE_HEIGHT)+1),
X (((char_col-1)/OUTPAGE_WIDTH )+1),
X char_row, char_col);
X msg_print(out_val);
X }
X reset_flag = TRUE; /* Free move */
X break;
X case 'M': /*M == print map*/
X if ((py.flags.blind > 0) || (no_light()))
X msg_print("You can't see to draw a map.");
X else
X print_map();
X reset_flag = TRUE; /* Free move */
X break;
X case 'R':
X rest(); /*R == rest */
X break;
X case '#':
X if (search_flag) /*^S == srh mode */
X {
X search_off();
X reset_flag = TRUE; /* Free move */
X }
X else if (py.flags.blind > 0)
X msg_print("You are incapable of searching while blind.");
X else
X {
X search_on();
X reset_flag = TRUE; /* Free move */
X }
X break;
X case 25: /* ^Y */
X x = char_row;
X y = char_col;
X (void) move(7, &x, &y);
X tunnel(x, y);
X break;
X case 11: /* ^K */
X x = char_row;
X y = char_col;
X (void) move(8, &x, &y);
X tunnel(x, y);
X break;
X case 21: /* ^U */
X x = char_row;
X y = char_col;
X (void) move(9, &x, &y);
X tunnel(x, y);
X break;
X case 12: /* ^L */
X x = char_row;
X y = char_col;
X (void) move(6, &x, &y);
X tunnel(x, y);
X break;
X case 14: /* ^N */
X x = char_row;
X y = char_col;
X (void) move(3, &x, &y);
X tunnel(x, y);
X break;
X case 10: /* ^J */
X x = char_row;
X y = char_col;
X (void) move(2, &x, &y);
X tunnel(x, y);
X break;
X case 2: /* ^B */
X x = char_row;
X y = char_col;
X (void) move(1, &x, &y);
X tunnel(x, y);
X break;
X case 8: /* ^H */
X x = char_row;
X y = char_col;
X (void) move(4, &x, &y);
X tunnel(x, y);
X break;
X case 'z':
X aim(); /*z == aim */
X break;
X case 'P':
X examine_book(); /*P == browse */
X reset_flag = TRUE;
X break;
X case 'c':
X closeobject(); /*c == close */
X break;
X case 'd':
X drop(); /*d == drop */
X break;
X case 'e': /*e == equipment*/
X reset_flag = TRUE; /* Free move */
X if (inven_command('e', 0, 0)) draw_cave();
X break;
X case 't':
X throw_object(); /*t == throw */
X break;
X#if 0
X case 104: /*h == moria hlp */
X moria_help("");
X draw_cave();
X reset_flag = TRUE; /* Free move */
X break;
X#endif
X case 'i': /*i == inventory*/
X reset_flag = TRUE; /* Free move */
X if (inven_command('i', 0, 0)) draw_cave();
X break;
X case 'S':
X jamdoor(); /*S == jam */
X break;
X case 'x': /*l == look */
X look();
X reset_flag = TRUE; /* Free move */
X break;
X case 'm':
X cast(); /*m == magick */
X break;
X case 'o':
X openobject(); /*o == open */
X break;
X case 'p':
X pray(); /*p == pray */
X break;
X case 'q':
X quaff(); /*q == quaff */
X break;
X case 'r':
X read_scroll(); /*r == read */
X break;
X case 's':
X if (py.flags.blind > 0) /*s == search */
X msg_print("You are incapable of searching while blind.");
X else
X search(char_row, char_col, py.misc.srh);
X break;
X case 'T': /*T == unwear */
X reset_flag = TRUE;
X if (inven_command('t', 0, 0)) draw_cave();
X break;
X case 'Z':
X use(); /*Z == use staff*/
X break;
X case 'v':
X game_version(); /*v == version */
X reset_flag = TRUE;
X break;
X case 'w': /*w == wear */
X reset_flag = TRUE;
X if (inven_command('w', 0, 0)) draw_cave();
X break;
X case 'X': /*x == exchange */
X reset_flag = TRUE;
X if (inven_command('x', 0, 0)) draw_cave();
X break;
X default:
X if (wizard1)
X {
X reset_flag = TRUE; /* Wizard commands are free moves*/
X switch(*com_val)
X {
X case 1: /*^A == Cure all*/
X (void) remove_curse();
X (void) cure_blindness();
X (void) cure_confusion();
X (void) cure_poison();
X (void) remove_fear();
X s_ptr = &py.stats;
X s_ptr->cstr = s_ptr->str;
X s_ptr->cint = s_ptr->intel;
X s_ptr->cwis = s_ptr->wis;
X s_ptr->cdex = s_ptr->dex;
X s_ptr->ccon = s_ptr->con;
X s_ptr->cchr = s_ptr->chr;
X f_ptr = &py.flags;
X if (f_ptr->slow > 1)
X f_ptr->slow = 1;
X if (f_ptr->image > 1)
X f_ptr->image = 1;
X /* put_qio(); */
X /* adjust misc stats */
X py_bonuses(blank_treasure, 0);
X break;
X case 15:
X print_objects(); /*^O == objects */
X break;
X case 4: /*^D == up/down */
X prt("Go to which level (0 -1200) ? ", 0, 0);
X i = -1;
X if (get_string(tmp_str, 0, 30, 10))
X (void) sscanf(tmp_str, "%d", &i);
X if (i > -1)
X {
X dun_level = i;
X if (dun_level > 1200)
X dun_level = 1200;
X moria_flag = TRUE;
X }
X else
X erase_line(MSG_LINE, 0);
X break;
X case 127: /* ^? DEL */
X rogue_like_wizard_help(); /*DEL == wizhelp */
X break;
X case 9:
X (void) ident_spell(); /*^I == identify*/
X break;
X case 13:
X print_monsters(); /*^M == mon map */
X break;
X case '*':
X wizard_light(); /*` == wizlight*/
X break;
X case 20:
X teleport(100); /*^T == teleport*/
X break;
X case 22:
X restore_char(); /*^V == restore */
X prt_stat_block();
X moria_flag = TRUE;
X break;
X default:
X if (wizard2)
X switch(*com_val)
X {
X case 5:
X change_character(); /*^E == wizchar */
X break;
X case 6:
X (void) mass_genocide(); /*^F == genocide*/
X /* put_qio(); */
X break;
X case 7: /*^G == treasure*/
X alloc_object(set_floor, 5, 10);
X /* put_qio(); */
X break;
X case '+': /*+ == gain exp*/
X if (py.misc.exp == 0)
X py.misc.exp = 1;
X else
X py.misc.exp = py.misc.exp * 2;
X prt_experience();
X break;
X case 19: /*^S == summon */
X y = char_row;
X x = char_col;
X (void) summon_monster(&y, &x, TRUE);
X creatures(FALSE);
X break;
X case '@':
X wizard_create(); /*^Q == create */
X break;
X default:
X prt("Type '?' or DELETE for help...", 0, 0);
X break;
X }
X else
X prt("Type '?' or DELETE for help...", 0, 0);
X }
X }
X else
X {
X prt("Type '?' for help...", 0, 0);
X reset_flag = TRUE;
X }
X }
X}
END_OF_FILE
if test 41566 -ne `wc -c <'dungeon.c'`; then
echo shar: \"'dungeon.c'\" unpacked with wrong size!
fi
# end of 'dungeon.c'
fi
if test -f 'potions.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'potions.c'\"
else
echo shar: Extracting \"'potions.c'\" \(9078 characters\)
sed "s/^X//" >'potions.c' <<'END_OF_FILE'
X#include "constants.h"
X#include "config.h"
X#include "types.h"
X#include "externs.h"
X
X
X/* Potions for the quaffing -RAK- */
Xquaff()
X{
X unsigned int i;
X int j, k, l, item_val;
X int redraw, ident;
X register treasure_type *i_ptr;
X register struct misc *m_ptr;
X register struct flags *f_ptr;
X register struct stats *s_ptr;
X register class_type *c_ptr;
X
X reset_flag = TRUE;
X if (inven_ctr > 0)
X {
X if (find_range(75, 76, &j, &k))
X {
X redraw = FALSE;
X if (get_item(&item_val, "Quaff which potion?", &redraw, j, k))
X {
X i_ptr = &inventory[item_val];
X if (redraw) draw_cave();
X reset_flag = FALSE;
X i = i_ptr->flags;
X ident = FALSE;
X while (i != 0)
X {
X j = bit_pos(&i) + 1;
X if (i_ptr->tval == 76)
X j += 31;
X /* Potions */
X switch(j)
X {
X case 1:
X s_ptr = &py.stats;
X s_ptr->cstr = in_statp(s_ptr->cstr);
X if (s_ptr->cstr > s_ptr->str)
X s_ptr->str = s_ptr->cstr;
X msg_print("Wow! What bulging muscles!");
X prt_strength();
X ident = TRUE;
X /* adjust misc stats */
X py_bonuses(blank_treasure, 0);
X break;
X case 2:
X ident = lose_str();
X break;
X case 3:
X s_ptr = &py.stats;
X s_ptr->cstr = s_ptr->str;
X msg_print("You feel warm all over.");
X prt_strength();
X ident = TRUE;
X /* adjust misc stats */
X py_bonuses(blank_treasure, 0);
X break;
X case 4:
X s_ptr = &py.stats;
X s_ptr->cint = in_statp(s_ptr->cint);
X if (s_ptr->cint > py.stats.intel)
X py.stats.intel = s_ptr->cint;
X msg_print("Aren't you brilliant!");
X prt_intelligence();
X ident = TRUE;
X break;
X case 5:
X msg_print("This potion tastes very dull.");
X ident = lose_int();
X break;
X case 6:
X s_ptr = &py.stats;
X s_ptr->cint = py.stats.intel;
X msg_print("You have have a warm feeling.");
X prt_intelligence();
X ident = TRUE;
X break;
X case 7:
X s_ptr = &py.stats;
X s_ptr->cwis = in_statp(s_ptr->cwis);
X if (s_ptr->cwis > s_ptr->wis)
X s_ptr->wis = s_ptr->cwis;
X msg_print("You suddenly have a profound thought!");
X prt_wisdom();
X ident = TRUE;
X break;
X case 8:
X ident = lose_wis();
X break;
X case 9:
X s_ptr = &py.stats;
X if (s_ptr->cwis < s_ptr->wis)
X {
X s_ptr->cwis = s_ptr->wis;
X msg_print("You feel your wisdom returning.");
X prt_wisdom();
X ident = TRUE;
X }
X break;
X case 10:
X s_ptr = &py.stats;
X s_ptr->cchr = in_statp(s_ptr->cchr);
X if (s_ptr->cchr > s_ptr->chr)
X s_ptr->chr = s_ptr->cchr;
X msg_print("Gee, ain't you cute!");
X prt_charisma();
X ident = TRUE;
X break;
X case 11:
X ident = lose_chr();
X break;
X case 12:
X s_ptr = &py.stats;
X if (s_ptr->cchr < s_ptr->chr)
X {
X s_ptr->cchr = s_ptr->chr;
X msg_print("You feel your looks returning.");
X prt_charisma();
X ident = TRUE;
X }
X break;
X case 13:
X ident = hp_player(damroll("2d7"), "a potion.");
X break;
X case 14:
X ident = hp_player(damroll("4d7"), "a potion.");
X break;
X case 15:
X ident = hp_player(damroll("6d7"), "a potion.");
X break;
X case 16:
X ident = hp_player(1000, "a potion.");
X break;
X case 17:
X m_ptr = &py.misc;
X py.stats.ccon = in_statp(py.stats.ccon);
X if (py.stats.ccon > py.stats.con)
X py.stats.con = py.stats.ccon;
X m_ptr->mhp++;
X m_ptr->chp += m_ptr->mhp;
X msg_print("You feel tingly for a moment.");
X prt_mhp();
X prt_chp();
X prt_constitution();
X ident = TRUE;
X break;
X case 18:
X m_ptr = &py.misc;
X l = (m_ptr->exp / 2) + 10;
X if (l > 100000) l = 100000;
X m_ptr->exp += l;
X msg_print("You feel more experienced.");
X prt_experience();
X ident = TRUE;
X break;
X case 19:
X f_ptr = &py.flags;
X if (!f_ptr->free_act)
X {
X msg_print("You fall asleep.");
X f_ptr->paralysis += randint(4) + 4;
X ident = TRUE;
X }
X break;
X case 20:
X f_ptr = &py.flags;
X msg_print("You are covered by a veil of darkness.");
X f_ptr->blind += randint(100) + 100;
X ident = TRUE;
X break;
X case 21:
X f_ptr = &py.flags;
X msg_print("Hey! This is good stuff! * Hick! *");
X f_ptr->confused += randint(20) + 12;
X ident = TRUE;
X break;
X case 22:
X f_ptr = &py.flags;
X msg_print("You feel very sick.");
X f_ptr->poisoned += randint(15) + 10;
X ident = TRUE;
X break;
X case 23:
X py.flags.fast += randint(25) + 15;
X ident = TRUE;
X break;
X case 24:
X py.flags.slow += randint(25) + 15;
X ident = TRUE;
X break;
X case 25:
X ident = detect_monsters();
X break;
X case 26:
X s_ptr = &py.stats;
X s_ptr->cdex = in_statp(s_ptr->cdex);
X if (s_ptr->cdex > s_ptr->dex)
X s_ptr->dex = s_ptr->cdex;
X msg_print("You feel more limber!");
X prt_dexterity();
X ident = TRUE;
X /* adjust misc stats */
X py_bonuses(blank_treasure, 0);
X break;
X case 27:
X s_ptr = &py.stats;
X if (s_ptr->cdex < s_ptr->dex)
X {
X s_ptr->cdex = s_ptr->dex;
X msg_print("You feel less clumsy.");
X prt_dexterity();
X ident = TRUE;
X /* adjust misc stats */
X py_bonuses(blank_treasure, 0);
X }
X break;
X case 28:
X s_ptr= &py.stats;
X if (s_ptr->ccon < s_ptr->con)
X {
X s_ptr->ccon = s_ptr->con;
X msg_print("You feel your health returning!");
X prt_constitution();
X ident = TRUE;
X }
X break;
X case 29:
X (void) cure_blindness();
X break;
X case 30:
X (void) cure_confusion();
X break;
X case 31:
X (void) cure_poison();
X break;
X case 32:
X m_ptr = &py.misc;
X c_ptr = &class[m_ptr->pclass];
X if (c_ptr->mspell)
X {
X ident = learn_spell(&redraw);
X if (redraw) draw_cave();
X }
X else if (c_ptr->pspell)
X ident = learn_prayer();
X break;
X case 33:
X msg_print("You feel your memories fade...");
X /* avoid randint(0) call */
X l = (py.misc.exp/5.0);
X if (l == 0)
X lose_exp(1);
X else
X lose_exp(randint(l)+l);
X ident = TRUE;
X break;
X case 34:
X f_ptr = &py.flags;
X (void) cure_poison();
X if (f_ptr->food > 150) f_ptr->food = 150;
X f_ptr->paralysis = 4;
X msg_print("The potion makes you vomit!");
X ident = TRUE;
X break;
X case 35:
X py.flags.invuln += randint(10) + 10;
X ident = TRUE;
X break;
X case 36:
X py.flags.hero += randint(25) + 25;
X ident = TRUE;
X break;
X case 37:
X py.flags.shero += randint(25) + 25;
X ident = TRUE;
X break;
X case 38:
X ident = remove_fear();
X break;
X case 39:
X ident = restore_level();
X break;
X case 40:
X f_ptr = &py.flags;
X f_ptr->resist_heat += randint(10) + 10;
X break;
X case 41:
X f_ptr = &py.flags;
X f_ptr->resist_cold += randint(10) + 10;
X break;
X case 42:
X detect_inv2(randint(12)+12);
X break;
X case 43:
X ident = slow_poison();
X break;
X case 44:
X ident = cure_poison();
X break;
X case 45:
X m_ptr = &py.misc;
X if (m_ptr->cmana < m_ptr->mana)
X {
X m_ptr->cmana = (double)m_ptr->mana;
X ident = TRUE;
X msg_print("Your feel your head clear...");
X }
X break;
X case 46:
X f_ptr = &py.flags;
X f_ptr->tim_infra += 100 + randint(100);
X ident = TRUE;
X msg_print("Your eyes begin to tingle.");
X break;
X case 47:
X break;
X case 48:
X break;
X case 49:
X break;
X case 50:
X break;
X case 51:
X break;
X case 52:
X break;
X case 53:
X break;
X case 54:
X break;
X case 55:
X break;
X case 56:
X break;
X case 57:
X break;
X case 58:
X break;
X case 59:
X break;
X case 60:
X break;
X case 61:
X break;
X case 62:
X break;
X default:
X break;
X }
X /* End of Potions... */
X }
X if (ident)
X identify(inventory[item_val]);
X if (i_ptr->flags != 0)
X {
X m_ptr = &py.misc;
X m_ptr->exp += (int)(i_ptr->level/m_ptr->lev + 0.5);
X prt_experience();
X }
X add_food(i_ptr->p1);
X desc_remain(item_val);
X inven_destroy(item_val);
X }
X else
X if (redraw) draw_cave();
X }
X else
X msg_print("You are not carrying any potions.");
X }
X else
X msg_print("But you are not carrying anything.");
X}
END_OF_FILE
if test 9078 -ne `wc -c <'potions.c'`; then
echo shar: \"'potions.c'\" unpacked with wrong size!
fi
# end of 'potions.c'
fi
if test -f 'shar.script' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'shar.script'\"
else
echo shar: Extracting \"'shar.script'\" \(741 characters\)
sed "s/^X//" >'shar.script' <<'END_OF_FILE'
Xshar README INSTALL Flexnames Highscores Int16bit.patch MISC_NOTES Makefile\
X constants.h create.c > Part01
X
Xshar Moria.doc > Part02
X
Xshar Moria.man Moria.man.alt Moria_hours Moria_news PROBLEMS io.c sets.c\
X > Part03
X
Xshar PRONOUNCE Xenix.patch config.h > Part04
X
Xshar creature.c death.c desc.c > Part05
X
Xshar dungeon.c eat.c externs.h > Part06
X
Xshar files.c generate.c > Part07
X
Xshar magic.c main.c misc1.c > Part08
X
Xshar misc2.c scrolls.c > Part09
X
Xshar monsters.c potions.c > Part10
X
Xshar moria1.c prayer.c > Part11
X
Xshar moria2.c signals.c > Part12
X
Xshar spells.c > Part13
X
Xshar help.c staffs.c store1.c store2.c > Part14
X
Xshar treasure1.c > Part15
X
Xshar save.c treasure2.c types.h > Part16
X
Xshar variables.c wands.c wizard.c > Part17
END_OF_FILE
if test 741 -ne `wc -c <'shar.script'`; then
echo shar: \"'shar.script'\" unpacked with wrong size!
fi
# end of 'shar.script'
fi
echo shar: End of archive 9 \(of 18\).
cp /dev/null ark9isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 18 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0