diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-26 11:36:35 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-26 11:36:35 +0300 |
| commit | f707bc6179521d316a93dde9beca2668115ad6cd (patch) | |
| tree | 125422ef403850a1d65527885d7755398413846c /crates/fparkan-runtime/src/clan_combat_strength.rs | |
| parent | dfbdef7d4d1d295ee962dd8aab754ce6be902f8d (diff) | |
| download | fparkan-f707bc6179521d316a93dde9beca2668115ad6cd.tar.xz fparkan-f707bc6179521d316a93dde9beca2668115ad6cd.zip | |
fix(factory): rank researched combat designs for clan orders
Use the clan technology table to qualify candidates for SELECT_STRONGEST, then compare their projected Control endurance and weapon banks. The stock Two Fortresses factory releases 12spd1.dat in about ten seconds. Checked the selector with the original DLL, the first release and reservation in licensed tests, and the new model in the game window.
Diffstat (limited to 'crates/fparkan-runtime/src/clan_combat_strength.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/clan_combat_strength.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/crates/fparkan-runtime/src/clan_combat_strength.rs b/crates/fparkan-runtime/src/clan_combat_strength.rs index 2ad01692..0dcbd7e2 100644 --- a/crates/fparkan-runtime/src/clan_combat_strength.rs +++ b/crates/fparkan-runtime/src/clan_combat_strength.rs @@ -1,6 +1,7 @@ use crate::{ - control_device_provider_value_from_status, MissionControlDeviceTableState, - MissionControlDeviceTableStatus, ObjectHandle, + control_device_provider_value_from_status, EffectiveControlDevice, + MissionControlDeviceTableState, MissionControlDeviceTableStatus, + MissionControlNodeProviderTableStatus, ObjectHandle, }; pub(super) fn unit_strength( @@ -14,6 +15,15 @@ pub(super) fn unit_strength( let MissionControlDeviceTableStatus::Available(devices) = &table.status else { return rating(capacity, 0.0); }; + // shortcut: assume full design ammunition and use the live Control amount + // until selector 0x36 scaling and live weapon counters are wired. + rating(capacity, weapon_power(devices, &table.node_provider_status)) +} + +pub(super) fn weapon_power( + devices: &[EffectiveControlDevice], + providers: &MissionControlNodeProviderTableStatus, +) -> f32 { let mut grouped = false; let mut weapon_power = 0.0; for device in devices { @@ -25,7 +35,7 @@ pub(super) fn unit_strength( else { continue; }; - if control_device_provider_value_from_status(&table.node_provider_status, device) + if control_device_provider_value_from_status(providers, device) .is_ok_and(|health| health == 0.0) { continue; @@ -39,12 +49,10 @@ pub(super) fn unit_strength( _ => {} } } - // shortcut: assume full design ammunition and use the live Control amount - // until selector 0x36 scaling and live weapon counters are wired. - rating(capacity, weapon_power) + weapon_power } -fn rating(capacity: f32, weapon_power: f32) -> f32 { +pub(super) fn rating(capacity: f32, weapon_power: f32) -> f32 { ((weapon_power + 0.8_f32) * capacity) * 0.00001_f32 } |
