Skip to content

Commit

Permalink
Fix #2822: Endless loop for classes using Best Mana Potion item.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hekili committed Oct 13, 2023
1 parent d284077 commit 925627c
Show file tree
Hide file tree
Showing 9 changed files with 345 additions and 3 deletions.
10 changes: 7 additions & 3 deletions State.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2284,10 +2284,12 @@ do
end
end

-- Check for globals before variables/settings/toggles.
if _G[ k ] ~= nil then return _G[ k ] end

if t:GetVariableIDs( k ) then return t.variable[ k ] end
if t.settings[ k ] ~= nil then return t.settings[ k ] end
if t.toggle[ k ] ~= nil then return t.toggle[ k ] end
if _G[ k ] ~= nil then return _G[ k ] end

if k ~= "scriptID" then
Hekili:Error( "Returned unknown string '" .. k .. "' in state metatable [" .. t.scriptID .. "].\n\n" .. debugstack() )
Expand Down Expand Up @@ -2727,8 +2729,10 @@ local mt_settings = {

if ability then
local item = ability.item or 0
if item > 0 and t.spec.items[ state.this_action ] ~= nil then return t.spec.items[ state.this_action ][ k ]
elseif not ability.item and t.spec.abilities[ state.this_action ] ~= nil then return t.spec.abilities[ state.this_action ][ k ] end
if item > 0 then
if t.spec.items[ state.this_action ] ~= nil then return t.spec.items[ state.this_action ][ k ]
elseif t.spec.abilities[ state.this_action ] ~= nil then return t.spec.abilities[ state.this_action ][ k ] end
end
end
end

Expand Down
10 changes: 10 additions & 0 deletions Wrath Plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# New Expressions

Test!

| Type | Expression | Definition | Notes
|-|-|-|-
| Death Knight | `change_presence` | Enabled: Can recommend changing to a different presence when a presence is up.<br/>Disabled: Will not recommend changing presence (respects your presence choice).<br/>Default: Disabled. | By default, the addon trusts that you want to be in your current presence, if you have a current presence.
| Action Argument | `precombat_seconds` | If a pull timer has been activated, the precombat recommendation will *not* be available until the pull timer has expired.
| Action Argument | `casts` | The action entry cannot be used if the action has been used this number of times.
| Expression | `casts`<br/>`action.X.casts` | The number of times that ability `X` has been used in combat. This count resets after an encounter ends (boss fights) or the player is out of combat for 10 seconds or more. | If moving from pack to pack, the opener will not retrigger unless you start an encounter or fall out of combat for 10+ seconds.
78 changes: 78 additions & 0 deletions Wrath/APLs 2.0/DeathKnight-Blood-wowtbc.simc
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Blood DK
# https://wowtbc.gg/wotlk/class-guides/blood-tank-death-knight/
# 2023-09-12

## Opener
# Use Frost Presence
actions.precombat+=/frost_presence,if=change_presence
# Use Death and Decay 10 seconds before pull for Runic Power.
actions.precombat+=/death_and_decay,precombat_seconds=10
# Use Army of the Dead 6 seconds before pull.
actions.precombat+=/army_of_the_dead,precombat_seconds=6
# Horn of Winter pre-pull.
actions.precombat+=/horn_of_winter
# Use Pre-pot Indestructible Potion.
actions.precombat+=/indestructible_potion
# Use Rune Strike to avoid capping on Runic Power.

## Default
actions+=/rune_strike,if=runic_power.deficit<20
# Use Icy Touch.
actions+=/icy_touch,if=use_count=0
# Use Icy Touch.
actions+=/icy_touch,if=use_count=1
# Use Blood Tap.
actions+=/blood_tap,if=use_count=0
# Use Icy Touch.
actions+=/icy_touch,if=use_count=2
# Use Empower Rune Weapon.
actions+=/empower_rune_weapon,if=use_count=0
# Use Icy Touch.
actions+=/icy_touch,if=use_count=3
# Use Icy Touch.
actions+=/icy_touch,if=use_count=4
# Use Icy Touch.
actions+=/icy_touch,if=use_count=5
# Use Plague Strike.
actions+=/plague_strike,if=use_count=0
# Use Blood Strke.
actions+=/blood_strike,if=use_count=0
# Proceed with normal priorities.
actions+=/run_action_list,name=aoe,if=active_enemies>1
## Single Target
# Use Frost Presence.
actions+=/frost_presence,if=change_presence
# Maintain Horn of Winter if assigned (check for equivalent buffs).
actions+=/horn_of_winter,if=refreshable
# Use Blood Tap.
actions+=/blood_tap
# Use Empower Rune Weapon
actions+=/empower_rune_weapon
# Use (i) Hysteria on a physical DPS.
actions+=/hysteria
# Use Rune Strike to avoid capping on Runic Power.
actions+=/rune_strike,if=runic_power.deficit<20
# Maintain Blood Plague and Frost Fever with Pestilence.
actions+=/pestilence,if=dot.blood_plague.ticking&dot.blood_plague.refreshable&dot.frost_fever.ticking&dot.frost_fever.refreshable
# Use Icy Touch. This is your highest threat ability. Try to use the Death Runes generated from Death Rune Mastery after using a# Death Strike.
actions+=/icy_touch
# Use Death Strike to heal yourself.
actions+=/death_strike,if=health.pct<death_strike_threshold
# Use Blood Strike to maintain Blade Barrier.
actions+=/blood_strike,if=talent.blade_barrier.enabled&blood_runes.time_to_1<gcd

## AOE
# Use Death and Decay.
actions.aoe+=/death_and_decay
# Use Icy Touch.
# Use Plague Strike.
# Use Pestilence to spread the diseases.
# Proceed with normal priorities and use Blood Boil instead of Heart Strike whenever possible.

## Defensive Cooldowns
# Rune Tap.
# Vampiric Blood.
# Icebound Fortitude.
# Anti-Magic Shell.
# Death Pact on the ghouls from Army of the Dead or Raise Dead.
# Mark of Blood if talented.
53 changes: 53 additions & 0 deletions Wrath/APLs 2.0/DeathKnight-BloodPesti.simc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# DeathKnightBlood: Blood Pesti APL
# https://wowsims.github.io/wotlk/deathknight/#
# September 2023

## Precombat
actions.precombat+=/unholy_presence,precombat_seconds=20,if=change_presence
actions.precombat+=/army_of_the_dead,precombat_seconds=10
actions.precombat+=/blood_presence,precombat_seconds=6,if=change_presence
# TODO: Check requirements re: overwriting other HoWs.
actions.precombat+=/horn_of_winter,precombat_seconds=1.5,if=refreshable
actions.precombat+=/potion_of_speed,precombat_seconds=1
actions.precombat+=/unholy_frenzy
actions.precombat+=/hyperspeed_acceleration
# Or other racials?
actions.precombat+=/berserking

## Default
actions+=/mind_freeze
# Cast any other cooldowns (Racials) if they are not specified in this priority.
actions+=/other_cooldowns
# Use any trinkets that aren't otherwise specified.
actions+=/use_items
# If we haven't used Heart Strike 4 times and we're in the first 10 seconds of the fight, process the opener.
actions+=/call_action_list,strict=1,if=action.heart_strike.casts<4&time<10
actions+=/icy_touch,if=!dot.frost_fever.ticking
actions+=/plague_strike,if=!dot.blood_plague.ticking
actions+=/pestilence,if=dot.frost_fever.ticking&dot.frost_fever.remains<1.5
actions+=/unholy_frenzy,if=cooldown.dancing_rune_weapon.ready
actions+=/berserking,if=cooldown.dancing_rune_weapon.ready
actions+=/hyperspeed_acceleration,if=cooldown.dancing_rune_weapon.ready
actions+=/potion_of_speed,if=cooldown.dancing_rune_weapon.ready&(buff.unholy_frenzy.up|boss&cooldown.unholy_frenzy.remains>fight_remains)
actions+=/raise_dead,if=cooldown.dancing_rune_weapon.ready
actions+=/dancing_rune_weapon
actions+=/pestilence,if=blood_runes.time_to_1>dot.frost_fever.remains
actions+=/heart_strike
actions+=/death_strike
actions+=/death_coil,if=!cooldown.dancing_rune_weapon.ready
actions+=/horn_of_winter

## Opener
actions.opener+=/icy_touch,casts=1
actions.opener+=/plague_strike,casts=1
actions.opener+=/death_strike,casts=1
actions.opener+=/heart_strike,casts=2
actions.opener+=/raise_dead,casts=1
actions.opener+=/empower_rune_weapon,casts=1
actions.opener+=/dancing_rune_weapon,casts=1
actions.opener+=/death_strike,casts=2
actions.opener+=/heart_strike,casts=3
## Wait 1.5 seconds... ?
actions.opener+=/blood_tap,casts=1
actions.opener+=/heart_strike,casts=4

48 changes: 48 additions & 0 deletions Wrath/APLs 2.0/DeathKnight-FrostBLPesti.simc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# DeathKnightBlood: Frost BL Pesti APL
# https://wowsims.github.io/wotlk/deathknight/#
# September 2023

## Precombat
actions.precombat+=/unholy_presence,precombat_seconds=20,if=change_presence
actions.precombat+=/army_of_the_dead,precombat_seconds=10
actions.precombat+=/blood_presence,precombat_seconds=6,if=change_presence
actions.precombat+=/potion_of_speed,precombat_seconds=1

## Default
actions+=/mind_freeze
# Cast any other cooldowns (i.e., Racials) if they are not specified in this priority.
actions+=/use_cooldowns
# Use any trinkets that aren't otherwise specified.
actions+=/use_items
# If we haven't used Obliterate 4 times and we're in the first 10 seconds of the fight, process the opener.
actions+=/call_action_list,strict=1,if=action.obliterate.casts<4&(action.raise_dead.casts<1|cooldown.raise_dead.remains>0)&time<10
actions+=/icy_touch,if=!dot.frost_fever.ticking
actions+=/plague_strike,if=!dot.blood_plague.ticking
actions+=/pestilence,if=dot.frost_fever.ticking&dot.frost_fever.remains<1.5
actions+=/blood_fury,if=cooldown.unbreakable_armor.ready
actions+=/hyperspeed_acceleration,if=cooldown.unbreakable_armor.ready
actions+=/potion_of_speed,if=cooldown.unbreakable_armor.ready
actions+=/unbreakable_armor
actions+=/blood_tap,if=prev_off_gcd.1.unbreakable_armor
actions+=/pestilence,if=dot.frost_fever.ticking&dot.frost_fever.remains<4
actions+=/howling_blast,if=buff.freezing_fog.up
actions+=/obliterate
actions+=/raise_dead
actions+=/blood_strike
actions+=/frost_strike

## Opener
actions.opener+=/icy_touch,casts=1
actions.opener+=/plague_strike,casts=1
actions.opener+=/unbreakable_armor,casts=1
actions.opener+=/hyperspeed_acceleration,casts=1
actions.opener+=/blood_fury,casts=1
actions.opener+=/blood_tap,casts=1
actions.opener+=/obliterate,casts=1
actions.opener+=/frost_strike,casts=1
actions.opener+=/pestilence,casts=1
actions.opener+=/empower_rune_weapon,casts=1
actions.opener+=/obliterate,casts=2
actions.opener+=/frost_strike,casts=2
actions.opener+=/obliterate,casts=4
actions.opener+=/raise_dead,casts=1
48 changes: 48 additions & 0 deletions Wrath/APLs 2.0/DeathKnight-FrostUHPesti.simc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# DeathKnightBlood: Frost UH Pesti APL
# https://wowsims.github.io/wotlk/deathknight/#
# September 2023

## Precombat
actions.precombat+=/unholy_presence,precombat_seconds=20,if=change_presence
actions.precombat+=/army_of_the_dead,precombat_seconds=10
actions.precombat+=/blood_presence,precombat_seconds=6,if=change_presence
actions.precombat+=/potion_of_speed,precombat_seconds=1

## Default
actions+=/mind_freeze
# Cast any other cooldowns (i.e., Racials) if they are not specified in this priority.
actions+=/use_cooldowns
# Use any trinkets that aren't otherwise specified.
actions+=/use_items
# If we haven't used Obliterate 4 times and we're in the first 10 seconds of the fight, process the opener.
actions+=/call_action_list,strict=1,if=action.obliterate.casts<4&(action.raise_dead.casts<1|cooldown.raise_dead.remains>0)&time<10
actions+=/icy_touch,if=!dot.frost_fever.ticking
actions+=/plague_strike,if=!dot.blood_plague.ticking
actions+=/pestilence,if=dot.frost_fever.ticking&dot.frost_fever.remains<1.5
actions+=/blood_fury,if=cooldown.unbreakable_armor.ready
actions+=/hyperspeed_acceleration,if=cooldown.unbreakable_armor.ready
actions+=/potion_of_speed,if=cooldown.unbreakable_armor.ready
actions+=/unbreakable_armor
actions+=/blood_tap,if=prev_off_gcd.1.unbreakable_armor
actions+=/pestilence,if=dot.frost_fever.ticking&dot.frost_fever.remains<8.5
actions+=/howling_blast,if=buff.freezing_fog.up
actions+=/obliterate
actions+=/raise_dead
actions+=/blood_strike
actions+=/frost_strike

## Opener
actions.opener+=/icy_touch,casts=1
actions.opener+=/plague_strike,casts=1
actions.opener+=/unbreakable_armor,casts=1
actions.opener+=/hyperspeed_acceleration,casts=1
actions.opener+=/blood_fury,casts=1
actions.opener+=/blood_tap,casts=1
actions.opener+=/obliterate,casts=1
actions.opener+=/frost_strike,casts=1
actions.opener+=/blood_strike,casts=1
actions.opener+=/empower_rune_weapon,casts=1
actions.opener+=/obliterate,casts=2
actions.opener+=/frost_strike,casts=2
actions.opener+=/obliterate,casts=4
actions.opener+=/raise_dead,casts=1
32 changes: 32 additions & 0 deletions Wrath/APLs 2.0/DeathKnight-Unholy2HSS.simc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# DeathKnightBlood: Unholy 2H SS APL
# https://wowsims.github.io/wotlk/deathknight/#
# September 2023

## Precombat
actions.precombat+=/unholy_presence,precombat_seconds=10,if=change_presence
actions.precombat+=/ghoul_frenzy,precombat_seconds=8
actions.precombat+=/horn_of_winter,precombat_seconds=1.5
actions.precombat+=/potion_of_speed,precombat_seconds=1

## Default
actions+=/mind_freeze
# Cast any other cooldowns (i.e., Racials) if they are not specified in this priority.
actions+=/use_cooldowns
# Use any trinkets that aren't otherwise specified.
actions+=/use_items
actions+=/icy_touch,if=dot.frost_fever.remains<3
actions+=/plague_strike,if=dot.blood_plague.remains<3
actions+=/blood_strike,if=buff.desolation.down
actions+=/berserking,if=buff.summon_gargoyle.up
actions+=/hyperspeed_acceleration,if=buff.summon_gargoyle.up|cooldown.summon_gargoyle.remains>50
actions+=/potion_of_speed,if=buff.summon_gargoyle.up|boss&cooldown.summon_gargoyle.remains>fight_remains
actions+=/army_of_the_dead,if=buff.summon_gargoyle.up
actions+=/blood_tap,if=buff.ghoul_frenzy.down&!blood_runes.left_ready
actions+=/ghoul_frenzy,if=blood_runes.left_death&buff.ghoul_frenzy.down&unholy_runes.all_death
actions+=/scourge_strike
actions+=/blood_strike
actions+=/empower_rune_weapon,if=buff.summon_gargoyle.up
actions+=/summon_gargoyle
actions+=/death_coil,if=cooldown.summon_gargoyle.remains
actions+=/blood_presence,if=change_presence&buff.unholy_presence.up&cooldown.summon_gargoyle.remains>0&buff.summon_gargoyle.down
actions+=/horn_of_winter
34 changes: 34 additions & 0 deletions Wrath/APLs 2.0/DeathKnight-UnholyDNDAOE.simc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# DeathKnightBlood: Unholy DND AOE APL
# https://wowsims.github.io/wotlk/deathknight/#
# September 2023

## Precombat
actions.precombat+=/unholy_presence,precombat_seconds=10,if=change_presence
actions.precombat+=/ghoul_frenzy,precombat_seconds=8
actions.precombat+=/horn_of_winter,precombat_seconds=1.5
actions.precombat+=/potion_of_speed,precombat_seconds=1

## Default
actions+=/mind_freeze
# Cast any other cooldowns (i.e., Racials) if they are not specified in this priority.
actions+=/use_cooldowns
# Use any trinkets that aren't otherwise specified.
actions+=/use_items
actions+=/icy_touch,if=dot.frost_fever.remains<3
actions+=/plague_strike,if=dot.blood_plague.remains<3
actions+=/blood_strike,if=buff.desolation.down
actions+=/berserking,if=buff.summon_gargoyle.up
actions+=/hyperspeed_acceleration,if=buff.summon_gargoyle.up|cooldown.summon_gargoyle.remains>50
actions+=/potion_of_speed,if=buff.summon_gargoyle.up|boss&cooldown.summon_gargoyle.remains>fight_remains
actions+=/empower_rune_weapon,if=buff.summon_gargoyle.up
actions+=/army_of_the_dead,if=buff.summon_gargoyle.up
actions+=/death_and_decay
actions+=/scourge_strike,if=cooldown.death_and_decay.remains>6
actions+=/pestilence,if=dot.frost_fever.ticking&active_dot.frost_fever<active_enemies
actions+=/blood_strike,if=cooldown.death_and_decay.remains>6&buff.desolation.remains<10
actions+=/summon_gargoyle
actions+=/death_coil,if=cooldown.summon_gargoyle.remains
actions+=/blood_tap
actions+=/ghoul_frenzy,if=prev_off_gcd.1.blood_tap
actions+=/blood_presence,if=change_presence&buff.unholy_presence.up&cooldown.summon_gargoyle.remains>0&buff.summon_gargoyle.down
actions+=/horn_of_winter
35 changes: 35 additions & 0 deletions Wrath/APLs 2.0/DeathKnight-UnholyDWSS.simc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# DeathKnightBlood: Unholy DW SS APL
# https://wowsims.github.io/wotlk/deathknight/#
# September 2023

## Precombat
actions.precombat+=/unholy_presence,precombat_seconds=10,if=change_presence
actions.precombat+=/ghoul_frenzy,precombat_seconds=8
actions.precombat+=/horn_of_winter,precombat_seconds=1.5
actions.precombat+=/potion_of_speed,precombat_seconds=1

## Default
actions+=/mind_freeze
# Cast any other cooldowns (i.e., Racials) if they are not specified in this priority.
actions+=/use_cooldowns
# Use any trinkets that aren't otherwise specified.
actions+=/use_items
actions+=/icy_touch,if=dot.frost_fever.remains<3
actions+=/plague_strike,if=dot.blood_plague.remains<3
actions+=/blood_strike,if=buff.desolation.down
actions+=/berserking,if=buff.summon_gargoyle.up
actions+=/hyperspeed_acceleration,if=buff.summon_gargoyle.up|cooldown.summon_gargoyle.remains>50
actions+=/potion_of_speed,if=buff.summon_gargoyle.up|boss&cooldown.summon_gargoyle.remains>fight_remains
actions+=/army_of_the_dead,if=buff.summon_gargoyle.up&!cooldown.empower_rune_weapon.remains>0&frost_runes.non_death=1
actions+=/scourge_strike,if=buff.unholy_force.down&cooldown.summon_gargoyle.ready
actions+=/death_and_decay
actions+=/army_of_the_dead,if=buff.summon_gargoyle.up
actions+=/blood_strike,if=cooldown.death_and_decay.remains>6|cooldown.empower_rune_weapon.ready|buff.desolation.remains<10|buff.unholy_might.icd_remains=0
actions+=/blood_boil,if=cooldown.death_and_decay.remains>6|cooldown.empower_rune_weapon.ready
actions+=/empower_rune_weapon,if=buff.summon_gargoyle.up
actions+=/summon_gargoyle
actions+=/death_coil,if=cooldown.summon_gargoyle.remains
actions+=/blood_tap
actions+=/ghoul_frenzy,if=prev_off_gcd.1.blood_tap
actions+=/blood_presence,if=change_presence&buff.unholy_presence.up&cooldown.summon_gargoyle.remains>0&buff.summon_gargoyle.down
actions+=/horn_of_winter

0 comments on commit 925627c

Please sign in to comment.