Пример #1
0
void l_enter_court(void)
{
  print1("You have found a magical portal! Enter it? [yn] ");
  if (ynq1()=='y') {
    if (! gamestatusp(COMPLETED_CASTLE)) {
      if (! gamestatusp(ATTACKED_ORACLE)) {
	print2("A dulcet voice says: 'Jolly good show!'");
	morewait();
      }
      setgamestatus(COMPLETED_CASTLE);
    }
    change_environment(E_COURT);
  }
}
Пример #2
0
/* various miscellaneous location functions */
void l_water(void)
{
  if (! gamestatusp(MOUNTED))  {
    if ((Player.possessions[O_ARMOR] != NULL)) {
      print1("Your heavy armor drags you under the water!");
      morewait();
      p_drown();
      print2("You reach the surface again.");
    }
    else if (Player.itemweight > ((int) (Player.maxweight / 2))) {
      print1("The weight of your burden drags you under water!");
      morewait();
      p_drown();
      print2("You reach the surface again.");
    }
    else switch(random_range(32)) {
    case 0:print1("Splish. Splash!"); break;
    case 1:print1("I want my ducky!"); break;
    case 2:print1("So finally you take a bath!"); break;
    case 3:print1("You must be very thirsty!"); break;
    }
  }
  else switch(random_range(32)) {
    case 0:print1("Your horse frolics playfully in the water."); break;
    case 1:print1("Your horse quenches its thirst."); break;
    case 2:print1("Your steed begins to swim...."); break;
    case 3:print1("Your mount thrashes about in the water."); break;
    }
}
Пример #3
0
void l_void_station(void)
{
  int i,something=FALSE;
  if (cinema_confirm("You're about to Peter Pan into an endless void.")=='y') {
    if (Level->mlist == NULL) {
      print2("You fall forever. Eventually you die of starvation.");
      morewait();
      while(Player.hp>0) {
	Time+=60;
	hourly_check();
	usleep(250000);
      }
    }
    else {
      print1("You enter the void.");
      print2("You feel a sudden surge of power from five directions.");
      morewait();
      something = (Player.packptr > 0);
      if (! something)
	for(i=0;((i<MAXITEMS)&&(!something));i++)
	  if (Player.possessions[i] != NULL)
	    something = TRUE;
      if (something) {
	print1("The flow of power is disrupted by something!");
	print2("The power is unbalanced! You lose control!");
	morewait();
	print1("Each of your cells explodes with a little scream of pain.");
	print2("Your disrupted essence merges with the megaflow.");
	p_death("the Power of the Void");
      }
      else if (! gamestatusp(PREPARED_VOID)){
	print1("The hungry void swallows you whole!");
	print2("Your being dissipates with a pathetic little sigh....");
	p_death("the Emptyness of the Void");
      }
      else {
	print1("The flow of power rages through your body,");
	print2("but you manage to master the surge!");
	print3("You feel adept....");
	morewait();clearmsg();
	print1("With a thought, you soar up through the void to the");
	print2("place from whence you came.");
	print3("As the platform of the Challenge dwindles beneath you");
	morewait();
	clearmsg();
	print1("You see Death raise his scythe to you in a salute.");
	Player.rank[ADEPT] = 1;
	setgamestatus(COMPLETED_CHALLENGE);
	FixedPoints = calc_points();
	/* set so change_environment puts player in correct temple! */
	Player.x = 49;
	Player.y = 59;
	print2("You find yourself back in the Temple of Destiny.");
	morewait();
	change_environment(E_TEMPLE);
      }
    }
  }
  else print2("You back away from the edge....");
}
Пример #4
0
short dump_options( FILE *dumpfile )
{
  if ( cheated_death || cheated_savegame )
    {
      /* reset "checksum" */
      dumpcheck = 0;
	
      if ( !dump( dumpfile, "\n-- Cheats --\n\n", FALSE ) )
        return FALSE;
			
      if ( gamestatusp( CHEATED ) )
        {
          if ( !dump( dumpfile, "Entered Wizard Mode\n", TRUE ) )
            return FALSE;
        }
				
      if ( cheated_death )
        {
          if ( !dump( dumpfile, "Refused to die\n", TRUE ) )
            return FALSE;
        }
				
      if ( cheated_savegame )
        {
          if ( !dump( dumpfile, "Restored from save file after death\n", TRUE ) )
            return FALSE;
        }
			
      sprintf( dump_buf, "[Verification: %8.8lx]\n\n", dumpcheck );
      if ( !dump( dumpfile, dump_buf, FALSE ) )
        return FALSE;
    }
			
  return TRUE;
}
Пример #5
0
/* prints wherever cursor is in window, but checks to see if
it should morewait and clear window */
void mprint(char *s)
{
  int x,y;
  if (! gamestatusp(SUPPRESS_PRINTING)) {
    getyx(Msgw,y,x);
    if (x+strlen(s) >= ScreenWidth) {
      buffercycle(s);
      if (Msgw == Msg1w) {
        wclear(Msg2w);
        Msgw = Msg2w;
      }
      else {
        morewait();
        wclear(Msg1w);
        wclear(Msg2w);
        wrefresh(Msg2w);
        Msgw = Msg1w;
      }
    }
    else if (x > 0)
      bufferappend(s);
    else
      buffercycle(s);
    wprintw(Msgw,s);
    waddch(Msgw,' '); 
    wrefresh(Msgw);
  }
}
Пример #6
0
/* Increase in level at appropriate experience gain */
void gain_level(void)
{
  int gained=FALSE;
  int hp_gain; /* FIXED! 12/30/98 */
  
  if (gamestatusp(SUPPRESS_PRINTING))
    return;
  while (expval(Player.level+1) <= Player.xp) {
    if (!gained)
      morewait();
    gained = TRUE;
    Player.level++;
    print1("You have attained a new experience level!");
    print2("You are now ");
    nprint2(getarticle(levelname(Player.level)));
    nprint2(levelname(Player.level));
    hp_gain = random_range(Player.con)+1; /* start fix 12/30/98 */
    if (Player.hp < Player.maxhp )
      Player.hp += hp_gain*Player.hp/Player.maxhp;
    else if (Player.hp < Player.maxhp + hp_gain)
      Player.hp = Player.maxhp + hp_gain;
    /* else leave current hp alone */
    Player.maxhp += hp_gain;
    Player.maxmana = calcmana();
    /* If the character was given a bonus, let him keep it.  Otherwise
     * recharge him. */
    Player.mana = max(Player.mana, Player.maxmana); /* end fix 12/30/98 */
    morewait();
  }
  if (gained) clearmsg();
  calc_melee();
}
Пример #7
0
/* direct print to second msg line */
void print2(char *s)
{
  if (! gamestatusp(SUPPRESS_PRINTING)) {
    buffercycle(s);
    wclear(Msg2w);
    wprintw(Msg2w,s);
    wrefresh(Msg2w);
  }
}
Пример #8
0
void l_fire(void)
{
  print1("You boldly stride through the curtain of fire...");
  if (gamestatusp(MOUNTED)) {
    print2("Your horse is fried and so are you...");
    resetgamestatus(MOUNTED);
  }
  p_damage(random_range(100),FLAME,"self-immolation");
}
Пример #9
0
/* for run on-messages -- print2 clears first.... */
void nprint2(char *s)
{
  if (! gamestatusp(SUPPRESS_PRINTING)) {
    if (bufferappend(s)) {
      wprintw(Msg2w,s);
      wrefresh(Msg2w);
    }
  }
}
Пример #10
0
/* WDT: it's also typically used for messages intended to persist a while.
 * Thus I'm having print3 save its input in a global variable which other
 * things can use. */
void print3 (char *s)
{
  if (!gamestatusp(SUPPRESS_PRINTING))
    {
      buffercycle(s);
      erasemsg3();
      wprintw(Msg3w, s);
      strcpy(screenLine3, s);
      wrefresh(Msg3w);
    }
}
Пример #11
0
/* for run on-messages -- print3 clears first.... */
void nprint3(char *s)
{
  if (!gamestatusp(SUPPRESS_PRINTING))
    {
      if (bufferappend(s))
        {
          strcat(screenLine3, s);
          wprintw(Msg3w,s);
          wrefresh(Msg3w);
        }
    }
}
Пример #12
0
void cavern_level(void)
{
  int i,fx,fy,tx,ty,t,l,e;
  char rsi;

  Level->numrooms = 1;

  if ((Current_Dungeon == E_CAVES) && (Level->depth == CAVELEVELS))
    rsi = RS_GOBLINKING;
  else rsi = RS_CAVERN;
  t = random_range((Level->level_length)/2);
  l = random_range((Level->level_width)/2);
  e = random_range((Level->level_width)/8)+(Level->level_width)/8;
  build_square_room(t,l,e,rsi,0);
  
  for (i=0;i<16;i++) {
    findspace(&tx,&ty,-1);
    fx = random_range((Level->level_width)-2)+1;
    fy = random_range((Level->level_length)-2)+1;
    straggle_corridor(fx,fy,tx,ty,FLOOR,RS_CORRIDOR);
  }
  while (random_range(3)==1) {
    findspace(&tx,&ty,-1);
    fx = random_range((Level->level_width)-2)+1;
    fy = random_range((Level->level_length)-2)+1;
    straggle_corridor(fx,fy,tx,ty,WATER,RS_PONDS);
  }
  if (Current_Dungeon == E_CAVES) {
    if ((Level->depth == CAVELEVELS) && (! gamestatusp(COMPLETED_CAVES))) {
      findspace(&tx,&ty,-1);
      Level->mlist = ((pml) checkmalloc(sizeof(mltype)));
      Level->mlist->next = NULL;
      Level->mlist->m = 
	Level->site[tx][ty].creature = 
	  ((pmt) make_creature(GOBLIN_KING)); /* goblin king */
      Level->mlist->m->x = tx;
      Level->mlist->m->y = ty;
    }
  }
  else if (Current_Environment == E_VOLCANO) {
    if (Level->depth == VOLCANOLEVELS) {
      findspace(&tx,&ty,-1);
      Level->mlist = ((pml) checkmalloc(sizeof(mltype)));
      Level->mlist->next = NULL;
      Level->mlist->m = 
	Level->site[tx][ty].creature = 
	  ((pmt) make_creature(DEMON_EMP)); /* The demon emp */
      Level->mlist->m->x = tx;
      Level->mlist->m->y = ty;
    }
  }
}
Пример #13
0
void drawvision(int x, int y)
{
  static int oldx = -1,oldy = -1;
  int i,j,c;

  if (Current_Environment != E_COUNTRYSIDE) {
    if (Player.status[BLINDED]) {
      drawspot(oldx,oldy);
      drawspot(x,y);
      drawplayer();
    }
    else {
      if (Player.status[ILLUMINATION] > 0) {
        for (i= -2;i<3;i++)
          for (j= -2;j<3;j++)
            if (inbounds(x+i,y+j))
              if (view_los_p(x+i,y+j,Player.x,Player.y))
                dodrawspot(x+i,y+j);
      }
      else {
        for (i= -1;i<2;i++)
          for (j= -1;j<2;j++)
            if (inbounds(x+i,y+j))
              dodrawspot(x+i,y+j);
      }
      drawplayer();
      drawmonsters(FALSE); /* erase all monsters */
      drawmonsters(TRUE);  /* draw those now visible */
    }
    if ((! gamestatusp(FAST_MOVE)) || (! optionp(JUMPMOVE)))
      omshowcursor(Player.x,Player.y);
    oldx = x;
    oldy = y;
  }
  else {
    for (i= -1;i<2;i++)
      for (j= -1;j<2;j++)
        if (inbounds(x+i,y+j)) {
          c_set(x+i, y+j, SEEN);
          if (!offscreen(x+i,y+j)) {
            wmove(Levelw,screenmody(y+j),screenmodx(x+i));
            c = Country[x+i][y+j].current_terrain_type;
            if (optionp(SHOW_COLOUR))
              wattrset(Levelw, CHARATTR(c));
            waddch(Levelw,(c&0xff));
          }
        }
    drawplayer();
    omshowcursor(Player.x,Player.y);
  }
}
Пример #14
0
short dump_possessions( FILE *dumpfile )
{
  if ( !dump_carried( dumpfile ) )
    return FALSE;
		
  if ( !dump_pack( dumpfile ) )
    return FALSE;
	
  if ( gamestatusp( SOLD_CONDO ) )
    {
      if ( !dump_condo( dumpfile ) )
        return FALSE;
    }
		
  return TRUE;
}
Пример #15
0
void l_lava(void)
{
  print1("Very clever -- walking into a pool of lava...");
  if (gamestatusp(MOUNTED)) {
    print2("Your horse is incinerated... You fall in too!");
    resetgamestatus(MOUNTED);
  }
  morewait();
  if (strcmp(Player.name,"Saltheart Foamfollower")==0) {
    print1("Strangely enough, you don't seem terribly affected.");
    p_damage(1,UNSTOPPABLE,"slow death in a pool of lava");
  }
  else {
    p_damage(random_range(75),FLAME,"incineration in a pool of lava");
    if (Player.hp> 0) p_drown();
    Player.status[IMMOBILE]+=2;
  }
}
Пример #16
0
void morewait(void)
{
  int display=TRUE;
  int c;
  if (gamestatusp(SUPPRESS_PRINTING))
    return;
  do {
    wclear(Morew);
    if (display) wprintw(Morew,"***  MORE  ***");
    else wprintw(Morew,"+++  MORE  +++");
    display = ! display;
    wrefresh(Morew);
    /* c = wgetch(Msgw); */
    c = wgetch(Morew);
  } while ((c != ' ') && (c != RETURN) && (c != EOF));
  wclear(Morew);
  wrefresh(Morew);
}
Пример #17
0
void l_adept(void)
{
    print1("You see a giant shimmering gate in the form of an omega.");
    if (! gamestatusp(ATTACKED_ORACLE)) {
        if (Player.str+Player.con+Player.iq+Player.pow < 100)
            print2("A familiar female voice says: I would not advise this now....");
        else print2("A familiar female voice says: Go for it!");
    }
    morewait();
    clearmsg();
    if (cinema_confirm("You're about to step into the mystic portal.")!='y') {
        if (Player.level > 100) {
            print1("The Lords of Destiny spurn your cowardice and indecision...");
            Player.xp = 0;
            Player.level = 0;
            Player.hp = Player.maxhp = Player.con;
            Player.mana = calcmana();
            print2("You suddenly feel very inexperienced.");
            dataprint();
            morewait();
            clearmsg();
        }
        print1("You edge away from the challenge.");
    }
    else {
        clearmsg();
        print1("You pass through the portal.");
        morewait();
        drawomega();
        print1("Like wow man! Colors! ");
        if (Player.patron != DESTINY) {
            print2("Strange forces try to tear you apart!");
            p_damage(random_range(200),UNSTOPPABLE,"a vortex of chaos");
        }
        else print2("Some strange force shields you from a chaos vortex!");
        morewait();
        print1("Your head spins for a moment....");
        print2("and clears....");
        morewait();
        Player.hp = Player.maxhp;
        Player.mana = calcmana();
        change_environment(E_ABYSS);
    }
}
Пример #18
0
void sewer_level(void)
{
  int i,tx,ty,t,l,e;
  char rsi;
  Symbol lchar;

  Level->numrooms = random_range(3)+3;
  rsi = RS_DRAINED_SEWER;
  for (i=0;i<Level->numrooms;i++) {
    do {
      t = random_range((Level->level_length)-10)+1;
      l = random_range((Level->level_width)-10)+1;
      e = 4;
    } while ((Level->site[l][t].roomnumber == rsi) ||
	     (Level->site[l+e][t].roomnumber == rsi) ||
	     (Level->site[l][t+e].roomnumber == rsi) ||
	     (Level->site[l+e][t+e].roomnumber == rsi));
    if (random_range(5)) {
      lchar = FLOOR;
      rsi = RS_DRAINED_SEWER;
    }
    else {
      lchar = WATER;
      rsi = RS_DROWNED_SEWER;
    }
    build_room(l,t,e,rsi,i);
    sewer_corridor(l,t,-1,-1,lchar);
    sewer_corridor(l+e,t,1,-1,lchar);
    sewer_corridor(l,t+e,-1,1,lchar);
    sewer_corridor(l+e,t+e,1,1,lchar);
  }
  if (Current_Dungeon == E_SEWERS) {
    if ((Level->depth == SEWERLEVELS) && (! gamestatusp(COMPLETED_SEWERS))) {
      findspace(&tx,&ty,-1);
      Level->mlist = ((pml) checkmalloc(sizeof(mltype)));
      Level->mlist->next = NULL;
      Level->mlist->m = 
	Level->site[tx][ty].creature = 
	  ((pmt) make_creature(GREAT_WYRM)); /* The Great Wyrm */
      Level->mlist->m->x = tx;
      Level->mlist->m->y = ty;
    }
  }
}
Пример #19
0
void l_chaos(void)
{
  if (gamestatusp(MOUNTED)) {
    print1("Your steed tries to swim in the raw Chaos, but seems to");
    print2("be having some difficulties...");
    morewait();
    print1("probably because it's just turned into a chaffinch.");
    morewait();
    resetgamestatus(MOUNTED);
  }
  if (! onewithchaos)
    print1("You are immersed in raw Chaos....");
  if (Player.rank[ADEPT]) {
    if (! onewithchaos)
    {
      onewithchaos = 1;
      print2("You achieve oneness of Chaos....");
    }
    Player.mana = max(Player.mana,calcmana());
    Player.hp = max(Player.hp, Player.maxhp);
  }
  else if (onewithchaos) /* adept that gets amnesia from chaos storm */
  {
    print2("The chaos sea doesn't seem to bother you at all.");
  }
  else if (Player.rank[PRIESTHOOD] && (! saved)) {
    print2("A mysterious force protects you from the Chaos!");
    print3("Wow.... You feel a bit smug.");
    gain_experience(500);
    saved = TRUE;
  }
  else {
    print2("Uh oh....");
    if (saved) nprint2("Nothing mysterious happens this time....");
    morewait();
    print1("Congratulations! You've achieved maximal entropy!");
    Player.alignment -= 50;
    gain_experience(1000);
    p_death("immersion in raw Chaos");
  }
}
Пример #20
0
void showflags(void)
{

  phaseprint();
  wclear(Flagw);
  if (Player.food < 0)
    wprintw(Flagw,"Starving\n");
  else if (Player.food <= 3)
    wprintw(Flagw,"Weak\n");
  else if (Player.food <= 10)
    wprintw(Flagw,"Ravenous\n");
  else if (Player.food <= 20)
    wprintw(Flagw,"Hungry\n");
  else if (Player.food <= 30)
    wprintw(Flagw,"A mite peckish\n");
  else if (Player.food <= 36)
    wprintw(Flagw,"Content\n");
  else if (Player.food <= 44)
    wprintw(Flagw,"Satiated\n");
  else wprintw(Flagw,"Bloated\n");


  if (Player.status[POISONED]>0)
    wprintw(Flagw,"Poisoned\n");
  else wprintw(Flagw,"Vigorous\n");

  if (Player.status[DISEASED]>0)
    wprintw(Flagw,"Diseased\n");
  else wprintw(Flagw,"Healthy\n");

  if (gamestatusp(MOUNTED)) wprintw(Flagw,"Mounted\n");
  else if (Player.status[LEVITATING]) wprintw(Flagw,"Levitating\n");
  else wprintw(Flagw,"Afoot\n");

  wrefresh(Flagw);
}
Пример #21
0
/* various kinds of wishes */
void wish(int blessing)
{
    int i;
    char wishstr[80];
    clearmsg();
    print1("What do you wish for? ");
    if (blessing < 0)
        deathprint();
    else
        strcpy(wishstr,msgscanstring());
    if (blessing < 0 || strcmp(wishstr,"Death")==0) {
        print2("As you wish, so shall it be.");
        p_death("a deathwish");
    }
    if (strcmp(wishstr,"Power")==0) {
        print2("You feel a sudden surge of energy");
        Player.mana=calcmana()*10;
    }
    else if (strcmp(wishstr,"Skill")==0) {
        print2("You feel more competent.");
        if (gamestatusp(CHEATED))
            gain_experience(10000);
        else
            gain_experience(min(10000,Player.xp));
    }
    else if (strcmp(wishstr,"Wealth")==0) {
        print2("You are submerged in shower of gold pieces!");
        Player.cash += 10000;
    }
    else if (strcmp(wishstr,"Balance")==0) {
        print2("You feel neutral.");
        Player.alignment = 0;
    }
    else if (strcmp(wishstr,"Chaos")==0) {
        print2("You feel chaotic.");
        Player.alignment -= 25;
    }
    else if (strcmp(wishstr,"Law")==0) {
        print2("You feel lawful.");
        Player.alignment += 25;
    }
    else if (strcmp(wishstr,"Location")==0)
        strategic_teleport(1);
    else if (strcmp(wishstr,"Knowledge")==0) {
        print2("You feel more knowledgeable.");
        i = random_range(NUMSPELLS);
        if (Spells[i].known)
            Spells[i].powerdrain =
                (max(1,Spells[i].powerdrain/2));
        else Spells[i].known = TRUE;
    }
    else if (strcmp(wishstr,"Health")==0) {
        print2("You feel vigorous");
        Player.hp = max( Player.hp, Player.maxhp);
        Player.status[DISEASED] = 0;
        Player.status[POISONED] = 0;
        Player.food = 43;
        /* Wish for Health when starving does some good. PGM */
    }
    else if (strcmp(wishstr,"Destruction")==0)
        annihilate(gamestatusp(CHEATED));
    else if (strcmp(wishstr,"Acquisition")==0)
        acquire(gamestatusp(CHEATED));
    else if (strcmp(wishstr,"Summoning")==0)
        summon(gamestatusp(CHEATED),-1);
    else if (strcmp(wishstr,"Stats") == 0 && gamestatusp(CHEATED))
    {
        Player.str = Player.maxstr = Player.con = Player.maxcon =
                                         Player.agi = Player.maxagi = Player.dex = Player.maxdex =
                                                 Player.iq = Player.maxiq = Player.pow = Player.maxpow = 200;
        calc_melee();
    }
    else print2("You feel stupid.");
    dataprint();
    showflags();
}
Пример #22
0
void l_order(void)
{
  pob newitem;
  pml ml;
  print1("The Headquarters of the Order of Paladins.");
  morewait();
  if ((Player.rank[ORDER]==PALADIN) &&
      (Player.level > Justiciarlevel) &&
      gamestatusp(GAVE_STARGEM) &&
      Player.alignment > 300) {
    print1("You have succeeded in your quest!");
    morewait();
    print1("The previous Justiciar steps down in your favor.");
    print2("You are now the Justiciar of Rampart and the Order!");
    strcpy(Justiciar,Player.name);
    for (ml = Level->mlist; ml && (ml->m->id != HISCORE_NPC ||
	ml->m->aux2 != 15); ml = ml->next)
      /* just scan for current Justicar */;
    if (ml) {
      m_remove(ml->m); /* signals "death" -- no credit to player, though */
    }
    Justiciarlevel = Player.level;
    morewait();
    Justiciarbehavior = fixnpc(4);
    save_hiscore_npc(15);
    clearmsg();
    print1("You are awarded a blessed shield of deflection!");
    morewait();
    newitem = ((pob) checkmalloc(sizeof(objtype)));
    *newitem = Objects[OB_DEFLECT]; /* shield of deflection */
    newitem->blessing = 9;
    gain_item(newitem);
    morewait();
    Player.rank[ORDER] = JUSTICIAR;
    Player.maxstr += 5;
    Player.str += 5;
    Player.maxpow += 5;
    Player.pow += 5;
  }
  if (Player.alignment < 1) {
    if (Player.rank[ORDER] > 0) {
      print1("You have been tainted by chaos!");
      print2("You are stripped of your rank in the Order!");
      morewait();
      Player.rank[ORDER]= -1;
      send_to_jail();
    }
    else
      print1("Get thee hence, minion of chaos!");
  }
  else if (Player.rank[ORDER] == -1)
    print1("Thou again?  Get thee hence, minion of chaos!");
  else if (Player.rank[ORDER] == 0) {
    if (Player.rank[ARENA] != 0) 
      print1("We do not accept bloodstained gladiators into our Order.");
    else if (Player.rank[LEGION] != 0) 
      print1("Go back to your barracks, mercenary!");
    else {
      print1("Dost thou wish to join our Order? [yn] ");
      if (ynq1()=='y') {
	print1("Justiciar ");
	nprint1(Justiciar);
	nprint1(" welcomes you to the Order.");
	print2("'Mayest thou always follow the sublime path of Law.'");
	morewait();
	print1("You are now a Gallant in the Order.");
	print2("You are given a horse and a blessed spear.");
	morewait();
	Player.rank[ORDER] = GALLANT;
	Player.guildxp[ORDER] = 1;
	setgamestatus(MOUNTED);
	newitem = ((pob) checkmalloc(sizeof(objtype)));
	*newitem = Objects[OB_SPEAR]; /* spear */
	newitem->blessing = 9;
	newitem->plus = 1;
	newitem->known = 2;
	gain_item(newitem);
      }
    }
  } else {
      print1("'Welcome back, Paladin.'");
      if (!gamestatusp(MOUNTED)) {
	print2("You are given a new steed.");
	setgamestatus(MOUNTED);
      }
      morewait();
      clearmsg();
      if ((Player.hp < Player.maxhp) || (Player.status[DISEASED]) ||
	(Player.status[POISONED]))
	print1("Your wounds are treated by a medic.");
      cleanse(0);
      Player.hp = Player.maxhp;
      if ( Player.food <= 40 )
      {
        Player.food = 40;
        print2("You get a hot meal from the refectory.");
      }
      morewait();
      clearmsg();
      if (Player.rank[ORDER]==PALADIN) {
	if (Player.level <= Justiciarlevel)
	  print2("You are not experienced enough to advance.");
	else if (Player.alignment < 300)
	  print2("You are not sufficiently Lawful as yet to advance.");
	else print2("You must give the Star Gem to the LawBringer.");
      }
      else if (Player.rank[ORDER]==CHEVALIER) {
	if (Player.guildxp[ORDER] < 4000)
	  print2("You are not experienced enough to advance.");
	else if (Player.alignment < 200)
	  print2("You are not sufficiently Lawful as yet to advance.");
	else {
	  print1("You are made a Paladin of the Order!");
	  print2("You learn the Spell of Heroism and get Mithril Plate!");
	  morewait();
	  newitem = ((pob) checkmalloc(sizeof(objtype)));
	  *newitem = Objects[OB_MITHRIL_PLATE]; /* mithril plate armor */
	  newitem->blessing = 9;
	  newitem->known = 2;
	  gain_item(newitem);
	  morewait();
	  clearmsg();
	  print1("To advance you must rescue the Star Gem and return it");
	  print2("to its owner, the LawBringer, who resides on Star Peak.");
	  morewait();
	  print1("The Star Gem was stolen by the cursed Prime Sorceror,");
	  print2("whose headquarters may be found beyond the Astral Plane.");
	  morewait();
	  print1("The Oracle will send you to the Astral Plane if you");
	  print2("prove yourself worthy to her.");
	  morewait();
	  Spells[S_HERO].known = TRUE;
	  Player.rank[ORDER] = PALADIN;
	}
      }
      else if (Player.rank[ORDER]==GUARDIAN) {
	if (Player.guildxp[ORDER] < 1500)
	  print2("You are not experienced enough to advance.");
	else if (Player.alignment < 125)
	  print2("You are not yet sufficiently Lawful to advance.");
	else {
	  Player.rank[ORDER] = CHEVALIER;
	  print1("You are made a Chevalier of the Order!");
	  print2("You are given a Mace of Disruption!");
	  morewait();
	  clearmsg();
	  newitem = ((pob) checkmalloc(sizeof(objtype)));
	  *newitem = Objects[OB_MACE_DISRUPT]; /* mace of disruption */
	  newitem->known = 2;
	  gain_item(newitem);
	}
      }
      else if (Player.rank[ORDER]==GALLANT) {
	if (Player.guildxp[ORDER] < 400)
	  print2("You are not experienced enough to advance.");
	else if (Player.alignment < 50)
	  print2("You are not Lawful enough to advance.");
	else  {
	  print1("You are made a Guardian of the Order of Paladins!");
	  print2("You are given a Holy Hand Grenade (of Antioch).");
	  morewait();
	  print1("You hear a nasal monotone in the distance....");
	  print2("'...and the number of thy counting shall be 3...'");
	  morewait();
	  clearmsg();
	  Player.rank[ORDER] = GUARDIAN;
	  newitem = ((pob) checkmalloc(sizeof(objtype)));
	  *newitem = Objects[OB_ANTIOCH]; /* holy hand grenade. */
	  newitem->known = 2;
	  gain_item(newitem);
	}
      }
  }
  showflags();
}
Пример #23
0
/* deal with a new player command in countryside mode */
void p_country_process(void)
{
    int no_op;

    drawvision(Player.x,Player.y);
    do {
        no_op = FALSE;
        Cmd = mgetc();
        clear_if_necessary();
        switch (Cmd) {
        case ' ':
        case 13:
            no_op = TRUE;
            break;
        case 7:
            wizard();
            break; /* ^g */
        case 12:
            xredraw();
            no_op = TRUE;
            break; /* ^l */
#if !defined(WIN32)
        case 16:
            bufferprint();
            no_op = TRUE;
            break; /* ^p */
#else
        case 15:
            bufferprint();
            no_op = TRUE;
            break; /* ^o */
#endif
        case 18:
            redraw();
            no_op = TRUE;
            break; /* ^r */
        case 23:
            if (gamestatusp(CHEATED)) drawscreen();
            break; /* ^w */
        case 24:
            if (gamestatusp(CHEATED) ||
                    Player.rank[ADEPT]) wish(1);
            break; /* ^x */
        case 'd':
            drop();
            break;
        case 'e':
            eat();
            break;
        case 'i':
            do_inventory_control();
            break;
        case 's':
            countrysearch();
            break;
        case 'x':
            examine();
            break;
        case 'E':
            dismount_steed();
            break;
        case 'H':
            hunt(Country[Player.x][Player.y].current_terrain_type);
            break;
        case 'I':
            if (! optionp(TOPINV)) top_inventory_control();
            else {
                menuclear();
                display_possessions();
                inventory_control();
            }
            break;
        case 'O':
            setoptions();
            break;
        case 'P':
            show_license();
            break; /* actually show_license is in file.c */
        case 'Q':
            quit();
            break;
        case 'R':
            rename_player();
            break;
        case 'S':
            save(FALSE);
            break;
        case 'V':
            version();
            break;
        case '>':
            enter_site(Country[Player.x][Player.y].base_terrain_type);
            break;
        case '#':
            if (gamestatusp(CHEATED)) editstats();
            break; /* RAC - char editor */
        case '/':
            charid();
            no_op = TRUE;
            break;
        case '?':
            help();
            no_op = TRUE;
            break;
        case '4':
        case 'h':
            movepincountry(-1,0);
            break;
        case '2':
        case 'j':
            movepincountry(0,1);
            break;
        case '8':
        case 'k':
            movepincountry(0,-1);
            break;
        case '6':
        case 'l':
            movepincountry(1,0);
            break;
        case '1':
        case 'b':
            movepincountry(-1,1);
            break;
        case '3':
        case 'n':
            movepincountry(1,1);
            break;
        case '7':
        case 'y':
            movepincountry(-1,-1);
            break;
        case '9':
        case 'u':
            movepincountry(1,-1);
            break;
        default:
            commanderror();
            no_op = TRUE;
            break;
        }
    } while (no_op);
    screencheck(Player.x,Player.y);
}
Пример #24
0
/* deal with a new player command in dungeon or city mode*/
void p_process(void)
{
    static int searchval=0;

    if (Player.status[BERSERK])
        if (goberserk()) {
            setgamestatus(SKIP_PLAYER);
            drawvision(Player.x,Player.y);
        }
    if (! gamestatusp(SKIP_PLAYER)) {
        if (searchval > 0) {
            searchval--;
            if (searchval == 0) resetgamestatus(FAST_MOVE);
        }
        drawvision(Player.x,Player.y);
        if (! gamestatusp(FAST_MOVE)) {
            searchval = 0;
            Cmd = mgetc();
            clear_if_necessary();
        }
        Command_Duration = 0;
        switch (Cmd) {
        case ' ':
        case 13:
            setgamestatus(SKIP_MONSTERS);
            break; /*no op on space or return*/
        case 6:
            abortshadowform();
            break; /* ^f */
        case 7:
            wizard();
            break; /* ^g */
        case 4:
            player_dump();
            break; /* ^d */
        case 9:
            display_pack();
            morewait();
            xredraw();
            break; /* ^i */
        case 11:
            if (gamestatusp(CHEATED)) frobgamestatus();
            break;
        case 12:
            xredraw();
            setgamestatus(SKIP_MONSTERS);
            break; /* ^l */
#if !defined(WIN32)
        case 16:
            bufferprint();
            setgamestatus(SKIP_MONSTERS);
            break; /* ^p */
#else
        case 15:
            bufferprint();
            setgamestatus(SKIP_MONSTERS);
            break; /* ^o */
#endif
        case 18:
            redraw();
            setgamestatus(SKIP_MONSTERS);
            break; /* ^r */
        case 23:
            if (gamestatusp(CHEATED)) drawscreen();
            break; /* ^w */
        case 24: /* ^x */
            if (gamestatusp(CHEATED) ||
                    Player.rank[ADEPT])
                wish(1);
            Command_Duration = 5;
            break;
        case 'a':
            zapwand();
            Command_Duration = Player.speed*8/5;
            break;
        case 'c':
            closedoor();
            Command_Duration = Player.speed*2/5;
            break;
        case 'd':
            drop();
            Command_Duration = Player.speed*5/5;
            break;
        case 'e':
            eat();
            Command_Duration = 30;
            break;
        case 'f':
            fire();
            Command_Duration = Player.speed*5/5;
            break;
        case 'g':
            pickup();
            Command_Duration = Player.speed*10/5;
            break;
        case 'i':
            do_inventory_control();
            break;
        case 'm':
            magic();
            Command_Duration = 12;
            break;
        case 'o':
            opendoor();
            Command_Duration = Player.speed*5/5;
            break;
        case 'p':
            pickpocket();
            Command_Duration = Player.speed*20/5;
            break;
        case 'q':
            quaff();
            Command_Duration = 10;
            break;
        case 'r':
            peruse();
            Command_Duration = 20;
            break;
        case 's':
            search(&searchval);
            Command_Duration = 20;
            break;
        case 't':
            talk();
            Command_Duration = 10;
            break;
        case 'v':
            vault();
            Command_Duration = Player.speed*10/5;
            break;
        case 'x':
            examine();
            Command_Duration = 1;
            break;
        case 'z':
            bash_location();
            Command_Duration = Player.speed*10/5;
            break;
        case 'A':
            activate();
            Command_Duration = 10;
            break;
        case 'C':
            callitem();
            break;
        case 'D':
            disarm();
            Command_Duration = 30;
            break;
        case 'E':
            dismount_steed();
            Command_Duration = Player.speed*10/5;
            break;
        case 'F':
            tacoptions();
            break;
        case 'G':
            give();
            Command_Duration = 10;
            break;
        case 'I':
            if (! optionp(TOPINV)) top_inventory_control();
            else {
                display_possessions();
                inventory_control();
            }
            break;
        case 'M':
            city_move();
            Command_Duration = 10;
            break;
        case 'O':
            setoptions();
#if defined(WIN32)
            show_screen();
            xredraw();
#endif
            break;
        case 'P':
            show_license();
            break; /* actually show_license is in file.c */
        case 'Q':
            quit();
            break;
        case 'R':
            rename_player();
            break;
        case 'S':
            save(FALSE);
            break;
        case 'T':
            tunnel();
            Command_Duration =  Player.speed*30/5;
            break;
        case 'V':
            version();
            break;
        case 'Z':
            bash_item();
            Command_Duration = Player.speed*10/5;
            break;
        case '.':
            rest();
            Command_Duration = 10;
            break;
        case ',':
            Command_Duration = 10;
            nap();
            break;
        case '>':
            downstairs();
            break;
        case '<':
            upstairs();
            break;
        case '@':
            p_movefunction(Level->site[Player.x][Player.y].p_locf);
            Command_Duration = 5;
            break;
        case '#':
            if (gamestatusp(CHEATED)) editstats();
            break; /* RAC - char editor */
        case '/':
            charid();
            setgamestatus(SKIP_MONSTERS);
            break;
        case '?':
            help();
            setgamestatus(SKIP_MONSTERS);
            break;
        case '4':
        case 'h':
            moveplayer(-1,0);
            Command_Duration = Player.speed*5/5;
            break;
        case '2':
        case 'j':
            moveplayer(0,1);
            Command_Duration = Player.speed*5/5;
            break;
        case '8':
        case 'k':
            moveplayer(0,-1);
            Command_Duration = Player.speed*5/5;
            break;
        case '6':
        case 'l':
            moveplayer(1,0);
            Command_Duration = Player.speed*5/5;
            break;
        case '1':
        case 'b':
            moveplayer(-1,1);
            Command_Duration = Player.speed*5/5;
            break;
        case '3':
        case 'n':
            moveplayer(1,1);
            Command_Duration = Player.speed*5/5;
            break;
        case '7':
        case 'y':
            moveplayer(-1,-1);
            Command_Duration = Player.speed*5/5;
            break;
        case '9':
        case 'u':
            moveplayer(1,-1);
            Command_Duration = Player.speed*5/5;
            break;
        case '5':
            setgamestatus(SKIP_MONSTERS); /* don't do anything; a dummy turn */
            Cmd = mgetc();
            while ((Cmd != ESCAPE) &&
                    ((Cmd < '1') || (Cmd > '9') || (Cmd=='5'))) {
                print3("Run in keypad direction [ESCAPE to abort]: ");
                Cmd = mgetc();
            }
            if (Cmd != ESCAPE) 
                setgamestatus(FAST_MOVE);
            else
                clearmsg3();
            break;
        case 'H':
            setgamestatus(FAST_MOVE);
            Cmd = 'h';
            moveplayer(-1,0);
            Command_Duration = Player.speed*4/5;
            break;
        case 'J':
            setgamestatus(FAST_MOVE);
            Cmd = 'j';
            moveplayer(0,1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'K':
            setgamestatus(FAST_MOVE);
            Cmd = 'k';
            moveplayer(0,-1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'L':
            setgamestatus(FAST_MOVE);
            Cmd = 'l';
            moveplayer(1,0);
            Command_Duration = Player.speed*4/5;
            break;
        case 'B':
            setgamestatus(FAST_MOVE);
            Cmd = 'b';
            moveplayer(-1,1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'N':
            setgamestatus(FAST_MOVE);
            Cmd = 'n';
            moveplayer(1,1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'Y':
            setgamestatus(FAST_MOVE);
            Cmd = 'y';
            moveplayer(-1,-1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'U':
            setgamestatus(FAST_MOVE);
            Cmd = 'u';
            moveplayer(1,-1);
            Command_Duration = Player.speed*4/5;
            break;
        default:
            commanderror();
            setgamestatus(SKIP_MONSTERS);
            break;
        }
    }
    if (Current_Environment != E_COUNTRYSIDE) roomcheck();
    screencheck(Player.x,Player.y);
}
Пример #25
0
void l_oracle(void)
{
    char response;
    if (gamestatusp(ATTACKED_ORACLE) && (! gamestatusp(COMPLETED_ASTRAL))) {
        print1("You come before a blue crystal dais. You see a broken mirror.");
        print2("Look in the mirror? [yn] ");
        if (ynq2()=='y') {
            print1("A strange force rips you from your place....");
            Player.hp = 1;
            print2("You feel drained....");
            dataprint();
            print3("You find yourself in a weird flickery maze.");
            change_environment(E_ASTRAL);
        }
    }
    else {
        print1("You come before a blue crystal dais. There is a bell and a mirror.");
        print2("Ring the bell [b], look in the mirror [m], or leave [ESCAPE] ");
        do response = (char) mcigetc();
        while ((response != 'b') && (response != 'm') && (response != ESCAPE));
        if (response == 'b') {
            print1("The ringing note seems to last forever.");
            print2("You notice a robed figure in front of you....");
            morewait();
            print1("The oracle doffs her cowl. Her eyes glitter with blue fire!");
            print2("Attack her? [yn] ");
            if (ynq2() == 'y') {
                setgamestatus(ATTACKED_ORACLE);
                print1("The oracle deftly avoids your attack.");
                print2("She sneers at you and vanishes.");
            }
            else {
                print2("She stares at you...and speaks:");
                if (!gamestatusp(SPOKE_TO_DRUID)) {
                    print3("'The ArchDruid speaks wisdom in his forest shrine.'");
                }
                else if (!gamestatusp(COMPLETED_CAVES)) {
                    print3("'Thou mayest find aught of interest in the caves to the South.'");
                }
                else if (!gamestatusp(COMPLETED_SEWERS)) {
                    print3("'Turn thy attention to the abyssal depths of the city.'");
                }
                else if (!gamestatusp(COMPLETED_CASTLE)) {
                    print3("'Explorest thou the depths of the Castle of the ArchMage.'");
                }
                else if (!gamestatusp(COMPLETED_ASTRAL)) {
                    morewait();
                    print1("'Journey to the Astral Plane and meet the Gods' servants.'");
                    print2("The oracle holds out her hand. Do you take it? [yn] ");
                    if (ynq2()=='y') {
                        print1("'Beware: Only the Star Gem can escape the Astral Plane.'");
                        print2("A magic portal opens behind the oracle. She leads you");
                        morewait();
                        print1("through a sequence of special effects that would have");
                        print2("IL&M technicians cursing in awe and deposits you in an");
                        morewait();
                        clearmsg();
                        print1("odd looking room whose walls seem strangely insubstantial.");
                        gain_experience(5000);
                        change_environment(E_ASTRAL);
                    }
                    else print3("You detect the hint of a sneer from the oracle.");
                }
                else if (!gamestatusp(COMPLETED_VOLCANO)) {
                    print3("'The infernal maw may yield its secrets to thee now.'");
                }
                else if (!gamestatusp(COMPLETED_CHALLENGE)) {
                    print3("'The challenge of adepthood yet awaits thee.'");
                }
                else {
                    morewait();
                    print1("'My lord: Thou hast surpassed my tutelage forever.");
                    print2("Fare thee well.'");
                    print3("The oracle replaces her hood and seems to fade away....");
                }
            }
        }
        else if (response == 'm') {
            print1("You seem to see yourself. Odd....");
            knowledge(1);
        }
        else print2("You leave this immanent place.");
    }
}
Пример #26
0
void l_magic_pool(void)
{
  int possibilities=random_range(100);
  print1("This pool seems to be enchanted....");
  if (gamestatusp(MOUNTED)) {
    if (random_range(2)) {
      print2("Your horse is polymorphed into a fig newton.");
      resetgamestatus(MOUNTED);
    }
    else print2("Whatever it was, your horse enjoyed it....");
  }
  else  if (possibilities == 0) {
    print1("Oh no! You encounter the DREADED AQUAE MORTIS...");
    if (random_range(1000) < Player.level*Player.level*Player.level) {
      print2("The DREADED AQUAE MORTIS throttles you within inches....");
      print3("but for some reason chooses to let you escape.");
      gain_experience(500);
      Player.hp = 1;
    }
    else p_death("the DREADED AQUAE MORTIS!");
  }
  else if (possibilities < 25)
    augment(0);
  else if (possibilities < 30)
    augment(1);
  else if (possibilities < 60)
    augment(-1);
  else if (possibilities < 65)
    cleanse(1);
  else if (possibilities < 80) {
    if (Player.possessions[O_WEAPON_HAND] != NULL) {
      print1("You drop your weapon in the pool! It's gone forever!");
      dispose_lost_objects(1,Player.possessions[O_WEAPON_HAND]);
    }
    else print1("You feel fortunate.");
  }
  else if (possibilities < 90) {
    if (Player.possessions[O_WEAPON_HAND] != NULL) {
      print1("Your weapon leaves the pool with a new edge....");
      Player.possessions[O_WEAPON_HAND]->plus += random_range(10)+1;
      calc_melee();
    }
    else print1("You feel unfortunate.");
  }
  else if (possibilities < 95) {
    Player.hp += 10;
    print1("You feel healthier after the dip...");
  }
  else if (possibilities < 99) {
    print1("Oooh, a tainted pool...");
    p_poison(10);
  }
  else if (possibilities == 99) {
    print1("Wow! A pool of azoth!");
    heal(10);
    cleanse(1);
    Player.mana = calcmana()*3;
    Player.str = (Player.maxstr++)*3;
  }
  print2("The pool seems to have dried up.");
  Level->site[Player.x][Player.y].locchar = TRAP;
  Level->site[Player.x][Player.y].p_locf = L_TRAP_PIT;
  lset(Player.x, Player.y, CHANGED);
}
Пример #27
0
short dump_basic( FILE *dumpfile )
{
  int curcol;
  long total_balance;
  char *cp;
  bank_account *account;
	
  /* reset "checksum" */
  dumpcheck = 0;

  strcpy( dump_buf, "[*] " );
  strcat( dump_buf, VERSIONSTRING );
  strcat( dump_buf, " character dump [*]\n\n" );
  if ( !dump( dumpfile, dump_buf, FALSE ) )
    return FALSE;
		
  curcol = sprintf( dump_buf, "Name      : %s\n", Player.name );
  if ( gamestatusp( CHEATED ) )
    {
      if ( 72 > strlen( dump_buf ) )
        cp = strrchr( dump_buf, '\n' );
      else
        cp = &(dump_buf[ 70 ]);
      strcpy( cp, " (WIZARD)\n" );
    }
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  sprintf( dump_buf, "Level     : %s [%d]\n", levelname( Player.level ), Player.level );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  sprintf( dump_buf, "Alignment : %s\n\n", alignment_string( Player.alignment ) );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
	
  /*
    sprintf( dump_buf, "Str : %5d [%d]%n%*sHP       : %5d [%d]%n%*sHit     : %d\n",
    Player.str, Player.maxstr, &curcol, 26 - curcol, spaces,
    Player.hp,  Player.maxhp,  &curcol, 57 - curcol, spaces,
    Player.hit );
    if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
  */
		
  curcol = sprintf( dump_buf, "Str : %5d [%d]", Player.str, Player.maxstr );
  cp = strrchr( dump_buf, '\0' );
  for ( ; curcol < 26; curcol++ )
    *cp++ = ' ';
  curcol += sprintf( cp, "HP       : %5d [%d]", Player.hp,  Player.maxhp );
  cp = strrchr( dump_buf, '\0' );
  for ( ; curcol < 57; curcol++ )
    *cp++ = ' ';
  sprintf( cp, "Hit     : %d\n", Player.hit );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  curcol = sprintf( dump_buf, "Con : %5d [%d]", Player.con, Player.maxcon );
  cp = strrchr( dump_buf, '\0' );
  for ( ; curcol < 26; curcol++ )
    *cp++ = ' ';
  curcol += sprintf( cp, "Mana     : %5ld [%ld]", Player.mana,  Player.maxmana );
  cp = strrchr( dump_buf, '\0' );
  for ( ; curcol < 57; curcol++ )
    *cp++ = ' ';
  sprintf( cp, "Damage  : %d\n", Player.dmg );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  curcol = sprintf( dump_buf, "Dex : %5d [%d]", Player.dex, Player.maxdex );
  cp = strrchr( dump_buf, '\0' );
  for ( ; curcol < 57; curcol++ )
    *cp++ = ' ';
  sprintf( cp, "Defense : %d\n", Player.defense );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  curcol = sprintf( dump_buf, "Agi : %5d [%d]", Player.agi, Player.maxagi );
  cp = strrchr( dump_buf, '\0' );
  for ( ; curcol < 26; curcol++ )
    *cp++ = ' ';
  sprintf( cp, "Exp      : %-10ld          Armor   : %d\n", Player.xp,  Player.absorption );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  curcol = sprintf( dump_buf, "Int : %5d [%d]", Player.iq, Player.maxiq );
  cp = strrchr( dump_buf, '\0' );
  for ( ; curcol < 26; curcol++ )
    *cp++ = ' ';
  sprintf( cp, "Carry    : %-10d          Speed   : %d.%d\n",
           Player.itemweight, 5 / Player.speed, 500 / Player.speed % 100 );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  curcol = sprintf( dump_buf, "Pow : %5d [%d]", Player.pow, Player.maxpow );
  cp = strrchr( dump_buf, '\0' );
  for ( ; curcol < 26; curcol++ )
    *cp++ = ' ';
  sprintf( cp, "Capacity : %d\n\n", Player.maxweight );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  total_balance = 0;
  for( account = bank; account; account = account->next_account )
    {
      if ( account->player )
        total_balance += account->balance;
    }
		
  sprintf( dump_buf, "Cash (carried/bank) : %ld / %ld\n", Player.cash, total_balance );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  sprintf( dump_buf, "Current Point Total : %ld\n", calc_points() );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  sprintf( dump_buf, "Elapsed Game Time   : %s\n\n", elapsed_time_string( Time ) );
  if ( !dump( dumpfile, dump_buf, TRUE ) )
    return FALSE;
		
  sprintf( dump_buf, "[Verification: %8.8lx]\n\n", dumpcheck );
  if ( !dump( dumpfile, dump_buf, FALSE ) )
    return FALSE;
		
  return TRUE;
}
Пример #28
0
/* gain for an item */
void acquire(int blessing)
{
    char otype;
    int index,id = ABORT;
    pob newthing;

    if (blessing < 0) {
        index = random_item();
        if (index == ABORT)
            mprint("You feel fortunate.");
        else {
            print1("Smoke drifts out of your pack.... ");
            print2("Destroyed: ");
            nprint2(itemid(Player.possessions[index]));
            morewait();
            dispose_lost_objects(1,Player.possessions[index]);
        }
    }
    else {
        newthing = ((pob) checkmalloc(sizeof(objtype)));
        /* DAG this assignment looks unneccessary */
        newthing->id = -1;
        if (gamestatusp(CHEATED))
            print1("Acquire which kind of item: !?][}{)/=%%\\& ");
        else
            print1("Acquire which kind of item: !?][}{)/=%%\\ ");
        otype = mgetc();
        switch (otype) {
        case (POTION&0xff):
            if (blessing > 0)
                id = itemlist(POTIONID,NUMPOTIONS);
            else
                id = random_range(NUMPOTIONS);
            if (id < 0) print2("You feel stupid.");
            else make_potion(newthing,id);
            break;
        case (SCROLL&0xff):
            if (blessing > 0)
                id = itemlist(SCROLLID,NUMSCROLLS);
            else
                id = random_range(NUMSCROLLS);
            if (id < 0) print2("You feel stupid.");
            else make_scroll(newthing,id);
            break;
        case (RING&0xff):
            if (blessing > 0)
                id = itemlist(RINGID,NUMRINGS);
            else
                id = random_range(NUMRINGS);
            if (id < 0) print2("You feel stupid.");
            else make_ring(newthing,id);
            break;
        case (STICK&0xff):
            if (blessing > 0)
                id = itemlist(STICKID,NUMSTICKS);
            else
                id = random_range(NUMSTICKS);
            if (id < 0) print2("You feel stupid.");
            else make_stick(newthing,id);
            break;
        case (ARMOR&0xff):
            if (blessing > 0)
                id = itemlist(ARMORID,NUMARMOR);
            else
                id = random_range(NUMARMOR);
            if (id < 0) print2("You feel stupid.");
            else make_armor(newthing,id);
            break;
        case (SHIELD&0xff):
            if (blessing > 0)
                id = itemlist(SHIELDID,NUMSHIELDS);
            else
                id = random_range(NUMSHIELDS);
            if (id < 0) print2("You feel stupid.");
            else make_shield(newthing,id);
            break;
        case (WEAPON&0xff):
            if (blessing > 0)
                id = itemlist(WEAPONID,NUMWEAPONS);
            else
                id = random_range(NUMWEAPONS);
            if (id < 0) print2("You feel stupid.");
            else make_weapon(newthing,id);
            break;
        case (BOOTS&0xff):
            if (blessing > 0)
                id = itemlist(BOOTID,NUMBOOTS);
            else
                id = random_range(NUMBOOTS);
            if (id < 0) print2("You feel stupid.");
            else make_boots(newthing,id);
            break;
        case (CLOAK&0xff):
            if (blessing > 0)
                id = itemlist(CLOAKID,NUMCLOAKS);
            else
                id = random_range(NUMCLOAKS);
            if (id < 0) print2("You feel stupid.");
            else make_cloak(newthing,id);
            break;
        case (FOOD&0xff):
            if (blessing > 0)
                id = itemlist(FOODID,NUMFOODS);
            else
                id = random_range(NUMFOODS);
            if (id < 0) print2("You feel stupid.");
            else make_food(newthing,id);
            break;
        case (THING&0xff):
            if (blessing > 0)
                id = itemlist(THINGID,NUMTHINGS);
            else
                id = random_range(NUMTHINGS);
            if (id < 0) print2("You feel stupid.");
            else make_thing(newthing,id);
            break;
        case (ARTIFACT&0xff):
            if (gamestatusp(CHEATED))
                id = itemlist(ARTIFACTID,NUMARTIFACTS);
            else
                id = -1;
            if (id < 0) print2("You feel stupid.");
            else make_artifact(newthing,id);
            break;
        default:
            print2("You feel stupid.");
        }
        xredraw();
        if (id != ABORT) {
            if (blessing > 0) {
                newthing->known = 2;
                Objects[id].known = 1;
            }
            newthing->used = FALSE;
            gain_item(newthing);
        }
        else
        {
            /* DAG newthing allocated but was not freed... was YA memory leak */
            /* use free() rather than free_obj() since newthing not initialized */
            free( (char *) newthing );
        }
    }
}
Пример #29
0
void m_death(struct monster *m)
{
    pob corpse;
    pml ml;
    int x;
    int y;
    int found = FALSE;
    m->hp = -1;

    if(los_p(Player.x, Player.y, m->x, m->y)) {
        putspot(m->x, m->y, getspot(m->x, m->y, FALSE));
        gain_experience(m->xpv);
        calc_melee();

        if(m->uniqueness != COMMON) {
            strcpy(Str1, m->monstring);
        }
        else {
            strcpy(Str1, "The ");
            strcat(Str1, m->monstring);
        }

        strcat(Str1, " is dead!");
        mprint(Str1);
    }

    m_dropstuff(m);

    /* Death */
    if(m->id == (ML10 + 0)) {
        mprint("Death lies sprawled out on the ground...");
        mprint("Death laughs ironically and gets back to his feet.");
        mprint("He gestures and another scythe appears in his hands.");

        switch(random_range(10)) {
        case 0:
            mprint("Death performs a little bow and goes back on guard.");

            break;
        case 1:
            mprint("\'A hit! A palpable hit!\' Death goes back on the attack.");

            break;
        case 2:
            mprint("\'Ah, if only it could be so simple!\' snickers Death.");

            break;
        case 3:
            mprint("\'This fool things he can slay death! What a jest!\' says Death.");

            break;
        case 4:
            mprint("\'You point is well taken.\' says Death, attacking again.");

            break;
        case 5:
            mprint("\'Oh, come now, stop delaying the inevitable.\' says Death.");

            break;
        case 6:
            mprint("\'Your destiny ends here with me.\' says Death, scythe raised.");

            break;
        case 7:
            mprint("\'I almost felt that.\' says Death, smiling.");

            break;
        case 8:
            mprint("\'Timeo Mortis?\' asks Death quizzically, \'Not me!\'");

            break;
        case 9:
            mprint("Death sighs theatrically. \'They never learn.\'");

            break;
        }

        strengthen_death(m);
    }
    else {
        Level->site[m->x][m->y].creature = NULL;

        if(random_range(2) || (m->uniqueness != COMMON)) {
            corpse = (pob)malloc(sizeof(objtype));
            make_corpse(corpse, m);
            drop_at(m->x, m->y, corpse);
        }

        plotspot(m->x, m->y, FALSE);

        switch(m->id) {
        case ML0 + 8: /* Hiscore NPC */
            switch(m->aux2) {
            case 0:
                mprint("You hear a faroff dirge. You feel a sense of triumph.");

                break;
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
                mprint("You hear a faroff sound like angels crying...");
                strcpy(Priest[1], nameprint());
                Priestbehavior[1] = 2933;

                break;
            case 7:
                mprint("A furtive figure dashes out of the shadows, takes a look at");
                mprint("the corpse, and runs away!");
                strcpy(Shadowlord, nameprint());
                Shadowlordbehavior = 2912;

                break;
            case 8:
                mprint("An aide-de-camp approaches, removes the corpse's insignia,");
                mprint("and departs.");
                strcpy(Commandant, nameprint());
                Commandantbehavior = 2912;

                break;
            case 9:
                mprint("An odd glow surrounds the corpse, and slowly fades.");
                strcpy(Archmage, nameprint());
                Archmagebehavior = 2933;

                break;
            case 10:
                mprint("A demon materializes, takes a quick look at the corpse,");
                mprint("and teleports away with a faint popping noise.");
                strcpy(Prime, nameprint());
                Primebehavior = 2932;

                break;
            case 11:
                mprint("A sports columnist rushes forward and takes a quick photo");
                mprint("of the corpse and rushes off muttering about a deadline.");
                strcpy(Champion, nameprint());
                Championbehavior = 2913;

                break;
            case 12:
                mprint("You hear a fanfare in the distance, and feel dismayed.");
                strcpy(Duke, nameprint());
                Dukebehavior = 2911;

                break;
            case 13:
                if(Player.alignment > 10) {
                    mprint("You feel smug.");
                }
                else if(Player.alignment < 10) {
                    mprint("You feel ashamed.");
                }

                strcpy(Chaoslord, nameprint());
                Chaoslordbehavior = 2912;

                break;
            case 14:
                if(Player.alignment < 10) {
                    mprint("You feel smug.");
                }
                else if(Player.alignment > 10) {
                    mprint("You feel ashamed.");
                }

                strcpy(Lawlord, nameprint());
                Lawlordbehavior = 2911;

                break;
            case 15:
                /*
                 * Just a tad complicated. Promote a new justiciar if
                 * an guards are left in the city, otherwise destroy
                 * the Order!
                 */
                Player.alignment -= 100;

                if(!gamestatusp(DESTROYED_ORDER)) {
                    mprint("In the distance you hear a trumpet. A Servent of Law");
                    mprint("materializes, sheds a tear, and leaves.");
                    strcpy(Justiciar, nameprint());
                    Justiciarbehavior = 2911;

                    /* Promote one of the city guards to be justiciar */
                    ml = City->mlist;

                    while(!found && (ml != NULL)) {
                        if((ml->m->id == (ML0 + 3)) && (ml->m->hp > 0)) {
                            found = 1;
                        }
                        else {
                            found = 0;
                        }

                        if(!found) {
                            ml = ml->next;
                        }
                    }

                    if(ml != NULL) {
                        mprint("A new justiciar has been promoted!");
                        x = ml->m->x;
                        y = ml->m->y;
                        ml->m->x = x;
                        ml->m->y = y;
                        ml->m->click = (Tick + 1) % 60;
                        m_status_reset(ml->m, AWAKE);
                        m_status_reset(ml->m, HOSTILE);
                    }

                    /* 
                     * Will cause order to be destroyed if no guards or justiciar
                     */
                    alert_guards();
                }
                else {
                    mprint("A Servant of Chaos materializes, grabs the corpse,");
                    mprint("snickers a bit, and vanishes.");
                }
            }
            
            break;
        case ML0 + 3: /* Guard */
            Player.alignment -= 10;
            
            if((Current_Environment == E_CITY)
               || (Current_Environment == E_VILLAGE)) {
                alert_guards();
            }
            
            break;
        case ML3 + 5: /* Goblin king */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("You seem to hear a woman's voice from far off:");
                mprint("\'Well don! Come to me now...\'");
            }
            
            setgamestatus(COMPLETED_CAVES);
            
            break;
        case ML7 + 5: /* Great worm */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("A female voice sounds from just behind your ear:");
                mprint("\'Well fought! I have some new advice for you...\'");
            }
            
            setgamestatus(COMPLETED_SEWERS);
            
            break;
        case ML10 + 1:
            setgamestatus(KILLED_EATER);
            
            break;
        case ML10 + 2:
            setgamestatus(KILLED_LAWBRINGER);
            
            break;
        case ML10 + 3:
            setgamestatus(KILLED_DRAGONLORD);
            
            break;
        case ML10 + 4:
            setgamestatus(COMPLETED_VOLCANO);
            
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("You feel a soft touch on your shoulder...");
                mprint("You turn around but there is no one there!");
                mprint("You turn back and see a not: \'See me soon.\'");
                mprint("The note vanishes in a burst of blue fire!");
            }
            
            break;
        case ML10 + 9: /* Elemental master */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("Words appear before you, traced in blue flame!");
                mprint("\'Return to the Prime Plane via the Circle of Sorcerors...");
            }
            
            break;
        }
    }
    
    dodrawspot(m->x, m->y);
}
Пример #30
0
void l_condo(void)
{
    pol ol,prev=NULL;
    int i,done=FALSE,over=FALSE,weeksleep=FALSE;
    char response;

    if (! gamestatusp(SOLD_CONDO)) {
        response = cinema_interact
                   ("rp","Rampart Arms. Weekly Condo Rentals and Purchases",
                    "Which are you interested in [r,p, or ESCAPE] ",
                    NULL);
        if (response == 'p') {
            print2("Only 50,000Au. Buy it? [yn] ");
            if (ynq2()=='y') {
                if (Player.cash < 50000)
                    print3("No mortgages, buddy.");
                else {
                    setgamestatus(SOLD_CONDO);
                    Player.cash-=50000;
                    dataprint();
                    print2("You are the proud owner of a luxurious condo penthouse.");
                    Condoitems = NULL;
                }
            }
        }
        else if (response == 'r') {
            print2("Weekly Rental, 1000Au. Pay for it? [yn] ");
            if (ynq2()=='y') {
                if (Player.cash < 1000)
                    print2("Hey, pay the rent or out you go....");
                else {
                    weeksleep = TRUE;
                    Player.cash -=1000;
                    dataprint();
                }
            }
        }
        else print2("Please keep us in mind for your housing needs.");
    }
    else {
        while (! done) {
            menuclear();
            menuprint("Home Sweet Home\n");
            menuprint("a: Leave items in your safe.\n");
            menuprint("b: Retrieve items.\n");
            menuprint("c: Take a week off to rest.\n");
            menuprint("d: Retire permanently.\n");
            menuprint("ESCAPE: Leave this place.\n");
            showmenu();
            response = (char) mcigetc();
            if (response == 'a') {
                i = getitem(NULL_ITEM);
                if (i != ABORT) {
                    if (Player.possessions[i]->blessing < 0)
                        print2("The item just doesn't want to be stored away...");
                    else {
                        ol = ((pol) checkmalloc(sizeof(oltype)));
                        ol->thing = Player.possessions[i];
                        ol->next = Condoitems;
                        Condoitems = ol;
                        conform_unused_object(Player.possessions[i]);
                        Player.possessions[i] = NULL;
                    }
                }
            }
            else if (response == 'b') {
                ol = Condoitems;
                while ((ol != NULL) && (! over)) {
                    print1("Retrieve ");
                    nprint1(itemid(ol->thing));
                    nprint1(" [ynq] ");
                    response = (char) mcigetc();
                    /* DAG -- fix memory leak where object list nodes weren't deleted */
                    if (response == 'y') {
                        gain_item(ol->thing);
                        if (ol == Condoitems)
                        {
                            ol = ol->next;
                            free( Condoitems );
                            Condoitems = ol;
                        }
                        else
                        {
                            ol=ol->next;
                            free( prev->next );
                            prev->next = ol;
                        }
                    }
                    else if (response == 'q')
                        over = TRUE;
                    else
                    {
                        prev = ol;
                        ol = ol->next;
                    }
                }
            }
            else if (response == 'c') {
                weeksleep = TRUE;
                print1("You take a week off to rest...");
                morewait();
            }
            else if (response == 'd') {
                clearmsg();
                if (cinema_confirm("You ponder settling down here for good.") == 'y') {
                    p_win();
                }
            }
            else if (response == ESCAPE) done = TRUE;
        }
        xredraw();
    }
    if (weeksleep) {
        clearmsg();
        print1("Taking a week off to rest...");
        morewait();
        toggle_item_use(TRUE);
        Player.hp = Player.maxhp;
        Player.str = Player.maxstr;
        Player.agi = Player.maxagi;
        Player.con = Player.maxcon;
        Player.dex = Player.maxdex;
        Player.iq = Player.maxiq;
        Player.pow = Player.maxpow;
        for (i=0; i<NUMSTATI; i++)
            if (Player.status[i]<1000) Player.status[i]=0;
        toggle_item_use(FALSE);
        Player.food = 36;
        print2("You're once again fit and ready to continue your adventure.");
        Time += 60*24*7;
        Date += 7;
        moon_check();
        timeprint();
    }
}