| 68 | } |
| 69 | |
| 70 | bool UnitWrap::DoUnitBehaviour() |
| 71 | { |
| 72 | DecloakCheck(); |
| 73 | |
| 74 | UnitType t = pUnit->getType(); |
| 75 | switch ( t ) |
| 76 | { |
| 77 | case UnitTypes::Enum::Protoss_Carrier: |
| 78 | case UnitTypes::Enum::Protoss_Reaver: |
| 79 | // @TODO: Check AI reserves |
| 80 | pUnit->train(); |
| 81 | return false; |
| 82 | case UnitTypes::Enum::Terran_Dropship: |
| 83 | if ( pUnit->getHitPoints() < t.maxHitPoints() ) //&& AssignRepairSCV(pUnit) ) |
| 84 | { |
| 85 | Unit pSCV = nullptr;//AssignRepairSCV(pUnit); |
| 86 | if ( pSCV ) // do unload, then follow SCV |
| 87 | { |
| 88 | if ( pUnit->getLoadedUnits().empty() ) |
| 89 | return pUnit->follow(pSCV); |
| 90 | else |
| 91 | return pUnit->unloadAll(); |
| 92 | } |
| 93 | } |
| 94 | // do what protoss shuttle does after: |
| 95 | case UnitTypes::Enum::Protoss_Shuttle: |
| 96 | //if ( AI_TranpoerAction(pUnit) ) |
| 97 | // return true; |
| 98 | if ( pUnit->getLoadedUnits().empty() ) |
| 99 | return false; |
| 100 | return pUnit->unloadAll(); |
| 101 | case UnitTypes::Enum::Zerg_Overlord: |
| 102 | if ( pUnit->getLoadedUnits().empty() ) |
| 103 | return false; |
| 104 | return pUnit->unloadAll(); |
| 105 | case UnitTypes::Enum::Terran_Vulture: |
| 106 | return false;//pUnit->useTech(TechTypes::Spider_Mines, GetSpiderMineLocation(pUnit)); |
| 107 | case UnitTypes::Enum::Terran_Siege_Tank_Tank_Mode: |
| 108 | if ( this->GetControlType() == ControlTypes::Guard && pUnit->isIdle() ) // && !AI_Guard_AttackTarget_Proc(unit, 0) |
| 109 | return pUnit->siege(); |
| 110 | return false; |
| 111 | case UnitTypes::Enum::Protoss_Shield_Battery: |
| 112 | if ( pUnit->getEnergy() >= 50 ) |
| 113 | { |
| 114 | Unitset myUnits(Broodwar->self()->getUnits()); |
| 115 | for ( auto i = myUnits.begin(); i != myUnits.end(); ++i ) |
| 116 | { |
| 117 | |
| 118 | // @TODO |
| 119 | // if ( i can recharge, not attacking, shields > 40 ) |
| 120 | // recharge the unit |
| 121 | } |
| 122 | } |
| 123 | return false; |
| 124 | case UnitTypes::Enum::Protoss_Arbiter: |
| 125 | // Should be "AIOrderTargetUnit" or autotarget |
| 126 | Unit pBest = pUnit->getClosestUnit(GetPlayer == Broodwar->self() && !IsBuilding && OrderTarget != nullptr, 640); |
| 127 | if ( pBest != nullptr ) |
nothing calls this directly
no test coverage detected