示例#1
0
文件: effect2.c 项目: anylonen/omega
void accuracy(int blessing)
{
  if (blessing > -1) {
      mprint("Everything seems covered in bullseyes!");
      Player.status[ACCURACY] += random_range(5)+1+blessing*5;
      calc_melee();
    }
  else {
    Player.status[ACCURACY]=0;
    calc_melee();
    mprint("Your vision blurs...");
  }
}
示例#2
0
文件: move.c 项目: anylonen/omega
void l_voidstone(void)
{
  int i;
  print1("This is a grey and uninteresting stone.");
  print2("A feeling of nihility emanates from it.");
  morewait();
  clearmsg();
  if (cinema_confirm("You're about to touch it.")=='y') {
    print1("You feel negated.");
    morewait();
    Player.mana = 0;
    toggle_item_use(TRUE);
    for(i=0;i<NUMSTATI;i++)
      Player.status[i] = 0;
    for(i=0;i<MAXITEMS;i++) 
      if (Player.possessions[i] != NULL) {
	Player.possessions[i]->blessing = 0;
	Player.possessions[i]->plus = 0;
	Player.possessions[i]->usef = I_NOTHING;
      }
    toggle_item_use(FALSE);
    calc_melee();
  }
  else print1("You back away from the strange rock.");
}
示例#3
0
文件: char.cpp 项目: cwc/OmegaRPG
void omegan_character_stats(void)
{
    int share1,share2,i=0;
    print1("To reroll hit ESCAPE; hit any other key to accept these stats.");
    do {
        i++;
#if REROLLS == -1
        sprintf(Str1, "Generated character # %d", i );
#else
        sprintf(Str1, "You have only %d chance%s to reroll... ", REROLLS - i,
                (i == (REROLLS-1) ) ? "":"s");
#endif
        print2(Str1);
        Player.iq = Player.maxiq = 4 + random_range(5)+
                                   (share1 = random_range(6)) + (share2 = random_range(6));
        Player.pow = Player.maxpow = 4 + random_range(5) + share1 +share2;
        Player.dex = Player.maxdex = 4 + random_range(5)+
                                     (share1 = random_range(6)) + (share2 = random_range(6));
        Player.agi = Player.maxagi = 4 + random_range(5) + share1 +share2;
        Player.str = Player.maxstr = 4 + random_range(5)+
                                     (share1 = random_range(6)) + (share2 = random_range(6));
        Player.con = Player.maxcon = 4 + random_range(5) + share1 +share2;
        Player.cash = random_range(100)+random_range(100)+
                      random_range(100)+random_range(100)+random_range(100);
        Player.hp=Player.maxhp=Player.con;
        Player.mana=Player.maxmana = calcmana();
        calc_melee();
        dataprint();
#if REROLLS == -1
    } while (mgetc() == ESCAPE);
#else
    }
示例#4
0
void i_azoth(pob o)
{
    if (o->plus < 0) {
        mprint("The mercury was poisonous!");
        p_poison(25);
    }
    else if (o->plus == 0) {
        mprint("The partially enchanted azoth makes you sick!");
        Player.con = ((int) (Player.con / 2));
        calc_melee();
    }
    else if (o->blessing < 1) {
        mprint("The unblessed azoth warps your soul!");
        Player.pow = Player.maxpow = ((int) (Player.maxpow / 2));
        level_drain(random_range(10),"cursed azoth");
    }
    else {
        mprint("The azoth fills you with cosmic power!");
        if (Player.str > Player.maxstr*2) {
            mprint("The power rages out of control!");
            p_death("overdose of azoth");
        }
        else {
            heal(10);
            cleanse(1);
            Player.mana = calcmana()*3;
            toggle_item_use(TRUE);
            Player.str = (Player.maxstr++)*3;
            toggle_item_use(FALSE);
        }
    }
}
示例#5
0
文件: aux2.c 项目: anylonen/omega
/* Increase in level at appropriate experience gain */
void gain_level(void)
{
  int gained=FALSE;
  int hp_gain; /* FIXED! 12/30/98 */
  
  if (gamestatusp(SUPPRESS_PRINTING))
    return;
  while (expval(Player.level+1) <= Player.xp) {
    if (!gained)
      morewait();
    gained = TRUE;
    Player.level++;
    print1("You have attained a new experience level!");
    print2("You are now ");
    nprint2(getarticle(levelname(Player.level)));
    nprint2(levelname(Player.level));
    hp_gain = random_range(Player.con)+1; /* start fix 12/30/98 */
    if (Player.hp < Player.maxhp )
      Player.hp += hp_gain*Player.hp/Player.maxhp;
    else if (Player.hp < Player.maxhp + hp_gain)
      Player.hp = Player.maxhp + hp_gain;
    /* else leave current hp alone */
    Player.maxhp += hp_gain;
    Player.maxmana = calcmana();
    /* If the character was given a bonus, let him keep it.  Otherwise
     * recharge him. */
    Player.mana = max(Player.mana, Player.maxmana); /* end fix 12/30/98 */
    morewait();
  }
  if (gained) clearmsg();
  calc_melee();
}
示例#6
0
文件: effect2.c 项目: anylonen/omega
void augment(int blessing)
{
  if (blessing < 0) {
    mprint("You feel a cold surge!");
    switch(random_range(6)) {
      case 0: Player.str = min(Player.str-1,Player.maxstr-1); break;
      case 1: Player.con = min(Player.con-1,Player.maxcon-1); break;
      case 2: Player.dex = min(Player.dex-1,Player.maxdex-1); break;
      case 3: Player.agi = min(Player.agi-1,Player.maxagi-1); break;
      case 4: Player.iq = min(Player.iq-1,Player.maxiq-1); break;
      case 5: Player.pow = min(Player.pow-1,Player.maxpow-1); break;
    }
  }
  else if (blessing == 0) {
    mprint("You feel a warm tingle!");
    switch(random_range(6)) {
      case 0: Player.str = max(Player.str+1,Player.maxstr+1); break;
      case 1: Player.con = max(Player.con+1,Player.maxcon+1); break;
      case 2: Player.dex = max(Player.dex+1,Player.maxdex+1); break;
      case 3: Player.agi = max(Player.agi+1,Player.maxagi+1); break;
      case 4: Player.iq = max(Player.iq+1,Player.maxiq+1); break;
      case 5: Player.pow = max(Player.pow+1,Player.maxpow+1); break;
    }
  }
  else {
    mprint("You feel a hot flash!");
    Player.str = max(Player.str+1,Player.maxstr+1);
    Player.con = max(Player.con+1,Player.maxcon+1);
    Player.dex = max(Player.dex+1,Player.maxdex+1);
    Player.agi = max(Player.agi+1,Player.maxagi+1);
    Player.iq = max(Player.iq+1,Player.maxiq+1);
    Player.pow = max(Player.pow+1,Player.maxpow+1);
  }
  calc_melee();
}
示例#7
0
void i_stim(pob o)
{
    mprint("You feel Hyper!");
    i_speed(o);
    Player.str +=3;
    Player.con -=1;
    calc_melee();
}
示例#8
0
void identify(int blessing)
{
    int index;

    clearmsg();

    if (blessing == 0) {
        index = getitem_prompt("Identify: ", NULL_ITEM);
        if (index == CASHVALUE) print3("Your money is really money.");
        else if (index == ABORT)
            State.setSkipMonsters();
        else {
            if (Player.possessions[index]->objchar == FOOD)
                Player.possessions[index]->known = 1;
            else {
                Player.possessions[index]->known = 2;
                Objects[Player.possessions[index]->id].known = 1;
            }
            print1("Identified: ");
            mprint(itemid(Player.possessions[index]));
        }
    }
    else if (blessing < 0) {
        print2("You feel forgetful.");
        for (index=0; index<MAXITEMS; index++)
            if (Player.possessions[index] != NULL) {
                Player.possessions[index]->known = 0;
                Objects[Player.possessions[index]->id].known = 0;
            }
    }
    else {
        print2("You feel encyclopaedic.");
        for (index=0; index<MAXITEMS; index++)
            if (Player.possessions[index] != NULL) {
                if (Player.possessions[index]->objchar == FOOD)
                    Player.possessions[index]->known = 1;
                else {
                    Player.possessions[index]->known = 2;
                    Objects[Player.possessions[index]->id].known = 1;
                }
            }
        for (index=0; index<Player.packptr; index++)
            if (Player.pack[index] != NULL) {
                if (Player.pack[index]->objchar == FOOD)
                    Player.pack[index]->known = 1;
                else {
                    Player.pack[index]->known = 2;
                    Objects[Player.pack[index]->id].known = 1;
                }
            }
    }
    calc_melee();
}
示例#9
0
void i_perm_hero(pob o)
{
    if (o->known < 1) o->known = 1;
    Objects[o->id].known = 1;
    if (o->used) {
        if (o->blessing > -1) {
            Player.status[HERO] += 1500;
            calc_melee();
            mprint("You feel super!");
        }
        else {
            Player.status[HERO] = 0;
            calc_melee();
            if (! Player.immunity[FEAR]) {
                Player.status[AFRAID]+=1500;
                mprint("You feel cowardly....");
            }
        }
    }
    else {
        if (o->blessing > -1) {
            Player.status[HERO] -= 1500;
            if (Player.status[HERO] < 1) {
                calc_melee();
                mprint("You feel less super now.");
                Player.status[HERO] = 0;
            }
        }
        else {
            Player.status[AFRAID] -= 1500;
            if (Player.status[AFRAID] < 1) {
                mprint("You finally conquer your fear.");
                Player.status[AFRAID] = 0;
            }
        }
    }
}
示例#10
0
void i_perm_protection(pob o)
{
    if (o->used) {
        if (o->blessing > -1)
            Player.status[PROTECTION] += abs(o->plus)+1;
        else
            Player.status[PROTECTION] -= abs(o->plus)+1;
    }
    else {
        if (o->blessing > -1)
            Player.status[PROTECTION] -= abs(o->plus)+1;
        else
            Player.status[PROTECTION] += abs(o->plus)+1;
    }
    calc_melee();
}
示例#11
0
void i_perm_accuracy(pob o)
{
    if (o->known < 1) o->known = 1;
    Objects[o->id].known = 1;
    if ((o->used) && (o->blessing > -1)) {
        Player.status[ACCURATE] += 1500;
        mprint("You feel skillful and see bulls' eyes everywhere.");
    }
    else {
        Player.status[ACCURATE] -= 1500;
        if (Player.status[ACCURATE] < 1) {
            Player.status[ACCURATE] = 0;
            calc_melee();
            mprint("Your vision blurs....");
        }
    }
}
示例#12
0
void i_perm_agility(pob o)
{
    if (o->known < 1) o->known = 2;
    Objects[o->id].known = 1;
    if (o->used) {
        if (o->blessing > -1)
            Player.agi += abs(o->plus)+1;
        else
            Player.agi -= abs(o->plus)+1;
    }
    else {
        if (o->blessing > -1)
            Player.agi -= abs(o->plus)+1;
        else
            Player.agi += abs(o->plus)+1;
    }
    calc_melee();
}
示例#13
0
文件: itemf2.c 项目: anylonen/omega
void i_perm_strength(pob o)
{
  if (o->known < 1) o->known = 1;
  Objects[o->id].known = 1;
  if (o->used){
    if (o->blessing > -1)
      Player.str += abs(o->plus)+1;
    else
      Player.str -= abs(o->plus)+1;
  }
  else {
    if (o->blessing > -1)
      Player.str -= abs(o->plus)+1;
    else
      Player.str += abs(o->plus)+1;
  }
  calc_melee();
}
示例#14
0
文件: effect2.c 项目: anylonen/omega
void recover_stat(int blessing)
{
  if (blessing < 0) {
    mprint("You feel a cold surge!");
    switch(random_range(6)) {
      case 0: Player.str = min(Player.str-1,Player.maxstr-1); break;
      case 1: Player.con = min(Player.con-1,Player.maxcon-1); break;
      case 2: Player.dex = min(Player.dex-1,Player.maxdex-1); break;
      case 3: Player.agi = min(Player.agi-1,Player.maxagi-1); break;
      case 4: Player.iq = min(Player.iq-1,Player.maxiq-1); break;
      case 5: Player.pow = min(Player.pow-1,Player.maxpow-1); break;
    }
  }
  else {
    mprint("You feel a warm tingle!");
    Player.str = max(Player.str,Player.maxstr);
    Player.con = max(Player.con,Player.maxcon);
    Player.dex = max(Player.dex,Player.maxdex);
    Player.agi = max(Player.agi,Player.maxagi);
    Player.iq = max(Player.iq,Player.maxiq);
    Player.pow = max(Player.pow,Player.maxpow);
    }
  calc_melee();
}
示例#15
0
文件: char.c 项目: DavidKinder/Omega
/* set player to begin with */
void initplayer()
{
  int i;
  int oldchar=FALSE;
  FILE *fd;
  char *lname;
#if !defined(MSDOS) && !defined(_WIN32)
  struct passwd *dastuff;
#endif

  lname = getlogin();
#if !defined(MSDOS) && !defined(_WIN32)
  if (!lname || strlen(lname) == 0)
  {
       dastuff = getpwuid(getuid());
       lname = dastuff->pw_name;
  }
#endif
  strcpy(Player.name,lname);
  if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
       Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
  Player.itemweight = 0;
  Player.food = 36; 
  Player.packptr = 0;
  Behavior = -1;
  Player.options = 0;
  for (i=0;i<MAXITEMS;i++)
    Player.possessions[i] = NULL;
  for (i=0;i<MAXPACK;i++)
    Player.pack[i] = NULL;
  for (i=0;i<NUMIMMUNITIES;i++) Player.immunity[i] = 0;
  for (i=0;i<NUMSTATI;i++) Player.status[i] = 0;
  for (i=0;i<NUMRANKS;i++) {
    Player.rank[i] = 0;
    Player.guildxp[i] = 0;
  }
  Player.patron = 0;
  Player.alignment = 0;
  Player.cash = 250;
  change_to_user_perms();
  if ((fd=omegarc_check())!=NULL) {
    fread((char *)&i,sizeof(int),1,fd);
    if (i != VERSION) {
#if defined(MSDOS) || defined(AMIGA) || defined(_WIN32)
      print1("Out of date omega.rc! Make another!");
#else
      print1("Out of date .omegarc! Make another!");
#endif
      morewait();
    }
    else {
      oldchar = TRUE;
      fread((char *)&Player,sizeof(Player),1,fd);
      fread((char *)&Searchnum,sizeof(int),1,fd);
      fread((char *)&Verbosity,sizeof(char),1,fd);
      strcpy(Player.name,lname);
      if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
	   Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
    }
    fclose(fd);
  }
  change_to_game_perms();
  if (! oldchar) {
    optionset(RUNSTOP);
    optionset(CONFIRM);
#ifdef COMPRESS_SAVE_FILES
    optionset(COMPRESS_OPTION);
#endif
#if defined(MSDOS) || defined(AMIGA) || defined(_WIN32)
    optionset(SHOW_COLOUR);
#endif
    initstats();
  }
  Searchnum = max(1,min(9,Searchnum));
  Player.hp = Player.maxhp = Player.maxcon;
  Player.mana = Player.maxmana = calcmana();
  Player.click = 1;
  strcpy(Player.meleestr,"CCBC");
  calc_melee();
  ScreenOffset = -1000;	/* to force a redraw */
}
示例#16
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();
    }
}
示例#17
0
文件: move.c 项目: anylonen/omega
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);
}
示例#18
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();
}
示例#19
0
文件: move.c 项目: anylonen/omega
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();
      }
    }
  }
}
示例#20
0
文件: aux2.c 项目: anylonen/omega
/* values over 1000 indicate a permanent effect */
void tenminute_status_check(void)
{
  if ((Player.status[SHADOWFORM]>0) && (Player.status[SHADOWFORM]<1000)) {
    Player.status[SHADOWFORM]--;
    if (Player.status[SHADOWFORM] == 0) {
      Player.immunity[NORMAL_DAMAGE]--;
      Player.immunity[ACID]--;
      Player.immunity[THEFT]--;
      Player.immunity[INFECTION]--;
      mprint("You feel less shadowy now.");
    }
  }

  if ((Player.status[ILLUMINATION]>0) && (Player.status[ILLUMINATION]<1000)) {
    Player.status[ILLUMINATION]--;
    if (Player.status[ILLUMINATION] == 0) {
      mprint("Your light goes out!");
    }
  }


  if ((Player.status[VULNERABLE]>0) && (Player.status[VULNERABLE]<1000)){
    Player.status[VULNERABLE]--;
    if (Player.status[VULNERABLE] == 0)
      mprint("You feel less endangered.");
  }


  if ((Player.status[DEFLECTION]>0) && (Player.status[DEFLECTION]<1000)){
    Player.status[DEFLECTION]--;
    if (Player.status[DEFLECTION] == 0)
      mprint("You feel less well defended.");
  }

  if ((Player.status[ACCURATE]>0) && (Player.status[ACCURACY]<1000)){
    Player.status[ACCURATE]--;
    if (Player.status[ACCURATE] == 0) {
      calc_melee();
      mprint("The bulls' eyes go away.");
    }
  }
  if ((Player.status[HERO]>0) && (Player.status[HERO]<1000)){
    Player.status[HERO]--;
    if (Player.status[HERO] == 0) {
      calc_melee();
      mprint("You feel less than super.");
    }
  }

  if ((Player.status[LEVITATING]>0) && (Player.status[LEVITATING]<1000)){
    Player.status[LEVITATING]--;
    if (Player.status[LEVITATING] == 0)
      mprint("You're no longer walking on air.");
  }

  if (Player.status[DISEASED]>0) {
    Player.status[DISEASED]--;
    if (Player.status[DISEASED] == 0) {
      showflags();
      mprint("You feel better now.");
    }
  }


  if ((Player.status[INVISIBLE] > 0) && (Player.status[INVISIBLE]<1000)){
    Player.status[INVISIBLE]--;
    if (Player.status[INVISIBLE] == 0)
      mprint("You feel more opaque now.");
  }

  if ((Player.status[BLINDED]>0) && (Player.status[BLINDED]<1000)) {
    Player.status[BLINDED]--;
    if (Player.status[BLINDED] == 0) 
      mprint("You can see again.");
  }

  if ((Player.status[TRUESIGHT]>0) && (Player.status[TRUESIGHT]<1000)) {
    Player.status[TRUESIGHT]--;
    if (Player.status[TRUESIGHT] == 0) 
      mprint("You feel less keen now.");
  }

  if ((Player.status[BERSERK]>0) && (Player.status[BERSERK]<1000)) {
    Player.status[BERSERK]--;
    if (Player.status[BERSERK] == 0) 
      mprint("You stop foaming at the mouth.");
  }

  if ((Player.status[ALERT]>0) && (Player.status[ALERT] < 1000)) {
    Player.status[ALERT]--;
    if (Player.status[ALERT] == 0) 
      mprint("You feel less alert now.");
  }

  if ((Player.status[BREATHING]>0) && (Player.status[BREATHING] < 1000)) {
    Player.status[BREATHING]--;
    if (Player.status[BREATHING] == 0) 
      mprint("You feel somewhat congested."); 
  }

  if ((Player.status[DISPLACED]>0) && (Player.status[DISPLACED] < 1000)) {
    Player.status[DISPLACED]--;
    if (Player.status[DISPLACED]==0) 
      mprint("You feel a sense of position.");
  }
  timeprint();
  dataprint();
}
示例#21
0
文件: aux2.c 项目: anylonen/omega
/* A value over 1000 indicates a permanent effect */
void minute_status_check(void)
{
  int i;

  if (Player.status[HASTED]>0) {
    if (Player.status[HASTED] < 1000) {
      Player.status[HASTED]--;
      if (Player.status[HASTED]==0) {
	mprint("The world speeds up.");
	calc_melee();
      }
    }
  }


  if (Player.status[POISONED]>0) {
    Player.status[POISONED]--;
    p_damage(3,POISON,"poison");
    if (Player.status[POISONED] == 0) {
      showflags();
      mprint("You feel better now.");
    }
  }


  if (Player.immunity[UNSTOPPABLE]>0) {
    for(i=0;i<NUMIMMUNITIES;i++)
    Player.immunity[i]--;
    if (Player.immunity[UNSTOPPABLE]==1)
      mprint("You feel vincible again.");
  }


  if (Player.status[IMMOBILE]>0) {
    Player.status[IMMOBILE]--;
    if (Player.status[IMMOBILE] == 0) 
      mprint("You can move again.");
  }


  if (Player.status[SLEPT]>0) {
    Player.status[SLEPT]--;
    if (Player.status[SLEPT] == 0) {
      mprint("You woke up.");
    }
  }

  if (Player.status[REGENERATING]>0) {
    if ((Player.hp < Player.maxhp) && (Player.mana > 0)){
      Player.hp++;
      Player.mana--;
      dataprint();
    }
    if (Player.status[REGENERATING] < 1000) {
      Player.status[REGENERATING]--;
      if (Player.status[REGENERATING] == 0) {
	mprint("You feel less homeostatic.");
      }
    }
  }

  if (Player.status[SLOWED]>0) {
    if (Player.status[SLOWED] < 1000) {
      Player.status[SLOWED]--;
      if (Player.status[SLOWED] == 0) {
	mprint("You feel quicker now.");
	calc_melee();
      }
    }
  }

  if (Player.status[RETURNING]>0) {
    Player.status[RETURNING]--;
    if (Player.status[RETURNING] == 10)
      mprint("Your return spell slowly hums towards activation...");
    else if (Player.status[RETURNING] == 8)
      mprint("There is an electric tension in the air!");
    else if (Player.status[RETURNING] == 5)
      mprint("A vortex of mana begins to form around you!");
    else if (Player.status[RETURNING] == 1)
      mprint("Your surroundings start to warp and fade!");
    if (Player.status[RETURNING] == 0)
      level_return();
  }
  
  if (Player.status[AFRAID]>0) {
    if (Player.status[AFRAID] < 1000) {
      Player.status[AFRAID]--;
      if (Player.status[AFRAID] == 0) {
	mprint("You feel bolder now.");
      }
    }
  }
  
}
示例#22
0
void m_death(struct monster *m)
{
    pob corpse;
    pml ml;
    int x;
    int y;
    int found = FALSE;
    m->hp = -1;

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

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

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

    m_dropstuff(m);

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

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

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

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

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

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

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

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

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

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

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

            break;
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    /* 
                     * Will cause order to be destroyed if no guards or justiciar
                     */
                    alert_guards();
                }
                else {
                    mprint("A Servant of Chaos materializes, grabs the corpse,");
                    mprint("snickers a bit, and vanishes.");
                }
            }
            
            break;
        case ML0 + 3: /* Guard */
            Player.alignment -= 10;
            
            if((Current_Environment == E_CITY)
               || (Current_Environment == E_VILLAGE)) {
                alert_guards();
            }
            
            break;
        case ML3 + 5: /* Goblin king */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("You seem to hear a woman's voice from far off:");
                mprint("\'Well don! Come to me now...\'");
            }
            
            setgamestatus(COMPLETED_CAVES);
            
            break;
        case ML7 + 5: /* Great worm */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("A female voice sounds from just behind your ear:");
                mprint("\'Well fought! I have some new advice for you...\'");
            }
            
            setgamestatus(COMPLETED_SEWERS);
            
            break;
        case ML10 + 1:
            setgamestatus(KILLED_EATER);
            
            break;
        case ML10 + 2:
            setgamestatus(KILLED_LAWBRINGER);
            
            break;
        case ML10 + 3:
            setgamestatus(KILLED_DRAGONLORD);
            
            break;
        case ML10 + 4:
            setgamestatus(COMPLETED_VOLCANO);
            
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("You feel a soft touch on your shoulder...");
                mprint("You turn around but there is no one there!");
                mprint("You turn back and see a not: \'See me soon.\'");
                mprint("The note vanishes in a burst of blue fire!");
            }
            
            break;
        case ML10 + 9: /* Elemental master */
            if(!gamestatusp(ATTACKED_ORACLE)) {
                mprint("Words appear before you, traced in blue flame!");
                mprint("\'Return to the Prime Plane via the Circle of Sorcerors...");
            }
            
            break;
        }
    }
    
    dodrawspot(m->x, m->y);
}
示例#23
0
文件: char.cpp 项目: cwc/OmegaRPG
/* set player to begin with */
bool initplayer(void)
{
    int i;
    int oldchar=false;
    FILE *fd;
    char *lname;
    int ret_value = false;

    lname = getlogin();

#if !defined(WIN32)
    // Get the login name if getlogin() failed
    if (!lname || strlen(lname) == 0)
    {
        struct passwd *dastuff;

        dastuff = getpwuid(getuid());
        lname = dastuff->pw_name;
    }
#endif

    strcpy(Player.name,lname);
    if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
        Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
    Player.itemweight = 0;
    Player.food = 36;
    Player.packptr = 0;
    Behavior = -1;
    Player.options = 0;
    for (i=0; i<MAXITEMS; i++)
        Player.possessions[i] = NULL;
    for (i=0; i<MAXPACK; i++)
        Player.pack[i] = NULL;
    for (i=0; i<NUMIMMUNITIES; i++) Player.immunity[i] = 0;
    for (i=0; i<NUMSTATI; i++) Player.status[i] = 0;
    for (i=0; i<NUMRANKS; i++) {
        Player.rank[i] = 0;
        Player.guildxp[i] = 0;
    }
    Player.patron = 0;
    Player.alignment = 0;
    Player.cash = 250;
    change_to_user_perms();
    if ((fd=omegarc_check())!=NULL) {
        fread((char *)&i,sizeof(int),1,fd);
        if (i != VERSION) {
            print1("Out of date .omegarc! Make another!");
            morewait();
        }
        else {
            oldchar = true;
            fread((char *)&Player,sizeof(Player),1,fd);
            fread((char *)&Searchnum,sizeof(int),1,fd);
            fread((char *)&Verbosity,sizeof(char),1,fd);
            strcpy(Player.name,lname);
            if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
                Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
        }
        fclose(fd);
    }
    change_to_game_perms();

    // Zop: initstats() can load a save file, so this block needs to precede the function
    /* DAG - put the code back in the same place, rather than duplicating */
    Searchnum = max(1,min(9,Searchnum));
    Player.hp = Player.maxhp = Player.maxcon;
    Player.mana = Player.maxmana = calcmana();
    Player.click = 1;
    strcpy(Player.combatManeuvers,"CCBC");
    calc_melee();
    ScreenOffset = -1000;	/* to force a redraw */

    if (! oldchar) {
        optionset(RUNSTOP);
        optionset(CONFIRM);
        optionset(SHOW_COLOUR);
        ret_value = initstats() ; /* RM 04-19-2000:loading patch */ /* DAG */
    }

    return ret_value > 0; /* RM 04-19-2000: loading patch */ /* DAG */
}
示例#24
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);
                }
            }
        }
    }
}
示例#25
0
int main(int argc, char *argv[])
{
  int continuing = 0;
  int count;
  int scores_only = 0;
  int i;

#ifndef NOGETOPT
  while(( i= getopt( argc, argv, "dsh")) != -1)
  {
     switch (i)
     {
       case 'd':
#ifdef DEBUG
         DG_debug_flag++;
#endif
         break;
       case 's':
         scores_only = 1;
         break;
       case 'h':
#ifdef DEBUG
         printf("Usage: omega [-shd] [savefile]\n");
#else
         printf("Usage: omega [-sh] [savefile]\n");
#endif
         printf("Options:\n");
         printf("  -s  Display high score list\n");
         printf("  -h  Display this message\n");
#ifdef DEBUG
         printf("  -d  Enable debug mode\n");
#endif
         exit(0);
         break;
       case '?':
         /* error parsing args... ignore? */
         printf("'%c' is an invalid option, ignoring\n", optopt );
         break;
     }
  }

  if (optind >= argc ) {
    /* no save file given */
#if defined( BSD ) || defined( SYSV )
    sprintf( SaveFileName, "Omega%d", getuid() );
#else
    strcpy( SaveFileName,"Omega");
#endif
  } else {
    /* savefile given */
    continuing = 1;
    strcpy(SaveFileName,argv[optind]);
  }

#else 
  /* alternate code for people who don't support getopt() -- no enhancement */
  if (argc ==2) {
    strcpy( SaveFileName, argv[1]);
    continuing = 1;
  } else {
    strcpy( SaveFileName,"Omega");
  }
#endif

  /* always catch ^c and hang-up signals */

#ifdef SIGINT
  signal(SIGINT,signalquit);
#endif
#ifdef SIGHUP
  signal(SIGHUP,signalsave);
#endif

#ifndef MSDOS
  if (CATCH_SIGNALS) {
    signal(SIGQUIT,signalexit);
    signal(SIGILL,signalexit);
#ifdef DEBUG
    if( DG_debug_flag ) {
#endif
    signal(SIGTRAP,signalexit);
    signal(SIGFPE,signalexit);
    signal(SIGSEGV,signalexit);
#ifdef DEBUG
    }
#endif
#ifdef SIGIOT
    signal(SIGIOT,signalexit);
#endif
#ifdef SIGABRT
    signal(SIGABRT,signalexit);
#endif
#ifdef SIGEMT
    signal(SIGEMT,signalexit);
#endif
#ifdef SIGBUS
    signal(SIGBUS,signalexit);
#endif
#ifdef SIGSYS
    signal(SIGSYS,signalexit);
#endif
    }
#endif

#ifndef FIXED_OMEGALIB
  if (!(Omegalib = getenv("OMEGALIB")))
#endif
    Omegalib = OMEGALIB;

  /* if filecheck is 0, some necessary data files are missing */
  if (filecheck() == 0) exit(0);

  /* all kinds of initialization */
  init_perms();
  initgraf();
#ifndef MSDOS_SUPPORTED_ANTIQUE
  initdirs();
#endif
  initrand(E_RANDOM, 0);
  initspells();

#ifdef DEBUG
  /* initialize debug log file */
  DG_debug_log = fopen( "/tmp/omega_dbg_log", "a" );
  assert( DG_debug_log ); /* WDT :) */
  setvbuf( DG_debug_log, NULL, _IOLBF, 0);
  fprintf(DG_debug_log, "##############  new game started ##############\n");
#endif

  for (count = 0; count < STRING_BUFFER_SIZE; count++)
    strcpy(Stringbuffer[count],"<nothing>");

#ifdef SAVE_LEVELS
  msdos_init();
#endif

  omega_title();
  showscores();

  if (scores_only ) {
    endgraf();
    exit(0);
  }

  /* game restore attempts to restore game if there is an argument */
  if (continuing) 
  {
     game_restore(SaveFileName);
     mprint("Your adventure continues....");
  }
  else
  {
    /* monsters initialized in game_restore if game is being restored */  
    /* items initialized in game_restore if game is being restored */
    inititem(TRUE);
    Date = random_range(360);
    Phase = random_range(24);
#ifdef NEW_BANK
    bank_init();
#else
    strcpy(Password,"");
#endif
    continuing = initplayer(); /* RM: 04-19-2000 loading patch */
  }
  if (!continuing)
  {
    init_world();  /* RM: 04-19-2000 loading patch */
    mprint("'?' for help or commandlist, 'Q' to quit.");
  }

  timeprint();
  calc_melee();
  if (Current_Environment != E_COUNTRYSIDE)
    showroom(Level->site[Player.x][Player.y].roomnumber);
  else
    terrain_check(FALSE);
  
  if (optionp(SHOW_COLOUR))
    colour_on();
  else
    colour_off();

  screencheck(Player.x,Player.y);

 /* game cycle */
  if (!continuing)
    time_clock(TRUE);
  while (TRUE) {
    if (Current_Environment == E_COUNTRYSIDE)
      p_country_process();
    else time_clock(FALSE);
  }
}
示例#26
0
/* various kinds of wishes */
void wish(int blessing)
{
    int i;
    char wishstr[80];
    clearmsg();
    print1("What do you wish for? ");
    if (blessing < 0)
        deathprint();
    else
        strcpy(wishstr,msgscanstring());
    if (blessing < 0 || strcmp(wishstr,"Death")==0) {
        print2("As you wish, so shall it be.");
        p_death("a deathwish");
    }
    if (strcmp(wishstr,"Power")==0) {
        print2("You feel a sudden surge of energy");
        Player.mana=calcmana()*10;
    }
    else if (strcmp(wishstr,"Skill")==0) {
        print2("You feel more competent.");
        if (gamestatusp(CHEATED))
            gain_experience(10000);
        else
            gain_experience(min(10000,Player.xp));
    }
    else if (strcmp(wishstr,"Wealth")==0) {
        print2("You are submerged in shower of gold pieces!");
        Player.cash += 10000;
    }
    else if (strcmp(wishstr,"Balance")==0) {
        print2("You feel neutral.");
        Player.alignment = 0;
    }
    else if (strcmp(wishstr,"Chaos")==0) {
        print2("You feel chaotic.");
        Player.alignment -= 25;
    }
    else if (strcmp(wishstr,"Law")==0) {
        print2("You feel lawful.");
        Player.alignment += 25;
    }
    else if (strcmp(wishstr,"Location")==0)
        strategic_teleport(1);
    else if (strcmp(wishstr,"Knowledge")==0) {
        print2("You feel more knowledgeable.");
        i = random_range(NUMSPELLS);
        if (Spells[i].known)
            Spells[i].powerdrain =
                (max(1,Spells[i].powerdrain/2));
        else Spells[i].known = TRUE;
    }
    else if (strcmp(wishstr,"Health")==0) {
        print2("You feel vigorous");
        Player.hp = max( Player.hp, Player.maxhp);
        Player.status[DISEASED] = 0;
        Player.status[POISONED] = 0;
        Player.food = 43;
        /* Wish for Health when starving does some good. PGM */
    }
    else if (strcmp(wishstr,"Destruction")==0)
        annihilate(gamestatusp(CHEATED));
    else if (strcmp(wishstr,"Acquisition")==0)
        acquire(gamestatusp(CHEATED));
    else if (strcmp(wishstr,"Summoning")==0)
        summon(gamestatusp(CHEATED),-1);
    else if (strcmp(wishstr,"Stats") == 0 && gamestatusp(CHEATED))
    {
        Player.str = Player.maxstr = Player.con = Player.maxcon =
                                         Player.agi = Player.maxagi = Player.dex = Player.maxdex =
                                                 Player.iq = Player.maxiq = Player.pow = Player.maxpow = 200;
        calc_melee();
    }
    else print2("You feel stupid.");
    dataprint();
    showflags();
}
示例#27
0
文件: guild2.c 项目: anylonen/omega
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();
}