------------------------------------------- CAN TARGET -------------------------------------------------
| 469 | } |
| 470 | //------------------------------------------- CAN TARGET ------------------------------------------------- |
| 471 | static inline bool canTargetUnit(Unit targetUnit) |
| 472 | { |
| 473 | if ( !targetUnit || !targetUnit->exists() ) |
| 474 | return Broodwar->setLastError(Errors::Unit_Does_Not_Exist); |
| 475 | if ( !targetUnit->isVisible() && !Broodwar->isFlagEnabled(Flag::CompleteMapInformation) ) |
| 476 | return false; |
| 477 | if ( !targetUnit->isCompleted() && |
| 478 | !targetUnit->getType().isBuilding() && |
| 479 | !targetUnit->isMorphing() && |
| 480 | targetUnit->getType() != UnitTypes::Protoss_Archon && |
| 481 | targetUnit->getType() != UnitTypes::Protoss_Dark_Archon ) |
| 482 | return Broodwar->setLastError(Errors::Incompatible_State); |
| 483 | if ( targetUnit->getType() == UnitTypes::Spell_Scanner_Sweep || |
| 484 | targetUnit->getType() == UnitTypes::Spell_Dark_Swarm || |
| 485 | targetUnit->getType() == UnitTypes::Spell_Disruption_Web || |
| 486 | targetUnit->getType() == UnitTypes::Special_Map_Revealer ) |
| 487 | return Broodwar->setLastError(Errors::Incompatible_UnitType); |
| 488 | |
| 489 | return true; |
| 490 | } |
| 491 | static inline bool canTargetUnit(Unit thisUnit, Unit targetUnit, bool checkCommandibility = true) |
| 492 | { |
| 493 | if ( !checkCommandibility ) |
no test coverage detected