Hello guyz
I`ve gotta little problem with changing damage type of physical attacks from default physical to pure.
Below you can see my version of trigger:
FIrst it saves Hp, and Unit ID to variables, then check, and return damage reduction of target, and save it to another variable.
Next action is "Wait" until missile hit (It`s designed for ranged hero with 1.8k missile speed)
To this point everything is working - last function: GUI "Damage target" seems to have problems with executing a formula to get a final damage output.
Could anyone tell me what do i do wrong, or even create a working piece of code for me? (please)
I`ve gotta little problem with changing damage type of physical attacks from default physical to pure.
Below you can see my version of trigger:
JASS:
function Trig_PurifDamager_Kopiuj_Conditions takes nothing returns boolean
if ( not ( GetAttacker() == gg_unit_E000_0000 ) ) then
return false
endif
if ( not ( UnitHasBuffBJ(gg_unit_E000_0000, 039;B001039;) == true ) ) then
return false
endif
return true
endfunction
function Trig_PurifDamager_Kopiuj_Actions takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
// Setting Variables
set udg_PurifUnitHolder = GetAttackedUnitBJ()
set udg_PurifHpHolder = GetUnitStateSwap(UNIT_STATE_LIFE, GetAttackedUnitBJ())
// Checking target`s armor reduction
call SetUnitLifeBJ( udg_PurifUnitHolder, 100.00 )
call UnitDamageTargetBJ( gg_unit_E000_0000, udg_PurifUnitHolder, 100.00, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
set udg_PurifArmorDecrem = ( ( 100.00 - GetUnitStateSwap(UNIT_STATE_LIFE, udg_PurifUnitHolder) ) / 100.00 )
call SetUnitLifeBJ( udg_PurifUnitHolder, udg_PurifHpHolder )
// Wait until projectile hits the target (even too much time)
call TriggerSleepAction( ( DistanceBetweenPoints(GetUnitLoc(udg_PurifUnitHolder), GetUnitLoc(gg_unit_E000_0000)) / 1600.00 ) )
// Setting Variable to HP after being attacked
set udg_PurifHpHolder2 = GetUnitStateSwap(UNIT_STATE_LIFE, GetAttackedUnitBJ())
// Why this isn`t working then???
call UnitDamageTargetBJ( gg_unit_E000_0000, udg_PurifUnitHolder, ( ( ( udg_PurifHpHolder - udg_PurifHpHolder2 ) / ( 1 - udg_PurifArmorDecrem ) ) - ( udg_PurifHpHolder - udg_PurifHpHolder2 ) ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_ENHANCED )
call EnableTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_PurifDamager_Kopiuj takes nothing returns nothing
set gg_trg_PurifDamager_Kopiuj = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_PurifDamager_Kopiuj, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_PurifDamager_Kopiuj, Condition( function Trig_PurifDamager_Kopiuj_Conditions ) )
call TriggerAddAction( gg_trg_PurifDamager_Kopiuj, function Trig_PurifDamager_Kopiuj_Actions )
endfunction
FIrst it saves Hp, and Unit ID to variables, then check, and return damage reduction of target, and save it to another variable.
Next action is "Wait" until missile hit (It`s designed for ranged hero with 1.8k missile speed)
To this point everything is working - last function: GUI "Damage target" seems to have problems with executing a formula to get a final damage output.
Could anyone tell me what do i do wrong, or even create a working piece of code for me? (please)