From 0ff59a473d95918b5f5b223f2fa9719f1112f63e Mon Sep 17 00:00:00 2001
From: fourinone41 <pz200411@gmail.com>
Date: Sun, 17 Nov 2024 06:21:15 -0500
Subject: [PATCH] sim: update liaison mechanics

---
 js/kcEQDATA.js | 1 +
 js/kcsim.js    | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/js/kcEQDATA.js b/js/kcEQDATA.js
index 9be53063..00642a52 100644
--- a/js/kcEQDATA.js
+++ b/js/kcEQDATA.js
@@ -8164,6 +8164,7 @@ var LBASDATA = {
 	544: { distance: 4, cost: 5 },
 	545: { distance: 6, cost: 8 },
 	546: { distance: 2, cost: 9 },
+	549: { distance: 3, cost: 5 },
 };
 
 
diff --git a/js/kcsim.js b/js/kcsim.js
index a184a22a..028d8064 100644
--- a/js/kcsim.js
+++ b/js/kcsim.js
@@ -2268,6 +2268,11 @@ function AADefenceFighters(carriers,showplanes,APIkouku,eqtFilter) {
 					}
 					var randplus = Math.floor((Math.floor(1000*rplus)+1)*Math.random())/1000;
 					let modJet = ship.equips[j].isjet ? .6 : 1;
+					if (eqtFilter == 'isfighter' && [AUTOGYRO,ASWPLANE].includes(ship.equips[j].type) && !ship.equips[j].is20th) { //estimate
+						if (ship.airState() == -2) modJet = .9;
+						else if (ship.airState() == -1) modJet = .5;
+						else modJet = .3;
+					}
 					lostcount = Math.floor(ship.planecount[j]*(rmin+randplus)*modJet);
 				} else {
 					var rmax;
@@ -2962,9 +2967,9 @@ function LBASPhase(lbas,alive2,subsalive2,isjetphase,APIkouku) {
 		var eq = lbas.equips[i];
 		if (!eq.isPlane) continue;
 		let isASWPlane = MECHANICS.LBASBuff && eq.ASW >= 7;
-		let isSurfacePlane = (eq.isdivebomber || eq.istorpbomber) && (eq.is20th || (eq.type != ASWPLANE && eq.type != AUTOGYRO));
+		let isSurfacePlane = (eq.isdivebomber || eq.istorpbomber) && (eq.DIVEBOMB || (eq.type != ASWPLANE && eq.type != AUTOGYRO));
 		if (!isSurfacePlane && !isASWPlane) continue;
-		if (defenders.length && isSurfacePlane) {
+		if (defenders.length && (eq.isdivebomber || eq.istorpbomber)) {
 			var defender = defenders[Math.floor(Math.random()*defenders.length)];
 			var supportMod = 1;
 			var shotProp = (Math.random() < .5)? Math.floor(getAAShotProp(defender,lbas.planecount[i],eq.aaResistShip)*supportMod) : 0;