Created
September 17, 2012 02:17
-
-
Save theQuazz/3735216 to your computer and use it in GitHub Desktop.
mage masher code
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
| function mashSilence takes nothing returns boolean | |
| if ( not ( GetRandomPercentageBJ() <= 21.00 ) ) then | |
| return false | |
| endif | |
| return true | |
| endfunction | |
| function checkmashertroll takes nothing returns boolean | |
| if ( ( GetUnitTypeId(GetAttackedUnitBJ()) == 'O00U' ) ) then | |
| return true | |
| endif | |
| if ( ( GetUnitTypeId(GetAttackedUnitBJ()) == 'O00R' ) ) then | |
| return true | |
| endif | |
| if ( ( GetUnitTypeId(GetAttackedUnitBJ()) == 'O00D' ) ) then | |
| return true | |
| endif | |
| if ( ( GetUnitTypeId(GetAttackedUnitBJ()) == 'O014' ) ) then | |
| return true | |
| endif | |
| if ( ( GetUnitTypeId(GetAttackedUnitBJ()) == 'O00P' ) ) then | |
| return true | |
| endif | |
| if ( ( GetUnitTypeId(GetAttackedUnitBJ()) == 'O00G' ) ) then | |
| return true | |
| endif | |
| if ( ( GetUnitTypeId(GetAttackedUnitBJ()) == 'O00S' ) ) then | |
| return true | |
| endif | |
| if ( ( GetUnitTypeId(GetAttackedUnitBJ()) == 'O011' ) ) then | |
| return true | |
| endif | |
| return false | |
| endfunction | |
| function mashManaBurn takes nothing returns boolean | |
| if ( not ( GetRandomPercentageBJ() <= 29.00 ) ) then | |
| return false | |
| endif | |
| if ( not(checkmashertroll()) ) then | |
| return false | |
| endif | |
| return true | |
| endfunction | |
| function mashhit takes nothing returns nothing | |
| local unit attack = GetEventDamageSource() | |
| local unit defend = GetTriggerUnit() | |
| local integer attacker = GetStoredInteger(udg_attackerCache,"attacker.w3v",I2S(GetPlayerId(GetOwningPlayer(attack)))) | |
| local integer attacked = GetStoredInteger(udg_attackedCache,"attacked.w3v",I2S(GetPlayerId(GetOwningPlayer(defend)))) | |
| if ( IsUnitType(attack, UNIT_TYPE_HERO) == true ) then | |
| if (attacker!=0 and attacked!=0) then | |
| call StoreInteger(udg_attackerCache,"attacker.w3v","Player "+I2S(GetPlayerId(GetOwningPlayer(attack))),0) | |
| call StoreInteger(udg_attackedCache,"attacked.w3v","Player "+I2S(GetPlayerId(GetOwningPlayer(defend))),0) | |
| if ( mashSilence() ) then | |
| call masterCastAtCaster(attack,defend,0,0,'A064',"soulburn") | |
| endif | |
| if ( mashManaBurn() ) then | |
| call masterCastAtCaster(attack,defend,0,0,'A065',"manaburn") | |
| endif | |
| endif | |
| endif | |
| call DestroyTrigger(GetTriggeringTrigger()) | |
| endfunction | |
| function Trig_MageMasher_Conditions takes nothing returns boolean | |
| if ( not ( UnitHasItemOfTypeBJ(GetAttacker(), 'I03J') == true ) ) then | |
| return false | |
| endif | |
| return true | |
| endfunction | |
| function Trig_MageMasher_Actions takes nothing returns nothing | |
| local trigger detecthit = CreateTrigger() | |
| local unit attacker=GetAttacker() | |
| local unit attacked=GetAttackedUnitBJ() | |
| if (udg_attackerCache==null) then | |
| set udg_attackerCache = InitGameCacheBJ( "attacker.w3v" ) | |
| set udg_attackedCache = InitGameCacheBJ( "attacked.w3v" ) | |
| endif | |
| call StoreInteger(udg_attackerCache,"attacker.w3v",I2S(GetPlayerId(GetOwningPlayer(attacker))),1) | |
| if (GetStoredInteger(udg_attackedCache,"attacked.w3v",I2S(GetPlayerId(GetOwningPlayer(attacked))))==0) then | |
| call StoreInteger(udg_attackedCache,"attacked.w3v",I2S(GetPlayerId(GetOwningPlayer(attacked))),1) | |
| call TriggerRegisterUnitEvent( detecthit, attacked, EVENT_UNIT_DAMAGED ) | |
| call TriggerAddAction(detecthit, function mashhit) | |
| endif | |
| call PolledWait(.35) | |
| //Units have Attack Damage dealt at .330 seconds into animation | |
| //.35 is just in case they are debuffed. | |
| call StoreInteger(udg_attackedCache,"attacked.w3v",I2S(GetPlayerId(GetOwningPlayer(attacked))),0) | |
| call StoreInteger(udg_attackerCache,"attacker.w3v",I2S(GetPlayerId(GetOwningPlayer(attacker))),0) | |
| set detecthit = null | |
| call DisableTrigger(detecthit) | |
| call DestroyTrigger(detecthit) | |
| endfunction | |
| //=========================================================================== | |
| function InitTrig_MageMasher takes nothing returns nothing | |
| set gg_trg_MageMasher = CreateTrigger( ) | |
| call TriggerRegisterAnyUnitEventBJ( gg_trg_MageMasher, EVENT_PLAYER_UNIT_ATTACKED ) | |
| call TriggerAddCondition( gg_trg_MageMasher, Condition( function Trig_MageMasher_Conditions ) ) | |
| call TriggerAddAction( gg_trg_MageMasher, function Trig_MageMasher_Actions ) | |
| endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment