Skip to content

Commit

Permalink
Fix potion fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hekili committed Sep 22, 2024
1 parent 5c61d30 commit 6ea69f5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
8 changes: 6 additions & 2 deletions Classes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2374,6 +2374,8 @@ do
for _, potion in ipairs( exp_potions ) do
local potionItem = Item:CreateFromItemID( potion.items[ #potion.items ] )

-- all:RegisterAbility( potion.name, {} ) -- Create stub.

potionItem:ContinueOnItemLoad( function()
all:RegisterAbility( potion.name, {
name = potionItem:GetItemName(),
Expand All @@ -2397,6 +2399,8 @@ do
end,
} )

class.abilities[ potion.name ] = all.abilities[ potion.name ]

class.potions[ potion.name ] = {
name = potionItem:GetItemName(),
link = potionItem:GetItemLink(),
Expand Down Expand Up @@ -2458,15 +2462,15 @@ do
if state.args.potion and class.abilities[ state.args.potion ] then return class.abilities[ state.args.potion ].item end
if settings.potion and class.abilities[ settings.potion ] then return class.abilities[ settings.potion ].item end
if first_potion and class.abilities[ first_potion ] then return class.abilities[ first_potion ].item end
return class.abilities.elemental_potion_of_power.item
return 191387
end,
bagItem = true,

handler = function ()
local use = all.abilities.potion
use = use and use.consumable

if use ~= "global_cooldown" then
if use and use ~= "global_cooldown" then
class.abilities[ use ].handler()
setCooldown( use, action[ use ].cooldown )
end
Expand Down
17 changes: 13 additions & 4 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,19 @@ function Hekili:GetPredictionFromAPL( dispName, packName, listName, slot, action
if not usePotion or not class.abilities[ usePotion ] then usePotion = class.specs[ specID ].options.potion end
if not usePotion or not class.abilities[ usePotion ] then usePotion = "elemental_potion_of_power" end

action = class.abilities[ usePotion ] and class.abilities[ usePotion ].key or "elemental_potion_of_power"
ability = class.abilities[ action ]
state.this_action = action
entryReplaced = true
if not class.abilities[ usePotion ] then
action = nil
ability = nil
state.this_action = "wait"
action = class.abilities[ usePotion ].key
ability = class.abilities[ action ]
state.this_action = action
else
action = class.abilities[ usePotion ] and class.abilities[ usePotion ].key or "elemental_potion_of_power"
ability = class.abilities[ action ]
state.this_action = action
entryReplaced = true
end
end

rDepth = rDepth + 1
Expand Down
8 changes: 0 additions & 8 deletions Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,6 @@ local oneTimeFixes = {
havoc.date = 20240727
havoc.version = 20240727
end
end,

resetPotionsIfBroke = function( p )
for _, spec in pairs( p.specs ) do
if spec.potion ~= "default" and not class.potionList[ spec.potion ] then spec.potion = "default" end
end

p.runOnce.resetPotionsIfBroke = nil
end
}

Expand Down

0 comments on commit 6ea69f5

Please sign in to comment.