Skip to content

Commit

Permalink
Fixed issue with lightning overload
Browse files Browse the repository at this point in the history
  • Loading branch information
lologarithm committed Apr 6, 2021
1 parent 8ab91c3 commit ed52095
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 5 deletions.
63 changes: 60 additions & 3 deletions tbc/auras.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,63 @@ type Aura struct {
OnExpire AuraEffect
}

func AuraName(a int32) string {
switch a {
case MagicIDUnknown:
return "Unknown"
case MagicIDLOTalent:
return "LOTalent"
case MagicIDJoW:
return "JoW"
case MagicIDEleFocus:
return "EleFocus"
case MagicIDEleMastery:
return "EleMastery"
case MagicIDStormcaller:
return "Stormcaller"
case MagicIDSilverCrescent:
return "SilverCrescent"
case MagicIDQuagsEye:
return "QuagsEye"
case MagicIDFungalFrenzy:
return "FungalFrenzy"
case MagicIDBloodlust:
return "Bloodlust"
case MagicIDSkycall:
return "Skycall"
case MagicIDEnergized:
return "Energized"
case MagicIDNAC:
return "NAC"
case MagicIDChaoticSkyfire:
return "ChaoticSkyfire"
case MagicIDInsightfulEarthstorm:
return "InsightfulEarthstorm"
case MagicIDMysticSkyfire:
return "MysticSkyfire"
case MagicIDMysticFocus:
return "MysticFocus"
case MagicIDEmberSkyfire:
return "EmberSkyfire"
case MagicIDLB12:
return "LB12"
case MagicIDCL6:
return "CL6"
case MagicIDISCTrink:
return "ISCTrink"
case MagicIDNACTrink:
return "NACTrink"
case MagicIDPotion:
return "Potion"
case MagicIDRune:
return "Rune"
case MagicIDAllTrinket:
return "AllTrinket"
}

return "unknown"
}

// AuraEffects will mutate a cast or simulation state.
type AuraEffect func(sim *Simulation, c *Cast)

Expand Down Expand Up @@ -68,7 +125,7 @@ func AuraLightningOverload(lvl int) Aura {
ID: MagicIDLOTalent,
Expires: math.MaxInt32,
OnSpellHit: func(sim *Simulation, c *Cast) {
if c.Spell.ID == MagicIDLB12 || c.Spell.ID == MagicIDCL6 {
if c.Spell.ID != MagicIDLB12 && c.Spell.ID != MagicIDCL6 {
return
}
if c.isLO {
Expand Down Expand Up @@ -165,7 +222,7 @@ func ActivateQuagsEye(sim *Simulation) Aura {
Expires: math.MaxInt32,
OnCastComplete: func(sim *Simulation, c *Cast) {
if lastActivation+(45*TicksPerSecond) < sim.currentTick && sim.rando.Float64() < 0.1 {
sim.debug(" -quags eye- \n")
sim.debug(" -quags eye proc- \n")
sim.Buffs[StatHaste] += hasteBonus
sim.addAura(AuraHasteRemoval(sim.currentTick, 6.0, hasteBonus, MagicIDFungalFrenzy))
lastActivation = sim.currentTick
Expand All @@ -179,7 +236,7 @@ func AuraHasteRemoval(tick int, seconds int, amount float64, id int32) Aura {
ID: id,
Expires: tick + (seconds * TicksPerSecond),
OnExpire: func(sim *Simulation, c *Cast) {
sim.debug("- haste removal %0.0f from %d", amount, id)
sim.debug("haste removal %0.0f from %d\n", amount, AuraName(id))
sim.Buffs[StatHaste] -= amount
},
}
Expand Down
4 changes: 2 additions & 2 deletions tbc/sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (sim *Simulation) cleanAura(i int) {
sim.Auras[i].OnSpellHit = nil
sim.Auras[i].OnExpire = nil

sim.debug("removed: %s- \n", sim.Auras[i].ID)
sim.debug("removed: %s- \n", AuraName(sim.Auras[i].ID))
sim.Auras = sim.Auras[:i+copy(sim.Auras[i:], sim.Auras[i+1:])]
}

Expand Down Expand Up @@ -232,7 +232,7 @@ func (sim *Simulation) Cast(cast *Cast) {
aur.OnCastComplete(sim, cast)
}
}
sim.debug("Completed Cast (%s)\n", cast.Spell.ID)
sim.debug("Completed Cast (%s)\n", cast.Spell.Name)
dbgCast := cast.Spell.Name
if sim.rando.Float64() < cast.Hit {
dmg := (sim.rando.Float64() * (cast.Spell.MaxDmg - cast.Spell.MinDmg)) + cast.Spell.MinDmg + (sim.Stats[StatSpellDmg] * cast.Spell.Coeff)
Expand Down
2 changes: 2 additions & 0 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ <h4>Standard Elemental Build</h4>
<li>Gems and gemming bonuses are not implemented.</li>
<li>Set bonuses are not implemented.</li>
<li>Unsure of exact spell pen. Using classic 2.5% chance for a 25% partial resist (this is probably wrong).</li>
<li>The 'optimize' checkbox in the simulation tab will figure out a rotation that maximizes DPS for the given duration.</li>
<li>The 'Hasted Rotations' tab will calculate the max DPS rotation for the given gear set and at fixed haste levels.</li>
</ul>
</li>
</ul>
Expand Down
Binary file modified ui/lib.wasm
Binary file not shown.

0 comments on commit ed52095

Please sign in to comment.