Round CHOAM income after totaling eligible support
This commit is contained in:
1 parent
54787c7f7b
commit
dff0c77a5b
8 files changed
+161
-26
No files matched your search
@@ -670,16 +670,19 @@ function calculate(input: BattleResolutionInput): BattleResolutionQuote {
|
||||
}
|
||||
const choam = input.participants.find((p) => p.faction === 'choam');
|
||||
// Preserve existing source-backed income, including Stronghold bank support;
|
||||
// CHOAM's prepaid ally contribution is excluded from this receipt.
|
||||
// CHOAM's prepaid ally contribution is excluded from this receipt. The
|
||||
// adopted Advanced source rounds once after totaling the eligible support.
|
||||
const choamAmount =
|
||||
input.advanced && choam && !ac && !dc
|
||||
? [a, d].reduce(
|
||||
(sum, s) =>
|
||||
sum +
|
||||
(s.id === choam.id
|
||||
? 0
|
||||
: Math.floor((s.plan.support - (s.plan.allyPayment ?? 0)) / 2)),
|
||||
0,
|
||||
? Math.floor(
|
||||
[a, d].reduce(
|
||||
(sum, s) =>
|
||||
sum +
|
||||
(s.id === choam.id
|
||||
? 0
|
||||
: s.plan.support - (s.plan.allyPayment ?? 0)),
|
||||
0,
|
||||
) / 2,
|
||||
)
|
||||
: 0;
|
||||
const result =
|
||||
|
||||
Reference in new issue
Block a user