Skip to content

Commit

Permalink
fix(simulationcraft): cleanup of simulationcraft APL translator (#816)
Browse files Browse the repository at this point in the history
* fix(simulationcraft): druid's Pulverize requires 2 stacks of Thrash

Move the condition code for Pulverize from an explicit condition in
the script to a spell requirement. Fix the condition code to check
for at least 2 stacks of Thrash instead of the ancient mechanic of
simply needing the Thrash debuff to be on the target.

* fix(simulationcraft): remove check for guardian druid Rejuvenation

Enhanced Rejuvenation for guardian druids was removed from the game
in Legion.

* fix(simulationcraft): feral druid Regrowth no longer procs Bloodtalons

The feral druid Bloodtalons talent was changed in Shadowlands and
no longer procs from casting Regrowth.

* fix(simulationcraft): hunter Kill Command requires an active pet

Kill Command requires that the hunter's pet be present and free to
attack the target. Move the condition from an explicit check in the
script to a spell requirement.

* fix(simulationcraft): remove Arcane Brilliance translation

Arcane Brilliance was removed from the game a while ago, and will no
longer be encountered as "arcane_brilliance" in an APL.

* fix(simulationcraft): frost mage can't summon pet if pet exists

Frost mages can't cast Summon Water Elemental if a pet is already
pre-existing. Move the condition check from an explicit check in
the mage script to a spell requirement.

* fix(simulationcraft): remove nimble_brew translation

Monk's Nimble Brew was removed from the game a while ago, and will
no longer be encountered as "nimble_brew" in an APL.

* fix(simulationcraft): set conditions for Whirling Dragon Punch to be usable

Monk's Whirling Dragon Punch can only be cast when both Fists of
Fury and Rising Sun Kick are on cooldown. Move the condition to
check this from the script into a spell requirement.

* fix(simulationcraft): premeditation is no longer an action

Rogue Premeditation was changed a while back to be a buff you gain
from entering Stealth, not a spell you use out of combat to gain
combo points. Remove the translation for the premeditation action.

* fix(simulationcraft): magma_totem is no longer a valid action

Shaman's Magma Totem was removed from the game a while ago. Remove
the translation for magma_totem.

* fix(simulationcraft): warrior Battle Shout is not available to tanks

* fix(simulationcraft): warrior Commanding Shout is not available

Warrior Commanding Shout was removed from the game a while ago.
Remove the translation of commanding_shout.

* fix(simulationcraft): warrior Enraged Regeneration doesn't give health

Warrior Enraged Regeneration was changed a while ago to only be
usable by Fury warriors and no longer grants health. Remove the
special condition to check for missing health when translating
enraged_regeneration.

* fix(simulationcraft): warrior Heroic Charge is not available

Warrior Heroic Charge was removed from the game a while ago.
Remove the translation for the heroic_charge action.

* fix(simulationcraft): 'stance' action is no longer available

Stance-dancing is not available in SimulationCraft or in-game.
Remove the translation for the 'stance' action.
  • Loading branch information
johnnylam88 committed Jan 20, 2021
1 parent b753b0a commit e77ca2d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 90 deletions.
2 changes: 1 addition & 1 deletion src/scripts/ovale_druid_spells.ts
Expand Up @@ -545,7 +545,7 @@ Define(thrash_bear 77758)
SpellAddTargetDebuff(thrash_bear thrash_bear_debuff add=1)
Define(thrash_bear_debuff 192090)
SpellInfo(thrash_bear_debuff duration=15 max_stacks=3)
SpellRequire(pulverize unusable set=1 enabled=(not targetdebuffpresent(thrash_bear_debuff)))
SpellRequire(pulverize unusable set=1 enabled=(target.debuffstacks(thrash_bear_debuff) < 2))
SpellAddTargetDebuff(pulverize thrash_bear_debuff add=-2)
#snapshots
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/ovale_hunter_spells.ts
Expand Up @@ -400,6 +400,8 @@ Define(niyas_tools_poison_soulbind 320660)
`;
// END
code += `
SpellRequire(kill_command unusable set=1 enabled=(not pet.Present() or pet.IsIncapacitated() or pet.IsFeared() or pet.IsStunned()))
SpellRequire(kill_command_survival unusable set=1 enabled=(not pet.Present() or pet.IsIncapacitated() or pet.IsFeared() or pet.IsStunned()))
SpellRequire(kill_shot unusable set=1 enabled=(target.healthpercent() > 20))
SpellRequire(kill_shot_survival unusable set=1 enabled=(target.healthpercent() > 20))
SpellRequire(harpoon unusable set=1 enabled=(target.distance() < 8))
Expand Down
8 changes: 5 additions & 3 deletions src/scripts/ovale_mage_spells.ts
Expand Up @@ -506,7 +506,8 @@ Define(grove_invigoration_soulbind 322721)
Define(wasteland_propriety_soulbind 319983)
`;
// END
code += `SpellList(hot_streak_spells pyroblast flamestrike)
code += `
SpellList(hot_streak_spells pyroblast flamestrike)
Define(disciplinary_command_arcane_buff -327369)
SpellInfo(disciplinary_command_arcane_buff duration=10)
SpellAddBuff(arcane_explosion disciplinary_command_arcane_buff add=1)
Expand All @@ -517,7 +518,8 @@ Define(disciplinary_command_frost_buff -327366)
SpellInfo(disciplinary_command_frost_buff duration=10)
SpellAddBuff(frostbolt disciplinary_command_frost_buff add=1)
SpellAddBuff(frost_nova disciplinary_command_frost_buff add=1)
`;
#summon_water_elemental
SpellRequire(summon_water_elemental unusable set=1 enabled=(pet.present()))
`;
OvaleScripts.RegisterScript("MAGE", undefined, name, desc, code, "include");
}
2 changes: 2 additions & 0 deletions src/scripts/ovale_monk_spells.ts
Expand Up @@ -303,6 +303,8 @@ Define(healing_elixir 122281)
#touch_of_death
SpellInfo(touch_of_death unusable=1)
SpellRequire(touch_of_death unusable set=0 enabled=(target.Health() < player.Health() or (Level() >= 44 and target.HealthPercent() < 15)))
#whirling_dragon_punch
SpellRequire(whirling_dragon_punch unusable set=1 enabled=(not spellcooldown(fists_of_fury) > 0 or not spellcooldown(rising_sun_kick) > 0))
## Stagger
Define(stagger 115069)
Expand Down
86 changes: 0 additions & 86 deletions src/simulationcraft/emiter.ts
Expand Up @@ -1343,7 +1343,6 @@ export class Emiter {
const className = annotation.classId;
const specialization = annotation.specialization;
const camelSpecialization = LowerSpecialization(annotation);
const role = annotation.role;
let [action, type] = this.Disambiguate(
annotation,
canonicalizedName,
Expand Down Expand Up @@ -1388,22 +1387,6 @@ export class Emiter {
isSpellAction = false;
} else if (className == "DRUID" && action == "primal_wrath") {
conditionCode = "Enemies(tagged=1) > 1";
} else if (className == "DRUID" && action == "pulverize") {
const debuffName = "thrash_bear_debuff";
this.AddSymbol(annotation, debuffName);
conditionCode = format(
"target.DebuffGain(%s) <= BaseDuration(%s)",
debuffName,
debuffName
);
} else if (
className == "DRUID" &&
specialization == "guardian" &&
action == "rejuvenation"
) {
const spellName = "enhanced_rejuvenation";
this.AddSymbol(annotation, spellName);
conditionCode = format("SpellKnown(%s)", spellName);
} else if (className == "DRUID" && action == "wild_charge") {
bodyCode = `${camelSpecialization}GetInMeleeRange()`;
annotation[action] = className;
Expand All @@ -1417,22 +1400,6 @@ export class Emiter {
conditionCode = "SpellKnown(half_moon)";
} else if (className == "DRUID" && action == "full_moon") {
conditionCode = "SpellKnown(full_moon)";
} else if (
className == "DRUID" &&
action == "regrowth" &&
specialization == "feral"
) {
conditionCode =
"Talent(bloodtalons_talent) and (BuffRemaining(bloodtalons_buff) < CastTime(regrowth)+GCDRemaining() or InCombat())";
this.AddSymbol(annotation, "bloodtalons_talent");
this.AddSymbol(annotation, "bloodtalons_buff");
this.AddSymbol(annotation, "regrowth");
} else if (className == "HUNTER" && action == "kill_command") {
conditionCode =
"pet.Present() and not pet.IsIncapacitated() and not pet.IsFeared() and not pet.IsStunned()";
} else if (className == "MAGE" && action == "arcane_brilliance") {
conditionCode =
"BuffExpires(critical_strike_buff any=1) or BuffExpires(spell_power_multiplier_buff any=1)";
} else if (className == "MAGE" && truthy(find(action, "pet_"))) {
conditionCode = "pet.Present()";
} else if (
Expand Down Expand Up @@ -1461,11 +1428,6 @@ export class Emiter {
conditionCode =
"CheckBoxOn(opt_time_warp) and DebuffExpires(burst_haste_debuff any=1)";
annotation[action] = className;
} else if (
className == "MAGE" &&
action == "summon_water_elemental"
) {
conditionCode = "not pet.Present()";
} else if (className == "MAGE" && action == "ice_floes") {
conditionCode = "Speed() > 0";
} else if (className == "MAGE" && action == "blast_wave") {
Expand All @@ -1480,8 +1442,6 @@ export class Emiter {
isSpellAction = false;
} else if (className == "MONK" && action == "gift_of_the_ox") {
isSpellAction = false;
} else if (className == "MONK" && action == "nimble_brew") {
conditionCode = "IsFeared() or IsRooted() or IsStunned()";
} else if (
className == "MONK" &&
action == "storm_earth_and_fire"
Expand All @@ -1499,12 +1459,6 @@ export class Emiter {
// annotation,
// "hidden_masters_forbidden_touch_buff"
// );
} else if (
className == "MONK" &&
action == "whirling_dragon_punch"
) {
conditionCode =
"SpellCooldown(fists_of_fury)>0 and SpellCooldown(rising_sun_kick)>0";
} else if (
className == "PALADIN" &&
action == "blessing_of_kings"
Expand Down Expand Up @@ -1539,8 +1493,6 @@ export class Emiter {
conditionCode = format("BuffRemaining(%s) < 1200", buffName);
} else if (className == "ROGUE" && action == "cancel_autoattack") {
isSpellAction = false;
} else if (className == "ROGUE" && action == "premeditation") {
conditionCode = "ComboPoints() < 5";
} else if (
className == "ROGUE" &&
specialization == "assassination" &&
Expand All @@ -1566,10 +1518,6 @@ export class Emiter {
bodyCode = `${camelSpecialization}Bloodlust()`;
annotation[action] = className;
isSpellAction = false;
} else if (className == "SHAMAN" && action == "magma_totem") {
const spellName = "primal_strike";
this.AddSymbol(annotation, spellName);
conditionCode = format("target.InRange(%s)", spellName);
} else if (
className == "WARLOCK" &&
action == "felguard_felstorm"
Expand Down Expand Up @@ -1610,27 +1558,10 @@ export class Emiter {
) {
conditionCode =
"pet.Present() and pet.CreatureFamily(Wrathguard)";
} else if (
className == "WARRIOR" &&
action == "battle_shout" &&
role == "tank"
) {
conditionCode = "BuffExpires(stamina_buff)";
} else if (className == "WARRIOR" && action == "charge") {
conditionCode =
"CheckBoxOn(opt_melee_range) and target.InRange(charge) and not target.InRange(pummel)";
this.AddSymbol(annotation, "pummel");
} else if (
className == "WARRIOR" &&
action == "commanding_shout" &&
role == "attack"
) {
conditionCode = "BuffExpires(attack_power_multiplier_buff)";
} else if (
className == "WARRIOR" &&
action == "enraged_regeneration"
) {
conditionCode = "HealthPercent() < 80";
} else if (
className == "WARRIOR" &&
sub(action, 1, 7) == "execute"
Expand All @@ -1643,8 +1574,6 @@ export class Emiter {
isSpellAction = false;
}
}
} else if (className == "WARRIOR" && action == "heroic_charge") {
isSpellAction = false;
} else if (className == "WARRIOR" && action == "heroic_leap") {
conditionCode =
"CheckBoxOn(opt_melee_range) and target.Distance() >= 8 and target.Distance() <= 40";
Expand Down Expand Up @@ -1772,21 +1701,6 @@ export class Emiter {
} else if (action === "sequence" || action == "strict_sequence") {
// TODO doesn't seem to be supported
isSpellAction = false;
} else if (action == "stance") {
if (modifiers.choose) {
const name = this.unparser.Unparse(modifiers.choose);
if (name) {
if (className == "MONK") {
action = `stance_of_the_${name}`;
} else if (className == "WARRIOR") {
action = `${name}_stance`;
} else {
action = name;
}
}
} else {
isSpellAction = false;
}
} else if (action == "summon_pet") {
bodyCode = `${camelSpecialization}SummonPet()`;
annotation[action] = className;
Expand Down

0 comments on commit e77ca2d

Please sign in to comment.