seblindfors / ConsolePort

ConsolePort - Game Controller Addon for World of Warcraft
Artistic License 2.0
172 stars 40 forks source link

Penance attempts to cast on friendly units when using raid cursor and not specced into The Penitent #22

Closed GingerbreadFred closed 2 years ago

GingerbreadFred commented 8 years ago

I started experimenting with the raid cursor last night and found the above issue. I have bodged the code around a bit to force it to work but not something I would really want to put into a pull request. The fix I made was to change the refresh actions delegate in UnitFrames.lua to the following

RefreshActions = [=[
    Helpful = wipe(Helpful)
    Harmful = wipe(Harmful)
    for actionButton in pairs(Actions) do
            local action = actionButton:GetAttribute("action")

            if self:RunAttribute("IsHelpfulAction", action) then
                Helpful[actionButton] = true
            elseif self:RunAttribute("IsHarmfulAction", action) then
                Harmful[actionButton] = true
            else
                -- Remove this line to fix issue with penance attempting to 
                -- cast on friendly units, it seems IsHarmfulAction and IsHelpfulAction both
                -- return false
                -- Helpful[actionButton] = true
                Harmful[actionButton] = true
            end
        end
    ]=]

Obviously not an ideal fix as the issue seems to be with Blizzards API for the spell being harmful or not after taking a deeper look at what IsHelpful and IsHarmful action actually do

seblindfors commented 8 years ago

Penance was an especially tricky spell before the Legion overhaul because it could target both enemies and friendlies and was a direct spell cast. Seems to me the API doesn't reflect whether you're specced for friendlies or not.

I'll check it out later and see how it fits in with other classes. The secure environment is unfortunately very limited in how much we can determine where a spell is applicable.

What you can do to prevent it should this change not come to fruition is just make a macro: /cast [@target] Penance