In XML serie of <tag>values</tag> (CIV4LeaderHeadInfos.xml), there is indeed a location for how many techs trigger a particular attitude modifier called TXT_KEY_MEMORY_TRADED_TECH_TO_US (
"You have shared your technological discoveries with us.").
In Civ4 game, there are two types of attitude: those who are eternal and those affected by some decay process.
The second category has two values: decay odd and some attitude indicator (which is finally processed in the SDK, that is C++/header files in CvGameCoreDLL folder).
In CIV4LeaderHeadInfos:
Decay:
Attitude Indicator:
All leaders have same memory capacity; no one forgets faster than others.
But some leaders are more sensitive to other player propensity (and I said player, because AI-AI works too; not human exclusive) to freely share their discoveries.
Here's the list:
Now how to process those numbers in an actual number of received techs (point of view of the tech receiver).
In CvPlayerAI.cpp:
The very part that interests us is:
Code:
for (iI = 0; iI < NUM_MEMORY_TYPES; iI++)
{
iAttitude += AI_getMemoryAttitude(ePlayer, ((MemoryTypes)iI));
}
Basically making
some enumeration of memory types, and #26 is the concerned one.
Becomes
Code:
iAttitude += AI_getMemoryAttitude(TechReceiver, ((MEMORY_TRADED_TECH_TO_US)26));
And bit farther in CvPlayerAI...
we have our definition for AI_getMemoryAttitude:
Code:
int CvPlayerAI::AI_getMemoryAttitude(PlayerTypes ePlayer, MemoryTypes eMemory) const
{
return ((AI_getMemoryCount(ePlayer, eMemory) * GC.getLeaderHeadInfo(getPersonalityType()).getMemoryAttitudePercent(eMemory)) / 100);
}
Basically that in understandable formula:
iAttitude= [#TechsReceived*<iMemoryAttitudePercent> / 100]
[] meaning you have to round down after the calculus.
For instance, for Cathy, let's take instances of 7, 14 and 20 given techs.
7 techs:
iAttitude = [7*15/100] = [1.05]=
1
14 techs:
iAttitude = [14*15/100] = [2.1]=
2
20 techs:
iAttitude = [20*15/100] = [3]=
3
And that is why for those with <iMemoryAttitudePercent> as 15, for getting diplo modifiers up to
+3, it goes 7,7,6 techs.
Important thing to remember, those with <iMemoryAttitudePercent> as 5 need 20 techs for +1, those with <iMemoryAttitudePercent> as 10 need 10 techs +1 modifier and those with <iMemoryAttitudePercent> as 15 need 7,7,6 techs for +1,+2,+3 modifier.
Trivia
- Interestingly, I was thinking that was better in CvTeamAI.cpp because tech trading is a matter of teams more of individuals. Now come the thought, if you trade a tech to a team, the other partner automatically receives the tech. Does it have a tech count for both or just the leader you traded/gave the tech? Food for thought.
- The decay process is defined in CvPlayerAI::AI_doCounter() ; nothing particular but basic Soren Johnson's RNG that rolls a number from 0 to 100 (for 101 possible values?). If rolling 0, then the count decreases by one. That RNG is processed each turn. And it is worth for each leader as roughly 1% per turn of Alzheimer.
- Most code parts are trifles. Mostly for me.