Skip to content

Commit b56f33b

Browse files
committed
Adjust Phobos attack missions to skip Immune=yes check for spies, engineers etc
1 parent 27e8ced commit b56f33b

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/Ext/Script/Mission.Attack.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,17 +484,22 @@ TechnoClass* ScriptExt::GreatestThreat(TechnoClass* pTechno, int method, int cal
484484
continue;
485485

486486
const auto pTargetType = pTarget->GetTechnoType();
487+
bool skipImmune = false;
487488

488-
if (!pTargetType->LegalTarget || pTargetType->Immune)
489-
continue;
490-
491-
// Discard invisible structures
492-
if (const auto pTargetBuildingType = abstract_cast<BuildingTypeClass*, true>(pTargetType))
489+
if (const auto pTargetBuilding = abstract_cast<BuildingClass*>(pTarget))
493490
{
494-
if (pTargetBuildingType->InvisibleInGame)
491+
// Discard invisible structures
492+
if (pTargetBuilding->Type->InvisibleInGame)
495493
continue;
494+
495+
// Skip immunity check for buildings in agent mode.
496+
if (agentMode)
497+
skipImmune = true;
496498
}
497499

500+
if (!pTargetType->LegalTarget || (!skipImmune && pTargetType->Immune))
501+
continue;
502+
498503
// Note: the TEAM LEADER is picked for this task, be careful with leadership values in your mod
499504
const auto pWeaponType = pTechno->GetWeapon(pTechno->SelectWeapon(pTarget))->WeaponType;
500505

0 commit comments

Comments
 (0)