Untitled

 avatar
unknown
plain_text
6 months ago
2.3 kB
3
Indexable
local function SpreadMarkOfTheCrane(mainTarget, icon)
    local maxTargets = 8
    local markedTargets = 0
    local needSpread = false
    local activeUnitPlates = MultiUnits:GetActiveUnitPlates()
    local totalTargets = 0

    if not UnitExists("focus") and UnitExists("target") then
        return A.SetFocus:Show(icon)
    end

    for unitID in pairs(activeUnitPlates) do
        if Unit(unitID):GetRange() <= 8 and UnitCanAttack("player", unitID) and not Unit(unitID):IsDead() then
            totalTargets = totalTargets + 1
            if Unit(unitID):HasDeBuffs(A.MarkoftheCraneDebuff.ID) > 0 then
                markedTargets = markedTargets + 1
            else
                needSpread = true
            end
        end
    end

    if markedTargets >= math.min(totalTargets, maxTargets) then
        if UnitGUID("target") ~= UnitGUID("focus") then
            return A.TargetFocus:Show(icon)
        end
        return false
    end

    if needSpread and Unit("target"):GetRange() <= 8 
    and Unit("target"):HasDeBuffs(A.MarkoftheCraneDebuff.ID) == 0 
    and UnitCanAttack("player", "target")
    and not Unit("target"):IsDead() and A.TigerPalm:IsInRange("target")
    then
      
        if A.BlackoutKick:IsReady("target") 
        and ComboStrike(A.BlackoutKick)
        and (Player:Chi() >= 1 or Unit(player):HasBuffs(A.BlackoutKickBuff.ID) > 0)
        then
            return A.BlackoutKick:Show(icon)
        end

      
        if A.TigerPalm:IsReady("target")
        and ComboStrike(A.TigerPalm)
        and Player:ChiDeficit() >= 2
        and Player:Energy() >= (A.InnerPeace:GetTalentTraits() > 0 and 55 or 60)
        then
            return A.TigerPalm:Show(icon)
        end

    
        if A.RisingSunKick:IsReady("target")
        and ComboStrike(A.RisingSunKick)
        and Player:Chi() >= 2
        then
            return A.RisingSunKick:Show(icon)
        end
    end

    if needSpread and markedTargets < math.min(totalTargets, maxTargets) then
        -- Check mouseover first
        if UnitExists("mouseover") 
        and Unit("mouseover"):GetRange() <= 8 
        and Unit("mouseover"):HasDeBuffs(A.MarkoftheCraneDebuff.ID) == 0 
        then
            return A.TargetMouseOver:Show(icon)
        end
        
        return A.TargetEnemy:Show(icon)
    end

    return false
end
Editor is loading...
Leave a Comment