Skip to content

Commit

Permalink
chore: kongo class sp attack can be used twice in one sortie
Browse files Browse the repository at this point in the history
  • Loading branch information
KochiyaOcean committed Mar 28, 2022
1 parent cb60df7 commit 160ee72
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions views/components/ship/index.es
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ const fleetShipViewDataSelectorFactory = memoize((fleetId) =>
[
fleetShipsIdSelectorFactory(fleetId),
fleetShipsDataWithEscapeSelectorFactory(fleetId),
(state) => get(state.sortie, 'spAttackUsed'),
(state) => get(state.sortie, 'spAttackCount'),
(state) => get(state.info, 'useitems.95.api_count'),
(state) => get(state.sortie, 'combinedFlag'),
],
(shipsId, shipsData, spAttackUsed, submarineSupplyCount, combinedFlag) => ({
(shipsId, shipsData, spAttackCount, submarineSupplyCount, combinedFlag) => ({
shipsId,
isSpAttack: isSpAttackAvailable(shipsData, {
spAttackUsed,
spAttackCount,
submarineSupplyCount,
combinedFlag,
fleetId,
Expand Down
6 changes: 3 additions & 3 deletions views/redux/sortie/index.es
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const initState = {
spotHistory: [],
item: null,
itemHistory: [],
spAttackUsed: false,
spAttackCount: 0,
}

const ensureArray = (x) => (isArray(x) ? x : [x])
Expand Down Expand Up @@ -67,7 +67,7 @@ export function reducer(state = initState, { type, path, postBody, body }) {
spotHistory: [],
item: null,
itemHistory: [],
spAttackUsed: false,
spAttackCount: 0,
}

case '@@Response/kcsapi/api_req_sortie/battleresult':
Expand Down Expand Up @@ -169,7 +169,7 @@ export function reducer(state = initState, { type, path, postBody, body }) {
) {
return {
...state,
spAttackUsed: true,
spAttackCount: state.spAttackCount + 1,
}
}
return state
Expand Down
12 changes: 6 additions & 6 deletions views/utils/sp_attack.es
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const overNotLessThan =
(...data) =>
funcs.map((func) => func(...data)).filter((result) => result).length >= n

const isSpAttackNotUsed = (shipsData, extraData) => !extraData.spAttackUsed
const isSpAttackLessThan = (count) => (shipsData, extraData) => extraData.spAttackCount < count

const hasSubmarineSupply = (shipsData, extraData) => extraData.submarineSupplyCount > 0

Expand Down Expand Up @@ -67,7 +67,7 @@ const isKirishimaKaiNi = shipIdIs(152)
const isWarspite = _.overSome([shipIdIs(364), shipIdIs(439)])

const isNelsonSpAttack = _.overEvery([
isSpAttackNotUsed,
isSpAttackLessThan(1),
isFullFleet,
overShip(0)(_.overEvery([isNelson, isNotMidDmg])),
overShip(1)(isNotSub),
Expand All @@ -78,7 +78,7 @@ const isNelsonSpAttack = _.overEvery([
])

const isNagatoSpAttack = _.overEvery([
isSpAttackNotUsed,
isSpAttackLessThan(1),
isFullFleet,
overShip(0)(_.overEvery([isNagatoKaiNi, isNotMidDmg])),
overShip(1)(_.overEvery([isBattleShip, isNotHeavyDmg])),
Expand All @@ -89,7 +89,7 @@ const isNagatoSpAttack = _.overEvery([
])

const isMutsuSpAttack = _.overEvery([
isSpAttackNotUsed,
isSpAttackLessThan(1),
isFullFleet,
overShip(0)(_.overEvery([isMutsuKaiNi, isNotMidDmg])),
overShip(1)(_.overEvery([isBattleShip, isNotHeavyDmg])),
Expand All @@ -100,7 +100,7 @@ const isMutsuSpAttack = _.overEvery([
])

const isColoradoSpAttack = _.overEvery([
isSpAttackNotUsed,
isSpAttackLessThan(1),
isFullFleet,
overShip(0)(_.overEvery([isColorado, isNotMidDmg])),
overShip(1)(_.overEvery([isBattleShip, isNotHeavyDmg])),
Expand All @@ -111,7 +111,7 @@ const isColoradoSpAttack = _.overEvery([
])

const isKongoClassKaiNiCSpAttack = _.overEvery([
isSpAttackNotUsed,
isSpAttackLessThan(2),
isFleetWith5NonSubs,
_.overSome([
_.overEvery([
Expand Down

0 comments on commit 160ee72

Please sign in to comment.