-
Notifications
You must be signed in to change notification settings - Fork 0
Make war reparations a vassal trade tariff #96
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -297,9 +297,6 @@ public double getIncome(Cashflow cashflow) { | |
| amount = getWarReparationsReceived(); | ||
| break; | ||
| case WAR_REPARATIONS_PAYMENT: | ||
| if (!guild.isBase()) { | ||
| return 0; | ||
| } | ||
| amount = -getWarReparationsPayment(); | ||
| break; | ||
| // No isBase() guard: the guild whose tables won declares it, and the capital picks its | ||
|
|
@@ -754,11 +751,8 @@ public double getTributeRecieved() { | |
| } | ||
|
|
||
| public double getWarReparationsPayment() { | ||
| if (!guild.isBase()) { | ||
| return 0.0; | ||
| } | ||
| Faction f = guild.getFaction(); | ||
| double base = getReparationsTaxableIncome(); | ||
| double base = getTradeGrossIncome(); | ||
| double paid = 0.0; | ||
| for (WarReparationsObligation obligation : WarReparationsService.activeObligations(f)) { | ||
| paid += base * (obligation.getIncomePercent() / 100.0); | ||
|
|
@@ -779,16 +773,25 @@ public double getWarReparationsReceived() { | |
| if (f == null || f.getId().equals(self.getId())) { | ||
| continue; | ||
| } | ||
| Guild payerGuild = f.getOrCreateMainGuild(); | ||
| if (payerGuild == null || payerGuild.getLedger() == null) { | ||
| if (f.getGuildHandler() == null) { | ||
| continue; | ||
| } | ||
| double base = payerGuild.getLedger().getReparationsTaxableIncome(); | ||
| for (WarReparationsObligation obligation : WarReparationsService.activeObligations(f)) { | ||
| if (!self.getId().equalsIgnoreCase(obligation.getPayeeFactionId())) { | ||
| continue; | ||
| } | ||
| total += base * (obligation.getIncomePercent() / 100.0); | ||
| for (Guild payerGuild : f.getGuildHandler().getGuilds()) { | ||
| if (payerGuild == null) { | ||
| continue; | ||
| } | ||
| Ledger payerLedger = payerGuild.getLedger(); | ||
| if (payerLedger == null || payerLedger.skipsMoneyMovement()) { | ||
| continue; | ||
| } | ||
| TradeBreakdown trade = payerGuild.getTradeBreakdown(); | ||
| double grossTradeIncome = trade == null ? 0.0 : trade.getIncome(); | ||
| total += grossTradeIncome * (obligation.getIncomePercent() / 100.0); | ||
|
Comment on lines
+791
to
+793
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. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Use the same non-negative trade base for receipts and payments. If 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
| } | ||
| return total; | ||
|
|
@@ -798,6 +801,11 @@ public double getWarReparationsReceived() { | |
| return getInternalTaxableIncome(); | ||
| } | ||
|
|
||
| private double getTradeGrossIncome() { | ||
| TradeBreakdown trade = guild.getTradeBreakdown(); | ||
| return trade == null ? 0.0 : Math.max(0.0, trade.getIncome()); | ||
| } | ||
|
|
||
| /** | ||
| * Positive gross-counted income excluding cross-faction transfers (tribute, | ||
| * war reparations, vassal guild rollups). Used as the base for tribute and | ||
|
|
@@ -1104,12 +1112,9 @@ private void applySettlementFor(Cashflow cf, DailyGuildTransfers buffer) { | |
| } | ||
|
|
||
| case WAR_REPARATIONS_PAYMENT: { | ||
| if (!guild.isBase()) { | ||
| return; | ||
| } | ||
| Faction f = guild.getFaction(); | ||
| if (f == null) return; | ||
| double base = getReparationsTaxableIncome(); | ||
| double base = getTradeGrossIncome(); | ||
| for (WarReparationsObligation obligation : WarReparationsService.activeObligations(f)) { | ||
| if (obligation == null) continue; | ||
| Faction receiverFaction = FactionManager.getByString(obligation.getPayeeFactionId()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.