From 6d768527ca63e6c92e9d671e98e8963472068ec4 Mon Sep 17 00:00:00 2001 From: HetmesAskalana <60427521+HetmesAskalana@users.noreply.github.com> Date: Thu, 20 Aug 2026 04:19:10 +0800 Subject: [PATCH] feat: add enemy escort night battle engagement check --- assets/i18n/en-US.json | 1 + assets/i18n/ja-JP.json | 1 + assets/i18n/ko-KR.json | 1 + assets/i18n/zh-CN.json | 1 + assets/i18n/zh-TW.json | 1 + src/game-handler.ts | 5 ++++- src/index.tsx | 2 ++ src/redux.ts | 1 + src/types.ts | 1 + src/utils/lib-battle-adapter.ts | 7 ++++++- src/views/battle-info.tsx | 3 +++ src/views/battle-view-area.tsx | 17 +++++++++++++++++ 12 files changed, 39 insertions(+), 2 deletions(-) diff --git a/assets/i18n/en-US.json b/assets/i18n/en-US.json index 1f69ee6..474f0f9 100644 --- a/assets/i18n/en-US.json +++ b/assets/i18n/en-US.json @@ -47,6 +47,7 @@ "Next Spot": "Next Spot", "last_chosen": "Last chosen: ", "smoke": "Smoke screen activated", + "escortNightInfo": "Night battle may target the Escort Fleet", "A_rank": "A rank", "Transport Point": "Transport Point (TP)", "Tank Transport Point": "Tank Transport Point (TP)", diff --git a/assets/i18n/ja-JP.json b/assets/i18n/ja-JP.json index 85429cf..952b62e 100644 --- a/assets/i18n/ja-JP.json +++ b/assets/i18n/ja-JP.json @@ -69,6 +69,7 @@ "Ship parameters include equipment bonus": "装備込みのステータスを表示する", "last_chosen": "前の選択:", "smoke": "煙幕発動", + "escortNightInfo": "随伴艦隊と夜戦の可能性あり", "Carrier Task Force": "空母機動部隊", "Surface Task Force": "水上打撃部隊", "Transport Escort": "輸送護衛部隊", diff --git a/assets/i18n/ko-KR.json b/assets/i18n/ko-KR.json index e2b7d1d..e7c8d6d 100644 --- a/assets/i18n/ko-KR.json +++ b/assets/i18n/ko-KR.json @@ -48,6 +48,7 @@ "Not in sortie": "출격중이 아닙니다", "last_chosen": "Last chosen: ", "smoke": "Smoke screen activated", + "escortNightInfo": "야간전 시 호위 함대와 교전할 가능성이 있음", "A_rank": "A rank", "Transport Point": "Transport Point (TP)", "Tank Transport Point": "Tank Transport Point (TP)" diff --git a/assets/i18n/zh-CN.json b/assets/i18n/zh-CN.json index a936b69..85cf85f 100644 --- a/assets/i18n/zh-CN.json +++ b/assets/i18n/zh-CN.json @@ -69,6 +69,7 @@ "Ship parameters include equipment bonus": "舰娘属性包含装备加成", "last_chosen": "上次选择:", "smoke": "烟幕发动", + "escortNightInfo": "夜战可能与随伴舰队交战", "Carrier Task Force": "空母机动部队", "Surface Task Force": "水上打击部队", "Transport Escort": "输送护卫部队", diff --git a/assets/i18n/zh-TW.json b/assets/i18n/zh-TW.json index b0f3ec4..765cd3d 100644 --- a/assets/i18n/zh-TW.json +++ b/assets/i18n/zh-TW.json @@ -69,6 +69,7 @@ "Ship parameters include equipment bonus": "艦娘屬性包含裝備加成", "last_chosen": "上次選擇:", "smoke": "煙幕發動", + "escortNightInfo": "夜戰可能與隨伴艦隊交戰", "Carrier Task Force": "空母機動部隊", "Surface Task Force": "水上打擊部隊", "Transport Escort": "輸送護衛部隊", diff --git a/src/game-handler.ts b/src/game-handler.ts index 14fc6a4..5581321 100644 --- a/src/game-handler.ts +++ b/src/game-handler.ts @@ -130,6 +130,7 @@ const handleGameResponse = (e: Event): void => { result, battleForm, eFormation, + hasEnteredNightBattle, } = battleState isBaseDefense = false let updateFleetStateFromLibBattle = !!battleRef @@ -146,6 +147,7 @@ const handleGameResponse = (e: Event): void => { eventKind, result, airForce, + hasEnteredNightBattle, } = initBattleState) updateFleetStateFromLibBattle = false break @@ -167,7 +169,7 @@ const handleGameResponse = (e: Event): void => { eventId = api_event_id === undefined ? eventId : api_event_id eventKind = api_event_kind === undefined ? eventKind : api_event_kind mapAreaId = api_maparea_id === undefined ? mapAreaId : api_maparea_id - ;({ enemyFleet, enemyEscort, landBase, airForce } = initBattleState) + ;({ enemyFleet, enemyEscort, landBase, airForce, hasEnteredNightBattle } = initBattleState) if (_showAirRaid && api_destruction_battle != null) { const destructionBattleArray = Array.isArray(api_destruction_battle) @@ -349,6 +351,7 @@ const handleGameResponse = (e: Event): void => { result, battleForm, eFormation, + hasEnteredNightBattle, ...newState, }), ) diff --git a/src/index.tsx b/src/index.tsx index ce51464..31d2e3b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -48,6 +48,7 @@ export const Prophet: FC = () => { airControl, isBaseDefense, isHeavyBomberDefense, + hasEnteredNightBattle, sortieState, eventId, eventKind, @@ -71,6 +72,7 @@ export const Prophet: FC = () => { airControl={airControl} isBaseDefense={isBaseDefense} isHeavyBomberDefense={isHeavyBomberDefense} + hasEnteredNightBattle={hasEnteredNightBattle} sortieState={sortieState} eventId={eventId} eventKind={eventKind} diff --git a/src/redux.ts b/src/redux.ts index 31d4765..ab4325a 100644 --- a/src/redux.ts +++ b/src/redux.ts @@ -129,6 +129,7 @@ export const initBattleState: BattleDisplayState = { airControl: '', isBaseDefense: false, isHeavyBomberDefense: false, + hasEnteredNightBattle: false, sortieState: SortieState.InPort, mapAreaId: 0, eventId: 0, diff --git a/src/types.ts b/src/types.ts index 4ecf222..22388e8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -34,6 +34,7 @@ export interface BattleDisplayState { airControl: string isBaseDefense: boolean isHeavyBomberDefense: boolean + hasEnteredNightBattle: boolean sortieState: SortieStateValue mapAreaId: number eventId: number diff --git a/src/utils/lib-battle-adapter.ts b/src/utils/lib-battle-adapter.ts index dec07ff..c45d888 100644 --- a/src/utils/lib-battle-adapter.ts +++ b/src/utils/lib-battle-adapter.ts @@ -245,6 +245,7 @@ export const synthesizeInfo = ( eFormation: Formation | '' fFormation: Formation | '' smokeType: number + hasEnteredNightBattle: boolean result: Result } => { let mainFleet = _simulator.mainFleet @@ -273,10 +274,11 @@ export const synthesizeInfo = ( let fLost = 0 let eResidule = 0 let eLost = 0 + let hasEnteredNightBattle = false _.each(stages, (stage: Stage | null) => { if (stage == null) return - const { engagement, aerial, type } = stage + const { engagement, aerial, type, subtype } = stage if (engagement && type === StageType.Engagement) { battleForm = engagement.engagement ?? '' @@ -285,6 +287,8 @@ export const synthesizeInfo = ( smokeType = engagement.smokeType ?? 0 } + if (subtype === StageType.Night) hasEnteredNightBattle = true + if (aerial && type === StageType.Aerial) { const { fPlaneInit, fPlaneNow, ePlaneInit, ePlaneNow, control } = aerial fResidule = fPlaneNow ?? 0 @@ -324,6 +328,7 @@ export const synthesizeInfo = ( eFormation, fFormation, smokeType, + hasEnteredNightBattle, result, } } diff --git a/src/views/battle-info.tsx b/src/views/battle-info.tsx index ed4ca93..cc8c39f 100644 --- a/src/views/battle-info.tsx +++ b/src/views/battle-info.tsx @@ -42,6 +42,7 @@ interface BattleInfoProps { battleForm?: string airControl?: string smokeType?: number + escortNight?: boolean } const BattleInfo: FC = ({ @@ -50,6 +51,7 @@ const BattleInfo: FC = ({ battleForm = '', airControl = '', smokeType = 0, + escortNight = false, }) => { const { t } = useTranslation('poi-plugin-prophet') return ( @@ -71,6 +73,7 @@ const BattleInfo: FC = ({ _t(battleForm), _t(airControl), ...(smokeType ? [`${t('smoke')}: ${smokeType}`] : []), + ...(escortNight ? [t('escortNightInfo')] : []), ]).map((text) => (
{text}
))} diff --git a/src/views/battle-view-area.tsx b/src/views/battle-view-area.tsx index 1467021..4af305b 100644 --- a/src/views/battle-view-area.tsx +++ b/src/views/battle-view-area.tsx @@ -162,6 +162,7 @@ interface BattleViewAreaProps { airControl?: string isBaseDefense?: boolean isHeavyBomberDefense?: boolean + hasEnteredNightBattle: boolean sortieState?: SortieStateValue eventId?: number eventKind?: number @@ -184,6 +185,7 @@ const BattleViewArea: FC = ({ airControl = '', isBaseDefense, isHeavyBomberDefense, + hasEnteredNightBattle = false, sortieState = SortieState.InPort, eventId = 0, eventKind = 0, @@ -307,6 +309,18 @@ const BattleViewArea: FC = ({