True Strike & Orb of Anihilation

Status
Not open for further replies.
Hello,

I tried to make a True Strike (=never miss) ability for an item in my map. I tried the 2 well known ways:
- Critical Strike with 100% chance / 0,0 damage multiplier / Never miss = true / Targets allowed = air, ennemy, ground
- Bash with 100% chance / 0,0 damage bonus / Never miss = true / Targets allowed = air, ennemy, ground

Both work fine in normal condition.
But it bugs if the hero has an orb of anihilation skill (auto-attack with AOE damage) : visualy everything is fine, but damages are no more AOE, just single target.

Any idea on how to have both True Strike & Orb of Anihilation together ? :)
 
Level 20
Joined
May 16, 2012
Messages
635
Trigger the orb of annihilation effect like this:

JASS:
scope OrbOfAnnihilation initializer Init

private function Conditions takes nothing returns boolean
    local unit source = GetEventDamageSource()
    local unit target = BlzGetEventDamageTarget()
    local group g
    local unit v

    //I000 is just for the example, use your item Id
    if(UnitHasItemOfTypeBJ(source, 'I000') and BlzGetEventDamageType() == DAMAGE_TYPE_NORMAL) then //DAMAGE_TYPE_NORMAL means it will only trigger for auto attacks
        set g = CreateGroup

        //DesiredAoE is obvious
        call GroupEnumUnitsInRange(g, GetUnitX(target), GetUnitY(target), DesiredAoE, null)
        loop
            set v = FirstOfGroup(g)
            exitwhen v == null
                //if you haven't already than you going to need to declare the UnitAlive native function in your map header like this
                //native UnitAlive takes unit id returns boolean, its the safest way to check if a unit is alive or dead
                //ofcourse you can modify the following filter of targets
                if(IsUnitEnemy(v, GetOwningPlayer(source)) and v != target  and UnitAlive(v) and not IsUnitType(v, UNIT_TYPE_STRUCTURE)) then
                    //DesiredDamage is obvious as well, nd here is very important that you do not use DAMAGE_TYPE_NORMAL because it will cause an infinite loop in the trigger
                    call UnitDamageTarget(source, v, DesiredDamage, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_UNIVERSAL, null)
                endif
                call GroupRemoveUnit(g, v)
        endloop
        call DestroyGroup(g)
    endif

    set g = null
    set v = null
    set source = null
    set target = null
    return false
endfunction
//===========================================================================
private function Init takes nothing returns nothing
    set gg_trg_OrbOfAnnihilation = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_OrbOfAnnihilation, EVENT_PLAYER_UNIT_DAMAGED)
    call TriggerAddCondition(gg_trg_OrbOfAnnihilation, Condition(function Conditions))
endfunction

endscope
 
Status
Not open for further replies.
Top