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

Method inProgressInternal

game/state/battle/ai/aidecision.cpp:57–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57bool AIAction::inProgressInternal(BattleUnit &u)
58{
59 switch (type)
60 {
61 case AIAction::Type::AttackGrenade:
62 return !u.missions.empty() &&
63 u.missions.front()->type == BattleUnitMission::Type::ThrowItem;
64 case AIAction::Type::AttackWeaponTile:
65 return u.isAttacking() &&
66 (u.targetingMode == BattleUnit::TargetingMode::TileCenter ||
67 u.targetingMode == BattleUnit::TargetingMode::TileGround) &&
68 u.targetTile == targetLocation;
69 case AIAction::Type::AttackWeaponUnit:
70 return u.isAttacking() && u.targetingMode == BattleUnit::TargetingMode::Unit &&
71 u.targetUnit == targetUnit;
72 case AIAction::Type::AttackPsiMC:
73 case AIAction::Type::AttackPsiStun:
74 case AIAction::Type::AttackPsiPanic:
75 // Even though the attack might already be over, we won't check for it
76 // This is intentional. Psi attack is considered "in progress" indefinitely
77 // otherwise, especially in TB, when attack is instant, AI would spam attacks and
78 // we would rather have them do attacks with a small delay
79 // which we introduce via reThinkDelay value
80 return u.agent->modified_stats.psi_energy < psiEnergySnapshot;
81 case AIAction::Type::AttackBrainsucker:
82 return u.current_movement_state == MovementState::Brainsuck ||
83 u.target_body_state == BodyState::Jumping;
84 case AIAction::Type::AttackSuicide:
85 // If you're not dead yet then you haven't popped yet :)))
86 return false;
87 }
88 return false;
89}
90
91bool AIAction::inProgress(BattleUnit &u)
92{

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.80
isAttackingMethod · 0.80
isMovingMethod · 0.80

Tested by

no test coverage detected