From ebce10eed5db3bf433a0527d43f2071b33cce915 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Tue, 26 Jan 2021 02:37:48 -0500 Subject: [PATCH] fix(druid): fix problems with guardian druid script (#827) (#830) * fix(simulationcraft): improve druid GetInMaleeRange() function Don't use wild_charge, and instead use wild_charge_bear when in Bear form and wild_charge_cat when in Cat form. * fix(druid): regenerate scripts with fixed GetInMeleeRange() function Fixes issue #827. * fix(spellbook): verify parameters to IsSpellKnown() The WoW API function IsSpellKnown() only accepts spell IDs greater than zero as a vaild parameter, otherwise it throws an error. --- src/scripts/ovale_druid.ts | 45 +++++++++++++++++++++++--------- src/simulationcraft/generator.ts | 15 ++++++++--- src/states/SpellBook.ts | 14 +++++----- 3 files changed, 52 insertions(+), 22 deletions(-) diff --git a/src/scripts/ovale_druid.ts b/src/scripts/ovale_druid.ts index c5bd21f5e..8a7c56337 100644 --- a/src/scripts/ovale_druid.ts +++ b/src/scripts/ovale_druid.ts @@ -898,10 +898,18 @@ AddFunction feraluseitemactions AddFunction feralgetinmeleerange { - if checkboxon(opt_melee_range) and stance(druid_bear_form) and not target.inrange(mangle) or { stance(druid_cat_form) or stance(druid_claws_of_shirvallah) } and not target.inrange(shred) + if checkboxon(opt_melee_range) { - if target.inrange(wild_charge) spell(wild_charge) - texture(misc_arrowlup help=(l(not_in_melee_range))) + if stance(druid_bear_form) and not target.inrange(mangle) + { + if target.inrange(wild_charge_bear) spell(wild_charge_bear) + texture(misc_arrowlup help=(l(not_in_melee_range))) + } + if (stance(druid_cat_form) or stance(druid_claws_of_shirvallah)) and not target.inrange(shred) + { + if target.inrange(wild_charge_cat) spell(wild_charge_cat) + texture(misc_arrowlup help=(l(not_in_melee_range))) + } } } @@ -1556,7 +1564,6 @@ AddIcon enabled=(checkboxon(opt_druid_feral_aoe) and specialization(feral)) help # tigers_fury # typhoon # war_stomp -# wild_charge # wild_charge_bear # wild_charge_cat `; @@ -1636,10 +1643,18 @@ AddFunction feraluseitemactions AddFunction feralgetinmeleerange { - if checkboxon(opt_melee_range) and stance(druid_bear_form) and not target.inrange(mangle) or { stance(druid_cat_form) or stance(druid_claws_of_shirvallah) } and not target.inrange(shred) + if checkboxon(opt_melee_range) { - if target.inrange(wild_charge) spell(wild_charge) - texture(misc_arrowlup help=(l(not_in_melee_range))) + if stance(druid_bear_form) and not target.inrange(mangle) + { + if target.inrange(wild_charge_bear) spell(wild_charge_bear) + texture(misc_arrowlup help=(l(not_in_melee_range))) + } + if (stance(druid_cat_form) or stance(druid_claws_of_shirvallah)) and not target.inrange(shred) + { + if target.inrange(wild_charge_cat) spell(wild_charge_cat) + texture(misc_arrowlup help=(l(not_in_melee_range))) + } } } @@ -2294,7 +2309,6 @@ AddIcon enabled=(checkboxon(opt_druid_feral_aoe) and specialization(feral)) help # tigers_fury # typhoon # war_stomp -# wild_charge # wild_charge_bear # wild_charge_cat `; @@ -2339,10 +2353,18 @@ AddFunction guardianuseitemactions AddFunction guardiangetinmeleerange { - if checkboxon(opt_melee_range) and stance(druid_bear_form) and not target.inrange(mangle) or { stance(druid_cat_form) or stance(druid_claws_of_shirvallah) } and not target.inrange(shred) + if checkboxon(opt_melee_range) { - if target.inrange(wild_charge) spell(wild_charge) - texture(misc_arrowlup help=(l(not_in_melee_range))) + if stance(druid_bear_form) and not target.inrange(mangle) + { + if target.inrange(wild_charge_bear) spell(wild_charge_bear) + texture(misc_arrowlup help=(l(not_in_melee_range))) + } + if (stance(druid_cat_form) or stance(druid_claws_of_shirvallah)) and not target.inrange(shred) + { + if target.inrange(wild_charge_cat) spell(wild_charge_cat) + texture(misc_arrowlup help=(l(not_in_melee_range))) + } } } @@ -2985,7 +3007,6 @@ AddIcon enabled=(checkboxon(opt_druid_guardian_aoe) and specialization(guardian) # tooth_and_claw_buff # typhoon # war_stomp -# wild_charge # wild_charge_bear # wild_charge_cat # wrath diff --git a/src/simulationcraft/generator.ts b/src/simulationcraft/generator.ts index 77bb55b85..1d6359ed5 100644 --- a/src/simulationcraft/generator.ts +++ b/src/simulationcraft/generator.ts @@ -678,10 +678,18 @@ export class Generator { const fmt = ` AddFunction %sGetInMeleeRange { - if CheckBoxOn(opt_melee_range) and Stance(druid_bear_form) and not target.InRange(mangle) or { Stance(druid_cat_form) or Stance(druid_claws_of_shirvallah) } and not target.InRange(shred) + if CheckBoxOn(opt_melee_range) { - if target.InRange(wild_charge) Spell(wild_charge) - Texture(misc_arrowlup help=L(not_in_melee_range)) + if Stance(druid_bear_form) and not target.InRange(mangle) + { + if target.InRange(wild_charge_bear) Spell(wild_charge_bear) + Texture(misc_arrowlup help=L(not_in_melee_range)) + } + if (Stance(druid_cat_form) or Stance(druid_claws_of_shirvallah)) and not target.InRange(shred) + { + if target.InRange(wild_charge_cat) Spell(wild_charge_cat) + Texture(misc_arrowlup help=L(not_in_melee_range)) + } } } `; @@ -697,7 +705,6 @@ export class Generator { annotation.functionTag[node.name] = "shortcd"; annotation.addSymbol("mangle"); annotation.addSymbol("shred"); - annotation.addSymbol("wild_charge"); annotation.addSymbol("wild_charge_bear"); annotation.addSymbol("wild_charge_cat"); count = count + 1; diff --git a/src/states/SpellBook.ts b/src/states/SpellBook.ts index 1754a1f12..02c06ad8b 100644 --- a/src/states/SpellBook.ts +++ b/src/states/SpellBook.ts @@ -405,12 +405,14 @@ export class OvaleSpellBookClass { let isKnown = this.spell[spellId] !== undefined; if (!isKnown) { - isKnown = IsSpellKnown(spellId) || IsSpellKnown(spellId, true); - if (isKnown) { - this.tracer.log( - "Spell ID '%s' is not in the spellbook, but is still known.", - spellId - ); + if (spellId > 0) { + isKnown = IsSpellKnown(spellId) || IsSpellKnown(spellId, true); + if (isKnown) { + this.tracer.log( + "Spell ID '%s' is not in the spellbook, but is still known.", + spellId + ); + } } } return (isKnown && true) || false;