Skip to content

Commit

Permalink
Merge pull request #1160 from wowsims/feature/shaman-fire-elemental-s…
Browse files Browse the repository at this point in the history
…napshot-apl-check

Feature/shaman fire elemental snapshot apl check
  • Loading branch information
1337LutZ authored Nov 2, 2024
2 parents 65ced30 + 0c92bb3 commit 30ccd72
Show file tree
Hide file tree
Showing 11 changed files with 874 additions and 852 deletions.
3 changes: 3 additions & 0 deletions proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ message APLValue {
APLValueWarlockShouldRefreshCorruption warlock_should_refresh_corruption = 60;
APLValueCurrentEclipsePhase druid_current_eclipse_phase = 70;
APLValueMageCurrentCombustionDotEstimate mage_current_combustion_dot_estimate = 77;
APLValueShamanCanSnapshotStrongerFireElemental shaman_can_snapshot_stronger_fire_elemental = 82;
}
}

Expand Down Expand Up @@ -621,3 +622,5 @@ message APLValueWarlockShouldRefreshCorruption {
}
message APLValueMageCurrentCombustionDotEstimate {
}
message APLValueShamanCanSnapshotStrongerFireElemental {
}
4 changes: 4 additions & 0 deletions sim/core/pet.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ func (pet *Pet) Disable(sim *Simulation) {
}
}

func (pet *Pet) GetInheritedStats() stats.Stats {
return pet.inheritedStats
}

// Default implementations for some Agent functions which most Pets don't need.
func (pet *Pet) GetCharacter() *Character {
return &pet.Character
Expand Down
33 changes: 33 additions & 0 deletions sim/shaman/_apl_values.go → sim/shaman/apl_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import (

"github.com/wowsims/cata/sim/core"
"github.com/wowsims/cata/sim/core/proto"
"github.com/wowsims/cata/sim/core/stats"
)

func (shaman *Shaman) NewAPLValue(rot *core.APLRotation, config *proto.APLValue) core.APLValue {
switch config.Value.(type) {
case *proto.APLValue_TotemRemainingTime:
return shaman.newValueTotemRemainingTime(rot, config.GetTotemRemainingTime())
case *proto.APLValue_ShamanCanSnapshotStrongerFireElemental:
return shaman.newValueCanSnapshotStrongerFireElemental(config.GetShamanCanSnapshotStrongerFireElemental())
default:
return nil
}
Expand Down Expand Up @@ -52,3 +55,33 @@ func (value *APLValueTotemRemainingTime) GetDuration(sim *core.Simulation) time.
func (value *APLValueTotemRemainingTime) String() string {
return fmt.Sprintf("Totem Remaining Time(%s)", value.totemType.String())
}

type APLValueShamanCanSnapshotStrongerFireElemental struct {
core.DefaultAPLValueImpl
shaman *Shaman
}

func (shaman *Shaman) newValueCanSnapshotStrongerFireElemental(_ *proto.APLValueShamanCanSnapshotStrongerFireElemental) core.APLValue {
return &APLValueShamanCanSnapshotStrongerFireElemental{
shaman: shaman,
}
}
func (value *APLValueShamanCanSnapshotStrongerFireElemental) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeBool
}
func (value *APLValueShamanCanSnapshotStrongerFireElemental) GetBool(sim *core.Simulation) bool {
shaman := value.shaman

if shaman.FireElemental.IsEnabled() {
simulatedStats := shaman.fireElementalStatInheritance()(shaman.GetStats())
potentialFireElementalSpellPower := simulatedStats[stats.SpellPower]
currentFireElementalSpellPower := shaman.FireElemental.GetPet().GetInheritedStats()[stats.SpellPower]
return potentialFireElementalSpellPower > currentFireElementalSpellPower
}

return true
}

func (value *APLValueShamanCanSnapshotStrongerFireElemental) String() string {
return "Can Snapshot Stronger Fire Elemental"
}
Loading

0 comments on commit 30ccd72

Please sign in to comment.