Beispiel #1
0
void activate()
{
  int index;
  char response;

  clearmsg();

  print1("Activate -- item [i] or artifact [a] or quit [ESCAPE]?");
  do response = (char) mcigetc();
  while ((response != 'i') && (response != 'a') && (response != ESCAPE));
  if (response != ESCAPE) {
    if (response == 'i')
      index = getitem(THING);
    else if (response == 'a')
      index = getitem(ARTIFACT);
    if (index != ABORT) {
      clearmsg();
      print1("You activate it.... ");
      morewait();
      item_use(Player.possessions[index]);
    }
    else setgamestatus(SKIP_MONSTERS);
  }
  else setgamestatus(SKIP_MONSTERS);
}
Beispiel #2
0
/* read a scroll, book, tome, etc. */
void peruse()
{
  int index;
  struct object *obj;

  clearmsg();

  if (Player.status[BLINDED] > 0)
    print3("You're blind -- you can't read!!!");
  else if (Player.status[AFRAID] > 0)
    print3("You are too afraid to stop to read a scroll!");
  else {
    print1("Read -- ");
    index = getitem(SCROLL);
    if (index == ABORT)
      setgamestatus(SKIP_MONSTERS);
    else {
      obj = Player.possessions[index];
      if (obj->objchar != SCROLL) {
	print3("There's nothing written on ");
	nprint3(itemid(obj));
      }
      else {
	nprint1("You carefully unfurl the scroll....");
	morewait();
	item_use(obj);
	dispose_lost_objects(1,obj);
      }
    }
  }
}
Beispiel #3
0
void eat()
{
  int index;
  struct object *obj;

  clearmsg();

  print1("Eat --");
  index = getitem(FOOD);
  if (index == ABORT)
    setgamestatus(SKIP_MONSTERS);
  else {
    obj = Player.possessions[index];
    if ((obj->objchar != FOOD)&&(obj->objchar != CORPSE)) {
      print3("You can't eat ");
      nprint3(itemid(obj));
    }
    else {
      if (obj->usef == I_FOOD) Player.food = max(0,Player.food+obj->aux);
      item_use(obj);
      dispose_lost_objects(1,obj);
      if (Current_Dungeon == E_COUNTRYSIDE) {
	Time += 100;
	hourly_check();
      }
    }
  }
  foodcheck();
}
Beispiel #4
0
void normalDown(unsigned char key, int x, int y)
{
	if (key == 'a')
		keysDown |= aKey;
	if (key == 'd')
		keysDown |= dKey;
	if (key == 'm')
		keysDown |= mKey;
	if (key == 32)
	{
		if (controlled->items->elem->anim == NULL)
		{
			item_use(controlled, controlled->items->elem);
		}
	}
}
Beispiel #5
0
void quaff()
{
  int index;
  struct object *obj;
  clearmsg();
  print1("Quaff --");
  index = getitem(POTION);
  if (index == ABORT)
    setgamestatus(SKIP_MONSTERS);
  else {
    obj = Player.possessions[index];
    if (obj->objchar != POTION) {
      print3("You can't drink ");
      nprint3(itemid(obj));
    }
    else {
      print1("You drink it down.... ");
      item_use(obj);
      morewait();
      dispose_lost_objects(1,obj);
    }
  }
}
Beispiel #6
0
/* enchant */
void enchant(int delta)
{
    int i,used = false;
    long change_cash;

    if (delta < 0) {
        i = random_item();
        if (i == ABORT || Player.possessions[i]->usef == I_NOTHING ||
                Player.possessions[i]->usef == I_NO_OP ||
                Player.possessions[i]->usef == I_NORMAL_ARMOR ||
                Player.possessions[i]->usef == I_NORMAL_WEAPON ||
                Player.possessions[i]->usef == I_NORMAL_SHIELD ||
                Player.possessions[i]->objchar == FOOD ||
                Player.possessions[i]->objchar == MISSILEWEAPON) {
            print1("You feel fortunate.");
            morewait();
        }
        else if (Player.possessions[i]->blessing < 0 ||
                 (Player.possessions[i]->objchar == ARTIFACT && random_range(3))) {
            if (Player.possessions[i]->uniqueness == COMMON)
                print1("Your ");
            nprint1(itemid(Player.possessions[i]));
            nprint1(" glows, but the glow flickers out...");
            morewait();
        }
        else {
            used = (Player.possessions[i]->used);
            if (used) {
                Player.possessions[i]->used = false;
                item_use(Player.possessions[i]);
            }
            if (Player.possessions[i]->uniqueness == COMMON)
                print1("Your ");
            nprint1(itemid(Player.possessions[i]));
            nprint1(" radiates an aura of mundanity!");
            morewait();
            Player.possessions[i]->plus = 0;
            Player.possessions[i]->charge = -1;
            Player.possessions[i]->usef = I_NOTHING;
            if (used) {
                Player.possessions[i]->used = true;
                item_use(Player.possessions[i]);
            }
        }
    }
    else {
        i = getitem(CASH);
        if (i == ABORT) {
            print1("You feel unlucky.");
            morewait();
        }
        else if (i == CASHVALUE) {
            print1("You enchant your money.... What a concept!");
            change_cash = Player.cash*(random_range(7) - 3)/6;
            if (change_cash > 0) print2("Seems to have been a good idea!");
            else print2("Maybe it wasn't such a good idea....");
            Player.cash += change_cash;
            morewait();
        }
        else if (Player.possessions[i]->objchar == ARTIFACT) {
            if (Player.possessions[i]->usef !=
                    Objects[Player.possessions[i]->id].usef) {
                print1("It re-acquires its magical aura!");
                Player.possessions[i]->usef = Objects[Player.possessions[i]->id].usef;
            }
            else {
                print1("The enchantment spell enfolds the ");
                nprint1(itemid(Player.possessions[i]));
                print2("and the potent enchantment of the Artifact causes a backlash!");
                morewait();
                clearmsg();
                manastorm(Player.x,Player.y,Player.possessions[i]->level*5);
            }
        }
        else {
            if (Player.possessions[i]->plus > random_range(20)+1) {
                print1("Uh-oh, the force of the enchantment was too much!");
                print2("There is a loud explosion!");
                morewait();
                manastorm(Player.x,Player.y,Player.possessions[i]->plus*5);
                dispose_lost_objects(1,Player.possessions[i]);
            }
            else {
                used = (Player.possessions[i]->used);
                if (used) {
                    State.setSuppressPrinting( true );
                    Player.possessions[i]->used = false;
                    item_use(Player.possessions[i]);
                    State.setSuppressPrinting( false );
                }
                print1("The item shines!");
                morewait();
                Player.possessions[i]->plus += delta+1;
                if (Player.possessions[i]->charge > -1)
                    Player.possessions[i]->charge +=
                        ((delta+1) * (random_range(10) + 1));
                if (used) {
                    State.setSuppressPrinting( true );
                    Player.possessions[i]->used = true;
                    item_use(Player.possessions[i]);
                    State.setSuppressPrinting( false );
                }
            }
        }
        calc_melee();
    }
}
Beispiel #7
0
/* bless */
void bless(int blessing)
{
    int index,used;

    if (blessing < 0) {
        index = random_item();
        if (index == ABORT) {
            print1("You feel fortunate.");
            morewait();
        }
        else {
            print1("A foul odor arises from ");
            if (Player.possessions[index]->uniqueness == COMMON)
                nprint1("your ");
            nprint1(itemid(Player.possessions[index]));
            morewait();
            used = (Player.possessions[index]->used);
            if (used) {
                State.setSuppressPrinting( true );
                Player.possessions[index]->used = false;
                item_use(Player.possessions[index]);
                State.setSuppressPrinting( false );
            }
            Player.possessions[index]->blessing -= 2;
            if (Player.possessions[index]->blessing < 0)
                Player.possessions[index]->plus =
                    abs(Player.possessions[index]->plus) - 1;
            if (used) {
                State.setSuppressPrinting( true );
                Player.possessions[index]->used = true;
                item_use(Player.possessions[index]);
                State.setSuppressPrinting( false );
            }
        }
    }
    else {
        index = getitem(NULL_ITEM);
        if (index == CASHVALUE) {
            print1("Blessing your money has no effect.");
            morewait();
        }
        else if (index != ABORT) {
            used = Player.possessions[index]->isUsed();
            if (used) {
                State.setSuppressPrinting( true );
                Player.possessions[index]->used = false;
                item_use(Player.possessions[index]);
                State.setSuppressPrinting( false );
            }
            print1("A pure white light surrounds the item... ");
            if (Player.possessions[index]->blessing < 0-(blessing+1)) {
                print2("which is evil enough to resist the effect of the blessing!");
                morewait();
            }
            else if (Player.possessions[index]->blessing < -1) {
                print2("which disintegrates under the influence of the holy aura!");
                morewait();
                Player.itemweight -=  Player.possessions[index]->weight;
                dispose_lost_objects(1,Player.possessions[index]);
            }
            else if (Player.possessions[index]->blessing < blessing+1) {
                print2("which now seems affected by afflatus!");
                morewait();
                Player.possessions[index]->blessing++;
                Player.possessions[index]->plus =
                    abs(Player.possessions[index]->plus)+1;
            }
            else {
                print2("The hierolux fades without any appreciable effect....");
                morewait();
            }
            if (used && (Player.possessions[index] != NULL)) {
                State.setSuppressPrinting( true );
                Player.possessions[index]->used = true;
                item_use(Player.possessions[index]);
                State.setSuppressPrinting( false );
            }
        }
    }
    calc_melee();
}
Beispiel #8
0
/* Prayer occurs at altars, hence the name of the function */
void l_altar()
{
    int i;
    int deity;
    char response;

    if(Current_Environment == E_COUNTRYSIDE) {
        deity = DRUID;
    }
    else {
        deity = Level->site[Player.x][Player.y].aux;
    }

    switch(deity) {
    case ODIN:
        print1("This granite altar is graven with a gallows.");

        break;
    case SET:
        print1("This sandstone altar has a black hand drawn on it.");

        break;
    case HECATE:
        print1("This silver altar is inlaid with a black cresent moon.");

        break;
    case ATHENA:
        print1("This golden altar is inscribed with an owl.");

        break;
    case DESTINY:
        print1("This crystal altar is in the form of an omega.");

        break;
    case DRUID:
        print1("This oaken altar is ornately engraved with leaves.");

        break;
    default:
        print1("This rude altar has no markings.");

        break;
    }

    print2("Worship at this altar? [yn] ");

    if(ynq2() == 'y') {
        if(Player.rank[PRIESTHOOD] == 0) {
            increase_priest_rank(deity);
        }
        else if(!check_sacrilege(deity)) {
            if(Blessing) {
                print1("You have a sense of immanence.");
            }

            print2("Request a Blessing, Sacrifice an item, or just Pray [b,s,p] ");
            response = mcigetc();

            while((response != 'b')
                  && (response != 's')
                  && (response != 'p')
                  && (response != ESCAPE)) {
                response = mcigetc();
            }

            if(response == 'b') {
                print1("You beg a heavenly benefice.");
                print2("You hear a gong resonating throughout eternity...");
                morewait();

                if(Blessing) {
                    print1("A shaft of lecent radiance lances dwon from the heavens!");
                    print2("You feel uplifted...");
                    morewait();
                    gain_experience(Player.rank[PRIESTHOOD] * Player.rank[PRIESTHOOD] * 50);
                    cleanse(1);
                    heal(10);
                    bless(1);
                    Blessing = FALSE;
                    increase_priest_rank(deity);
                }
                else {
                    print1("Your ardent plea is ignored.");
                    print2("You feel ashamed.");
                    Player.xp -= (Player.xp / 4);
                }

                calc_melee();
            }
            else if(response == 's') {
                print1("Which item to Sacrifice?");
                i = getitem('\0');

                if(i == ABORT) {
                    i = 0;
                }

                if(Player.possessions[i] == NULL) {
                    print1("You have insulted your deity!");
                    print2("Not a good idea, as it turns out...");
                    dispel(-1);
                    p_damage(Player.hp - 1, UNSTOPPABLE, "a god's pique");
                }
                else if(true_item_value(Player.possessions[i]) > (Player.rank[PRIESTHOOD] * Player.rank[PRIESTHOOD] * Player.rank[PRIESTHOOD] * 50)) {
                    print1("With a burst of blue flame, your offering vanishes!");
                    dispose_lost_objects(1, Player.possessions[i]);
                    print2("A violet nimbus settles around your head and slowly fades.");
                    morewait();
                    Blessing = TRUE;
                }
                else {
                    print1("A darkling glow envelopes your offering!");
                    print2("The glow slowly fades...");
                    morewait();
                    setgamestatus(SUPPRESS_PRINTING);

                    if(Player.possessions[i]->used) {
                        Player.possessions[i]->used = FALSE;
                        item_use(Player.possessions[i]);
                        Player.possessions[i]->blessing = -1 - abs(Player.possessions[i]->blessing);
                        Player.possessions[i]->used = TRUE;
                        item_use(Player.possessions[i]);
                    }
                    else {
                        Player.possessions[i]->blessing = -1 - abs(Player.possessions[i]->blessing);
                    }

                    resetgamestatus(SUPPRESS_PRINTING);
                }
            }
            else if(response == 'p') {
                if(deity != Player.patron) {
                    print1("Nothing seems to happen.");
                }
                else {
                    increase_priest_rank(deity);
                }
            }
        }
    }
}
Beispiel #9
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();
}