Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 10 additions & 0 deletions proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ message APLValue {
APLValueWarlockPetIsActive warlock_pet_is_active = 72;
// Paladin
APLValueCurrentSealRemainingTime current_seal_remaining_time = 65;
// Hunter
APLValueHunterCurrentPetFocus hunter_current_pet_focus = 80;
APLValueHunterCurrentPetFocusPercent hunter_current_pet_focus_percent = 81;
APLValueHunterPetIsActive hunter_pet_is_active = 82;
}
}

Expand Down Expand Up @@ -554,5 +558,11 @@ message APLValueWarlockCurrentPetManaPercent {
}
message APLValueWarlockPetIsActive {
}
message APLValueHunterPetIsActive {
}
message APLValueHunterCurrentPetFocus {
}
message APLValueHunterCurrentPetFocusPercent {
}
message APLValueCurrentSealRemainingTime {
}
4 changes: 4 additions & 0 deletions sim/core/focus.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func (fb *focusBar) CurrentFocus() float64 {
return fb.currentFocus
}

func (unit *Unit) CurrentFocusPercent() float64 {
return unit.CurrentFocus() / unit.MaxFocus()
}

func (fb *focusBar) MaxFocus() float64 {
return fb.maxFocus
}
Expand Down
8 changes: 4 additions & 4 deletions sim/core/movement.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (move *MovementHandler) removeMoveSpeedModifier(moveHeap *MoveHeap, actionI
}

func (move *MovementHandler) updateMoveSpeed() {
move.MoveSpeed = move.baseSpeed * move.getActveModifier(move.moveSpeedBonuses) * (1-move.getActveModifier(move.moveSpeedPenalties))
move.MoveSpeed = move.baseSpeed * move.getActveModifier(move.moveSpeedBonuses) * (1 - move.getActveModifier(move.moveSpeedPenalties))
}

func (move *MovementHandler) getActveModifier(moveHeap *MoveHeap) float64 {
Expand Down Expand Up @@ -136,7 +136,7 @@ func (unit *Unit) IsMoving() bool {
}

func (unit *Unit) MoveTo(moveRange float64, sim *Simulation) {
if moveRange == unit.DistanceFromTarget {
if moveRange == unit.DistanceFromTarget || unit.IsMoving() {
return
}

Expand Down Expand Up @@ -168,12 +168,12 @@ func (unit *Unit) AddMoveSpeedModifier(actionId *ActionID, modifier float64) {
ActionId: actionId,
Modifier: modifier,
}
if(moveSpeedMod.Modifier < 1) {
if moveSpeedMod.Modifier < 1 {
unit.MovementHandler.addMoveSpeedModifier(unit.MovementHandler.moveSpeedPenalties, moveSpeedMod)
} else {
unit.MovementHandler.addMoveSpeedModifier(unit.MovementHandler.moveSpeedBonuses, moveSpeedMod)
}

}

func (unit *Unit) RemoveMoveSpeedModifier(actionID *ActionID) {
Expand Down
98 changes: 98 additions & 0 deletions sim/hunter/apl_values.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package hunter

import (
"fmt"

"github.com/wowsims/sod/sim/core"
"github.com/wowsims/sod/sim/core/proto"
)

func (hunter *Hunter) NewAPLValue(rot *core.APLRotation, config *proto.APLValue) core.APLValue {
switch config.Value.(type) {
case *proto.APLValue_HunterPetIsActive:
return hunter.newValueHunterPetIsActive(rot)
case *proto.APLValue_HunterCurrentPetFocus:
return hunter.newValueHunterCurrentPetFocus(rot, config.GetHunterCurrentPetFocus())
case *proto.APLValue_HunterCurrentPetFocusPercent:
return hunter.newValueHunterCurrentPetFocusPercent(rot, config.GetHunterCurrentPetFocusPercent())
default:
return nil
}
}

type APLValueHunterPetIsActive struct {
core.DefaultAPLValueImpl
hunter *Hunter
}

func (hunter *Hunter) newValueHunterPetIsActive(_ *core.APLRotation) core.APLValue {
return &APLValueHunterPetIsActive{
hunter: hunter,
}
}

func (value *APLValueHunterPetIsActive) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeBool
}
func (value *APLValueHunterPetIsActive) GetBool(sim *core.Simulation) bool {
return value.hunter.pet != nil
}
func (value *APLValueHunterPetIsActive) String() string {
return fmt.Sprintf("Current Pet Focus %%")
}

type APLValueHunterCurrentPetFocus struct {
core.DefaultAPLValueImpl
pet *HunterPet
}

func (hunter *Hunter) newValueHunterCurrentPetFocus(rot *core.APLRotation, config *proto.APLValueHunterCurrentPetFocus) core.APLValue {
pet := hunter.pet
if pet == nil {
return nil
}
if !pet.GetPet().HasFocusBar() {
rot.ValidationWarning("%s does not use Focus", pet.GetPet().Label)
return nil
}
return &APLValueHunterCurrentPetFocus{
pet: pet,
}
}
func (value *APLValueHunterCurrentPetFocus) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeFloat
}
func (value *APLValueHunterCurrentPetFocus) GetFloat(sim *core.Simulation) float64 {
return value.pet.CurrentFocus()
}
func (value *APLValueHunterCurrentPetFocus) String() string {
return "Current Pet Focus"
}

type APLValueHunterCurrentPetFocusPercent struct {
core.DefaultAPLValueImpl
pet *HunterPet
}

func (hunter *Hunter) newValueHunterCurrentPetFocusPercent(rot *core.APLRotation, config *proto.APLValueHunterCurrentPetFocusPercent) core.APLValue {
pet := hunter.pet
if pet == nil {
return nil
}
if !pet.GetPet().HasFocusBar() {
rot.ValidationWarning("%s does not use Focus", pet.GetPet().Label)
return nil
}
return &APLValueHunterCurrentPetFocusPercent{
pet: pet,
}
}
func (value *APLValueHunterCurrentPetFocusPercent) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeFloat
}
func (value *APLValueHunterCurrentPetFocusPercent) GetFloat(sim *core.Simulation) float64 {
return value.pet.GetPet().CurrentFocusPercent()
}
func (value *APLValueHunterCurrentPetFocusPercent) String() string {
return fmt.Sprintf("Current Pet Focus %%")
}
Loading
Loading