Skip to content

Commit

Permalink
Fix a bunch of bugs
Browse files Browse the repository at this point in the history
- Fixed a crash when deleting a City-State from the game with IGE
- Fixed #11096 a crash when scoring religious beliefs without having a capital city
- 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 a 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
- 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 they have at least 1.5x the evaluating AI's score
- AI teammates will switch ideologies if they have the option and either of the two conditions above are true
- AI no longer sends spies to City-States if a Sphere of Influence or Open Doors resolution has been proposed for them
- AI now considers when a player currently owns their teammate's cities as well as their own for some things
- Improve readability of DifficultyChanges.xml
  • Loading branch information
RecursiveVision committed Jul 9, 2024
1 parent 9ad006c commit f6d8c1e
Show file tree
Hide file tree
Showing 22 changed files with 1,424 additions and 1,600 deletions.
54 changes: 54 additions & 0 deletions (1) Community Patch/Core Files/Core Tables/DifficultyTables.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- Delete the data in the difficulty tables, replaced in DifficultyTables.xml
DELETE FROM HandicapInfo_FreeTechs;
DELETE FROM HandicapInfo_AIFreeTechs;
DELETE FROM HandicapInfo_Goodies; -- This one is replaced at the end of this file instead
DELETE FROM HandicapInfos;

-- This code is necessary to avoid a UI glitch where difficulty levels do not display properly on game creation, do not remove it
Expand Down Expand Up @@ -226,3 +230,53 @@ VALUES
('GOODY_GOLDEN_AGE', 'TXT_KEY_GOODY_GOLDEN_AGE', 'TXT_KEY_GOODY_CHOOSE_GOLDEN_AGE', 0, 200, 0, 0),
('GOODY_TILES', 'TXT_KEY_GOODY_TILES', 'TXT_KEY_GOODY_CHOOSE_FREE_TILES', 0, 0, 4, 0),
('GOODY_SCIENCE', 'TXT_KEY_GOODY_SCIENCE', 'TXT_KEY_GOODY_CHOOSE_SCIENCE', 0, 0, 0, 35);

-- Re-add Goody Hut rewards
CREATE TEMP TABLE HandicapsList (
HandicapType text
);

INSERT INTO HandicapsList
(HandicapType)
VALUES
('HANDICAP_SETTLER'),
('HANDICAP_CHIEFTAIN'),
('HANDICAP_WARLORD'),
('HANDICAP_PRINCE'),
('HANDICAP_KING'),
('HANDICAP_EMPEROR'),
('HANDICAP_IMMORTAL'),
('HANDICAP_DEITY'),
('HANDICAP_AI_DEFAULT');

CREATE TEMP TABLE GoodyHutRewards (
GoodyType text
);

INSERT INTO GoodyHutRewards
(GoodyType)
VALUES
('GOODY_POPULATION'),
('GOODY_CULTURE'),
('GOODY_PANTHEON_FAITH'),
('GOODY_PROPHET_FAITH'),
('GOODY_GOLD'),
('GOODY_MAP'),
('GOODY_TECH'),
('GOODY_REVEAL_NEARBY_BARBS'),
('GOODY_UPGRADE_UNIT');

-- Settler-exclusive rewards
INSERT INTO HandicapInfo_Goodies
('HANDICAP_SETTLER', 'GOODY_WORKER'),
('HANDICAP_SETTLER', 'GOODY_SETTLER');

-- General rewards
INSERT INTO HandicapInfo_Goodies
(HandicapType, GoodyType)
SELECT
a.HandicapType, b.GoodyType
FROM HandicapsList a, GoodyHutRewards b;

DROP TABLE HandicapsList;
DROP TABLE GoodyHutRewards;
786 changes: 222 additions & 564 deletions (1) Community Patch/Core Files/Core Tables/DifficultyTables.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions (1) Community Patch/Core Files/Core Values/CoreDefines.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ INSERT INTO Defines (Name, Value) SELECT 'VASSALAGE_VASSAL_MASTER_CITY_PERCENT_T
INSERT INTO Defines (Name, Value) SELECT 'VASSALAGE_VASSAL_MASTER_POP_PERCENT_THRESHOLD', 60;

INSERT INTO Defines (Name, Value) SELECT 'VASSALAGE_CAPITULATE_BASE_THRESHOLD', 100; -- How likely is a vassal to voluntarily capitulate?
INSERT INTO Defines (Name, Value) SELECT 'VASSALAGE_LIBERATE_BASE_THRESHOLD', 100; -- How likely is a master to voluntarily liberate a vassal?

-- Border growth tile selection
UPDATE Defines SET Value = 200 WHERE Name = 'PLOT_INFLUENCE_RING_COST';
Expand Down
54 changes: 54 additions & 0 deletions (2) Vox Populi/Database Changes/Difficulty/DifficultyChanges.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
-- New Goody Hut rewards
CREATE TEMP TABLE HandicapsList (
HandicapType text
);

INSERT INTO HandicapsList
(HandicapType)
VALUES
('HANDICAP_SETTLER'),
('HANDICAP_CHIEFTAIN'),
('HANDICAP_WARLORD'),
('HANDICAP_PRINCE'),
('HANDICAP_KING'),
('HANDICAP_EMPEROR'),
('HANDICAP_IMMORTAL'),
('HANDICAP_DEITY'),
('HANDICAP_AI_DEFAULT');

CREATE TEMP TABLE GoodyHutRewards (
GoodyType text
);

INSERT INTO GoodyHutRewards
(GoodyType)
VALUES
('GOODY_POPULATION'),
('GOODY_CULTURE'),
('GOODY_PANTHEON_FAITH'),
('GOODY_PROPHET_FAITH'),
('GOODY_GOLD'),
('GOODY_MAP'),
('GOODY_UPGRADE_UNIT'),
('GOODY_PRODUCTION'),
('GOODY_GOLDEN_AGE'),
('GOODY_TILES'),
('GOODY_SCIENCE');

-- Settler-exclusive rewards
INSERT INTO HandicapInfo_Goodies
('HANDICAP_SETTLER', 'GOODY_WORKER'),
('HANDICAP_SETTLER', 'GOODY_SETTLER');

-- General rewards
INSERT INTO HandicapInfo_Goodies
(HandicapType, GoodyType)
SELECT
a.HandicapType, b.GoodyType
FROM HandicapsList a, GoodyHutRewards b;

DROP TABLE HandicapsList;
DROP TABLE GoodyHutRewards;



CREATE TEMP TABLE TriggerYields (
HistoricEventType text,
YieldType text
Expand Down
861 changes: 224 additions & 637 deletions (2) Vox Populi/Database Changes/Difficulty/DifficultyChanges.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
-- Delete the data in the difficulty tables, replaced in DifficultyChanges.xml
-- Delete the data in the difficulty tables, replaced in DifficultyChanges.xml and GoodyHutChanges.sql
DELETE FROM HandicapInfo_DifficultyBonus;
DELETE FROM HandicapInfo_AIDifficultyBonus;
DELETE FROM HandicapInfo_FreeTechs;
DELETE FROM HandicapInfo_AIFreeTechs;
DELETE FROM HandicapInfo_Goodies;
DELETE FROM HandicapInfos;
DELETE FROM HandicapInfos;
3 changes: 1 addition & 2 deletions CvGameCoreDLLUtil/include/CvDllInterfaces2.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ class ICvNetMessageHandler3 : public ICvNetMessageHandler2
virtual void DLLCALL ResponseGoodyChoice(PlayerTypes ePlayer, int iPlotX, int iPlotY, GoodyTypes eGoody, int iUnitID) = 0;
virtual void DLLCALL ResponseSetSwappableGreatWork(PlayerTypes ePlayer, int iWorkClass, int iWorkIndex) = 0;
virtual void DLLCALL ResponseSwapGreatWorks(PlayerTypes ePlayer1, int iWorkIndex1, PlayerTypes PlayerTypes2, int iWorkIndex2) = 0;
virtual void DLLCALL ResponseMoveGreatWorks(PlayerTypes ePlayer, int iCity1, int iBuildingClass1, int iWorkIndex1,
int iCity2, int iBuildingClass2, int iWorkIndex2) = 0;
virtual void DLLCALL ResponseMoveGreatWorks(PlayerTypes ePlayer, int iCity1, int iBuildingClass1, int iWorkIndex1, int iCity2, int iBuildingClass2, int iWorkIndex2) = 0;
virtual void DLLCALL ResponseChangeIdeology(PlayerTypes ePlayer) = 0;
};

Expand Down
Loading

1 comment on commit f6d8c1e

@JohnsterID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://productionresultssa9.blob.core.windows.net/actions-results/d6218ab2-9471-45ed-9a9c-aee97022364d/workflow-job-run-c10d9e2f-60df-5bcc-d6bc-33b4959e8306/logs/job/job-logs.txt?rsct=text%2Fplain&se=2024-07-09T11%3A55%3A16Z&sig=djhlA%2BuRrAlg70y9Qh0JubO4jU9GVJ24WQ%2B5E59F7hE%3D&ske=2024-07-09T21%3A31%3A05Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2024-07-09T09%3A31%3A05Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2023-11-03&sp=r&spr=https&sr=b&st=2024-07-09T11%3A45%3A11Z&sv=2023-11-03

2024-07-09T03:34:56.1642402Z D:\a\Community-Patch-DLL\Community-Patch-DLL\CvGameCoreDLL_Expansion2\CvDiplomacyAI.cpp(55617,15) : warning: comparison of different enumeration types ('PlayerTypes' and 'StrengthTypes') [-Wenum-compare]
2024-07-09T03:34:56.1642718Z  55617 |                         if (eVassal > STRENGTH_AVERAGE)
2024-07-09T03:34:56.1644037Z        |                             ~~~~~~~ ^ ~~~~~~~~~~~~~~~~
2024-07-09T03:34:56.1646190Z D:\a\Community-Patch-DLL\Community-Patch-DLL\CvGameCoreDLL_Expansion2\CvDiplomacyAI.cpp(55623,15) : warning: comparison of different enumeration types ('PlayerTypes' and 'StrengthTypes') [-Wenum-compare]
2024-07-09T03:34:56.1646632Z  55623 |                         if (eVassal > STRENGTH_AVERAGE)
2024-07-09T03:34:56.1647880Z        |                             ~~~~~~~ ^ ~~~~~~~~~~~~~~~~

Please sign in to comment.