Skip to content

Commit

Permalink
feat: update oasw rules
Browse files Browse the repository at this point in the history
  • Loading branch information
KochiyaOcean committed Sep 22, 2024
1 parent 0c40e6c commit 0012800
Showing 1 changed file with 67 additions and 7 deletions.
74 changes: 67 additions & 7 deletions views/utils/oasw.es
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const shipIdIs = (n) => (ship) => ship.api_ship_id === n
const hasSome = (pred) => (xs) => xs.some(pred)
const hasMoreThan = (num) => (pred) => (xs) => xs.filter(pred).length >= num

const isDepthCharge = iconIs(17)
const isSonar = iconIs(18)

const isDiveBomber = (equip) => equip.api_type[2] === 7
const isTorpedoBomber = (equip) => equip.api_type[2] === 8
const isLargeSonar = (equip) => equip.api_type[2] === 40
const taisenAbove = (value) => (ship) => ship.api_taisen[0] >= value

const isDE = (ship) => ship.api_stype === 1
Expand All @@ -19,6 +19,7 @@ const isJClassKai = _.overSome([shipIdIs(394), shipIdIs(893), shipIdIs(906)])
const isTatsutaKai = shipIdIs(478)
const isSamuelKai = shipIdIs(681)
const isSamuelKaiNi = shipIdIs(920)
const isFusoClassKaiNi = _.overSome([shipIdIs(411), shipIdIs(412)])
const isFletcherClassOrKai = _.overSome([
shipIdIs(562), // Johnston
shipIdIs(689), // Johnston Kai
Expand All @@ -31,6 +32,7 @@ const isFletcherClassOrKai = _.overSome([

const isTaiyouClassKai = _.overSome([shipIdIs(380), shipIdIs(381)])
const isTaiyouClassKaiNi = _.overSome([shipIdIs(529), shipIdIs(536)])
const isMogamiClassKouKaiNi = _.overSome([shipIdIs(508), shipIdIs(509)])

const isHyugaKaiNi = shipIdIs(554)

Expand All @@ -40,6 +42,10 @@ const isKagaKaiNiGo = shipIdIs(646)

const isShinShuMaruKai = shipIdIs(626)

const isYamatoKaiNiJuu = shipIdIs(916)

const isKumanomaru = _.overSome([shipIdIs(943), shipIdIs(948)])

const isFixedWingASWAircraft = (equip) =>
// 対潜哨戒機 (e.g. 三式指揮連絡機(対潜))
equip.api_type[2] === 26
Expand Down Expand Up @@ -125,8 +131,8 @@ export const isOASWWith = (allCVEIds) =>
_.overSome(
// 対潜値1以上の艦攻
_.overEvery(isTorpedoBomber, equipTaisAbove(1)),
// 艦爆
isDiveBomber,
// 対潜値1以上の艦爆
_.overEvery(isDiveBomber, equipTaisAbove(1)),
// 三式指揮連絡機(対潜) / カ号観測機
isASWAircraft,
),
Expand All @@ -135,7 +141,11 @@ export const isOASWWith = (allCVEIds) =>
),
// 護衛空母 (excluding 大鷹改 大鷹改二)
_.overEvery(
(s) => !isTaiyouClassKai(s) && !isTaiyouClassKaiNi(s) && allCVEIds.includes(s.api_ship_id),
(s) =>
!isTaiyouClassKai(s) &&
!isTaiyouClassKaiNi(s) &&
!isMogamiClassKouKaiNi(s) &&
allCVEIds.includes(s.api_ship_id),
_.overSome(
_.overEvery(
taisenAbove(65),
Expand All @@ -152,7 +162,7 @@ export const isOASWWith = (allCVEIds) =>
),
_.overEvery(
taisenAbove(50),
overEquips(hasSome(isLargeSonar)),
overEquips(hasSome(isSonar)),
overEquips(
hasSome(
_.overSome(
Expand All @@ -164,6 +174,20 @@ export const isOASWWith = (allCVEIds) =>
),
),
),
_.overEvery(
taisenAbove(100),
overEquips(hasSome(isSonar)),
overEquips(
hasSome(
_.overSome(
// 対潜値1以上の艦攻
_.overEvery(isTorpedoBomber, equipTaisAbove(1)),
// 対潜値1以上の艦爆
_.overEvery(isDiveBomber, equipTaisAbove(1)),
),
),
),
),
),
),
// 日向改二
Expand All @@ -176,9 +200,9 @@ export const isOASWWith = (allCVEIds) =>
overEquips(hasMoreThan(2)(isAutogyro)),
),
),
// 神州丸改
// 神州丸改 大和改二重
_.overEvery(
isShinShuMaruKai,
_.overSome(isShinShuMaruKai, isYamatoKaiNiJuu),
taisenAbove(100),
overEquips(
hasSome(
Expand All @@ -192,4 +216,40 @@ export const isOASWWith = (allCVEIds) =>
),
overEquips(hasSome(isSonar)),
),
// 熊野丸/改
_.overEvery(
_.overSome(isKumanomaru),
taisenAbove(100),
overEquips(hasSome(isSonar)),
overEquips(
hasSome(
_.overSome(
// 対潜値1以上の艦爆
_.overEvery(isDiveBomber, equipTaisAbove(1)),
// オートジャイロ機
isAutogyro,
// 対潜哨戒機
isFixedWingASWAircraft,
),
),
),
),
// 扶桑改二 山城改二
_.overEvery(
_.overSome(isFusoClassKaiNi),
taisenAbove(100),
overEquips(hasSome(isSonar)),
overEquips(
hasSome(
_.overSome(
// 水上爆撃機
isSeaplaneBomber,
// オートジャイロ機
isAutogyro,
// 爆雷投射機/爆雷
isDepthCharge,
),
),
),
),
)

0 comments on commit 0012800

Please sign in to comment.