Skip to content

Commit

Permalink
fix(druid): fix problems with guardian druid script (#827) (#830)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
johnnylam88 committed Jan 26, 2021
1 parent b274af6 commit ebce10e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 22 deletions.
45 changes: 33 additions & 12 deletions src/scripts/ovale_druid.ts
Expand Up @@ -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)))
}
}
}
Expand Down Expand Up @@ -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
`;
Expand Down Expand Up @@ -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)))
}
}
}
Expand Down Expand Up @@ -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
`;
Expand Down Expand Up @@ -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)))
}
}
}
Expand Down Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions src/simulationcraft/generator.ts
Expand Up @@ -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))
}
}
}
`;
Expand All @@ -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;
Expand Down
14 changes: 8 additions & 6 deletions src/states/SpellBook.ts
Expand Up @@ -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;
Expand Down

0 comments on commit ebce10e

Please sign in to comment.