bool cJobManager::WorkBrothelStripper(Girl* girl, Brothel* brothel, int DayNight, std::string& summary)
{
    std::string message = "";
	if(Preprocessing(ACTION_SEX, girl, brothel, DayNight, summary, message))
		return true;

	// put that shit away, you'll scare off the customers!
	g_Girls.UnequipCombat(girl);

	g_Girls.UpdateEnjoyment(girl, ACTION_SEX, +3, true);
	u_int action = g_Dice%2;
	if(action == 0)
	{
		u_int n = 0;
		message += " she stripped for and ended up f*****g the customer as well, making them very happy.";
		sCustomer cust;
		GetMiscCustomer(brothel, cust);
		g_Girls.GirlFucks(girl, DayNight, &cust, false,message,n);
		brothel->m_Happiness += 100;
		int imageType = IMGTYPE_SEX;
		if(n == SKILL_ANAL)
			imageType = IMGTYPE_ANAL;
		else if(n == SKILL_BDSM)
			imageType = IMGTYPE_BDSM;
		else if(n == SKILL_NORMALSEX)
			imageType = IMGTYPE_SEX;
		else if(n == SKILL_BEASTIALITY)
			imageType = IMGTYPE_BEAST;
		else if(n == SKILL_GROUP)
			imageType = IMGTYPE_GROUP;
		else if(n == SKILL_LESBIAN)
			imageType = IMGTYPE_LESBIAN;
		g_Girls.UpdateTempStat(girl, STAT_LIBIDO, -4);

		// work out the pay between the house and the girl
		girl->m_Pay += g_Girls.GetStat(girl, STAT_ASKPRICE)+30;
		girl->m_Events.AddMessage(message, imageType, DayNight);
	}
	else if(action == 1)
	{
		message += " she stripped for a customer.";

		brothel->m_Happiness += (g_Dice%70)+30;

		// work out the pay between the house and the girl
		girl->m_Pay += g_Girls.GetStat(girl, STAT_ASKPRICE)+10;
		girl->m_Events.AddMessage(message, IMGTYPE_PROFILE, DayNight);
	}

	return false;
}
bool cJobManager::WorkExploreCatacombs(Girl* girl, Brothel* brothel, int DayNight, std::string& summary)
{
	int num_monsters = 0;
	int type_monster_girls = 0;
	int type_unique_monster_girls = 0;
	int type_beasts = 0;

	long gold = 0;
	int num_items = 0;
	bool raped = false;
    std::string message = "";

	//standard job boilerpate
	if(Preprocessing(ACTION_COMBAT, girl, brothel, DayNight, summary, message))
		return true;

	// ready armor and weapons!
	g_Girls.EquipCombat(girl);

	// determine if they fight any monsters
	
	if ((g_Dice%100)+1 > std::max(girl->combat(), girl->magic()))	// WD:	Allow best of Combat or Magic skill 
	{
		std::stringstream noplay;
		noplay << "Nobody wants to play with you today in the catacombs :(";
		girl->m_Events.AddMessage(noplay.str(), IMGTYPE_PROFILE, DayNight);
		//return true;		// WD: not a refusal
		return false;
	}

	num_monsters = (g_Dice%3)+1;

	// fight/capture monsters here
	for(int i=num_monsters; i>0; i--)
	{
		int type = ((g_Dice%2)+1);	// 1 is beast 2 is monster girl

		Girl* tempgirl = g_Girls.CreateRandomGirl(18, false, false, false, true, false);

		Uint8 fight_outcome = g_Girls.girl_fights_girl(girl, tempgirl);
		if (fight_outcome == 1)  // If she won
		{
			if(type == 2)  // Monster girl type
			{
				Girl* ugirl = nullptr;
				bool unique = false;
				if((g_Dice%100)+1 < 30)	// chance of getting unique girl
					unique = true;

				if(unique)  // Unique monster girl type
				{
					ugirl = g_Girls.GetRandomGirl(false, true);
					if(ugirl == nullptr)
						unique = false;
				}

				if(g_Brothels.GetObjective())
				{
					if(g_Brothels.GetObjective()->m_Objective == OBJECTIVE_CAPTUREXMONSTERGIRLS)
						g_Brothels.GetObjective()->m_SoFar++;
				}

				// Either type of girl goes to the dungeon
				if(unique)
				{
					ugirl->m_States &= ~(1 << STATUS_CATACOMBS);
					g_Brothels.GetDungeon()->AddGirl(ugirl, DUNGEON_GIRLCAPTURED);
					type_unique_monster_girls++;
				}
				else
				{
					// MYR: Commented out for local testing only. 

					ugirl = g_Girls.CreateRandomGirl(0, false, false, true, true);
					if(ugirl != nullptr)  // make sure a girl was returned
					{
						g_Brothels.GetDungeon()->AddGirl(ugirl, DUNGEON_GIRLCAPTURED);
						type_monster_girls++;
					}
				}
			}
			else  // Beast type
			{
				g_Brothels.add_to_beasts(1);
				type_beasts++;
			}
		}
		else if (fight_outcome == 2)  // she lost
		{
			raped = true;

			if(tempgirl)
				delete tempgirl;
			tempgirl = nullptr;
			break;
		}
		else if (fight_outcome == 0)  // it was a draw
		{
			// hmm, guess we'll just ignore draws for now
		}

		if(tempgirl)
			delete tempgirl;
		tempgirl = nullptr;
	} // # of monsters to fight loop


	std::stringstream ss;
	if (raped)
	{
		int NumMon = g_Dice%6 + 1;
		ss << girl->m_Realname << " was defeated then" << ((NumMon <= 3) ? "" : " gang") << " raped and abused by " << NumMon << " monsters.";
		if(girl->m_Virgin)
		{
			ss << " That's a hell of a way to lose your virginity; naturally, she's rather distressed by this fact.";
			girl->m_Virgin = false;
			g_Girls.UpdateStat(girl, STAT_SPIRIT, -2);
			g_Girls.UpdateEnjoyment(girl, ACTION_SEX, -4, true);
			g_Girls.UpdateEnjoyment(girl, ACTION_COMBAT, -4, true);
		}
		girl->m_Events.AddMessage(ss.str(), IMGTYPE_DEATH, EVENT_DANGER);

		g_Girls.UpdateStat(girl, STAT_HEALTH, -2);
		g_Girls.UpdateStat(girl, STAT_SPIRIT, -1);
		g_Girls.GirlInjured(girl, 10);
		g_Girls.UpdateEnjoyment(girl, ACTION_SEX, -4, true);
		g_Girls.UpdateEnjoyment(girl, ACTION_COMBAT, -4, true);

		// chance of insemination boosted depending on number of beasts
		// She could have taken contraceptives beforehand if available to her, though
		/*
		 * doc : var declared but not used. commenting out for now
		 *
		double chance = 0.7 + (NumMon * 0.3);
		bool inseminated = girl->calc_insemination(g_Brothels.GetPlayer(), false, chance);
		*/

		//return true;		// WD: not a refusal
		return false;
	}

	int ItemPlace = 0;  // Place in 0..299

    std::string item_list = "";
	for(int i = num_monsters; i > 0; i--)
	{
		gold += (g_Dice%100) + 25;

		// get any items
		while((g_Dice%100)+1 < 40)
		{
			sInventoryItem* TempItem = g_InvManager.GetRandomItem();

			// 1. If the item type already exists in the brothel, and there isn't already 255 of it,
			// add one to it
			ItemPlace = g_Brothels.HasItem(TempItem->m_Name, -1);
			if ((ItemPlace != -1) && (g_Brothels.m_NumItem[ItemPlace] <= 254))
			{
				item_list += ((item_list=="") ? "" : ", ") + TempItem->m_Name;
				g_Brothels.m_NumItem[ItemPlace]++;
				num_items++;
			}
			// 2. If the count is already 255, do nothing

			// 3. If there are less than MAXNUM_INVENTORY different things in the inventory and the item type
			// isn't in the inventory already, add the item
			if(g_Brothels.m_NumInventory < MAXNUM_INVENTORY && ItemPlace == -1)
			{
				for(int j=0; j<MAXNUM_INVENTORY; j++)
				{
					if(g_Brothels.m_Inventory[j] == nullptr) // Empty slot
					{
						item_list += ((item_list=="") ? "" : ", ") + TempItem->m_Name;
						g_Brothels.m_Inventory[j] = TempItem;
						g_Brothels.m_EquipedItems[j] = 0;
						g_Brothels.m_NumInventory++;
						g_Brothels.m_NumItem[j]++;  // = 1 instead?

						num_items++;
						break;
					}
				}
			}
			// 4. If there are already MAXNUM_INVENTORY different items, do nothing
		}  // while getting items
	}      // for each monster killed

	ss << girl->m_Realname << " adventured in the catacombs and encountered " << num_monsters << " monsters. She captured:\n"
		<< type_monster_girls << " monster girls,\n"
		<< type_unique_monster_girls << " unique monster girls, and\n"
		<< type_beasts << " beasts.\n"
		<< "Further, she came out with " << gold << " gold";
	if(num_items == 1)
		ss << " and a " << item_list << ".";
	else if(num_items > 1)
		ss << " and " << num_items << " items: " << item_list << ".";
	else if(num_items == 0)
		ss << ".";

	girl->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, DayNight);

	// Improve girl
	int xp = 15, libido = 5, skill = 1;

	if (g_Girls.HasTrait(girl, "Quick Learner"))
	{
		skill += 1;
		xp += 5;
	}
	else if (g_Girls.HasTrait(girl, "Slow Learner"))
	{
		skill -= 1;
		xp -= 5;
	}

	if (g_Girls.HasTrait(girl, "Nymphomaniac"))
		libido += 2;

	girl->m_Pay += gold;
	g_Girls.UpdateStat(girl, STAT_EXP, xp);
	g_Girls.UpdateSkill(girl, SKILL_COMBAT, skill);
	g_Girls.UpdateSkill(girl, SKILL_MAGIC, skill);
	g_Girls.UpdateTempStat(girl, STAT_LIBIDO, libido);
	g_Girls.UpdateEnjoyment(girl, ACTION_COMBAT, +8, true);

	// Myr: Turned trait gains into functions
	g_Girls.PossiblyGainNewTrait(girl, "Tough", 15, ACTION_COMBAT, "She has become pretty Tough from all of the fights she's been in.", DayNight != 0);
	g_Girls.PossiblyGainNewTrait(girl, "Adventurer", 60, ACTION_COMBAT, "She has been in enough tough spots to consider herself Adventurer.", DayNight != 0);
	g_Girls.PossiblyGainNewTrait(girl, "Aggressive", 60, ACTION_COMBAT, "She is getting rather Aggressive from her enjoyment of combat.", DayNight != 0);
	
	return false;
}
bool cJobManager::WorkTorturer(Girl* girl, Brothel* brothel, int DayNight, std::string& summary)
{
	if(DayNight == SHIFT_NIGHT)  // Do this only once a day
		return false;

    std::string message = "";
	if(Preprocessing(ACTION_WORKTORTURER, girl, brothel, DayNight, summary, message))
		return true;




	// ready armor and weapons!
	g_Girls.EquipCombat(girl);

	// Complications
	if(g_Dice%100 <= 10)
	{
		g_Girls.UpdateEnjoyment(girl, ACTION_WORKTORTURER, -3, true);
		message = girl->m_Realname + " hurt herself while torturing someone.";
		girl->m_Events.AddMessage(message, IMGTYPE_PROFILE, DayNight);
	}
	else
	{
		g_Girls.UpdateEnjoyment(girl, ACTION_WORKTORTURER, +3, true);
		message = girl->m_Realname + " enjoyed her job working in the dungeon.";
		girl->m_Events.AddMessage(message, IMGTYPE_PROFILE, DayNight);
	}
	
	// Improve girl
	int xp = 5, libido = 5, skill = 1;

	if (g_Girls.HasTrait(girl, "Quick Learner"))
	{
		skill += 1;
		xp += 3;
	}
	else if (g_Girls.HasTrait(girl, "Slow Learner"))
	{
		skill -= 1;
		xp -= 3;
	}

	if (g_Girls.HasTrait(girl, "Nymphomaniac"))
		libido += 2;

	girl->m_Pay += 65;
	g_Gold.staff_wages(65);  // wages come from you
	g_Girls.UpdateStat(girl, STAT_EXP, xp);
	g_Girls.UpdateSkill(girl, SKILL_BDSM, skill);
	g_Girls.UpdateTempStat(girl, STAT_LIBIDO, libido);

	// WD: Update flag
	g_Brothels.TortureDone(true);	

	// Check for new traits
	g_Girls.PossiblyGainNewTrait(girl, "Sadistic", 30, ACTION_WORKTORTURER, girl->m_Realname + " has come to enjoy her job so much that she has become rather Sadistic.", DayNight != 0);
	g_Girls.PossiblyGainNewTrait(girl, "Merciless", 50, ACTION_WORKTORTURER, girl->m_Realname + " extensive experience with torture has made her absolutely Merciless.", DayNight != 0);

	return false;
}
bool cJobManager::WorkSecurity(Girl* girl, Brothel* brothel, int DayNight, std::string& summary)
{
    std::string message = "";
	if(Preprocessing(ACTION_WORKSECURITY, girl, brothel, DayNight, summary, message))
		return true;

	// ready armor and weapons!
	g_Girls.EquipCombat(girl);

	// Complications
	if(g_Dice%100 <= 10)
	{
		g_Girls.UpdateEnjoyment(girl, ACTION_WORKSECURITY, -3, true);
		message = "Had to deal with some very unruly patrons that gave her a hard time.";
		girl->m_Events.AddMessage(message, IMGTYPE_PROFILE, DayNight);
	}
	else
	{
		g_Girls.UpdateEnjoyment(girl, ACTION_WORKSECURITY, +3, true);
		message = "Successfully handled unruly patrons.";
		girl->m_Events.AddMessage(message, IMGTYPE_PROFILE, DayNight);

		// Just 'cause
		if (g_Girls.HasTrait(girl, "Nymphomaniac") && g_Dice%100 <= 50)
			message += "\nGave some bonus service to the well behaved patrons.";
	}

	// First lets decay the previous security level somewhat.  Lets not have too much banking
	// of security points.

	brothel->m_SecurityLevel -= 50;

	/* MYR: Modified security level calculation & added traits for it
	        I'm treating the service skill in a more general way here.
            A gang of 1-10 customers attack girls now in function
			work_related_violence.  It takes (# members x 5) security
			points to intercept them. see work_related_violence for
			details. */
			
	int SecLev = g_Dice%(g_Girls.GetSkill(girl, SKILL_COMBAT)/3) 
		+ g_Dice%(g_Girls.GetSkill(girl, SKILL_MAGIC)/3)
		+ g_Dice%(g_Girls.GetSkill(girl, SKILL_SERVICE)/3);

	// Please excuse the comments. I wrote this soon after all the sex strings.

	// Good traits
	if (g_Girls.HasTrait(girl, "Psychic"))  // I sense danger
		SecLev += 10;

	if (g_Girls.HasTrait(girl, "Fleet of Foot"))  // Moves around quickly
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Charming"))  // Gets more cooperation
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Cool Person"))  // Gets more cooperation redux
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Adventurer"))  // Has experience
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Aggressive"))  // Rawr! I kill you now!
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Sadistic"))  // I kill you slowly with this dull knife!
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Merciless"))  // Your cries for clemency amuse me
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Fearless"))  // Chhhhaaaarrrrrggggeeeeee!!
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Iron Will"))  // Hold the line!
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Construct") || g_Girls.HasTrait(girl, "Not Human"))  // Scary
		SecLev += 5;

	if (g_Girls.HasTrait(girl, "Demon"))  // Even scarier
		SecLev += 10;

	if (g_Girls.HasTrait(girl, "Incorporial"))  // I'm f*****g Superman!
		SecLev += 20;

	if (g_Girls.HasTrait(girl, "Strange Eyes"))  // I'm watching you
		SecLev += 2;

	if (g_Girls.HasTrait(girl, "Assassin"))  // I was born for this job. I know how you think.
		SecLev += 50;    // Is 50 too high? Assassin is a relatively rare trait, and there's no way to gain it
	                     // (That I'm aware of) so it trades off(?)

	if (g_Girls.HasTrait(girl, "Lolita"))  // Hi there kiddo.  Lost your mommy?  OHMYGOD! She has two Swords of Forever!
		SecLev += 5;

	// Bad traits
	if (g_Girls.HasTrait(girl, "Nerd"))  // Gets no respect
		SecLev -= 5;

	if (g_Girls.HasTrait(girl, "Tsundere"))  // Puts people off
		SecLev -= 5;

	if (g_Girls.HasTrait(girl, "Twisted"))  // Wierd ideas about security rarely work
		SecLev -= 5;

	if (g_Girls.HasTrait(girl, "Broken Will"))  // I'm too tired to patrol
		SecLev -= 5;

	if (g_Girls.HasTrait(girl, "Nymphomaniac"))  // Wait! The security officer is a nymphomaniac in a brothel?
		SecLev -= 20;      // This hurts people like me who use the automation functions.

	if (g_Girls.HasTrait(girl, "Meek"))  // Wait... bad person... come back
		SecLev -= 5;

	if (g_Girls.HasTrait(girl, "Clumsy"))  // "Stop thief!" ..... "Ahhhhh! I fell again!"
		SecLev -= 5;

	if (g_Girls.HasTrait(girl, "Dependant"))  // I can't do this alone
		SecLev -= 5;

	if (g_Girls.HasTrait(girl, "Mind F****d"))  // duurrrrrr..... secu.... sec... what?
		SecLev -= 50;                           // (Mind f****d can be cured btw.)

	if (SecLev < 10)
		SecLev = 10;

	brothel->m_SecurityLevel += SecLev;

	std::stringstream sstemp;
    sstemp << "Patrolling the building. Security level up by " << SecLev << ".";
	girl->m_Events.AddMessage(sstemp.str(), IMGTYPE_PROFILE, DayNight);

	// Improve girl
	int xp = 10, libido = 1, skill = 1;

	if (g_Girls.HasTrait(girl, "Quick Learner"))
	{
		skill += 1;
		xp += 5;
	}
	else if (g_Girls.HasTrait(girl, "Slow Learner"))
	{
		skill -= 1;
		xp -= 5;
	}

	if (g_Girls.HasTrait(girl, "Nymphomaniac"))
		libido += 2;

	girl->m_Pay += 70;
	g_Gold.staff_wages(70);  // wages come from you
	g_Girls.UpdateStat(girl, STAT_EXP, xp);
	g_Girls.UpdateSkill(girl, SKILL_COMBAT, libido);
	g_Girls.UpdateTempStat(girl, STAT_LIBIDO, skill);

	// Copy-pasta from WorkExploreCatacombs
	g_Girls.PossiblyGainNewTrait(girl, "Tough", 15, ACTION_WORKSECURITY, "She has become pretty Tough from all of the fights she's been in.", DayNight != 0);
	g_Girls.PossiblyGainNewTrait(girl, "Adventurer", 60, ACTION_WORKSECURITY, "She has been in enough tough spots to consider herself Adventurer.", DayNight != 0);
	g_Girls.PossiblyGainNewTrait(girl, "Aggressive", 60, ACTION_WORKSECURITY, "She is getting rather Aggressive from her enjoyment of combat.", DayNight != 0);
	return false;
}
Esempio n. 5
0
void CPRApplication::PreprocessIncludes(char** saveto, char* sText, char* workdir)
{
    // обработка инклудов
    ag::list<CPRTokenInfo>* pTok=new ag::list<CPRTokenInfo>;
    ParseIt(pTok,sText,true,true);
    ag::list<StartEndStruct> StartEndList;
    StartEndStruct ses;

    for(ag::list<CPRTokenInfo>::member p=pTok->head;(p!=NULL)&&(p->data.petCurrType!=petEOF);p=p->next)
    {
	if (p->data.sCurrText[0]=='#')
	{
	    ses.start=p->data.iStartPos;
	    do p=p->next; while (p->data.sCurrText[0]==' ');
	    if (strcmp(p->data.sCurrText,"include")==0)
	    {
		do p=p->next; while (p->data.sCurrText[0]==' ');
		int IncludeType = (p->data.sCurrText[0]=='"')?1:( (p->data.sCurrText[0]=='<')?2:-1 );
		if (IncludeType==-1) throw "Invalid include directive";

		if (IncludeType==1)
		{
		    do p=p->next; while (p->data.sCurrText[0]==' ');
		    std::string wd=workdir;
		    if (workdir[strlen(workdir)-1]!='/')
			wd+='/';
		    std::string sPath;
		    do{ sPath+=p->data.sCurrText; p=p->next;}while ((p->data.sCurrText[0]!='"')&&(p!=NULL));
		    do p=p->next; while (p->data.sCurrText[0]==' ');
		    if (p==NULL) throw "Second brace is not found";
		    sPath=wd+sPath;
		    if (debugmode) std::cout<<"Path: "<<sPath<<"\n";
		    if (debugmode) std::cout<<"Work: "<<wd   <<"\n";
		    char** inc=new char*;
		    ses.end=p->data.iStartPos;
		    Preprocessing(inc,GetFileText((char*)sPath.c_str()),(char*)wd.c_str());
		    ses.data=inc;
		    StartEndList.add_tail(ses);
		}
		if (IncludeType==2)
		{
		    do p=p->next; while (p->data.sCurrText[0]==' ');
		    char* incpath=getenv("CPROMPTINCLUDES");
		    if(incpath==NULL)
		    {
			throw "(FATAL ERROR) Enviromnent variable CPROMPTINCLUDES is not initialized\n";
		    }
		    std::string wd=incpath;
		    if (incpath[strlen(incpath)-1]!='/')
			wd+='/';
		    std::string sPath;
		    do{ sPath+=p->data.sCurrText; p=p->next;}while ((p->data.sCurrText[0]!='>')&&(p!=NULL));
		    do p=p->next; while (p->data.sCurrText[0]==' ');
		    if (p==NULL) throw "Second brace is not found";
		    sPath=wd+sPath;
		    if (debugmode) std::cout<<"Path: "<<sPath<<"\n";
		    if (debugmode) std::cout<<"Work: "<<wd   <<"\n";
		    char** inc=new char*;
		    ses.end=p->data.iStartPos;
		    Preprocessing(inc,GetFileText((char*)sPath.c_str()),(char*)wd.c_str());
		    ses.data=inc;
		    StartEndList.add_tail(ses);
		}
	    }
	}
    }
    char* k;
    std::string res="";
    int last=0;
    for(ag::list<StartEndStruct>::member p=StartEndList.head;(p!=NULL);p=p->next)
    {
	k=new char[p->data.start+1];
	strncpy(k,sText+last,p->data.start-last);
//        if (debugmode) std::cout<<": "<<k<<"\n";
	k[(p->data.start)-last]=0;
	res+=k;
	delete[] k;
	res+=*(char**)(p->data.data);
	last=p->data.end;
    }
    k=new char[strlen(sText)-last+1];
    strncpy(k,sText+last,strlen(sText)-last);
//    if (debugmode) std::cout<<p->data.start<<' '<<p->data.end<<": "<<k;
    k[strlen(sText)-last]=0;
    res+=k;
    delete[] k;

    k=new char[res.size()+1];
    strcpy(k,res.c_str());
    k[res.size()]=0;
    ((saveto!=NULL)?*saveto:sPText) = k;
}