Skip to content

Commit

Permalink
add back thunderfury, update tooltip parsing to grab bonus school wea…
Browse files Browse the repository at this point in the history
…pon damage
  • Loading branch information
kayla-glick committed Jul 28, 2024
1 parent 8542917 commit 2a87f0f
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 91 deletions.
Binary file modified assets/database/db.bin
Binary file not shown.
23 changes: 12 additions & 11 deletions assets/database/db.json

Large diffs are not rendered by default.

Binary file modified assets/database/leftover_db.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion assets/database/leftover_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1480,8 +1480,8 @@
{"effectId":63,"spellId":13538,"name":"Enchant Chest - Lesser Absorption","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":66,"spellId":7457,"name":"Enchant Bracer - Minor Stamina","type":6,"stats":[0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":66,"spellId":7863,"name":"Enchant Boots - Minor Stamina","type":10,"stats":[0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":241,"spellId":7745,"name":"Enchant 2H Weapon - Minor Impact","type":13,"enchantType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":241,"spellId":13503,"name":"Enchant Weapon - Lesser Striking","type":13,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":241,"spellId":7745,"name":"Enchant 2H Weapon - Minor Impact","type":13,"enchantType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":242,"spellId":7748,"name":"Enchant Chest - Lesser Health","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":243,"spellId":7766,"name":"Enchant Bracer - Minor Spirit","type":6,"stats":[0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":2},
{"effectId":246,"spellId":7776,"name":"Enchant Chest - Lesser Mana","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":2},
Expand Down
131 changes: 63 additions & 68 deletions sim/common/vanilla/item_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -1780,85 +1780,80 @@ func init() {
})
})

// Not yet available
// core.NewItemEffect(Thunderfury, func(agent core.Agent) {
// character := agent.GetCharacter()

// procMask := character.GetProcMaskForItem(Thunderfury)
// ppmm := character.AutoAttacks.NewPPMManager(6.0, procMask)
// https://www.wowhead.com/classic/item=19019/thunderfury-blessed-blade-of-the-windseeker
// Chance on hit: Blasts your enemy with lightning, dealing 300 Nature damage and then jumping to additional nearby enemies.
// Each jump reduces that victim's Nature resistance by 25. Affects 5 targets.
// Your primary target is also consumed by a cyclone, slowing its attack speed by 20% for 12 sec.
core.NewItemEffect(Thunderfury, func(agent core.Agent) {
character := agent.GetCharacter()

// procActionID := core.ActionID{SpellID: 21992}
procMask := character.GetProcMaskForItem(Thunderfury)
ppmm := character.AutoAttacks.NewPPMManager(6.0, procMask)

// singleTargetSpell := character.GetOrRegisterSpell(core.SpellConfig{
// ActionID: procActionID.WithTag(1),
// SpellSchool: core.SpellSchoolNature,
// DefenseType: core.DefenseTypeMagic,
// ProcMask: core.ProcMaskEmpty,
procActionID := core.ActionID{SpellID: 21992}

// DamageMultiplier: 1,
// ThreatMultiplier: 0.5,
singleTargetSpell := character.GetOrRegisterSpell(core.SpellConfig{
ActionID: procActionID.WithTag(1),
SpellSchool: core.SpellSchoolNature,
DefenseType: core.DefenseTypeMagic,
ProcMask: core.ProcMaskEmpty,

// ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
// spell.CalcAndDealDamage(sim, target, 300, spell.OutcomeMagicHitAndCrit)
// },
// })
DamageMultiplier: 1,
ThreatMultiplier: 1,

// debuffAuras := character.NewEnemyAuraArray(func(target *core.Unit, _ int32) *core.Aura {
// return target.GetOrRegisterAura(core.Aura{
// Label: "Thunderfury",
// ActionID: procActionID,
// Duration: time.Second * 12,
// OnGain: func(aura *core.Aura, sim *core.Simulation) {
// target.AddStatDynamic(sim, stats.NatureResistance, -25)
// },
// OnExpire: func(aura *core.Aura, sim *core.Simulation) {
// target.AddStatDynamic(sim, stats.NatureResistance, 25)
// },
// })
// })
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
spell.CalcAndDealDamage(sim, target, 300, spell.OutcomeMagicHitAndCrit)
},
})

// results := make([]*core.SpellResult, min(5, character.Env.GetNumTargets()))
debuffAuras := character.NewEnemyAuraArray(func(target *core.Unit, _ int32) *core.Aura {
return target.GetOrRegisterAura(core.Aura{
Label: "Thunderfury",
ActionID: procActionID,
Duration: time.Second * 12,
OnGain: func(aura *core.Aura, sim *core.Simulation) {
target.AddStatDynamic(sim, stats.NatureResistance, -25)
},
OnExpire: func(aura *core.Aura, sim *core.Simulation) {
target.AddStatDynamic(sim, stats.NatureResistance, 25)
},
})
})

// bounceSpell := character.GetOrRegisterSpell(core.SpellConfig{
// ActionID: procActionID.WithTag(2),
// SpellSchool: core.SpellSchoolNature,
// ProcMask: core.ProcMaskEmpty,
results := make([]*core.SpellResult, min(5, character.Env.GetNumTargets()))

// ThreatMultiplier: 1,
// FlatThreatBonus: 63,
bounceSpell := character.GetOrRegisterSpell(core.SpellConfig{
ActionID: procActionID.WithTag(2),
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskEmpty,

// ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
// for idx := range results {
// results[idx] = spell.CalcDamage(sim, target, 0, spell.OutcomeMagicHit)
// target = sim.Environment.NextTargetUnit(target)
// }
// for _, result := range results {
// if result.Landed() {
// debuffAuras[result.Target.Index].Activate(sim)
// }
// spell.DealDamage(sim, result)
// }
// },
// })
ThreatMultiplier: 1,
FlatThreatBonus: 126,

// character.GetOrRegisterAura(core.Aura{
// Label: "Thunderfury",
// Duration: core.NeverExpires,
// OnReset: func(aura *core.Aura, sim *core.Simulation) {
// aura.Activate(sim)
// },
// OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
// if !result.Landed() {
// return
// }
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
for idx := range results {
results[idx] = spell.CalcDamage(sim, target, 0, spell.OutcomeMagicHit)
target = sim.Environment.NextTargetUnit(target)
}
for _, result := range results {
if result.Landed() {
debuffAuras[result.Target.Index].Activate(sim)
}
spell.DealDamage(sim, result)
}
},
})

// if ppmm.Proc(sim, spell.ProcMask, "Thunderfury") {
// singleTargetSpell.Cast(sim, result.Target)
// bounceSpell.Cast(sim, result.Target)
// }
// },
// })
// })
core.MakePermanent(character.GetOrRegisterAura(core.Aura{
Label: "Thunderfury Trigger",
OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if result.Landed() && ppmm.Proc(sim, spell.ProcMask, "Thunderfury") {
singleTargetSpell.Cast(sim, result.Target)
bounceSpell.Cast(sim, result.Target)
}
},
}))
})

// https://www.wowhead.com/classic/item=228273/thunderstrike
// Chance on hit: Blasts up to 3 targets for 200 to 300 Nature damage. Each target after the first takes less damage.
Expand Down
3 changes: 0 additions & 3 deletions tools/database/overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,6 @@ var DenyListNameRegexes = []*regexp.Regexp{
regexp.MustCompile(`Grand Marshal's [a-zA-z\s]+`),
regexp.MustCompile(`High Warlord's [a-zA-z\s]+`),

// BWL
regexp.MustCompile(`Thunderfury`),

// ZG
regexp.MustCompile(`Zandalarian`),
regexp.MustCompile(`Bloodvine [a-zA-z]+`),
Expand Down
35 changes: 29 additions & 6 deletions tools/database/wowhead_tooltips.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ var armorPenetrationRegex2 = regexp.MustCompile(`Increases your armor penetratio
var expertiseRegex = regexp.MustCompile(`Increases your expertise rating by <!--rtg37-->([0-9]+)\.`)
var weaponDamageRegex = regexp.MustCompile(`<!--dmg-->([0-9]+) - ([0-9]+)`)
var weaponDamageRegex2 = regexp.MustCompile(`<!--dmg-->([0-9]+) Damage`)
var weaponDamageBonusSchoolRegex = regexp.MustCompile(`\+ ([0-9]+) - ([0-9]+) [a-zA-Z]+ Damage`)
var weaponSpeedRegex = regexp.MustCompile(`<!--spd-->(([0-9]+).([0-9]+))`)

var axesSkill = regexp.MustCompile(`Increased Axes \+([0-9]+)\.`)
Expand Down Expand Up @@ -602,27 +603,49 @@ func (item WowheadItemResponse) GetRangedWeaponType() proto.RangedWeaponType {
// Returns min/max of weapon damage
func (item WowheadItemResponse) GetWeaponDamage() (float64, float64) {
noCommas := strings.ReplaceAll(item.Tooltip, ",", "")
min, max := 0.0, 0.0

// Base damage
if matches := weaponDamageRegex.FindStringSubmatch(noCommas); len(matches) > 0 {
min, err := strconv.ParseFloat(matches[1], 64)
minVal, err := strconv.ParseFloat(matches[1], 64)
if err != nil {
log.Fatalf("Failed to parse weapon damage: %s", err)
}
max, err := strconv.ParseFloat(matches[2], 64)
maxVal, err := strconv.ParseFloat(matches[2], 64)
if err != nil {
log.Fatalf("Failed to parse weapon damage: %s", err)
}
if min > max {
if minVal > maxVal {
log.Fatalf("Invalid weapon damage for item %s: min = %0.1f, max = %0.1f", item.Name, min, max)
}
return min, max
min, max = minVal, maxVal
} else if matches := weaponDamageRegex2.FindStringSubmatch(noCommas); len(matches) > 0 {
val, err := strconv.ParseFloat(matches[1], 64)
if err != nil {
log.Fatalf("Failed to parse weapon damage: %s", err)
}
return val, val
min, max = val, val
}

// Add effects like Thunderfury + 16 - 30 Nature Damage that were intended for bonus school damage on top of the base weapon damage
if matches := weaponDamageBonusSchoolRegex.FindStringSubmatch(noCommas); len(matches) > 0 {
minVal, err := strconv.ParseFloat(matches[1], 64)
if err != nil {
log.Fatalf("Failed to parse weapon damage: %s", err)
}
maxVal, err := strconv.ParseFloat(matches[2], 64)
if err != nil {
log.Fatalf("Failed to parse weapon damage: %s", err)
}
if minVal > maxVal {
log.Fatalf("Invalid bonus school weapon damage for item %s: min = %0.1f, max = %0.1f", item.Name, min, max)
}

min += minVal
max += maxVal
}
return 0, 0

return min, max
}

func (item WowheadItemResponse) GetWeaponSpeed() float64 {
Expand Down
4 changes: 2 additions & 2 deletions ui/core/proto_utils/action_id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ export class ActionId {
break;
case 'Thunderfury':
if (this.tag === 1) {
name += ' (ST)';
name += ' (Main)';
} else if (this.tag === 2) {
name += ' (MT)';
name += ' (Bounce)';
}
break;
case 'Sunfire':
Expand Down

0 comments on commit 2a87f0f

Please sign in to comment.