Function BlightGoldMineForPlayerBJ
- Line
- 8090
- Location
- blizzard.j
- Constant?
- no
- Type
- function
- Arguments
- unit goldMine, player whichPlayer
- Returns
- unit
| 8090 | function BlightGoldMineForPlayerBJ takes unit goldMine, player whichPlayer returns unit |
| 8091 | local real mineX |
| 8092 | local real mineY |
| 8093 | local integer mineGold |
| 8094 | local unit newMine |
| 8095 | |
| 8096 | // Make sure we're replacing a Gold Mine and not some other type of unit.
|
| 8097 | if GetUnitTypeId(goldMine) != 'ngol' then |
| 8098 | return null |
| 8099 | endif
|
| 8100 | |
| 8101 | // Save the Gold Mine's properties and remove it.
|
| 8102 | set mineX = GetUnitX(goldMine) |
| 8103 | set mineY = GetUnitY(goldMine) |
| 8104 | set mineGold = GetResourceAmount(goldMine) |
| 8105 | call RemoveUnit(goldMine) |
| 8106 | |
| 8107 | // Create a Haunted Gold Mine to replace the Gold Mine.
|
| 8108 | set newMine = CreateBlightedGoldmine(whichPlayer, mineX, mineY, bj_UNIT_FACING) |
| 8109 | call SetResourceAmount(newMine, mineGold) |
| 8110 | return newMine
|
| 8111 | endfunction
|