fix(research): bank redirected battle RP in the destination branch
With "Research of helicopters by playing ground vehicles" on, the stock text says ground vehicles are not researched and all their vehicle RP goes to helicopters (lang shop/research_helicopters_by_ground_vehicles_tooltip). Settlement fell back to the ground branch whenever the helicopter branch had no current research target; now the RP stays in the destination branch (banked there until the player picks the next helicopter) and returns to the vehicle's own branch only when the destination has nothing left to research. The redirection moves from the profile helper into the RP investment, which has the tech tree. Checked: typecheck.
This commit is contained in:
1 parent
9ed92c33d4
commit
747c4d4594
2 files changed
+18
-19
No files matched your search
@@ -13,13 +13,13 @@
|
||||
* (ES_UNIT_TYPE_INVALID), exposed to Squirrel by getDestinationRPUnitType (0x15532f0).
|
||||
* - Writer (0x9307eb..0x93082a): writes "destTypeRP<SrcType>" only when 0 <= destType <= 6
|
||||
* and omits the parameter when disabled (-1).
|
||||
* Battle settlement applies it in battle/battle-rp-investment.ts.
|
||||
*/
|
||||
import { ensureBlock, findBlock, type BlkBlock } from '@wto/blk';
|
||||
import { ACCEPTED, refused, type RuleOutcome } from '../research/rule-outcome.ts';
|
||||
import type { TechTree } from '../research/tech-tree.ts';
|
||||
import { VEHICLE_TYPES, vehicleTypeById, type VehicleType } from '../research/vehicle-types.ts';
|
||||
import { removeParam, stringField } from './blk-fields.ts';
|
||||
import { researchTarget } from './profile-research-targets.ts';
|
||||
|
||||
const RESEARCH_UNITS = 'researchUnits';
|
||||
const DEST_TYPE_PREFIX = 'destTypeRP';
|
||||
@@ -79,18 +79,3 @@ export function applySetDestinationRpRule(
|
||||
setDestinationRpDomain(profile, country, sourceDomain, destinationDomain);
|
||||
return ACCEPTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the effective research branch for battle settlement: returns the redirected domain
|
||||
* (such as 'Helicopter' when playing 'Tank') when configured and that branch still has an
|
||||
* active currUnit research target, otherwise falls back to sourceDomain.
|
||||
*/
|
||||
export function readRedirectedResearchDomain(
|
||||
profile: BlkBlock,
|
||||
country: string,
|
||||
sourceDomain: VehicleDomain,
|
||||
): VehicleDomain {
|
||||
const redirected = destinationRpDomain(profile, country, sourceDomain);
|
||||
if (!redirected) return sourceDomain;
|
||||
return researchTarget(profile, country, redirected) !== '' ? redirected : sourceDomain;
|
||||
}
|
||||
Reference in new issue
Block a user