Beispiel #1
0
int initstats(void)
{
    char response;
    char savedg[80];
    print1("Do you want to run a character [c], load a game [l], or ");
    print2("play yourself [p]?"); /* RM 04-19-2000 loading patch */
    do
        response = (char) mcigetc();
    while ((response!='c')&&(response != 'p')&&(response !='l'));
    if (response == 'c') omegan_character_stats();
    else if (response == 'l')
    {
        /* RM 04-19-2000: loading patch - a blatant hack */
        clearmsg();
        print1("Enter saved game name: ");
        strcpy(savedg,msgscanstring());

        game_restore(savedg);
        return true;
    }
    else {
        clearmsg(); /* RM 04-19-2000 loading patch - fix the display */
        user_character_stats();
        user_intro();
        print1("Do you want to save this set-up to .omegarc in your home directory? [yn] ");
        if (ynq1()=='y')
            save_omegarc();
    }
    xredraw();
    return false;
}
Beispiel #2
0
void l_tome2(void)
{
  menuclear();
  menuprint("\nYou discover in some ancient notes that the Star Gem can be");
  menuprint("\nused for transportation, but also read a caution that it must");
  menuprint("\nbe allowed to recharge a long time between uses.");
  menuprint("\nA marginal note says 'if only it could be reset to go somewhere");
  menuprint("\nbesides Star Peak, the gem might be useful....'");
  showmenu();
  morewait();
  xredraw();
}
Beispiel #3
0
void l_tome1(void)
{
  menuclear();
  menuprint("\nYou discover in a dusty tome some interesting information....");
  menuprint("\nThe Star Gem holds a vast amount of mana, usable");
  menuprint("\nfor either Law or Chaos. It is magically linked to Star Peak");
  menuprint("\nand can either be activated or destroyed there. If destroyed,");
  menuprint("\nits power will be used for Chaos, if activated, for Law.");
  menuprint("\n\nIt is said the LawBringer has waited for an eternity");
  menuprint("\nat Star Peak for someone to bring him the gem.");
  menuprint("\nIt is also rumored that while anyone might destroy the gem,");
  menuprint("\nreleasing chaotic energy, only the LawBringer can release");
  menuprint("\nthe lawful potential of the gem.");
  showmenu();
  morewait();
  xredraw();
}
Beispiel #4
0
FILE *omegarc_check()
{
  FILE *fd;
#if defined(MSDOS) || defined(AMIGA) || defined(_WIN32)
  if ((fd = fopen("omega.rc","rb")) != NULL) {
    print2("Use omega.rc in current directory? [yn] ");
#else
  sprintf(Str1, "%s/.omegarc", getenv("HOME"));
  if ((fd = fopen(Str1,"r")) != NULL) {
    print2("Use .omegarc in home directory? [yn] ");
#endif
    if (ynq2()!='y') {
      fclose(fd);
      fd = NULL;
    }
  }
  clearmsg();
  return(fd);
}

void initstats()
{
  char response;
  print1("Do you want to run a character [c] or play yourself [p]?");
  do response = (char) mcigetc(); while ((response!='c')&&(response != 'p'));
  if (response == 'c') omegan_character_stats();
  else {
    user_character_stats();
    user_intro();
#if defined(MSDOS) || defined(AMIGA) || defined(_WIN32)
    print1("Do you want to save this set-up to omega.rc in this directory? [yn] ");
#else
    print1("Do you want to save this set-up to .omegarc in your home directory? [yn] ");
#endif
    if (ynq1()=='y')
      save_omegarc();
  }
  xredraw();
}
Beispiel #5
0
void knowledge(int blessing)
{
  if (blessing < 0)
    mprint("You feel ignorant.");
  else {
    mprint("You feel knowledgeable!");
    menuclear();
    menuprint("Current Point Total: ");
    menulongprint(calc_points());
    menuprint("\nAlignment:");
    if (Player.alignment == 0)
      menuprint("Neutral, embodying the Cosmic Balance");
    else if (abs(Player.alignment) < 10)
      menuprint("Neutral, tending toward ");
    else if (abs(Player.alignment) < 50)
      menuprint("Neutral-");
    else if (abs(Player.alignment) < 100) ;
    else if (abs(Player.alignment) < 200)
      menuprint("Servant of ");
    else if (abs(Player.alignment) < 400)
      menuprint("Master of ");
    else if (abs(Player.alignment) < 800)
      menuprint("The Essence of ");
    else menuprint("The Ultimate Avatar of ");
    if (Player.alignment < 0) menuprint("Chaos\n");
    else if (Player.alignment > 0) menuprint("Law\n");
    showmenu();
    morewait();
    menuclear();
    menuprint("Current stati:\n");
    if (Player.status[BLINDED])
      menuprint("Blinded\n");
    if (Player.status[SLOWED])
      menuprint("Slowed\n");
#ifdef DEBUG
    if (Player.status[SLOWED])
      fprintf(DG_debug_log, "Slowed is %d\n", Player.status[SLOWED] );
#endif
    if (Player.status[HASTED])
      menuprint("Hasted\n");
    if (Player.status[DISPLACED])
      menuprint("Displaced\n");
    if (Player.status[SLEPT])
      menuprint("Slept\n");
    if (Player.status[DISEASED])
      menuprint("Diseased\n");
    if (Player.status[POISONED])
      menuprint("Poisoned\n");
    if (Player.status[BREATHING])
      menuprint("Breathing\n");
    if (Player.status[INVISIBLE])
      menuprint("Invisible\n");
    if (Player.status[REGENERATING])
      menuprint("Regenerating\n");
    if (Player.status[VULNERABLE])
      menuprint("Vulnerable\n");
    if (Player.status[BERSERK])
      menuprint("Berserk\n");
    if (Player.status[IMMOBILE])
      menuprint("Immobile\n");
    if (Player.status[ALERT])
      menuprint("Alert\n");
    if (Player.status[AFRAID])
      menuprint("Afraid\n");
    if (Player.status[ACCURATE])
      menuprint("Accurate\n");
    if (Player.status[HERO])
      menuprint("Heroic\n");
    if (Player.status[LEVITATING])
      menuprint("Levitating\n");
    if (Player.status[TRUESIGHT]) /* FIXED! 12/30/98 DG */
      menuprint("Sharp\n");
    if (Player.status[SHADOWFORM])
      menuprint("Shadowy\n");
    if (Player.status[ILLUMINATION])
      menuprint("Glowing\n");
    if (Player.status[DEFLECTION])
      menuprint("Buffered\n");
    if (Player.status[RETURNING])
      menuprint("Returning\n");
    showmenu();
    morewait();
    menuclear();
    menuprint("Immunities:\n");
    if (p_immune(NORMAL_DAMAGE))
      menuprint("Normal Damage\n");
    if (p_immune(FLAME))
      menuprint("Flame\n");
    if (p_immune(ELECTRICITY))
      menuprint("Electricity\n");
    if (p_immune(COLD))
      menuprint("Cold\n");
    if (p_immune(POISON))
      menuprint("Poison\n");
    if (p_immune(ACID))
      menuprint("Acid\n");
    if (p_immune(FEAR))
      menuprint("Fear\n");
    if (p_immune(SLEEP))
      menuprint("Sleep\n");
    if (p_immune(NEGENERGY))
      menuprint("Negative Energies\n");
    if (p_immune(THEFT))
      menuprint("Theft\n");
    if (p_immune(GAZE))
      menuprint("Gaze\n");
    if (p_immune(INFECTION))
      menuprint("Infection\n");
    showmenu();
    morewait();
    menuclear();
    menuprint("Ranks:\n");
    switch(Player.rank[LEGION]) {
    case COMMANDANT:
      menuprint("Commandant of the Legion"); 
      break;
    case COLONEL:    
      menuprint("Colonel of the Legion");
      break;
    case FORCE_LEADER:
      menuprint("Force Leader of the Legion");
      break;
    case CENTURION:
      menuprint("Centurion of the Legion");
      break;
    case LEGIONAIRE:
      menuprint("Legionaire");
      break;
    }
    if (Player.rank[LEGION] > 0) {
      menuprint(" (");
      menunumprint(Player.guildxp[LEGION]);
      menuprint(" XP).\n");
    }
    switch(Player.rank[ARENA]) {
    case -1:
      menuprint("Ex-gladiator\n");
      break;
    case CHAMPION:
      menuprint("Gladiator Champion");
      break;
    case GLADIATOR:    
      menuprint("Gladiator of the Arena");
      break;
    case RETIARIUS:
      menuprint("Retiarius of the Arena");
      break;
    case BESTIARIUS:
      menuprint("Bestiarius of the Arena");
      break;
    case TRAINEE:
      menuprint("Gladiator Trainee of the Arena");
      break;
    }
    if (Player.rank[ARENA] > 0) {
      menuprint(" (Opponent ");
      menunumprint(Arena_Opponent);
      menuprint(")\n");
    }
    switch(Player.rank[COLLEGE]) {
    case ARCHMAGE:
      menuprint("Archmage of the Collegium Magii");
      break;
    case MAGE:
      menuprint("Collegium Magii: Mage");
      break;
    case PRECEPTOR:
      menuprint("Collegium Magii: Preceptor");
      break;
    case STUDENT:
      menuprint("Collegium Magii: Student");
      break;
    case NOVICE:
      menuprint("Collegium Magii: Novice");
      break;
    }
    if (Player.rank[COLLEGE] > 0) {
      menuprint(" (");
      menunumprint(Player.guildxp[COLLEGE]);
      menuprint(" XP).\n");
    }
    switch(Player.rank[NOBILITY]) {
    case DUKE:
      menuprint("Duke of Rampart");
      break;
    case LORD:
      menuprint("Peer of the Realm");
      break;
    case KNIGHT:
      menuprint("Order of the Knights of Rampart");
      break;
    case ESQUIRE:
      menuprint("Squire of Rampart");
      break;
    case COMMONER:
      menuprint("Commoner");
      break;
    default:
      menuprint("Lowly Commoner\n");
      break;
    }
    if (Player.rank[NOBILITY] > 1) {
      menuprint(" (");
      menunumprint(Player.rank[NOBILITY] - 1);
      menuprint(ordinal(Player.rank[NOBILITY] - 1));
      menuprint(" Quest Completed)\n");
    }
    else if (Player.rank[NOBILITY] == 1) {
      menuprint(" (1st Quest Undertaken)\n");
    }
    switch(Player.rank[CIRCLE]) {
    case -1:
      menuprint("Former member of the Circle.\n");
      break;
    case PRIME:
      menuprint("Prime Sorceror of the Inner Circle");
      break;
    case HIGHSORCEROR:
      menuprint("High Sorceror of the Inner Circle");
      break;
    case SORCEROR:
      menuprint("Member of the Circle of Sorcerors");
      break;
    case ENCHANTER:
      menuprint("Member of the Circle of Enchanters");
      break;
    case INITIATE:
      menuprint("Member of the Circle of Initiates");
      break;
    }
    if (Player.rank[CIRCLE] > 0) {
      menuprint(" (");
      menunumprint(Player.guildxp[CIRCLE]);
      menuprint(" XP).\n");
    }
    switch(Player.rank[ORDER]) {
    case -1:
      menuprint("Washout from the Order of Paladins\n");
      break;
    case JUSTICIAR:
      menuprint("Justiciar of the Order of Paladins");
      break;
    case PALADIN:
      menuprint("Paladin of the Order");
      break;
    case CHEVALIER:
      menuprint("Chevalier of the Order");
      break;
    case GUARDIAN:
      menuprint("Guardian of the Order");
      break;
    case GALLANT:
      menuprint("Gallant of the Order");
      break;
    }
    if (Player.rank[ORDER] > 0) {
      menuprint(" (");
      menunumprint(Player.guildxp[ORDER]);
      menuprint(" XP).\n");
    }
    switch(Player.rank[THIEVES]) {
    case SHADOWLORD:
      menuprint("Guild of Thieves: Shadowlord");
      break;
    case TMASTER:
      menuprint("Guild of Thieves: Master Thief");
      break;
    case THIEF:
      menuprint("Guild of Thieves: Thief");
      break;
    case ATHIEF:
      menuprint("Guild of Thieves: Apprentice Thief");
      break;
    case TMEMBER:
      menuprint("Guild of Thieves: Candidate Member");
      break;
    }
    if (Player.rank[THIEVES] > 0) {
      menuprint(" (");
      menunumprint(Player.guildxp[THIEVES]);
      menuprint(" XP).\n");
    }
    switch(Player.rank[PRIESTHOOD]) {
      case LAY:
        menuprint("A lay devotee of ");
	break;
      case ACOLYTE:
        menuprint("An Acolyte of ");
	break;
      case PRIEST:
        menuprint("A Priest of ");
	break;
      case SPRIEST:
        menuprint("A Senior Priest of ");
	break;
      case HIGHPRIEST:
        menuprint("The High Priest of ");
	break;
      }
    switch(Player.patron) {
      case ODIN:
        menuprint("Odin");
	break;
      case SET:
        menuprint("Set");
	break;
      case ATHENA:
        menuprint("Athena");
	break;
      case HECATE:
        menuprint("Hecate");
	break;
      case DRUID:
        menuprint("Druidism");
	break;
      case DESTINY:
        menuprint("the Lords of Destiny");
	break;
    }
    if (Player.rank[PRIESTHOOD] > 0) {
      menuprint(" (");
      menunumprint(Player.guildxp[PRIESTHOOD]);
      menuprint(" XP).\n");
    }
#ifdef INCLUDE_MONKS
    switch(Player.rank[MONKS]) {
    case MONK_GRANDMASTER:
      menuprint("Tholian Monks: Grandmaster");
      break;
    case MONK_MASTER_TEARS:
      menuprint("Tholian Monks: Master of Tears");
      break;
    case MONK_MASTER_PAINS:
      menuprint("Tholian Monks: Master of Pain");
      break;
    case MONK_MASTER_SIGHS:
      menuprint("Tholian Monks: Master of Sighs");
      break;
    case MONK_MASTER:
      menuprint("Tholian Monks: Master");
      break;
    case MONK_MONK:
      menuprint("Tholian Monks: Monk");
      break;
    case MONK_TRAINEE:
      menuprint("Tholian Monks: Trainee");
      break;
    }
    if (Player.rank[MONKS] > 0) {
      menuprint(" (");
      menunumprint(Player.guildxp[MONKS]);
      menuprint(" XP).\n");
    }
#endif
    if (Player.rank[ADEPT] > 0) 
      menuprint("**************\n*Omegan Adept*\n**************\n");
    showmenu();
    morewait();
    xredraw();
  }
}
Beispiel #6
0
void l_sorcerors(void)
{
  char action;
  int done=FALSE,fee;
  long total;
  print1("The Circle of Sorcerors.");
  if (Player.rank[CIRCLE] == -1) {
    print2("Fool! Didn't we tell you to go away?");
    Player.mana = 0;
    dataprint();
  }
  else  while (! done) {
    if ((Player.rank[CIRCLE]==HIGHSORCEROR) &&
	(Player.level > Primelevel) &&
	find_and_remove_item(CORPSEID,LAWBRINGER)) {
      print2("You obtained the Crown of the Lawgiver!");
      morewait();
      print1("The Crown is ritually sacrificed to the Lords of Chaos.");
      print2("You are now the Prime Sorceror of the Inner Circle!");
      strcpy(Prime,Player.name);
      Primelevel = Player.level;
      morewait();
      Primebehavior = fixnpc(4);
      save_hiscore_npc(10);
      clearmsg();
      print1("You learn the Spell of Disintegration!");
      morewait();
      clearmsg();
      Spells[S_DISINTEGRATE].known = TRUE;
      Player.rank[CIRCLE] = PRIME;
      Player.maxpow += 10;
      Player.pow += 10;
    }
    menuclear();
    menuprint("May we help you?\n\n");
    menuprint("a: Become an Initiate of the Circle.\n");
    menuprint("b: Raise your rank in the Circle.\n");
    menuprint("c: Restore mana points\n");
    menuprint("ESCAPE: Leave these Chambers of Power.\n");
    showmenu();
    action = mgetc();
    if (action == ESCAPE) done = TRUE;
    else if (action == 'a') {
      if (Player.rank[CIRCLE] > 0)
	  print2("You are already an initiate!");
      else if (Player.alignment > 0)
	print2("You may not join -- you reek of Law!");
      else if (Player.rank[COLLEGE] > 0)
	print2("Foolish Mage!  You don't have the right attitude to Power!");
#ifdef INCLUDE_MONKS
      else if (Player.rank[MONKS] > 0)
	print2("Stupid monk. Go Meditate on this!");
#endif
      else {
        fee = 3000;
	fee += Player.alignment*100;
	fee += fee*(12 - Player.pow)/9;
	fee = max(100,fee);
	clearmsg();
	mprint("For you, there is an initiation fee of");
	mnumprint(fee);
	mprint(" Au.");
	print2("Pay it? [yn] ");
	if (ynq2() =='y') {
	  if (Player.cash < fee) 
	    print3("Try again when you have the cash!");
	  else {
	    print1("Prime Sorceror ");
	    nprint1(Prime);
	    print2("conducts your initiation into the circle of novices.");
	    morewait();
	    clearmsg();
	    print1("You learn the Spell of Magic Missiles.");
	    Spells[S_MISSILE].known = TRUE;
	    Player.cash -= fee;
	    dataprint();
	    Player.rank[CIRCLE] = INITIATE;
	    Player.guildxp[CIRCLE] = 1;
	    Player.maxpow++;
	    Player.pow++;
	  }
	}
      }
    }
    else if (action == 'b') {
      if (Player.rank[CIRCLE] == 0)
	print2("You have not even been initiated, yet!");
      else if (Player.alignment > -1) {
	print1("Ahh! You have grown too lawful!!!");
	print2("You are hereby blackballed from the Circle!");
	Player.rank[CIRCLE] = -1;
	morewait();
	clearmsg();
	print1("A pox upon thee!");
	if (! Player.immunity[INFECTION])
	  Player.status[DISEASED]+=100;
	print2("And a curse on your possessions!");
	morewait();
	clearmsg();
	acquire(-1);
	clearmsg();
	enchant(-1);
	bless(-1);
	print3("Die, false sorceror!");
	p_damage(25,UNSTOPPABLE,"a sorceror's curse");
 	done = TRUE;
      }
      else if (Player.rank[CIRCLE]==PRIME) 
	print2("You are at the pinnacle of mastery in the Circle.");
      else if (Player.rank[CIRCLE]==HIGHSORCEROR) {
	if (Player.level <= Primelevel)
	  print2("You are not experienced enough to advance.");
	else 
	  print2("You must return with the Crown of the LawBringer!");
      }
      else if (Player.rank[CIRCLE]==SORCEROR) {
	if (Player.guildxp[CIRCLE] < 4000)
	  print2("You are not experienced enough to advance.");
	else  {
	  print1("You are now a High Sorceror of the Inner Circle!");
	  print2("You learn the Spell of Disruption!");
	  morewait();
	  clearmsg();
	  print1("To advance you must return with the LawBringer's Crown!");
	  print2("The LawBringer resides on Star Peak.");
	  Spells[S_DISRUPT].known = TRUE;
	  Player.rank[CIRCLE] = HIGHSORCEROR;
	  Player.maxpow += 5;
	  Player.pow += 5;
	}
      }
      else if (Player.rank[CIRCLE]==ENCHANTER) {
	if (Player.guildxp[CIRCLE] < 1500)
	  print2("You are not experienced enough to advance.");
	else  {
	  print1("You are now a member of the Circle of Sorcerors!");
	  print2("You learn the Spell of Ball Lightning!");
	  Spells[S_LBALL].known = TRUE;
	  Player.rank[CIRCLE] = SORCEROR;
	  Player.maxpow += 2; 
	  Player.pow+=2;
	}
      }
      else if (Player.rank[CIRCLE]==INITIATE) {
	if (Player.guildxp[CIRCLE] < 400)
	  print2("You are not experienced enough to advance.");
	else  {
	  print1("You are now a member of the Circle of Enchanters!");
	  print2("You learn the Spell of Firebolts.");
	  Spells[S_FIREBOLT].known = TRUE;
	  Player.rank[CIRCLE] = ENCHANTER;
	  Player.maxpow+=2;
	  Player.pow+=2;
	}
      }
    }
    else if (action == 'c') {
      done = TRUE;
      fee = Player.level*100;
      if (Player.rank[CIRCLE]) fee = fee / 2;
      clearmsg();
      print1("That will be: ");
      mnumprint(fee);
      nprint1("Au. Pay it? [yn] ");
      if (ynq1()=='y') {
	if (Player.cash < fee) 
	  print2("Begone, deadbeat, or face the wrath of the Circle!");
	else {
	  Player.cash -= fee;
	  total = calcmana();
	  while (Player.mana < total) {
	    Player.mana++;
	    dataprint();
	  }
	  print2("Have a sorcerous day, now!");
	}
      }
      else print2("Be seeing you!");
    }
  }
  xredraw();
}
Beispiel #7
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 );
        }
    }
}
Beispiel #8
0
void l_college(void)
{
  char action;
  int done=FALSE,enrolled = FALSE;
  print1("The Collegium Magii. Founded 16937, AOF.");
  if (nighttime())
    print2("The Registration desk is closed at night....");
  else {
    while (! done) {
      if ((Player.rank[COLLEGE]==MAGE) &&
	  (Player.level > Archmagelevel) &&
	  find_and_remove_item(CORPSEID,EATER)) {
	print1("You brought back the heart of the Eater of Magic!");
	morewait();
	print1("The Heart is sent to the labs for analysis.");
	print2("The Board of Trustees appoints you Archmage!");
	morewait();
	clearmsg();
	strcpy(Archmage,Player.name);
	Archmagelevel = Player.level;
	Player.rank[COLLEGE] = ARCHMAGE;
	Player.maxiq += 5;
	Player.iq += 5;
	Player.maxpow += 5;
	Player.pow += 5;
	morewait();
	Archmagebehavior = fixnpc(4);
	save_hiscore_npc(9);
      }
      menuclear();
      menuprint("May we help you?\n\n");
      menuprint("a: Enroll in the College.\n");
      menuprint("b: Raise your College rank.\n");
      menuprint("c: Do spell research.\n");
      menuprint("ESCAPE: Leave these hallowed halls.\n");
      showmenu();
      action = mgetc();
      if (action == ESCAPE) done = TRUE;
      else if (action == 'a') {
	if (Player.rank[COLLEGE] > 0)
	  print2("You are already enrolled!");
	else if (Player.iq < 13) 
	  print2("Your low IQ renders you incapable of being educated.");
	else if (Player.rank[CIRCLE] > 0)
	  print2("Sorcery and our Magic are rather incompatible, no?");
#ifdef INCLUDE_MONKS
	else if (Player.rank[MONKS] > 0)
	  print2("Meditation will not leave you enough time for studies.");
#endif
	else {
	  if (Player.iq > 17) {
	    print2("You are given a scholarship!");
	    morewait();
	    enrolled=TRUE;
	  }
	  else {
	    print1("Tuition is 1000Au. ");
	    nprint1("Pay it? [yn] ");
	    if (ynq1() =='y') {
	      if (Player.cash < 1000)
		print2("You don't have the funds!");
	      else {
		Player.cash -= 1000;
		enrolled = TRUE;
		dataprint();
	      }		
	    }
	  }
	  if (enrolled) {
	    print1("Archmage ");
	    nprint1(Archmage);
	    nprint1(" greets you and congratulates you on your acceptance.");
	    print2("You are now enrolled in the Collegium Magii!");
	    morewait();
	    print1("You are now a Novice.");
	    print2("You may research 1 spell, for your intro class.");
	    Spellsleft = 1;
	    Player.rank[COLLEGE] = INITIATE;
	    Player.guildxp[COLLEGE] = 1;
	    Player.maxiq += 1;
	    Player.iq += 1;
	    Player.maxpow += 1;
	    Player.pow += 1;
	  }
	}
      }
      else if (action == 'b') {
	if (Player.rank[COLLEGE] == 0)
	  print2("You have not even been initiated, yet!");
	else if (Player.rank[COLLEGE]==ARCHMAGE) 
	  print2("You are at the pinnacle of mastery in the Collegium.");
	else if (Player.rank[COLLEGE]==MAGE) {
	  if (Player.level <= Archmagelevel)
	    print2("You are not experienced enough to advance.");
	  else
	    print2("You must return with the heart of the Eater of Magic!");
	}
	else if (Player.rank[COLLEGE]==PRECEPTOR) {
	  if (Player.guildxp[COLLEGE] < 4000)
	    print2("You are not experienced enough to advance.");
	  else  {
	    print1("You are now a Mage of the Collegium Magii!");
	    print2("You may research 6 spells for postdoctoral research.");
	    Spellsleft += 6;
	    morewait();
	    print1("To become Archmage, you must return with the");
	    print2("heart of the Eater of Magic");
	    morewait();
	    clearmsg();
	    print1("The Eater may be found on a desert isle somewhere.");
	    Player.rank[COLLEGE] = MAGE;
	    Player.maxiq += 2;
	    Player.iq += 2;
	    Player.maxpow += 2;
	    Player.pow += 2;
	  }
	}
	else if (Player.rank[COLLEGE]==STUDENT) {
	  if (Player.guildxp[COLLEGE] < 1500)
	    print2("You are not experienced enough to advance.");
	  else  {
	    print1("You are now a Preceptor of the Collegium Magii!");
	    print2("You are taught the basics of ritual magic.");
	    morewait();
	    clearmsg();
	    print1("Your position allows you to research 4 spells.");
	    Spellsleft +=4;
	    Spells[S_RITUAL].known = TRUE;
	    Player.rank[COLLEGE] = PRECEPTOR;
	    Player.maxiq += 1;
	    Player.iq += 1;
	    Player.maxpow += 1;
	    Player.pow += 1;
	  }
	}
	else if (Player.rank[COLLEGE]==NOVICE) {
	  if (Player.guildxp[COLLEGE] < 400)
	    print2("You are not experienced enough to advance.");
	  else  {
	    print1("You are now a Student at the Collegium Magii!");
	    print2("You are taught the spell of identification.");
	    morewait();
	    clearmsg();
	    print1("Thesis research credit is 2 spells.");
	    Spellsleft+=2;
	    Spells[S_IDENTIFY].known = TRUE;
	    Player.rank[COLLEGE] = STUDENT;
	    Player.maxiq += 1;
	    Player.iq += 1;
	    Player.maxpow += 1;
	    Player.pow += 1;
	  }
	}
      }
      else if (action == 'c') {
	clearmsg();
	if (Spellsleft > 0) {
	  print1("Research permitted: ");
	  mnumprint(Spellsleft);
	  nprint1(" Spells.");
	  morewait();
	}
	if (Spellsleft < 1) {
	  print1("Extracurricular Lab fee: 2000 Au. ");
	  nprint1("Pay it? [yn] ");
	  if (ynq1()=='y') {
	    if (Player.cash < 2000) 
	      print1("Try again when you have the cash.");
	    else {
	      Player.cash -= 2000;
	      dataprint();
	      Spellsleft = 1;
	    }
	  }
	}
	if (Spellsleft > 0) {
	  learnspell(0);
	  Spellsleft--;
	}
      }
    }
  }
  xredraw();
}
Beispiel #9
0
void l_monastery(void)
{
  char action;
  int done=FALSE,enrolled = FALSE;
  print1("Tholian Monastery of Rampart. Founded 12031, AOF.");
  print2("Welcome to our humble hovel.");
  if (nighttime())
    print2("The monastery doors are sealed until dawn.");
  else {
    while (! done) {
      menuclear();
      menuprint("Find your True Course:\n\n");
      menuprint("a: Discover the Way.\n");
      menuprint("b: Meditate on the Path.\n");
      menuprint("c: Meditate on Knowledge.\n");
      menuprint("d: Take an extended Meditation.\n");
      menuprint("ESCAPE: Re-enter the World.\n");
      showmenu();
      action = mgetc();
      if (action == ESCAPE) {
	done = TRUE;
	calc_melee();
      }
      else if (action == 'a') {
	if (Player.rank[MONKS] > 0)
	  print2("You are already initiated, Brother.");
	else if (Player.con < 13) 
	  print2("Your body is too fragile to walk the Path, child.");
	else if (Player.pow < 13) 
	  print2("Your mind is too fragile to follow the Path, child.");
	else if (Player.rank[COLLEGE] > 0)
	  print2("The Collegium has corruputed your spirit, child.");
	else if (Player.rank[CIRCLE] > 0)
	  print2("The Circle has corruputed your spirit, child.");
	else {
	  if (Player.pow > 17) {
	    print2("Your spirit is strong. You may study the Path with us.");
	    morewait();
	    enrolled=TRUE;
	  }
	  else {
	    print1("A substantial cash sacrifice will cleanse your spirit.. ");
	    print2("Donate your worldly goods? [yn] ");
	    if (ynq1() =='y') {
	      if (Player.cash < 1000)
		{
                  /* WDT HACK! I'd rather the monks have some other
		   * criteria for joining. */
		  print2("You have not much to give.");
		}
	      else {
		Player.cash = 0;
		enrolled = TRUE;
		dataprint();
	      }		
	    }
	  }
	  if (enrolled) {
	    print1("Grandmaster ");
	    nprint1(Grandmaster);
	    nprint1(" welcomes you to the Brotherhood.");
	    print2("You are now a Tholian Monk trainee!");
	    morewait();
	    print2("You may study the Way with us.");
	    Studiesleft = 1;
	    Player.rank[MONKS] = MONK_TRAINEE;
	    Player.guildxp[MONKS] = 1;
	    Player.maxpow += 1;
	    Player.pow += 1;
	  }
	}
      }
      else if (action == 'b') {
	if (Player.rank[MONKS] == 0)
	  print2("You are not yet initiated, child.");
	else if (Player.rank[MONKS]==MONK_GRANDMASTER) 
	  print2("Your advancement lies within, Grandmaster.");
	else if (Player.rank[MONKS]==MONK_MASTER_TEARS) {
	  if (Player.level <= Grandmasterlevel)
	    print2("Seek more experience, Master.");
	  else if ((Player.rank[MONKS]==MONK_MASTER_TEARS) &&
		   (Player.level > Grandmasterlevel) &&
		   find_and_remove_item(CORPSEID,EATER))
	    {
	      print1("You brought back the heart of the Eater of Magic!");
	      morewait();
	      print1("The Heart is sent to the placed in the kitchen cauldron.");
	      print2("The Grandmaster steps down. You are the new Grandmaster.");
	      morewait();
	      clearmsg();
	      strcpy(Grandmaster,Player.name);
	      Grandmasterlevel = Player.level;
	      Player.rank[MONKS] = MONK_GRANDMASTER;
	      Player.maxhp += (Player.maxpow * 3);
	      Player.maxiq += 5;
	      Player.iq+= 5;
	      Player.maxpow += 3;
	      Player.pow += 3;
	      Player.maxstr += 3;
	      Player.str += 3;
	      morewait();
	      Grandmasterbehavior = fixnpc(4);
	      save_hiscore_npc(16);
	    }
	  else
	    print2("You must return with the heart of the Eater of Magic!");

	}
	else if (Player.rank[MONKS]==MONK_MASTER_PAINS) {
	  if (Player.guildxp[MONKS] < 40000)
	    print2("Seek more experience, Master.");
	  else  {
	    print1("You have travelled far, Master.");
	    print2("You are now Master of Tears.");
	    Studiesleft += 6;
	    morewait();
	    print1("To become Grandmaster, you must return with the");
	    print2("heart of the Eater of Magic");
	    morewait();
	    clearmsg();
	    print1("The Eater may be found on a desert isle somewhere.");
	    Spells[S_REGENERATE].known = TRUE;
	    Player.rank[MONKS] = MONK_MASTER_TEARS;
	    Player.maxhp += (Player.maxpow * 2);
	    Player.maxpow += 2;
	    Player.pow += 2;
	    Player.maxstr += 2;
	    Player.str += 2;
	    Player.maxagi += 2;
	    Player.agi += 2;
	  }
	}
	else if (Player.rank[MONKS]==MONK_MASTER_SIGHS) {
	  if (Player.guildxp[MONKS] < 15000)
	    print2("Seek more experience, Master.");
	  else  {
	    print1("The Path is long, Master.");
	    print2("You are now Master of Pain.");
	    morewait();
	    print1("You feel enlightened.");
	    morewait();
	    clearmsg();
	    Studiesleft +=4;
	    Spells[S_RITUAL].known = TRUE;
	    Spells[S_RESTORE].known = TRUE;
	    Player.status[ILLUMINATION] = 1500;  /* enlightened */
	    Player.rank[MONKS] = MONK_MASTER_PAINS;
	    Player.maxhp += Player.maxpow;
	    Player.maxcon += 1;
	    Player.con += 1;
	    Player.maxdex += 2;
	    Player.dex += 2;
	  }
	}
	else if (Player.rank[MONKS]==MONK_MASTER) {
	  if (Player.guildxp[MONKS] < 9000)
	    print2("Seek more experience, Master.");
	  else  {
	    print1("Drink, weary Master.");
	    print2("You are now Master of Sighs.");
	    morewait();
	    clearmsg();
	    Studiesleft +=2;
	    Spells[S_HASTE].known = TRUE;
	    Player.rank[MONKS] = MONK_MASTER_SIGHS;
	    Player.maxhp += Player.maxpow;
	    Player.maxcon += 1;
	    Player.con += 1;
	    Player.maxiq += 2;
	    Player.iq += 2;
	  }
	}
	else if (Player.rank[MONKS]==MONK_MONK) {
	  if (Player.guildxp[MONKS] < 3000)
	    print2("Seek more experience, Brother.");
	  else  {
	    print1("A thousand steps on the path, Brother.");
	    print2("You are now a Master.");
	    morewait();
	    clearmsg();
	    Studiesleft +=2;
	    Spells[S_HEAL].known = TRUE;
	    Player.rank[MONKS] = MONK_MASTER;
	    Player.maxhp += Player.maxpow;
	    Player.maxcon += 1;
	    Player.con += 1;
	    Player.maxpow += 2;
	    Player.pow += 5; /* [sic] */
	  }
	}
	else if (Player.rank[MONKS]==MONK_TRAINEE) {
	  if (Player.guildxp[MONKS] < 1500)
	    print2("Seek more experience, Brother.");
	  else  {
	    print1("You have sought wisdom, Brother.");
	    print2("You are now a Tholian Monk.");
	    morewait();
	    clearmsg();
	    Studiesleft +=2;
	    Spells[S_CURE].known = TRUE;
	    Player.rank[MONKS] = MONK_MONK;
	    Player.maxhp += Player.maxpow;
	    Player.maxcon += 1;
	    Player.con += 1;
	    Player.maxpow += 1;
	    Player.pow += 1; 
	  }
	}
      }
      else if (action == 'c') {
	clearmsg();
	if (Studiesleft > 0) {
	  print1("Studies permitted: ");
	  mnumprint(Studiesleft);
	  nprint1(" Studies.");
	  morewait();
	}
	if (Studiesleft < 1) {
	  print1("Sacrifice clears a cluttered heart. ");
	  nprint1("Donate your worldly cash? [yn] ");
	  if (ynq1()=='y') {
	    if (Player.cash < 2000)
	      {
		if ( Player.rank[MONKS] >= MONK_GRANDMASTER )
		  print2("You have not much to give, Grandmaster.");
		else if ( Player.rank[MONKS] >= MONK_MASTER )
		  print2("You have not much to give, Master.");
		else
		  print2("You have not much to give, Brother.");
	      }
	    else {
	      Player.cash = 0;
	      dataprint();
	      Studiesleft = 1;
	    }
	  }
	}
	if (Studiesleft > 0) {
	  learnspell(0);
	  Studiesleft--;
	}
      }
      else if (action == 'd') {
	if (Player.rank[MONKS] < MONK_MASTER) {
	  clearmsg();
	  print1("Only Masters can achieve extended meditation, child.");
	  print2(" ");
	}
	else {
	  int i = 0;
	  clearmsg();
	  print1("Seeking inner truth...");
	  morewait();
	  clearmsg();
	  morewait();
	  toggle_item_use(TRUE);
	  Player.cash = 0;
	  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 = 43;
	  print2("Your body and mind are whole.");
	  if (random_range(2) == 1) {
	    morewait();
	    print1("Extra whole!");
	    Player.maxhp += 1;
	  }
	}
	Time += 60*24*7;
	Date += 7;
	moon_check();
	timeprint();
      }

    }
  }
  xredraw();
}
Beispiel #10
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);
}
Beispiel #11
0
void l_thieves_guild(void)
{
  int fee,count,i,number,done=FALSE,dues=1000;
  char c,action;
  pob lockpick;
  print1("You have penetrated to the Lair of the Thieves' Guild.");
  if (! nighttime()) 
    print2("There aren't any thieves around in the daytime.");
  else {
    if ((Player.rank[THIEVES]==TMASTER) &&
	(Player.level > Shadowlordlevel) &&
	find_and_remove_item(OB_JUSTICIAR_BADGE,-1)) {
      print2("You nicked the Justiciar's Badge!");
      morewait();
      print1("The Badge is put in a place of honor in the Guild Hall.");
      print2("You are now the Shadowlord of the Thieves' Guild!");
      morewait();
      print1("Who says there's no honor among thieves?");
      strcpy(Shadowlord,Player.name);
      Shadowlordlevel = Player.level;
      morewait();
      Shadowlordbehavior = fixnpc(4);
      save_hiscore_npc(7);
      clearmsg();
      print1("You learn the Spell of Shadowform.");
      Spells[S_SHADOWFORM].known = TRUE;
      morewait();
      clearmsg();
      Player.rank[THIEVES]=SHADOWLORD;
      Player.maxagi += 2;
      Player.maxdex += 2;
      Player.agi += 2;
      Player.dex += 2;
    }
    while (! done) {
      menuclear();
      if (Player.rank[THIEVES] == 0)
	menuprint("a: Join the Thieves' Guild.\n");
      else
	menuprint("b: Raise your Guild rank.\n");
      menuprint("c: Get an item identified.\n");
      if (Player.rank[THIEVES] > 0)
	menuprint("d: Fence an item.\n");
      menuprint("ESCAPE: Leave this Den of Iniquity.");
      showmenu();
      action = mgetc();
      if (action == ESCAPE) done = TRUE;
      else if (action == 'a') {
	done = TRUE;
	if (Player.rank[THIEVES]> 0)
	  print2("You are already a member!");
	else if (Player.alignment > 10) 
	  print2("You are too lawful to be a thief!");
	else {
	  dues += dues*(12-Player.dex)/9;
	  dues += Player.alignment*5;
	  dues = max(100,dues);
	  clearmsg();
	  mprint("Dues are");
	  mnumprint(dues);
	  mprint(" Au. Pay it? [yn] ");
	  if (ynq1() =='y') {
	    if (Player.cash < dues) {
	      print1("You can't cheat the Thieves' Guild!");
	      print2("... but the Thieves' Guild can cheat you....");
	      Player.cash = 0;
	    }
	    else {
	      print1("Shadowlord ");
	      nprint1(Shadowlord);
	      print2("enters your name into the roll of the Guild."); 
	      morewait();
	      clearmsg();
	      print1("As a special bonus, you get a free lockpick.");
	      print2("You are taught the spell of Object Detection.");
	      morewait();
	      Spells[S_OBJ_DET].known = TRUE; 
	      lockpick = ((pob) checkmalloc(sizeof(objtype)));
	      *lockpick = Objects[OB_LOCK_PICK]; /* lock pick */
	      gain_item(lockpick);
	      Player.cash -= dues;
	      dataprint();
	      Player.guildxp[THIEVES]=1;
	      Player.rank[THIEVES]=TMEMBER;
	      Player.maxdex++;Player.dex++;Player.agi++;Player.maxagi++;
	    }
	  }
	}
      }
      else if (action == 'b') {
	if (Player.rank[THIEVES]==0)
	  print2("You are not even a member!");
	else if (Player.rank[THIEVES]==SHADOWLORD) 
	  print2("You can't get any higher than this!");
	else if (Player.rank[THIEVES]==TMASTER) {
	  if (Player.level <= Shadowlordlevel)
	    print2("You are not experienced enough to advance.");
	  else print2("You must bring back the Justiciar's Badge!");
	}
	else if (Player.rank[THIEVES]==THIEF) {
	  if (Player.guildxp[THIEVES] < 4000)
	    print2("You are not experienced enough to advance.");
	  else  {
	    print1("You are now a Master Thief of the Guild!");
	    print2("You are taught the Spell of Apportation.");
	    morewait();
	    print1("To advance to the next level you must return with");
	    print2("the badge of the Justiciar (cursed be his name).");
	    morewait();
	    clearmsg();
	    print1("The Justiciar's office is just south of the gaol.");
	    Spells[S_APPORT].known = TRUE;
	    Player.rank[THIEVES]=TMASTER;
	    Player.maxagi++;
	    Player.maxdex++;
	    Player.agi++;
	    Player.dex++;
	  }
	}
	else if (Player.rank[THIEVES]==ATHIEF) {	
	  if (Player.guildxp[THIEVES] < 1500)
	    print2("You are not experienced enough to advance.");
	  else  {
	    print1("You are now a ranking Thief of the Guild!");
	    print2("You learn the Spell of Invisibility.");
	    Spells[S_INVISIBLE].known = TRUE;
	    Player.rank[THIEVES]=THIEF;
	    Player.agi++;
	    Player.maxagi++;
	  }
	}
	else if (Player.rank[THIEVES]==TMEMBER) {
	  if (Player.guildxp[THIEVES] < 400)
	    print2("You are not experienced enough to advance.");
	  else {
	    print1("You are now an Apprentice Thief!");
	    print2("You are taught the Spell of Levitation.");
	    Spells[S_LEVITATE].known = TRUE;
	    Player.rank[THIEVES]=ATHIEF;
	    Player.dex++;
	    Player.maxdex++;
	  }
	}
      }
      else if (action == 'c') {
	if (Player.rank[THIEVES]==0) {
	  print1("RTG, Inc, Appraisers. Identification Fee: 50Au/item.");
	  fee = 50;
	}
	else {
	  fee = 5;
	  print1("The fee is 5Au per item.");
	}
	print2("Identify one item, or all possessions? [ip] ");
	if ((char) mcigetc()=='i') {
	  if (Player.cash < fee)
	    print2("Try again when you have the cash.");
	  else {
	    Player.cash -= fee;
	    dataprint();
	    identify(0);
	  }
	}
	else {
	  count = 0;
	  for(i=1;i<MAXITEMS;i++)
	    if (Player.possessions[i] != NULL)
	      if (Player.possessions[i]->known < 2)
		count++;
	  for(i=0;i<Player.packptr;i++)
	    if (Player.pack[i] != NULL)
	      if (Player.pack[i]->known < 2)
		count++;
	  clearmsg();
	  print1("The fee will be: ");
	  mnumprint(max(count*fee,fee));
	  nprint1("Au. Pay it? [yn] ");
	  if (ynq1()=='y')
	  {
	    if (Player.cash < max(count*fee,fee))
	      print2("Try again when you have the cash.");
	    else {
	      Player.cash -= max(count*fee,fee);
	      dataprint();
	      identify(1);
	    }
	  }
	}
      }
      else if (action == 'd') {
	if (Player.rank[THIEVES]==0)
	  print2("Fence? Who said anything about a fence?");
	else {
	  print1("Fence one item or go through pack? [ip] ");
	  if ((char) mcigetc()=='i') {
	    i = getitem(NULL_ITEM);
	    if ((i==ABORT) || (Player.possessions[i] == NULL))
	      print2("Huh, Is this some kind of set-up?");
	    else if (Player.possessions[i]->blessing < 0) 
	      print2("I don't want to buy a cursed item!");
	    else {
	      clearmsg();
	      print1("I'll give you ");
	      mlongprint(2 * item_value(Player.possessions[i]) / 3);
	      nprint1("Au each. OK? [yn] ");
	      if (ynq1() == 'y') {
		number = getnumber(Player.possessions[i]->number);
		if ((number >= Player.possessions[i]->number) &&
		    Player.possessions[i]->used) {
		  Player.possessions[i]->used = FALSE;
		  item_use(Player.possessions[i]);
		}
		Player.cash += number*2*item_value(Player.possessions[i])/3;
		/* Fenced artifacts could turn up anywhere, really... */
		if (Objects[Player.possessions[i]->id].uniqueness >
		    UNIQUE_UNMADE)
		  Objects[Player.possessions[i]->id].uniqueness = UNIQUE_UNMADE;
		dispose_lost_objects(number,Player.possessions[i]);
		dataprint();
	      }
	      else print2("Hey, gimme a break, it was a fair price!");
	    }
	  }
	  else {
	    for(i=0;i<Player.packptr;i++) {
	      if (Player.pack[i]->blessing > -1) {
		clearmsg();
		print1("Sell ");
		nprint1(itemid(Player.pack[i]));
		nprint1(" for ");
		mlongprint(2*item_value(Player.pack[i])/3);
		nprint1("Au each? [ynq] ");
		if ((c=ynq1())=='y') {
		  number = getnumber(Player.pack[i]->number);
		  Player.cash += 2*number * item_value(Player.pack[i]) / 3;
		  Player.pack[i]->number -= number;
		  if (Player.pack[i]->number < 1) {
                    /* Fenced an artifact?  You just might see it again. */
 		    if (Objects[Player.pack[i]->id].uniqueness > UNIQUE_UNMADE)
 		      Objects[Player.pack[i]->id].uniqueness = UNIQUE_UNMADE;
		    free((char *)Player.pack[i]);
		    Player.pack[i] = NULL;
		  }
		  dataprint();
		}
		else if (c=='q') break;
	      }
	    }
	    fixpack();
	  }
	}
      }
    }
  }
  xredraw();
}
Beispiel #12
0
/*  npcbehavior digits 1234

4 : alignment (LAWFUL,CHAOTIC, or NEUTRAL)
3 : primary combat action (melee,missile,spell,thief,flight,1..5)
2 : competence at 4 (0..9, 0 = incompetent, 9 = masterful)
1 : conversation mode

status : 1 = dead, 2 = saved, 3 = retired, 4 = still playing
*/
int fixnpc(int status)
{
    int npcbehavior=0;
    char response;
    if (status == 1) { /* player is dead, all undead are chaotic */
        npcbehavior+=CHAOTIC;
        npcbehavior+=10; /* melee */
        npcbehavior+=100*min(9,((int) (Player.level/3)));
        npcbehavior+=1000; /* threaten */
    }
    else if (Behavior >= 0)
        npcbehavior = Behavior;
    else {
        menuclear();
        menuprint("NPC Behavior Determination Module\n\n");
        menuprint("Your overall NPC behavior is:");
        if (Player.alignment < -10) {
            npcbehavior += CHAOTIC;
            menuprint("\n\n CHAOTIC");
        }
        else if (Player.alignment > 10) {
            npcbehavior += LAWFUL;
            menuprint("\n\n LAWFUL");
        }
        else {
            npcbehavior += NEUTRAL;
            menuprint("\n\n NEUTRAL");
        }
        menuprint("\n\n1: hand-to-hand combat");
        menuprint("\n2: missile combat");
        menuprint("\n3: spellcasting");
        menuprint("\n4: thieving");
        menuprint("\n5: escape");
        menuprint("\n\nEnter NPC response to combat: ");
        showmenu();
        response = '0';
        while ((response != '1') &&
                (response != '2') &&
                (response != '3') &&
                (response != '4') &&
                (response != '5'))
            response = menugetc();
        menuaddch(response);
        npcbehavior+=10*(response - '0');
        npcbehavior+=100*competence_check(response-'0');
        response = '0';
        menuclear();
        menuprint("1: threaten");
        menuprint("\n2: greet");
        menuprint("\n3: aid");
        menuprint("\n4: beg");
        menuprint("\n5: silence");
        menuprint("\n\nEnter NPC response to conversation: ");
        showmenu();
        while ((response != '1') &&
                (response != '2') &&
                (response != '3') &&
                (response != '4') &&
                (response != '5'))
            response = menugetc();
        menuaddch(response);
        npcbehavior+=1000*(response - '0');
        xredraw();
    }
    Behavior = npcbehavior;
    return(npcbehavior);
}
Beispiel #13
0
void l_tourist(void)
{
    print1("Greetings and welcome to Rampart.");
    print2("Would you like the tourist guide to the city? [yn]");
    if( ynq2() == 'y' )
    {
        menuclear();
        menuprint("You now know how to find:\n\n");
        if (! CitySiteList[L_ARMORER-CITYSITEBASE][0])
            menuprint("Julie's Armor of Proof and Weapons of Quality\n");
        CitySiteList[L_ARMORER-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_CLUB-CITYSITEBASE][0])
            menuprint("Rampart Explorers' Club\n");
        CitySiteList[L_CLUB-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_GYM-CITYSITEBASE][0])
            menuprint("The Rampart Gymnasium\n");
        CitySiteList[L_GYM-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_HEALER-CITYSITEBASE][0])
            menuprint("Rampart Healers\n");
        CitySiteList[L_HEALER-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_CASINO-CITYSITEBASE][0])
            menuprint("Rampart Mithril Nugget Casino\n");
        CitySiteList[L_CASINO-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_DINER-CITYSITEBASE][0])
            menuprint("The Rampart Diner\n");
        CitySiteList[L_DINER-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_CRAP-CITYSITEBASE][0])
            menuprint("Les Crapeuleaux, fine dining\n");
        CitySiteList[L_CRAP-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_COMMANDANT-CITYSITEBASE][0])
            menuprint("Commandant Sonder's Rampart-fried Lyzzard partes\n");
        CitySiteList[L_COMMANDANT-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_TAVERN-CITYSITEBASE][0])
            menuprint("The Centaur and Nymph tavern\n");
        CitySiteList[L_TAVERN-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_ALCHEMIST-CITYSITEBASE][0])
            menuprint("Ambrosias' Potions et cie\n");
        CitySiteList[L_ALCHEMIST-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_DPW-CITYSITEBASE][0])
            menuprint("Rampart Department of Public Works\n");
        CitySiteList[L_DPW-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_LIBRARY-CITYSITEBASE][0])
            menuprint("Rampart Public Library\n");
        CitySiteList[L_LIBRARY-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_PAWN_SHOP-CITYSITEBASE][0])
            menuprint("Knight's Pawn Shop\n");
        CitySiteList[L_PAWN_SHOP-CITYSITEBASE][0] = TRUE;

        if (! CitySiteList[L_CONDO-CITYSITEBASE][0])
            menuprint("Luxury Condominiums\n");
        CitySiteList[L_CONDO-CITYSITEBASE][0] = TRUE;

        showmenu();
        morewait();
        clearmsg();
        xredraw();
        print1("Have a nice day.");
    } else
    {
        clearmsg();
        print1("Have a nice day then.");
    }
}
Beispiel #14
0
void i_jane_t (pob o)
{
    int volume;
    int range_idx;
    int range_beg;
    int range_end;
    char first_letter;

    Objects[o->id].known = 1;

    print1("Jane's Guide to the World's Treasures: ");

    volume = random_range(6);
    switch (volume)
    {
    case 0:
        nprint1("SCROLLS");
        range_beg = SCROLLID;
        range_end = POTIONID;
        break;

    case 1:
        nprint1("POTIONS");
        range_beg = POTIONID;
        range_end = WEAPONID;
        break;

    case 2:
        nprint1("CLOAKS");
        range_beg = CLOAKID;
        range_end = BOOTID;
        break;

    case 3:
        nprint1("BOOTS");
        range_beg = BOOTID;
        range_end = RINGID;
        break;

    case 4:
        nprint1("RINGS");
        range_beg = RINGID;
        range_end = STICKID;
        break;

    case 5:
        nprint1("STICKS");
        range_beg = STICKID;
        range_end = ARTIFACTID;
        break;

    default:
        /* bomb on error */
        range_beg = range_end = 0;
        assert(FALSE);
    }

    menuclear();
    menuprint("You could probably now recognise:\n");

    for(range_idx = range_beg; range_idx < range_end; ++range_idx)
    {
        Objects[range_idx].known = 1;
        first_letter = Objects[range_idx].truename[0];

        if (is_capital_letter(first_letter) || volume == 3)
            sprintf(Str1, "   %s\n", Objects[range_idx].truename);
        else if (is_vowel(first_letter))
            sprintf(Str1, "   an %s\n", Objects[range_idx].truename);
        else
            sprintf(Str1, "   a %s\n", Objects[range_idx].truename);

        menuprint(Str1);
    }

    showmenu();
    morewait();
    xredraw();
}
Beispiel #15
0
void l_arena(void)
{
    char response;
    Object* newitem;
    int i,prize,monsterlevel;
    char *melee = NULL;

    print1("Rampart Coliseum");
    if (Player.rank[ARENA] == 0) {
        print2("Enter the games, or Register as a Gladiator? [e,r,ESCAPE] ");
        do response = (char) mcigetc();
        while ((response != 'e') && (response != 'r') && (response != ESCAPE));
    }
    else {
        print2("Enter the games? [yn] ");
        response = ynq2();
        if (response == 'y') response = 'e';
        else response = ESCAPE;
    }
    if (response == 'r') {
        if (Player.rank[ARENA]>0)
            print2("You're already a gladiator....");
        else if (Player.rank[ORDER]>0)
            print2("We don't let Paladins into our Guild.");
        else if (Player.rank[LEGION]>0)
            print2("We don't train no stinkin' mercs!");
        else if (Player.str < 13)
            print2("Yer too weak to train!");
        else if (Player.agi < 12)
            print2("Too clumsy to be a gladiator!");
        else {
            print1("Ok, yer now an Arena Trainee.");
            print2("Here's a wooden sword, and a shield");
            morewait();
            clearmsg();
            newitem = ((Object*) checkmalloc(sizeof(Object)));
            *newitem = Objects[OB_CLUB]; /* club */
            gain_item(newitem);
            newitem = ((Object*) checkmalloc(sizeof(Object)));
            *newitem = Objects[OB_LRG_RND_SHIELD]; /* shield */
            gain_item(newitem);
            Player.rank[ARENA] = TRAINEE;
            Arena_Opponent = 3;
            morewait();
            clearmsg();
            print1("You've got 5000Au credit at the Gym.");
            Gymcredit+=5000;
        }
    }
    else if (response == 'e') {
        print1("OK, we're arranging a match....");
        morewait();
        Arena_Monster = ((Monster*) checkmalloc(sizeof(Monster)));
        Arena_Victory = false;
        switch(Arena_Opponent) {
        case 0:
            *Arena_Monster = Monsters[GEEK];
            break;
        case 1:
            *Arena_Monster = Monsters[HORNET];
            break;
        case 2:
            *Arena_Monster = Monsters[HYENA];
            break;
        case 3:
            *Arena_Monster = Monsters[GOBLIN];
            break;
        case 4:
            *Arena_Monster = Monsters[GRUNT];
            break;
        case 5:
            *Arena_Monster = Monsters[TOVE];
            break;
        case 6:
            *Arena_Monster = Monsters[APPR_NINJA];
            break;
        case 7:
            *Arena_Monster = Monsters[SALAMANDER];
            break;
        case 8:
            *Arena_Monster = Monsters[ANT];
            break;
        case 9:
            *Arena_Monster = Monsters[MANTICORE];
            break;
        case 10:
            *Arena_Monster = Monsters[SPECTRE];
            break;
        case 11:
            *Arena_Monster = Monsters[BANDERSNATCH];
            break;
        case 12:
            *Arena_Monster = Monsters[LICHE];
            break;
        case 13:
            *Arena_Monster = Monsters[AUTO_MAJOR];
            break;
        case 14:
            *Arena_Monster = Monsters[JABBERWOCK];
            break;
        case 15:
            *Arena_Monster = Monsters[JOTUN];
            break;
        default:
            if ((Player.rank[ARENA] < 5) && (Player.rank[ARENA] > 0)) {
                strcpy(Str1,Champion);
                strcat(Str1,", the arena champion");
                *Arena_Monster = Monsters[HISCORE_NPC];
                Arena_Monster->name = salloc(Str1);
                strcpy(Str2,"The corpse of ");
                strcat(Str2,Str1);
                Arena_Monster->corpseString = salloc(Str2);
                m_status_set( Arena_Monster, ALLOC );
                Arena_Monster->level = 20;
                Arena_Monster->hp = Championlevel*Championlevel*5;
                Arena_Monster->hit = Championlevel*4;
                Arena_Monster->ac = Championlevel*3;
                Arena_Monster->dmg = 100+Championlevel*2;
                Arena_Monster->xpv = Championlevel*Championlevel*5;
                Arena_Monster->speed = 3;
                melee = Arena_Monster->combatManeuvers = (char *) checkmalloc(30*sizeof(char));
                strcpy(Arena_Monster->combatManeuvers,"");
                for(i=0; i<Championlevel/5; i++)
                    strcat(Arena_Monster->combatManeuvers,"L?R?");
                m_status_set(Arena_Monster, MOBILE);
                m_status_set(Arena_Monster, HOSTILE);
            }
            else {
                do
                    i = random_range(ML9 - ML0) + ML0;
                while (i == NPC || i == HISCORE_NPC || i == ZERO_NPC ||
                        (Monsters[i].uniqueness != COMMON) ||
                        (Monsters[i].dmg == 0));
                *Arena_Monster = Monsters[i];
            }
            break;
        }
        monsterlevel = Arena_Monster->level;
        if (Arena_Monster->level != 20) {
            strcpy(Str1,nameprint());
            strcat(Str1," the ");
            strcat(Str1,Arena_Monster->name);
            Arena_Monster->name = salloc(Str1);
            strcpy(Str2,"The corpse of ");
            strcat(Str2,Str1);
            Arena_Monster->corpseString = salloc(Str2);
            m_status_set( Arena_Monster, ALLOC );
        }
        Arena_Monster->uniqueness = UNIQUE_MADE;
        print1("You have a challenger: ");
        print2(Arena_Monster->name);
        Arena_Monster->wasAttackedByPlayer = true;
        m_status_set(Arena_Monster,HOSTILE);
        /* DAG  pump up the stats of the arena monster; from env.c */
        /* DAG should we even do this for the champion? */
        Arena_Monster->hp += Arena_Monster->level*10;
        Arena_Monster->hit += Arena_Monster->hit;
        Arena_Monster->dmg += Arena_Monster->dmg/2;

        morewait();
        clearmsg();
        change_environment(E_ARENA);
        print1("Let the battle begin....");

        time_clock(true);
        while (Current_Environment == E_ARENA)
            time_clock(false);

        /* DAG all this nasty mess cleaned up...  */
        /* one process with m_status_set( Arena_Monster, ALLOC) */

        /* free(name); */
        /* free(corpse); */

        if (melee)
            free(melee);
        if (! Arena_Victory) {
            print1("The crowd boos your craven behavior!!!");
            if (Player.rank[ARENA] > 0) {
                print2("You are thrown out of the Gladiator's Guild!");
                morewait();
                clearmsg();
                if (Gymcredit > 0) print1("Your credit at the gym is cut off!");
                Gymcredit = 0;
                Player.rank[ARENA] = -1;
            }
        }
        else {
            Arena_Opponent++;
            if (monsterlevel == 20) {
                print1("The crowd roars its approval!");
                if (Player.rank[ARENA]) {
                    print2("You are the new Arena Champion!");
                    Championlevel = Player.level;
                    strcpy(Champion,Player.name);
                    Player.rank[ARENA] = 5;
                    morewait();
                    Championbehavior = fixnpc(4);
                    save_hiscore_npc(11);
                    print1("You are awarded the Champion's Spear: Victrix!");
                    morewait();
                    newitem = ((Object*) checkmalloc(sizeof(Object)));
                    *newitem = Objects[OB_VICTRIX];
                    gain_item(newitem);

                }
                else {
                    print1("As you are not an official gladiator,");
                    nprint1("you are not made Champion.");
                    morewait();
                }
            }
            morewait();
            clearmsg();
            print1("Good fight! ");
            nprint1("Your prize is: ");
            prize = max(25,monsterlevel * 50);
            if (Player.rank[ARENA] > 0) prize *= 2;
            mnumprint(prize);
            nprint1("Au.");
            Player.cash+=prize;
            if ((Player.rank[ARENA]<4) &&
                    (Arena_Opponent>5) &&
                    (Arena_Opponent % 3 == 0)) {
                if (Player.rank[ARENA]>0) {
                    Player.rank[ARENA]++;
                    morewait();
                    print1("You've been promoted to a stronger class!");
                    print2("You are also entitled to additional training.");
                    Gymcredit+=Arena_Opponent*1000;
                }
            }
        }
        xredraw();
    }
    else clearmsg();
}
Beispiel #16
0
void l_trifid(void)
{
    int damage=0,stuck=TRUE;
    print1("The hedge comes alive with a surge of alien growth!");
    while (stuck) {
        dataprint();
        damage += Level->depth/2+1;
        print2("Razor-edged vines covered in suckers attach themselves to you.");
        morewait();
        if (find_and_remove_item(OB_SALT_WATER,-1)) {
            print1("Thinking fast, you toss salt water on the trifid...");
            print2("The trifid disintegrates with a frustrated sigh.");
            Level->site[Player.x][Player.y].locchar = FLOOR;
            Level->site[Player.x][Player.y].p_locf = L_NO_OP;
            lset(Player.x, Player.y, CHANGED);
            gain_experience(1000);
            stuck = FALSE;
        }
        else {
            p_damage(damage,UNSTOPPABLE,"a trifid");
            morewait();
            print1("You are entangled in tendrils...");
            menuclear();
            menuprint("a: Try to break free.\n");
            menuprint("b: Hang limp and hope the tendrils uncoil.\n");
            menuprint("c: Pray for assistance.\n");
            menuprint("d: Attempt to bargain with the hedge.\n");
            menuprint("e: Click your heels together and wish for escape.\n");
            menuprint("ANYTHING ELSE: writhe and scream hopelessly.\n");
            showmenu();
            switch(menugetc()) {
            case 'a':
                if (Player.str > random_range(200)) {
                    print1("Amazing! You're now free.");
                    print2("The trifid writhes hungrily at you.");
                    stuck = FALSE;
                }
                else print1("Well, THAT didn't work.");
                break;
            case 'b':
                print1("Well, at least you're facing your fate with dignity.");
                break;
            case 'c':
                if ((Player.patron == DRUID) &&
                        (Player.rank[PRIESTHOOD] > random_range(5))) {
                    print1("A shaft of golden light bathes the alien plant");
                    print2("which grudginly lets you go....");
                    stuck = FALSE;
                }
                else print1("You receive no divine aid as yet.");
                break;
            case 'd':
                print1("The hedge doesn't answer your entreaties.");
                break;
            case 'e':
                print1("You forgot your ruby slippers, stupid.");
                break;
            default:
                print1("The hedge enjoys your camp play-acting....");
                break;
            }
        }
    }
    xredraw();
}
Beispiel #17
0
void l_brothel(void)
{
    char response;
    print1("You come to a heavily reinforced inner door.");
    print2("A sign reads `The House of the Eclipse'");
    morewait();
    clearmsg();
    if (cinema_confirm("You are about to open the door.")=='y') {
        menuclear();
        menuprint("a:knock on the door.\n");
        menuprint("b:try to pick the lock.\n");
        menuprint("c:bash down the door.\n");
        menuprint("ESCAPE: Leave this house of ill repute.\n");
        showmenu();
        do
            response = menugetc();
        while ((response != 'a') &&
                (response != 'b') &&
                (response != 'c') &&
                (response != ESCAPE));
        xredraw();
        if (response == 'a') {
            if (!nighttime())
                print2("There is no reponse.");
            else {
                print1("A window opens in the door.");
                print2("`500Au, buddy. For the night.' pay it? [yn] ");
                if (ynq2()=='y') {
                    if (Player.cash < 500) {
                        print1("`What, no roll?!'");
                        print2("The bouncer bounces you a little and lets you go.");
                        p_damage(25,UNSTOPPABLE,"da bouncer");
                    }
                    else {
                        Player.cash -= 500;
                        print1("You are ushered into an opulently appointed hall.");
                        print2("After an expensive dinner (takeout from Les Crapuleux)");
                        morewait();
                        if (Player.preference == 'n') {
                            switch(random_range(4)) {
                            case 0:
                                print1("you spend the evening playing German Whist with");
                                break;
                            case 1:
                                print1("you spend the evening discussing philosophy with");
                                break;
                            case 2:
                                print1("you spend the evening playing chess against");
                                break;
                            case 3:
                                print1("you spend the evening telling your adventures to");
                            }
                            print2("various employees of the House of the Eclipse.");
                        }
                        else {
                            print1("you spend an enjoyable and educational evening with");
                            if (Player.preference == 'm' ||
                                    (Player.preference == 'y' && random_range(2)))
                                switch(random_range(4)) {
                                case 0:
                                    print2("Skarn the Insatiable, a satyr.");
                                    break;
                                case 1:
                                    print2("Dryden the Defanged, an incubus.");
                                    break;
                                case 2:
                                    print2("Gorgar the Equipped, a centaur.");
                                    break;
                                case 3:
                                    print2("Hieronymus, the mendicant priest of Eros.");
                                    break;
                                }
                            else switch(random_range(4)) {
                                case 0:
                                    print2("Noreen the Nymph (omaniac)");
                                    break;
                                case 1:
                                    print2("Angelface, a recanted succubus.");
                                    break;
                                case 2:
                                    print2("Corporal Sue of the City Guard (moonlighting).");
                                    break;
                                case 3:
                                    print2("Sheena the Queena the Jungle, a wereleopard.");
                                    break;
                                }
                        }
                        morewait();
                        if (hour() > 12) Time += ((24-hour())+8) * 60;
                        else {
                            Time += ((9-hour())*60);
                            Date++;
                        }
                        Player.food = 40;
                        Player.status[DISEASED] = 0;
                        Player.status[POISONED] = 0;
                        Player.hp = Player.maxhp;
                        /* reduce temporary stat gains to max stat levels */
                        toggle_item_use(TRUE);
                        Player.str = min(Player.str,Player.maxstr);
                        Player.con = min(Player.con,Player.maxcon);
                        Player.agi = min(Player.agi,Player.maxagi);
                        Player.dex = min(Player.dex,Player.maxdex);
                        Player.iq = min(Player.iq,Player.maxiq);
                        Player.pow = min(Player.pow,Player.maxpow);
                        toggle_item_use(FALSE);
                        if (Player.preference == 'n')
                            Player.iq++; /* whatever :-) */
                        else
                            Player.con++;
                        gain_experience(100);
                        timeprint();
                        dataprint();
                        showflags();
                        morewait();
                        clearmsg();
                        if (Player.preference == 'n')
                            print1("You arise refreshed the next morning...");
                        else
                            print1("You arise, tired but happy, the next morning...");
                    }
                }
                else print2("What are you, some kinda prude?");
            }
        }
        else if (response == 'b') {
            if (nighttime()) {
                print1("As you fumble at the lock, the door opens....");
                print2("The bouncer tosses you into the street.");
            }
            else print1("The door appears to be bolted and barred from behind.");
        }
        else if (response == 'c') {
            if (nighttime()) {
                print1("As you charge toward the door it opens....");
                print2("Yaaaaah! Thud!");
                morewait();
                print1("You run past the startled bouncer into a wall.");
                p_damage(20,UNSTOPPABLE,"a move worthy of Clouseau");
                print2("The bouncer tosses you into the street.");
            }
            else {
                print1("Ouch! The door resists your efforts.");
                p_damage(1,UNSTOPPABLE,"a sturdy door");
                morewait();
                print1("You hear an irritated voice from inside:");
                print2("'Keep it down out there! Some of us are trying to sleep!'");
            }
        }
    }
}
Beispiel #18
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();
    }
}
Beispiel #19
0
int spellparse(void)
{
    int first, last, pos;
    char byte, prefix[80];
    int found = 0;
    int f, l;

    first = 0;
    while (first < NUMSPELLS && !Spells[spell_ids[first]].known)
        first++;
    if (first == NUMSPELLS) {
        print1("You don't know any spells!");
        return ABORT;
    }
    last = NUMSPELLS - 1;
    pos = 0;
    print2("");
    do {
        byte = mgetc();
        if (byte == BACKSPACE || byte == DELETE_CHAR) {
            if (pos > 0) {
                prefix[--pos] = '\0';
                byte = prefix[pos - 1];
                f = first;
                while (f >= 0 && !strncmp(prefix, spell_names[f], pos)) {
                    if (Spells[spell_ids[f]].known)
                        first = f;
                    f--;
                }
                l = last;
                while (l < NUMSPELLS && !strncmp(prefix, spell_names[l], pos)) {
                    if (Spells[spell_ids[l]].known)
                        last = l;
                    l++;
                }
                if (found)
                    found = 0;
                print2(prefix);
            }
            if (pos == 0) {
                first = 0;
                last = NUMSPELLS - 1;
                found = 0;
                print2("");
            }
        }
        else if (byte == ESCAPE) {
            xredraw();
            return ABORT;
        }
        else if (byte == '?')
            showknownspells(first, last);
        else if (byte != '\n') {
            if (byte >= 'A' && byte <= 'Z')
                byte += 'a' - 'A';
            if (found)
                continue;
            f = first;
            l = last;
            while (f < NUMSPELLS &&
                    (!Spells[spell_ids[f]].known ||
                     strlen(spell_names[f]) < pos || spell_names[f][pos] < byte))
                f++;
            while (l >= 0 && (!Spells[spell_ids[l]].known ||
                              strlen(spell_names[l]) < pos || spell_names[l][pos] > byte))
                l--;
            if (l < f)
                continue;
            prefix[pos++] = byte;
            prefix[pos] = '\0';
            nprint2(prefix + pos - 1);
            first = f;
            last = l;
            if (first == last && !found) {	/* unique name */
                found = 1;
                nprint2(spell_names[first] + pos);
            }
        }
    } while (byte != '\n');
    xredraw();
    if (found)
        return spell_ids[first];
    else {
        print3("That is an ambiguous abbreviation!");
        return ABORT;
    }
}
Beispiel #20
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);
}