Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
1 change: 1 addition & 0 deletions assets/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"Ship parameters include equipment bonus": "装備込みのステータスを表示する",
"last_chosen": "前の選択:",
"smoke": "煙幕発動",
"escortNightInfo": "随伴艦隊と夜戦の可能性あり",
"Carrier Task Force": "空母機動部隊",
"Surface Task Force": "水上打撃部隊",
"Transport Escort": "輸送護衛部隊",
Expand Down
1 change: 1 addition & 0 deletions assets/i18n/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
1 change: 1 addition & 0 deletions assets/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"Ship parameters include equipment bonus": "舰娘属性包含装备加成",
"last_chosen": "上次选择:",
"smoke": "烟幕发动",
"escortNightInfo": "夜战可能与随伴舰队交战",
"Carrier Task Force": "空母机动部队",
"Surface Task Force": "水上打击部队",
"Transport Escort": "输送护卫部队",
Expand Down
1 change: 1 addition & 0 deletions assets/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"Ship parameters include equipment bonus": "艦娘屬性包含裝備加成",
"last_chosen": "上次選擇:",
"smoke": "煙幕發動",
"escortNightInfo": "夜戰可能與隨伴艦隊交戰",
"Carrier Task Force": "空母機動部隊",
"Surface Task Force": "水上打擊部隊",
"Transport Escort": "輸送護衛部隊",
Expand Down
5 changes: 4 additions & 1 deletion src/game-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const handleGameResponse = (e: Event): void => {
result,
battleForm,
eFormation,
hasEnteredNightBattle,
} = battleState
isBaseDefense = false
let updateFleetStateFromLibBattle = !!battleRef
Expand All @@ -146,6 +147,7 @@ const handleGameResponse = (e: Event): void => {
eventKind,
result,
airForce,
hasEnteredNightBattle,
} = initBattleState)
updateFleetStateFromLibBattle = false
break
Expand All @@ -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)
Expand Down Expand Up @@ -349,6 +351,7 @@ const handleGameResponse = (e: Event): void => {
result,
battleForm,
eFormation,
hasEnteredNightBattle,
...newState,
}),
)
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const Prophet: FC = () => {
airControl,
isBaseDefense,
isHeavyBomberDefense,
hasEnteredNightBattle,
sortieState,
eventId,
eventKind,
Expand All @@ -71,6 +72,7 @@ export const Prophet: FC = () => {
airControl={airControl}
isBaseDefense={isBaseDefense}
isHeavyBomberDefense={isHeavyBomberDefense}
hasEnteredNightBattle={hasEnteredNightBattle}
sortieState={sortieState}
eventId={eventId}
eventKind={eventKind}
Expand Down
1 change: 1 addition & 0 deletions src/redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const initBattleState: BattleDisplayState = {
airControl: '',
isBaseDefense: false,
isHeavyBomberDefense: false,
hasEnteredNightBattle: false,
sortieState: SortieState.InPort,
mapAreaId: 0,
eventId: 0,
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface BattleDisplayState {
airControl: string
isBaseDefense: boolean
isHeavyBomberDefense: boolean
hasEnteredNightBattle: boolean
sortieState: SortieStateValue
mapAreaId: number
eventId: number
Expand Down
7 changes: 6 additions & 1 deletion src/utils/lib-battle-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export const synthesizeInfo = (
eFormation: Formation | ''
fFormation: Formation | ''
smokeType: number
hasEnteredNightBattle: boolean
result: Result
} => {
let mainFleet = _simulator.mainFleet
Expand Down Expand Up @@ -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 ?? ''
Expand All @@ -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
Expand Down Expand Up @@ -324,6 +328,7 @@ export const synthesizeInfo = (
eFormation,
fFormation,
smokeType,
hasEnteredNightBattle,
result,
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/views/battle-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface BattleInfoProps {
battleForm?: string
airControl?: string
smokeType?: number
escortNight?: boolean
}

const BattleInfo: FC<BattleInfoProps> = ({
Expand All @@ -50,6 +51,7 @@ const BattleInfo: FC<BattleInfoProps> = ({
battleForm = '',
airControl = '',
smokeType = 0,
escortNight = false,
}) => {
const { t } = useTranslation('poi-plugin-prophet')
return (
Expand All @@ -71,6 +73,7 @@ const BattleInfo: FC<BattleInfoProps> = ({
_t(battleForm),
_t(airControl),
...(smokeType ? [`${t('smoke')}: ${smokeType}`] : []),
...(escortNight ? [t('escortNightInfo')] : []),
]).map((text) => (
<div key={text}>{text}</div>
))}
Expand Down
17 changes: 17 additions & 0 deletions src/views/battle-view-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ interface BattleViewAreaProps {
airControl?: string
isBaseDefense?: boolean
isHeavyBomberDefense?: boolean
hasEnteredNightBattle: boolean
Comment thread
KochiyaOcean marked this conversation as resolved.
sortieState?: SortieStateValue
eventId?: number
eventKind?: number
Expand All @@ -184,6 +185,7 @@ const BattleViewArea: FC<BattleViewAreaProps> = ({
airControl = '',
isBaseDefense,
isHeavyBomberDefense,
hasEnteredNightBattle = false,
sortieState = SortieState.InPort,
eventId = 0,
eventKind = 0,
Expand Down Expand Up @@ -307,6 +309,18 @@ const BattleViewArea: FC<BattleViewAreaProps> = ({
<noscript />
)

const checkEnemyNightEngagementFleet = (enemyEscort: (Ship | null)[]): boolean => {
let v = 0
for (const [idx, ship] of enemyEscort.entries()) {
if (!ship || ship.maxHP <= 0 || ship.nowHP <= 0 || ship.hpUnknown) continue

v +=
(ship.nowHP * 4 <= ship.maxHP ? 0 : ship.nowHP * 2 <= ship.maxHP ? 7 : 10) +
(idx === 0 ? 10 : 0)
}
return v >= 30
}

const combatInfo = (
<ProphetInfo>
<CombatTitle>
Expand Down Expand Up @@ -367,6 +381,9 @@ const BattleViewArea: FC<BattleViewAreaProps> = ({
battleForm={battleForm}
airControl={airControl}
smokeType={smokeType}
escortNight={
Comment thread
KochiyaOcean marked this conversation as resolved.
!hasEnteredNightBattle && checkEnemyNightEngagementFleet(enemyEscort)
}
/>
)

Expand Down