| 1385 | } |
| 1386 | |
| 1387 | bool BattleUnitMission::getNextFacing(GameState &state, BattleUnit &u, Vec2<int> &dest) |
| 1388 | { |
| 1389 | if (cancelled) |
| 1390 | { |
| 1391 | return false; |
| 1392 | } |
| 1393 | // If turning or changing body state then we cannot turn |
| 1394 | if (u.current_body_state != u.target_body_state) |
| 1395 | { |
| 1396 | return false; |
| 1397 | } |
| 1398 | // If we have not yet consumed queued up body change, we cannot turn |
| 1399 | // Unless we're throwing, in which case it's complicated |
| 1400 | if (u.current_body_state != targetBodyState) |
| 1401 | { |
| 1402 | if (this->type == Type::ThrowItem) |
| 1403 | { |
| 1404 | // If we are turning, our priority is: [STAND] -> [TURN] -> [THROW] |
| 1405 | // Therefore, if we're not standing, body takes priority, otherwise turning does |
| 1406 | if (u.current_body_state != BodyState::Standing) |
| 1407 | { |
| 1408 | return false; |
| 1409 | } |
| 1410 | } |
| 1411 | else |
| 1412 | { |
| 1413 | return false; |
| 1414 | } |
| 1415 | } |
| 1416 | switch (this->type) |
| 1417 | { |
| 1418 | case Type::Turn: |
| 1419 | case Type::ThrowItem: |
| 1420 | case Type::GotoLocation: |
| 1421 | case Type::ReachGoal: |
| 1422 | case Type::Jump: |
| 1423 | case Type::Brainsuck: |
| 1424 | if (state.current_battle->mode == Battle::Mode::TurnBased && |
| 1425 | ((!state.current_battle->interruptQueue.empty()) || |
| 1426 | (u.owner == state.current_battle->currentActiveOrganisation && |
| 1427 | !state.current_battle->interruptUnits.empty()) || |
| 1428 | (u.owner != state.current_battle->currentActiveOrganisation && |
| 1429 | state.current_battle->interruptUnits.find({&state, u.id}) == |
| 1430 | state.current_battle->interruptUnits.end()))) |
| 1431 | { |
| 1432 | u.addMission(state, BattleUnitMission::acquireTU(u, true)); |
| 1433 | return false; |
| 1434 | } |
| 1435 | return advanceFacing(state, u, dest); |
| 1436 | default: |
| 1437 | return false; |
| 1438 | } |
| 1439 | } |
| 1440 | |
| 1441 | bool BattleUnitMission::getNextBodyState(GameState &state, BattleUnit &u, BodyState &dest) |
| 1442 | { |
nothing calls this directly
no test coverage detected