|
|
|
@ -7,6 +7,7 @@ import {removeBall, updateComponent} from "./TacticContentDomains"
|
|
|
|
|
import {
|
|
|
|
|
areInSamePath,
|
|
|
|
|
changePlayerBallState,
|
|
|
|
|
getComponent,
|
|
|
|
|
getOrigin,
|
|
|
|
|
getPlayerNextTo,
|
|
|
|
|
isNextInPath,
|
|
|
|
@ -165,11 +166,9 @@ function alreadyHasAnAnteriorActionWith(
|
|
|
|
|
|
|
|
|
|
const targetIdx = targetOriginPath.indexOf(target.id)
|
|
|
|
|
for (let i = targetIdx; i < targetOriginPath.length; i++) {
|
|
|
|
|
const phantom = components.find(
|
|
|
|
|
(c) => c.id === targetOriginPath[i],
|
|
|
|
|
)! as PlayerLike
|
|
|
|
|
const component = getComponent(targetOriginPath[i], components)
|
|
|
|
|
if (
|
|
|
|
|
phantom.actions.find(
|
|
|
|
|
component.actions.find(
|
|
|
|
|
(a) =>
|
|
|
|
|
typeof a.target === "string" &&
|
|
|
|
|
moves(a.type) &&
|
|
|
|
@ -467,9 +466,7 @@ export function spreadNewStateFromOriginStateChange(
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const actionTarget = content.components.find(
|
|
|
|
|
(c) => action.target === c.id,
|
|
|
|
|
)! as PlayerLike
|
|
|
|
|
const actionTarget: PlayerLike = getComponent(action.target, content.components)
|
|
|
|
|
|
|
|
|
|
let targetState: BallState = actionTarget.ballState
|
|
|
|
|
let deleteAction = false
|
|
|
|
@ -499,13 +496,16 @@ export function spreadNewStateFromOriginStateChange(
|
|
|
|
|
action.type === ActionKind.SCREEN
|
|
|
|
|
) {
|
|
|
|
|
targetState = BallState.HOLDS_BY_PASS
|
|
|
|
|
const screenPhantom = getPlayerNextTo(origin, 1, content.components)!
|
|
|
|
|
if (screenPhantom.type === "phantom" && screenPhantom.pos.type === "follows") {
|
|
|
|
|
content = removePlayer(screenPhantom, content)
|
|
|
|
|
origin = getComponent(origin.id, content.components)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (deleteAction) {
|
|
|
|
|
content = removeAction(origin, i, content)
|
|
|
|
|
origin = content.components.find((c) => c.id === origin.id)! as
|
|
|
|
|
| Player
|
|
|
|
|
| PlayerPhantom
|
|
|
|
|
origin = getComponent(origin.id, content.components)
|
|
|
|
|
i-- // step back
|
|
|
|
|
} else {
|
|
|
|
|
// do not change the action type if it is a shoot action
|
|
|
|
|