Skip to content

Commit 62c6dfe

Browse files
committed
Add Current Vengeance & Stagger APL helpers
1 parent 89ae3fe commit 62c6dfe

6 files changed

Lines changed: 1393 additions & 1304 deletions

File tree

proto/apl.proto

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ message APLAction {
8585
}
8686
}
8787

88-
// NextIndex: 100
88+
// NextIndex: 102
8989
message APLValue {
9090
UUID uuid = 87;
9191

@@ -203,6 +203,7 @@ message APLValue {
203203
APLValueFrontOfTarget front_of_target = 63;
204204

205205
// Class or Spec-specific values
206+
APLValueCurrentVengeancePercent current_vengeance_percent = 101;
206207
APLValueTotemRemainingTime totem_remaining_time = 49;
207208
APLValueCatExcessEnergy cat_excess_energy = 52;
208209
APLValueCatNewSavageRoarDuration cat_new_savage_roar_duration = 61;
@@ -214,6 +215,7 @@ message APLValue {
214215
APLValueShamanFireElementalDuration shaman_fire_elemental_duration = 83;
215216
APLValueMonkCurrentChi monk_current_chi = 95;
216217
APLValueMonkMaxChi monk_max_chi = 96;
218+
APLValueBrewmasterMonkCurrentStaggerPercent brewmaster_monk_current_stagger_percent = 100;
217219
}
218220
}
219221

@@ -686,21 +688,18 @@ message APLValueSequenceTimeToReady {
686688
message APLValueTotemRemainingTime {
687689
ShamanTotems.TotemType totem_type = 1;
688690
}
689-
message APLValueCatExcessEnergy {
690-
}
691-
message APLValueCatNewSavageRoarDuration {
692-
}
693-
message APLValueWarlockShouldRecastDrainSoul {
694-
}
691+
message APLValueCatExcessEnergy {}
692+
message APLValueCatNewSavageRoarDuration {}
693+
message APLValueWarlockShouldRecastDrainSoul {}
695694
message APLValueWarlockShouldRefreshCorruption {
696695
UnitReference target_unit = 1;
697696
}
698-
message APLValueMageCurrentCombustionDotEstimate {
699-
}
700-
message APLValueShamanCanSnapshotStrongerFireElemental {
701-
}
702-
message APLValueShamanFireElementalDuration {
703-
}
697+
message APLValueMageCurrentCombustionDotEstimate {}
698+
message APLValueShamanCanSnapshotStrongerFireElemental {}
699+
message APLValueShamanFireElementalDuration {}
704700

705701
message APLValueMonkCurrentChi {}
706702
message APLValueMonkMaxChi {}
703+
message APLValueBrewmasterMonkCurrentStaggerPercent {}
704+
705+
message APLValueCurrentVengeancePercent {}

sim/core/apl_value.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ func (rot *APLRotation) newAPLValue(config *proto.APLValue) APLValue {
142142
value = rot.newValueFocusTimeToTarget(config.GetFocusTimeToTarget(), config.Uuid)
143143
case *proto.APLValue_CurrentGenericResource:
144144
value = rot.newValueCurrentGenericResource(config.GetCurrentGenericResource(), config.Uuid)
145+
// Tank "resource"
146+
case *proto.APLValue_CurrentVengeancePercent:
147+
value = rot.newValueCurrentVengeancePercent(config.GetCurrentVengeancePercent(), config.Uuid)
145148

146149
// Resources Runes
147150
case *proto.APLValue_CurrentRuneCount:

sim/core/apl_values_resources.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,3 +512,34 @@ func (value *APLValueCurrentGenericResource) GetInt(sim *Simulation) int32 {
512512
func (value *APLValueCurrentGenericResource) String() string {
513513
return "Current {GENERIC_RESOURCE}"
514514
}
515+
516+
type APLValueCurrentVengeancePercent struct {
517+
DefaultAPLValueImpl
518+
unit *Unit
519+
aura *Aura
520+
}
521+
522+
func (rot *APLRotation) newValueCurrentVengeancePercent(config *proto.APLValueCurrentVengeancePercent, uuid *proto.UUID) APLValue {
523+
unit := rot.unit
524+
if unit == nil {
525+
return nil
526+
}
527+
vengeanceAura := unit.GetAura("Vengeance")
528+
if vengeanceAura == nil {
529+
rot.ValidationMessageByUUID(uuid, proto.LogLevel_Warning, "%s does not know Vengeance", unit.Label)
530+
return nil
531+
}
532+
return &APLValueCurrentVengeancePercent{
533+
unit: unit,
534+
aura: vengeanceAura,
535+
}
536+
}
537+
func (value *APLValueCurrentVengeancePercent) Type() proto.APLValueType {
538+
return proto.APLValueType_ValueTypeFloat
539+
}
540+
func (value *APLValueCurrentVengeancePercent) GetFloat(sim *Simulation) float64 {
541+
return float64(value.aura.GetStacks()) / value.unit.MaxHealth()
542+
}
543+
func (value *APLValueCurrentVengeancePercent) String() string {
544+
return fmt.Sprintf("Current Vengeance %%")
545+
}

0 commit comments

Comments
 (0)