Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 34 additions & 32 deletions sim/common/sod/item_effects/phase_8.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,16 @@ func init() {
// https://www.wowhead.com/classic/item=240919/ravagane
// Chance on hit: You attack all nearby enemies for 9 sec causing weapon damage plus an additional 200 every 1.5 sec.
// Confirmed PPM 0.8
itemhelpers.CreateWeaponProcAura(Ravagane, "Ravagane", 0.8, func(character *core.Character) *core.Aura {
core.NewItemEffect(Ravagane, func(agent core.Agent) {
character := agent.GetCharacter()
actionID := core.ActionID{SpellID: 1231547}

tickSpell := character.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 1231546},
ActionID: actionID,
SpellSchool: core.SpellSchoolPhysical,
DefenseType: core.DefenseTypeMelee,
ProcMask: core.ProcMaskMeleeMHSpecial,
Flags: core.SpellFlagNoOnCastComplete | core.SpellFlagPassiveSpell,
Flags: core.SpellFlagNoOnCastComplete | core.SpellFlagPassiveSpell | core.SpellFlagSuppressEquipProcs,

DamageMultiplier: 1,
ThreatMultiplier: 1,
Expand All @@ -769,12 +772,27 @@ func init() {
})

whirlwindSpell := character.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 1231547},
SpellSchool: core.SpellSchoolPhysical,
ProcMask: core.ProcMaskMeleeMHSpecial,
Dot: core.DotConfig{
Aura: core.Aura{
Label: "Ravagane Whirlwind",
ActionID: actionID,
Label: "Ravagane Whirlwind",
OnGain: func(aura *core.Aura, sim *core.Simulation) {
// In-game testing shows that there is a slight delay before auto attacks are disablecd.
// Extra attacks are able to proc during this time.
core.StartDelayedAction(sim, core.DelayedActionOptions{
DoAt: sim.CurrentTime + time.Millisecond*50, // Exact amount of time unknown
OnAction: func(sim *core.Simulation) {
if aura.IsActive() {
character.AutoAttacks.AllowAutoSwing(sim, false)
}
},
})
},
OnExpire: func(aura *core.Aura, sim *core.Simulation) {
character.AutoAttacks.AllowAutoSwing(sim, true)
},
},
NumberOfTicks: 6,
TickLength: time.Millisecond * 1500,
Expand All @@ -785,36 +803,20 @@ func init() {
},
})

return character.RegisterAura(core.Aura{
Label: "Ravagane Bladestorm",
Duration: time.Second * 9,
Icd: &core.Cooldown{
Timer: character.NewTimer(),
Duration: time.Second * 8,
},
OnGain: func(aura *core.Aura, sim *core.Simulation) {
if !aura.Icd.IsReady(sim) {
return
}
aura.Icd.Use(sim)

triggerAura := core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{
Name: "Ravagane Bladestorm Trigger",
Callback: core.CallbackOnSpellHitDealt,
Outcome: core.OutcomeLanded,
ProcMask: core.ProcMaskMelee,
SpellFlagsExclude: core.SpellFlagSuppressWeaponProcs, // Trigger is Chance on Hit so suppress if triggering spell does not proc Chance on Hit
PPM: 0.8,
ICD: 8 * time.Second,
Handler: func(sim *core.Simulation, _ *core.Spell, result *core.SpellResult) {
whirlwindSpell.AOEDot().Apply(sim)
character.AutoAttacks.CancelAutoSwing(sim)
},
OnRefresh: func(aura *core.Aura, sim *core.Simulation) {
if !aura.Icd.IsReady(sim) {
return
}
aura.Icd.Use(sim)

whirlwindSpell.AOEDot().ApplyOrReset(sim)
character.AutoAttacks.CancelAutoSwing(sim)
},
OnExpire: func(aura *core.Aura, sim *core.Simulation) {
whirlwindSpell.AOEDot().Cancel(sim)
character.AutoAttacks.EnableAutoSwing(sim)
},
})

character.ItemSwap.RegisterProc(Ravagane, triggerAura)
})

// https://www.wowhead.com/classic/item=241002/remnants-of-the-red
Expand Down
20 changes: 19 additions & 1 deletion sim/core/attack.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ type WeaponAttack struct {
curSwingSpeed float64
curSwingDuration time.Duration
enabled bool
allowed bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Adamrch can you explain why we need the #AllowAutoSwing method and the allowed state versus what exists now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exists now is the player controlled startattack / stopattack. Allowed is a just a flag that causes the swing timer to reset and no auto to go out as seen in game. (the delay at the end of the whirlwind for the first auto is consistant with the swingtimer filling and reseting during the whirlwind)

}

func (wa *WeaponAttack) getWeapon() *Weapon {
Expand Down Expand Up @@ -330,6 +331,10 @@ func (wa *WeaponAttack) setWeapon(sim *Simulation, weapon Weapon) {
func (wa *WeaponAttack) trySwing(sim *Simulation) time.Duration {
if sim.CurrentTime < wa.swingAt {
return wa.swingAt
} else if !wa.allowed {
wa.swingAt = sim.CurrentTime + wa.curSwingDuration // Auto Attack Fails due to being disabled by an item or effect (e.g. Ravagane)
sim.rescheduleWeaponAttack(wa.swingAt)
return wa.swingAt
}
return wa.swing(sim)
}
Expand Down Expand Up @@ -467,6 +472,8 @@ type AutoAttacks struct {
AutoSwingMelee bool
AutoSwingRanged bool

AutoSwingDisabled bool

IsDualWielding bool

character *Character
Expand Down Expand Up @@ -676,6 +683,10 @@ func (aa *AutoAttacks) reset(sim *Simulation) {
aa.oh.enabled = false
aa.ranged.enabled = false

aa.mh.allowed = true
aa.oh.allowed = true
aa.ranged.allowed = true

aa.mh.swingAt = NeverExpires
aa.oh.swingAt = NeverExpires

Expand Down Expand Up @@ -798,6 +809,13 @@ func (aa *AutoAttacks) EnableAutoSwing(sim *Simulation) {
aa.EnableRangedSwing(sim)
}

// Allow the auto swing action for the iteration
func (aa *AutoAttacks) AllowAutoSwing(sim *Simulation, isAllowed bool) {
aa.mh.allowed = isAllowed
aa.oh.allowed = isAllowed
aa.ranged.allowed = isAllowed
}

func (aa *AutoAttacks) EnableMeleeSwing(sim *Simulation) {
if !aa.AutoSwingMelee {
return
Expand All @@ -821,7 +839,7 @@ func (aa *AutoAttacks) EnableMeleeSwing(sim *Simulation) {
}
}

if !aa.IsDualWielding && aa.oh.enabled {
if (!aa.IsDualWielding && aa.oh.enabled) {
sim.removeWeaponAttack(&aa.oh)
aa.oh.enabled = false
}
Expand Down
Loading