MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / updateTB

Method updateTB

game/state/battle/battleunit.cpp:2024–2052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2022}
2023
2024void BattleUnit::updateTB(GameState &state)
2025{
2026 // Destroyed or retreated units do not exist in the battlescape
2027 if (destroyed || retreated)
2028 {
2029 return;
2030 }
2031
2032 // Update Items
2033 bool updatedShield = false;
2034 for (auto &item : agent->equipment)
2035 {
2036 if (item->type->type == AEquipmentType::Type::DisruptorShield &&
2037 item->ammo < item->getPayloadType()->max_ammo)
2038 {
2039 if (updatedShield)
2040 {
2041 continue;
2042 }
2043 updatedShield = true;
2044 }
2045 item->updateTB(state);
2046 }
2047
2048 // Miscellaneous state updates, as well as unit's stats
2049 updateCloak(state, TICKS_PER_TURN);
2050 updateStateAndStats(state, TICKS_PER_TURN);
2051 updateRegen(state, TICKS_REGEN_PER_TURN);
2052}
2053
2054void BattleUnit::updateCloak(GameState &state [[maybe_unused]], unsigned int ticks)
2055{

Callers

nothing calls this directly

Calls 1

getPayloadTypeMethod · 0.80

Tested by

no test coverage detected