Fix hit boolean for torpedos
This commit is contained in:
parent
2991dc19f2
commit
8b179b5e65
1 changed files with 7 additions and 7 deletions
|
@ -225,20 +225,20 @@ export function intersectingShip(
|
|||
|
||||
export function compiledHits(i: 0 | 1) {
|
||||
return (
|
||||
users[i]?.moves.reduce((hits, move) => {
|
||||
const list = targetList(move, move.type)
|
||||
return move.type === MoveType.Enum.radar
|
||||
users[i]?.moves.reduce((hits, { orientation, type, ...move }) => {
|
||||
const list = targetList(move, type)
|
||||
return type === MoveType.Enum.radar
|
||||
? hits
|
||||
: [
|
||||
...hits,
|
||||
...list.map(({ x, y }) => ({
|
||||
...list.map((pos) => ({
|
||||
hit: !!intersectingShip(users[i === 0 ? 1 : 0]?.ships ?? [], {
|
||||
...move,
|
||||
...pos,
|
||||
orientation,
|
||||
size: 1,
|
||||
variant: 0,
|
||||
}).fields.length,
|
||||
x,
|
||||
y,
|
||||
...pos,
|
||||
})),
|
||||
]
|
||||
}, [] as Hit[]) ?? []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue