-
Notifications
You must be signed in to change notification settings - Fork 29
Issue #796 - Domestic advisor details #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
esbudylin
merged 12 commits into
C7-Game:Development
from
zack-the-coding-actuary:domesticAdvisorDetails
Jan 15, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
af418e4
WIP: Domestic Advisor Details
zack-the-coding-actuary 783f581
Domestic Advisor Set Up
zack-the-coding-actuary edbe486
Small bugfixes and some UI QoL updates
zack-the-coding-actuary 15cec48
Deleted unnecessary assignment of unitCostSupport in DomesticAdvisor.cs
zack-the-coding-actuary dca3ae9
Merge branch 'C7-Game:Development' into domesticAdvisorDetails
zack-the-coding-actuary 2eb5d22
Fixed reviewer comments
zack-the-coding-actuary c5b4c08
Fixed .json save issue.
zack-the-coding-actuary 72e7cc9
Removed currentTurn flag and instantiation from multi-turn deal logic…
zack-the-coding-actuary 3b5c27c
Merge branch 'C7-Game:Development' into domesticAdvisorDetails
zack-the-coding-actuary b3e3052
Merge branch 'Development' of https://github.com/zack-the-coding-actu…
zack-the-coding-actuary 9b9f752
Merge branch 'domesticAdvisorDetails' of https://github.com/zack-the-…
zack-the-coding-actuary 499fe59
JSON whitespace and added TODO for city commerce calculations
zack-the-coding-actuary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,35 @@ | |
| using static C7GameData.EraUtils; | ||
|
|
||
| namespace C7GameData { | ||
|
|
||
| public struct PlayerCommerceBreakdown { | ||
| public int corrupted; // Amount of commerce lost directly to corruption | ||
| public int taxes; // Amount of treasury income from REGULAR citizens working tiles | ||
| public int taxmenTaxes; // Amount of treasury income from tax collector specialists | ||
| public int beakers; // Amount of commerce going to science | ||
| public int happiness; // Amount of commerce going to entertainment | ||
| public int fromOtherCivs; // Income from other Civ GPT deals | ||
| public int toOtherCivs; // Expenses paid to other Civ GPT deals | ||
| public int interest; // Interest income from Wall Street-flag small wonder | ||
| public int maintenance; // Expenses due to aggregate building maintenance | ||
| public int unitSupport; // Expenses due to unit support costs | ||
|
|
||
| public int Inflows() { | ||
| return corrupted + taxes + taxmenTaxes + beakers + happiness + fromOtherCivs + interest; | ||
| } | ||
|
|
||
| public int Outflows() { | ||
| return corrupted + beakers + happiness + toOtherCivs + maintenance + unitSupport; | ||
| } | ||
|
|
||
| public int Netflows() { | ||
| return Inflows() - Outflows(); | ||
| } | ||
|
|
||
| public int CityInflows() { | ||
| return corrupted + taxes + beakers + happiness; | ||
| } | ||
| } | ||
| public class Player { | ||
| private static ILogger log = Log.ForContext<Player>(); | ||
|
|
||
|
|
@@ -324,6 +353,61 @@ public override string ToString() { | |
| return ""; | ||
| } | ||
|
|
||
| public PlayerCommerceBreakdown AggregateFlows() { | ||
| var result = new PlayerCommerceBreakdown | ||
| { | ||
| corrupted = 0, | ||
| taxes = 0, | ||
| taxmenTaxes = 0, | ||
| beakers = 0, | ||
| happiness = 0, | ||
| fromOtherCivs = 0, | ||
| toOtherCivs = 0, | ||
| interest = 0, | ||
| maintenance = 0, | ||
| unitSupport = 0 | ||
| }; | ||
|
|
||
| // If player has no cities, apply no expenses or income. | ||
| // This is how this behaves in regular Civ 3 as well (if you're not defeated, e.g. you still have a King unit or settler) | ||
| if (cities.Count == 0) return result; | ||
|
|
||
| // Assume player has no buildings that generate interest income until we check | ||
| int interestBuildings = 0; | ||
|
|
||
| foreach (City city in cities) { | ||
| CommerceBreakdown cityCommerce = city.CurrentCommerceYield(); | ||
| result.corrupted += cityCommerce.corrupted; | ||
| result.taxes += cityCommerce.taxes; | ||
| result.beakers += cityCommerce.beakers; | ||
| result.happiness += cityCommerce.happiness; | ||
| result.maintenance += city.MaintenanceCosts(); | ||
|
|
||
| interestBuildings += city.constructed_buildings.Count(cb => cb.building.treasuryEarnsInterest); | ||
|
|
||
| foreach (CityResident cr in city.residents) { | ||
| // Split city income into "regular citizen" and "tax collector" buckets | ||
| result.taxes -= cr.citizenType.Taxes; | ||
| result.taxmenTaxes += cr.citizenType.Taxes; | ||
| } | ||
| } | ||
|
|
||
| foreach (var pr in playerRelationships.Values) { | ||
| foreach (var mtd in pr.multiTurnDeals) { | ||
| if (mtd.dealSubType == DealSubType.GoldPerTurn) { | ||
| if (mtd.dealDetails == DealDetails.Inbound) result.fromOtherCivs += mtd.goldPerTurn; | ||
| else if (mtd.dealDetails == DealDetails.Outbound) result.toOtherCivs += mtd.goldPerTurn; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| result.unitSupport = TotalUnitsAllowedUnitsAndSupportCost().Item3; | ||
|
|
||
| if (interestBuildings > 0) result.interest = interestBuildings * Math.Min((int)(gold * rules.TreasuryInterestRate), rules.MaxInterest); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @esbudylin That's what cought my eye, and saw some similarities with the lua files |
||
|
|
||
| return result; | ||
| } | ||
|
|
||
| public int MaintenanceCosts() { | ||
| int result = 0; | ||
| foreach (City c in cities) { | ||
|
|
@@ -332,18 +416,9 @@ public int MaintenanceCosts() { | |
| return result; | ||
| } | ||
|
|
||
| // TODO: Add interest and GPT deals | ||
| public int CalculateGoldPerTurn() { | ||
| int result = 0; | ||
| foreach (City city in cities) { | ||
| result += city.CurrentCommerceYield().taxes; | ||
| result -= city.MaintenanceCosts(); | ||
| } | ||
|
|
||
| // Subtract unit support costs, if any. | ||
| var (_, _, unitSupportCost) = TotalUnitsAllowedUnitsAndSupportCost(); | ||
| result -= unitSupportCost; | ||
|
|
||
| return result; | ||
| return AggregateFlows().Netflows(); | ||
| } | ||
|
|
||
| public bool WouldAcceptDealFrom(GameData gameData, Player other, TradeOffer theirOffer, TradeOffer ourOffer) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.