Deadstarre
Expert
rank 3 spy for example always has a %70 chance of success. Anyone know where this can be altered? I looked through the EspionageOverview lua but didn't find it
rank 3 spy for example always has a %70 chance of success. Anyone know where this can be altered? I looked through the EspionageOverview lua but didn't find it
ugh. Im not about to download software so i can even read it, so I suppose its worth saying then; its strange the success rate doesn't take into account difference of influence - like I can be at -60 influence, Ghandi can be at 2000 influence, yet if I send my rank 3 spy there I have a %70 chance to gain 2060 influence. it seems intuitive the difference in influence should affect the rate of success (did it used to?).
its fine, if suboptimal for AI reasons, that it works this way, but if so %70 is a bit high for rate of success. its very easy/quick/safe to level up spies as diplomats and wreak havoc on the map with that kind of rate.
/// GetCoupChangeOfSuccess - What is the % chance of success that a spy will be able to pull off a coup?
int CvPlayerEspionage::GetCoupChanceOfSuccess(uint uiSpyIndex)
{
// if you can't stage a coup, then the likelihood is zero!
if(!CanStageCoup(uiSpyIndex))
{
return 0;
}
CvCity* pCity = GetCityWithSpy(uiSpyIndex);
CvAssertMsg(pCity, "No city");
if(!pCity)
{
return 0;
}
CvCityEspionage* pCityEspionage = pCity->GetCityEspionage();
CvAssertMsg(pCityEspionage, "No city espionage");
if(!pCityEspionage)
{
return 0;
}
PlayerTypes eCityOwner = pCity->getOwner();
CvAssertMsg(GET_PLAYER(eCityOwner).isMinorCiv(), "Owner is not a minor civ");
if(!GET_PLAYER(eCityOwner).isMinorCiv())
{
return 0;
}
CvMinorCivAI* pMinorCivAI = GET_PLAYER(eCityOwner).GetMinorCivAI();
CvAssertMsg(pMinorCivAI, "pMinorCivAI is null");
if(!pMinorCivAI)
{
return 0;
}
PlayerTypes eAllyPlayer = pMinorCivAI->GetAlly();
int iAllySpyRank = 0;
bool bNoAllySpy = true;
if(pCityEspionage->m_aiSpyAssignment[eAllyPlayer] != -1)
{
int iAllySpyIndex = pCityEspionage->m_aiSpyAssignment[eAllyPlayer];
iAllySpyRank = GET_PLAYER(eAllyPlayer).GetEspionage()->m_aSpyList[iAllySpyIndex].m_eRank;
bNoAllySpy = true;
}
int iAllyInfluence = pMinorCivAI->GetEffectiveFriendshipWithMajorTimes100(eAllyPlayer);
int iMyInfluence = pMinorCivAI->GetEffectiveFriendshipWithMajorTimes100(m_pPlayer->GetID());
int iDeltaInfluence = iAllyInfluence - iMyInfluence;
#if defined(MOD_BALANCE_CORE)
iDeltaInfluence /= 2;
if(iDeltaInfluence > 7000)
{
iDeltaInfluence = 7000;
}
#endif
//float fNobodyBonus = 0.5;
//float fMultiplyConstant = 3.0f;
//float fSpyLevelDeltaZero = 0.0f;
//float fSpyLevelDeltaOne = 1.5f;
//float fSpyLevelDeltaTwo = 2.25;
//float fSpyLevelDeltaThree = 3.0f;
float fNobodyBonus = GC.getESPIONAGE_COUP_NOBODY_BONUS();
float fMultiplyConstant = GC.getESPIONAGE_COUP_MULTIPLY_CONSTANT();
float fSpyLevelDeltaZero = GC.getESPIONAGE_COUP_SPY_LEVEL_DELTA_ZERO();
float fSpyLevelDeltaOne = GC.getESPIONAGE_COUP_SPY_LEVEL_DELTA_ONE();
float fSpyLevelDeltaTwo = GC.getESPIONAGE_COUP_SPY_LEVEL_DELTA_TWO();
float fSpyLevelDeltaThree = GC.getESPIONAGE_COUP_SPY_LEVEL_DELTA_THREE();
float fSpyLevelDeltaFour = GC.getESPIONAGE_COUP_SPY_LEVEL_DELTA_FOUR();
float fAllySpyValue = 0.0f;
float fMySpyValue = 0.0;
int iMySpyRank = m_aSpyList[uiSpyIndex].m_eRank;
iMySpyRank += m_pPlayer->GetCulture()->GetInfluenceCityStateSpyRankBonus(eCityOwner);
switch (iMySpyRank)
{
case 0:
fMySpyValue = fSpyLevelDeltaZero;
break;
case 1:
fMySpyValue = fSpyLevelDeltaOne;
break;
case 2:
fMySpyValue = fSpyLevelDeltaTwo;
break;
case 3:
fMySpyValue = fSpyLevelDeltaThree;
break;
case 4:
fMySpyValue = fSpyLevelDeltaFour;
break;
}
switch (iAllySpyRank)
{
case 0:
fAllySpyValue = fSpyLevelDeltaZero;
break;
case 1:
fAllySpyValue = fSpyLevelDeltaOne;
break;
case 2:
fAllySpyValue = fSpyLevelDeltaTwo;
break;
}
float fSpyMultipier = fAllySpyValue - fMySpyValue + fMultiplyConstant;
if (bNoAllySpy)
{
fSpyMultipier *= fNobodyBonus;
}
int iResultPercentage = 100 - (int)((iDeltaInfluence * fSpyMultipier) / 100);
#if defined(MOD_BALANCE_CORE)
if (MOD_BALANCE_CORE_SPIES_ADVANCED)
{
iResultPercentage *= (100 + m_pPlayer->GetPlayerPolicies()->GetNumericModifier(POLICYMOD_RIGGING_ELECTION_MODIFIER));
iResultPercentage /= 100;
}
#endif
if(iResultPercentage > 70)
{
iResultPercentage = 70;
}
#if defined(MOD_BALANCE_CORE)
else if(iResultPercentage < 5)
{
iResultPercentage = 5;
}
#else
else if(iResultPercentage < 0)
{
iResultPercentage = 0;
}
#endif
//int iAdjustedAllyInfluenceTimes100 = iAllyInfluence * (100 + m_aSpyList[uiSpyIndex].m_eRank * 100);
//int iAdjustedAllyInfluence = iAdjustedAllyInfluenceTimes100 / 100;
//int iResultPercentage = 0;
//if (iAdjustedAllyInfluence != 0)
//{
// iResultPercentage = 100 - ((iDeltaInfluence * 100) / iAdjustedAllyInfluence);
//}
return iResultPercentage;
}
Something /= other_thingso... there is something in the code to adjust spy % for difference of influence
iDeltaInfluence = iAllyInfluence - iMyInfluence
int iResultPercentage = 100 - (int)((iDeltaInfluence * fSpyMultipier) / 100);
I guess just overall the numbers have been arranged so it ultimately becomes insignificant? I know i've been behind by thousands of influence and still had a %70 rate of success.
right here I guess?
#if defined(MOD_BALANCE_CORE)
iDeltaInfluence /= 2;
not sure Im understanding that equation... sigh math.