RefuseAttitudeThresholds not working ???

Another potential trade-denial-related bug has popped up in the topic This is weird; anyone ever see this?

You can't ask an AI civ to run Emancipation because they will redline it with the message TXT_KEY_DENIAL_ANGER_CIVIC ("We don't want to deal with the unhappiness"). However, that kind of denial message seems like it should come from asking them to switch out of Emancipation, not into it. Here's the very brief bit of CvPlayerAI::AI_civicTrade() that is causing it:
Code:
	if (getCivicPercentAnger(eCivic) > 0)
	{
		return DENIAL_ANGER_CIVIC;
	}
That would make sense if a positive return value from CvPlayer::getCivicPercentAnger() means that your people will become unhappy if you run the suggested civic. But a positive return value instead means that you will get unhappiness if you aren't running it. Note that you can see the true meaning of this return value by looking at how the same function is used in CvCity::unhappyLevel().

Unfortunately, fixing this properly is a little tricky. The quick and dirty method would be to do something like this:
Code:
	if (getCivicPercentAnger(getCivics((CivicOptionTypes)(GC.getCivicInfo(eCivic).getCivicOptionType())),true) > 0)
	{
		return DENIAL_ANGER_CIVIC;
	}
That basically says "if switching out of our current civic of the same type as the suggested one can cause unhappiness, deny." So, for example, if the AI is in Emancipation and the human is suggesting Caste System, they'll deny. But if the AI is running Caste System and the human is suggesting Emancipation, they'll consider it. This did work for me in a brief test.

Note that this fix assumes there is a maximum of one civic of each type that can cause unhappiness in other nations. This should work fine in the original game where Emancipation is the only such civic, but wouldn't be so hot if multiple civics have been modified to cause that sort of unhappiness. That'd require a much more complex check where you'd have to try and determine how much civic-related unhappiness you currently have and compare it to how much civic-related unhappiness you'd have if you switched.
 
Wow, nice catch. Certainly the quick and dirty method you describe seems to be what Firaxis intended here, to make it a little more mod friendly we could do:

Code:
	if (getCivicPercentAnger(getCivics((CivicOptionTypes)(GC.getCivicInfo(eCivic).getCivicOptionType())),true) > getCivicPercentAnger(eCivic))

How does that sound?
 
Haha, really nice Dresden! The problem is not so much the AI's denial to switch into Emancipation (most of the times they do so automatically, plus the human player would probably want to decrease his own Emancipation unhappiness more often than to increase it for other AIs), but the thus never occurring denial to switch out of it.

jdog5000: shouldn't the comparison be if Anger(CurrentCivic) < Anger(NewCivic) --> denial ?
 
@Dan: you're making the same mistake Firaxis made ;) getCivicPercentAnger() does not tell you how much anger running that civic causes, but how much not running it causes. so jdog's comparison should be okay.

Here's a concrete example:
Assume that a new labor civic called Unions generates small unhappiness in non-users while Emancipation generates large unhappiness in non-users. Thus we get the relationship getCivicPercentAnger(Emancipation) > getCivicPercentAnger(Unions) > 0

jdog's comparison looks like this:
if (getCivicPercentAnger(current) > getCivicPercentAnger(proposed)) then deny.

Thus they would redline a change from Emancipation to Unions but would not redline a change from Unions to Emancipation.
 
Right! Should have taken a look at the actual code and not just at the clever :)rolleyes:) name of getCivicPercentAnger.
Your Unions example makes it "clear as an unmuddied lake, sir".:goodjob:
 
I agree with Dan too - this is a really serious bug, and I won't willingly play 3.17 until it has been fixed.

And the favorite civic bug is definitely a bug too.
 
I'm not sure. I believe that it just shows that the leader is very satisfied with his choice of society and is unwilling to make any changes at all. Of course, I see your point - it would make sense if the refusal applied only to the same civic category. Hmm. At least be glad that "favorite civic" doesn't mean that the AI would always run that civic no matter what ;)

I've been running into this problem lately. Your argument in its defense isn't particularly valid, because even in theocracy for example Justinian would still switch from caste system to emancipation. However, it would be impossible to bribe him to do so.

On the flip side, bribes for civic switches make sense. I switch civics just for diplo sometimes, I would DEFINITELY switch civics if it meant a free tech or 500-1k gold depending on how fare in the game I am, especially if spiritual.

There's already a check for "we don't want to deal with the unhappiness" which usually would prevent them from switching out of emancipation or something - something similar may exist for state property and $$$ - haven't tried.
 
Top Bottom