| 1296 | } |
| 1297 | |
| 1298 | bool BattleUnit::spendTU(GameState &state, int cost, bool ignoreKneelReserve, |
| 1299 | bool ignoreShootReserve, bool allowInterrupt) |
| 1300 | { |
| 1301 | if (state.current_battle->mode == Battle::Mode::RealTime || !isConscious() || cost == 0) |
| 1302 | { |
| 1303 | return true; |
| 1304 | } |
| 1305 | if (!canAfford(state, cost, ignoreKneelReserve, ignoreShootReserve)) |
| 1306 | { |
| 1307 | return false; |
| 1308 | } |
| 1309 | agent->modified_stats.time_units -= cost; |
| 1310 | state.current_battle->notifyAction(position, {&state, id}); |
| 1311 | // If doing any action other than moving that triggers reaction, we give interrupt chance here |
| 1312 | // If moving we do not give it here, and instead give interrupt chance when changing tiles |
| 1313 | if (allowInterrupt) |
| 1314 | { |
| 1315 | state.current_battle->giveInterruptChanceToUnits(state, {&state, id}, |
| 1316 | agent->getReactionValue()); |
| 1317 | } |
| 1318 | return true; |
| 1319 | } |
| 1320 | |
| 1321 | void BattleUnit::spendRemainingTU(GameState &state, bool allowInterrupt) |
| 1322 | { |
no test coverage detected