45°38'N-13°47'E
Deity
Simple mistake that is throwing everything off, and it's my fault:
TECH_DIFFUSION_KNOWN_TEAM_MODIFIER * (0.85 ^ exponent + 0.5)
should be
(TECH_DIFFUSION_KNOWN_TEAM_MODIFIER * (0.85 ^ exponent) + 0.5)
The exponent has 0.5 added to it to effectively "round up". Due to order of operations, the 0.5 is added at the very last step for that set of parenthesis.
Also, if the modifier is negative it is not used, tech diffusion can not hurt your research rate.
Guys, I'm missing something: the actual code is
Code:
int techDiffMod = GC.getTECH_DIFFUSION_KNOWN_TEAM_MODIFIER();
if (knownExp > 0.0)
{
//ensure tech diffusion can not hurt research, only help
iModifier += std::max(0, techDiffMod - (int)(techDiffMod * pow(0.85, knownExp) + 0.5));
}
// Tech flows downhill to those who are far behind
int iTechScorePercent = GET_TEAM(getTeam()).getBestKnownTechScorePercent();
int iWelfareThreshold = GC.getTECH_DIFFUSION_WELFARE_THRESHOLD();
if( iTechScorePercent < iWelfareThreshold )
{
if( knownExp > 0.0 )
{
int iWelfareMod = GC.getTECH_DIFFUSION_WELFARE_MODIFIER();
//ensure tech diffusion can not hurt research, only help
iModifier += std::max(0, (iWelfareMod - (int)(iWelfareMod * pow(0.98, iWelfareThreshold - iTechScorePercent) + 0.5)));
so it looks to me your code is right Afforess. Or am I lost somewhere in the discussion?