Beispiel #1
0
void cDungeon::AddGirl(sGirl* girl, int reason)
{
	if (reason == DUNGEON_GIRLKIDNAPPED)
	{
		if (g_Brothels.GetObjective() && g_Brothels.GetObjective()->m_Objective == OBJECTIVE_KIDNAPXGIRLS)
		{
			g_Brothels.GetObjective()->m_SoFar++;
		}
	}

	// by this stage they should no longer be a part of any other lists of girls
	sDungeonGirl* newPerson = new sDungeonGirl();
	newPerson->m_Reason = reason;
	newPerson->m_Girl = girl;
	girl->m_InStudio = girl->m_InCentre = girl->m_InClinic = girl->m_InHouse = girl->m_InArena = false;	// `J`
	girl->where_is_she = 0;	// `J`
	girl->m_DayJob = girl->m_NightJob = JOB_INDUNGEON;

	// remove from girl manager if she is there
	g_Girls.RemoveGirl(girl);

	// remove girl from brothels if she is there
	for (int i = 0; i < g_Brothels.GetNumBrothels(); i++)
	{
		g_Brothels.RemoveGirl(i, girl, false);
	}

	PlaceDungeonGirl(newPerson);
}
void cGirlTorture::AddTextPlayer()
{
	bool was, is;

	int mes = g_Dice.in_range(0, 4);
	switch (mes) {
	case 0:
		m_Message += gettext("you torture her for hours leaving her sobbing.\n");
		break;
	case 1:
		m_Message += gettext("you enjoy giving out all manners of pain imaginable.");
		break;
	case 2:
		m_Message += gettext("you place a small wormlike creature called a vorm in her pussy and watch as it painfully sucks fluid from her.");
		break;
	case 3:
		m_Message += gettext("after beating her around and using a few torture devices, you sit and watch her crying and cowering in the corner for a time.");
		break;
	case 4:
	default:
		m_Message += gettext("you rape her many times making sure she is as uncomfotable as possible.");
		/*
		*		see if she was preggers before the rape
		*		check to see if the rape made her pregnant
		*		then check to see if she is afterward
		*/
		was = m_Girl->is_pregnant();
		/*
		*		supposed to be checking to see if
		*		she's preg by the goons (at group sex rates)
		*		then again by player. But I don't have a handy
		*		sCustomer so I'm going group rate
		*		and assigning any progeny to the player.
		*		Lazy, I know :)
		*/
		m_Girl->calc_pregnancy(The_Player, false, 1.5);
		is = m_Girl->is_pregnant();
		/*
		*		if she was not, but is now, then the player
		*		just knocked her up. We should mention this.
		*/
		if (is && !was)
		{
			m_Message += gettext(" She is now pregnant.");
		}
		g_Girls.LoseVirginity(m_Girl);
		break;
	}
}
Beispiel #3
0
void sDungeonGirl::OutputGirlDetailString(string& Data, const string& detailName)
{
	//given a statistic name, set a string to a value that represents that statistic
	static stringstream ss;
	ss.str("");
	if (detailName == "Rebelliousness")	// `J` Dungeon "Matron" can be a Torturer from any brothel
	{
		ss << g_Girls.GetRebelValue(m_Girl, (
			g_Brothels.GetNumGirlsOnJob(0, JOB_TORTURER, 0) > 0 ||
			g_Brothels.GetNumGirlsOnJob(1, JOB_TORTURER, 0) > 0 ||
			g_Brothels.GetNumGirlsOnJob(2, JOB_TORTURER, 0) > 0 ||
			g_Brothels.GetNumGirlsOnJob(3, JOB_TORTURER, 0) > 0 ||
			g_Brothels.GetNumGirlsOnJob(4, JOB_TORTURER, 0) > 0 ||
			g_Brothels.GetNumGirlsOnJob(5, JOB_TORTURER, 0) > 0 ||
			g_Brothels.GetNumGirlsOnJob(6, JOB_TORTURER, 0) > 0));
	}
	else if (detailName == "Reason")
	{
		switch (m_Reason)
		{
		case DUNGEON_GIRLCAPTURED:				ss << gettext("Newly Captured.");					break;
		case DUNGEON_GIRLKIDNAPPED:				ss << gettext("Taken from her family.");			break;
		case DUNGEON_GIRLWHIM:					ss << gettext("Your whim.");						break;
		case DUNGEON_GIRLSTEAL:					ss << gettext("Not reporting true earnings.");		break;
		case DUNGEON_GIRLRUNAWAY:				ss << gettext("Ran away and re-captured.");			break;
		case DUNGEON_NEWSLAVE:					ss << gettext("This is a new slave.");				break;
		case DUNGEON_NEWGIRL:					ss << gettext("This is a new girl.");				break;
		case DUNGEON_KID:						ss << gettext("Child of one of your girls.");		break;
		case DUNGEON_NEWARENA:					ss << gettext("This is a girl won in the arena.");	break;
		case DUNGEON_RECRUITED:					ss << gettext("This girl was recruited for you.");	break;
		}
	}
	else if (detailName == "Duration")			{ ss << m_Weeks; }
	else if (detailName == "Feeding")			{ ss << ((m_Feeding) ? gettext("Yes") : gettext("No")); }
	else if (detailName == "Tortured")			{ ss << ((m_Girl->m_Tort) ? gettext("Yes") : gettext("No")); }
	else
	{
		m_Girl->OutputGirlDetailString(Data, detailName);
		return;
	}
	Data = ss.str();
}
Beispiel #4
0
// Run the shifts
void cCentreManager::UpdateGirls(sBrothel* brothel, bool Day0Night1)	// Start_Building_Process_B
{
	
	stringstream ss;
	string summary, girlName;

	u_int restjob = JOB_CENTREREST;
	u_int matronjob = JOB_CENTREMANAGER;
	u_int firstjob = JOB_CENTREREST;
	u_int lastjob = JOB_THERAPY;
	u_int sw = 0, psw = 0;

	int totalPay = 0, totalTips = 0, totalGold = 0;
	int sum = EVENT_SUMMARY;
	int numgirls = GetNumGirls(brothel->m_id);

	bool matron = false, matrondone = false;
	bool counselor = false;

	bool refused = false;

	m_Processing_Shift = Day0Night1;		// WD:	Set processing flag to shift type

	//////////////////////////////////////////////////////
	//  Handle the start of shift stuff for all girls.  //
	//////////////////////////////////////////////////////
	sGirl* current = brothel->m_Girls;
	while (current)
	{
		if (current->health() <= 0)		// skip dead girls
		{
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		else
		{
			g_Girls.UseItems(current);				// Girl uses items she has
			g_Girls.CalculateGirlType(current);		// update the fetish traits
			g_Girls.CalculateAskPrice(current, true);	// Calculate the girls asking price

			current = current->m_Next; // Next Girl
		}
	}


	////////////////////////////////////////////////////////
	//  Process Matron first incase she refuses to work.  //
	////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current && !matrondone)
	{
		if (current->health() <= 0 ||
			(GetNumGirlsOnJob(0, matronjob, Day0Night1) > 0 && (current->m_DayJob != matronjob || current->m_NightJob != matronjob)) ||
			(GetNumGirlsOnJob(0, matronjob, Day0Night1) < 1 && (current->m_PrevDayJob != matronjob || current->m_PrevNightJob != matronjob)))
		{	// Sanity check! Don't process dead girls and only process those with matron jobs
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		// `J` so someone is or was a matron

		girlName = current->m_Realname;
		// if there is no matron on duty, we see who was on duty previously
		if (GetNumGirlsOnJob(0, matronjob, Day0Night1) < 1)
		{
			// if a matron was found and she is healthy, not tired and not on maternity leave... send her back to work
			if ((current->m_PrevDayJob == matronjob || current->m_PrevNightJob == matronjob) &&
				(g_Girls.GetStat(current, STAT_HEALTH) >= 50 && g_Girls.GetStat(current, STAT_TIREDNESS) <= 50) &&
				current->m_PregCooldown < cfg.pregnancy.cool_down())
				// Matron job is more important so she will go back to work at 50% instead of regular 80% health and 20% tired
			{
				current->m_DayJob = current->m_NightJob = matronjob;
				current->m_PrevDayJob = current->m_PrevNightJob = 255;
				current->m_Events.AddMessage("The Centre Manager puts herself back to work.", IMGTYPE_PROFILE, EVENT_BACKTOWORK);
			}
			else if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		// `J` Now we have a matron so lets see if she will work

		totalPay = totalTips = totalGold = 0;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");

		// `J` she can refuse the first shift then decide to work the second shift 
		if (!current->m_Refused_To_Work_Day && Day0Night1 == SHIFT_NIGHT)	// but if she worked the first shift she continues the rest of the night
		{
			matron = true;
			ss << girlName << " continued to help the other girls throughout the night.";
		}
		else if (g_Girls.DisobeyCheck(current, ACTION_WORKMATRON, brothel))
		{
			(Day0Night1 ? current->m_Refused_To_Work_Night = true : current->m_Refused_To_Work_Day = true);
			brothel->m_Fame -= g_Girls.GetStat(current, STAT_FAME);
			ss << girlName << " refused to work as the Centre Manager.";
			sum = EVENT_NOWORK;
		}
		else	// so there is less chance of a matron refusing the entire turn
		{
			matron = true;
			totalPay = totalTips = totalGold = 0;
			m_JobManager.JobFunc[matronjob](current, brothel, Day0Night1, summary);
			totalGold += current->m_Pay + current->m_Tips;

			// She does not get paid for the first shift and gets docked some pay from the second shift if she refused once
			if (Day0Night1 == SHIFT_NIGHT) totalGold /= 3;

			current->m_Pay += max(0, totalGold);
			current->m_Pay = current->m_Tips = 0;

			brothel->m_Fame += g_Girls.GetStat(current, STAT_FAME);
			/* */if (totalGold > 0)		{ ss << girlName << " earned a total of " << totalGold << " gold directly from you. She gets to keep it all."; }
			else if (totalGold == 0)	{ ss << girlName << " made no money."; }
			else if (totalGold < 0)		{ sum = EVENT_DEBUG; ss << "ERROR: She has a loss of " << totalGold << " gold\n\n Please report this to the Pink Petal Devloment Team at http://pinkpetal.org"; }
		}
		current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;	// Next Girl
		matrondone = true;			// there can be only one matron so this ends the while loop
	}

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//  Now If there is a matron and she is not refusing to work, then she can delegate the girls in this building.  //
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || sw != restjob)
		{	// skip dead girls and anyone not resting
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (current->m_PregCooldown == cfg.pregnancy.cool_down())
		{
			ss << girlName << " is on maternity leave.";
		}
		else if (current->health() < 80 || current->tiredness() > 20)
		{
			m_JobManager.JobFunc[restjob](current, brothel, Day0Night1, summary);
		}
		else
		{	// if she is healthy enough to go back to work... 
			if (matron)	// and there is a marton working...
			{
				psw = (Day0Night1 ? current->m_PrevNightJob : current->m_PrevDayJob);
				if (psw == JOB_COUNSELOR && current->is_free())
				{
					current->m_DayJob = current->m_NightJob = JOB_COUNSELOR;
					ss << "The Centre Manager puts " << girlName << " back to work.\n";
				}
				else if (psw == JOB_REHAB)
				{
					current->m_DayJob = current->m_NightJob = psw;
					ss << "The Centre Manager puts " << girlName << " back into Rehab.\n";
				}
				else if (psw == JOB_ANGER || psw == JOB_EXTHERAPY || psw == JOB_THERAPY)
				{
					current->m_DayJob = current->m_NightJob = psw;
					ss << "The Centre Manager puts " << girlName << " back into Therapy.\n";
				}
				else if (psw != restjob && psw != 255 && psw != JOB_COUNSELOR)
				{	// if she had a previous job, put her back to work.
					if (Day0Night1 == SHIFT_DAY)
					{
						current->m_DayJob = current->m_PrevDayJob;
						if (current->m_NightJob == restjob && current->m_PrevNightJob != restjob && current->m_PrevNightJob != 255)
							current->m_NightJob = current->m_PrevNightJob;
					}
					else
					{
						if (current->m_DayJob == restjob && current->m_PrevDayJob != restjob && current->m_PrevDayJob != 255)
							current->m_DayJob = current->m_PrevDayJob;
						current->m_NightJob = current->m_PrevNightJob;
					}
					ss << "The Centre Manager puts " << girlName << " back to work.\n";
				}
				else if (current->m_DayJob == restjob && current->m_NightJob == restjob)
				{	// if they have no job at all, assign them a job
					ss << "The Centre Manager assigns " << girlName << " to ";
					// first send any addicts to rehab
					if (current->is_addict())
					{
						current->m_DayJob = current->m_NightJob = JOB_REHAB;
						ss << "go to Rehab.";
					}
					// Make sure there is at least 1 counselor on duty
					else if (current->is_free() && GetNumGirlsOnJob(0, JOB_COUNSELOR, Day0Night1) < 1)
					{
						current->m_DayJob = current->m_NightJob = JOB_COUNSELOR;
						ss << "work as a Counselor.";
					}
					// assign 1 cleaner per 20 girls
					else if (GetNumGirlsOnJob(0, JOB_CLEANCENTRE, Day0Night1) < max(1,numgirls/20))
					{
						current->m_DayJob = current->m_NightJob = JOB_CLEANCENTRE;
						ss << "clean the Centre.";
					}
					// assign 1 counselor per 20 girls
					else if (current->is_free() && GetNumGirlsOnJob(0, JOB_COUNSELOR, Day0Night1) < numgirls / 20)
					{
						current->m_DayJob = current->m_NightJob = JOB_COUNSELOR;
						ss << "work as a Counselor.";
					}
					// split all the rest between JOB_COMUNITYSERVICE and JOB_FEEDPOOR
					else if (GetNumGirlsOnJob(0, JOB_COMUNITYSERVICE, Day0Night1) < GetNumGirlsOnJob(0, JOB_FEEDPOOR, Day0Night1))
					{
						current->m_DayJob = current->m_NightJob = JOB_COMUNITYSERVICE;
						ss << "work doing comunity service.";
					}
					else
					{
						current->m_DayJob = current->m_NightJob = JOB_FEEDPOOR;
						ss << "work feeding the poor.";
					}
				}
				current->m_PrevDayJob = current->m_PrevNightJob = 255;
				sum = EVENT_BACKTOWORK;
			}
			else	// no one to send her back to work
			{
				ss << "WARNING " << girlName << " is doing nothing!\n";
				sum = EVENT_WARNING;
			}
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;
	}

	//////////////////////////////////////////////////////////
	//  JOB_COUNSELOR needs to be checked before all others //
	//////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || sw != JOB_COUNSELOR)
		{	// skip dead girls and anyone who is not a counselor
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		totalPay = totalTips = totalGold = 0;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;
		
		if (g_Girls.DisobeyCheck(current, ACTION_WORKCOUNSELOR, brothel))
		{
			(Day0Night1 ? current->m_Refused_To_Work_Night = true : current->m_Refused_To_Work_Day = true);
			brothel->m_Fame -= g_Girls.GetStat(current, STAT_FAME);
			ss << girlName << " refused to work so made no money.";
		}
		else
		{
			counselor = true;
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}

	/////////////////////////////////////////////////////////////////////////////////
	//  Anyone not in the Therapy Cantre can be assigned to counselor if need be.  //
	/////////////////////////////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current && matron && !counselor && GetNumberPatients(Day0Night1) > 0)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || (sw != JOB_FEEDPOOR && sw != JOB_COMUNITYSERVICE && sw != JOB_CLEANCENTRE))
		{	// skip dead girls
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (!g_Girls.DisobeyCheck(current, ACTION_WORKCOUNSELOR, brothel))
		{
			counselor = true;
			ss << "There was no Counselor available to work so " << girlName << " was assigned to do it.";
			current->m_DayJob = current->m_NightJob = JOB_COUNSELOR;
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}

	/////////////////////////////////////////////////////////////////////////////
	//  Anyone in the Therapy Cantre can be assigned to counselor if need be.  //
	//  Try them in order of who can better go without their therapy.          //
	/////////////////////////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current && matron && !counselor && GetNumberPatients(Day0Night1) > 0)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || sw != JOB_THERAPY)
		{	// skip dead girls
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (!g_Girls.DisobeyCheck(current, ACTION_WORKCOUNSELOR, brothel))
		{
			counselor = true;
			ss << "There was no Counselor available to work so " << girlName << " was assigned to do it.";
			current->m_DayJob = current->m_NightJob = JOB_COUNSELOR;
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}
	current = brothel->m_Girls;
	while (current && matron && !counselor && GetNumberPatients(Day0Night1) > 0)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || (sw != JOB_ANGER && sw != JOB_EXTHERAPY))
		{	// skip dead girls
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (!g_Girls.DisobeyCheck(current, ACTION_WORKCOUNSELOR, brothel))
		{
			counselor = true;
			ss << "There was no Counselor available to work so " << girlName << " was assigned to do it.";
			current->m_DayJob = current->m_NightJob = JOB_COUNSELOR;
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}
	current = brothel->m_Girls;
	while (current && matron && !counselor && GetNumberPatients(Day0Night1) > 0)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || sw != JOB_REHAB)
		{	// skip dead girls
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (!g_Girls.DisobeyCheck(current, ACTION_WORKCOUNSELOR, brothel))
		{
			counselor = true;
			ss << "There was no Counselor available to work so " << girlName << " was assigned to do it.";
			current->m_DayJob = current->m_NightJob = JOB_COUNSELOR;
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}
	
	/////////////////////////////////////
	//  Do all the Centre staff jobs.  //
	/////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || (sw != JOB_FEEDPOOR && sw != JOB_COMUNITYSERVICE && sw != JOB_CLEANCENTRE && sw != JOB_COUNSELOR) ||
			// skip dead girls and anyone who is not staff
			(sw == JOB_COUNSELOR && ((Day0Night1 == SHIFT_DAY && current->m_Refused_To_Work_Day) || (Day0Night1 == SHIFT_NIGHT && current->m_Refused_To_Work_Night))))
		{	// and skip counselors who refused to work in the first check
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		totalPay = totalTips = totalGold = 0;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (current->m_NightJob == JOB_COUNSELOR) summary = "SkipDisobey";
		// do their job
		refused = m_JobManager.JobFunc[sw](current, brothel, Day0Night1, summary);

		totalPay += current->m_Pay;
		totalTips += current->m_Tips;
		totalGold += current->m_Pay + current->m_Tips;
		g_Brothels.CalculatePay(brothel, current, sw);

		//		Summary Messages
		if (refused)
		{
			brothel->m_Fame -= g_Girls.GetStat(current, STAT_FAME);
			ss << girlName << " refused to work so made no money.";
		}
		else
		{
			ss << m_JobManager.GirlPaymentText(brothel, current, totalTips, totalPay, totalGold, Day0Night1);
			if (totalGold < 0) sum = EVENT_DEBUG;

			brothel->m_Fame += g_Girls.GetStat(current, STAT_FAME);
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}


	////////////////////////////////////////////////////////////////////
	//  Do Rehab and therapy last if there is a counselor available.  //
	////////////////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || (sw != JOB_REHAB && sw != JOB_ANGER && sw != JOB_EXTHERAPY && sw != JOB_THERAPY))
		{	// skip dead girls, resting girls and the matron
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		summary = "";
		m_JobManager.JobFunc[sw](current, brothel, Day0Night1, summary);

		current = current->m_Next; // Next Girl
	}

	///////////////////////////////////
	//  Finaly do end of day stuff.  //
	///////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		if (current->health() <= 0)
		{	// skip dead girls
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		girlName = current->m_Realname;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");

		// update for girls items that are not used up
		do_daily_items(brothel, current);					// `J` added

		// Level the girl up if nessessary
		g_Girls.LevelUp(current);
		// Natural healing, 2% health and 2% tiredness per day
		g_Girls.UpdateStat(current, STAT_HEALTH, 2, false);
		g_Girls.UpdateStat(current, STAT_TIREDNESS, -2, false);


		if (g_Girls.GetStat(current, STAT_HAPPINESS) < 40)
		{
			if (current->m_NightJob != matronjob && matron && brothel->m_NumGirls > 1 && g_Dice.percent(70))
			{
				ss << "The Centre Manager helps cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 10 + 5);
			}
			else if (brothel->m_NumGirls > 10 && g_Dice.percent(50))
			{
				ss << "Some of the other girls help cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 8 + 3);
			}
			else if (brothel->m_NumGirls > 1 && g_Dice.percent(max(brothel->m_NumGirls, 50)))
			{
				ss << "One of the other girls helps cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 6 + 2);
			}
			else if (brothel->m_NumGirls == 1 && g_Dice.percent(70))
			{
				ss << girlName << " plays around in the empty building until she feels better.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 10 + 10);
			}
			else if (g_Girls.GetStat(current, STAT_HAPPINESS) < 20) // no one helps her and she is really unhappy
			{
				ss << girlName << " is looking very depressed. You may want to do something about that before she does something drastic.\n";
				sum = EVENT_WARNING;
			}
		}

		if (g_Girls.GetStat(current, STAT_TIREDNESS) > 80 || g_Girls.GetStat(current, STAT_HEALTH) < 40)
		{
			int t = g_Girls.GetStat(current, STAT_TIREDNESS);
			int h = g_Girls.GetStat(current, STAT_HEALTH);

			if (current->m_WorkingDay > 0)
			{
				ss << girlName << " is not faring well in rehab.\n";
			}
			else if (!matron)	// do no matron first as it is the easiest
			{
				ss << "WARNING! " << girlName;
				if (t > 80 && h < 20)		ss << " is in real bad shape, she is tired and injured.\nShe should go to the Clinic.\n";
				else if (t > 80 && h < 40)	ss << " is in bad shape, she is tired and injured.\nShe should rest or she may die!\n";
				else if (t > 80)			ss << " is desparatly in need of rest.\nGive her some free time\n";
				else if (h < 20)			ss << " is badly injured.\nShe should rest or go to the Clinic.\n";
				else if (h < 40)			ss << " is hurt.\nShe should rest and recuperate.\n";
			}
			else if (current->m_NightJob == matronjob && matron)	// do matron	
			{
				if (t > 90 && h < 10)	// The matron may take herself off work if she is really bad off
				{
					current->m_PrevDayJob = current->m_DayJob;
					current->m_PrevNightJob = current->m_NightJob;
					current->m_DayJob = current->m_NightJob = restjob;
					ss << "The Centre Manager takes herself off duty because she is just too damn sore.\n";
					g_Girls.UpdateEnjoyment(current, ACTION_WORKMATRON, -10);
				}
				else
				{
					ss << "As Centre Manager, " << girlName << " has the keys to the store room.\nShe used them to 'borrow' ";
					if (t > 80 && h < 40)
					{
						ss << "some potions";
						g_Gold.consumable_cost(20, true);
						current->m_Stats[STAT_HEALTH] = min(current->m_Stats[STAT_HEALTH] + 20, 100);
						current->m_Stats[STAT_TIREDNESS] = max(current->m_Stats[STAT_TIREDNESS] - 20, 0);
					}
					else if (t > 80)
					{
						ss << "a resting potion";
						g_Gold.consumable_cost(10, true);
						current->m_Stats[STAT_TIREDNESS] = max(current->m_Stats[STAT_TIREDNESS] - 20, 0);
					}
					else if (h < 40)
					{
						ss << "a healing potion";
						g_Gold.consumable_cost(10, true);
						current->m_Stats[STAT_HEALTH] = min(current->m_Stats[STAT_HEALTH] + 20, 100);
					}
					ss << " for herself.\n";
				}
			}
			else	// do all other girls with a matron working
			{
				if (current->m_PrevNightJob == 255 && current->m_PrevDayJob == 255) // the girl has been working
				{
					current->m_PrevDayJob = current->m_DayJob;
					current->m_PrevNightJob = current->m_NightJob;
					current->m_DayJob = current->m_NightJob = restjob;
					ss << "The Centre Manager takes " << girlName << " off duty to rest due to her ";
					if (t > 80 && h < 40)	ss << "exhaustion.\n";
					else if (t > 80)		ss << "tiredness.\n";
					else if (h < 40)		ss << "low health.\n";
					else /*       */		ss << "current state.\n";
				}
				else	// the girl has already been taken off duty by the matron
				{
					if (g_Dice.percent(70))
					{
						ss << "The Centre Manager helps ";
						if (t > 80 && h < 40)
						{
							ss << girlName << " recuperate.\n";
							g_Girls.UpdateStat(current, STAT_TIREDNESS, -(g_Dice % 4 + 2));
							g_Girls.UpdateStat(current, STAT_HEALTH, (g_Dice % 4 + 2));
						}
						else if (t > 80)
						{
							ss << girlName << " to relax.\n";
							g_Girls.UpdateStat(current, STAT_TIREDNESS, -(g_Dice % 5 + 5));
						}
						else if (h < 40)
						{
							ss << "heal " << girlName << ".\n";
							g_Girls.UpdateStat(current, STAT_HEALTH, (g_Dice % 5 + 5));
						}
					}
				}
			}
		}

		if (ss.str().length() > 0)	current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;		// Process next girl
	}

	m_Processing_Shift = -1;	// WD: Finished Processing Shift set flag
}
Beispiel #5
0
// ----- Update & end of turn
void cCentreManager::UpdateCentre()	// Start_Building_Process_A
{
	cTariff tariff;
	stringstream ss;
	string girlName;

	sBrothel* current = (sBrothel*)m_Parent;
	u_int restjob = JOB_CENTREREST;
	u_int matronjob = JOB_CENTREMANAGER;
	u_int firstjob = JOB_CENTREREST;
	u_int lastjob = JOB_THERAPY;

	current->m_Finance.zero();
	current->m_AntiPregUsed = 0;
	m_Rehab_Patient_Time = 0;

	sGirl* cgirl = current->m_Girls;
	while (cgirl)
	{
		current->m_Filthiness++;
		if (cgirl->health() <= 0)			// Remove any dead bodies from last week
		{
			current->m_Filthiness++; // `J` Death is messy
			sGirl* DeadGirl = 0;
			girlName = cgirl->m_Realname;
			DeadGirl = cgirl;
			// If there are more girls to process
			cgirl = (cgirl->m_Next) ? cgirl->m_Next : 0;
			// increase all the girls fear and hate of the player for letting her die (weather his fault or not)
			UpdateAllGirlsStat(current, STAT_PCFEAR, 2);
			UpdateAllGirlsStat(current, STAT_PCHATE, 1);

			ss.str(""); ss << girlName << " has died from her injuries, the other girls all fear and hate you a little more.";
			DeadGirl->m_Events.AddMessage(ss.str(), IMGTYPE_DEATH, EVENT_DANGER);
			g_MessageQue.AddToQue(ss.str(), COLOR_RED);
			ss.str(""); ss << girlName << " has died from her injuries.  Her body will be removed by the end of the week.";
			DeadGirl->m_Events.AddMessage(ss.str(), IMGTYPE_DEATH, EVENT_SUMMARY);

			RemoveGirl(0, DeadGirl); DeadGirl = 0;	// cleanup
		}
		else
		{
			cgirl->m_Events.Clear();			// Clear the girls' events from the last turn
			cgirl->where_is_she = 0;
			cgirl->m_InStudio = false;
			cgirl->m_InArena = false;
			cgirl->m_InCentre = true;
			cgirl->m_InClinic = false;
			cgirl->m_InFarm = false;
			cgirl->m_InHouse = false;

			cgirl->m_Pay = cgirl->m_Tips = 0;

			// `J` Check for out of building jobs and set yesterday jobs for everyone first
			if (cgirl->m_DayJob	  < firstjob || cgirl->m_DayJob   > lastjob)	cgirl->m_DayJob = restjob;
			if (cgirl->m_NightJob < firstjob || cgirl->m_NightJob > lastjob)	cgirl->m_NightJob = restjob;
			if (cgirl->m_PrevDayJob != 255 && (cgirl->m_PrevDayJob	 < firstjob || cgirl->m_PrevDayJob   > lastjob))	cgirl->m_PrevDayJob = 255;
			if (cgirl->m_PrevNightJob != 255 && (cgirl->m_PrevNightJob < firstjob || cgirl->m_PrevNightJob > lastjob))	cgirl->m_PrevNightJob = 255;
			cgirl->m_YesterDayJob = cgirl->m_DayJob;		// `J` set what she did yesterday
			cgirl->m_YesterNightJob = cgirl->m_NightJob;	// `J` set what she did yesternight
			cgirl->m_Refused_To_Work_Day = cgirl->m_Refused_To_Work_Night = false;
			string summary = "";

			g_Girls.AddTiredness(cgirl);			// `J` moved all girls add tiredness to one place
			do_food_and_digs(current, cgirl);		// Brothel only update for girls accommodation level
			g_Girls.updateGirlAge(cgirl, true);		// update birthday counter and age the girl
			g_Girls.HandleChildren(cgirl, summary);	// handle pregnancy and children growing up
			g_Girls.updateSTD(cgirl);				// health loss to STD's				NOTE: Girl can die
			g_Girls.updateHappyTraits(cgirl);		// Update happiness due to Traits	NOTE: Girl can die
			updateGirlTurnBrothelStats(cgirl);		// Update daily stats				Now only runs once per day
			g_Girls.updateGirlTurnStats(cgirl);		// Stat Code common to Dugeon and Brothel

			if (cgirl->m_JustGaveBirth)				// if she gave birth, let her rest this week
			{
				if (cgirl->m_DayJob != restjob)		cgirl->m_PrevDayJob = cgirl->m_DayJob;
				if (cgirl->m_NightJob != restjob)	cgirl->m_PrevNightJob = cgirl->m_NightJob;
				cgirl->m_DayJob = cgirl->m_NightJob = restjob;
			}

			cgirl = cgirl->m_Next;
		}
	}

	UpdateGirls(current, 0);	// Run the Day Shift

	UpdateGirls(current, 1);	// Run the Nighty Shift

	if (current->m_Filthiness < 0)		current->m_Filthiness = 0;
	if (current->m_SecurityLevel < 0)	current->m_SecurityLevel = 0;

	g_Gold.brothel_accounts(current->m_Finance, current->m_id);

	cgirl = current->m_Girls;
	while (cgirl)
	{
		g_Girls.updateTemp(cgirl);			// update temp stuff
		g_Girls.EndDayGirls(current, cgirl);
		cgirl = cgirl->m_Next;
	}
}
Beispiel #6
0
// Run the shifts
void cArenaManager::UpdateGirls(sBrothel* brothel, bool Day0Night1)	// Start_Building_Process_B
{
	stringstream ss;
	string summary, girlName;

	u_int sw = 0, psw = 0;

	int totalPay = 0, totalTips = 0, totalGold = 0;
	int sum = EVENT_SUMMARY;
	int numgirls = GetNumGirls(brothel->m_id);

	bool matron = false, matrondone = false;
	
	
	bool refused = false;

	m_Processing_Shift = Day0Night1;		// WD:	Set processing flag to shift type

	//////////////////////////////////////////////////////
	//  Handle the start of shift stuff for all girls.  //
	//////////////////////////////////////////////////////
	sGirl* current = brothel->m_Girls;
	while (current)
	{
		if (current->health() <= 0)		// skip dead girls
		{
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		else
		{
			g_Girls.UseItems(current);					// Girl uses items she has
			g_Girls.CalculateGirlType(current);			// update the fetish traits
			g_Girls.CalculateAskPrice(current, true);	// Calculate the girls asking price

			current = current->m_Next; // Next Girl
		}
	}


	////////////////////////////////////////////////////////
	//  Process Matron first incase she refuses to work.  //
	////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current && !matrondone)
	{
		if (current->health() <= 0 ||
			(GetNumGirlsOnJob(0, matronjob, Day0Night1) > 0 && (current->m_DayJob != matronjob || current->m_NightJob != matronjob)) ||
			(GetNumGirlsOnJob(0, matronjob, Day0Night1) < 1 && (current->m_PrevDayJob != matronjob || current->m_PrevNightJob != matronjob)))
		{	// Sanity check! Don't process dead girls and only process those with matron jobs
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		// `J` so someone is or was a matron

		girlName = current->m_Realname;
		// if there is no matron on duty, we see who was on duty previously
		if (GetNumGirlsOnJob(0, matronjob, Day0Night1) < 1)
		{
			// if a matron was found and she is healthy, not tired and not on maternity leave... send her back to work
			if ((current->m_PrevDayJob == matronjob || current->m_PrevNightJob == matronjob) &&
				(g_Girls.GetStat(current, STAT_HEALTH) >= 50 && g_Girls.GetStat(current, STAT_TIREDNESS) <= 50) &&
				current->m_PregCooldown < cfg.pregnancy.cool_down())
				// Matron job is more important so she will go back to work at 50% instead of regular 80% health and 20% tired
			{
				current->m_DayJob = current->m_NightJob = matronjob;
				current->m_PrevDayJob = current->m_PrevNightJob = 255;
				current->m_Events.AddMessage("The Doctore puts herself back to work.", IMGTYPE_PROFILE, EVENT_BACKTOWORK);
			}
			else if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		// `J` Now we have a matron so lets see if she will work

		totalPay = totalTips = totalGold = 0;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");

		// `J` she can refuse the first shift then decide to work the second shift 
		if (!current->m_Refused_To_Work_Day && Day0Night1 == SHIFT_NIGHT)	// but if she worked the first shift she continues the rest of the night
		{
			matron = true;
			ss << girlName << " continued to help the other girls throughout the night.";
		}
		else if (g_Girls.DisobeyCheck(current, ACTION_WORKMATRON, brothel))
		{
			(Day0Night1 ? current->m_Refused_To_Work_Night = true : current->m_Refused_To_Work_Day = true);
			brothel->m_Fame -= g_Girls.GetStat(current, STAT_FAME);
			ss << girlName << " refused to work as the Doctore.";
			sum = EVENT_NOWORK;
		}
		else	// so there is less chance of a matron refusing the entire turn
		{
			matron = true;
			totalPay = totalTips = totalGold = 0;
			m_JobManager.JobFunc[matronjob](current, brothel, Day0Night1, summary);
			totalGold += current->m_Pay + current->m_Tips;

			// She does not get paid for the first shift and gets docked some pay from the second shift if she refused once
			if (Day0Night1 == SHIFT_NIGHT) totalGold /= 3;

			current->m_Pay += max(0, totalGold);
			current->m_Pay = current->m_Tips = 0;

			brothel->m_Fame += g_Girls.GetStat(current, STAT_FAME);
			/* */if (totalGold > 0)		{ ss << girlName << " earned a total of " << totalGold << " gold directly from you. She gets to keep it all."; }
			else if (totalGold == 0)	{ ss << girlName << " made no money."; }
			else if (totalGold < 0)		{ sum = EVENT_DEBUG; ss << "ERROR: She has a loss of " << totalGold << " gold\n\n Please report this to the Pink Petal Devloment Team at http://pinkpetal.org"; }
		}
		current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;	// Next Girl
		matrondone = true;			// there can be only one matron so this ends the while loop
	}

	
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//  Now If there is a matron and she is not refusing to work, then she can delegate the girls in this building.  //
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || sw != restjob)
		{	// skip dead girls and anyone not resting
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (current->m_PregCooldown == cfg.pregnancy.cool_down())
		{
			ss << girlName << " is on maternity leave.";
		}
		else if (current->health() < 80 || current->tiredness() > 20)
		{
			m_JobManager.JobFunc[restjob](current, brothel, Day0Night1, summary);
		}
		else
		{	// if she is healthy enough to go back to work... 
			if (matron)	// and there is a marton working...
			{
				psw = (Day0Night1 ? current->m_PrevNightJob : current->m_PrevDayJob);
				if (psw != restjob && psw != 255)
				{	// if she had a previous job, put her back to work.
					if (Day0Night1 == SHIFT_DAY)
					{
						current->m_DayJob = current->m_PrevDayJob;
						if (current->m_NightJob == restjob && current->m_PrevNightJob != restjob && current->m_PrevNightJob != 255)
							current->m_NightJob = current->m_PrevNightJob;
					}
					else
					{
						if (current->m_DayJob == restjob && current->m_PrevDayJob != restjob && current->m_PrevDayJob != 255)
							current->m_DayJob = current->m_PrevDayJob;
						current->m_NightJob = current->m_PrevNightJob;
					}
					ss << "The Doctore puts " << girlName << " back to work.\n";
				}
				else if (current->m_DayJob == restjob && current->m_NightJob == restjob)
				{	// if they have no job at all, assign them a job
					ss << "The Doctore assigns " << girlName << " to ";

					// need at least 1 guard and 1 cleaner (because guards must be free, they get assigned first)
					if (current->is_free() && GetNumGirlsOnJob(0, JOB_CITYGUARD, Day0Night1) < 1)
					{
						current->m_DayJob = current->m_NightJob = JOB_CITYGUARD;
						ss << "work helping the city guard.";
					}
					else if (GetNumGirlsOnJob(0, JOB_CLEANARENA, Day0Night1) < 1)
					{
						current->m_DayJob = current->m_NightJob = JOB_CLEANARENA;
						ss << "work cleaning the arena.";
					}
					else if (GetNumGirlsOnJob(0, JOB_BLACKSMITH, Day0Night1) < 1)
					{
						current->m_DayJob = current->m_NightJob = JOB_BLACKSMITH;
						ss << "work making weapons and armor.";
					}
					else if (GetNumGirlsOnJob(0, JOB_COBBLER, Day0Night1) < 1)
					{
						current->m_DayJob = current->m_NightJob = JOB_COBBLER;
						ss << "work making shoes and leather items.";
					}
					else if (GetNumGirlsOnJob(0, JOB_JEWELER, Day0Night1) < 1)
					{
						current->m_DayJob = current->m_NightJob = JOB_JEWELER;
						ss << "work making jewelery.";
					}

					// next assign more guards and cleaners if there are a lot of girls to choose from
					else if (current->is_free() && GetNumGirlsOnJob(0, JOB_CITYGUARD, Day0Night1) < numgirls / 20)
					{
						current->m_DayJob = current->m_NightJob = JOB_CITYGUARD;
						ss << "work helping the city guard.";
					}
					else if (GetNumGirlsOnJob(0, JOB_CLEANARENA, Day0Night1) < numgirls / 20)
					{
						current->m_DayJob = current->m_NightJob = JOB_CLEANARENA;
						ss << "work cleaning the arena.";
					}
					else if (GetNumGirlsOnJob(0, JOB_BLACKSMITH, Day0Night1) < numgirls / 20)
					{
						current->m_DayJob = current->m_NightJob = JOB_BLACKSMITH;
						ss << "work making weapons and armor.";
					}
					else if (GetNumGirlsOnJob(0, JOB_COBBLER, Day0Night1) < numgirls / 20)
					{
						current->m_DayJob = current->m_NightJob = JOB_COBBLER;
						ss << "work making shoes and leather items.";
					}
					else if (GetNumGirlsOnJob(0, JOB_JEWELER, Day0Night1) < numgirls / 20)
					{
						current->m_DayJob = current->m_NightJob = JOB_JEWELER;
						ss << "work making jewelery.";
					}

					// Assign fighters - 50+ combat

					/*	Only fight beasts if there are 10 or more available
					*		and 1 girl per 10 beasts so they don't get depleted too fast.
					*	You can manually assign more if you want but I prefer to save beasts for the brothel
					*		until each building has their own beast supply.
					*	The farm will supply them when more work gets done to it
					*/
					else if (current->combat() > 60 && g_Brothels.GetNumBeasts() >= 10 &&
						GetNumGirlsOnJob(0, JOB_FIGHTBEASTS, Day0Night1) < g_Brothels.GetNumBeasts() / 10)
					{
						current->m_DayJob = current->m_NightJob = JOB_FIGHTBEASTS;
						ss << "work fighting beast in the arena.";
					}
					// if there are not enough beasts, have the girls fight other girls
					else if (current->combat() > 60 && GetNumGirlsOnJob(0, JOB_FIGHTARENAGIRLS, Day0Night1) < 1)
					{
						current->m_DayJob = current->m_NightJob = JOB_FIGHTARENAGIRLS;
						ss << "work fighting other girls in the arena.";
					}

					else	// assign anyone else to Traning
					{
						current->m_DayJob = current->m_NightJob = JOB_FIGHTTRAIN;
						ss << "train for the arena.";
					}
				}
				current->m_PrevDayJob = current->m_PrevNightJob = 255;
				sum = EVENT_BACKTOWORK;
			}
			else	// no one to send her back to work
			{
				ss << "WARNING " << girlName << " is doing nothing!\n";
				sum = EVENT_WARNING;
			}
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;
	}

	///////////////////////////////////////////////////////////
	//  All Jobs in the Arena can be done at the same time.  //
	///////////////////////////////////////////////////////////
	/* `J` zzzzzz - Need to split up the jobs
	Done - JOB_ARENAREST, JOB_DOCTORE

	JOB_CLEANARENA

	JOB_FIGHTBEASTS
	JOB_FIGHTARENAGIRLS
	JOB_FIGHTTRAIN
	JOB_CITYGUARD


	//*/
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->health() <= 0 || sw == restjob || sw == matronjob)
		{	// skip dead girls, resting girls and the matron
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		totalPay = totalTips = totalGold = 0;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		// fight beasts so if there is no beasts dont want them doing nothing
		if (sw == JOB_FIGHTBEASTS && g_Brothels.GetNumBeasts() < 1)
		{
			stringstream ssc;
			ssc << "There are no beasts to fight so " << girlName << " was sent to ";

			if (current->health() < 50)
			{
				ssc << "rest and heal";
				sw = restjob;
			}
			else if (current->combat() > 90 && current->magic() > 90 && current->agility() > 90 && current->constitution() > 90 && current->health() > 90)
			{
				ssc << "fight other girls";
				sw = JOB_FIGHTARENAGIRLS;
			}
			else
			{
				ssc << "train for combat";
				sw = JOB_FIGHTTRAIN;
			}
			ssc << " instead.\n\n";
			current->m_Events.AddMessage(ssc.str(), IMGTYPE_PROFILE, Day0Night1);

		}

		// do their job
		refused = m_JobManager.JobFunc[sw](current, brothel, Day0Night1, summary);

		totalPay += current->m_Pay;
		totalTips += current->m_Tips;
		totalGold += current->m_Pay + current->m_Tips;
		g_Brothels.CalculatePay(brothel, current, sw);

		//		Summary Messages
		if (refused)
		{
			brothel->m_Fame -= g_Girls.GetStat(current, STAT_FAME);
			ss << girlName << " refused to work so made no money.";
		}
		else
		{
			ss << m_JobManager.GirlPaymentText(brothel, current, totalTips, totalPay, totalGold, Day0Night1);
			if (totalGold < 0) sum = EVENT_DEBUG;

			brothel->m_Fame += g_Girls.GetStat(current, STAT_FAME);
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}

	///////////////////////////////////
	//  Finaly do end of day stuff.  //
	///////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		if (current->health() <= 0)
		{	// skip dead girls
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		girlName = current->m_Realname;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");

		// update for girls items that are not used up
		do_daily_items(brothel, current);					// `J` added

		// Level the girl up if nessessary
		g_Girls.LevelUp(current);
		// Natural healing, 2% health and 2% tiredness per day
		g_Girls.UpdateStat(current, STAT_HEALTH, 2, false);
		g_Girls.UpdateStat(current, STAT_TIREDNESS, -2, false);


		if (g_Girls.GetStat(current, STAT_HAPPINESS) < 40)
		{
			if (current->m_NightJob != matronjob && matron && brothel->m_NumGirls > 1 && g_Dice.percent(70))
			{
				ss << "The Doctore helps cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 10 + 5);
			}
			else if (brothel->m_NumGirls > 10 && g_Dice.percent(50))
			{
				ss << "Some of the other girls help cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 8 + 3);
			}
			else if (brothel->m_NumGirls > 1 && g_Dice.percent(max(brothel->m_NumGirls, 50)))
			{
				ss << "One of the other girls helps cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 6 + 2);
			}
			else if (brothel->m_NumGirls == 1 && g_Dice.percent(70))
			{
				ss << girlName << " plays around in the empty building until she feels better.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 10 + 10);
			}
			else if (g_Girls.GetStat(current, STAT_HAPPINESS) < 20) // no one helps her and she is really unhappy
			{
				ss << girlName << " is looking very depressed. You may want to do something about that before she does something drastic.\n";
				sum = EVENT_WARNING;
			}
		}

		if (g_Girls.GetStat(current, STAT_TIREDNESS) > 80 || g_Girls.GetStat(current, STAT_HEALTH) < 40)
		{
			int t = g_Girls.GetStat(current, STAT_TIREDNESS);
			int h = g_Girls.GetStat(current, STAT_HEALTH);

			if (!matron)	// do no matron first as it is the easiest
			{
				ss << "WARNING! " << girlName;
				if (t > 80 && h < 20)		ss << " is in real bad shape, she is tired and injured.\nShe should go to the Clinic.\n";
				else if (t > 80 && h < 40)	ss << " is in bad shape, she is tired and injured.\nShe should rest or she may die!\n";
				else if (t > 80)			ss << " is desparatly in need of rest.\nGive her some free time\n";
				else if (h < 20)			ss << " is badly injured.\nShe should rest or go to the Clinic.\n";
				else if (h < 40)			ss << " is hurt.\nShe should rest and recuperate.\n";
			}
			else if (current->m_NightJob == matronjob && matron)	// do matron	
			{
				if (t > 90 && h < 10)	// The matron may take herself off work if she is really bad off
				{
					current->m_PrevDayJob = current->m_DayJob;
					current->m_PrevNightJob = current->m_NightJob;
					current->m_DayJob = current->m_NightJob = restjob;
					ss << "The Doctore takes herself off duty because she is just too damn sore.\n";
					g_Girls.UpdateEnjoyment(current, ACTION_WORKMATRON, -10);
				}
				else
				{
					ss << "As Doctore, " << girlName << " has the keys to the store room.\nShe used them to 'borrow' ";
					if (t > 80 && h < 40)
					{
						ss << "some potions";
						g_Gold.consumable_cost(20);
						current->m_Stats[STAT_HEALTH] = min(current->m_Stats[STAT_HEALTH] + 20, 100);
						current->m_Stats[STAT_TIREDNESS] = max(current->m_Stats[STAT_TIREDNESS] - 20, 0);
					}
					else if (t > 80)
					{
						ss << "a resting potion";
						g_Gold.consumable_cost(10, true);
						current->m_Stats[STAT_TIREDNESS] = max(current->m_Stats[STAT_TIREDNESS] - 20, 0);
					}
					else if (h < 40)
					{
						ss << "a healing potion";
						g_Gold.consumable_cost(10, true);
						current->m_Stats[STAT_HEALTH] = min(current->m_Stats[STAT_HEALTH] + 20, 100);
					}
					ss << " for herself.\n";
				}
			}
			else	// do all other girls with a matron working
			{
				if (current->m_PrevNightJob == 255 && current->m_PrevDayJob == 255) // the girl has been working
				{
					current->m_PrevDayJob = current->m_DayJob;
					current->m_PrevNightJob = current->m_NightJob;
					current->m_DayJob = current->m_NightJob = restjob;
					ss << "The Doctore takes " << girlName << " off duty to rest due to her ";
					if (t > 80 && h < 40)	ss << "exhaustion.\n";
					else if (t > 80)		ss << "tiredness.\n";
					else if (h < 40)		ss << "low health.\n";
					else /*       */		ss << "current state.\n";
				}
				else	// the girl has already been taken off duty by the matron
				{
					if (g_Dice.percent(70))
					{
						ss << "The Doctore helps ";
						if (t > 80 && h < 40)
						{
							ss << girlName << " recuperate.\n";
							g_Girls.UpdateStat(current, STAT_TIREDNESS, -(g_Dice % 4 + 2));
							g_Girls.UpdateStat(current, STAT_HEALTH, (g_Dice % 4 + 2));
						}
						else if (t > 80)
						{
							ss << girlName << " to relax.\n";
							g_Girls.UpdateStat(current, STAT_TIREDNESS, -(g_Dice % 5 + 5));
						}
						else if (h < 40)
						{
							ss << " heal " << girlName << ".\n";
							g_Girls.UpdateStat(current, STAT_HEALTH, (g_Dice % 5 + 5));
						}
					}
				}
			}
		}

		if (ss.str().length() > 0)	current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;		// Process next girl
	}

	m_Processing_Shift = -1;	// WD: Finished Processing Shift set flag
}
Beispiel #7
0
void cDungeon::Update()
{
	/*
	*	WD: GetNumGirlsOnJob() not testing if the girl worked
	*
	*/
	sGirl* TorturerGirlref = 0;
	string girlName;
	stringstream msg;
	stringstream ss;

	// Reser counters
	m_NumGirlsTort = m_NumCustsTort = 0;

	// WD:	Did we torture the girls
	bool tort = g_Brothels.TortureDone();
	// WD: If so, who is the Torturer
	if (tort) { TorturerGirlref = g_Brothels.WhoHasTorturerJob(); }

	/*********************************
	*	DO ALL DUNGEON GIRLS
	*********************************/
	if (m_Girls)
	{

		sDungeonGirl* current = m_Girls;
		while (current)
		{
			sGirl* girl = current->m_Girl;

			//			girl->m_Tort = false;// WD: Move till after Girls have been tortured so that we dont torture twice week
			girlName = girl->m_Realname;
			ss.str("");
			msg.str("");

			// Check for dead girls
			if (girl->health() <= 0)
			{
				// remove dead bodies from last week
				if (current->m_Reason == DUNGEON_DEAD)
				{
					sDungeonGirl* temp = current;
					current = current->m_Next;
					msg << girlName << "'s body has been removed from the dungeon since she was dead.";
					g_MessageQue.AddToQue(msg.str(), COLOR_RED);
					delete RemoveGirl(temp);
					continue;
				}
				// Mark as dead
				else
				{
					m_NumberDied++;
					current->m_Reason = DUNGEON_DEAD;
					SetGameFlag(FLAG_DUNGEONGIRLDIE);
					continue;
				}
			}
			/*
			*			DAILY Processing
			*/
			string summary = "";

			current->m_Weeks++;						// the number of weeks they have been in the dungeon
			g_Girls.CalculateGirlType(girl);		// update the fetish traits
			g_Girls.updateGirlAge(girl, true);		// update birthday counter and age the girl
			g_Girls.updateTemp(girl);			// update temp stuff
			g_Girls.EndDayGirls(g_Brothels.GetBrothel(0), girl);
			g_Girls.HandleChildren(girl, summary);	// handle pregnancy and children growing up
			g_Girls.updateSTD(girl);				// health loss to STD's - NOTE: Girl can die
			g_Girls.updateHappyTraits(girl);		// Update happiness due to Traits - NOTE: Girl can die
			updateGirlTurnDungeonStats(current);	// Update stats
			g_Girls.updateGirlTurnStats(girl);		// Stat Code common to Dugeon and Brothel

			// Check again for dead girls
			if (g_Girls.GetStat(girl, STAT_HEALTH) <= 0)
			{
				m_NumberDied++;
				current->m_Reason = DUNGEON_DEAD;
				SetGameFlag(FLAG_DUNGEONGIRLDIE);

				msg.str(""); ss.str("");
				msg << girlName << gettext(" has died in the dungeon.");
				girl->m_Events.AddMessage(msg.str(), IMGTYPE_DEATH, EVENT_DANGER);
				ss << girlName << gettext(" has died.  Her body will be removed by the end of the week.\n");
				girl->m_Events.AddMessage(ss.str(), IMGTYPE_DEATH, EVENT_SUMMARY);

				// if there is a torturer send her a message
				if (tort)
				{
					msg.str("");
					msg << girlName << gettext(" has died in the dungeon under her care!");
					TorturerGirlref->m_Events.AddMessage(msg.str(), IMGTYPE_PROFILE, EVENT_DUNGEON);
				}

				current = current->m_Next;
				continue;
			}

			// Have dungeon girls tortured by the Torturer
			if (tort)
			{
				cGirlTorture gt(current, TorturerGirlref);
			}

			/*		`J` merged WARNING MESSAGES and SUMMARY MESSAGES
			*			Allow girl sorting in turn summary
			*/
			//	`J` set the basics
			msg.str(""); ss.str("");
			msg << girlName << gettext(" is languish in the dungeon.\n\n");
			int msgtype = EVENT_DUNGEON;
			int imgtype = IMGTYPE_PROFILE;
			int	nHealth = girl->health();
			int	nTired = girl->tiredness();

			//	`J` check them for dangers or warnings
			if (nHealth < 20 || nTired > 80)
			{
				msg << gettext("DANGER: ") << girlName;
				msgtype = EVENT_DANGER;
			}
			else if (nHealth < 40 || nTired > 60)
			{
				msg << gettext("WARNING: ") << girlName;
				msgtype = EVENT_WARNING;
			}

			//	`J` did msgtype change?
			if (msgtype != EVENT_DUNGEON)
			{
				if (girl->m_Tort)
				{
					msg << gettext(" was tortured this week.");
					imgtype = IMGTYPE_TORTURE;
					if (nHealth < 40 || nTired > 60)	{ msg << gettext("\nShe"); }
				}
				if (nHealth < 20)						{ msg << gettext(" is severely injured"); }
				else if (nHealth < 40)					{ msg << gettext(" is injured"); }
				if (nHealth < 40 && nTired > 60)		{ msg << gettext(" and"); }
				else if (nTired > 60)					{ msg << gettext(" is"); }
				else									{ msg << gettext("."); }
				if (nTired > 80)						{ msg << gettext(" exhausted, it may effect her health."); }
				else if (nTired > 60)					{ msg << gettext(" tired."); }
				msg << gettext("\n\nHer health is ") << nHealth << gettext(".\nHer tiredness is ") << nTired << ".";
			}
			girl->m_Events.AddMessage(msg.str(), imgtype, msgtype);

			girl->m_Tort = false;

			// loop next dungeon girl	
			current = current->m_Next;
		}

		/*
		*			WD:  Torturer Girl summary
		*				Processed after all dGirls
		*/
		if (tort)
		{
			msg.str("");
			msg << TorturerGirlref->m_Realname << gettext(" has tortured ") << m_NumGirlsTort << gettext(" girls in the Dungeon.");
			TorturerGirlref->m_Events.AddMessage(msg.str(), IMGTYPE_PROFILE, EVENT_DUNGEON);

		}
	}


	/*********************************
	*	DO ALL CUSTOMERS
	*********************************/
	if (m_Custs)
	{
		sDungeonCust* current = m_Custs;
		while (current)
		{
			current->m_Tort = false;
			if (current->m_Health <= 0)
			{
				m_NumberDied++;
				current->m_Reason = DUNGEON_DEAD;
				SetGameFlag(FLAG_DUNGEONCUSTDIE);
			}
			if (current->m_Reason == DUNGEON_DEAD)
			{
				sDungeonCust* temp = current;
				current = current->m_Next;
				RemoveCust(temp);
				continue;
			}

			/*
			*			lose health if not feeding
			*
			*			Mod: removed "no-effect" branch to silence
			*			compiler
			*/
			if (!current->m_Feeding) current->m_Health -= 5;

			current->m_Weeks++;
			if (current->m_Health <= 0)
			{
				m_NumberDied++;
				current->m_Reason = DUNGEON_DEAD;
				SetGameFlag(FLAG_DUNGEONCUSTDIE);
			}
			current = current->m_Next;
		}
	}
}
bool cGirlTorture::IsGirlInjured(unsigned int unModifier)
{  // modifier: 5 = 5% chance, 10 = 10% chance

	// Sanity check, Can't get injured
	if (m_Girl->has_trait("Incorporeal")) return false;


	/*
	*	WD	Injury was only possible if girl is pregnant or
	*		hasn't got the required traits.
	*
	*		Now check for injury first
	*		Use usigned int so can't pass negative chance
	*/
	string	sMsg;
	string	sGirlName = m_Girl->m_Realname;
	int		nMod = static_cast<int>(unModifier);
	if (cfg.initial.torture_mod() < 0){ nMod += nMod; }


	if (m_Girl->has_trait("Fragile"))	nMod += nMod;	// nMod *= 2;
	if (m_Girl->has_trait("Tough"))		nMod /= 2;
	if (nMod < 1) nMod = 1;		// `J` always at least a 1% chance

	// Did the girl get injured
	if (!g_Dice.percent(nMod)) return false;
	/*
	*	INJURY PROCESSING
	*	Only injured girls continue past here
	*/

	// Post any outstanding Player messages
	if (m_TorturedByPlayer && !m_Message.empty())
	{
		g_MessageQue.AddToQue(m_Message, 0);
		m_Girl->m_Events.AddMessage(m_Message, IMGTYPE_TORTURE, EVENT_SUMMARY);	// `J` added

		m_Message = sGirlName + ": ";
	}

	// getting hurt badly could lead to scars
	if (g_Dice.percent(nMod * 2) &&
		!m_Girl->has_trait("Small Scars") &&
		!m_Girl->has_trait("Cool Scars") &&
		!m_Girl->has_trait("Horrific Scars"))
	{
		int chance = g_Dice % 6;
		if (chance == 0)
		{
			m_Girl->add_trait("Horrific Scars", false);
			if (m_TorturedByPlayer)
				m_Message += gettext("She was badly injured, and now has to deal with Horrific Scars.\n");
			else
				MakeEvent(sGirlName + gettext(" was badly injured, and now has Horrific Scars.\n"));
		}
		else if (chance <= 2)
		{
			m_Girl->add_trait("Small Scars", false);
			if (m_TorturedByPlayer)
				m_Message += gettext("She was injured and now has a couple of Small Scars.\n");
			else
				MakeEvent(sGirlName + gettext(" was injured, and now has Small Scars.\n"));
		}
		else
		{
			m_Girl->add_trait("Cool Scars", false);
			if (m_TorturedByPlayer)
				m_Message += gettext("She was injured and scarred. As scars go however, at least they are pretty Cool Scars.\n");
			else
				MakeEvent(sGirlName + gettext(" was injured and scarred. She now has Cool Scars.\n"));
		}
	}

	// in rare cases, she might even lose an eye
	if (g_Dice.percent((nMod / 2)) &&
		!m_Girl->has_trait("One Eye") &&
		!m_Girl->has_trait("Eye Patch"))
	{
		int chance = g_Dice % 3;
		if (chance == 0)
		{
			m_Girl->add_trait("One Eye", false);
			if (m_TorturedByPlayer)
				m_Message += gettext("Oh, no! She was badly injured, and now only has One Eye!\n");
			else
				MakeEvent(sGirlName + gettext(" was badly injured and lost an eye.\n"));
		}
		else
		{
			m_Girl->add_trait("Eye Patch", false);
			if (m_TorturedByPlayer)
				m_Message += gettext("She was injured and lost an eye, but at least she has a cool Eye Patch to wear.\n");
			else
				MakeEvent(sGirlName + gettext(" was injured and lost an eye, but at least she has a cool Eye Patch to wear.\n"));
		}
	}

	// or lose tough or become fragile
	if (m_Girl->has_trait("Tough"))
	{
		if (g_Dice.percent(nMod))
		{
			g_Girls.RemoveTrait(m_Girl, "Tough", false);
			if (m_TorturedByPlayer)
				m_Message += gettext("Her body has become less Tough due to the extent of her injuries.\n");
			else
				MakeEvent("Due to " + sGirlName + gettext(" injuries her body has become less Tough.\n"));
		}
	}
	else if (!m_Girl->has_trait("Fragile"))
	{
		if (g_Dice.percent(nMod / 2))
		{
			m_Girl->add_trait("Fragile", false);
			if (m_TorturedByPlayer)
				m_Message += gettext("Her body has become rather Fragile due to the extent of her injuries.\n");
			else
				MakeEvent("Due to " + sGirlName + gettext(" injuries her body has become fragile.\n"));
		}
	}

	// and if pregnant, she might lose the baby; I'll assume inseminations can't be aborted so easily
	if ((m_Girl->carrying_human() && g_Dice.percent(nMod * 2)) ||
		(m_Girl->carrying_monster() && g_Dice.percent(nMod)))	// `J` added insemination loss chance
	{  // unintended abortion time
		//injured = true;
		m_Girl->m_ChildrenCount[CHILD08_MISCARRIAGES]++;
		m_Girl->clear_pregnancy();
		m_Girl->happiness(-20);
		m_Girl->spirit(-5);
		if (m_TorturedByPlayer)
			m_Message += gettext("Her unborn child has been lost due to the injuries she sustained, leaving her quite distraught.\n");
		else
			MakeEvent(gettext("Due to ") + sGirlName + gettext(" injuries she has had a miscarriage, leaving her quite distraught.\n"));
	}


	int damage = 5 + g_Dice % 10;								// Lose between 5 - 14 hp
	if (cfg.initial.torture_mod() < 0){ damage += damage / 2; }	// `J` Lose between 7 - 21 hp if harsh torture
	m_Girl->health(-damage);


	// Post any new Player messages in Red Message Box Colour 1 
	if (m_TorturedByPlayer && !m_Message.empty() && m_Message != sGirlName + ": ")
	{
		g_MessageQue.AddToQue(m_Message, COLOR_RED);
		m_Girl->m_Events.AddMessage(m_Message, IMGTYPE_TORTURE, EVENT_DAYSHIFT);	// `J` added

		m_Message = sGirlName + ": ";
	}

	return true;
}
void cGirlTorture::DoTorture()
{
	/*
	*	These variables to be initilisied befor calling DoTorture()
	*		bool			m_TorturedByPlayer
	*		sGirl			*m_Girl;
	*		sGirl			*m_Torturer;
	*		sDungeonGirl	*m_DungeonGirl;
	*		Dungeon			*m_Dungeon;
	*/

	// Sanity check. Abort on dead girl
	if (m_Girl->health() <= 0) return;

	m_Fight = false;

	string sGirlName = m_Girl->m_Realname;
	string sMsg = "";
	CLog	l;
	bool bDebug = cfg.debug.log_torture();

	if (bDebug)
	{
		if (m_TorturedByPlayer) l.ss() << "\ncGirlTorture: Player is torturing " << sGirlName << ".";
		else l.ss() << "\ncGirlTorture: " << m_Torturer->m_Realname << " is torturing " << sGirlName << ".";
		l.ssend();
	}
	/*
	*	clear down the message and start with her name
	*/
	m_Message = "";
	if (m_TorturedByPlayer) m_Message = sGirlName + ": ";
	/*
	*	only allow this once a week
	*/
	// WD	Don't allow girls to be tortured by both the Player and the Torturer
	if (m_Girl->m_Tort && !g_Cheats)
	{
		if (m_TorturedByPlayer) m_Message += gettext("You may only torture someone once per week.\n");
		else m_Message += sGirlName + gettext(" has already been tortured this week.\n");
		return;
	}


	// Don't torture new mums
	if (m_Girl->m_JustGaveBirth)
	{
		if (m_TorturedByPlayer)
		{
			m_Message += gettext("She has given birth and has the week off. So she and will not be tortured.\n");
		}
		else
		{
			sMsg = sGirlName + gettext(" gave birth and had the week off so was not tortured this week.");
			m_Message += gettext("Since ") + sGirlName + gettext(" gave birth she was not tortured this week.\n");
			//m_Girl->m_Events.AddMessage(sMsg, IMGTYPE_PROFILE, EVENT_DUNGEON);
			m_Torturer->m_Events.AddMessage(sMsg, IMGTYPE_PROFILE, EVENT_DUNGEON);
		}
		return;
	}

	m_Girl->m_Tort = true;
	if (!m_TorturedByPlayer)
		m_Dungeon->NumGirlsTort(+1);

#if 0
	/*
	*	WD	Way too much evilness for torturing moved
	*		this to runaway code in girl_escapes()
	*
	*	add 5 evil points for attempted torture.
	*	original code had this as non-slave only...
	*/
	The_Player->evil(5);
#endif

	/*
	*	OK: she may fight, and if she wins she'll escape
	*
	*	BUG: Intermitent crash if cGirlGangFight() is
	*		is called when tortured by Girl not Player
	*
	*	WD:	To balance this halve chance of gaining trait
	*		in cGirlTorture::add_trait()
	*/
	if (m_TorturedByPlayer)
	{
		if (girl_escapes()) return;
	}

	/*
	*	on the grounds that while intending to torture someone is bad
	*	actually doing it is worse still...
	*
	*	also if she's not a slave that's a bit worse still
	*	(allowing players who need to discipline their slaves
	*	a bit of a break...)
	*
	*	WD	With changes to cPlayer stats how quickly you gain Evil depends
	*		on how evil you currently are. Limited to min of 1 point.
	*
	*/
	if (m_TorturedByPlayer)
	{
		if (m_Girl->is_slave())
			The_Player->evil(5);
		else
			The_Player->evil(10);
	}
	else	// Tortured by Girl
	{
		if (m_Girl->is_slave())
			The_Player->evil(2);
		else
			The_Player->evil(4);

	}
	/*
	*	now add one of a number of torture messages...
	*/
	if (m_TorturedByPlayer)
		AddTextPlayer();
	else
		AddTextTorturerGirl();
	/*
	*	check for injury
	*/
	if (IsGirlInjured(3))
	{
		if (m_TorturedByPlayer)
		{
			m_Message += gettext(" You were a little too heavy handed and badly injure her.\n");
		}
		else
		{
			sMsg = sGirlName + gettext(" was seriously injured in the dungeon this week.");
			m_Girl->m_Events.AddMessage(sMsg, IMGTYPE_TORTURE, EVENT_WARNING);
			m_Torturer->m_Events.AddMessage(sMsg, IMGTYPE_PROFILE, EVENT_DUNGEON);
		}
	}
	/*
	*	hmmm... not entirely sure this needs to be a class
	*/
	UpdateStats();
	UpdateTraits();

	// `J` wear down rebellion
	g_Girls.updateTempTraits(m_Girl, "Kidnapped", -1);
	g_Girls.updateTempTraits(m_Girl, "Emprisoned Customer", -1);

	/*
	*	DANGER DEATH and low health warnings
	*
	*/
	if (m_TorturedByPlayer)
	{
		if (m_Girl->health() <= 0)		// Dead Girl
			m_Message += gettext("She unfortunatly died from her wounds.\n");

		else if (m_Girl->health() < 20)
			m_Message += gettext("Also, she is close to death.\n");

	}

	else	// Tortured by Torturer Girl
	{
		if (m_Girl->health() <= 0)
		{
			sMsg = gettext("While torturing ") + sGirlName +
				gettext(" in the dungeon she died from her wounds.");
			m_Torturer->m_Events.AddMessage(sMsg, IMGTYPE_PROFILE, EVENT_DANGER);
		}
		else if (m_Girl->health() < 20)
		{
			// if she is on this low health the tortuer will start feeding again
			if (!m_DungeonGirl->m_Feeding)
			{
				m_DungeonGirl->m_Feeding = true;
				sMsg = m_Torturer->m_Realname + gettext(" has allowed ") + sGirlName +
					gettext("  to eat because her health was low.\n");
				m_Message += m_Torturer->m_Realname +
					gettext(" was allowed her food because her health was low.\n");
				m_Girl->m_Events.AddMessage(sMsg, IMGTYPE_TORTURE, EVENT_DANGER);
				m_Torturer->m_Events.AddMessage(sMsg, IMGTYPE_PROFILE, EVENT_DANGER);
			}
			else
			{
				sMsg = sGirlName + gettext("  health is low from ongoing torture.");
				// WD	Low health warnings done as part of cDungeon::Update()
				//m_Girl->m_Events.AddMessage(sMsg, IMGTYPE_TORTURE, EVENT_DANGER);
				m_Torturer->m_Events.AddMessage(sMsg, IMGTYPE_PROFILE, EVENT_DANGER);
			}

		}
	}

	if (bDebug)
	{
		l.ss() << "cGirlTorture: " << sGirlName << " torture completed!\n";
		l.ssend();
	}

}
Beispiel #10
0
// Run the shifts
void cClinicManager::UpdateGirls(sBrothel* brothel, bool Day0Night1)	// Start_Building_Process_B
{
	// `J` When modifying Jobs, search for "J-Change-Jobs"  :  found in >> cClinic.cpp
	u_int restjob = JOB_CLINICREST;
	u_int matronjob = JOB_CHAIRMAN;
	u_int firstjob = JOB_GETHEALING;
	u_int lastjob = JOB_JANITOR;
	stringstream ss;
	string summary, girlName;

	u_int sw = 0, psw = 0;

	int totalPay = 0, totalTips = 0, totalGold = 0;
	int sum = EVENT_SUMMARY;
	int numgirls = GetNumGirls(brothel->m_id);

	bool matron = false, matrondone = false;
	int numDoctors = 0, numNurses = 0;

	bool refused = false;

	m_Processing_Shift = Day0Night1;		// WD:	Set processing flag to shift type

	//////////////////////////////////////////////////////
	//  Handle the start of shift stuff for all girls.  //
	//////////////////////////////////////////////////////
	sGirl* current = brothel->m_Girls;
	while (current)
	{
		if (current->is_dead())		// skip dead girls
		{
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		else
		{
			sum = EVENT_SUMMARY; summary = ""; ss.str("");

			g_Girls.UseItems(current);				// Girl uses items she has
			g_Girls.CalculateGirlType(current);		// update the fetish traits
			g_Girls.CalculateAskPrice(current, true);	// Calculate the girls asking price

			if (g_Girls.HasTrait(current, "AIDS") &&
				(current->m_DayJob == JOB_DOCTOR || current->m_DayJob == JOB_INTERN || current->m_DayJob == JOB_NURSE
				|| current->m_NightJob == JOB_DOCTOR || current->m_NightJob == JOB_INTERN || current->m_NightJob == JOB_NURSE))
			{
				ss << "Health laws prohibit anyone with AIDS from working in the Medical profession so " << girlName << " was sent to the waiting room.";
				current->m_DayJob = current->m_NightJob = JOB_CLINICREST;
				sum = EVENT_WARNING;
			}
			if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);
			current = current->m_Next; // Next Girl
		}

	}


	////////////////////////////////////////////////////////
	//  Process Matron first incase she refuses to work.  //
	////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current && !matrondone)
	{
		if (current->is_dead() ||
			(GetNumGirlsOnJob(0, matronjob, Day0Night1) > 0 && (current->m_DayJob != matronjob || current->m_NightJob != matronjob)) ||
			(GetNumGirlsOnJob(0, matronjob, Day0Night1) < 1 && (current->m_PrevDayJob != matronjob || current->m_PrevNightJob != matronjob)))
		{	// Sanity check! Don't process dead girls and only process those with matron jobs
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		// `J` so someone is or was a matron

		girlName = current->m_Realname;
		// if there is no matron on duty, we see who was on duty previously
		if (GetNumGirlsOnJob(0, matronjob, Day0Night1) < 1)
		{
			// if a matron was found and she is healthy, not tired and not on maternity leave... send her back to work
			if ((current->m_PrevDayJob == matronjob || current->m_PrevNightJob == matronjob) &&
				(g_Girls.GetStat(current, STAT_HEALTH) >= 50 && g_Girls.GetStat(current, STAT_TIREDNESS) <= 50) &&
				current->m_PregCooldown < cfg.pregnancy.cool_down())
				// Matron job is more important so she will go back to work at 50% instead of regular 80% health and 20% tired
			{
				current->m_DayJob = current->m_NightJob = matronjob;
				current->m_PrevDayJob = current->m_PrevNightJob = 255;
				current->m_Events.AddMessage("The Chairman puts herself back to work.", IMGTYPE_PROFILE, EVENT_BACKTOWORK);
			}
			else if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		// `J` Now we have a matron so lets see if she will work

		totalPay = totalTips = totalGold = 0;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");

		// `J` she can refuse the first shift then decide to work the second shift 
		if (!current->m_Refused_To_Work_Day && Day0Night1 == SHIFT_NIGHT)	// but if she worked the first shift she continues the rest of the night
		{
			matron = true;
			ss << girlName << " continued to help the other girls throughout the night.";
		}
		else if (g_Girls.DisobeyCheck(current, ACTION_WORKMATRON, brothel))
		{
			(Day0Night1 ? current->m_Refused_To_Work_Night = true : current->m_Refused_To_Work_Day = true);
			brothel->m_Fame -= g_Girls.GetStat(current, STAT_FAME);
			ss << girlName << " refused to work as the Chairman.";
			sum = EVENT_NOWORK;
		}
		else	// so there is less chance of a matron refusing the entire turn
		{
			matron = true;
			totalPay = totalTips = totalGold = 0;
			m_JobManager.JobFunc[matronjob](current, brothel, Day0Night1, summary);
			totalGold += current->m_Pay + current->m_Tips;

			// She does not get paid for the first shift and gets docked some pay from the second shift if she refused once
			if (Day0Night1 == SHIFT_NIGHT) totalGold /= 3;

			current->m_Pay += max(0, totalGold);
			current->m_Pay = current->m_Tips = 0;

			brothel->m_Fame += g_Girls.GetStat(current, STAT_FAME);
			/* */if (totalGold > 0)		{ ss << girlName << " earned a total of " << totalGold << " gold directly from you. She gets to keep it all."; }
			else if (totalGold == 0)	{ ss << girlName << " made no money."; }
			else if (totalGold < 0)		{ sum = EVENT_DEBUG; ss << "ERROR: She has a loss of " << totalGold << " gold\n\nPlease report this to the Pink Petal Devloment Team at http://pinkpetal.org\n" << "\nGirl Name: " << current->m_Realname << "\nJob: " << m_JobManager.JobName[(Day0Night1 ? current->m_NightJob : current->m_DayJob)] << "\nPay:     " << current->m_Pay << "\nTips:   " << current->m_Tips << "\nTotal: " << totalGold; }
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;	// Next Girl
		matrondone = true;			// there can be only one matron so this ends the while loop
	}

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//  Now If there is a matron and she is not refusing to work, then she can delegate the girls in this building.  //
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->is_dead() || sw != restjob)
		{	// skip dead girls and anyone not resting
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (current->m_PregCooldown == cfg.pregnancy.cool_down())
		{
			ss << girlName << " is on maternity leave.";
		}
		else if (matron && (current->health() < 80 || current->tiredness() > 20))	// if she is not healthy enough to go back to work
		{
			ss << "The Chairman admits " << girlName << " to get ";
			/* */if (g_Girls.HasTrait(current, "Construct"))		{ ss << "repaired";				current->m_DayJob = current->m_NightJob = JOB_GETREPAIRS; }
			else if (g_Girls.HasTrait(current, "Half-Construct"))	{ ss << "healed and repaired";	current->m_DayJob = JOB_GETHEALING;	current->m_NightJob = JOB_GETREPAIRS; }
			else/*                                             */	{ ss << "healed";				current->m_DayJob = current->m_NightJob = JOB_GETHEALING; }
			ss << ".\n";
		}
		else if (current->health() < 40 || current->tiredness() > 60 && g_Dice.percent(current->intelligence()))
		{
			ss << girlName << " checks herself in to get ";
			/* */if (g_Girls.HasTrait(current, "Construct"))		{ ss << "repaired";				current->m_DayJob = current->m_NightJob = JOB_GETREPAIRS; }
			else if (g_Girls.HasTrait(current, "Half-Construct"))	{ ss << "healed and repaired";	current->m_DayJob = JOB_GETHEALING;	current->m_NightJob = JOB_GETREPAIRS; }
			else/*                                             */	{ ss << "healed";				current->m_DayJob = current->m_NightJob = JOB_GETHEALING; }
			ss << ".\n";
		}
		else if (matron)	// send her back to work
		{
			psw = (Day0Night1 ? current->m_PrevNightJob : current->m_PrevDayJob);
			bool backtowork = false;
			if (psw == JOB_DOCTOR || psw == JOB_NURSE || psw == JOB_INTERN || psw == JOB_MECHANIC)
			{
				if (current->has_trait("AIDS"))
				{
					current->m_DayJob = current->m_NightJob = restjob;
					ss << girlName << " could not go back to work as a";
					if (psw == JOB_DOCTOR)	ss << " Doctor";
					if (psw == JOB_NURSE)	ss << " Nurse";
					if (psw == JOB_INTERN)	ss << "n Intern";
					ss << " because she has AIDS. Instead ";
				}
				else if (psw == JOB_DOCTOR && current->is_slave())
				{
					current->m_DayJob = current->m_NightJob = restjob;
					ss << girlName << " could not go back to work as a Doctor because she is a slave. Instead ";
				}
				else if (psw == JOB_INTERN)		// intern is a part time job
				{
					current->m_DayJob = current->m_PrevDayJob;
					current->m_NightJob = current->m_PrevNightJob;
					backtowork = true;
				}
				else							// the others are fulltime
				{
					current->m_DayJob = current->m_NightJob = psw;
					backtowork = true;
				}
			}
			else if (psw != restjob && psw >= firstjob && psw<=lastjob)
			{	// if she had a previous job that shift, put her back to work.
				if (m_JobManager.FullTimeJob(psw))
				{
					current->m_DayJob = current->m_NightJob = psw;
				}
				else if (Day0Night1)	// checking night job
				{
					if (current->m_DayJob == restjob && current->m_PrevDayJob != restjob && current->m_PrevDayJob != 255)
						current->m_DayJob = current->m_PrevDayJob;
					current->m_NightJob = psw;
				}
				else					// checking day job
				{
					current->m_DayJob = psw;
					if (current->m_NightJob == restjob && current->m_PrevNightJob != restjob && current->m_PrevNightJob != 255)
						current->m_NightJob = current->m_PrevNightJob;
				}
				backtowork = true;
			}
			if (backtowork)	ss << "The Chairman puts " << girlName << " back to work.\n";

			if (!backtowork && current->m_DayJob == restjob && current->m_NightJob == restjob)
			{	// if they have no job at all, assign them a job
				ss << "The Chairman assigns " << girlName << " to ";
				if (current->has_trait("AIDS"))										// anyone with AIDS
				{
					current->m_DayJob = current->m_NightJob = JOB_CUREDISEASES;		//  needs to get it treated right away
					ss << "get her AIDS treated right away.";
				}
				else if (current->is_free() &&										// assign any free girl
					(current->intelligence() > 70 && current->medicine() > 70)		// who is well qualified
					|| (GetNumGirlsOnJob(0, JOB_DOCTOR, Day0Night1) < 1 &&			// or if there are no doctors yet
					current->intelligence() >= 50 && current->medicine() >= 50))	// asign anyone who qualifies
				{
					current->m_DayJob = current->m_NightJob = JOB_DOCTOR;			// as a Doctor
					ss << "work as a Doctor.";
				}
				else if (GetNumGirlsOnJob(0, JOB_NURSE, Day0Night1) < 1)			// make sure there is at least 1 Nurse
				{
					current->m_DayJob = current->m_NightJob = JOB_NURSE;
					ss << "work as a Nurse.";
				}
				else if (current->has_disease())									// treat anyone with a disease
				{
					current->m_DayJob = current->m_NightJob = JOB_CUREDISEASES;
					vector<string> diseases;
					if (current->has_trait("Herpes"))		diseases.push_back("Herpes");
					if (current->has_trait("Chlamydia"))	diseases.push_back("Chlamydia");
					if (current->has_trait("Syphilis"))		diseases.push_back("Syphilis");
					if (current->has_trait("AIDS"))			diseases.push_back("AIDS");
					int numdiseases = diseases.size();
					ss << "get her " << (numdiseases > 1 ? "diseases" : diseases[0]) << " treated.";
					diseases.clear();
				}
				// then make sure there is at least 1 Janitor and 1 Mechanic
				else if (GetNumGirlsOnJob(0, JOB_MECHANIC, Day0Night1) < 1)
				{
					current->m_DayJob = current->m_NightJob = JOB_MECHANIC;
					ss << "work as a Mechanic.";
				}
				else if (GetNumGirlsOnJob(0, JOB_JANITOR, Day0Night1) < 1)
				{
					current->m_DayJob = current->m_NightJob = JOB_JANITOR;
					ss << "work as a Janitor.";
				}
				// then add more of each job as numbers permit
				else if (current->medicine() > 30 && GetNumGirlsOnJob(0, JOB_NURSE, Day0Night1) < numgirls / 10)
				{
					current->m_DayJob = current->m_NightJob = JOB_NURSE;
					ss << "work as a Nurse.";
				}
				else if (GetNumGirlsOnJob(0, JOB_MECHANIC, Day0Night1) < numgirls / 20)
				{
					current->m_DayJob = current->m_NightJob = JOB_MECHANIC;
					ss << "work as a Mechanic.";
				}
				else if (GetNumGirlsOnJob(0, JOB_JANITOR, Day0Night1) < numgirls / 20)
				{
					current->m_DayJob = current->m_NightJob = JOB_JANITOR;
					ss << "work as a Janitor.";
				}
				else	// assign anyone else to Internship
				{
					current->m_DayJob = current->m_NightJob = JOB_INTERN;
					ss << "work as an Intern.";
				}
			}
			current->m_PrevDayJob = current->m_PrevNightJob = 255;
			sum = EVENT_BACKTOWORK;

		}
		else if (current->health() < 100 || current->tiredness() > 0)	// should only do rest job in the clinic if there is no matron
		{
			m_JobManager.JobFunc[restjob](current, brothel, Day0Night1, summary);
		}
		else	// she is fully healthy but there is no one to send her back to work
		{
			ss << "WARNING " << girlName << " is doing nothing!\n";
			sum = EVENT_WARNING;
		}
		
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;
	}

	////////////////////////////////////////////////////////
	//  JOB_DOCTOR needs to be checked before all others  //
	////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->is_dead() || sw != JOB_DOCTOR)
		{	// skip dead girls and anyone who is not a doctor
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		totalPay = totalTips = totalGold = 0;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (current->has_trait("AIDS"))
		{
			ss << girlName << " has AIDS! She has to get it treated before she can go back to work as a Doctor.";
			current->m_DayJob = current->m_NightJob = JOB_CUREDISEASES;
		}
		else if (current->is_slave())
		{
			ss << "Doctors can not be slaves so " << girlName << " was demoted to Nurse.";
			current->m_DayJob = current->m_NightJob = JOB_NURSE;
		}
		else if (current->intelligence() < 50 || current->medicine() < 50)
		{
			ss << girlName << " is not qualified to be a Doctor so she was sent back to being an Intern.";
			current->m_DayJob = current->m_NightJob = JOB_NURSE;
		}
		else if (g_Girls.DisobeyCheck(current, ACTION_WORKDOCTOR, brothel))
		{
			(Day0Night1 ? current->m_Refused_To_Work_Night = true : current->m_Refused_To_Work_Day = true);
			brothel->m_Fame -= g_Girls.GetStat(current, STAT_FAME);
			ss << girlName << " refused to work as a Doctor so made no money.";
			sum = EVENT_NOWORK;
		}
		else
		{
			numDoctors++;
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}

	////////////////////////////////////////////////////////////////
	//  Interns and Nurses can be promoted to doctor if need be.  //
	////////////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current && matron && numDoctors < 1)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->is_dead() || sw != JOB_INTERN || current->is_slave() || current->intelligence() < 50 || current->medicine() < 50)
		{	// skip dead girls and anyone who is not an intern and make sure they are qualified to be a doctor
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (!g_Girls.DisobeyCheck(current, ACTION_WORKDOCTOR, brothel))
		{
			numDoctors++;
			ss << "There was no Doctor available to work so " << girlName << " was promoted to Doctor.";
			current->m_DayJob = current->m_NightJob = JOB_DOCTOR;
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}
	current = brothel->m_Girls;
	while (current && matron && numDoctors < 1)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->is_dead() || sw != JOB_NURSE || current->is_slave() || current->intelligence() < 50 || current->medicine() < 50)
		{	// skip dead girls and anyone who is not a nurse and make sure they are qualified to be a doctor
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (!g_Girls.DisobeyCheck(current, ACTION_WORKDOCTOR, brothel))
		{
			numDoctors++;
			ss << "There was no Doctor available to work so " << girlName << " was promoted to Doctor.";
			current->m_DayJob = current->m_NightJob = JOB_DOCTOR;
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}

	/////////////////////////////////////
	//  Do all the Clinic staff jobs.  //
	/////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->is_dead() || (sw != JOB_INTERN && sw != JOB_NURSE && sw != JOB_JANITOR && sw != JOB_MECHANIC && sw != JOB_DOCTOR) ||
			// skip dead girls and anyone who is not staff
			(sw == JOB_DOCTOR && ((Day0Night1 == SHIFT_DAY && current->m_Refused_To_Work_Day)||(Day0Night1 == SHIFT_NIGHT && current->m_Refused_To_Work_Night))))
		{	// and skip doctors who refused to work in the first check
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		totalPay = totalTips = totalGold = 0;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");
		girlName = current->m_Realname;

		if (current->m_NightJob == JOB_DOCTOR) summary = "SkipDisobey";
		// do their job
		refused = m_JobManager.JobFunc[sw](current, brothel, Day0Night1, summary);

		totalPay += current->m_Pay;
		totalTips += current->m_Tips;
		totalGold += current->m_Pay + current->m_Tips;
		g_Brothels.CalculatePay(brothel, current, sw);

		//		Summary Messages
		if (refused)
		{
			brothel->m_Fame -= g_Girls.GetStat(current, STAT_FAME);
			ss << girlName << " refused to work so made no money.";
		}
		else
		{
			ss << m_JobManager.GirlPaymentText(brothel, current, totalTips, totalPay, totalGold, Day0Night1);
			if (totalGold < 0) sum = EVENT_DEBUG;

			brothel->m_Fame += g_Girls.GetStat(current, STAT_FAME);
		}
		if (ss.str().length() > 0) current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next; // Next Girl
	}


	///////////////////////////////////////////////////////////////////////
	//  Do all the surgery jobs. Not having a doctor is in all of them.  //
	///////////////////////////////////////////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (current->is_dead() || (sw != JOB_GETHEALING && sw != JOB_GETREPAIRS && sw != JOB_GETABORT
			&& sw != JOB_COSMETICSURGERY && sw != JOB_LIPO && sw != JOB_BREASTREDUCTION && sw != JOB_BOOBJOB
			&& sw != JOB_VAGINAREJUV && sw != JOB_FACELIFT && sw != JOB_ASSJOB && sw != JOB_TUBESTIED
			&& sw != JOB_CUREDISEASES && sw != JOB_FERTILITY))
		{	// skip dead girls and anyone not a patient
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		summary = "";

		// do their surgery
		m_JobManager.JobFunc[sw](current, brothel, Day0Night1, summary);

		current = current->m_Next; // Next Girl
	}

	///////////////////////////////////
	//  Finaly do end of day stuff.  //
	///////////////////////////////////
	current = brothel->m_Girls;
	while (current)
	{
		if (current->is_dead())
		{	// skip dead girls
			if (current->m_Next) { current = current->m_Next; continue; }
			else { current = 0; break; }
		}
		girlName = current->m_Realname;
		sum = EVENT_SUMMARY; summary = ""; ss.str("");

		// update for girls items that are not used up
		do_daily_items(brothel, current);					// `J` added

		// Level the girl up if nessessary
		g_Girls.LevelUp(current);
		// Natural healing, 2% health and 2% tiredness per day
		g_Girls.UpdateStat(current, STAT_HEALTH, 2, false);
		g_Girls.UpdateStat(current, STAT_TIREDNESS, -2, false);

		sw = (Day0Night1 ? current->m_NightJob : current->m_DayJob);
		if (g_Girls.GetStat(current, STAT_HAPPINESS) < 40)
		{
			if (sw != matronjob && matron && brothel->m_NumGirls > 1 && g_Dice.percent(70))
			{
				ss << "The Chairman helps cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 10 + 5);
			}
			else if (brothel->m_NumGirls > 10 && g_Dice.percent(50))
			{
				ss << "Some of the other girls help cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 8 + 3);
			}
			else if (brothel->m_NumGirls > 1 && g_Dice.percent(max(brothel->m_NumGirls, 50)))
			{
				ss << "One of the other girls helps cheer up " << girlName << " when she is feeling sad.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 6 + 2);
			}
			else if (brothel->m_NumGirls == 1 && g_Dice.percent(70))
			{
				ss << girlName << " plays around in the empty building until she feels better.\n";
				g_Girls.UpdateStat(current, STAT_HAPPINESS, g_Dice % 10 + 10);
			}
			else if (g_Girls.GetStat(current, STAT_HAPPINESS) < 20) // no one helps her and she is really unhappy
			{
				ss << girlName << " is looking very depressed. You may want to do something about that before she does something drastic.\n";
				sum = EVENT_WARNING;
			}
		}

		// The Clinic Chairman will heal herself if she is injured or tired
		if (sw == matronjob && (current->tiredness() > 60 || current->health() < 40))
		{
			int t = g_Girls.GetStat(current, STAT_TIREDNESS);
			int h = g_Girls.GetStat(current, STAT_HEALTH);
			if (t > 90 || h < 10)	// The matron may take herself off work if she is really bad off
			{
				current->m_PrevDayJob = current->m_DayJob;
				current->m_PrevNightJob = current->m_NightJob;
				current->m_DayJob = current->m_NightJob = JOB_GETHEALING;
				ss << "The Chairman admits herself to get Healing because she is just too damn sore.\n";
				g_Girls.UpdateEnjoyment(current, ACTION_WORKMATRON, -10);
			}
			else
			{
				ss << "As Chairman, " << girlName << " has the keys to the store room.\nShe used them to 'borrow' ";
				if (t > 50 && h < 50)
				{
					ss << "some potions";
					g_Gold.consumable_cost(20, true);
					current->health(min(current->health() + 20, 100));
					current->tiredness(max(current->tiredness() - 20, 0));
				}
				else if (t > 50)
				{
					ss << "a resting potion";
					g_Gold.consumable_cost(10, true);
					current->m_Stats[STAT_TIREDNESS] = max(current->m_Stats[STAT_TIREDNESS] - 20, 0);
				}
				else if (h < 50)
				{
					ss << "a healing potion";
					g_Gold.consumable_cost(10, true);
					current->m_Stats[STAT_HEALTH] = min(current->m_Stats[STAT_HEALTH] + 20, 100);
				}
				ss << " for herself.\n";
			}

		}
		else if (current->tiredness() > 80 || current->health() < 20)
		{
			int t = g_Girls.GetStat(current, STAT_TIREDNESS);
			int h = g_Girls.GetStat(current, STAT_HEALTH);

			if (current->m_WorkingDay > 0)
			{
				ss << girlName << " is not faring well in surgery.\n";
				sum = EVENT_WARNING;
			}
			else if (!matron)	// do no matron first as it is the easiest
			{
				ss << "WARNING! " << girlName;
				if (t > 80 && h < 20)		ss << " is in real bad shape, she is tired and injured.\nShe should go to the Clinic.\n";
				else if (t > 80 && h < 40)	ss << " is in bad shape, she is tired and injured.\nShe should rest or she may die!\n";
				else if (t > 80)			ss << " is desparatly in need of rest.\nGive her some free time\n";
				else if (h < 20)			ss << " is badly injured.\nShe should rest or go to the Clinic.\n";
				else if (h < 40)			ss << " is hurt.\nShe should rest and recuperate.\n";
				sum = EVENT_WARNING;
			}
			else	// do all other girls with a matron working
			{
				if (current->m_PrevNightJob == 255 && current->m_PrevDayJob == 255) // the girl has been working
				{
					current->m_PrevDayJob = current->m_DayJob;
					current->m_PrevNightJob = current->m_NightJob;
					current->m_DayJob = current->m_NightJob = restjob;
					ss << "The Chairman takes " << girlName << " off duty to rest due to her ";
					if (t > 80 && h < 40)	ss << "exhaustion.\n";
					else if (t > 80)		ss << "tiredness.\n";
					else if (h < 40)		ss << "low health.\n";
					else /*       */		ss << "current state.\n";
					sum = EVENT_WARNING;
				}
				else	// the girl has already been taken off duty by the matron
				{
					if (g_Dice.percent(70))
					{
						ss << "The Chairman helps ";
						if (t > 80 && h < 40)
						{
							ss << girlName << " recuperate.\n";
							g_Girls.UpdateStat(current, STAT_TIREDNESS, -(g_Dice % 4 + 2));
							g_Girls.UpdateStat(current, STAT_HEALTH, (g_Dice % 4 + 2));
						}
						else if (t > 80)
						{
							ss << girlName << " to relax.\n";
							g_Girls.UpdateStat(current, STAT_TIREDNESS, -(g_Dice % 5 + 5));
						}
						else if (h < 40)
						{
							ss << " heal " << girlName << ".\n";
							g_Girls.UpdateStat(current, STAT_HEALTH, (g_Dice % 5 + 5));
						}
					}
				}
			}
		}

		if (ss.str().length() > 0)	current->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, sum);

		current = current->m_Next;		// Process next girl
	}

	m_Processing_Shift = -1;	// WD: Finished Processing Shift set flag
}