void UnitWrap::RunGuardPost() { if ( GetOrderTimer() != 0 ) return; SetOrderTimer(15); if ( TaskSpellcaster(false) ) return; if ( TaskAggression() ) return; if ( pUnit->getType() == UnitTypes::Protoss_Observer ) return; if ( GetControlType() == ControlTypes::Guard && pUnit->getPosition() != GetGuardReturnPosition() ) { if ( pUnit->getType() == UnitTypes::Terran_Siege_Tank_Siege_Mode ) pUnit->unsiege(); SetVirtualUnitOrder(Orders::Enum::ComputerReturn, GetGuardReturnPosition() ); } else { SetVirtualUnitOrder(Orders::Enum::ComputerAI); } }
void UnitWrap::UpdateOrderTimers() { int timer; // Order timer timer = GetOrderTimer(); if ( timer > 0 ) SetOrderTimer(timer-1); }
void UnitWrap::RunComputerAI() { // Run this order on a timer if ( GetOrderTimer() > 0 ) return; SetOrderTimer(15); // Perform generic unit behaviour if ( DoUnitBehaviour() ) return; // Run AIController type-specific stuff PerformSpecializedUnitControl(); // Localize unit type UnitType t = pUnit->getType(); // Check if this (building) needs to be repaired if ( (GetRace == Races::Terran && IsMechanical && HP_Percent != 100 && IsBuilding && !IsPlagued && !IsIrradiated && !IsWorker)(pUnit) && !IsMilitaryCaptain() ) { // Do repair check/assign here } else if ( t == UnitTypes::Terran_Siege_Tank_Tank_Mode ) // Siege Tank special { if ( !MainController.IsCampaign() && pUnit->isIdle() ) pUnit->siege(); } else if ( t.isBurrowable() ) // Burrowable unit control { if ( !pUnit->isBurrowed() && t != UnitTypes::Zerg_Drone && pUnit->isIdle() ) pUnit->burrow(); } else if ( t == UnitTypes::Terran_Medic ) // Medic special { if ( !HasNoCaptain() ) SetVirtualUnitOrder(Orders::Enum::Medic); //else // Do independant AI Transport stuff } }