예제 #1
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();
}
예제 #2
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);
        }
    }
}
예제 #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 l_adept(void)
{
    print1("You see a giant shimmering gate in the form of an omega.");
    if (! gamestatusp(ATTACKED_ORACLE)) {
        if (Player.str+Player.con+Player.iq+Player.pow < 100)
            print2("A familiar female voice says: I would not advise this now....");
        else print2("A familiar female voice says: Go for it!");
    }
    morewait();
    clearmsg();
    if (cinema_confirm("You're about to step into the mystic portal.")!='y') {
        if (Player.level > 100) {
            print1("The Lords of Destiny spurn your cowardice and indecision...");
            Player.xp = 0;
            Player.level = 0;
            Player.hp = Player.maxhp = Player.con;
            Player.mana = calcmana();
            print2("You suddenly feel very inexperienced.");
            dataprint();
            morewait();
            clearmsg();
        }
        print1("You edge away from the challenge.");
    }
    else {
        clearmsg();
        print1("You pass through the portal.");
        morewait();
        drawomega();
        print1("Like wow man! Colors! ");
        if (Player.patron != DESTINY) {
            print2("Strange forces try to tear you apart!");
            p_damage(random_range(200),UNSTOPPABLE,"a vortex of chaos");
        }
        else print2("Some strange force shields you from a chaos vortex!");
        morewait();
        print1("Your head spins for a moment....");
        print2("and clears....");
        morewait();
        Player.hp = Player.maxhp;
        Player.mana = calcmana();
        change_environment(E_ABYSS);
    }
}
예제 #5
0
파일: move.c 프로젝트: anylonen/omega
void l_chaos(void)
{
  if (gamestatusp(MOUNTED)) {
    print1("Your steed tries to swim in the raw Chaos, but seems to");
    print2("be having some difficulties...");
    morewait();
    print1("probably because it's just turned into a chaffinch.");
    morewait();
    resetgamestatus(MOUNTED);
  }
  if (! onewithchaos)
    print1("You are immersed in raw Chaos....");
  if (Player.rank[ADEPT]) {
    if (! onewithchaos)
    {
      onewithchaos = 1;
      print2("You achieve oneness of Chaos....");
    }
    Player.mana = max(Player.mana,calcmana());
    Player.hp = max(Player.hp, Player.maxhp);
  }
  else if (onewithchaos) /* adept that gets amnesia from chaos storm */
  {
    print2("The chaos sea doesn't seem to bother you at all.");
  }
  else if (Player.rank[PRIESTHOOD] && (! saved)) {
    print2("A mysterious force protects you from the Chaos!");
    print3("Wow.... You feel a bit smug.");
    gain_experience(500);
    saved = TRUE;
  }
  else {
    print2("Uh oh....");
    if (saved) nprint2("Nothing mysterious happens this time....");
    morewait();
    print1("Congratulations! You've achieved maximal entropy!");
    Player.alignment -= 50;
    gain_experience(1000);
    p_death("immersion in raw Chaos");
  }
}
예제 #6
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 */
}
예제 #7
0
int check_sacrilege(int deity)
{
    int i;
    int sacrilege = FALSE;

    if((Player.patron != deity) && (Player.patron > 0)) {
        sacrilege = TRUE;
        --Player.pow;
        --Player.maxpow;

        switch(Player.patron) {
        case ODIN:
            print1("Odin notices your lack of faith!");
            morewait();

            if(deity == ATHENA) {
                print2("However, Athena intercedes on your behalf.");
                sacrilege = FALSE;
            }
            else {
                print2("You are struck by a thunderbolt!");
                p_damage(Player.level * 5, UNSTOPPABLE, "Odin's wrath");

                if(Player.hp > 0) {
                    morewait();
                    print2("The bolt warps your feeble frame...");
                    Player.maxcon = Player.maxcon / 2;
                    Player.con = min(Player.con, Player.maxcon);
                    Player.maxstr = Player.maxstr / 2;
                    Player.con = min(Player.str, Player.maxstr);
                }
            }

            morewait();

            break;
        case SET:
            print1("Set notices you lack of faith1");
            morewait();

            if(deity == HECATE) {
                print1("But since you pray to a friendly deity,");
                print2("Set decided not to punish you.");
                sacrilege = FALSE;
            }
            else {
                print2("You are blasted by a shaft of black fire!");
                p_damage(Player.level * 5, UNSTOPPABLE, "Set's anger");

                if(Player.hp > 0) {
                    morewait();
                    print1("You are wreathed in clouds of smoke.");

                    for(i = 0; i < MAXITEMS; ++i) {
                        if((Player.possessions[i] != NULL)
                           && (Player.possessions[i]->blessing > -1)) {
                            conform_lost_object(Player.possessions[i]);
                        }
                    }

                    morewait();
                    print2("You feel Set's Black Hand on your heart...");
                    Player.maxcon = Player.maxcon / 4;
                    Player.con = Player.maxcon;
                }
            }

            morewait();

            break;
        case HECATE:
            print1("Hecate notices your lack of faith!");
            morewait();

            if(deity == SET) {
                print1("But ignores the affront since she likes Set.");
                sacrilege = FALSE;
            }
            else {
                print1("You are zapped by dark moonbeams!");
                p_damage(Player.level * 5, UNSTOPPABLE, "Hecate's malice");

                if(Player.hp > 0) {
                    print2("The beams leach you of magical power!");
                    Player.maxpow = Player.maxpow / 5;
                    Player.pow = min(Player.pow, Player.maxpow);

                    for(i = 0; i < NUMSPELLS; ++i) {
                        Spells[i].known = FALSE;
                    }
                }
            }
            
            morewait();
            
            break;
        case ATHENA:
            print1("Athena notices your lack of faith!");
            morewait();

            if(deity == ODIN) {
                print2("But lets you off this time since Odin is also Lawful.");
                sacrilege = FALSE;
            }
            else {
                print2("You are zorched by godsfire!");

                if(Player.hp > 0) {
                    morewait();
                    print1("the fire burns away your worldly experience!");
                    Player.level = 0;
                    Player.xp = 0;
                    Player.hp = Player.con;
                    Player.maxhp = Player.hp;
                    print2("Your power is reduced by the blast!!!");
                    Player.maxpow = Player.maxpow / 3;
                    Player.pow = Player.maxpow;
                    Player.mana = min(Player.mana, calcmana());
                }
            }

            morewait();

            break;
        case DESTINY:
            print2("The Lords of Destiny ignore your lack of faith.");
            sacrilege = FALSE;
            morewait();

            break;
        case DRUID:
            print2("your treachery to the Archdruid has been noted.");

            if(random_range(2) == 1) {
                Player.alignment += 40;
            }
            else {
                Player.alignment -= 40;
            }

            morewait();

            break;
        }

        if(sacrilege) {
            Player.patron = 0;
            Player.rank[PRIESTHOOD] = 0;
        }
    }

    return sacrilege;
}
예제 #8
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();
}
예제 #9
0
파일: guild2.c 프로젝트: anylonen/omega
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();
}
예제 #10
0
void i_pow(pob o)
{
    mprint("You feel a surge of mystic power!");
    Player.mana = 2 * calcmana();
}
예제 #11
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);
}
예제 #12
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 */
}