[comp.sources.games] v03i049: omega - rogue like dungeon exploration, Part02/15

games-request@tekred.TEK.COM (01/20/88)

Submitted by: "Laurence R. Brothers" <brothers@paul.rutgers.edu>
Comp.sources.games: Volume 3, Issue 49
Archive-name: omega/Part02

#! /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 2 (of 15)."
# Contents:  ofile.c oitemf.c
# Wrapped by billr@tekred on Mon Jan 18 10:20:11 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f ofile.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"ofile.c\"
else
echo shar: Extracting \"ofile.c\" \(10374 characters\)
sed "s/^X//" >ofile.c <<'END_OF_ofile.c'
X/* omega (c) 1987 by Laurence Raphael Brothers */
X/* ofile.c */
X/* functions with file access in them. Also some direct calls to
X   curses functions */
X
X#include <curses.h>
X#include <strings.h>
X#include <sys/file.h>
X#include "oglob.h"
X
X/* from ocom */
Xextern void save();
X
X/* from  outil */
Xextern int calc_points();
X
X/* from oscr */
Xextern void endgraf(),xredraw(),printm(),mprint(),morewait();
Xextern char ynq(), mgetc();
X
X/* ofile functions */
Xvoid commandlist(),helpfile(),showfile(),showscores();
Xvoid extendlog(),filescanstring(),checkhigh();
Xvoid theologyfile(),cityguidefile();
Xint filecheck();
X
XFILE *checkfopen();
X
XFILE *checkfopen(filestring,optionstring)
Xchar *filestring,*optionstring;
X{
X  FILE *fd;
X  char response;
X  fd = fopen(filestring,optionstring);
X  while (fd == NULL) {
X    printm("\nWarning! Error opening file:");
X    mprint(filestring);
X    mprint(" Abort or Retry? [ar] ");
X    do response = mgetc(); while ((response != 'a') && (response != 'r'));
X    if (response == 'r') fd = fopen(filestring,optionstring);
X    else {
X      endgraf();
X      printf("\n\nSorry 'bout that.... Bye!");
X      exit(0);
X    }
X  }
X  return(fd);
X}
X
Xvoid commandlist()
X{
X  FILE *fd; 
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"ocommands.txt");
X  fd = checkfopen(Str1,"r");
X  showfile(fd);
X  fclose(fd);
X  clear();
X  refresh();
X  xredraw();
X}
X
Xvoid helpfile()
X{
X  FILE *fd;
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"ohelp.txt");
X  fd = checkfopen(Str1,"r");
X  showfile(fd);
X  fclose(fd);
X  clear();
X  refresh();
X  xredraw();
X}
X
Xvoid cityguidefile()
X{
X  FILE *fd;
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"oscroll2.txt");
X  fd = checkfopen(Str1,"r");
X  showfile(fd);
X  fclose(fd);
X  clear();
X  refresh();
X  xredraw();
X}
X
Xvoid theologyfile()
X{
X  FILE *fd;
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"oscroll1.txt");
X  fd = checkfopen(Str1,"r");
X  showfile(fd);
X  fclose(fd);
X  clear();
X  refresh();
X}
X
X
X
X
X/* display a file page at a time */
Xvoid showfile(fd)
XFILE *fd;
X{
X  char c,d=' ';
X  int x,y;
X  clear();
X  refresh();
X  c = fgetc(fd);
X  while ((c != EOF)&&(d != 'q')&&(d!=ESCAPE)) {
X    getyx(stdscr,y,x);
X    if (y > 20) {
X      printw("\n-More-");
X      refresh();
X      d = wgetch(stdscr);
X      clear();
X    }
X    printw("%c",c);
X    c = fgetc(fd);
X  }
X  if ((d != 'q')&&(d!=ESCAPE)) {
X    printw("\n-Done-");
X    refresh();
X    getch();
X  }
X}    
X
X
X
Xvoid showscores()
X{
X  FILE *fd;
X  int i;
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"omega.hiscore");
X  fd = checkfopen(Str1,"r");
X  filescanstring(fd,Hiscorer);
X  filescanstring(fd,Hidescrip);
X  fscanf(fd,"%d\n%d\n%d\n",&Hiscore,&Hilevel,&Hibehavior);
X  filescanstring(fd,Duke);
X  fscanf(fd,"%d\n%d\n",&Dukelevel,&Dukebehavior);
X  filescanstring(fd,Commandant);
X  fscanf(fd,"%d\n%d\n",&Commandantlevel,&Commandantbehavior);
X  filescanstring(fd,Champion);
X  fscanf(fd,"%d\n%d\n",&Championlevel,&Championbehavior);
X  filescanstring(fd,Archmage);
X  fscanf(fd,"%d\n%d\n",&Archmagelevel,&Archmagebehavior);
X  filescanstring(fd,Prime);
X  fscanf(fd,"%d\n%d\n",&Primelevel,&Primebehavior);
X  filescanstring(fd,Shadowlord);
X  fscanf(fd,"%d\n%d\n",&Shadowlordlevel,&Shadowlordbehavior);
X  for(i=1;i<7;i++) {
X    filescanstring(fd,Priest[i]);
X    fscanf(fd,"%d\n%d\n",&(Priestlevel[i]),&(Priestbehavior[i]));
X  }
X  fclose(fd);
X  clear();
X  printw("High Score: %d",Hiscore);
X  printw(", by %s, a level %d adventurer",Hiscorer,Hilevel);
X  printw("\n%s",Hidescrip);
X  printw("\n\nDuke of Rampart:              ");
X  printw("%s",Duke);
X  printw("\nCommandant:                   ");
X  printw("%s",Commandant);
X  printw("\nChampion:                     ");
X  printw("%s",Champion);
X  printw("\nArchmage:                     ");
X  printw("%s",Archmage);
X  printw("\nPrime Sorceror:               ");
X  printw("%s",Prime);
X  printw("\nShadowlord:                   ");
X  printw("%s",Shadowlord);
X  printw("\n\nHigh Priests:");
X  printw("\n of Odin:                     ");
X  printw("%s",Priest[ODIN]);
X  printw("\n of Set:                      ");
X  printw("%s",Priest[SET]);
X  printw("\n of Athena:                   ");
X  printw("%s",Priest[ATHENA]);
X  printw("\n of Hecate:                   ");
X  printw("%s",Priest[HECATE]);
X  printw("\n of the Lords of Destiny:     ");
X  printw("%s",Priest[DESTINY]);
X  printw("\nThe ArchDruid:                ");
X  printw("%s",Priest[DRUID]);
X  printw("\n\n\n\nHit any key to continue.");
X  refresh();
X  wgetch(stdscr);
X}
X
Xvoid checkhigh(descrip,behavior)
Xchar *descrip;
Xint behavior;
X{
X  int i;
X  FILE *fd;
X  if (! Cheated) {
X    strcpy(Str1,OMEGALIB);
X    strcat(Str1,"omega.hiscore");
X    fd = checkfopen(Str1,"w");
X    
X    if (Hiscore < calc_points()) {
X      morewait();
X      mprint("Yow! A new high score!");
X      fprintf(fd,"%s\n",Player.name);
X      fprintf(fd,"%s\n",descrip);
X      fprintf(fd,"%d\n",calc_points());
X      fprintf(fd,"%d\n",Player.level);
X      fprintf(fd,"%d",behavior);
X    }
X    else {
X      fprintf(fd,"%s\n",Hiscorer);
X      fprintf(fd,"%s\n",Hidescrip);
X      fprintf(fd,"%d\n",Hiscore);
X      fprintf(fd,"%d\n",Hilevel);
X      fprintf(fd,"%d",Hibehavior);
X    }
X    fprintf(fd,"\n%s",Duke);
X    fprintf(fd,"\n%d",Dukelevel);
X    if (Player.rank[NOBILITY] == DUKE)
X      fprintf(fd,"\n%d",behavior);
X    else fprintf(fd,"\n%d",Dukebehavior);
X    fprintf(fd,"\n%s",Commandant);
X    fprintf(fd,"\n%d",Commandantlevel);
X    if (Player.rank[LEGION] == COMMANDANT)
X      fprintf(fd,"\n%d",behavior);
X    else fprintf(fd,"\n%d",Commandantbehavior);
X    fprintf(fd,"\n%s",Champion);
X    fprintf(fd,"\n%d",Championlevel);
X    if (Player.rank[ARENA] == CHAMPION)
X      fprintf(fd,"\n%d",behavior);
X    else fprintf(fd,"\n%d",Championbehavior);
X    fprintf(fd,"\n%s",Archmage);
X    fprintf(fd,"\n%d",Archmagelevel);
X    if (Player.rank[COLLEGE] == ARCHMAGE)
X      fprintf(fd,"\n%d",behavior);
X    else fprintf(fd,"\n%d",Archmagebehavior);
X    fprintf(fd,"\n%s",Prime);
X    fprintf(fd,"\n%d",Primelevel);
X    if (Player.rank[CIRCLE] == PRIME)
X      fprintf(fd,"\n%d",behavior);
X    else fprintf(fd,"\n%d",Primebehavior);
X    fprintf(fd,"\n%s",Shadowlord);
X    fprintf(fd,"\n%d",Shadowlordlevel);
X    if (Player.rank[THIEVES] == SHADOWLORD)
X      fprintf(fd,"\n%d",behavior);
X    else fprintf(fd,"\n%d",Shadowlordbehavior);
X    for(i=1;i<7;i++) {
X      fprintf(fd,"\n%s",Priest[i]);
X      fprintf(fd,"\n%d",Priestlevel[i]);
X      if ((Player.rank[PRIESTHOOD] == HIGHPRIEST) && (Player.patron == i))
X	fprintf(fd,"\n%d",behavior);
X      else fprintf(fd,"\n%d",Priestbehavior[i]);
X    }
X    fclose(fd);
X  }
X}
X
Xvoid extendlog(descrip,lifestatus)
Xchar *descrip;
Xint lifestatus;
X{
X  FILE *fd;
X  char username[60];
X  int npcbehavior;
X  strcpy(username,getlogin());
X  if ((Player.level > 0) && (! Cheated)) {
X    npcbehavior=fixnpc(lifestatus);
X    checkhigh(descrip,npcbehavior);
X    Logsize++;
X    strcpy(Str1,OMEGALIB);
X    strcat(Str1,"omega.lognum");
X    fd = checkfopen(Str1,"w");
X    fprintf(fd,"%d",Logsize);
X    fclose(fd);
X    strcpy(Str1,OMEGALIB);
X    strcat(Str1,"omega.log");
X    fd = checkfopen(Str1,"a");
X    fprintf(fd,"%s\n",username);
X    fprintf(fd,"%s\n",Player.name);
X    fprintf(fd,"%d %d %d\n",lifestatus,Player.level,npcbehavior);
X    fclose(fd);
X  }
X}
X
X
X
X
X
X
Xvoid filescanstring(fd,fstr)
XFILE *fd;
Xchar *fstr;
X{
X  int i= -1;
X  char byte='x';
X  while ((i<80) && (byte != '\n')) {
X    i++;
X    fscanf(fd,"%c",&byte);
X    fstr[i] = byte;
X  } 
X  if (byte != '\n')
X    while(byte!='\n')
X      fscanf(fd,"%c",&byte);
X  fstr[i]=0;
X}
X
X
X/* Checks existence of omega data files */
X/* Returns 1 if OK, 0 if impossible to run, -1 if possible but not OK */
Xint filecheck()
X{
X  int impossible=FALSE,badbutpossible=FALSE;
X  int result;
X
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"ocity.dat");
X  result = access(Str1,F_OK|R_OK);
X  if (result == -1) {
X    impossible = TRUE;
X    printf("\nWarning! File not accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"odepths.dat");
X  result = access(Str1,F_OK|R_OK);
X  if (result == -1) {
X    impossible = TRUE;
X    printf("\nWarning! File not accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"omega.hiscore");
X  result = access(Str1,F_OK|R_OK|W_OK);
X  if (result == -1) {
X    impossible = TRUE;
X    printf("\nWarning! File not appendable or accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"omega.log");
X  result = access(Str1,F_OK|R_OK|W_OK);
X  if (result == -1) {
X    impossible = TRUE;
X    printf("\nWarning! File not appendable or accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"omega.lognum");
X  result = access(Str1,F_OK|R_OK|W_OK);
X  if (result == -1) {
X    impossible = TRUE;
X    printf("\nWarning! File not appendable or accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"omega.motd");
X  result = access(Str1,F_OK|R_OK);
X  if (result == -1) {
X    impossible = TRUE;
X    printf("\nWarning! File not accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"ocommands.txt");
X  result = access(Str1,F_OK|R_OK);
X  if (result == -1) {
X    badbutpossible = TRUE;
X    printf("\nWarning! File not accessible:");
X    printf(Str1);
X  }
X  
X
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"ohelp.txt");
X  result = access(Str1,F_OK|R_OK);
X  if (result == -1) {
X    badbutpossible = TRUE;
X    printf("\nWarning! File not accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"omega.saves");
X  result = access(Str1,F_OK|R_OK|W_OK);
X  if (result == -1) {
X    badbutpossible = TRUE;
X    printf("\nWarning! File not appendable or accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"oscroll1.txt");
X  result = access(Str1,F_OK|R_OK);
X  if (result == -1) {
X    badbutpossible = TRUE;
X    printf("\nWarning! File not accessible:");
X    printf(Str1);
X  }
X  
X  strcpy(Str1,OMEGALIB);
X  strcat(Str1,"oscroll2.txt");
X  result = access(Str1,F_OK|R_OK);
X  if (result == -1) {
X    badbutpossible = TRUE;
X    printf("\nWarning! File not accessible:");
X    printf(Str1);
X  }
X  
X  if (impossible) {
X    printf("\nFurther execution is impossible. Sorry.");
X    printf("\nOMEGALIB may be badly #defined in odefs.h\n");
X    return(0);
X  }
X  else if (badbutpossible) {
X    printf("\nFurther execution may cause anomalous behavior.");
X    printf("\nContinue anyhow? [yn]");
X    if (getchar()=='y') return(-1);
X    else return(0);
X  }
X  else return(1);
X}
END_OF_ofile.c
if test 10374 -ne `wc -c <ofile.c`; then
    echo shar: \"ofile.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f oitemf.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"oitemf.c\"
else
echo shar: Extracting \"oitemf.c\" \(43957 characters\)
sed "s/^X//" >oitemf.c <<'END_OF_oitemf.c'
X/* omega copyright (C) 1987 by Laurence Raphael Brothers */
X/* oitemf.c */
X
X/* only i_ and weapon_ functions should be in this file. Auxiliary functions */
X/* in oitem */
X
X#include <strings.h>
X#include "oglob.h"
X
X/* from ocom */
Xextern void levelchange();
X
X/* from omon */
Xextern void m_damage(),m_death(),m_vanish(),m_status_reset();
Xextern int m_immunityp();
X
X
X/* from outil */
Xextern int random_range(),pow2();
X
X/* from oscr */
Xextern void mprint(),printm(),menumorewait(),showflags();
Xextern void erase_level(),menuprint(),menuclear(),xredraw(),morewait();
Xextern char mgetc();
X
X/* ogen */
Xvoid clear_level(),create_level();
X
X
X
X
X/* from oaux */
Xextern void setspot(),p_poison(),p_drown(),p_death(),p_damage();
Xextern void conform_lost_object(),calc_melee(),foodcheck();
Xextern void p_teleport(),p_hit();
Xextern void gain_experience();
Xextern int p_immune();
X
X/* from oeffect1 */
Xextern void identify(),bless(),enchant(),heal(),cleanse(),acquire();
Xextern void fbolt(),lball(),mondet(),objdet(),snowball(),wish();
Xextern void lbolt(),fball(),disrupt(),disintegrate();
Xextern void sleep_player(),nbolt(),sleep_monster(),summon(),apport();
Xextern void hide(),clairvoyance(),learnspell(),amnesia(),level_drain();
X
X/* from oeffect2 */
Xextern void knowledge(),flux(),displace(),breathe(),invisible(),recover_stat();
Xextern void augment(),haste(),warp(),alert(),regenerate(),accuracy(),hero();
Xextern void levitate(),dispel(),polymorph(),truesight(),illuminate();
Xextern void sanctify(),cure();
X
X/* from oitem */
Xextern void item_use();
X
X/* from omove */
Xextern void p_movefunction();
X
X/* from oinv */
Xextern void conform_unused_object();
Xextern int inpack();
X
X/* itemf functions */
Xvoid weapon_bare_hands(),weapon_normal_hit(),weapon_demonblade();
Xvoid weapon_lightsabre(),weapon_mace_disrupt(),weapon_tangle();
Xvoid weapon_vorpal(),weapon_desecrate(),weapon_firestar(),weapon_defend();
Xvoid weapon_victrix();
X
Xvoid i_no_op(),i_nothing();
Xvoid i_spells(),i_bless(),i_enchant(),i_acquire(),i_jane_t();
Xvoid i_flux(),i_breathing(),i_invisible(),i_perm_invisible();
Xvoid i_teleport(),i_wish(),i_clairvoyance(),i_displace(),i_id(),i_augment();
Xvoid i_heal(),i_objdet(),i_mondet(),i_sleep_self(),i_neutralize_poison();
Xvoid i_speed(),i_restore(),i_azoth(),i_regenerate(),i_demonblade();
Xvoid i_firebolt(),i_lbolt(),i_missile(),i_fireball(),i_lball(),i_snowball();
Xvoid i_sleep_other(),i_summon(),i_hide(),i_disrupt(),i_disintegrate();
Xvoid i_perm_vision(),i_perm_burden(),i_perm_fire_resist(),i_charge();
Xvoid i_perm_poison_resist(),i_perm_strength(),i_perm_gaze_immune();
Xvoid i_perm_energy_resist();void i_perm_speed(),i_perm_breathing();
Xvoid i_perm_displace(),i_perm_negimmune(),i_mace_disrupt(),i_warp();
Xvoid i_food(),i_poison_food(),i_stim(),i_immune(),i_lembas(),i_pow();
Xvoid i_orbfire(),i_orbwater(),i_orbair(),i_orbearth(),i_orbdead();
Xvoid i_orbmastery(),i_lightsabre(),i_alert(),i_knowledge(),i_pick();
Xvoid i_perm_knowledge(),i_fear_resist(),i_perm_fear_resist(),i_key();
Xvoid i_defend(),i_victrix(),i_apport(),i_corpse(),i_accuracy();
Xvoid i_perm_accuracy(),i_hero(),i_perm_hero(),i_levitate();
Xvoid i_perm_regenerate(),i_perm_levitate(),i_perm_protection();
Xvoid i_perm_agility(),i_truesight(),i_perm_truesight(),i_cure();
Xvoid i_dispel(),i_pepper_food(),i_enchantment(),polymorph();
Xvoid i_crystal(),i_kolwynia(),i_death(),i_life(),i_helm(),i_antioch();
Xvoid i_illuminate(),i_perm_illuminate(),i_desecrate();
Xvoid i_trap(),i_juggernaut();
X
X/* general item functions */
X
Xvoid i_no_op(o)
Xpob o;
X{
X}
X
Xvoid i_nothing(o)
Xpob o;
X{
X}
X
X
X/* ring functions */
Xvoid i_perm_knowledge(o)
Xpob o;
X{
X  o->known = 1;
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  if (o->used) 
X    knowledge(o->blessing);
X}
X
Xvoid i_perm_strength(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  if (o->used){
X    if (o->blessing > -1)
X      Player.str += abs(o->plus)+1;
X    else
X      Player.str -= abs(o->plus)+1;
X  }
X  else {
X    if (o->blessing > -1)
X      Player.str -= abs(o->plus)+1;
X    else
X      Player.str += abs(o->plus)+1;
X  }
X  calc_melee();
X  calc_melee();
X}
X
X
Xvoid i_perm_vision(o)
Xpob o;
X{
X  o->known = 2;
X  Objects[o->id].known = 1;
X  if (o->used) Player.vision += (o->plus+1);
X  else Player.vision -= (o->plus+1);
X}
X
Xvoid i_perm_burden(o)
Xpob o;
X{
X  int i;
X  
X  if (o->used) {
X    o->weight = 1000;
X    mprint("You feel heavier.");
X  }
X  else {
X    o->weight = 1;
X    mprint("Phew. What a relief.");
X  }
X  Player.itemweight = 0;
X  for (i=0;i<MAXITEMS;i++) {
X    if (Player.possessions[i] != NULL)
X      Player.itemweight += 
X	(Player.possessions[i]->weight*Player.possessions[i]->number);
X  }
X}
X
Xvoid i_perm_gaze_immune(o)
Xpob o;
X{
X  if (o->used) Player.immunity[GAZE]++;
X  else Player.immunity[GAZE]--;
X}
X
Xvoid i_perm_fire_resist(o)
Xpob o;
X{
X  if (o->used) Player.immunity[FLAME]++;
X  else Player.immunity[FLAME]--;
X}
X
Xvoid i_perm_poison_resist(o)
Xpob o;
X{
X  if (o->used) {
X    if (o->blessing < 0) {
X      Player.immunity[POISON] = 0;
X      p_poison(100);
X    }
X    else {
X      Player.immunity[POISON]++;
X      if (Player.status[POISONED] > 0) {
X	mprint("You feel much better now.");
X	Player.status[POISONED] = 0;
X      }
X    }
X  }
X  else {
X    Player.status[POISONED] = 0;
X    Player.immunity[POISON]--;
X  }
X}
X
X
Xvoid i_perm_energy_resist(o)
Xpob o;
X{
X  if (o->used){
X    Player.immunity[FLAME]++;
X    Player.immunity[COLD]++;
X    Player.immunity[ELECTRICITY]++;
X  }
X  else {
X    Player.immunity[FLAME]--;
X    Player.immunity[COLD]--;
X    Player.immunity[ELECTRICITY]--;
X  }
X}
X
X
X
Xvoid i_perm_breathing(o)
Xpob o;
X{
X 
X  o->known = 1;
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X
X  if (o->blessing > -1) {
X    if (o->used) {
X      mprint("Your breath is energized!");
X      Player.status[BREATHING] += 1500;
X    }
X    else  {
X      Player.status[BREATHING] -= 1500;
X      if (Player.status[BREATHING] < 1) {
X	mprint("Your breathing is back to normal.");
X	Player.status[BREATHING] = 0;
X      }
X    }
X  }
X  else if (o->used) {
X    Player.status[BREATHING] = 0;
X    p_drown();
X  }
X}
X
X
X
X
Xvoid i_perm_regenerate(o)
Xpob o;
X{
X  o->known = 1;
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  if (o->used) {
X    mprint("You seem abnormally healthy.");
X    Player.status[REGENERATING] += 1500;
X  }
X  else {
X    Player.status[REGENERATING] -= 1500;
X    if (Player.status[REGENERATING] < 1) {
X      mprint("Your vitality is back to normal");
X      Player.status[REGENERATING] = 0;
X    }
X  }
X}
X
X
X/*  scroll functions */
X
Xvoid i_knowledge(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  knowledge(o->blessing);
X}
X
Xvoid i_jane_t(o)
Xpob o;
X{
X  int volume = random_range(6);
X  int i,j,k;
X
X  printm("\nJane's Guide to the World's Treasures: ");
X  
X  switch(volume) {
X    case 0:mprint("SCROLLS");j = SCROLLID; k = POTIONID; break;
X    case 1:mprint("POTIONS");j = POTIONID; k = WEAPONID; break;
X    case 2:mprint("CLOAKS");j = CLOAKID; k = BOOTID; break;
X    case 3:mprint("BOOTS");j = BOOTID; k = RINGID; break;
X    case 4:mprint("RINGS");j = RINGID; k = STICKID; break;
X    case 5:mprint("STICKS");j = STICKID; k = ARTIFACTID; break;
X  }
X  for(i=j;i<k;i++)
X    Objects[i].known = 1;
X}
X
X   
Xvoid i_flux(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  flux(o->blessing);
X}
X
X
X/* enchantment */
Xvoid i_enchant(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  enchant(o->blessing < 0 ? -1-o->plus : o->plus+1);
X}
X
X/* scroll of clairvoyance */
Xvoid i_clairvoyance(o)
Xstruct object *o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  if (o->blessing < 0)
X    amnesia();
X  else if (o->blessing > 0)
X      clairvoyance(Player.vision*10);
X  else clairvoyance(Player.vision*2);
X}
X
X
X
Xvoid i_acquire(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  acquire(o->blessing);
X}
X
Xvoid i_teleport(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  p_teleport(o->blessing);
X}
X
X
Xvoid i_spells(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  mprint("A scroll of spells.");
X  learnspell(o->blessing);
X}
X
X
X
X/* scroll of blessing */
Xvoid i_bless(o)
Xpob o;
X{
X  Objects[o->id].known = 1;
X  bless(o->blessing);
X}
X
X/* scroll of wishing */
Xvoid i_wish(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  wish(o->blessing);
X}
X
X/* scroll of displacement */
Xvoid i_displace(o)
Xpob o;
X{
X  if (o->blessing > -1) 
X      Objects[o->id].known = 1;
X  displace(o->blessing);
X}
X
X
X/* scroll of identification */
Xvoid i_id(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  identify(o->blessing);
X}
X
X/* potion functions */
X
X/* potion of healing */
Xvoid i_heal(o)
Xpob o;
X{
X  if (o->blessing > -1) {
X    Objects[o->id].known = 1;
X    heal(1+o->plus);
X  }
X  else heal(-1-abs(o->plus));
X}
X
X/* potion of monster detection */
Xvoid i_mondet(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  mondet(o->blessing);
X}
X
X
X/* potion of object detection */
Xvoid i_objdet(o)
Xpob o;
X{
X
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  objdet(o->blessing);
X}
X
X/* potion of neutralize poison */
Xvoid i_neutralize_poison(o)
Xpob o;
X{
X  if (o->blessing > -1) {
X    Objects[o->id].known = 1;
X    mprint("You feel vital!");
X    Player.status[POISONED] = 0;
X  }
X  else p_poison(random_range(20)+5);
X}
X
X
X/* potion of sleep */
Xvoid i_sleep_self(o)
Xpob o;
X{
X  sleep_player(6);
X  Objects[o->id].known = 1;
X}
X
X
X
X
X/* potion of speed */
Xvoid i_speed(o)
Xpob o;
X{
X  if (o->blessing > -1) 
X    Objects[o->id].known = 1;
X  haste(o->blessing);
X}
X
X
X/* potion of restoration */
Xvoid i_restore(o)
Xpob o;
X{
X  if (o->blessing > -1) 
X    Objects[o->id].known = 1;
X  recover_stat(o->blessing);
X}
X
Xvoid i_augment(o)
Xpob o;
X{
X  if (o->blessing > -1) 
X    Objects[o->id].known = 1;
X  augment(o->blessing);
X}  
X
Xvoid i_azoth(o)
Xpob o;
X{
X  if (o->plus < 0) {
X    mprint("The mercury was poisonous!");
X    p_poison(25);
X  }
X  else if (o->plus == 0) {
X    mprint("The partially enchanted azoth makes you sick!");
X    Player.con = ((int) (Player.con / 2));
X    calc_melee();
X  }
X  else if (o->blessing < 1) {
X    mprint("The unblessed azoth warps your soul!");
X    Player.pow = Player.maxpow = ((int) (Player.maxpow / 2));
X    level_drain(random_range(10),"cursed azoth");
X  }
X  else {
X    mprint("The azoth fills you with cosmic power!");
X    if (Player.str > Player.maxstr*2) {
X      mprint("The power rages out of control!");
X      p_death("overdose of azoth");
X    }
X    else {
X      heal(10);
X      cleanse(1);
X      Player.mana = calcmana()*3;
X      Player.str = (Player.maxstr++)*3;
X    }
X  }
X}
X
Xvoid i_regenerate(o)
Xpob o;
X{
X  regenerate(o->blessing);
X}
X
X
X/* orb functions */
Xvoid i_orbfire(o)
Xpob o;
X{
X  if (o->known < 1) {
X    mprint("Fumbling with the orb, you set it off accidentally!");
X    mprint("The Orb of Fire blasts you!");
X    fball(Player.x,Player.y,Player.x,Player.y,100);
X    o->known = 1;
X  }
X  else {
X    mprint("The Orb of Fire is activated!");
X    Spells[S_FIREBOLT].known = TRUE;
X    gain_experience(10000);
X    Player.immunity[FLAME]+=100;
X    mprint("You feel fiery!");
X    o->plus = 100;
X    o->blessing = 100;
X    i_firebolt(o);
X    *o = Objects[ARTIFACTID+5];
X  }
X}
X
X
Xvoid i_orbwater(o)
Xpob o;
X{
X  if (o->known < 1) {
X    mprint("Fumbling with the orb, you set it off accidentally!");
X    mprint("The Orb of Water blasts you!");
X    heal(-100);
X    o->known = 1;
X  }
X  else {
X    mprint("The Orb of Water is activated!");
X    Spells[S_DISRUPT].known = TRUE;
X    Player.immunity[POISON]+=100;
X    gain_experience(10000);
X    mprint("You feel wet!");
X    o->plus = 100;
X    o->blessing = 100;
X    i_disrupt(o);
X    *o = Objects[ARTIFACTID+5];
X  }
X}
X
X
Xvoid i_orbearth(o)
Xpob o;
X{
X  int i;
X  if (o->known < 1) {
X    mprint("Fumbling with the orb, you set it off accidentally!");
X    mprint("The Orb of Earth blasts you!");
X    for (i=0;i<MAXITEMS;i++) {
X      if (Player.possessions[i] != NULL) {
X	conform_lost_objects(Player.possessions[i]);
X      }
X    }
X    mprint("Your pack disintegrates!");
X    o->known = 1;
X  }
X  else {
X    mprint("The Orb of Earth is activated!");
X    Spells[S_DISINTEGRATE].known = TRUE;
X    gain_experience(10000);
X    Player.immunity[NEGENERGY]+=100;
X    mprint("You feel earthy!");
X    o->plus = 100;
X    o->blessing = 100;
X    i_disintegrate(o);
X    *o = Objects[ARTIFACTID+5];
X  }
X}
X
X
Xvoid i_orbair(o)
Xpob o;
X{
X  if (o->known < 1) {
X    mprint("Fumbling with the orb, you set it off accidentally!");
X    mprint("The Orb of Air blasts you!");
X    lball(Player.x,Player.y,Player.x,Player.y,100);
X    o->known = 1;
X  }
X  else {
X    mprint("The Orb of Air is activated!");
X    Spells[S_LBALL].known = TRUE; /* lball */
X    gain_experience(10000);
X    mprint("You feel airy!");
X    Player.immunity[ELECTRICITY]+=100;
X    o->plus = 100;
X    o->blessing = 100;
X    i_invisible(o);
X    i_lbolt(o);
X    *o = Objects[ARTIFACTID+5];
X  }
X}
X
X
Xvoid i_orbmastery(o)
Xpob o;
X{
X  int a,b,c,d,i;
X  if (o->known < 1) {
X    mprint("Fumbling with the orb, you set it off accidentally!");
X    mprint("The Orb of Mastery blasts you to cinders!");
X    p_death("playing with the Orb of Mastery");
X    o->known = 1;
X  }
X  else if (((a=inpack(ARTIFACTID+1,-1)) != ABORT) &&
X	   ((b=inpack(ARTIFACTID+2,-1)) != ABORT) &&
X	   ((c=inpack(ARTIFACTID+3,-1)) != ABORT) &&
X	   ((d=inpack(ARTIFACTID+4,-1)) != ABORT)) {
X    item_use(Player.possessions[a]);
X    item_use(Player.possessions[b]);
X    item_use(Player.possessions[c]);
X    item_use(Player.possessions[d]);
X    mprint("The Orb of Mastery is activated!");
X    mprint("You feel godlike.");
X    Player.iq = Player.maxiq = 2 * Player.maxiq;
X    Player.pow = Player.maxpow = 2 * Player.maxpow;
X    Player.str = Player.maxstr = 2 * Player.maxstr;
X    Player.dex = Player.maxdex = 2 * Player.maxdex;
X    Player.con = Player.maxcon = 2 * Player.maxcon;
X    Player.agi = Player.maxagi = 2 * Player.maxagi;
X    dataprint();
X    mprint("You have been imbued with a cosmic power....");
X    wish(1);
X    mprint("You feel much more experienced.");
X    gain_experience(20000);
X    *o = Objects[ARTIFACTID+5];
X  }
X  else {
X    mprint("The Orb of Mastery's power is unbalanced!");
X    mprint("The Orb of Mastery blasts you to cinders!");
X    p_death("playing with the Orb of Mastery");
X  }  
X}
X
X
Xvoid i_orbdead(o)
Xpob o;
X{
X  int i;
X  mprint("The burnt-out orb drains all your energy!");
X  for(i=0;i<NUMSPELLS;i++)
X    Spells[i].known = FALSE;
X  mprint("You feel not at all like a mage.");
X  for(i=0;i<MAXITEMS;i++) {
X    if (Player.possessions[i] != NULL) {
X      Player.possessions[i]->plus = 0;
X      if (Player.possessions[i]->usef > 100)
X	Player.possessions[i]->usef = I_NOTHING;
X    }
X  }
X  mprint("A storm of mundanity surounds you!");
X  level_drain(Player.level-1,"a Burnt-out Orb");
X}
X
X
X
X/* stick functions * /
X
X
X/* wand of apportation */
Xvoid i_apport(o)
Xpob o;
X{
X  o->known = max(1,o->known);
X  Objects[o->id].known = 1;
X  apport(o->blessing);
X}
X
X/* staff of firebolts */
Xvoid i_firebolt(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  o->known = max(1,o->known);
X  Objects[o->id].known = 1;
X  setspot(&x,&y);
X  if (o->blessing < 0) {
X    x = Player.x;
X    y = Player.y;
X  }
X  fbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,75);
X}
X
X
Xvoid i_disintegrate(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  o->known = max(1,o->known);
X  Objects[o->id].known = 1;
X  setspot(&x,&y);
X  if (o->blessing < 0) {
X    x = Player.x;
X    y = Player.y;
X  }
X  disintegrate(x,y);
X}
X
Xvoid i_disrupt(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  o->known = max(1,o->known);
X  Objects[o->id].known = 1;
X  setspot(&x,&y);
X  if (o->blessing < 0) {
X    x = Player.x;
X    y = Player.y;
X  }
X  disrupt(x,y,100);
X}
X
X
X/* staff of lightning bolts */
Xvoid i_lbolt(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  o->known = max(1,o->known);
X  Objects[o->id].known = 1;
X  setspot(&x,&y);
X  if (o->blessing < 0) {
X    x = Player.x;
X    y = Player.y;
X  }
X  lbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,75);
X}
X
X/* wand of magic missiles */
Xvoid i_missile(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  o->known = max(1,o->known);
X  Objects[o->id].known = 1;
X  setspot(&x,&y);
X  if (o->blessing < 0) {
X    x = Player.x;
X    y = Player.y;
X  }
X  nbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,20);
X}
X
X/* wand of fire balls */
Xvoid i_fireball(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  Objects[o->id].known = 1;
X  o->known = max(1,o->known);
X  setspot(&x,&y);
X  if (o->blessing < 0) {
X    x = Player.x;
X    y = Player.y;
X  }
X  fball(Player.x,Player.y,x,y,35);
X}
X
X
X/* wand of snowballs */
Xvoid i_snowball(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  Objects[o->id].known = 1;
X  o->known = max(1,o->known);
X  setspot(&x,&y);
X  if (o->blessing < 0) {
X    x = Player.x;
X    y = Player.y;
X  }
X  snowball(Player.x,Player.y,x,y,20);
X}
X
X/* wand of lightning balls */
Xvoid i_lball(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  Objects[o->id].known = 1;
X  o->known = max(1,o->known);
X  setspot(&x,&y);
X  if (o->blessing < 0) {
X    x = Player.x;
X    y = Player.y;
X  }
X  lball(Player.x,Player.y,x,y,50);
X}
X
X/* staff of sleep */
Xvoid i_sleep_other(o)
Xpob o;
X{
X  Objects[o->id].known = 1;
X  o->known = max(1,o->known);
X  sleep_monster(o->blessing);
X}
X
X/* rod of summoning */
Xvoid i_summon(o)
Xpob o;
X{
X  Objects[o->id].known = 1;
X  o->known = max(1,o->known);
X  summon(o->blessing,-1);
X}
X
Xvoid i_hide(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  Objects[o->id].known = 1;
X  o->known = max(1,o->known);
X  setspot(&x,&y);
X  hide(x,y);
X}
X
Xvoid i_polymorph(o)
Xpob o;
X{
X  Objects[o->id].known = 1;
X  o->known = max(1,o->known);
X  polymorph(o->blessing);
X}
X
X
X
X/* boots functions */
Xvoid i_perm_speed(o)
Xpob o;
X{
X  if (o->blessing > -1) {
X    if (o->used) {
X      o->known = 2;
X      Objects[o->id].known = 1;
X      if (Player.status[SLOWED] > 0) {
X	Player.status[SLOWED] = 0;
X      }
X      mprint("The world slows down!"); 
X      Player.status[HASTED] += 1500;
X    }
X    else {
X      Player.status[HASTED] -= 1500;
X      if (Player.status[HASTED] < 1) 
X	mprint("The world speeds up again.");
X    }
X  }
X  else {
X    if (o->used) {
X      if (Player.status[HASTED] > 0) {
X	Player.status[HASTED] = 0;
X      }
X      mprint("You feel slower.");
X      Player.status[SLOWED] += 1500;
X    }
X    else  {
X      Player.status[SLOWED] -= 1500;
X      if (Player.status[SLOWED] < 1) 
X	mprint("You feel quicker again.");
X    }  
X  }
X}
X
X/* cloak functions */
Xvoid i_perm_displace(o)
Xpob o;
X{
X  if (o->blessing > -1) {
X    if (o->used) {
X      mprint("You feel dislocated.");
X      Player.status[DISPLACED] += 1500;
X    }
X    else {
X      Player.status[DISPLACED] -= 1500;
X      if (Player.status[DISPLACED] < 1) {
X	mprint("You feel a sense of position.");
X	Player.status[DISPLACED] = 0;
X      }
X    }
X  }
X  else {
X    if (o->used) {
X      mprint("You have a forboding of bodily harm!");
X      Player.status[VULNERABLE] += 1500;
X    }
X    else {
X      Player.status[VULNERABLE] -= 1500;
X      if (Player.status[VULNERABLE] < 1) {
X	mprint("You feel less endangered.");
X	Player.status[VULNERABLE] = 0;
X      }
X    }
X  }
X}
X
Xvoid i_perm_negimmune(o)
Xpob o;
X{
X  if (o->blessing > -1) {
X    if (o->used) {
X      Player.immunity[NEGENERGY]++;
X    }
X    else Player.immunity[NEGENERGY]--;
X  }
X  else if (o->used)
X    level_drain(abs(o->blessing),"cursed cloak of level drain");
X}
X
X/* food functions */
X
X
Xvoid i_food(o)
Xpob o;
X{
X  switch(random_range(5)) {
X    case 0: mprint("That tasted horrible!"); break;
X    case 1: mprint("Yum!"); break;
X    case 2: mprint("How nauseous!"); break;
X    case 3: mprint("Can I have some more? Please?"); break;
X    case 4: mprint("Your mouth feels like it is growing hair!"); break;
X  }
X}
X
Xvoid i_stim(o)
Xpob o;
X{
X  mprint("You feel Hyper!");
X  i_speed(o);
X  Player.str +=3;
X  Player.con -=1;
X  calc_melee();
X}
X
Xvoid i_pow(o)
Xpob o;
X{
X  mprint("You feel a surge of mystic power!");
X  Player.mana = 2 * calcmana();
X}
X
Xvoid i_poison_food(o)
Xpob o;
X{
X  mprint("This food was contaminated with cyanide!");
X  p_poison(random_range(20)+5);
X}
X
Xvoid i_pepper_food(o)
Xpob o;
X{
X  mprint("You innocently start to chew the szechuan pepper.....");
X  morewait();
X  mprint("hot.");
X  morewait();
X  mprint("Hot.");
X  morewait();
X  mprint("Hot!");
X  morewait();
X  mprint("HOT!!!!!!");
X  morewait();
X  p_damage(1,UNSTOPPABLE,"a szechuan pepper");
X  mprint("Your sinuses melt and run out your ears.");
X  mprint("Your mouth and throat seem to be permanently on fire.");
X  mprint("You feel much more awake now....");
X  Player.immunity[SLEEP]++;
X}
X
Xvoid i_lembas(o)
Xpob o;
X{
X  heal(10);
X  cleanse(0);
X  if (Player.food > 24) Player.food = 24;
X}
X
X
Xvoid i_cure(o)
Xpob o;
X{
X  cure(o->blessing);
X}
X
Xvoid i_immune(o)
Xpob o;
X{
X  if (o->blessing > 0) {
X    mprint("You feel a sense of innoculation");
X    Player.immunity[INFECTION]++;
X    cure(o->blessing);
X  }
X}
X
X
X
Xvoid i_breathing(o)
Xpob o;
X{
X  
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  breathe(o->blessing);
X}
X
X      
Xvoid i_invisible(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  invisible(o->blessing);
X}
X
X
Xvoid i_perm_invisible(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  if (o->used) {
X    if (o->blessing > -1) {
X      mprint("You feel transparent!");
X      Player.status[INVISIBLE] += 1500;
X    }
X    else {
X      mprint("You feel a forboding of bodily harm!");
X      Player.status[VULNERABLE] += 1500;
X    }
X  }
X  else {
X    if (o->blessing > -1) {
X      Player.status[INVISIBLE]-=1500;
X      if (Player.status[INVISIBLE] < 1) {
X	mprint("You feel opaque again.");
X	Player.status[INVISIBLE] = 0;
X      }
X    }
X    else {
X      Player.status[VULNERABLE] -= 1500;
X      if (Player.status[VULNERABLE] < 1) {
X	mprint("You feel less endangered now.");
X	Player.status[VULNERABLE] = 0;
X      }
X    }
X  }
X}
X
Xvoid weapon_demonblade(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{ 
X  if (o->blessing > -1) {
X    mprint("Demonblade disintegrates with a soft sigh.");
X    mprint("You stop foaming at the mouth.");
X    Player.status[BERSERK] = 0;
X    conform_lost_object(o);
X  }
X  else if (m->specialf == M_SP_DEMON) {
X    mprint("The demon flees in terror before your weapon!");
X    m_vanish(m);
X  }
X  else if (m->meleef != M_MELEE_SPIRIT) {
X    if (m->level > random_range(10)) {
X      Player.hp = min(Player.maxhp,Player.hp+m->hp);
X      Player.str++;
X      Player.pow = min(Player.maxpow,Player.pow+m->level);
X      m_death(m);
X      mprint("You feel a surge of raw power from Demonblade!");
X    }
X    else p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
X
X  }
X  else {
X    mprint("Demonblade howls as it strikes the spirit!");
X    if (random_range(10) == 1) {
X      mprint("... and shatters into a thousand lost fragments!");
X      p_damage(50,UNSTOPPABLE,"Demonblade exploding");
X      conform_lost_object(o);
X    }
X    else {
X      mprint("You feel your lifeforce draining....");
X      p_damage(25,UNSTOPPABLE,"a backlash of negative energies");
X      Player.str -= 3;
X      Player.con -= 3;
X    }
X  }
X}
X
Xvoid weapon_lightsabre(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if (! o->known) {
X    mprint("Fumbling with the cylinder, you press the wrong stud....");
X    p_death("fumbling with a lightsabre");
X  }
X  else {
X    mprint("Vzzzzzmm... Zap!");
X    m_damage(m,20,NORMAL_DAMAGE);
X    if (m->hp>0) m_damage(m,20,FLAME);
X  }
X}
X
Xvoid weapon_tangle(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
X  if ((random_range(2) == 1) && (! m_immunityp(m,NORMAL_DAMAGE))) {
X    mprint("You entangle the monster!");
X    m_status_reset(m,MOBILE);
X  }
X}
X
X/* if wielding a bow, add bow damage to arrow damage */
Xvoid weapon_arrow(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if ((Player.primary != NULL) &&
X      (Player.primary->id == WEAPONID+26)) /* ie, using a bow */
X    p_hit(m,Player.dmg+o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
X  else p_hit(m,o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
X}
X
X/* if wielding a crossbow, add bow damage to arrow damage */
Xvoid weapon_bolt(dmgmod,o,m)
Xpob o;
Xstruct monster *m;
X{
X  if ((Player.primary != NULL) &&
X      (Player.primary->id == WEAPONID+27) && /*ie using a crossbow */
X      (Player.primary->aux==LOADED)) {
X	p_hit(m,Player.dmg+o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
X	Player.primary->aux = UNLOADED;
X      }
X  else p_hit(m,o->plus+o->dmg,NORMAL_DAMAGE);
X}
X
X
Xvoid weapon_mace_disrupt(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if (m->meleef == M_MELEE_SPIRIT) {
X    mprint("The monster crumbles away to dust!");
X    m_death(m);
X  }
X  else p_hit(m,Player.dmg+dmgmod,UNSTOPPABLE);
X}
X
Xvoid weapon_normal_hit(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
X}
X
X
X/* will be updated eventually */
Xvoid weapon_bare_hands(dmgmod,m)
Xint dmgmod;
Xstruct monster *m;
X{
X  p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
X}
X
X
Xvoid i_demonblade(o)
Xpob o;
X{
X  if (o->used) {
X    o->known = 2;
X    mprint("Demonblade's fangs open and bury themselves in your wrist!");
X    mprint("You hear evil laughter in the distance....");
X    mprint("You begin to foam at the mouth!");
X    Player.status[BERSERK] = 1500;
X  }
X  else {
X    mprint("You hear a sound like a demon cursing.");
X    mprint("You feel less like biting your shield.");
X    Player.status[BERSERK] = 0;
X  }
X}
X
X
Xvoid i_lightsabre(o)
Xpob o;
X{
X  if (o->used) mprint("You feel one with the Force.");
X  else mprint("You feel out of touch with the Force.");
X}
X
Xvoid i_mace_disrupt(o)
Xpob o;
X{
X  mprint("That's a damned heavy mace!");
X}
X
Xvoid i_warp(o)
Xpob o;
X{
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  warp(o->blessing);
X}
X
X
Xvoid i_alert(o)
Xpob o;
X{
X  if (o->blessing > -1) {
X    Objects[o->id].known = 1;
X    alert(o->blessing);
X  }
X}
X
Xvoid i_charge(o)
Xpob o;
X{
X  int i;
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  mprint("A scroll of charging.");
X  mprint("Charge: ");
X  i = getitem(STICK);
X  if (i != ABORT) {
X    i-='a';
X    if (o->blessing < 0) {
X      mprint("The stick glows black!");
X      Player.possessions[i]->charge == 0;
X    }
X    else {
X      mprint("The stick glows blue!");
X      Player.possessions[i]->charge += (random_range(10)+1)*(o->blessing+1);
X      if (Player.possessions[i]->charge > 99)
X	Player.possessions[i]->charge = 99;
X    }
X  }
X}
X
X
Xvoid i_fear_resist(o)
Xpob o;
X{
X  if (o->blessing > -1) {
X    Objects[o->id].known = 1;
X    if (Player.status[AFRAID] > 0) {
X      mprint("You feel stauncher now.");
X      Player.status[AFRAID] = 0;
X    }
X  }
X  else if (! p_immune(FEAR)) {
X    mprint("You panic!");
X    Player.status[AFRAID]+=random_range(100);
X  }
X}
X
Xvoid i_perm_fear_resist(o)
Xpob o;
X{
X  if (o->used){
X    Player.immunity[FEAR]++;
X    if (o->blessing < 0) {
X      Player.status[BERSERK] += 1500;
X      mprint("You feel blood-simple!");
X    }
X  }
X  else {
X    Player.immunity[FEAR]--;
X    if (o->blessing < 0) {
X      Player.status[BERSERK] -= 1500;
X      if (Player.status[BERSERK] < 1) {
X	mprint("You feel less rabid now.");
X      Player.status[BERSERK] = 0;
X      }
X    }
X  }
X}    
X
X
X
X/* use a thieves pick */
Xvoid i_pick(o)
Xpob o;
X{
X  int dir;
X  int ox,oy;
X  o->used = FALSE;
X  if ((! o->known) && (! Player.rank[THIEVES]))
X    mprint("You have no idea what do with a piece of twisted metal.");
X  else {
X    o->known = 1;
X    Objects[o->id].known = 1;
X    printm("\nPick lock:");
X    dir = getdir();
X    if (dir == ABORT)
X      Skipmonsters = TRUE;
X    else {
X      ox = Player.x + Dirs[0][dir];
X      oy = Player.y + Dirs[1][dir];
X      if ((Dungeon[Dlevel][ox][oy].locchar != CLOSED_DOOR) || 
X	  Dungeon[Dlevel][ox][oy].secret) {
X	mprint("You can't unlock that!");
X	Skipmonsters = TRUE;
X      }
X      else if (Dungeon[Dlevel][ox][oy].aux == LOCKED) {
X	if (Dlevel == NUMLEVELS-1) 
X	  mprint("The lock is too complicated for you!!!");
X	else if (Dlevel*2 + random_range(50) <
X	    Player.dex+Player.level+Player.rank[THIEVES]*10) {
X	  mprint("You picked the lock!");
X	  Dungeon[Dlevel][ox][oy].aux = UNLOCKED;
X	  gain_experience(max(3,Dlevel));
X	}
X	else mprint("You failed to pick the lock.");
X      }
X      else mprint("That door is already unlocked!");
X    }
X  }
X}
X
X/* use a magic key*/
Xvoid i_key(o)
Xpob o;
X{
X  int dir;
X  int ox,oy;
X  o->used = FALSE;
X  printm("\nUnlock door: ");
X  dir = getdir();
X  if (dir == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    ox = Player.x + Dirs[0][dir];
X    oy = Player.y + Dirs[1][dir];
X    if ((Dungeon[Dlevel][ox][oy].locchar != CLOSED_DOOR) || 
X	Dungeon[Dlevel][ox][oy].secret) {
X	  mprint("You can't unlock that!");
X	  Skipmonsters = TRUE;
X	}
X    else if (Dungeon[Dlevel][ox][oy].aux == LOCKED) {
X	mprint("The lock clicks open!");
X	Dungeon[Dlevel][ox][oy].aux = UNLOCKED;
X	o->blessing--;
X	if ((o->blessing<0)||(Dlevel == NUMLEVELS-1)) {
X	  mprint("The key disintegrates!");
X	  conform_lost_objects(1,o);
X	}
X	else {
X	  mprint("Your key glows faintly.");
X	  o->blessing--;
X	}
X      }
X    else mprint("That door is already unlocked!");
X  }
X}
X
Xvoid weapon_vorpal(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if ((random_range(10) < 3) && (! m_immunityp(m,NORMAL_DAMAGE))) {
X    o->known = 2;
X    if (random_range(2) == 1)
X      mprint("One Two! One Two! And through and through!");
X    else mprint("Your vorpal blade goes snicker-snack!");
X    m_death(m);
X  }
X  else weapon_normal_hit(dmgmod,o,m);
X}
X
Xvoid weapon_desecrate(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  o->known = 2;
X  if (Player.alignment < 0) {
X    mprint("Your opponent screams in agony!");
X    p_hit(m,Player.dmg+dmgmod,UNSTOPPABLE);
X    Player.alignment--;
X    if (Player.hp < Player.maxhp) {
X      mprint("You feel a thrill of power surging up your blade!");
X      Player.hp = min(Player.maxhp,Player.hp+Player.dmg+dmgmod);
X    }
X  }
X  else {
X    mprint("Your blade turns in your hands and hits you!");
X    mprint("You hear evil laughter....");
X    level_drain(Player.dmg,"the sword Desecrator");
X    Player.alignment-=10;
X    mprint("A strange force spreads from the wound throughout your body...");
X    mprint("You feel much more chaotic now.");
X  }
X}
X
X
X
Xvoid weapon_firestar(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if (random_range(3) == 1) {
X    o->known = 2;
X    fball(Player.x,Player.y,Player.x,Player.y,max(Player.dmg,25));
X  }
X  if (m->hp > 0) weapon_normal_hit(dmgmod,o,m);
X}
X
Xvoid weapon_defend(dmgmod,o,m)
Xpob o;
Xstruct monster *m;
X{
X  if ((Player.alignment < 0) && (o->blessing > 0)) {
X      mprint("The Holy Defender screams in your hands....");
X      mprint("You stagger before the sound of its rage....");
X      p_damage(50,UNSTOPPABLE,"a pissed-off Holy Defender");
X      mprint("The weapon finally quiets. It seems less holy now.");
X      strcpy(o->truename,o->cursestr);
X      Player.status[PROTECTION] -= (o->hit);
X      o->plus = 0-abs(o->plus);
X      o->blessing = -1;
X    }
X  if ((m->specialf == M_SP_DEMON) ||
X      (m->meleef == M_MELEE_SPIRIT)) {
X    mprint("Your opponent shies back before your holy weapon!");
X    m->hit = 0;
X  }
X  weapon_normal_hit(dmgmod,o,m);
X}
X
Xvoid weapon_victrix(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if (Player.alignment < -20) {
X    mprint("The Spear Victrix dissolves in your hands with a faint sigh.");
X    conform_lost_object(o);
X    mprint("You hear congratulatory laughter all around you.");
X    gain_experience(1000);
X  }
X  else {  
X    if ((m->specialf == M_SP_DEMON) ||
X	(m->meleef == M_MELEE_SPIRIT)) {
X      mprint("Your opponent dissipates in a harmless cloud of vapors...");
X      Player.alignment++;
X      m_death(m);
X    }
X    else weapon_normal_hit(dmgmod,o,m);
X  }
X}
X
Xvoid i_defend(o)
Xpob o;
X{
X  o->known = 2;
X  if (o->used) {
X    mprint("You feel under an aegis!");
X    Player.status[PROTECTION] += o->hit;
X  }
X  else Player.status[PROTECTION] -= o->hit;
X}
X
X
Xvoid i_victrix(o)
Xpob o;
X{
X  o->known = 2;
X  o->blessing = abs(o->blessing);
X  if (o->used) {
X    Player.immunity[POISON]++;
X    Player.immunity[FEAR]++;
X    Player.immunity[INFECTION]++;
X  }
X  else {
X    Player.immunity[POISON]--;
X    Player.immunity[FEAR]--;
X    Player.immunity[INFECTION]--;
X  }
X}    
X
Xvoid i_corpse(o)
Xpob o;
X{
X  switch (o->aux) {
X  case ML0+1: 
X  case ML0+2:
X  case ML0+3:
X  case ML0+4:
X  case ML2+0:
X  case ML2+2:
X  case ML7+3:
X  case ML10+0: /* cannibalism */
X    mprint("Yechh! How could you! You didn't even cook him, first!");
X    if (Player.alignment > 0) Player.food = 25;
X    Player.food += 8;
X    Player.alignment -=10;
X    foodcheck();
X    break;
X  case ML1+2: /* fnord */
X    mprint("You feel illuminated!");
X    Player.iq++;
X    break;
X  case ML4+3: /* denebian slime devil */
X    mprint("I don't believe this. You ate Denebian Slime?");
X    mprint("You deserve a horrible wasting death, uncurable by any means!");
X    break;
X  case ML5+0:
X    mprint("Those dragon-steaks were fantastic!");
X    Player.food=24;
X    foodcheck();
X    break;
X  case ML7+0:
X    mprint("You feel infinitely more virile now.");
X    Player.str = max(Player.str,Player.maxstr+10);
X    Player.food = 24;
X    foodcheck();
X    break;
X  case ML9+1:
X    mprint("Guess what? You're invisible.");
X    if (Player.status[INVISIBLE] < 1000) Player.status[INVISIBLE] = 666;
X    Player.food+=6;
X    foodcheck();
X    break;
X  case ML7+2:  
X    mprint("You ATE a unicorn's horn?!?!?");
X    Player.immunity[POISON]=1000;
X    break;
X  case ML0+0:
X  case ML1+0:
X  case ML1+1:
X  case ML1+4:
X  case ML1+5:
X  case ML1+6:
X  case ML1+10:
X  case ML2+1:
X  case ML2+4:
X  case ML4+1:
X  case ML4+4:
X  case ML5+3:
X    mprint("Well, you forced it down. Not much nutrition, though.");
X    Player.food++;
X    foodcheck();
X    break;
X  case ML1+3:
X  case ML1+7:
X  case ML2+3:
X  case ML2+5:
X  case ML3+1:
X  case ML4+5:
X  case ML9+3:
X  case ML10+1:
X    mprint("Oh, yuck. The 'food' seems to be tainted.");
X    mprint("You feel very sick. You throw up.");
X    Player.food = min(Player.food, 4);
X    if (! Player.immunity[INFECTION])
X      Player.status[DISEASED]+=24;
X    p_poison(10);
X    break;
X  default: mprint("It proved completely inedible, but you tried anyhow.");
X  }
X}
X
Xvoid i_accuracy(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  accuracy(o->blessing);
X}
X
Xvoid i_perm_accuracy(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  if ((o->used) && (o->blessing > -1)) {
X    Player.status[ACCURATE] += 1500;
X    mprint("You feel skillful and see bulls' eyes everywhere.");
X  }
X  else {
X    Player.status[ACCURATE] -= 1500;
X    if (Player.status[ACCURATE] < 1) {
X      Player.status[ACCURATE] = 0;
X      calc_melee();
X      mprint("Your vision blurs....");
X    }
X  }
X}
X
Xvoid i_hero(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  hero(o->blessing);
X}
X
Xvoid i_perm_hero(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  if (o->used){
X    if (o->blessing > -1) {
X      Player.status[HERO] += 1500;
X      calc_melee();
X      mprint("You feel super!");
X    }
X    else {
X      Player.status[HERO] = 0;
X      calc_melee();
X      if (! Player.immunity[FEAR]) {
X	Player.status[AFRAID]+=1500;
X	mprint("You feel cowardly....");
X      }
X    }
X  }
X  else {
X    if (o->blessing > -1) {
X      Player.status[HERO] -= 1500;
X      if (Player.status[HERO] < 1) {
X	calc_melee();
X	mprint("You feel less super now.");
X	Player.status[HERO] = 0;
X      }
X    }
X    else {
X      Player.status[AFRAID] -= 1500;
X      if (Player.status[AFRAID] < 1) {
X	mprint("You finally conquer your fear.");
X	Player.status[AFRAID] = 0;
X      }
X    }
X  } 
X}
X
Xvoid i_levitate(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  levitate(o->blessing);
X}
X
Xvoid i_perm_levitate(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  if (o->blessing > -1) {
X    if (o->used) {
X      Player.status[LEVITATING] += 1500;
X      mprint("You start to float a few inches above the floor");
X      mprint("You fid you can easily control your altitude");
X    }
X    else {
X      Player.status[LEVITATING] -= 1500;
X      if (Player.status[LEVITATING] < 1) {
X	Player.status[LEVITATING] = 0;
X	mprint("You sink to the floor.");
X      }
X    }
X  }
X  else i_perm_burden(o);
X}
X
Xvoid i_perm_protection(o)
Xpob o;
X{
X  if (o->used){
X    if (o->blessing > -1)
X      Player.status[PROTECTION] += abs(o->plus)+1;
X    else
X      Player.status[PROTECTION] -= abs(o->plus)+1;
X  }
X  else {
X    if (o->blessing > -1)
X      Player.status[PROTECTION] -= abs(o->plus)+1;
X    else
X      Player.status[PROTECTION] += abs(o->plus)+1;
X  }
X  calc_melee();
X}
X
Xvoid i_perm_agility(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  if (o->used){
X    if (o->blessing > -1)
X      Player.agi += abs(o->plus)+1;
X    else
X      Player.agi -= abs(o->plus)+1;
X  }
X  else {
X    if (o->blessing > -1)
X      Player.agi -= abs(o->plus)+1;
X    else
X      Player.agi += abs(o->plus)+1;
X  }
X  calc_melee();
X}
X
Xvoid i_truesight(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  truesight(o->blessing);
X}
X
Xvoid i_perm_truesight(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  if (o->used){
X    if (o->blessing > -1) {
X      Player.status[TRUESIGHT] += 1500;
X      mprint("You feel sharp!");
X    }
X    else {
X      Player.status[BLINDED] += 1500;
X      mprint("You've been blinded!");
X    }
X  }
X  else {
X    if (o->blessing > -1) {
X      Player.status[TRUESIGHT] -= 1500;
X      if (Player.status[TRUESIGHT] < 1) {
X	mprint("You feel less keen now.");
X	Player.status[TRUESIGHT] = 0;
X      }
X    }
X    else {
X      Player.status[BLINDED] -= 1500;
X      if (Player.status[BLINDED] < 1) {
X	mprint("You can see again!"); 
X	Player.status[BLINDED] = 0;
X      }
X    }
X  } 
X}
X
Xvoid i_dispel(o)
Xpob o;
X{
X  dispel((o->blessing > -1) ? o->blessing+random_range(3): o->blessing);
X}
X
Xvoid i_crystal(o)
Xpob o;
X{
X  static int viewhour = 0;
X  if (!o->known) mprint("You can't figure out how to activate this orb.");
X  else {
X    mprint("You gaze into your crystal ball.");
X    if (viewhour == hour()) mprint("All you get is Gilligan's Island reruns.");
X    else if ((o->blessing<0) || (Player.iq+Player.level < random_range(30))) {
X      viewhour = hour();
X      mprint("Weird interference patterns from the crystal fog your mind....");
X      amnesia();
X    }
X    else {
X      viewhour = hour();
X      mprint("You sense the presence of life...");
X      mondet(1);
X      morewait();
X      mprint("You sense the presence of objects...");
X      objdet(1);
X      morewait();
X      mprint("You begin to see visions of things beyond your ken....");
X      hint();
X    }
X  }
X}
X    
Xvoid i_antioch(o)
Xpob o;
X{
X  int x=Player.x,y=Player.y;
X  int count;
X  if (!o->known){
X    mprint("Ka-Boom!");
X    mprint("You seem to have annihilated yourself.");
X    p_death("The Holy Hand-Grenade of Antioch");
X  }
X  else {
X    mprint("Bring out the Holy Hand-Grenade of Antioch!");
X    setspot(&x,&y);
X    mprint("Ok, you pull the pin.....");
X    mprint("What do you count up to? ");
X    count = parsenum();
X    if ((count < 3)&&(Dungeon[Dlevel][x][y].creature!=NULL)) {
X      mprint("Three shall be the number of thy counting.");
X      mprint("And the number of thy counting shall be three.");
X      mprint("Your target picks up the grenade and throws it back!");
X      mprint("Ka-Boom!");
X      p_death("The Holy Hand-Grenade of Antioch");
X    }
X    else if (count>3) {
X      mprint("Three shall be the number of thy counting.");
X      mprint("And the number of thy counting shall be three.");
X      mprint("Ka-Boom!");
X      p_death("The Holy Hand-Grenade of Antioch");
X    }
X    else {
X      mprint("Ka-Boom!");
X      gain_experience(1000);
X      Dungeon[Dlevel][x][y].locchar = TRAP;
X      Dungeon[Dlevel][x][y].p_locf = L_TRAP_DOOR;
X      if (Dungeon[Dlevel][x][y].creature != NULL) {
X	m_death(Dungeon[Dlevel][x][y].creature);
X	mprint("You are covered with gore.");
X      }
X      Dungeon[Dlevel][x][y].things = NULL;
X    }
X  }
X  conform_lost_object(o);
X}
X
Xvoid i_kolwynia(o)
Xpob o;
X{
X  int i;
X  if (! o->known) {
X    mprint("You destroy youself with a mana storm. How sad.");
X    p_death("Kolwynia, The Key That Was Lost");
X  }
X  else {
X    gain_experience(5000);
X    mprint("You seem to have gained complete mastery of magic.");
X    Player.pow = Player.maxpow = 2*Player.maxpow;
X    for(i=0;i<NUMSPELLS;i++)
X      Spells[i].known = TRUE;
X  }
X  conform_lost_object(o);
X}
X
Xvoid i_enchantment(o)
Xpob o;
X{
X  static int zaphour = 0;
X  char response;
X  if (zaphour == hour()) 
X    mprint("The staff doesn't seem to have recharged yet.");
X  else if (! o->known) {
X    zaphour = hour();
X    mprint("You blast the staff backwards....");
X    dispel(-1);
X  }
X  else {
X    zaphour = hour();
X    mprint("Zap with white or black end [wb]");
X    do response = mgetc(); while ((response != 'w') && (response != 'b'));
X    mprint("The staff discharges!");
X    if (response = 'w') enchant(o->blessing*2+1);
X    else dispel(o->blessing);
X  }
X}
X
Xvoid i_helm(o)
Xpob o;
X{
X  static int helmhour = 0;
X  if (helmhour == hour()) 
X    mprint("The helm doesn't seem to have recharged yet.");
X  else if (! o->known) {
X    helmhour = hour();
X    mprint("You put the helm on backwards....");
X    p_teleport(-1);
X  }
X  else {
X    helmhour = hour();
X    mprint("Your environment fades.... and rematerializes.");
X    p_teleport(o->blessing);
X  }
X}
X 
X
Xvoid i_death(o)
Xpob o;
X{
X  mprint("Bad move...");
X  p_death("The Potion of Death");
X}
X
Xvoid i_life(o)
Xpob o;
X{
X  mprint("Good move.");
X  Player.hp = Player.maxhp = 2 * Player.maxhp;
X  conform_lost_object(o);
X}
X
Xvoid i_illuminate(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  illuminate(o->blessing);
X}
X
Xvoid i_perm_illuminate(o)
Xpob o;
X{
X  o->known = 1;
X  Objects[o->id].known = 1;
X  if (o->used) 
X    Player.status[ILLUMINATION]+=1500;
X  else
X    Player.status[ILLUMINATION]=max(0,Player.status[ILLUMINATION]-1500);
X}
X
X
X
Xvoid i_desecrate(o)
Xpob o;
X{
X  o->known = 1;
X  if (o->blessing > 0) {
X    mprint("How weird, a blessed desecrator... ");
X    mprint("The structure of reality cannot permit such a thing....");
X    *o = Objects[WEAPONID+0];
X  }
X  else if (Dungeon[Dlevel][Player.x][Player.y].locchar == ALTAR)
X    sanctify(-1);
X}
X
X
Xvoid i_trap(o)
Xpob o;
X{
X  Objects[o->id].known = 1;
X  
X  if ((Dungeon[Dlevel][Player.x][Player.y].locchar != FLOOR) ||
X      (Dungeon[Dlevel][Player.x][Player.y].p_locf != L_NO_OP))
X    mprint("Your attempt fails.");
X  else  if (! o->known) {
X    mprint("Fiddling with the thing, you have a small accident....");
X    p_movefunction(o->aux);
X  }
X  else {
X    mprint("You successfully set a trap at your location.");
X    Dungeon[Dlevel][Player.x][Player.y].p_locf = o->aux;
X  }
X  conform_lost_objects(1,o);
X}
X
Xvoid i_juggernaut(o)
Xpob o;
X{
X  int d,x=Player.x,y=Player.y;
X  mprint("You activate the Juggernaut of Karnak!");
X  if (! o->known) {
X    mprint("Uh, oh, it's coming this way!");
X    p_death("The Juggernaut of Karnak");
X  }
X  else {
X    d = getdir();
X    if (d == ABORT)
X      mprint("You deactivate the Juggernaut before it escapes.");
X    else {
X      mprint("Vroom!");
X      while (inbounds(x+Dirs[0][d],y+Dirs[1][d])) {
X	x+=Dirs[0][d];
X	y+=Dirs[1][d];
X	Dungeon[Dlevel][x][y].locchar = FLOOR;
X	Dungeon[Dlevel][x][y].p_locf = L_NO_OP;
X	if (Dungeon[Dlevel][x][y].creature != NULL) {
X	  mprint("You hear a distant scream....");
X	  m_death(Dungeon[Dlevel][x][y].creature);
X	}
X      }
X      gain_experience(1000);
X    }
X  }
X  conform_lost_object(o);
X}
X
X
Xvoid i_symbol(o)
Xpob o;
X{
X  static int usehour = -1;
X  int i;
X  if (! o->known)
X    mprint("Nothing seems to happen.");
X  /* if o->charge != 17, then symbol was stolen from own high priest! */
X  else if ((o->aux != Player.patron) || (o->charge != 17)){
X    mprint("You invoke the deity...");
X    mprint("...who for some reason seems rather annoyed at you...");
X    mprint("You are enveloped in Godsfire!");
X    morewait();
X    for(;Player.hp>1;Player.hp--) {
X      dataprint();
X      morewait();
X      for(i=0;i<MAXITEMS;i++)
X	if (Player.possessions[i] != NULL)
X	  conform_lost_object(Player.possessions[i]);
X      Player.mana = 0;
X    }
X  }
X  else if (usehour == hour()) {
X    mprint("Your deity frowns upon this profligate use of power...");
X    mprint("Shazam! A bolt of Godsfire! Your symbol shatters!");
X    conform_lost_object(o);
X    Player.hp = 1;
X    dataprint();
X  }
X  else {
X    usehour = hour();
X    cleanse(1);
X    heal(10);
X    Player.mana = max(Player.mana,calcmana());
X  }
X}
END_OF_oitemf.c
if test 43957 -ne `wc -c <oitemf.c`; then
    echo shar: \"oitemf.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 2 \(of 15\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 15 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