BlightGoldMineForPlayerBJ
- Parameters
-
goldMine unit
whichPlayer player
- comment
- bug
-
Leaks handle
newMine
: In Jass you must set local variables that hold agents (or any child type) tonull
at the end of functions to avoid reference counter leaks. - patch
-
1.00
- Source
- Blizzard.j (suggest an edit or discuss on Github)
- return type
-
unit
- Source code
-
function BlightGoldMineForPlayerBJ takes unit goldMine, player whichPlayer returns unit local real mineX local real mineY local integer mineGold local unit newMine // Make sure we're replacing a Gold Mine and not some other type of unit. if GetUnitTypeId(goldMine) != 'ngol' then return null endif // Save the Gold Mine's properties and remove it. set mineX = GetUnitX(goldMine) set mineY = GetUnitY(goldMine) set mineGold = GetResourceAmount(goldMine) call RemoveUnit(goldMine) // Create a Haunted Gold Mine to replace the Gold Mine. set newMine = CreateBlightedGoldmine(whichPlayer, mineX, mineY, bj_UNIT_FACING) call SetResourceAmount(newMine, mineGold) return newMine endfunction