| 19 | } |
| 20 | |
| 21 | bool Use_Ability::execute(aithread &thread) const |
| 22 | { |
| 23 | // Get the appropriate tech and unit type for the opcode |
| 24 | TechType tech; |
| 25 | UnitType unit; |
| 26 | switch ( this->getOpcode() ) |
| 27 | { |
| 28 | case Enum::NUKE_LOCATION: |
| 29 | tech = TechTypes::Nuclear_Strike; |
| 30 | unit = UnitTypes::Terran_Ghost; |
| 31 | break; |
| 32 | case Enum::DISRUPTION_WEB: |
| 33 | tech = TechTypes::Disruption_Web; |
| 34 | unit = UnitTypes::Protoss_Corsair; |
| 35 | break; |
| 36 | case Enum::RECALL_LOCATION: |
| 37 | tech = TechTypes::Recall; |
| 38 | unit = UnitTypes::Protoss_Arbiter; |
| 39 | break; |
| 40 | } |
| 41 | |
| 42 | // Execute the ability after obtaining a unit |
| 43 | Unit pCaster = GetSuitableCaster(tech.energyCost(), unit); |
| 44 | if ( pCaster ) |
| 45 | pCaster->useTech(tech, thread.getLocation().center()); |
| 46 | |
| 47 | // Debug and return |
| 48 | thread.saveDebug(Text::Green, this->getOpcode()); |
| 49 | return true; |
| 50 | } |
nothing calls this directly
no test coverage detected