General
- Added some more automated testing to GitHub
- Lots of code cleanup - deleted another ~5k lines of code (thanks again, azum4roll)
Removed unused Civ4 religion mechanics
Removed non-functional columns in Buildings table: FoundsReligion, IsReligious
Reorganized CvPlayer::processPolicies(), make most policy abilities revertible
- Notable exception being instant population, which is currently REAPPLIED when the policy is removed (fixed)
- These policies' effects are now one shot (will not reapply if the policy is gained again):
-- Progress opener: retro yields from population and tech
-- Tradition opener: +2 capital population
-- Resettlement: +2 population in every city
-- People's Army, Worker's Faculties, Academy of Sciences: free buildings
-- Universal Suffrage: start a golden age
-- Enlightenment, Great Leap Forward: free tech
- Fixed National Treasure not having IncludesOneShotFreeUnits = 1
- "Technically, OneShot and IncludesOneShotFreeUnits should be default true since it's normal to block these effects from firing twice, but I'm too lazy to add a PolicySweeps.sql for now"
- DLL modders need to be careful where to place change functions
Removed unused (and defunct) variables and functions about "chosen" policy branches
- Fixed top panel calling the wrong Lua function
- Removed defines: NUM_POLICY_BRANCHES_ALLOWED
- Removed column: Policies.NumExtraBranches
- Removed Lua functions: player:GetNumPolicyBranchesAllowed (no setter), player:GetPolicyBranchChosen
Contained most MOD_BUILDINGS_THOROUGH_PREREQUISITES logic within the new CvCity::GetBuildingTypeFromClass() function
Made more columns/tables that add yields/happiness to buildings support having more than 1 of the same building in a city (probably still not ALL)
Unhardcoded (most) theming bonus descriptions
Removed inaccurate great people counter of both player and city
- Player version only tracks GG and GA and is never used
- City version is never updated
- Associated Lua function: city:GetNumGreatPeople
Reduced repetitive code with new CvCity::SetNumFreeBuilding() function
- Refund production/faith and city location validation are optional (default true)
Changed Lua function city:SetNumFreeBuilding
- Now takes in optional bRefund and bValidate parameters (default FALSE) and returns whether the city has the correct number of free buildings afterwards
- Backward compatible
- Full "declaration": bool SetNumFreeBuilding(BuildingTypes iIndex, int iNewValue, bool bRefund = false, bool bValidate = false)
Fixed some clang warnings
AI
City-State Diplomacy
- AI no longer sends diplomatic units or spies to City-States that have an Open Door or Sphere of Influence resolution currently proposed for them
- AI no longer sends diplomatic units or spies to City-States allied with their teammates
Diplomacy
- Humans can now request coop wars from players they are targeting with coop wars, if they want to
This was added as anti-AI stupidity but is no longer needed & shouldn't affect humans wanting to backstab
- AI no longer applies any diplomatic penalties towards other players for having their teammate's religion
- Reverted AI back to more intelligent calculation of comparative military power
It was reverted back to the vanilla version because nuclear weapons couldn't be considered since they had no combat strength, however see "Balance - Score" below
- AI will now refuse/break a "don't settle new cities near us" promise if they have no cities
- Improvements to AI logic relating to selecting war and demand targets
Fixed a bunch of bugs (see Bugfixes)
AIs going for Domination Victory are now programmed to select a target even if it would backstab a friend or their approach isn't negative, if no other valid targets are available
Some conditions (e.g., recent peace treaty, teamed up with a human, target too distant in early game) override this
Refusing a trade demand without an immediate war declaration in retaliation no longer deters the AI from declaring war against you
Accepting a trade demand still does, however - and the AI can tell the difference now
The deterrence now also ends if the demand expires due to war or sanctions
- AI no longer adds a FRIENDLY bonus for traded items you're giving to them as part of a demand or peace treaty *IF* they're looking for an opportunity attack against you
Voluntarily traded or given items still increase the FRIENDLY approach, however
- AI now more likely to become HOSTILE (or declare war, to a lesser extent) if they think you'd be a good demand target
- AI now more likely to become GUARDED if you've recently accepted a demand from them, scaling with their vulnerability
- AI now cannot be FRIENDLY if they're currently giving something to you in a trade demand, and reevaluates its approach instantly
- Opinion penalty for making trade demands is now halved if the AI is not currently giving anything to you
- Opinion penalty for making trade demands is now doubled if the AI is currently giving something and is bankrupt
If the AI will go bankrupt in less than 20 turns, the penalty will gradually increase to 2x based on the number of turns until bankruptcy
Average instant yield gain is added to the AI's negative GPT for this calculation, so it's not the same as the number displayed in the trade screen
- Minor improvements relating to vassals choosing approach towards their masters
Deal AI
- Minor improvements to third party war valuation logic
Policy AI
- AI teammates of humans will attempt to adopt the first human on their team's ideology (sorting by turn order) if it would not make them lose cities from Unhappiness
- AI teammates of other AIs will adopt the ideology of the clearly leading AI, if the leading AI has at least 1.5x the evaluating AI's score and it would not make the evaluating AI lose cities from Unhappiness
Being close to a cultural victory adds 100000 score to a team member for this evaluation
- AI teammates will switch ideologies if they have the option and either of the two conditions above are true
Religion AI
- AI will no longer convert foreign cities that are following their teammates' religions
They will allow human teammates (only) to convert their own cities without reconverting them
Balance
Complete Kills Game Option
- If a player stays alive for 10 turns without a Settler or any cities, they receive a free Settler
Spawn placement order of priority:
1. Attempt to spawn on top of a land combat unit that is on land (highest defensive strength)
2. Attempt to spawn on top of a land civilian unit that is on land (highest Production cost, minimum 1)
3. Spawn on top of a random tile where a city could be founded
(AI will not pick an Antiquity Site tile; they're disallowed to found on them to circumvent a bug)
Improvements
- Improvements created by Great People no longer follow the "take the minimum of time to construct and repair improvement" rule when determining repair time
i.e., They use the base repair time, they can't be repaired instantly
Military (Move Troops) Promise
- Is now mutual - the asker also agrees not to declare war on the player they're requesting the promise from
- Blocked AI teammates of humans from requesting or accepting move troops promises
- Also blocked AI from requesting a "don't attack my protected City-State" promise from AI teammates of humans
These exceptions are to prevent human teammates from incurring backstabbing penalties for promises they weren't aware were made, since AI will penalize an entire team for those penalties
Score
- Reverted score back to more intelligent calculation of military power based on attack strength
- Nuclear weapons now count towards military power, and the AI will evaluate them separately
Atomic Bombs are worth (strongest land unit in world * (blast radius tiles - 1) * 2) + (strongest land unit in world * 3) + (strongest air unit in world * 12)
Nuclear Missiles are worth (strongest land unit in world * blast radius tiles * 3) + (strongest air unit in world * 12)
City-States will just use these numbers as-is for the global military power bonus to tribute, but won't add an additional local military power bonus for nukes located near them
In AI evaluations, the AI will consider how many of its cities are protected by Strategic Defense Systems, and the stats of those SDS's, as well as use its own strongest units rather than those of the world
More SDS's = they will see your nukes as less of a threat
This also applies in reverse, they will consider their own nukes less threatening if their opponent has built SDS's
The AI also considers the nuclear power of each player's allies
Additionally, military skill rating or HumanStrengthPerceptionMod (difficulty) has no effect on AI's perception of nuclear power
Nuke Immunity
- Added it to Strategic Defense System, even though nukes don't currently destroy buildings in VP
- Made Nuke Immune buildings unable to be randomly destroyed by events that destroy buildings
Wonders and dummy buildings were already immune, so their balance is unchanged
UI
- Added a notification when the AI's "don't settle near Cities near us" promise is fulfilled (and might need renewal)
- Clarified some civ text; shortened all civ text to fit within 3 lines of text
- Other text fixes
Bugfixes
- Fixed a crash when determining religious Tourism towards a player with no cities
- Fixed a crash when deleting a City-State from the game with OCC / IGE
- Fixed a crash when scoring religious beliefs without having a capital city
- Fixed various bugs with Diplo AI war and demand logic
Caused AI to cancel AI operations inappropriately, which made successful operations less likely
- Fixed global City-State quests (e.g., Barbarian Horde) expiring prematurely if a major civ that had the quest died
This also fixes Barbarians capturing the City-State earlier than they should!
- Fixed AI being overly eager to liberate vassals (added many sanity checks, reduced weights, and added a customizable define)
- Fixed some vassal tax money being lost due to rounding if there are multiple players on the master's team
- Fixed vassal maintenance expenses not being divided evenly amongst members of the master's team
- Fixed vassals adopting the ideology of dead masters if a still-living master is later in the player order
- Fixed Nuclear Gandhi being enabled with Random Personalities enabled and without the relevant override setting enabled
- Fixed Indian Great Prophets perishing immediately if the player chooses to build a Holy Site before founding a religion
- Also unhardcoded this exception so that it works for any improvement that an Indian Great Prophet (or unique Great Prophet) can create, not just Holy Sites
- Fixed human vassals not adopting their master's ideology
- Fixed broken logic preventing AI players from switching ideologies
- Fixed Complete Kills AI not using any Settlers they have to found a new capital
- Fixed Rome getting yields and bonuses from conquered cities that aren't the City-State's original capital
- Fixed purchased Authority units not being able to create Polynesian Fishing Boats
- Fixed Defensive Pacts not being cancelled by denouncements
- Fixed being able to trade Defensive Pacts without mutual embassies
- Fixed player 0's AI personality not initializing correctly when entering observer mode
- Fixed AI not properly recognizing conquered religions as owned in some situations with teammates
- Added unitclass cap check to free unit picker
- Fixed belief yields from working any specialist not being scored by Religion AI
- Removed score nullification if belief gives Science to buildings and player has Chinese trait
No idea why this was here, but it sure doesn't make sense right now
- Allowed AI to immediately gain a reformation belief if the respective policy is picked, instead of needing to wait for next turn
- Fixed land units not being upgradeable on water polders
- Disallowed units from upgrading while having cargo
Prevents the case where it upgrades into something that can't carry cargo
This could already be intended in the base game, but the code was placed in the wrong block
- Removed potential Production/Faith refund for Palace when capital is captured - it's already being refunded by being rebuilt in the new capital