-
Notifications
You must be signed in to change notification settings - Fork 59
Hunter - Adding movement to hunter pets #1455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a391d55
added movement to hunter pet ai, added pet focus to apl
ncberman ead033c
revert scorpid rotation change
ncberman cbb9bea
Merge branch 'master' into hunter_pet_movement
ncberman 326508d
updated tests
ncberman 338d418
add check for active pet to apl condition
ncberman d28e4a1
Merge branch 'master' into hunter_pet_movement
ncberman 215a9d5
update tests
ncberman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 %%") | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.