Hooks
static bool BeforeCvLeagueAI_ScoreVoteChoiceYesNo(CvLeagueAI* self, CvProposal* pProposal, int iChoice, bool bEnact, int& result);static void AfterCvLeagueAI_ScoreVoteChoiceYesNo(CvLeagueAI* self, CvProposal* pProposal, int iChoice, bool bEnact, int& result);static int ReplaceCvLeagueAI_ScoreVoteChoiceYesNo(int (*original)(CvLeagueAI*, CvProposal*, int, bool), CvLeagueAI* self, CvProposal* pProposal, int iChoice, bool bEnact);CivRegisterBefore<CivHooks::CvLeagueAI_ScoreVoteChoiceYesNo>(host, &BeforeCvLeagueAI_ScoreVoteChoiceYesNo);CivRegisterAfter<CivHooks::CvLeagueAI_ScoreVoteChoiceYesNo>(host, &AfterCvLeagueAI_ScoreVoteChoiceYesNo);CivRegisterReplace<CivHooks::CvLeagueAI_ScoreVoteChoiceYesNo>(host, &ReplaceCvLeagueAI_ScoreVoteChoiceYesNo);
Code
8897// Score a particular choice on a particular proposal which is a decision between Yes and No8898int CvLeagueAI::ScoreVoteChoiceYesNo(CvProposal* pProposal, int iChoice, bool bEnact)8899{8900 CvAssert(pProposal != NULL);8901 if (!(pProposal != NULL)) return 0;89028903 // How much do we like this choice for this proposal? Positive is like, negative is dislike.8904 // Evaluate as if we are voting Yes to Enact the proposal. Post-processing below to fit actual situation.8905 int iScore = 0;89068907 // == Proposer Choice ==8908 ResolutionDecisionTypes eProposerDecision = pProposal->GetProposerDecision()->GetType();8909 PlayerTypes eTargetPlayer = NO_PLAYER;8910 if (eProposerDecision == RESOLUTION_DECISION_ANY_MEMBER ||8911 eProposerDecision == RESOLUTION_DECISION_MAJOR_CIV_MEMBER ||8912 eProposerDecision == RESOLUTION_DECISION_OTHER_MAJOR_CIV_MEMBER)8913 {8914 eTargetPlayer = (PlayerTypes) pProposal->GetProposerDecision()->GetDecision();8915 }8916 ResourceTypes eTargetLuxury = NO_RESOURCE;8917 if (eProposerDecision == RESOLUTION_DECISION_ANY_LUXURY_RESOURCE)8918 {8919 CvResourceInfo* pInfo = GC.getResourceInfo((ResourceTypes) pProposal->GetProposerDecision()->GetDecision());8920 if (pInfo && pInfo->getResourceUsage() == RESOURCEUSAGE_LUXURY)8921 {8922 eTargetLuxury = (ResourceTypes) pProposal->GetProposerDecision()->GetDecision();8923 }8924 }8925 ReligionTypes eTargetReligion = NO_RELIGION;8926 if (eProposerDecision == RESOLUTION_DECISION_RELIGION)8927 {8928 eTargetReligion = (ReligionTypes) pProposal->GetProposerDecision()->GetDecision();8929 }8930 PolicyBranchTypes eTargetIdeology = NO_POLICY_BRANCH_TYPE;8931 if (eProposerDecision == RESOLUTION_DECISION_IDEOLOGY)8932 {8933 eTargetIdeology = (PolicyBranchTypes) pProposal->GetProposerDecision()->GetDecision();8934 }89358936 // == Grand Strategy ==8937 AIGrandStrategyTypes eGrandStrategy = GetPlayer()->GetGrandStrategyAI()->GetActiveGrandStrategy();8938 bool bSeekingDiploVictory = eGrandStrategy == GC.getInfoTypeForString("AIGRANDSTRATEGY_UNITED_NATIONS");8939 bool bSeekingConquestVictory = eGrandStrategy == GC.getInfoTypeForString("AIGRANDSTRATEGY_CONQUEST");8940 bool bSeekingCultureVictory = eGrandStrategy == GC.getInfoTypeForString("AIGRANDSTRATEGY_CULTURE");8941 bool bSeekingScienceVictory = eGrandStrategy == GC.getInfoTypeForString("AIGRANDSTRATEGY_SPACESHIP");89428943 // == Gameplay Effects ==8944 // International Projects8945 if (pProposal->GetEffects()->eLeagueProjectEnabled != NO_LEAGUE_PROJECT)8946 {8947 LeagueProjectTypes eWorldsFair = (LeagueProjectTypes) GC.getInfoTypeForString("LEAGUE_PROJECT_WORLD_FAIR", true);8948 LeagueProjectTypes eInternationalGames = (LeagueProjectTypes) GC.getInfoTypeForString("LEAGUE_PROJECT_WORLD_GAMES", true);8949 LeagueProjectTypes eInternationalSpaceStation = (LeagueProjectTypes) GC.getInfoTypeForString("LEAGUE_PROJECT_INTERNATIONAL_SPACE_STATION", true);89508951 // Production might8952 int iOurProductionMight = GetPlayer()->calculateProductionMight();8953 int iHigherProductionCivs = 0;8954 int iLowerProductionCivs = 0;8955 int iAliveCivs = 0;8956 for (int i = 0; i < MAX_MAJOR_CIVS; i++)8957 {8958 PlayerTypes e = (PlayerTypes) i;8959 if (GET_PLAYER(e).isAlive() && !GET_PLAYER(e).isMinorCiv())8960 {8961 iAliveCivs++;8962 if (GetPlayer()->GetID() != e)8963 {8964 int iMight = GET_PLAYER(e).calculateProductionMight();8965 if (iMight > iOurProductionMight)8966 {8967 iHigherProductionCivs++;8968 }8969 else8970 {8971 iLowerProductionCivs++; // Include civs with equal might8972 }8973 }8974 }8975 }8976 bool bStrongProduction = false;8977 if (iAliveCivs > 0)8978 {8979 float fProductionMightRatio = ((float)iAliveCivs - (float)iHigherProductionCivs) / ((float)iAliveCivs);8980 CvAssertMsg(0.0f <= fProductionMightRatio && fProductionMightRatio <= 1.0f, "Error when evaluating delegates for an international project. Please send Anton your save file and version.");8981 fProductionMightRatio = MAX(fProductionMightRatio, 0.0f);8982 fProductionMightRatio = MIN(fProductionMightRatio, 1.0f);89838984 if (fProductionMightRatio >= 0.75f)8985 {8986 iScore += 40;8987 bStrongProduction = true;8988 }8989 else if (fProductionMightRatio >= 0.50f)8990 {8991 iScore += 20;8992 bStrongProduction = true;8993 }8994 else if (fProductionMightRatio >= 0.25f)8995 {8996 iScore += -20;8997 }8998 else8999 {9000 iScore += -40;9001 }9002 }90039004 // Project specific benefits9005 if (eWorldsFair == pProposal->GetEffects()->eLeagueProjectEnabled)9006 {9007 if (bSeekingCultureVictory && bStrongProduction)9008 {9009 iScore += 30;9010 }9011 else9012 {9013 iScore += 10;9014 }9015 }9016 else if (eInternationalGames == pProposal->GetEffects()->eLeagueProjectEnabled)9017 {9018 if (bSeekingCultureVictory && bStrongProduction)9019 {9020 iScore += 40;9021 }9022 else9023 {9024 iScore += 10;9025 }9026 }9027 else if (eInternationalSpaceStation == pProposal->GetEffects()->eLeagueProjectEnabled)9028 {9029 if (bSeekingScienceVictory && bStrongProduction)9030 {9031 iScore += 50;9032 }9033 else9034 {9035 iScore += 10;9036 }9037 }9038 }9039 // Embargo City-States9040 if (pProposal->GetEffects()->bEmbargoCityStates)9041 {9042 // Trade connections9043 int iCSDestinations = 0;9044 int iCSPartners = 0;9045 int iCivEmbargos = 0;9046 int iCivDestinations = 0;9047 for (int i = 0; i < MAX_CIV_PLAYERS; i++)9048 {9049 PlayerTypes e = (PlayerTypes) i;9050 if (e != GetPlayer()->GetID() && GET_PLAYER(e).isAlive())9051 {9052 if (GET_PLAYER(e).isMinorCiv())9053 {9054 iCSDestinations++;9055 if (GC.getGame().GetGameTrade()->IsPlayerConnectedToPlayer(GetPlayer()->GetID(), e))9056 {9057 iCSPartners++;9058 }9059 }9060 else if (GC.getGame().GetGameLeagues()->IsTradeEmbargoed(GetPlayer()->GetID(), e))9061 {9062 iCivEmbargos++;9063 }9064 else9065 {9066 iCivDestinations += GET_PLAYER(e).getNumCities();9067 }9068 }9069 }90709071 // Would we lose active CS trade routes?9072 if (iCSPartners > 0)9073 {9074 iScore += MAX(-50, iCSPartners * -15);9075 }9076 else9077 {9078 iScore += 25;9079 }90809081 // Can we trade with any major civs?9082 if (iCivDestinations <= 0)9083 {9084 iScore += -50;9085 }9086 else9087 {9088 // Based on estimates, would we still have enough valid trade routes if this passed?9089 int iPossibleRoutesAfter = iCivDestinations * GetPlayer()->getNumCities();9090 if ((iPossibleRoutesAfter / 3) < (int) GetPlayer()->GetTrade()->GetNumTradeRoutesPossible())9091 {9092 iScore += -40;9093 }9094 }90959096 // Player Trait making routes to them valuable (Morocco)9097 for (int i = 0; i < NUM_YIELD_TYPES; i++)9098 {9099 YieldTypes e = (YieldTypes) i;9100 if (GetPlayer()->GetPlayerTraits()->GetYieldChangeIncomingTradeRoute(e) > 0)9101 {9102 iScore += -40;9103 break;9104 }9105 }91069107 // Player Trait gives us extra routes, embargoes are bad for business (Venice)9108 if (GetPlayer()->GetPlayerTraits()->GetNumTradeRoutesModifier() > 0)9109 {9110 iScore += -20;9111 }9112 }9113 // Embargo9114 if (pProposal->GetEffects()->bEmbargoPlayer)9115 {9116 CvAssertMsg(eTargetPlayer != NO_PLAYER, "Evaluating an embargo on NO_PLAYER. Please send Anton your save file and version.");9117 // Major Civ relations9118 if (eTargetPlayer == GetPlayer()->GetID())9119 {9120 iScore += -100;9121 }9122 else if (GET_PLAYER(eTargetPlayer).getTeam() == GetPlayer()->getTeam())9123 {9124 iScore += -70;9125 }9126 else if (!GET_PLAYER(eTargetPlayer).isMinorCiv())9127 {9128 ThreatTypes eWarmongerThreat = GetPlayer()->GetDiplomacyAI()->GetWarmongerThreat(eTargetPlayer);9129 MajorCivOpinionTypes eOpinion = GetPlayer()->GetDiplomacyAI()->GetMajorCivOpinion(eTargetPlayer);9130 MajorCivApproachTypes eApproach = GetPlayer()->GetDiplomacyAI()->GetMajorCivApproach(eTargetPlayer, /*bHideTrueFeelings*/ true);9131 if (GET_TEAM(GetPlayer()->getTeam()).isAtWar(GET_PLAYER(eTargetPlayer).getTeam()))9132 {9133 iScore += 70;9134 }9135 else if (eWarmongerThreat >= THREAT_SEVERE)9136 {9137 iScore += 40;9138 }9139 else if (eOpinion < MAJOR_CIV_OPINION_NEUTRAL || eApproach < MAJOR_CIV_APPROACH_GUARDED)9140 {9141 iScore += 20;9142 }9143 else9144 {9145 iScore += -30;9146 }91479148 // Trade connections9149 if (GC.getGame().GetGameTrade()->IsPlayerConnectedToPlayer(GetPlayer()->GetID(), eTargetPlayer))9150 {9151 int iFactor = -10;9152 iScore += MAX(-40, GC.getGame().GetGameTrade()->CountNumPlayerConnectionsToPlayer(GetPlayer()->GetID(), eTargetPlayer) * iFactor);9153 }91549155 // Player Trait making routes to them valuable (Morocco)9156 for (int i = 0; i < NUM_YIELD_TYPES; i++)9157 {9158 YieldTypes e = (YieldTypes) i;9159 if (GetPlayer()->GetPlayerTraits()->GetYieldChangeIncomingTradeRoute(e) > 0)9160 {9161 iScore += -20;9162 break;9163 }9164 }91659166 // Player Trait gives us extra routes, embargoes are bad for business (Venice)9167 if (GetPlayer()->GetPlayerTraits()->GetNumTradeRoutesModifier() > 0)9168 {9169 iScore += -20;9170 }9171 }9172 }9173 // Ban Luxury9174 if (pProposal->GetEffects()->bNoResourceHappiness)9175 {9176 CvAssertMsg(eTargetLuxury != NO_RESOURCE, "Evaluating banning Happiness for NO_RESOURCE. Please send Anton your save file and version.");91779178 // What other major civs have this resource?9179 int iOtherPlayerResourceFactor = 0;9180 bool bOwnedByAnyPlayer = false;9181 for (int i = 0; i < MAX_MAJOR_CIVS; i++)9182 {9183 PlayerTypes e = (PlayerTypes) i;9184 if (e != GetPlayer()->GetID() && GET_PLAYER(e).isAlive() && !GET_PLAYER(e).isMinorCiv() && GET_TEAM(GetPlayer()->getTeam()).isHasMet(GET_PLAYER(e).getTeam()))9185 {9186 if (GET_PLAYER(e).getNumResourceTotal(eTargetLuxury) > 0)9187 {9188 bOwnedByAnyPlayer = true;9189 MajorCivOpinionTypes eOpinion = GetPlayer()->GetDiplomacyAI()->GetMajorCivOpinion(e);9190 if (GET_TEAM(GetPlayer()->getTeam()).isAtWar(GET_PLAYER(e).getTeam()))9191 {9192 iOtherPlayerResourceFactor += -3;9193 }9194 else if (GetPlayer()->GetDiplomacyAI()->IsDoFAccepted(e) || GetPlayer()->getTeam() == GET_PLAYER(e).getTeam())9195 {9196 iOtherPlayerResourceFactor += 3;9197 }9198 else if (eOpinion <= MAJOR_CIV_OPINION_COMPETITOR)9199 {9200 if (eOpinion == MAJOR_CIV_OPINION_COMPETITOR)9201 {9202 iOtherPlayerResourceFactor += -1;9203 }9204 else9205 {9206 iOtherPlayerResourceFactor += -2;9207 }9208 }9209 else if (eOpinion >= MAJOR_CIV_OPINION_FAVORABLE)9210 {9211 if (eOpinion == MAJOR_CIV_OPINION_FAVORABLE)9212 {9213 iOtherPlayerResourceFactor += 1;9214 }9215 else9216 {9217 iOtherPlayerResourceFactor += 2;9218 }9219 }9220 }9221 }9222 }9223 if (iOtherPlayerResourceFactor > 0)9224 {9225 // Our friends have this resource9226 iScore += -10;9227 if (iOtherPlayerResourceFactor > 3)9228 {9229 iScore += -10;9230 }9231 }9232 else if (iOtherPlayerResourceFactor < 0)9233 {9234 // Our enemies have this resource9235 iScore += 10;9236 if (iOtherPlayerResourceFactor < -3)9237 {9238 iScore += 10;9239 }9240 }92419242 // Do we have this resource?9243 if (GetPlayer()->getNumResourceTotal(eTargetLuxury) > 0)9244 {9245 bOwnedByAnyPlayer = true;9246 iScore += -30;9247 if (GetPlayer()->getResourceInOwnedPlots(eTargetLuxury) > 0)9248 {9249 iScore += -20;9250 }9251 if (GetPlayer()->IsEmpireUnhappy())9252 {9253 iScore += -20;9254 }9255 }9256 else9257 {9258 if (GetPlayer()->getResourceInOwnedPlots(eTargetLuxury) > 0)9259 {9260 iScore += -20;9261 }9262 else9263 {9264 iScore += 15;9265 }9266 }92679268 if (!bOwnedByAnyPlayer)9269 {9270 // Hard set to 0 if nobody owns it. No effect, so we don't care.9271 iScore = 0;9272 }9273 }9274 // Standing Army Tax9275 if (pProposal->GetEffects()->iUnitMaintenanceGoldPercent != 0)9276 {9277 int iFactor = (pProposal->GetEffects()->iUnitMaintenanceGoldPercent > 0) ? 1 : -1;9278 if (bSeekingConquestVictory)9279 {9280 iScore += -40 * iFactor;9281 }92829283 // What is the ratio of our current maintenance costs to our gross GPT?9284 int iUnitMaintenance = GetPlayer()->GetTreasury()->GetExpensePerTurnUnitMaintenance();9285 int iGPT = GetPlayer()->GetTreasury()->CalculateGrossGold();9286 float fRatio = ((float)iUnitMaintenance / (float)iGPT);9287 if ((iGPT - iUnitMaintenance) < 0)9288 {9289 iScore += -50 * iFactor;9290 }9291 else if (fRatio >= 0.5f)9292 {9293 iScore += -40 * iFactor;9294 }9295 else if (fRatio >= 0.2f)9296 {9297 iScore += -15 * iFactor;9298 }9299 else9300 {9301 iScore += 15 * iFactor;9302 }9303 }93049305 // Scholars in Residence9306 if (pProposal->GetEffects()->iMemberDiscoveredTechMod != 0)9307 {9308 float fTechRatio = GetPlayer()->GetPlayerTechs()->GetTechAI()->GetTechRatio();9309 fTechRatio = (fTechRatio - 0.5f) * 2.0f; // -1.0 if in first, 1.0 if in last9310 9311 // We are better than average9312 if (fTechRatio < 0.0f)9313 {9314 int iFactor = 30;9315 iScore += (int) (fTechRatio * iFactor);9316 if (bSeekingScienceVictory)9317 {9318 iScore += -30;9319 }9320 }9321 // At or worse than average9322 else9323 {9324 int iFactor = 50;9325 iScore += (int) (fTechRatio * iFactor);9326 if (bSeekingScienceVictory)9327 {9328 iScore += 40;9329 }9330 }9331 }9332 // Cultural Heritage Sites9333 if (pProposal->GetEffects()->iCulturePerWonder != 0)9334 {9335 int iNumWonders = GetPlayer()->GetNumWonders();9336 int iTempScore = -50;9337 if (iNumWonders > 0)9338 {9339 int iFactor = bSeekingCultureVictory ? 20 : 15;9340 iTempScore += iNumWonders * iFactor;9341 }9342 iScore += iTempScore;9343 iScore = MIN(70, iScore);9344 }9345 // Natural Heritage Sites9346 if (pProposal->GetEffects()->iCulturePerNaturalWonder != 0)9347 {9348 int iNumNaturalWonders = GetPlayer()->GetNumNaturalWondersInOwnedPlots();9349 int iTempScore = -35;9350 if (iNumNaturalWonders > 0)9351 {9352 int iFactor = bSeekingCultureVictory ? 20 : 15;9353 iTempScore += iNumNaturalWonders * iFactor;9354 }9355 iScore += iTempScore;9356 iScore = MIN(70, iScore);9357 }9358 // Nuclear Non-Proliferation9359 if (pProposal->GetEffects()->bNoTrainingNuclearWeapons)9360 {9361 if (bSeekingConquestVictory)9362 {9363 iScore += -50;9364 }9365 else9366 {9367 iScore += 35;9368 }9369 }9370 // World Religion9371 if (pProposal->GetEffects()->iVotesForFollowingReligion != 0 ||9372 pProposal->GetEffects()->iHolyCityTourism != 0 ||9373 pProposal->GetEffects()->iReligionSpreadStrengthMod != 0)9374 {9375 CvAssertMsg(eTargetReligion != NO_RELIGION, "Evaluating World Religion for NO_RELIGION. Please send Anton your save file and version.");9376 bool bFoundedReligion = GetPlayer()->GetReligions()->GetReligionCreatedByPlayer() == eTargetReligion;9377 bool bMajorityReligion = GetPlayer()->GetReligions()->HasReligionInMostCities(eTargetReligion);9378 if (bMajorityReligion)9379 {9380 iScore += 40;9381 if (bSeekingDiploVictory)9382 {9383 iScore += 20;9384 }9385 }9386 else9387 {9388 iScore += -30;9389 }93909391 const CvReligion* pkTargetReligion = GC.getGame().GetGameReligions()->GetReligion(eTargetReligion, GetPlayer()->GetID());9392 CvAssertMsg(pkTargetReligion, "Evaluating World Religion for an invalid religion. Please send Anton your save file and version.");9393 if (pkTargetReligion)9394 {9395 CvPlot* pPlot = GC.getMap().plot(pkTargetReligion->m_iHolyCityX, pkTargetReligion->m_iHolyCityY);9396 if(pPlot)9397 {9398 CvCity* pHolyCity = pPlot->getPlotCity();9399 if (pHolyCity && pHolyCity->getOwner() == GetPlayer()->GetID())9400 {9401 iScore += 10;9402 if (bSeekingCultureVictory)9403 {9404 iScore += 30;9405 }9406 }9407 }9408 }94099410 if (bFoundedReligion)9411 {9412 iScore += 40;9413 }9414 else if (GetPlayer()->GetReligions()->GetReligionCreatedByPlayer() != NO_RELIGION && GetPlayer()->GetReligions()->GetReligionCreatedByPlayer() != eTargetReligion)9415 {9416 iScore += -20;9417 }9418 }9419 // World Ideology9420 if (pProposal->GetEffects()->iVotesForFollowingIdeology != 0 ||9421 pProposal->GetEffects()->iOtherIdeologyRebellionMod != 0)9422 {9423 CvAssertMsg(eTargetIdeology != NO_POLICY_BRANCH_TYPE, "Evaluating World Ideology for NO_POLICY_BRANCH_TYPE. Please send Anton your save file and version.");9424 PolicyBranchTypes eOurIdeology = GetPlayer()->GetPlayerPolicies()->GetLateGamePolicyTree();9425 bool bPublicOpinionUnhappiness = GetPlayer()->GetCulture()->GetPublicOpinionUnhappiness() > 0;9426 if (eOurIdeology != NO_POLICY_BRANCH_TYPE)9427 {9428 if (eOurIdeology == eTargetIdeology)9429 {9430 iScore += 50;9431 if (bSeekingDiploVictory)9432 {9433 iScore += 25;9434 }9435 if (bPublicOpinionUnhappiness)9436 {9437 iScore += 25;9438 }9439 }9440 else9441 {9442 iScore += -50;9443 if (bSeekingDiploVictory)9444 {9445 iScore += -25;9446 }9447 if (bPublicOpinionUnhappiness)9448 {9449 iScore += -25;9450 }9451 }9452 }9453 }9454 // Arts Funding9455 if (pProposal->GetEffects()->iArtsyGreatPersonRateMod > 0 ||9456 pProposal->GetEffects()->iScienceyGreatPersonRateMod < 0)9457 {9458 if (bSeekingCultureVictory)9459 {9460 iScore += 80;9461 }9462 else if (bSeekingScienceVictory)9463 {9464 iScore += -80;9465 }94669467 // Do we have a sciencey Great Person unique unit? (ie. Merchant of Venice)9468 bool bScienceyUniqueUnit = false;9469 UnitClassTypes eScienceyUnitClass = (UnitClassTypes) GC.getInfoTypeForString("UNITCLASS_MERCHANT", true);9470 if (eScienceyUnitClass != NO_UNITCLASS)9471 {9472 CvUnitClassInfo* pScienceyUnitClassInfo = GC.getUnitClassInfo(eScienceyUnitClass);9473 if (pScienceyUnitClassInfo)9474 {9475 UnitTypes eScienceyUnit = (UnitTypes) GetPlayer()->getCivilizationInfo().getCivilizationUnits(eScienceyUnitClass);9476 UnitTypes eDefault = (UnitTypes) pScienceyUnitClassInfo->getDefaultUnitIndex();9477 if (eScienceyUnit != eDefault)9478 {9479 bScienceyUniqueUnit = true;9480 }9481 }9482 }9483 9484 if (bScienceyUniqueUnit)9485 {9486 iScore += -60;9487 }9488 }9489 // Sciences Funding9490 if (pProposal->GetEffects()->iScienceyGreatPersonRateMod > 0 ||9491 pProposal->GetEffects()->iArtsyGreatPersonRateMod < 0)9492 {9493 if (bSeekingScienceVictory)9494 {9495 iScore += 80;9496 }9497 else if (bSeekingCultureVictory)9498 {9499 iScore += -80;9500 }95019502 // Do we have a sciencey Great Person unique unit? (ie. Merchant of Venice)9503 bool bScienceyUniqueUnit = false;9504 UnitClassTypes eScienceyUnitClass = (UnitClassTypes) GC.getInfoTypeForString("UNITCLASS_MERCHANT", true);9505 if (eScienceyUnitClass != NO_UNITCLASS)9506 {9507 CvUnitClassInfo* pScienceyUnitClassInfo = GC.getUnitClassInfo(eScienceyUnitClass);9508 if (pScienceyUnitClassInfo)9509 {9510 UnitTypes eScienceyUnit = (UnitTypes) GetPlayer()->getCivilizationInfo().getCivilizationUnits(eScienceyUnitClass);9511 UnitTypes eDefault = (UnitTypes) pScienceyUnitClassInfo->getDefaultUnitIndex();9512 if (eScienceyUnit != eDefault)9513 {9514 bScienceyUniqueUnit = true;9515 }9516 }9517 }95189519 if (bScienceyUniqueUnit)9520 {9521 iScore += 60;9522 }9523 }9524 // Historical Landmarks9525 if (pProposal->GetEffects()->iGreatPersonTileImprovementCulture != 0 ||9526 pProposal->GetEffects()->iLandmarkCulture != 0)9527 {9528 int iNumGPImprovements = GetPlayer()->getGreatPersonImprovementCount();9529 int iNumLandmarks = 0;9530 ImprovementTypes eLandmark = (ImprovementTypes)GC.getInfoTypeForString("IMPROVEMENT_LANDMARK");9531 if (eLandmark != NO_IMPROVEMENT)9532 {9533 iNumLandmarks += GetPlayer()->getImprovementCount(eLandmark);9534 }95359536 int iTempScore = -50;9537 if (iNumGPImprovements > 0 || iNumLandmarks > 0)9538 {9539 int iGPImprovementFactor = bSeekingCultureVictory ? 20 : 15;9540 iTempScore += iNumGPImprovements * iGPImprovementFactor;9541 int iLandmarkFactor = bSeekingCultureVictory ? 20 : 15;9542 iTempScore += iNumLandmarks * iLandmarkFactor;9543 iScore += MIN(70, iTempScore);9544 }9545 iScore += iTempScore;9546 }95479548 // == Diplomat knowledge, Vote Commitments we secured ==95499550 // == Alignment with Proposer ==9551 PlayerTypes eProposer = pProposal->GetProposalPlayer();9552 if (iScore > -20 || eProposer == GetPlayer()->GetID())9553 {9554 if (eProposer != NO_PLAYER)9555 {9556 AlignmentLevels eAlignment = EvaluateAlignment(eProposer);9557 switch (eAlignment)9558 {9559 case ALIGNMENT_SELF:9560 iScore += 40;9561 break;9562 case ALIGNMENT_LIBERATOR:9563 case ALIGNMENT_LEADER:9564 case ALIGNMENT_ALLY:9565 iScore += 30;9566 break;9567 case ALIGNMENT_CONFIDANT:9568 iScore += 20;9569 break;9570 case ALIGNMENT_FRIEND:9571 iScore += 10;9572 break;9573 case ALIGNMENT_RIVAL:9574 iScore += -10;9575 break;9576 case ALIGNMENT_HATRED:9577 iScore += -20;9578 break;9579 case ALIGNMENT_ENEMY:9580 case ALIGNMENT_WAR:9581 iScore += -30;9582 break;9583 default:9584 break;9585 }9586 }9587 }95889589 // == Post-Processing ==9590 if (iChoice == LeagueHelpers::CHOICE_NO)9591 {9592 iScore *= -1; // Flip the score when we are considering NO for these effects9593 }9594 if (!bEnact)9595 {9596 iScore *= -1; // Flip the score when the proposal is to repeal these effects9597 }95989599 return iScore;9600}