Skip to content

Commit

Permalink
Merge pull request wowsims#3868 from vigo2/vigo/hardcast-out-of-advance
Browse files Browse the repository at this point in the history
vigo/hardcast-out-of-advance
  • Loading branch information
vigo2 authored Oct 12, 2023
2 parents 086f319 + 49211b1 commit a3813f9
Show file tree
Hide file tree
Showing 23 changed files with 2,699 additions and 2,698 deletions.
7 changes: 7 additions & 0 deletions sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ func (character *Character) initialize(agent Agent) {
character.gcdAction = &PendingAction{
Priority: ActionPriorityGCD,
OnAction: func(sim *Simulation) {
if hc := &character.Hardcast; hc.Expires != startingCDTime && hc.Expires <= sim.CurrentTime {
hc.Expires = startingCDTime
if hc.OnComplete != nil {
hc.OnComplete(sim, hc.Target)
}
}

if sim.CurrentTime < 0 {
return
}
Expand Down
9 changes: 7 additions & 2 deletions sim/core/gcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ func (unit *Unit) newHardcastAction(sim *Simulation) {
pa := &PendingAction{
NextActionAt: unit.Hardcast.Expires,
OnAction: func(sim *Simulation) {
// Don't need to do anything, the Advance() call will take care of the hardcast.
if hc := &unit.Hardcast; hc.Expires != startingCDTime && hc.Expires <= sim.CurrentTime {
hc.Expires = startingCDTime
if hc.OnComplete != nil {
hc.OnComplete(sim, hc.Target)
}
}
},
}
unit.hardcastAction = pa
Expand Down Expand Up @@ -82,7 +87,7 @@ func (unit *Unit) DoneWaitingForMana(sim *Simulation) bool {
return false
}

func (unit *Unit) DoneWaitingForEnergy(sim *Simulation) bool {
func (unit *Unit) DoneWaitingForEnergy(_ *Simulation) bool {
if unit.CurrentEnergy() >= unit.waitingForEnergy {
unit.waitStartTime = 0
unit.waitingForEnergy = 0
Expand Down
9 changes: 1 addition & 8 deletions sim/core/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,16 +487,9 @@ func (unit *Unit) startPull(sim *Simulation) {
}
}

// Advance moves time forward counting down auras, CDs, mana regen, etc
// Advance moves time forward counting down auras, and nothing else, currently.
func (unit *Unit) advance(sim *Simulation) {
unit.auraTracker.advance(sim)

if hc := &unit.Hardcast; hc.Expires != startingCDTime && hc.Expires <= sim.CurrentTime {
hc.Expires = startingCDTime
if hc.OnComplete != nil {
hc.OnComplete(sim, hc.Target)
}
}
}

func (unit *Unit) doneIteration(sim *Simulation) {
Expand Down
10 changes: 3 additions & 7 deletions sim/deathknight/ghoul_pet.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,14 @@ func (ghoulPet *GhoulPet) Reset(_ *core.Simulation) {
}

func (ghoulPet *GhoulPet) OnGCDReady(sim *core.Simulation) {
// Apply uptime for permanent pet ghoul
if !ghoulPet.IsGuardian() {
percentRemaining := sim.GetRemainingDurationPercent()
if percentRemaining < 1.0-ghoulPet.uptimePercent { // once fight is % completed, disable pet.
if ghoulPet.uptimePercent < 1.0 { // Apply uptime for permanent pet ghoul
if sim.GetRemainingDurationPercent() < 1.0-ghoulPet.uptimePercent { // once fight is % completed, disable pet.
ghoulPet.Pet.Disable(sim)
return
}
}

target := ghoulPet.CurrentTarget

if !ghoulPet.ClawAbility.TryCast(sim, target, ghoulPet) {
if !ghoulPet.ClawAbility.TryCast(sim, ghoulPet.CurrentTarget, ghoulPet) {
ghoulPet.DoNothing()
}
}
Expand Down
28 changes: 14 additions & 14 deletions sim/druid/balance/TestBalance.results
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ dps_results: {
dps_results: {
key: "TestBalance-AllItems-DislodgedForeignObject-50348"
value: {
dps: 8288.3991
tps: 8064.0309
dps: 8289.76557
tps: 8065.39737
}
}
dps_results: {
key: "TestBalance-AllItems-DislodgedForeignObject-50353"
value: {
dps: 8237.94461
tps: 8019.31389
dps: 8239.31187
tps: 8020.68115
}
}
dps_results: {
Expand Down Expand Up @@ -970,15 +970,15 @@ dps_results: {
dps_results: {
key: "TestBalance-Settings-Tauren-P1-Default-basic_p3-NoBuffs-LongMultiTarget"
value: {
dps: 2975.86585
tps: 3235.34744
dps: 2974.28351
tps: 3233.76509
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P1-Default-basic_p3-NoBuffs-LongSingleTarget"
value: {
dps: 2128.15927
tps: 2019.4942
dps: 2126.32387
tps: 2017.6588
}
}
dps_results: {
Expand Down Expand Up @@ -1012,15 +1012,15 @@ dps_results: {
dps_results: {
key: "TestBalance-Settings-Tauren-P2-4P-Default-basic_p3-NoBuffs-LongMultiTarget"
value: {
dps: 4706.08483
tps: 5252.78548
dps: 4706.01284
tps: 5252.71349
}
}
dps_results: {
key: "TestBalance-Settings-Tauren-P2-4P-Default-basic_p3-NoBuffs-LongSingleTarget"
value: {
dps: 3196.59594
tps: 3083.16505
dps: 3196.44523
tps: 3083.01435
}
}
dps_results: {
Expand Down Expand Up @@ -1096,8 +1096,8 @@ dps_results: {
dps_results: {
key: "TestBalance-Settings-Tauren-P3-Default-basic_p3-NoBuffs-LongMultiTarget"
value: {
dps: 7167.53114
tps: 8174.76366
dps: 7167.43242
tps: 8174.66493
}
}
dps_results: {
Expand Down
12 changes: 6 additions & 6 deletions sim/druid/balance/TestBalancePhase3.results
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ dps_results: {
dps_results: {
key: "TestBalancePhase3-AllItems-DislodgedForeignObject-50348"
value: {
dps: 11645.4463
tps: 11352.54545
dps: 11648.63144
tps: 11355.73059
}
}
dps_results: {
key: "TestBalancePhase3-AllItems-DislodgedForeignObject-50353"
value: {
dps: 11500.20549
tps: 11206.91429
dps: 11502.17785
tps: 11208.88664
}
}
dps_results: {
Expand Down Expand Up @@ -970,8 +970,8 @@ dps_results: {
dps_results: {
key: "TestBalancePhase3-Settings-Tauren-P3-Default-basic_p3-NoBuffs-LongMultiTarget"
value: {
dps: 6156.42751
tps: 6942.84154
dps: 6156.21369
tps: 6942.62772
}
}
dps_results: {
Expand Down
Loading

0 comments on commit a3813f9

Please sign in to comment.