From 53cf22e261a76530c98c922397f166d4c77ea203 Mon Sep 17 00:00:00 2001 From: fourinone41 Date: Fri, 28 Jun 2024 06:30:43 -0400 Subject: [PATCH] sortie sim: advanced setting override support fleet chance --- js/kcsim.js | 17 ++++++++++++++++- js/simulator-ui/convert.js | 7 ++++--- js/simulator-ui/ui-main.js | 4 ++++ simulator.html | 8 ++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/js/kcsim.js b/js/kcsim.js index 521adfb7..d82ff37c 100644 --- a/js/kcsim.js +++ b/js/kcsim.js @@ -269,6 +269,10 @@ var SIMCONSTS = { }, eqBonusAAModShip: .75, eqBonusAAModFleet: 1, + overrideSupportChanceDayN: null, + overrideSupportChanceDayB: null, + overrideSupportChanceNightN: null, + overrideSupportChanceNightB: null, } SIMCONSTS.vanguardEvShellDDMod = SIMCONSTS.vanguardEvShellDDModNormal.slice(); SIMCONSTS.vanguardEvTorpDDMod = SIMCONSTS.vanguardEvTorpDDModNormal.slice(); @@ -3471,7 +3475,18 @@ function sim(F1,F2,Fsupport,LBASwaves,doNB,NBonly,aironly,bombing,noammo,BAPI,no //support phase if (Fsupport && (!NBonly || (MECHANICS.LBASBuff && Fsupport.supportType != 1)) && !aironly && alive1.length+subsalive1.length > 0 && alive2.length+subsalive2.length > 0) { - var chance = Fsupport.supportChance(Fsupport.supportBoss); + var chance; + if (SIMCONSTS.overrideSupportChanceDayN != null && SIMCONSTS.overrideSupportChanceDayN !== '' && !NBonly && !Fsupport.supportBoss) { + chance = SIMCONSTS.overrideSupportChanceDayN/100; + } else if (SIMCONSTS.overrideSupportChanceDayB != null && SIMCONSTS.overrideSupportChanceDayB !== '' && !NBonly && Fsupport.supportBoss) { + chance = SIMCONSTS.overrideSupportChanceDayB/100; + } else if (SIMCONSTS.overrideSupportChanceNightN != null && SIMCONSTS.overrideSupportChanceNightN !== '' && NBonly && !Fsupport.supportBoss) { + chance = SIMCONSTS.overrideSupportChanceNightN/100; + } else if (SIMCONSTS.overrideSupportChanceNightB != null && SIMCONSTS.overrideSupportChanceNightB !== '' && NBonly && Fsupport.supportBoss) { + chance = SIMCONSTS.overrideSupportChanceNightB/100; + } else { + chance = Fsupport.supportChance(Fsupport.supportBoss); + } if (Math.random() < chance) { supportPhase(Fsupport.ships,alive2,subsalive2,Fsupport.supportType,BAPI,Fsupport.supportBoss); removeSunk(alive2); removeSunk(subsalive2); diff --git a/js/simulator-ui/convert.js b/js/simulator-ui/convert.js index f8fce531..23a50c29 100644 --- a/js/simulator-ui/convert.js +++ b/js/simulator-ui/convert.js @@ -944,8 +944,9 @@ window.CONVERT = { } if (found) settingsSave[key] = a; } else { - if (settingsUI[key] != SIMCONSTS.defaults[key]) { - settingsSave[key] = settingsUI[key]; + let v = settingsUI[key] === '' ? null : settingsUI[key]; + if (v != SIMCONSTS.defaults[key]) { + settingsSave[key] = v; } } } @@ -1059,7 +1060,7 @@ window.CONVERT = { loadSaveSettings(settingsSave,settingsUI) { for (let key in settingsSave) { if (key == 'mechanics') continue; - if (settingsUI[key] == null) continue; + if (settingsUI[key] === undefined) continue; if (Array.isArray(settingsUI[key])) { for (let i=0; iSettings [2]  +
+
Override Support Fleet Chance:
+ + + + +
Normal (Day):%
Normal (Night):%
Boss:%
+