| 7 | Resources_Jump enemyresources_jump_impl(AISCRIPT::Enum::ENEMYRESOURCES_JUMP); |
| 8 | |
| 9 | bool Resources_Jump::execute(aithread &thread) const |
| 10 | { |
| 11 | // Parameters |
| 12 | WORD wOre, wGas, wJump; |
| 13 | thread.readTuple( std::tie(wOre, wGas, wJump) ); |
| 14 | |
| 15 | // Get Player |
| 16 | Player player = this->getOpcode() == Enum::RESOURCES_JUMP ? Broodwar->self() : Broodwar->enemy(); |
| 17 | |
| 18 | // Check if player has the given amount of resources |
| 19 | if ( player && player->minerals() >= wOre && player->gas() >= wGas ) |
| 20 | thread.setScriptOffset( wJump ); |
| 21 | |
| 22 | // Debug and return |
| 23 | thread.saveDebug(Text::Green, this->getOpcode(), "%u %u p_%04X", wOre, wGas, wJump ); |
| 24 | return true; |
| 25 | } |