Skip to content

Commit

Permalink
[DK] Add delay to Raise Dead start attack
Browse files Browse the repository at this point in the history
  • Loading branch information
hillerstorm committed Nov 7, 2024
1 parent 5aa9aa9 commit 12d3d5b
Show file tree
Hide file tree
Showing 5 changed files with 1,972 additions and 1,954 deletions.
14 changes: 11 additions & 3 deletions sim/core/pet.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ type Pet struct {
// Some pets expire after a certain duration. This is the pending action that disables
// the pet on expiration.
timeoutAction *PendingAction

// DK Raise Dead is doing its whole RP thing by climbing out of the ground before attacking.
startAttackDelay time.Duration
}

func NewPet(name string, owner *Character, baseStats stats.Stats, statInheritance PetStatInheritance, enabledOnStart bool, isGuardian bool) Pet {
Expand Down Expand Up @@ -171,12 +174,12 @@ func (pet *Pet) Enable(sim *Simulation, petAgent PetAgent) {
pet.OnPetEnable(sim)
}

pet.SetGCDTimer(sim, max(0, sim.CurrentTime))
if sim.CurrentTime >= 0 {
pet.SetGCDTimer(sim, max(0, sim.CurrentTime+pet.startAttackDelay, sim.CurrentTime))
if sim.CurrentTime >= 0 && pet.startAttackDelay <= 0 {
pet.AutoAttacks.EnableAutoSwing(sim)
} else {
sim.AddPendingAction(&PendingAction{
NextActionAt: 0,
NextActionAt: max(0, sim.CurrentTime+pet.startAttackDelay),
OnAction: func(sim *Simulation) {
if pet.enabled {
pet.AutoAttacks.EnableAutoSwing(sim)
Expand All @@ -198,6 +201,11 @@ func (pet *Pet) Enable(sim *Simulation, petAgent PetAgent) {
}
}

func (pet *Pet) EnableWithStartAttackDelay(sim *Simulation, petAgent PetAgent, startAttackDelay time.Duration) {
pet.startAttackDelay = startAttackDelay
pet.Enable(sim, petAgent)
}

// Helper for enabling a pet that will expire after a certain duration.
func (pet *Pet) EnableWithTimeout(sim *Simulation, petAgent PetAgent, petDuration time.Duration) {
pet.Enable(sim, petAgent)
Expand Down
Loading

0 comments on commit 12d3d5b

Please sign in to comment.