function Trig_ChannelManaBeginCast_Copy_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A00D' ) // A00D is Channel Mana
endfunction
function Trig_ChannelManaBeginCast_Copy_Actions takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local multiboarditem mbitem
local group g = CreateGroup()
local unit dummy
//===== Gold is Magic that's collected from the mine. Channel Mana is an ability =====
//===== that takes harvested Magic and channels it into a specific Mana Pool =========
if ( GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD) > 0 ) then
//Magic Miner //
if (GetUnitTypeId(GetTriggerUnit()) == 'e002') then
//===== Decrease magic and increase Generic Mana (1 of the 6 types) =============
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, (GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD) - 1) )
set udg_genericMana[GetPlayerId(p)] = (udg_genericMana[GetPlayerId(p)]+1)
//===== Show the mana gain on the multiboard ====================================
set mbitem = MultiboardGetItem(udg_mboard[GetPlayerId(p)],1,2)
call MultiboardSetItemValueBJ( udg_mboard[GetPlayerId(p)],2, 1, I2S(udg_genericMana[GetPlayerId(p)]))
//===== Raise the level of Generic Mana dummy to be used as spell requirements ===
set g = GetUnitsOfPlayerAndTypeId(p,'H005')
set dummy = FirstOfGroup(g)
call SetHeroLevelBJ(dummy,2,false)
//call LeaderboardSetItemValue(bj_lastCreatedLeaderboard,LeaderboardGetPlayerIndex(bj_lastCreatedLeaderboard,p),GetHeroLevel(dummy))
endif
else
call IssueImmediateOrder(GetTriggerUnit(),"stop")
endif
set p = null
set mbitem = null
set dummy = null
set g = null
endfunction
//===========================================================================
function InitTrig_ChannelManaBeginCast_Copy takes nothing returns nothing
set gg_trg_ChannelManaBeginCast_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ChannelManaBeginCast_Copy, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_ChannelManaBeginCast_Copy, Condition( function Trig_ChannelManaBeginCast_Copy_Conditions ) )
call TriggerAddAction( gg_trg_ChannelManaBeginCast_Copy, function Trig_ChannelManaBeginCast_Copy_Actions )
endfunction