예제 #1
0
파일: aux1.cpp 프로젝트: Geozop/OmegaRPG
/* checks current food status of player, every hour, and when food is eaten */
void foodcheck(void)
{
    if (Player.food > 48) {
        print3("You vomit up your huge meal.");
        Player.food = 12;
    }
    else if (Player.food == 30)
        print3("Time for a smackerel of something.");
    else if (Player.food == 20)
        print3("You feel hungry.");
    else if (Player.food == 12)
        print3("You are ravenously hungry.");
    else if (Player.food == 3) {
        print3("You feel weak.");
        if (State.getFastMove()) {
            drawvision(Player.x,Player.y);
            State.setFastMove(false);
        }
    }
    else if (Player.food < 0) {
        if (State.getFastMove()) {
            drawvision(Player.x,Player.y);
            State.setFastMove(false);
        }
        print3("You're starving!");
        p_damage(-5*Player.food,UNSTOPPABLE,"starvation");
    }
    showflags();
}
예제 #2
0
파일: parsedata.c 프로젝트: Alkzndr/freebsd
static void
debug_determinestyle(int dateonly, char *date, int flags, char *month,
    int imonth, char *dayofmonth, int idayofmonth, char *dayofweek,
    int idayofweek, char *modifieroffset, char *modifierindex, char *specialday,
    char *year, int iyear)
{

	if (dateonly != 0) {
		printf("-------\ndate: |%s|\n", date);
		if (dateonly == 1)
			return;
	}
	printf("flags: %x - %s\n", flags, showflags(flags));
	if (modifieroffset[0] != '\0')
		printf("modifieroffset: |%s|\n", modifieroffset);
	if (modifierindex[0] != '\0')
		printf("modifierindex: |%s|\n", modifierindex);
	if (year[0] != '\0')
		printf("year: |%s| (%d)\n", year, iyear);
	if (month[0] != '\0')
		printf("month: |%s| (%d)\n", month, imonth);
	if (dayofmonth[0] != '\0')
		printf("dayofmonth: |%s| (%d)\n", dayofmonth, idayofmonth);
	if (dayofweek[0] != '\0')
		printf("dayofweek: |%s| (%d)\n", dayofweek, idayofweek);
	if (specialday[0] != '\0')
		printf("specialday: |%s|\n", specialday);
}
예제 #3
0
void cureforpay(void)
{
    if (Player.cash < 250)
        print2("You can't afford to be cured!");
    else {
        Player.cash -= 250;
        Player.status[DISEASED] = 0;
        print2("Quarantine lifted....");
        showflags();
    }
}
예제 #4
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();
}
예제 #5
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.");
      }
    }
  }
  
}
예제 #6
0
파일: aux1.cpp 프로젝트: Geozop/OmegaRPG
/* This is to be called whenever anything might change player performance in
melee, such as changing weapon, statistics, etc. */
void calc_melee(void)
{
    calc_weight();

    Player.maxweight = (Player.str * Player.agi * 10);
    Player.absorption = Player.status[PROTECTION];
    Player.defense = 2 * statmod(Player.agi)+(Player.level/2);
    Player.hit = Player.level + statmod(Player.dex)+1;
    Player.dmg = statmod(Player.str)+3;
    Player.speed = 5 - min(4,(statmod(Player.agi)/2));
    if (Player.status[HASTED] > 0) Player.speed = Player.speed / 2;
    if (Player.status[SLOWED] > 0) Player.speed = Player.speed * 2;
    if (Player.itemweight > 0)
        switch(Player.maxweight / Player.itemweight) {
        case 0:
            Player.speed+=6;
            break;
        case 1:
            Player.speed+=3;
            break;
        case 2:
            Player.speed+=2;
            break;
        case 3:
            Player.speed+=1;
            break;
        }

    if (Player.status[ACCURATE]) Player.hit+=20;
    if (Player.status[HERO]) Player.hit+=Player.dex;
    if (Player.status[HERO]) Player.dmg+=Player.str;
    if (Player.status[HERO]) Player.defense+=Player.agi;
    if (Player.status[HERO]) Player.speed=Player.speed / 2;

    Player.speed = max(1,min(25,Player.speed));

    if (State.getMounted()) {
        Player.speed = 3;
        Player.hit += 10;
        Player.dmg += 10;
    }
    else if (Player.rank[MONKS] > 0)
    {
        /* monks are faster when not in armor or on horseback */
        if (Player.possessions[O_ARMOR] == NULL) {
            Player.speed += (min(0,(Player.rank[MONKS] -1)));
        }
    }

    /* weapon */
    /* have to check for used since it could be a 2h weapon just carried
    in one hand */
    if (Player.possessions[O_WEAPON_HAND] != NULL)
        if (Player.possessions[O_WEAPON_HAND]->used &&
                ((Player.possessions[O_WEAPON_HAND]->objchar==WEAPON)||
                 (Player.possessions[O_WEAPON_HAND]->objchar==MISSILEWEAPON))) {
            Player.hit +=
                Player.possessions[O_WEAPON_HAND]->hit +
                Player.possessions[O_WEAPON_HAND]->plus;
            Player.dmg +=
                Player.possessions[O_WEAPON_HAND]->dmg +
                Player.possessions[O_WEAPON_HAND]->plus;
        }

    if (Player.rank[MONKS] > 0)
    {
        /* monks */
        /* aren't monks just obscene? PGM */
        if (Player.possessions[O_WEAPON_HAND] == NULL) /*barehanded*/
        {
            /* all monks get a bonus in unarmed combat */
            Player.hit += ( Player.rank[MONKS] * Player.level );
            Player.dmg += ( Player.rank[MONKS] * Player.level );
            Player.defense += ( Player.rank[MONKS] * Player.level );

            if (Player.rank[MONKS] == MONK_GRANDMASTER)
            {
                /* Grandmaster does 3x damage in unarmed combat. */
                Player.dmg *= 3;
            }
        }
    }

    /* shield or defensive weapon */
    if (Player.possessions[O_SHIELD] != NULL) {
        Player.defense +=
            Player.possessions[O_SHIELD]->aux +
            Player.possessions[O_SHIELD]->plus;
    }

    /* armor */
    if (Player.possessions[O_ARMOR] != NULL) {
        Player.absorption += Player.possessions[O_ARMOR]->dmg;
        Player.defense +=
            Player.possessions[O_ARMOR]->plus -
            Player.possessions[O_ARMOR]->aux;
    }

    if (strlen(Player.combatManeuvers) > 2*maneuvers())
        default_maneuvers();
    comwinprint();
    showflags();
    dataprint();
}
예제 #7
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();
}
예제 #8
0
파일: guild2.c 프로젝트: anylonen/omega
void l_order(void)
{
  pob newitem;
  pml ml;
  print1("The Headquarters of the Order of Paladins.");
  morewait();
  if ((Player.rank[ORDER]==PALADIN) &&
      (Player.level > Justiciarlevel) &&
      gamestatusp(GAVE_STARGEM) &&
      Player.alignment > 300) {
    print1("You have succeeded in your quest!");
    morewait();
    print1("The previous Justiciar steps down in your favor.");
    print2("You are now the Justiciar of Rampart and the Order!");
    strcpy(Justiciar,Player.name);
    for (ml = Level->mlist; ml && (ml->m->id != HISCORE_NPC ||
	ml->m->aux2 != 15); ml = ml->next)
      /* just scan for current Justicar */;
    if (ml) {
      m_remove(ml->m); /* signals "death" -- no credit to player, though */
    }
    Justiciarlevel = Player.level;
    morewait();
    Justiciarbehavior = fixnpc(4);
    save_hiscore_npc(15);
    clearmsg();
    print1("You are awarded a blessed shield of deflection!");
    morewait();
    newitem = ((pob) checkmalloc(sizeof(objtype)));
    *newitem = Objects[OB_DEFLECT]; /* shield of deflection */
    newitem->blessing = 9;
    gain_item(newitem);
    morewait();
    Player.rank[ORDER] = JUSTICIAR;
    Player.maxstr += 5;
    Player.str += 5;
    Player.maxpow += 5;
    Player.pow += 5;
  }
  if (Player.alignment < 1) {
    if (Player.rank[ORDER] > 0) {
      print1("You have been tainted by chaos!");
      print2("You are stripped of your rank in the Order!");
      morewait();
      Player.rank[ORDER]= -1;
      send_to_jail();
    }
    else
      print1("Get thee hence, minion of chaos!");
  }
  else if (Player.rank[ORDER] == -1)
    print1("Thou again?  Get thee hence, minion of chaos!");
  else if (Player.rank[ORDER] == 0) {
    if (Player.rank[ARENA] != 0) 
      print1("We do not accept bloodstained gladiators into our Order.");
    else if (Player.rank[LEGION] != 0) 
      print1("Go back to your barracks, mercenary!");
    else {
      print1("Dost thou wish to join our Order? [yn] ");
      if (ynq1()=='y') {
	print1("Justiciar ");
	nprint1(Justiciar);
	nprint1(" welcomes you to the Order.");
	print2("'Mayest thou always follow the sublime path of Law.'");
	morewait();
	print1("You are now a Gallant in the Order.");
	print2("You are given a horse and a blessed spear.");
	morewait();
	Player.rank[ORDER] = GALLANT;
	Player.guildxp[ORDER] = 1;
	setgamestatus(MOUNTED);
	newitem = ((pob) checkmalloc(sizeof(objtype)));
	*newitem = Objects[OB_SPEAR]; /* spear */
	newitem->blessing = 9;
	newitem->plus = 1;
	newitem->known = 2;
	gain_item(newitem);
      }
    }
  } else {
      print1("'Welcome back, Paladin.'");
      if (!gamestatusp(MOUNTED)) {
	print2("You are given a new steed.");
	setgamestatus(MOUNTED);
      }
      morewait();
      clearmsg();
      if ((Player.hp < Player.maxhp) || (Player.status[DISEASED]) ||
	(Player.status[POISONED]))
	print1("Your wounds are treated by a medic.");
      cleanse(0);
      Player.hp = Player.maxhp;
      if ( Player.food <= 40 )
      {
        Player.food = 40;
        print2("You get a hot meal from the refectory.");
      }
      morewait();
      clearmsg();
      if (Player.rank[ORDER]==PALADIN) {
	if (Player.level <= Justiciarlevel)
	  print2("You are not experienced enough to advance.");
	else if (Player.alignment < 300)
	  print2("You are not sufficiently Lawful as yet to advance.");
	else print2("You must give the Star Gem to the LawBringer.");
      }
      else if (Player.rank[ORDER]==CHEVALIER) {
	if (Player.guildxp[ORDER] < 4000)
	  print2("You are not experienced enough to advance.");
	else if (Player.alignment < 200)
	  print2("You are not sufficiently Lawful as yet to advance.");
	else {
	  print1("You are made a Paladin of the Order!");
	  print2("You learn the Spell of Heroism and get Mithril Plate!");
	  morewait();
	  newitem = ((pob) checkmalloc(sizeof(objtype)));
	  *newitem = Objects[OB_MITHRIL_PLATE]; /* mithril plate armor */
	  newitem->blessing = 9;
	  newitem->known = 2;
	  gain_item(newitem);
	  morewait();
	  clearmsg();
	  print1("To advance you must rescue the Star Gem and return it");
	  print2("to its owner, the LawBringer, who resides on Star Peak.");
	  morewait();
	  print1("The Star Gem was stolen by the cursed Prime Sorceror,");
	  print2("whose headquarters may be found beyond the Astral Plane.");
	  morewait();
	  print1("The Oracle will send you to the Astral Plane if you");
	  print2("prove yourself worthy to her.");
	  morewait();
	  Spells[S_HERO].known = TRUE;
	  Player.rank[ORDER] = PALADIN;
	}
      }
      else if (Player.rank[ORDER]==GUARDIAN) {
	if (Player.guildxp[ORDER] < 1500)
	  print2("You are not experienced enough to advance.");
	else if (Player.alignment < 125)
	  print2("You are not yet sufficiently Lawful to advance.");
	else {
	  Player.rank[ORDER] = CHEVALIER;
	  print1("You are made a Chevalier of the Order!");
	  print2("You are given a Mace of Disruption!");
	  morewait();
	  clearmsg();
	  newitem = ((pob) checkmalloc(sizeof(objtype)));
	  *newitem = Objects[OB_MACE_DISRUPT]; /* mace of disruption */
	  newitem->known = 2;
	  gain_item(newitem);
	}
      }
      else if (Player.rank[ORDER]==GALLANT) {
	if (Player.guildxp[ORDER] < 400)
	  print2("You are not experienced enough to advance.");
	else if (Player.alignment < 50)
	  print2("You are not Lawful enough to advance.");
	else  {
	  print1("You are made a Guardian of the Order of Paladins!");
	  print2("You are given a Holy Hand Grenade (of Antioch).");
	  morewait();
	  print1("You hear a nasal monotone in the distance....");
	  print2("'...and the number of thy counting shall be 3...'");
	  morewait();
	  clearmsg();
	  Player.rank[ORDER] = GUARDIAN;
	  newitem = ((pob) checkmalloc(sizeof(objtype)));
	  *newitem = Objects[OB_ANTIOCH]; /* holy hand grenade. */
	  newitem->known = 2;
	  gain_item(newitem);
	}
      }
  }
  showflags();
}
예제 #9
0
/*
 * routine:
 *	main
 *
 * purpose:
 *	argument processing and primary dispatch
 *
 * returns:
 *	error codes per filesync.1 (ERR_* in filesync.h)
 *
 * notes:
 *	read filesync.1 in order to understand the argument processing
 *
 *	most of the command line options just set some opt_ global
 *	variable that is later looked at by the code that actually
 *	implements the features.  Only file names are really processed
 *	in this routine.
 */
int
main(int argc, char **argv)
{	int i;
	int c;
	errmask_t errs = ERR_OK;
	int do_prune = 0;
	char *srcname = 0;
	char *dstname = 0;
	struct base *bp;

	/* keep the error messages simple	*/
	argv[0] = "filesync";

	/* gather together all of the options	*/
	while ((c = getopt(argc, argv, "AaehmnqvyD:E:r:s:d:f:o:")) != EOF)
		switch (c) {
			case 'a':	/* always scan for acls	*/
				opt_acls = TRUE;
				break;
			case 'e':	/* everything agrees	*/
				opt_everything = TRUE;
				break;
			case 'h':	/* halt on error	*/
				opt_halt = TRUE;
				break;
			case 'm':	/* preserve modtimes	*/
				opt_mtime = TRUE;
				break;
			case 'n':	/* notouch		*/
				opt_notouch = TRUE;
				break;
			case 'q':	/* quiet		*/
				opt_quiet = TRUE;
				break;
			case 'v':	/* verbose		*/
				opt_verbose = TRUE;
				break;
			case 'y':	/* yes			*/
				opt_yes = TRUE;
				break;
			case 'D':	/* debug options	*/
				if (!isdigit(optarg[0])) {
					dbg_usage();
					exit(ERR_INVAL);
				}
				opt_debug |= strtol(optarg, (char **)NULL, 0);
				break;

			case 'E':	/* error simulation	*/
				if (dbg_set_error(optarg)) {
					err_usage();
					exit(ERR_INVAL);
				}
				opt_errors = TRUE;
				break;

			case 'f':	/* force conflict resolution	*/
				switch (optarg[0]) {
					case 's':
						opt_force = OPT_SRC;
						break;
					case 'd':
						opt_force = OPT_DST;
						break;
					case 'o':
						opt_force = OPT_OLD;
						break;
					case 'n':
						opt_force = OPT_NEW;
						break;
					default:
						fprintf(stderr,
							gettext(ERR_badopt),
							c, optarg);
						errs |= ERR_INVAL;
						break;
				}
				break;

			case 'o':	/* one way propagation		*/
				switch (optarg[0]) {
					case 's':
						opt_oneway = OPT_SRC;
						break;
					case 'd':
						opt_oneway = OPT_DST;
						break;
					default:
						fprintf(stderr,
							gettext(ERR_badopt),
							c, optarg);
						errs |= ERR_INVAL;
						break;
				}
				break;

			case 'r':	/* restricted reconciliation	*/
				if (num_restrs < MAX_RLIST)
					rlist[ num_restrs++ ] = optarg;
				else {
					fprintf(stderr, gettext(ERR_tomany),
						MAX_RLIST);
					errs |= ERR_INVAL;
				}
				break;

			case 's':
				if ((srcname = qualify(optarg)) == 0)
					errs |= ERR_MISSING;
				break;

			case 'd':
				if ((dstname = qualify(optarg)) == 0)
					errs |= ERR_MISSING;
				break;

			default:
			case '?':
				errs |= ERR_INVAL;
				break;
		}

	if (opt_debug & DBG_MISC)
		fprintf(stderr, "MISC: DBG=%s\n", showflags(dbgmap, opt_debug));

	/* if we have file names, we need a source and destination */
	if (optind < argc) {
		if (srcname == 0) {
			fprintf(stderr, gettext(ERR_nosrc));
			errs |= ERR_INVAL;
		}
		if (dstname == 0) {
			fprintf(stderr, gettext(ERR_nodst));
			errs |= ERR_INVAL;
		}
	}

	/* check for simple usage errors	*/
	if (errs & ERR_INVAL) {
		usage();
		exit(errs);
	}

	/* locate our baseline and rules files	*/
	if (c = findfiles())
		exit(c);

	/* figure out file creation defaults	*/
	whoami();

	/* read in our initial baseline		*/
	if (!new_baseline && (c = read_baseline(file_base)))
		errs |= c;

	/* read in the rules file if we need or have rules	*/
	if (optind >= argc && new_rules) {
		fprintf(stderr, ERR_nonames);
		errs |= ERR_INVAL;
	} else if (!new_rules)
		errs |= read_rules(file_rules);

	/* if anything has failed with our setup, go no further	*/
	if (errs) {
		cleanup(errs);
		exit(errs);
	}

	/*
	 * figure out whether or not we are willing to do a one-sided
	 * analysis (where we don't even look at the other side.  This
	 * is an "I'm just curious what has changed" query, and we are
	 * only willing to do it if:
	 *	we aren't actually going to do anything
	 *	we have a baseline we can compare against
	 * otherwise, we are going to insist on being able to access
	 * both the source and destination.
	 */
	if (opt_notouch && !new_baseline)
		opt_onesided = opt_oneway;

	/*
	 * there are two interested usage scenarios:
	 *	file names specified
	 *		create new rules for the specified files
	 *		evaulate and reconcile only the specified files
	 *	no file names specified
	 *		use already existing rules
	 *		consider restricting them to specified subdirs/files
	 */
	if (optind < argc) {
		/* figure out what base pair we're working on	*/
		bp = add_base(srcname, dstname);

		/* perverse default rules to avoid trouble	*/
		if (new_rules) {
			errs |= add_ignore(0, SUFX_RULES);
			errs |= add_ignore(0, SUFX_BASE);
		}

		/* create include rules for each file/dir arg	*/
		while (optind < argc)
			errs |= add_include(bp, argv[ optind++ ]);

		/*
		 * evaluate the specified base on each side,
		 * being careful to limit evaulation to new rules
		 */
		errs |= evaluate(bp, OPT_SRC, TRUE);
		errs |= evaluate(bp, OPT_DST, TRUE);
	} else {
		/* note any possible evaluation restrictions	*/
		for (i = 0; i < num_restrs; i++)
			errs |= add_restr(rlist[i]);

		/*
		 * we can only prune the baseline file if we have done
		 * a complete (unrestricted) analysis.
		 */
		if (i == 0)
			do_prune = 1;

		/* evaulate each base on each side		*/
		for (bp = bases; bp; bp = bp->b_next) {
			errs |= evaluate(bp, OPT_SRC, FALSE);
			errs |= evaluate(bp, OPT_DST, FALSE);
		}
	}

	/* if anything serious happened, skip reconciliation	*/
	if (errs & ERR_FATAL) {
		cleanup(errs);
		exit(errs);
	}

	/* analyze and deal with the differenecs		*/
	errs |= analyze();

	/* see if there is any dead-wood in the baseline	*/
	if (do_prune) {
		c = prune();

		if (c > 0 && opt_verbose)
			fprintf(stdout, V_prunes, c);
	}

	/* print out a final summary				*/
	summary();

	/* update the rules and baseline files (if needed)	*/
	(void) umask(my_umask);
	errs |= write_baseline(file_base);
	errs |= write_rules(file_rules);

	if (opt_debug & DBG_MISC)
		fprintf(stderr, "MISC: EXIT=%s\n", showflags(errmap, errs));

	/* just returning ERR_RESOLVABLE upsets some people	*/
	if (errs == ERR_RESOLVABLE && !opt_notouch)
		errs = 0;

	/* all done	*/
	cleanup(0);
	return (errs);
}
예제 #10
0
void l_brothel(void)
{
    char response;
    print1("You come to a heavily reinforced inner door.");
    print2("A sign reads `The House of the Eclipse'");
    morewait();
    clearmsg();
    if (cinema_confirm("You are about to open the door.")=='y') {
        menuclear();
        menuprint("a:knock on the door.\n");
        menuprint("b:try to pick the lock.\n");
        menuprint("c:bash down the door.\n");
        menuprint("ESCAPE: Leave this house of ill repute.\n");
        showmenu();
        do
            response = menugetc();
        while ((response != 'a') &&
                (response != 'b') &&
                (response != 'c') &&
                (response != ESCAPE));
        xredraw();
        if (response == 'a') {
            if (!nighttime())
                print2("There is no reponse.");
            else {
                print1("A window opens in the door.");
                print2("`500Au, buddy. For the night.' pay it? [yn] ");
                if (ynq2()=='y') {
                    if (Player.cash < 500) {
                        print1("`What, no roll?!'");
                        print2("The bouncer bounces you a little and lets you go.");
                        p_damage(25,UNSTOPPABLE,"da bouncer");
                    }
                    else {
                        Player.cash -= 500;
                        print1("You are ushered into an opulently appointed hall.");
                        print2("After an expensive dinner (takeout from Les Crapuleux)");
                        morewait();
                        if (Player.preference == 'n') {
                            switch(random_range(4)) {
                            case 0:
                                print1("you spend the evening playing German Whist with");
                                break;
                            case 1:
                                print1("you spend the evening discussing philosophy with");
                                break;
                            case 2:
                                print1("you spend the evening playing chess against");
                                break;
                            case 3:
                                print1("you spend the evening telling your adventures to");
                            }
                            print2("various employees of the House of the Eclipse.");
                        }
                        else {
                            print1("you spend an enjoyable and educational evening with");
                            if (Player.preference == 'm' ||
                                    (Player.preference == 'y' && random_range(2)))
                                switch(random_range(4)) {
                                case 0:
                                    print2("Skarn the Insatiable, a satyr.");
                                    break;
                                case 1:
                                    print2("Dryden the Defanged, an incubus.");
                                    break;
                                case 2:
                                    print2("Gorgar the Equipped, a centaur.");
                                    break;
                                case 3:
                                    print2("Hieronymus, the mendicant priest of Eros.");
                                    break;
                                }
                            else switch(random_range(4)) {
                                case 0:
                                    print2("Noreen the Nymph (omaniac)");
                                    break;
                                case 1:
                                    print2("Angelface, a recanted succubus.");
                                    break;
                                case 2:
                                    print2("Corporal Sue of the City Guard (moonlighting).");
                                    break;
                                case 3:
                                    print2("Sheena the Queena the Jungle, a wereleopard.");
                                    break;
                                }
                        }
                        morewait();
                        if (hour() > 12) Time += ((24-hour())+8) * 60;
                        else {
                            Time += ((9-hour())*60);
                            Date++;
                        }
                        Player.food = 40;
                        Player.status[DISEASED] = 0;
                        Player.status[POISONED] = 0;
                        Player.hp = Player.maxhp;
                        /* reduce temporary stat gains to max stat levels */
                        toggle_item_use(TRUE);
                        Player.str = min(Player.str,Player.maxstr);
                        Player.con = min(Player.con,Player.maxcon);
                        Player.agi = min(Player.agi,Player.maxagi);
                        Player.dex = min(Player.dex,Player.maxdex);
                        Player.iq = min(Player.iq,Player.maxiq);
                        Player.pow = min(Player.pow,Player.maxpow);
                        toggle_item_use(FALSE);
                        if (Player.preference == 'n')
                            Player.iq++; /* whatever :-) */
                        else
                            Player.con++;
                        gain_experience(100);
                        timeprint();
                        dataprint();
                        showflags();
                        morewait();
                        clearmsg();
                        if (Player.preference == 'n')
                            print1("You arise refreshed the next morning...");
                        else
                            print1("You arise, tired but happy, the next morning...");
                    }
                }
                else print2("What are you, some kinda prude?");
            }
        }
        else if (response == 'b') {
            if (nighttime()) {
                print1("As you fumble at the lock, the door opens....");
                print2("The bouncer tosses you into the street.");
            }
            else print1("The door appears to be bolted and barred from behind.");
        }
        else if (response == 'c') {
            if (nighttime()) {
                print1("As you charge toward the door it opens....");
                print2("Yaaaaah! Thud!");
                morewait();
                print1("You run past the startled bouncer into a wall.");
                p_damage(20,UNSTOPPABLE,"a move worthy of Clouseau");
                print2("The bouncer tosses you into the street.");
            }
            else {
                print1("Ouch! The door resists your efforts.");
                p_damage(1,UNSTOPPABLE,"a sturdy door");
                morewait();
                print1("You hear an irritated voice from inside:");
                print2("'Keep it down out there! Some of us are trying to sleep!'");
            }
        }
    }
}