Created
September 18, 2012 15:54
-
-
Save theQuazz/3743885 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library UnitIDs initializer init | |
| globals | |
| constant integer UNIT_MAGE = 'O00U' | |
| constant integer UNIT_ELEMENTALIST = 'O00R' | |
| constant integer UNIT_HYPNOTIST = 'O00D' | |
| constant integer UNIT_DEMENTIA_MASTER = 'O014' | |
| constant integer UNIT_PRIEST = 'O00P' | |
| constant integer UNIT_BOOSTER = 'O00G' | |
| constant integer UNIT_MASTER_HEALER = 'O00S' | |
| constant integer UNIT_SAGE = 'O011' | |
| constant integer array MAGE_MASHER_CLASSES | |
| constant integer MAGE_MASHER_CLASSES_UB | |
| endglobals | |
| function init takes nothing returns nothing | |
| set MAGE_MASHER_CLASSES[0] = UNIT_MAGE | |
| set MAGE_MASHER_CLASSES[1] = UNIT_ELEMENTALIST | |
| set MAGE_MASHER_CLASSES[2] = UNIT_HYPNOTIST | |
| set MAGE_MASHER_CLASSES[3] = UNIT_DEMENTIA_MASTER | |
| set MAGE_MASHER_CLASSES[4] = UNIT_PRIEST | |
| set MAGE_MASHER_CLASSES[5] = UNIT_BOOSTER | |
| set MAGE_MASHER_CLASSES[6] = UNIT_MASTER_HEALER | |
| set MAGE_MASHER_CLASSES[7] = UNIT_SAGE | |
| set MAGE_MASHER_CLASSES_UB = 7 | |
| endfunction | |
| endlibrary | |
| function checkmashertroll takes nothing returns boolean | |
| local integer uid = GetUnitTypeId(GetTriggerUnit()) | |
| local integer i = 0 | |
| loop | |
| exitwhen i > MAGE_MASHER_CLASSES_UB | |
| if (uid = MAGE_MASHER_CLASSES[i]) | |
| return true | |
| endif | |
| set i = i + 1 | |
| endloop | |
| return false | |
| endfunction | |
| function Trig_MageMasher_Conditions takes nothing returns boolean | |
| local integer index = 0 | |
| local item indexItem | |
| local boolean hasMM = false | |
| loop | |
| set indexItem = UnitItemInSlot(GetAttacker(), index) | |
| if (indexItem != null) and (GetItemTypeId(indexItem) == 'I03J') then | |
| return true | |
| endif | |
| set index = index + 1 | |
| exitwhen index >= bj_MAX_INVENTORY | |
| endloop | |
| return false | |
| endfunction | |
| function Trig_MageMasher_Actions takes nothing returns nothing | |
| local unit attacker = GetAttacker(); | |
| local unit defender = GetTriggerUnit(); | |
| if ( GetRandomReal(0, 100) <= 21.00 ) then // Silence Percentage | |
| call masterCastAtCaster(attacker,defender,0,0,'A064',"soulburn") | |
| endif | |
| if ( GetRandomReal(0, 100) <= 29.00 and checkmashertroll() ) then // manaburn percentage | |
| call masterCastAtCaster(attacker,defender,0,0,'A065',"manaburn") | |
| endif | |
| endfunction | |
| //=========================================================================== | |
| function InitTrig_MageMasher takes nothing returns nothing | |
| local trigger t = CreateTrigger( ) | |
| call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DAMAGED ) | |
| call TriggerAddCondition( t, Condition( function Trig_MageMasher_Conditions ) ) | |
| call TriggerAddAction( t, function Trig_MageMasher_Actions ) | |
| endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment