• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Gui Damage Engine problem

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
i wrote here too because have no ideea when Bribe able to answer and maybe someone know what is the problem...

so situation is i use gui dmg engine, mostly untouched exclude the trigger where we can modify the DamageEventAmount, so i public here the trigger (2 form because from 1st i cut out few thing for be more visible the dmg modification)

Problem the dmg remain untouched even i changed the variable, so lets say floating text write i do 3 dmg but i do 500, or write 550 dmg and i 1hited a 1k hp hero but somehow at end of trigger with displaytext too the dmgeventamount and dmg variable are fine setted still dmg what unit reicive isn't lowered.

note each mob and unit has pdef/mdef and was added in unit indexer

JASS:
function Trig_Set_Damage_Conditions takes nothing returns boolean
    return udg_DamageEventOverride == false
endfunction

function Trig_Set_Damage_Actions takes nothing returns nothing
    local unit a = udg_DamageEventSource
    local unit t = udg_DamageEventTarget
    local integer ap = GetPlayerId(GetOwningPlayer(a)) + 1
    local integer tp = GetPlayerId(GetOwningPlayer(t)) + 1
    local integer acv = GetUnitUserData(a)
    local integer tcv = GetUnitUserData(t)
    local integer dmgtype = udg_DamageEventType
    local integer rnd = GetRandomInt(0, 99) //random for hit chance
    local real dmg = udg_DamageEventAmount
    local real dmgaddon
    local real r
    local real tr
    local real block
    local real eva
    local real alv
    local real dlv
    local real crit
    local real critdmg
    local real pdef
    local real mdef
    local integer hit
    local integer pv
    local real attackerlv
    local real targetlv
    local real PhysicalRed
    local real MagicRed
    local real ref = udg_Global_Reflect[tcv]
    local real ls = udg_Global_LifeSteal[acv]
    local real ms = udg_Global_ManaSteal[acv]
    local real DmgRed
    set udg_DamageEventOverride = true

    if dmg <= 0 then
        set udg_DamageEventAmount = 1
        set dmg = udg_DamageEventAmount
    endif

    set udg_DamageEventType = 0
        
    if dmgtype == 0 and udg_DamageTypeDOT == 0 then
        if udg_Global_MDmg1[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 1
            call UnitDamageTarget(a, t, udg_Global_MDmg1[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
        elseif udg_Global_MDmg2[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 2
            call UnitDamageTarget(a, t, udg_Global_MDmg2[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
        elseif udg_Global_MDmg3[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 3
            call UnitDamageTarget(a, t, udg_Global_MDmg3[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
        elseif udg_Global_MDmg4[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 4
            call UnitDamageTarget(a, t, udg_Global_MDmg5[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
        elseif udg_Global_MDmg5[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 5
            call UnitDamageTarget(a, t, udg_Global_MDmg5[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
        endif
       
    endif

    if ( IsUnitType(a, UNIT_TYPE_HERO) ) then
        set attackerlv = GetHeroLevel(a)
    else
        set attackerlv = GetUnitLevel(a)
    endif
    if ( IsUnitType(t, UNIT_TYPE_HERO) ) then
        set targetlv = GetHeroLevel(t)
    else
        set targetlv = GetUnitLevel(t)
    endif
            
      set block = udg_Global_Block[tcv]
    set alv = udg_Global_AttLv[acv]
    set dlv = udg_Global_DefLv[tcv]

    if ( GetPlayerController(GetOwningPlayer(a)) != MAP_CONTROL_USER ) then
        set pv = GetUnitPointValue(a)
       //in object editor point values was changed, 50=fire mob, 51 water dmg mob etc
        if pv >= 50 and pv < 55 then
            set dmgtype = 2 + pv - 50
        endif
        set alv = udg_Global_AttLv[acv]
    endif

    //if isn't player unit then i change defence level what based on difiiculty
    if ( GetPlayerController(GetOwningPlayer(t)) != MAP_CONTROL_USER ) and udg_Difficulty != 1 then
        set dlv = udg_Global_DefLv[tcv] + udg_Difficulty * 10
    else
        //if player unit (so pvp) then dmg reduced to 25%
        if GetPlayerController(GetOwningPlayer(t)) == MAP_CONTROL_USER and GetPlayerController(GetOwningPlayer(a)) == MAP_CONTROL_USER then
            set dmg = dmg / 4
        endif
        set dlv = udg_Global_DefLv[tcv]
    endif

    set crit = udg_Global_Crit[acv]
    set critdmg = udg_Global_CritDmg[acv] + 200.00
    set eva = ( udg_Global_Eva[tcv] - 1.00 ) / ( ( 2.00 * udg_Global_Acc[acv] ) + ( udg_Global_Eva[tcv] - 1.00 ) )
    set hit = HitChance(acv, tcv)//R2I((1.00 - eva) * 100.00)
    set pdef = udg_Global_Pdef[tcv]
    if dmgtype == 1 then
        set mdef = udg_Global_Mdef1[tcv]
    elseif dmgtype == 2 then
        set mdef = udg_Global_Mdef2[tcv]
    elseif dmgtype == 3 then
        set mdef = udg_Global_Mdef3[tcv]
    elseif dmgtype == 4 then
        set mdef = udg_Global_Mdef4[tcv]
    elseif dmgtype == 5 then
        set mdef = udg_Global_Mdef5[tcv]
    else
        set mdef = 0
    endif

    set dmg = dmg + (udg_Global_DmgInc[acv] - udg_Global_DmgRed[tcv]) / 100.00 * dmg

    if mdef < 0 then
        set mdef = 0
    endif

    if pdef < 0 then
        set pdef = 0
    endif

    //if random lower than evasion chance then no dmg
    if rnd < hit and dmgtype == 0 and udg_DamageTypeDOT == 0 then
        set dmg = 0.00
        call FT (Player(ap - 1), Player(tp - 1), "Miss!", 0.9 , t, 7, 51, 51, 255, 200)
        set DmgRed = 0
    else
        set rnd = GetRandomInt(0, 99)
        //if random lower than block chance then no dmg
        if rnd < block and udg_DamageTypeDOT == 0 and udg_DamageTypeDOT == 0 then
            set dmg = 0.00
            call FT (Player(ap - 1), Player(tp - 1), "Blocked!", 0.9, t, 7, 0, 0, 255, 200)
            set DmgRed = 0
        else
            set PhysicalRed = pdef / ( 40.00 * attackerlv + pdef + 25.00 )
            set MagicRed = mdef / ( 40.00 * attackerlv + mdef + 25.00 )
            set rnd = GetRandomInt(0, 99)
            if rnd < udg_Global_ArmorBreak[acv] then
                if dmgtype > 1 then
                    set dmg = dmg * ( 1 - MagicRed )
                    set DmgRed = ( 1 - MagicRed )
                else
                    set dmg = dmg * ( 1 - PhysicalRed )
                    set DmgRed = ( 1 - PhysicalRed )
                endif
             else
                set DmgRed = 1
            endif

            if ( alv > dlv ) then
                set dmg = dmg * ( 1 + ( alv - dlv ) / 100.00 )
            else
                set dmg = dmg / ( 1.00 + ( dlv - alv ) / 120.00)
            endif

            if GetRandomReal(0.00, 100) <= crit and udg_DamageTypeDOT == 0 and dmg > 0 then
                set dmg = dmg * critdmg / 100.00
                call FT (Player(ap - 1), Player(tp - 1), I2S(R2I(dmg)), 1.5, t, 10, 255, 0, 0, 200)
            else
                call FT (Player(ap - 1), Player(tp - 1), I2S(R2I(dmg)), 0.8, t, 15, 179, 255, 51, 200)
            endif

            if udg_DamageTypeDOT == 0 and dmg > 5 then
                if ls > 0 then
                    set r = dmg * ls / 100.00
                    set ls = GetWidgetLife(a) + r
                    call DisplayTextToPlayer(Player(0),0,0,"ls"+R2S(r))
                    call SetWidgetLife(a, ls )
                    if r > 0.99 then
                        call FT_Ex (Player(ap - 1), Player(tp - 1), "+" + I2S(R2I(r)), 0.8, a, 15, 255, 30, 30, 200, 0)
                    endif
                endif
                if ms > 0 then
                    set r = dmg * ms / 100.00
                    set ms = GetUnitState(a, UNIT_STATE_MANA) + r
                    call SetUnitState(a, UNIT_STATE_MANA, ms )
                    if r > 0.99 then
                        call FT_Ex (Player(ap - 1), Player(tp - 1), "+" + I2S(R2I(r)), 0.8, a, 15, 30, 30, 255, 200, 180)
                    endif
                endif
                if ref > 0 then
                    set udg_DamageEventType = 1
                    set dmgaddon = dmg * ref / 100.00
                    call UnitDamageTarget(t, a, dmgaddon, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                    if dmgaddon > 0.99 then
                        call FT_Ex (Player(ap - 1), Player(tp - 1), I2S(R2I(dmgaddon)), 1, t, 13, 70, 255, 30, 200, 270)
                    endif
                endif
            endif
        endif
    endif

    set udg_DamageEventAmount = dmg
    set udg_DamageEventOverride = false
     set udg_DamageTypeDOT = 0

    set a = null
    set t = null
endfunction

//===========================================================================
function InitTrig_Set_Damage takes nothing returns nothing
    set gg_trg_Set_Damage = CreateTrigger( )
    call TriggerRegisterVariableEvent( gg_trg_Set_Damage, "udg_DamageModifierEvent", EQUAL, 1.00 )
    call TriggerRegisterVariableEvent( gg_trg_Set_Damage, "udg_DamageModifierEvent", EQUAL, 2.00 )
    call TriggerAddCondition( gg_trg_Set_Damage, Condition( function Trig_Set_Damage_Conditions ) )
    call TriggerAddAction( gg_trg_Set_Damage, function Trig_Set_Damage_Actions )
endfunction


JASS:
function Trig_Set_Damage_Conditions takes nothing returns boolean
    return udg_DamageEventOverride == false
endfunction

function DamageDecrease takes integer cv, integer slot, real amount returns nothing
    local item itm = LoadItemHandle(udg_Stat_Table, cv, slot )
    local integer id
    local real dur
    local integer pl = GetPlayerId(GetOwningPlayer(udg_UDexUnits[cv])) + 1
    if slot < 10 and itm != null and amount > 0 then
        set id = GetHandleId(itm)
        set dur = LoadReal(udg_CItem_Table, id, 14) - amount
        call SaveReal(udg_CItem_Table, id, 14, dur)
        if dur < 11 then
            if not LoadBoolean(udg_Stat_Table, - cv, - 3 ) then
                call SaveBoolean(udg_Stat_Table, - cv, - 3, true )
                call DisplayTextToPlayer (Player(pl - 1), 0, 0, "|cffff0000Warning:|r |cffffff00" + GetItemName(itm) + "|r |cffff0000got low duratibility!!|r")
            endif
            if dur < 1 then
                call ForcedUnequip (cv, slot)
                call DisplayTextToPlayer (Player(pl - 1), 0, 0, "|cffff0000Broken item:|r |cffffff00" + GetItemName(itm) + "|r |cffff0000got no duratibility!!|r")
            endif
        endif
    endif
    set itm = null
endfunction

function Trig_Set_Damage_Actions takes nothing returns nothing
    local unit a = udg_DamageEventSource
    local unit t = udg_DamageEventTarget
    local integer ap = GetPlayerId(GetOwningPlayer(a)) + 1
    local integer tp = GetPlayerId(GetOwningPlayer(t)) + 1
    local integer acv = GetUnitUserData(a)
    local integer tcv = GetUnitUserData(t)
    local integer dmgtype = udg_DamageEventType
    local integer rnd = GetRandomInt(0, 99) //random for hit chance
    local real dmg = udg_DamageEventAmount
    local real dmgaddon
    local real r
    local real tr
    local real block
    local real eva
    local real alv
    local real dlv
    local real crit
    local real critdmg
    local real pdef
    local real mdef
    local integer hit
    local integer pv
    local real attackerlv
    local real targetlv
    local real PhysicalRed
    local real MagicRed
    local real ref = udg_Global_Reflect[tcv]
    local real ls = udg_Global_LifeSteal[acv]
    local real ms = udg_Global_ManaSteal[acv]
    local real DmgRed
    set udg_DamageEventOverride = true

    if dmg <= 0 then
        set udg_DamageEventAmount = 1
        set dmg = udg_DamageEventAmount
    endif

    call DisplayTextToPlayer(Player(0),0,0,"1-->amount"+R2S(udg_DamageEventAmount)+" dmg"+R2S(dmg))

    set udg_DamageEventType = 0
          //  call DisplayTextToForce( GetPlayersAll(), I2S(dmgtype)+"-"+I2S(udg_DamageTypeDOT)+R2S(udg_Global_MDmg4[acv]) )
    if dmgtype == 0 and udg_DamageTypeDOT == 0 then
        if udg_Global_MDmg1[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 1
            call UnitDamageTarget(a, t, udg_Global_MDmg1[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
        elseif udg_Global_MDmg2[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 2
            call UnitDamageTarget(a, t, udg_Global_MDmg2[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
        elseif udg_Global_MDmg3[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 3
            call UnitDamageTarget(a, t, udg_Global_MDmg3[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
        elseif udg_Global_MDmg4[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 4
            call UnitDamageTarget(a, t, udg_Global_MDmg5[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
        elseif udg_Global_MDmg5[acv] > 0.00 then
            set udg_DamageTypeDOT = 1
            set udg_DamageEventType = 5
            call UnitDamageTarget(a, t, udg_Global_MDmg5[acv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
        endif
        //call DestroyEffect(AddSpecialEffectTarget(udg_Effects[1], t, "origin"))
        //call FT (Player(ap-1), Player(tp-1),I2S(R2I(dmgaddon)), 0.8, t, 20, 100, 100, 255, 200)
    endif

    if ( IsUnitType(a, UNIT_TYPE_HERO) ) then
        set attackerlv = GetHeroLevel(a)
    else
        set attackerlv = GetUnitLevel(a)
    endif
    if ( IsUnitType(t, UNIT_TYPE_HERO) ) then
        set targetlv = GetHeroLevel(t)
    else
        set targetlv = GetUnitLevel(t)
    endif
            
    //pet power if you got summoner class, i not enabled it
    //if ( udg_Pet[GetUnitUserData(udg_Hero[ap])] == a and udg_Class2[ap]==6 ) then
    //    set dmg = dmg + (udg_Stat_Pet_Power[ap] + GetHeroInt(udg_Hero[ap], true)/100.00) * dmg
    //endif

    set block = udg_Global_Block[tcv]
    set alv = udg_Global_AttLv[acv]
    set dlv = udg_Global_DefLv[tcv]

    if ( GetPlayerController(GetOwningPlayer(a)) != MAP_CONTROL_USER ) then
        set pv = GetUnitPointValue(a)
        if pv >= 50 and pv < 55 then
            set dmgtype = 2 + pv - 50
        endif
        set alv = udg_Global_AttLv[acv]
    endif

    if ( GetPlayerController(GetOwningPlayer(t)) != MAP_CONTROL_USER ) and udg_Difficulty != 1 then
        set dlv = udg_Global_DefLv[tcv] + udg_Difficulty * 10
    else
        if GetPlayerController(GetOwningPlayer(t)) == MAP_CONTROL_USER and GetPlayerController(GetOwningPlayer(a)) == MAP_CONTROL_USER then
            set dmg = dmg / 4
        endif
        set dlv = udg_Global_DefLv[tcv]
    endif


    set crit = udg_Global_Crit[acv]
    set critdmg = udg_Global_CritDmg[acv] + 200.00
    set eva = ( udg_Global_Eva[tcv] - 1.00 ) / ( ( 2.00 * udg_Global_Acc[acv] ) + ( udg_Global_Eva[tcv] - 1.00 ) )
    set hit = HitChance(acv, tcv)//R2I((1.00 - eva) * 100.00)

    set pdef = udg_Global_Pdef[tcv]
    if dmgtype == 1 then
        set mdef = udg_Global_Mdef1[tcv]
    elseif dmgtype == 2 then
        set mdef = udg_Global_Mdef2[tcv]
    elseif dmgtype == 3 then
        set mdef = udg_Global_Mdef3[tcv]
    elseif dmgtype == 4 then
        set mdef = udg_Global_Mdef4[tcv]
    elseif dmgtype == 5 then
        set mdef = udg_Global_Mdef5[tcv]
    else
        set mdef = 0
    endif

    set dmg = dmg + (udg_Global_DmgInc[acv] - udg_Global_DmgRed[tcv]) / 100.00 * dmg

    if mdef < 0 then
        set mdef = 0
    endif

    if pdef < 0 then
        set pdef = 0
    endif

    if rnd < hit and dmgtype == 0 and udg_DamageTypeDOT == 0 then
        set dmg = 0.00
        call FT (Player(ap - 1), Player(tp - 1), "Miss!", 0.9 , t, 7, 51, 51, 255, 200)
        set DmgRed = 0
    else
        set rnd = GetRandomInt(0, 99)
        if rnd < block and udg_DamageTypeDOT == 0 and udg_DamageTypeDOT == 0 then
            set dmg = 0.00
            call FT (Player(ap - 1), Player(tp - 1), "Blocked!", 0.9, t, 7, 0, 0, 255, 200)
            set DmgRed = 0
        else
            set PhysicalRed = pdef / ( 40.00 * attackerlv + pdef + 25.00 )
            set MagicRed = mdef / ( 40.00 * attackerlv + mdef + 25.00 )
            set rnd = GetRandomInt(0, 99)
            if rnd < udg_Global_ArmorBreak[acv] then
                if dmgtype > 1 then
                    set dmg = dmg * ( 1 - MagicRed )
                    set DmgRed = ( 1 - MagicRed )
                else
                    set dmg = dmg * ( 1 - PhysicalRed )
                    set DmgRed = ( 1 - PhysicalRed )
                endif
             else
                set DmgRed = 1
            endif

            if GetPlayerController(GetOwningPlayer(t)) == MAP_CONTROL_USER and DmgRed > 0 then
                call DamageDecrease (tcv, 1, DmgRed / 5)
                call DamageDecrease (tcv, 2, DmgRed / 5)
                call DamageDecrease (tcv, 4, DmgRed / 5)
                call DamageDecrease (tcv, 5, DmgRed / 5)
                call DamageDecrease (tcv, 6, DmgRed / 5)
                call DamageDecrease (tcv, 7, DmgRed / 5)
                call DamageDecrease (tcv, 8, DmgRed / 5)
                call DamageDecrease (tcv, 9, DmgRed / 5)
                if udg_Inv_Sens[tp] and udg_Camera_Lock[tp] > 0 then
                      call WindowTransition (tp, udg_Camera_Lock[tp], 0)
                endif
            endif


            if GetPlayerController(GetOwningPlayer(a)) == MAP_CONTROL_USER then
                call DamageDecrease (acv, 3, 0.05)
            endif

            if ( alv > dlv ) then
                set dmg = dmg * ( 1 + ( alv - dlv ) / 100.00 )
            else
                set dmg = dmg / ( 1.00 + ( dlv - alv ) / 120.00)
            endif

            if udg_Global_Act_Id[acv] > 0 then
              set rnd = GetRandomInt(0, 99)
              if udg_Global_Act_Id[acv] == 1 then
                 if rnd < 5 then
                    set dmg = dmg * 2
                    call DestroyEffect(AddSpecialEffectTarget(EFFECT(1), t, "origin"))
                    if GetUnitState(a, UNIT_STATE_MAX_LIFE)*0.05 > GetWidgetLife(a) then
                       call SetWidgetLife(a, 1)         
                    else
                       call SetWidgetLife(a, GetWidgetLife(a)-(GetUnitState(a, UNIT_STATE_MAX_LIFE)*0.05)) 
                    endif
                 endif
               elseif udg_Global_Act_Id[acv] == 2 then
                 if rnd < 5 then
                    call AddOT (a, a, -1, R2I(GetUnitState(a, UNIT_STATE_MAX_LIFE)*0.1), 20)
                 endif
               elseif udg_Global_Act_Id[acv] == 3 then
                 if rnd < 5 then
                    call AddOT (a, t, 0, udg_Stat_Dmg[acv]+50, 20)
                 endif
               elseif udg_Global_Act_Id[acv] == 4 then
                 if rnd < 5 then
                    call AddUnitBuff (a, 6, 25, 5, 0, 0)
                    call AddUnitBuff (a, 7, -25, 5, 0, 0)
                 endif
               elseif udg_Global_Act_Id[acv] == 5 then
                 if rnd < 5 then
                    call AddUnitBuff (a, 9, 13, 6, 0, 0)
                    call AddUnitBuff (a, 10, 13, 6, 0, 0)
                 endif
               elseif udg_Global_Act_Id[acv] == 6 then
                 if rnd < 5 then
                    call AddUnitBuff (t, 7, -15, 5, 0, 0)
                 endif
               elseif udg_Global_Act_Id[acv] == 7 then
                 if rnd < 5 then
                    call AddUnitBuff (a, 11, 100, 4, 0, 0)
                 endif
               elseif udg_Global_Act_Id[acv] == 8 then
                 if rnd < 5 then
                    call AddUnitBuff (a, 15, R2I(udg_Stat_Pdef[acv]*0.6), 20, 0, 0)
                    call AddUnitBuff (a, 16, R2I(udg_Stat_Mdef1[acv]*0.6), 20, 0, 0)
                    call AddUnitBuff (a, 17, R2I(udg_Stat_Mdef2[acv]*0.6), 20, 0, 0)
                    call AddUnitBuff (a, 18, R2I(udg_Stat_Mdef3[acv]*0.6), 20, 0, 0)
                    call AddUnitBuff (a, 19, R2I(udg_Stat_Mdef4[acv]*0.6), 20, 0, 0)
                    call AddUnitBuff (a, 20, R2I(udg_Stat_Mdef5[acv]*0.6), 20, 0, 0)
                 endif
               elseif udg_Global_Act_Id[acv] == 9 then
                 if rnd < 25 then
                    call AddUnitBuff (a, 5, 50, 4, 0, 0)
                 endif
              endif
            endif
    call DisplayTextToPlayer(Player(0),0,0,"2-->amount"+R2S(udg_DamageEventAmount)+" dmg"+R2S(dmg))

            if GetRandomReal(0.00, 100) <= crit and udg_DamageTypeDOT == 0 and dmg > 0 then
                set dmg = dmg * critdmg / 100.00
                call FT (Player(ap - 1), Player(tp - 1), I2S(R2I(dmg)), 1.5, t, 10, 255, 0, 0, 200)
            else
                call FT (Player(ap - 1), Player(tp - 1), I2S(R2I(dmg)), 0.8, t, 15, 179, 255, 51, 200)
            endif

            if udg_DamageTypeDOT == 0 and dmg > 5 then
                if ls > 0 then
                    set r = dmg * ls / 100.00
                    set ls = GetWidgetLife(a) + r
                    call DisplayTextToPlayer(Player(0),0,0,"ls"+R2S(r))
                    call SetWidgetLife(a, ls )
                    if r > 0.99 then
                        call FT_Ex (Player(ap - 1), Player(tp - 1), "+" + I2S(R2I(r)), 0.8, a, 15, 255, 30, 30, 200, 0)
                    endif
                endif
                if ms > 0 then
                    set r = dmg * ms / 100.00
                    set ms = GetUnitState(a, UNIT_STATE_MANA) + r
                    call SetUnitState(a, UNIT_STATE_MANA, ms )
                    if r > 0.99 then
                        call FT_Ex (Player(ap - 1), Player(tp - 1), "+" + I2S(R2I(r)), 0.8, a, 15, 30, 30, 255, 200, 180)
                    endif
                endif
                if ref > 0 then
                    set udg_DamageEventType = 1
                    set dmgaddon = dmg * ref / 100.00
                    call UnitDamageTarget(t, a, dmgaddon, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                    if dmgaddon > 0.99 then
                        call FT_Ex (Player(ap - 1), Player(tp - 1), I2S(R2I(dmgaddon)), 1, t, 13, 70, 255, 30, 200, 270)
                    endif
                endif
            endif
        endif
    endif

    set udg_DamageEventAmount = dmg

    set udg_DamageEventOverride = false

    if udg_CombatTimer[tcv] < 1 then
        set udg_CombatTimer[tcv] = 10
        set udg_CombatIndex = udg_CombatIndex + 1
        set udg_CombatI2CV[udg_CombatIndex] = tcv
        call StatRefresh (tcv)
        if udg_Camera_Lock[tp] == 1 then
            call ShowStat (tp)
        endif
    else
        set udg_CombatTimer[tcv] = 10
    endif

    if udg_CombatTimer[acv] < 1 then
        set udg_CombatTimer[acv] = 10
        set udg_CombatIndex = udg_CombatIndex + 1
        set udg_CombatI2CV[udg_CombatIndex] = acv
        call StatRefresh (acv)
        if udg_Camera_Lock[ap] == 1 then
           call ShowStat (ap)
        endif
    else
        set udg_CombatTimer[acv] = 10
    endif

    call DisplayTextToPlayer(Player(0),0,0,"3-->amount"+R2S(udg_DamageEventAmount)+" dmg"+R2S(dmg))
    set udg_DamageTypeDOT = 0

    set a = null
    set t = null
endfunction

//===========================================================================
function InitTrig_Set_Damage takes nothing returns nothing
    set gg_trg_Set_Damage = CreateTrigger( )
    call TriggerRegisterVariableEvent( gg_trg_Set_Damage, "udg_DamageModifierEvent", EQUAL, 1.00 )
    call TriggerRegisterVariableEvent( gg_trg_Set_Damage, "udg_DamageModifierEvent", EQUAL, 2.00 )
    call TriggerAddCondition( gg_trg_Set_Damage, Condition( function Trig_Set_Damage_Conditions ) )
    call TriggerAddAction( gg_trg_Set_Damage, function Trig_Set_Damage_Actions )
endfunction
 
Status
Not open for further replies.
Top