JASS:
function Trig_dmgdodgeskill_Actions takes nothing returns nothing
local integer i
//the first three ifs check if the ability has been learned yet,
//and levels up the trigger along with the hero ability
//the return there makes the trigger end if the ability is still
//level zero, in other words it isn't learned yet
if GetUnitAbilityLevelSwapped('A00V', GetTriggerUnit()) == 1 then
set i =GetRandomInt(1,200)
else
if GetUnitAbilityLevelSwapped('A00V', GetTriggerUnit()) == 2 then
set i =GetRandomInt(31,200)
else
if GetUnitAbilityLevelSwapped('A00V', GetTriggerUnit()) == 3 then
set i =GetRandomInt(61,200)
else
return
endif
endif
endif
if i >= 191 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + GetEventDamage() ) )
else
if i >= 181 and i < 191 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + ( GetEventDamage() * 0.50 ) ) )
else
if i >= 171 and i < 181 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + GetEventDamage() ) )
call UnitDamageTargetBJ( GetTriggerUnit(), GetEventDamageSource(), ( GetEventDamage() * 1.00 ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
else
if i >= 161 and i < 171 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + GetEventDamage() ) )
call UnitDamageTargetBJ( GetTriggerUnit(), GetEventDamageSource(), ( GetEventDamage() * 2.00 ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
else
if i >= 151 and i < 161 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + ( GetEventDamage() * 0.75 ) ) )
call UnitDamageTargetBJ( GetTriggerUnit(), GetEventDamageSource(), ( GetEventDamage() * 3.00 ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
else
if i >= 141 and i < 151 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + GetEventDamage() ) )
call UnitDamageTargetBJ( GetTriggerUnit(), GetEventDamageSource(), ( GetEventDamage() * 0.50 ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
else
if i >= 131 and i < 141 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + ( GetEventDamage() * 0.50 ) ) )
call UnitDamageTargetBJ( GetTriggerUnit(), GetEventDamageSource(), ( GetEventDamage() * 4.00 ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
else
if i >= 121 and i < 131 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + ( GetEventDamage() * 0.25 ) ) )
else
if i >= 111 and i < 121 then
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + ( GetEventDamage() * 0.75 ) ) )
endif
endif
endif
endif
endif
endif
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_dmgdodgeskill takes nothing returns nothing
set gg_trg_dmgdodgeskill = CreateTrigger( )
call TriggerAddAction( gg_trg_dmgdodgeskill, function Trig_dmgdodgeskill_Actions )
endfunction
[/HIDDEN]
the 'A00U' is the raw data id of the ability. the one i'm using is evasion, and i set it's levels to 5% 6% and 7% evasion it's an ultimate ability so the numbers are a bit high. here's the tooltips:
Gives a percent chance to avoid damage in one of 10 ways:
Way 1 - Block out all the damage.
Way 2 - Block out 0.5x of the damage.
Way 3 - Block out 0.25x of the damage.
Way 4 - Block out 0.75x of the damage.
Way 5 - Deflect it back at the source.
Way 6 - Deflect it back at the source at 2x speed.
Way 7 - Deflect it back at the source at 3x speed, taking 0.25x damage.
Way 8 - Deflect it back at the source at 4x speed, taking 0.5x damage.
Way 9 - Deflect it back at the source at 0.5x speed.
Way 10 - Evade the attack.
Level 1 - 5% Level 2 - 6% Level 3 - 7%
level one tooltip:
Gives a 45% chance to defend or deflect an attack, and an extra 5% chance for an attack to miss completely.
by the way it is designed to be an ultimate ability, so 50-70 percent isn't that big of a deal especially considering some of those he still takes some damage. if you need movement speed reduction i suggest making a separate trigger that turns this trigger on and off when you defend. i'm not sure what the events would be but try message debugging for that. it might be what supersheep mentioned, i'm not sure, you can always put an action that displays a message to you in the game to test the ability to make sure the events and conditions are compatible, that's message debugging. anyway it's most likely gonna be either order or an ability so try all that.
keep in mind the above trigger could probably be rewritten to be more effecient than it is, perhaps it has too many function calls or something like that. any opinions?
at any rate my ability is a bit complex and it probably isn't exactly what you're looking for, but hopefully it will give you some ideas. oh and i hope you can read some jass.
another thing to keep in mind about this ability i made up is that it doesn't actually redirect the attack like defend does. in other words a footman can kill a wind rider with his own poison attack but this just attacks with a simple chaos attack no matter what attack was thrown at them.
i'm totally open to someone coming along and improving the ability of course. i just came up with a simple but crude concept that works. if no one else improves it i will eventually.