Esempio n. 1
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();
}
Esempio n. 2
0
/* x y is the proposed place to move to */
int p_moveable(int x, int y)
{
    State.setSkipMonsters();
    if (! inbounds(x,y)) return (false);
    else if (Player.status[SHADOWFORM]) {
        switch(Level->site[x][y].p_locf) {
        case L_CHAOS:
        case L_ABYSS:
        case L_VOID:
            return cinema_confirm("That looks dangerous.") == 'y';
        default:
            State.setSkipMonsters(false);
            return(true);
        }
    }
    else if (loc_statusp(x,y,SECRET)) {
        if (State.getFastMove() == false) print3("Ouch!");
        return(false);
    }
    else if (Level->site[x][y].creature != NULL) {
        if (State.getFastMove() == false) {
            Level->site[x][y].creature->fight_monster();
            State.setSkipMonsters(false);
            return(false);
        }
        else return(false);
    }
    else if ((Level->site[x][y].locchar == WALL) ||
             (Level->site[x][y].locchar == STATUE) ||
             (Level->site[x][y].locchar == PORTCULLIS) ||
             (Level->site[x][y].locchar == CLOSED_DOOR) ||
             (State.getFastMove() &&
              ((Level->site[x][y].locchar == HEDGE) ||
               (Level->site[x][y].locchar == LAVA) ||
               (Level->site[x][y].locchar == ABYSS) ||
               (Level->site[x][y].locchar == VOID_CHAR) ||
               (Level->site[x][y].locchar == FIRE) ||
               (Level->site[x][y].locchar == WHIRLWIND) ||
               (Level->site[x][y].locchar == WATER) ||
               (Level->site[x][y].locchar == LIFT) ||
               (Level->site[x][y].locchar == TRAP)))) {
        if (State.getFastMove() == false) print3("Ouch!");
        return(false);
    }
    else if (optionp(CONFIRM)) {
        if ((Level->site[x][y].locchar == HEDGE) ||
                (Level->site[x][y].locchar == LAVA) ||
                (Level->site[x][y].locchar == FIRE) ||
                (Level->site[x][y].locchar == WHIRLWIND) ||
                (Level->site[x][y].locchar == ABYSS) ||
                (Level->site[x][y].locchar == VOID_CHAR) ||
                (Level->site[x][y].locchar == WATER) ||
                (Level->site[x][y].locchar == RUBBLE) ||
                (Level->site[x][y].locchar == LIFT) ||
                (Level->site[x][y].locchar == TRAP)) {
            /* horses WILL go into water... */
            if (State.getMounted()) {
                if (Level->site[x][y].locchar != WATER ||
                        Level->site[x][y].p_locf != L_WATER) {
                    print1("You can't convince your steed to continue.");
                    State.setSkipMonsters();
                    return(false);
                }
                else return(true);
            }
            else if (cinema_confirm("Look where you're about to step!") == 'y') State.setSkipMonsters(false);
            else State.setSkipMonsters();
            return(State.getSkipMonsters() == false);
        }
        else {
            State.setSkipMonsters(false);
            return(true);
        }
    }
    else {
        State.setSkipMonsters(false);
        return(true);
    }
}
Esempio n. 3
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;
    }
}
Esempio n. 4
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);
}
Esempio n. 5
0
void testInsertSort()
{
	myRDT d[N]={{49,1},{38,2},{65,3},{97,4},{76,5},{13,6},{27,7},{49,8}};
	mySQLIST l1,l2,l3,l4,l5,l6,l7,l8,l9;
	int i ;
	for(i=0;i<N;++i)
		l1.r[i+1]=d[i];
	l1.length=N;
	l2=l3=l1;
	l5=l1;
	l6=l1;
	l7=l1;
	l8=l1;
	l9=l1;
	printf("еепРг╟:\n");
	print(l1);
	insertSort(l1);
	printf("ж╠╫с╡ЕхКеепР╨С:\n");
	print(l1);
	BInsertSort(l2);
	printf("уш╟К╡ЕхКеепР╨С:\n");
	print(l2);
	printf("2_б╥╡ЕхКеепР╨С:\n");
	p2_insertSort(l3);
	print(l3);

	mySLKT sl1,sl2;
	int *adr;
	tableInsert(sl1,d,N);
	sl2=sl1;
	printf("еепРг╟:\n");
	print2(sl1);
	arrange(sl1);
	printf("l1еепР╨С:\n");
	print2(sl1);
	adr=(int *)malloc((sl2.length+1)*sizeof(int));
	sort(sl2,adr);
	for(i=1;i<=sl2.length;++i)
		printf("adr[%d]=%d ",i,adr[i]);
	printf("\n");
	rearrange(sl2,adr);
	printf("l2еепР╨С:\n");
	print2(sl2);

	int dt[]={5,3,1};
	for(i=0;i<N;++i)
		l4.r[i+1]=d[i];
	l4.length=N;
	printf("еепРг╟: \n");
	shellSort<int>(l4,dt,3,print);
	printf("еепР╨С: ");
	print(l4);

	int d1[N]= {1,2,4,5,6,77,88,99}; //{49,38,65,97,76,13,27,49};
	printf("еепРг╟:\n");
	print3(d1,N);
	printf("еепР╨С:\n");
	bubble_sort(d1,N,print3);

	printf("©ЛкыеепР╨С: \n");
	quickSort(l5);
	print(l5);

	printf("я║тЯеепР╨С: \n");
	selectSort(l6);
	print(l6);

	printf("йВпня║тЯеепР╨С: \n");
	treeSort(l7);
	print(l7);

	printf("╤яеепР╨С: \n");
	heapSort(l8);
	print(l8);

	printf("╧И╡╒еепР╨С: \n");
	mergeSort(l9);
	print(l9);

	myRDT d3[N+2]={{278,1},{109,2},{63,3},{930,4},{589,5},{184,6},{505,7},{269,8},{8,9},{83,10}};
	mySLLIST l10;
	int *adr1;
	intiList1_(l10,d3,N+2);
	printf("еепРг╟(nextсР╩╧ц╩╦Ёж╣):\n");
	print5(l10);
	radixSort<int>(l10,print4);
	printf("еепР╨С(╬╡л╛а╢╠М):\n");
	print5(l10);
	adr1=(int*)malloc(l10.recnum*sizeof(int));
	sSort(l10,adr1);
	sRearrange(l10,adr1);
	printf("еепР╨С(жьее╪гб╪):\n");
	print5(l10);
}
Esempio n. 6
0
void change_level (char fromlevel, char tolevel, char rewrite_level)
{
    struct level * thislevel = NULL;
    Player.sx = -1;
    Player.sy = -1; /* sanctuary effect dispelled */

    thislevel = findlevel(Dungeon, tolevel);
    deepest[Current_Environment] = max(deepest[Current_Environment], tolevel);
    if (!thislevel)
    {
        thislevel = (level*) checkmalloc(sizeof(levtype));
        clear_level(thislevel);
        Level = thislevel;
        Level->next = Dungeon;
        Dungeon = Level;
    }

    Level = thislevel;
    if ((!Level->generated) || rewrite_level)
    {
        initrand(Current_Environment, tolevel);
        Level->environment = Current_Environment;
        Level->depth = tolevel;
        Level->generated = true;

        switch (Current_Environment)
        {
        case E_CAVES:
            Level->level_width = CAVES_WIDTH;
            Level->level_length = CAVES_LENGTH;
            if ((0 == random_range(4)) && (tolevel < MaxDungeonLevels))
                room_level();
            else
                cavern_level();
            break;

        case E_SEWERS:
            Level->level_width = SEWERS_WIDTH;
            Level->level_length = SEWERS_LENGTH;
            if ((0 == random_range(4)) && (tolevel < MaxDungeonLevels))
                room_level();
            else
                sewer_level();
            break;

        case E_CASTLE:
            Level->level_width = CASTLE_WIDTH;
            Level->level_length = CASTLE_LENGTH;
            room_level();
            break;

        case E_PALACE: /* PGM TODO */
            Level->level_width = PALACE_WIDTH;
            Level->level_length = PALACE_LENGTH;
            room_level();
            break;

        case E_ASTRAL:
            Level->level_width = ASTRAL_WIDTH;
            Level->level_length = ASTRAL_LENGTH;
            maze_level();
            break;

        case E_VOLCANO:
            Level->level_width = VOLCANO_WIDTH;
            Level->level_length = VOLCANO_LENGTH;
            switch (random_range(3))
            {
            case 0:
                cavern_level();
                break;
            case 1:
                room_level();
                break;
            case 2:
                maze_level();
                break;
            }
            break;

        default:
            print3("This dungeon not implemented!");
            assert(false);
            break;
        }

        install_traps();
        install_specials();
        make_stairs(fromlevel);
        make_stairs(fromlevel);
        initrand(E_RESTORE, 0);
        populate_level(Current_Environment);
        stock_level();
    }

    find_stairs(fromlevel, tolevel);
    ScreenOffset = Player.y - (ScreenLength/2);
    show_screen();
    screencheck(Player.x,Player.y);
    drawvision(Player.x,Player.y);

    /* synchronize with player on level change */
    Player.click = (Tick+1)%60;
    roomcheck();
}
Esempio n. 7
0
void l_temple_warning(void)
{
  print1("A stern voice thunders in the air around you:");
  print2("'No unbelievers may enter these sacred precincts;");
  print3("those who defile this shrine will be destroyed!");
}
Esempio n. 8
0
void l_throne(void)
{
  pob o;
  int i;
  print1("You have come upon a huge ornately appointed throne!");
  print2("Sit in it? [yn] ");
  if (ynq1()=='y') {
    if (! find_item(&o,OB_SCEPTRE,-1)) {
      print1("The throne emits an eerie violet-black radiance.");
      print2("You find, to your horror, that you cannot get up!");
      print3("You feel an abstract sucking sensation...");
      for(i=0;i<NUMSPELLS;i++) Spells[i].known = FALSE;
      Player.pow = 3;
      Player.mana = 0;
      Player.hp = 1;
      dispel(-1);
      morewait();clearmsg();
      print1("The radiance finally ceases. You can get up now.");
    }
    else {
      if (HiMagicUse == Date) 
	print3("You hear the sound of a magic kazoo played by an asthmatic.");
      else {
	HiMagicUse = Date;
	print1("Following some strange impulse, you raise the Sceptre....");
	print2("You hear a magical fanfare, repeated three times.");
	switch(HiMagic++) {
	case 0: 
	  print3("Strength.");
	  Player.str+=5;
	  Player.maxstr+=5;
	  break;
	case 1: 
	  print3("Constitution.");  
	  Player.con+=5;
	  Player.maxcon+=5;
	  break;
	case 2: 
	  print3("Dexterity.");
	  Player.dex+=5;
	  Player.maxdex+=5;
	  break;
	case 3: 
	  print3("Agility.");  
	  Player.agi+=5;
	  Player.maxagi+=5;
	  break;
	case 4: 
	  print3("Intelligence.");
	  Player.iq+=5;
	  Player.maxiq+=5;
	  break;
	case 5: 
	  print3("Power.");  
	  Player.pow+=5;
	  Player.maxpow+=5;
	  break;
	default:
	  if (Spells[S_WISH].known) {
	    print1("A mysterious voice mutters peevishly....");
	    print2("So what do you want now? A medal?");
	  }
	  else {
	    print1("Mystic runes appear in the air before you:");
	    print2("They appear to describe some high-powered spell.");
	    morewait();
	    print1("You hear a distant voice....");
	    print2("'You may now tread the path of High Magic.'");
	    Spells[S_WISH].known = TRUE;
	  }
	  break;
	case 17:
	  print1("Weird flickering lights play over the throne.");
	  print2("You hear a strange droning sound, as of a magical");
	  morewait();
	  print1("artifact stressed by excessive use....");
	  print2("With an odd tinkling sound the throne shatters!");
	  Level->site[Player.x][Player.y].locchar = RUBBLE;
	  Level->site[Player.x][Player.y].p_locf = L_RUBBLE;
	  lset(Player.x, Player.y, CHANGED);
	  if (find_and_remove_item(OB_SCEPTRE,-1)) {
	    morewait();
	    print1("Your sceptre reverberates with the noise, and");
	    print2("it too explodes in a spray of shards.");
	  }
	  break;
	}
	calc_melee();
	dataprint();
      }
    }
  }
}
Esempio n. 9
0
void l_lift(void)
{
  char response;
  int levelnum;
  int distance;
  int too_far = 0;

  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);
  print1("You walk onto a shimmering disk....");
  print2("The disk vanishes, and a glow surrounds you.");
  print3("You feel weightless.... You feel ghostly....");
  morewait();
  clearmsg();
  print1("Go up, down, or neither [u,d,ESCAPE] ");
  do response = (char) mcigetc();
  while ((response != 'u') && 
	 (response != 'd') &&
	 (response != ESCAPE));
  if (response != ESCAPE) {
    print1("How many levels?");
    levelnum = (int) parsenum("");
    if (levelnum > 6) {
      too_far = 1;
      levelnum = 6;
    }
    if (response == 'u' && Level->depth - levelnum < 1) {
      distance = levelnum - Level->depth;
      change_environment(E_COUNTRYSIDE); /* "you return to the countryside." */
      if (distance > 0) {
	nprint1("..");
	print2("...and keep going up!  You hang in mid air...");
	morewait();
	print3("\"What goes up...\"");
	morewait();
	print3("Yaaaaaaaah........");
	p_damage(distance*10,NORMAL_DAMAGE,"a fall from a great height");
      }
      return;
    }
    else if (response == 'd' && Level->depth + levelnum > MaxDungeonLevels) {
      too_far = 1;
      levelnum = MaxDungeonLevels - Level->depth;
    }
    if (levelnum == 0) {
      print1("Nothing happens.");
      return;
    }
    if (too_far) {
      print1("The lift gives out partway...");
      print2("You rematerialize.....");
    }
    else
      print1("You rematerialize.....");
    change_level(Level->depth,
		(response=='d' ? 
		 Level->depth+levelnum : 
		 Level->depth-levelnum),
		FALSE);
    roomcheck();
  }
}
Esempio n. 10
0
void l_magic_pool(void)
{
  int possibilities=random_range(100);
  print1("This pool seems to be enchanted....");
  if (gamestatusp(MOUNTED)) {
    if (random_range(2)) {
      print2("Your horse is polymorphed into a fig newton.");
      resetgamestatus(MOUNTED);
    }
    else print2("Whatever it was, your horse enjoyed it....");
  }
  else  if (possibilities == 0) {
    print1("Oh no! You encounter the DREADED AQUAE MORTIS...");
    if (random_range(1000) < Player.level*Player.level*Player.level) {
      print2("The DREADED AQUAE MORTIS throttles you within inches....");
      print3("but for some reason chooses to let you escape.");
      gain_experience(500);
      Player.hp = 1;
    }
    else p_death("the DREADED AQUAE MORTIS!");
  }
  else if (possibilities < 25)
    augment(0);
  else if (possibilities < 30)
    augment(1);
  else if (possibilities < 60)
    augment(-1);
  else if (possibilities < 65)
    cleanse(1);
  else if (possibilities < 80) {
    if (Player.possessions[O_WEAPON_HAND] != NULL) {
      print1("You drop your weapon in the pool! It's gone forever!");
      dispose_lost_objects(1,Player.possessions[O_WEAPON_HAND]);
    }
    else print1("You feel fortunate.");
  }
  else if (possibilities < 90) {
    if (Player.possessions[O_WEAPON_HAND] != NULL) {
      print1("Your weapon leaves the pool with a new edge....");
      Player.possessions[O_WEAPON_HAND]->plus += random_range(10)+1;
      calc_melee();
    }
    else print1("You feel unfortunate.");
  }
  else if (possibilities < 95) {
    Player.hp += 10;
    print1("You feel healthier after the dip...");
  }
  else if (possibilities < 99) {
    print1("Oooh, a tainted pool...");
    p_poison(10);
  }
  else if (possibilities == 99) {
    print1("Wow! A pool of azoth!");
    heal(10);
    cleanse(1);
    Player.mana = calcmana()*3;
    Player.str = (Player.maxstr++)*3;
  }
  print2("The pool seems to have dried up.");
  Level->site[Player.x][Player.y].locchar = TRAP;
  Level->site[Player.x][Player.y].p_locf = L_TRAP_PIT;
  lset(Player.x, Player.y, CHANGED);
}
Esempio n. 11
0
void l_abyss(void)
{
  int i;
  if (Current_Environment != Current_Dungeon) {
    print1("You fall through a dimensional portal!");
    morewait();
    strategic_teleport(-1);
  }
  else {
    print1("You enter the infinite abyss!");
    morewait();
    if (random_range(100)==13) {
      print1("As you fall you see before you what seems like");
      print2("an infinite congerie of iridescent bubbles.");
      print3("You have met Yog Sothoth!!!");
      morewait();
      clearmsg();
      if (Player.alignment > -10) 
	p_death("the Eater of Souls");
      else {
	print1("The All-In-One must have taken pity on you.");
	print2("A transdimensional portal appears...");
	morewait();
	change_level(Level->depth,Level->depth+1,FALSE);
	gain_experience(2000);
	Player.alignment -= 50;
      }
    }
    else {
      i = 0;
      print1("You fall...");
      while(random_range(3)!=2) {
	if (i%6 == 0)
	    print2("and fall... ");
	else
	    nprint2("and fall... ");
	i++;
	morewait();
      }
      i++;
      print1("Finally,you emerge through an interdimensional interstice...");
      morewait();
      if (Level->depth+i>MaxDungeonLevels) {
	print2("You emerge high above the ground!!!!");
	print3("Yaaaaaaaah........");
	morewait();
	change_environment(E_COUNTRYSIDE);
	do {
	  setPlayerXY( random_range(COUNTRY_WIDTH), random_range(COUNTRY_LENGTH));
	} while(Country[Player.x][Player.y].base_terrain_type == CHAOS_SEA);
	p_damage(i*50,NORMAL_DAMAGE,"a fall from a great height");
      }
      else {
	print2("You built up some velocity during your fall, though....");
	morewait();
	p_damage(i*5,NORMAL_DAMAGE,"a fall through the abyss");
	change_level(Level->depth,Level->depth+i,FALSE);
	gain_experience(i*i*50);
      }
    }
  }
}
Esempio n. 12
0
void l_safe(void)
{
    char response;
    pob newitem;
    int attempt = 0;
    response = cinema_interact("pfqi",
                               "You have discovered a safe!",
                               "Pick the lock [p], Force the door [f], or ignore [ESCAPE]",
                               NULL);

    if (response == 'p')
        attempt = (2*Player.dex + Player.rank[THIEVES]*10 - random_range(100))/10;
    else if (response == 'f')
        attempt = (Player.dmg - random_range(100))/10;
    if (attempt > 0) {
        Player.alignment -= 4;
        gain_experience(50);
        print2("The door springs open!");
        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);
        if (random_range(2) == 1) {
            print1("You find:");
            do {
                newitem = create_object(difficulty());
                print2(itemid(newitem));
                morewait();
                gain_item(newitem);
            } while (random_range(3) == 1);
        }
        else print2("The safe was empty (awwwww....)");
    }
    else {
        print3("Your attempt at burglary failed!");
        if (attempt == -1) {
            print1("A siren goes off! You see flashing red lights everywhere!");
            morewait();
            if (Last_Environment == E_CITY) {
                print2("The city guard shows up! They collar you in no time flat!");
                change_environment(E_CITY);
                morewait();
                send_to_jail();
            }
        }
        else if (attempt == -2) {
            print1("There is a sudden flash!");
            p_damage(random_range(25),FLAME,"a safe");
            print2("The safe has self-destructed.");
            Level->site[Player.x][Player.y].locchar = RUBBLE;
            Level->site[Player.x][Player.y].p_locf = L_RUBBLE;
            lset(Player.x, Player.y, CHANGED);
        }
        else if (attempt == -3) {
            print1("The safe jolts you with electricity!");
            lball(Player.x,Player.y,Player.x,Player.y,30);
        }
        else if (attempt < -3) {
            print1("You are hit by an acid spray!");
            if (Player.possessions[O_CLOAK] != NULL) {
                print2("Your cloak is destroyed!");
                conform_lost_object(Player.possessions[O_CLOAK]);
                p_damage(10,ACID,"a safe");
            }
            else if (Player.possessions[O_ARMOR] != NULL) {
                print2("Your armor corrodes!");
                Player.possessions[O_ARMOR]->dmg-=3;
                Player.possessions[O_ARMOR]->hit-=3;
                Player.possessions[O_ARMOR]->aux-=3;
                p_damage(10,ACID,"a safe");
            }
            else {
                print2("The acid hits your bare flesh!");
                p_damage(random_range(100),ACID,"a safe");
            }
        }
    }
}
Esempio n. 13
0
void l_oracle(void)
{
    char response;
    if (gamestatusp(ATTACKED_ORACLE) && (! gamestatusp(COMPLETED_ASTRAL))) {
        print1("You come before a blue crystal dais. You see a broken mirror.");
        print2("Look in the mirror? [yn] ");
        if (ynq2()=='y') {
            print1("A strange force rips you from your place....");
            Player.hp = 1;
            print2("You feel drained....");
            dataprint();
            print3("You find yourself in a weird flickery maze.");
            change_environment(E_ASTRAL);
        }
    }
    else {
        print1("You come before a blue crystal dais. There is a bell and a mirror.");
        print2("Ring the bell [b], look in the mirror [m], or leave [ESCAPE] ");
        do response = (char) mcigetc();
        while ((response != 'b') && (response != 'm') && (response != ESCAPE));
        if (response == 'b') {
            print1("The ringing note seems to last forever.");
            print2("You notice a robed figure in front of you....");
            morewait();
            print1("The oracle doffs her cowl. Her eyes glitter with blue fire!");
            print2("Attack her? [yn] ");
            if (ynq2() == 'y') {
                setgamestatus(ATTACKED_ORACLE);
                print1("The oracle deftly avoids your attack.");
                print2("She sneers at you and vanishes.");
            }
            else {
                print2("She stares at you...and speaks:");
                if (!gamestatusp(SPOKE_TO_DRUID)) {
                    print3("'The ArchDruid speaks wisdom in his forest shrine.'");
                }
                else if (!gamestatusp(COMPLETED_CAVES)) {
                    print3("'Thou mayest find aught of interest in the caves to the South.'");
                }
                else if (!gamestatusp(COMPLETED_SEWERS)) {
                    print3("'Turn thy attention to the abyssal depths of the city.'");
                }
                else if (!gamestatusp(COMPLETED_CASTLE)) {
                    print3("'Explorest thou the depths of the Castle of the ArchMage.'");
                }
                else if (!gamestatusp(COMPLETED_ASTRAL)) {
                    morewait();
                    print1("'Journey to the Astral Plane and meet the Gods' servants.'");
                    print2("The oracle holds out her hand. Do you take it? [yn] ");
                    if (ynq2()=='y') {
                        print1("'Beware: Only the Star Gem can escape the Astral Plane.'");
                        print2("A magic portal opens behind the oracle. She leads you");
                        morewait();
                        print1("through a sequence of special effects that would have");
                        print2("IL&M technicians cursing in awe and deposits you in an");
                        morewait();
                        clearmsg();
                        print1("odd looking room whose walls seem strangely insubstantial.");
                        gain_experience(5000);
                        change_environment(E_ASTRAL);
                    }
                    else print3("You detect the hint of a sneer from the oracle.");
                }
                else if (!gamestatusp(COMPLETED_VOLCANO)) {
                    print3("'The infernal maw may yield its secrets to thee now.'");
                }
                else if (!gamestatusp(COMPLETED_CHALLENGE)) {
                    print3("'The challenge of adepthood yet awaits thee.'");
                }
                else {
                    morewait();
                    print1("'My lord: Thou hast surpassed my tutelage forever.");
                    print2("Fare thee well.'");
                    print3("The oracle replaces her hood and seems to fade away....");
                }
            }
        }
        else if (response == 'm') {
            print1("You seem to see yourself. Odd....");
            knowledge(1);
        }
        else print2("You leave this immanent place.");
    }
}
Esempio n. 14
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();
    }
}
Esempio n. 15
0
void send_to_jail(void)
{
    if (Player.rank[ORDER] > 0) {
        print1("A member of the Order of Paladins sent to jail!");
        print2("It cannot be!");
        morewait();
        print1("You are immediately expelled permanently from the Order!");
        print2("Your name is expunged from the records....");
        Player.rank[ORDER] = -1;
    }
    else if (gamestatusp(DESTROYED_ORDER))
        print1("The destruction of the Order of Paladins has negated the law!");
    else if ((Current_Environment != E_CITY) &&
             (Last_Environment != E_CITY))
        print1("Fortunately, there is no jail around here, so you are freed!");
    else {
        pacify_guards();
        if (((Current_Environment == E_HOUSE) ||
                (Current_Environment == E_MANSION) ||
                (Current_Environment == E_HOVEL)) &&
                (Last_Environment == E_CITY))
        {
            setgamestatus(SUPPRESS_PRINTING);
            change_environment(E_CITY);
            resetgamestatus(SUPPRESS_PRINTING);
        }
        if (Current_Environment == E_CITY) {
            if (gamestatusp(UNDEAD_GUARDS)) {
                print1("You are taken to a weirdly deserted chamber where an undead");
                print2("Magistrate presides over a court of ghosts and haunts.");
                morewait();
                print1("'Mr. Foreman, what is the verdict?'");
                print2("'Guilty as charged, your lordship.'");
                morewait();
                clearmsg();
                print1("'Guilty...");
                morewait();
                nprint1("Guilty...");
                morewait();
                nprint1("Guilty...");
                morewait();
                nprint1("Guilty...'");
                clearmsg();
                print1("The members of the court close in around, fingers pointing.");
                print2("You feel insubstantial hands closing around your throat....");
                print3("You feel your life draining away!");
                while(Player.level > 0) {
                    Player.level--;
                    Player.xp /= 2;
                    Player.hp /= 2;
                    dataprint();
                }
                Player.maxhp = Player.maxcon;
                morewait();
                print1("You are finally released, a husk of your former self....");
                Player.x = 58;
                Player.y = 40;
                screencheck(Player.x,Player.y);
            }
            /* Hmm...  The sorcerors ought to be able to get you free, too,
             * although of course they should have their *own* price. */
            else if (Player.alignment + random_range(200) < 0) {
                print1("Luckily for you, a smooth-tongued advocate from the");
                print2("Rampart Chaotic Liberties Union gets you off!");
                Player.x = 58;
                Player.y = 40;
                screencheck(Player.x,Player.y);
            }
            else switch(Imprisonment++) {
                case 0:
                    print1("The Magistrate sternly reprimands you.");
                    print2("As a first-time offender, you are given probation.");
                    Player.y = 58;
                    Player.x = 40;
                    screencheck(Player.x,Player.y);
                    break;
                case 1:
                    print1("The Magistrate expresses shame for your conduct.");
                    print2("You are thrown in jail!");
                    morewait();
                    repair_jail();
                    Player.y = 54;
                    Player.x = 37 + (2*random_range(4));
                    screencheck(Player.x,Player.y);
                    l_portcullis_trap();
                    break;
                default:
                    print1("The Magistrate renders summary judgement.");
                    print2("You are sentenced to prison!");
                    morewait();
                    print1("The guards recognize you as a 'three-time-loser'");
                    print2("...and beat you up a little to teach you a lesson.");
                    p_damage(random_range(Imprisonment * 10),
                             UNSTOPPABLE,
                             "police brutality");
                    morewait();
                    repair_jail();
                    Player.y = 54;
                    Player.x = 37 + (2*random_range(4));
                    screencheck(Player.x,Player.y);
                    l_portcullis_trap();
                }
        }
    }
}