Skip to content

Commit

Permalink
Add define for number of spy points (#11446)
Browse files Browse the repository at this point in the history
  • Loading branch information
axatin authored Dec 18, 2024
1 parent 89ff613 commit afd2b2e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ VALUES
('ESPIONAGE_SPY_XP_MISSION_SUCCESS_PERCENT', 0), -- When successfully completing a Spy Mission, gain (NP Points needed for Mission) * ESPIONAGE_XP_MISSION_SUCESS_PERCENT / 100 XP

('ESPIONAGE_COUNTERSPY_CHANGE_FOCUS_COOLDOWN', 5), -- Cooldown between switching Counterspy Missions
('ESPIONAGE_SPY_POINT_UNIT', 100), -- Number of spy points a value of '1' in database columns like Eras.SpiesGrantedForPlayer or Buildings.ExtraSpies corresponds to

---------------------------------------
-- VP happiness system
Expand Down
2 changes: 2 additions & 0 deletions CvGameCoreDLL_Expansion2/CvGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2183,6 +2183,7 @@ CvGlobals::CvGlobals() :
GD_INT_INIT(ESPIONAGE_XP_UNCOVER_INTRIGUE, 0),
GD_INT_INIT(ESPIONAGE_SPY_XP_MISSION_SUCCESS_PERCENT, 0),
GD_INT_INIT(ESPIONAGE_COUNTERSPY_CHANGE_FOCUS_COOLDOWN, 5),
GD_INT_INIT(ESPIONAGE_SPY_POINT_UNIT, 100),
GD_INT_INIT(INTERNATIONAL_TRADE_BASE, 100),
GD_INT_INIT(INTERNATIONAL_TRADE_EXCLUSIVE_CONNECTION, 0),
GD_INT_INIT(INTERNATIONAL_TRADE_CITY_GPT_DIVISOR, 20),
Expand Down Expand Up @@ -7105,6 +7106,7 @@ void CvGlobals::cacheGlobals()
GD_INT_CACHE(ESPIONAGE_XP_UNCOVER_INTRIGUE);
GD_INT_CACHE(ESPIONAGE_SPY_XP_MISSION_SUCCESS_PERCENT);
GD_INT_CACHE(ESPIONAGE_COUNTERSPY_CHANGE_FOCUS_COOLDOWN);
GD_INT_CACHE(ESPIONAGE_SPY_POINT_UNIT);
GD_INT_CACHE(INTERNATIONAL_TRADE_BASE);
GD_INT_CACHE(INTERNATIONAL_TRADE_EXCLUSIVE_CONNECTION);
GD_INT_CACHE(INTERNATIONAL_TRADE_CITY_GPT_DIVISOR);
Expand Down
1 change: 1 addition & 0 deletions CvGameCoreDLL_Expansion2/CvGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -2771,6 +2771,7 @@ class CvGlobals
GD_INT_MEMBER(ESPIONAGE_XP_UNCOVER_INTRIGUE); // VP
GD_INT_MEMBER(ESPIONAGE_SPY_XP_MISSION_SUCCESS_PERCENT); // VP
GD_INT_MEMBER(ESPIONAGE_COUNTERSPY_CHANGE_FOCUS_COOLDOWN); // VP
GD_INT_MEMBER(ESPIONAGE_SPY_POINT_UNIT); // VP
GD_INT_MEMBER(INTERNATIONAL_TRADE_BASE);
GD_INT_MEMBER(INTERNATIONAL_TRADE_EXCLUSIVE_CONNECTION);
GD_INT_MEMBER(INTERNATIONAL_TRADE_CITY_GPT_DIVISOR);
Expand Down
10 changes: 4 additions & 6 deletions CvGameCoreDLL_Expansion2/CvPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22631,15 +22631,13 @@ void CvPlayer::CreateSpies(int iNumSpies, bool bScaling)
else
{
int iThreshold = max(1, GC.getGame().GetSpyThreshold());
int iSpyPointGain = iThreshold;

// Spies scaling with era. Instead of 1 spy, we gain 100 spy points. For each time the number of spy points exceeds the threshold, a spy is created
if (bScaling)
iSpyPointGain = 100;
// Spies scaling with map size. Instead of 1 spy, we gain ESPIONAGE_SPY_POINT_UNIT spy points. For each time the number of spy points exceeds the threshold, a spy is created
int iSpyPointUnit = bScaling ? /*100*/ GD_INT_GET(ESPIONAGE_SPY_POINT_UNIT) : iThreshold;

// Note that iNumSpies can be NEGATIVE (e.g. removing a policy that gives spy points). In that case, the player enters a spy debt.
m_iSpyPointsTotal += iNumSpies * iSpyPointGain;
m_iSpyPoints += iNumSpies * iSpyPointGain;
m_iSpyPointsTotal += iNumSpies * iSpyPointUnit;
m_iSpyPoints += iNumSpies * iSpyPointUnit;
while (m_iSpyPoints >= iThreshold)
{
pEspionage->CreateSpy();
Expand Down

0 comments on commit afd2b2e

Please sign in to comment.