Skip to content

Commit

Permalink
[core] handle WeaponAttacks via a "task"-like system
Browse files Browse the repository at this point in the history
[core] slightly speedup advance() by using an inlineable tryAdvance() stub
  • Loading branch information
vigo2 committed Oct 31, 2023
1 parent c089322 commit 73e8c8e
Show file tree
Hide file tree
Showing 48 changed files with 7,120 additions and 7,142 deletions.
4 changes: 2 additions & 2 deletions sim/common/tbc/melee_trinkets.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func init() {

core.NewItemEffect(11815, func(agent core.Agent) {
character := agent.GetCharacter()
if !character.AutoAttacks.AutoSwingMelee() {
if !character.AutoAttacks.AutoSwingMelee {
return
}

Expand All @@ -40,7 +40,7 @@ func init() {
Label: "Hand of Justice",
Duration: core.NeverExpires,
OnInit: func(aura *core.Aura, sim *core.Simulation) {
config := character.AutoAttacks.MHConfig
config := *character.AutoAttacks.MHConfig()
config.ActionID = core.ActionID{ItemID: 11815}
handOfJusticeSpell = character.GetOrRegisterSpell(config)
},
Expand Down
16 changes: 8 additions & 8 deletions sim/common/wotlk/capacitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func init() {

core.NewItemEffect(itemID, func(agent core.Agent) {
character := agent.GetCharacter()
if !character.AutoAttacks.AutoSwingMelee() {
if !character.AutoAttacks.AutoSwingMelee {
return
}

Expand All @@ -184,24 +184,24 @@ func init() {
SpellSchool: core.SpellSchoolPhysical,
ProcMask: core.ProcMaskMeleeMHSpecial,
Flags: core.SpellFlagMeleeMetrics | core.SpellFlagIncludeTargetBonusDamage | core.SpellFlagNoOnCastComplete,
DamageMultiplier: character.AutoAttacks.MHConfig.DamageMultiplier * 0.5,
CritMultiplier: character.AutoAttacks.MHConfig.CritMultiplier,
ThreatMultiplier: character.AutoAttacks.MHConfig.ThreatMultiplier,
DamageMultiplier: character.AutoAttacks.MHConfig().DamageMultiplier * 0.5,
CritMultiplier: character.AutoAttacks.MHConfig().CritMultiplier,
ThreatMultiplier: character.AutoAttacks.MHConfig().ThreatMultiplier,
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
baseDamage := character.MHWeaponDamage(sim, spell.MeleeAttackPower())
spell.CalcAndDealDamage(sim, target, baseDamage, spell.OutcomeMeleeWeaponSpecialHitAndCrit)
},
})

if character.AutoAttacks.IsDualWielding() {
if character.AutoAttacks.IsDualWielding {
ohSpell = character.GetOrRegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 71434}, // "Manifest Anger"
SpellSchool: core.SpellSchoolPhysical,
ProcMask: core.ProcMaskMeleeOHSpecial,
Flags: core.SpellFlagMeleeMetrics | core.SpellFlagIncludeTargetBonusDamage | core.SpellFlagNoOnCastComplete,
DamageMultiplier: character.AutoAttacks.OHConfig.DamageMultiplier * 0.5,
CritMultiplier: character.AutoAttacks.OHConfig.CritMultiplier,
ThreatMultiplier: character.AutoAttacks.OHConfig.ThreatMultiplier,
DamageMultiplier: character.AutoAttacks.OHConfig().DamageMultiplier * 0.5,
CritMultiplier: character.AutoAttacks.OHConfig().CritMultiplier,
ThreatMultiplier: character.AutoAttacks.OHConfig().ThreatMultiplier,
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
baseDamage := character.OHWeaponDamage(sim, spell.MeleeAttackPower())
spell.CalcAndDealDamage(sim, target, baseDamage, spell.OutcomeMeleeWeaponSpecialHitAndCrit)
Expand Down
Loading

0 comments on commit 73e8c8e

Please sign in to comment.