From f07dbef356fdb58ff129b9ea175ecfc659785fb5 Mon Sep 17 00:00:00 2001 From: Flugente Date: Tue, 2 Sep 2014 22:12:08 +0000 Subject: [PATCH] Feature improvement (PMC): - when PMC militias arrive, loyalty in player towns can be lowered - PMC militia arrival time is slightly randomized around the ETA git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7483 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/PMC.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Laptop/PMC.cpp b/Laptop/PMC.cpp index 04f936cf..337ab215 100644 --- a/Laptop/PMC.cpp +++ b/Laptop/PMC.cpp @@ -37,6 +37,7 @@ #include "Game Event Hook.h" #include "militia control.h" #include "Town Militia.h" +#include "Strategic Town Loyalty.h" #endif extern INT32 ReadFieldByField( HWFILE hFile, PTR pDest, UINT32 uiFieldSize, UINT32 uiElementSize, UINT32 uiCurByteCount ); @@ -564,7 +565,9 @@ void PMCTeamHireCallback( GUI_BUTTON *btn, INT32 reason ) gPMCHiringEvents.push_back( hiringevent ); - AddStrategicEvent( EVENT_PMC_REINFORCEMENT_ARRIVAL, hiringevent.usTimeToArrive, hiringevent.usId ); + // The ETA is, well, just an ETA - randomise it a bit + UINT32 realarrivaltime = hiringevent.usTimeToArrive - 60 + Random(180); + AddStrategicEvent( EVENT_PMC_REINFORCEMENT_ARRIVAL, realarrivaltime, hiringevent.usId ); gPMCData.usRegularsAvailable -= pmcdata[0].usToHire; pmcdata[0].usToHire = 0; @@ -750,10 +753,15 @@ void HandlePMCArrival( UINT8 usId ) // if this is in the current sector, militia will be updated ResetMilitia( ); + // notify the player that his reinforcements have arrived GetSectorIDString( SECTORX( (*it).usSectorToArrive ), SECTORY( (*it).usSectorToArrive ), 0, gPMCSectorNamesstr[0], TRUE ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPMCWebSite[TEXT_PMC_ARRIVAL], gPMCSectorNamesstr[0] ); + // there is a chance that loyalty in cities will be lowered - townsfolk might dislike massive rise in foreign mercenaries + // note: this is the decrease in hundreths of loyalty points, and one basic town loyalty point is worth 500 hundreths + DecrementTownLoyaltyEverywhere( 50 * (*it).usRegulars + 75 * (*it).usVeterans ); + // delete event, we're done here gPMCHiringEvents.erase( it );