View Full Version : changing the minimum turns for peace in int CvTeamAI::AI_makePeaceTradeVal


cotdamn
May 14, 2007, 05:35 PM
am i looking in the right place to get ready of "refuse to talk" # of turns after a war declaration?

int CvTeamAI::AI_makePeaceTradeVal(TeamTypes ePeaceTeam, TeamTypes eTeam) const
{
int iModifier;
int iValue;

FAssertMsg(eTeam != getID(), "shouldn't call this function on ourselves");
FAssertMsg(ePeaceTeam != getID(), "shouldn't call this function on ourselves");
FAssertMsg(GET_TEAM(ePeaceTeam).isAlive(), "GET_TEAM(ePeaceTeam).isAlive is expected to be true");
FAssertMsg(atWar(ePeaceTeam, eTeam), "eTeam should be at war with ePeaceTeam");

iValue = (50 + GC.getGameINLINE().getGameTurn());
iValue += ((GET_TEAM(eTeam).getNumCities() + GET_TEAM(ePeaceTeam).getNumCities()) * 8);

iModifier = 0;

switch ((GET_TEAM(eTeam).AI_getAttitude(ePeaceTeam) + GET_TEAM(ePeaceTeam).AI_getAttitude(eTeam)) / 2)
{
case ATTITUDE_FURIOUS:
iModifier += 400;
break;

case ATTITUDE_ANNOYED:
iModifier += 200;
break;

case ATTITUDE_CAUTIOUS:
iModifier += 100;
break;

case ATTITUDE_PLEASED:
iModifier += 50;
break;

case ATTITUDE_FRIENDLY:
break;

default:
FAssert(false);
break;
}

iValue *= max(0, (iModifier + 100));
iValue /= 100;

iValue *= 40;
iValue /= (GET_TEAM(eTeam).AI_getAtWarCounter(ePeaceTeam) + 10);

iValue -= (iValue % GC.getDefineINT("DIPLOMACY_VALUE_REMAINDER"));

if (isHuman())
{
return max(iValue, GC.getDefineINT("DIPLOMACY_VALUE_REMAINDER"));
}
else
{
return iValue;
}
}

PeteT
May 14, 2007, 07:41 PM
No, what you want is


bool CvPlayerAI::AI_isWillingToTalk(PlayerTypes ePlayer)
{
FAssertMsg(getPersonalityType() != NO_LEADER, "getPersonalityType() is not expected to be equal with NO_LEADER");
FAssertMsg(ePlayer != getID(), "shouldn't call this function on ourselves");

if (GET_PLAYER(ePlayer).getTeam() == getTeam()
|| GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isVassal(g etTeam())
|| GET_TEAM(getTeam()).isVassal(GET_PLAYER(ePlayer).g etTeam()))
{
return true;
}

if (GET_TEAM(getTeam()).isHuman())
{
return false;
}

if (atWar(getTeam(), GET_PLAYER(ePlayer).getTeam()))
{
if (GET_TEAM(getTeam()).AI_getAtWarCounter(GET_PLAYER (ePlayer).getTeam()) < (GC.getLeaderHeadInfo(getPersonalityType()).getRef useToTalkWarThreshold() * ((GET_TEAM(getTeam()).AI_isChosenWar(GET_PLAYER(eP layer).getTeam())) ? 2 : 1)))
{
return false;
}

cotdamn
May 14, 2007, 11:25 PM
awesome thanks :)