Skip to content

Commit

Permalink
Merge pull request #3993 from jarveson/jake/cat-apl
Browse files Browse the repository at this point in the history
cat apl updates
  • Loading branch information
jarveson committed Nov 2, 2023
2 parents 8079287 + 6468387 commit 8a7d40b
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 4 deletions.
13 changes: 12 additions & 1 deletion proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ message APLAction {
}
}

// NextIndex: 61
// NextIndex: 64
message APLValue {
oneof value {
// Operators
Expand Down Expand Up @@ -135,6 +135,7 @@ message APLValue {
APLValueSpellCPM spell_cpm = 42;
APLValueSpellIsChanneling spell_is_channeling = 56;
APLValueSpellChanneledTicks spell_channeled_ticks = 57;
APLValueSpellCurrentCost spell_current_cost = 62;

// Aura values
APLValueAuraIsActive aura_is_active = 22;
Expand All @@ -156,10 +157,12 @@ message APLValue {

// Properties
APLValueChannelClipDelay channel_clip_delay = 58;
APLValueFrontOfTarget front_of_target = 63;

// Class or Spec-specific values
APLValueTotemRemainingTime totem_remaining_time = 49;
APLValueCatExcessEnergy cat_excess_energy = 52;
APLValueCatNewSavageRoarDuration cat_new_savage_roar_duration = 61;
APLValueWarlockShouldRecastDrainSoul warlock_should_recast_drain_soul = 59;
APLValueWarlockShouldRefreshCorruption warlock_should_refresh_corruption = 60;
}
Expand Down Expand Up @@ -402,6 +405,9 @@ message APLValueSpellChannelTime {
}
message APLValueChannelClipDelay {
}
message APLValueFrontOfTarget {
}

message APLValueSpellTravelTime {
ActionID spell_id = 1;
}
Expand All @@ -414,6 +420,9 @@ message APLValueSpellIsChanneling {
message APLValueSpellChanneledTicks {
ActionID spell_id = 1;
}
message APLValueSpellCurrentCost {
ActionID spell_id = 1;
}

message APLValueAuraIsActive {
UnitReference source_unit = 2;
Expand Down Expand Up @@ -469,6 +478,8 @@ message APLValueTotemRemainingTime {
}
message APLValueCatExcessEnergy {
}
message APLValueCatNewSavageRoarDuration {
}
message APLValueWarlockShouldRecastDrainSoul {
}
message APLValueWarlockShouldRefreshCorruption {
Expand Down
20 changes: 20 additions & 0 deletions sim/core/apl_values_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,23 @@ func (value *APLValueChannelClipDelay) GetDuration(sim *Simulation) time.Duratio
func (value *APLValueChannelClipDelay) String() string {
return "Channel Clip Delay()"
}

type APLValueFrontOfTarget struct {
DefaultAPLValueImpl
unit *Unit
}

func (rot *APLRotation) newValueFrontOfTarget(config *proto.APLValueFrontOfTarget) APLValue {
return &APLValueFrontOfTarget{
unit: rot.unit,
}
}
func (value *APLValueFrontOfTarget) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeBool
}
func (value *APLValueFrontOfTarget) GetBool(sim *Simulation) bool {
return value.unit.PseudoStats.InFrontOfTarget
}
func (value *APLValueFrontOfTarget) String() string {
return "Front of Target()"
}
25 changes: 25 additions & 0 deletions sim/core/apl_values_spell.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,28 @@ func (value *APLValueSpellChanneledTicks) GetInt(_ *Simulation) int32 {
func (value *APLValueSpellChanneledTicks) String() string {
return fmt.Sprintf("ChanneledTicks(%s)", value.spell.ActionID)
}

type APLValueSpellCurrentCost struct {
DefaultAPLValueImpl
spell *Spell
}

func (rot *APLRotation) newValueSpellCurrentCost(config *proto.APLValueSpellCurrentCost) APLValue {
spell := rot.GetAPLSpell(config.SpellId)
if spell == nil {
return nil
}
return &APLValueSpellCurrentCost{
spell: spell,
}
}
func (value *APLValueSpellCurrentCost) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeFloat
}
func (value *APLValueSpellCurrentCost) GetFloat(_ *Simulation) float64 {
spell := value.spell
return spell.ApplyCostModifiers(spell.DefaultCast.Cost)
}
func (value *APLValueSpellCurrentCost) String() string {
return fmt.Sprintf("CurrentCost(%s)", value.spell.ActionID)
}
23 changes: 23 additions & 0 deletions sim/druid/feral/apl_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ func (cat *FeralDruid) NewAPLValue(rot *core.APLRotation, config *proto.APLValue
switch config.Value.(type) {
case *proto.APLValue_CatExcessEnergy:
return cat.newValueCatExcessEnergy(rot, config.GetCatExcessEnergy())
case *proto.APLValue_CatNewSavageRoarDuration:
return cat.newValueCatNewSavageRoarDuration(rot, config.GetCatNewSavageRoarDuration())
default:
return nil
}
Expand Down Expand Up @@ -67,3 +69,24 @@ func (value *APLValueCatExcessEnergy) GetFloat(sim *core.Simulation) float64 {
func (value *APLValueCatExcessEnergy) String() string {
return "Cat Excess Energy()"
}

type APLValueCatNewSavageRoarDuration struct {
core.DefaultAPLValueImpl
cat *FeralDruid
}

func (cat *FeralDruid) newValueCatNewSavageRoarDuration(rot *core.APLRotation, config *proto.APLValueCatNewSavageRoarDuration) core.APLValue {
return &APLValueCatNewSavageRoarDuration{
cat: cat,
}
}
func (value *APLValueCatNewSavageRoarDuration) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeDuration
}
func (value *APLValueCatNewSavageRoarDuration) GetDuration(sim *core.Simulation) time.Duration {
cat := value.cat
return cat.SavageRoarDurationTable[cat.ComboPoints()]
}
func (value *APLValueCatNewSavageRoarDuration) String() string {
return "New Savage Roar Duration()"
}
1 change: 0 additions & 1 deletion ui/core/components/character_stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ export class CharacterStats extends Component {
return [
Spec.SpecDeathknight,
Spec.SpecEnhancementShaman,
Spec.SpecFeralDruid,
Spec.SpecRetributionPaladin,
Spec.SpecRogue,
Spec.SpecWarrior
Expand Down
30 changes: 29 additions & 1 deletion ui/core/components/individual_sim_ui/apl_values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ import {
APLValueSpellCPM,
APLValueSpellIsChanneling,
APLValueSpellChanneledTicks,
APLValueSpellCurrentCost,
APLValueChannelClipDelay,
APLValueFrontOfTarget,
APLValueAuraIsActive,
APLValueAuraIsActiveWithReactionTime,
APLValueAuraRemainingTime,
Expand All @@ -72,6 +74,7 @@ import {
APLValueCatExcessEnergy,
APLValueWarlockShouldRecastDrainSoul,
APLValueWarlockShouldRefreshCorruption,
APLValueCatNewSavageRoarDuration,
} from '../../proto/apl.js';

import { EventID } from '../../typed_event.js';
Expand Down Expand Up @@ -543,6 +546,13 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
newValue: APLValueNumberTargets.create,
fields: [],
}),
'frontOfTarget': inputBuilder({
label: 'Front of Target',
submenu: ['Encounter'],
shortDescription: '<b>True</b> if facing from of target',
newValue: APLValueFrontOfTarget.create,
fields: [],
}),

// Resources
'currentHealth': inputBuilder({
Expand Down Expand Up @@ -725,6 +735,15 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
}),

// Spells
'spellCurrentCost': inputBuilder({
label: 'Current Cost',
submenu: ['Spell'],
shortDescription: 'Returns current resource cost of spell',
newValue: APLValueSpellCurrentCost.create,
fields: [
AplHelpers.actionIdFieldConfig('spellId', 'castable_spells', ''),
],
}),
'spellCanCast': inputBuilder({
label: 'Can Cast',
submenu: ['Spell'],
Expand Down Expand Up @@ -976,6 +995,15 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
fields: [
],
}),
'catNewSavageRoarDuration': inputBuilder({
label: 'New Savage Roar Duration',
submenu: ['Feral Druid'],
shortDescription: 'Returns duration of savage roar based on current combo points',
newValue: APLValueCatNewSavageRoarDuration.create,
includeIf: (player: Player<any>, isPrepull: boolean) => player.spec == Spec.SpecFeralDruid,
fields: [
],
}),
'warlockShouldRecastDrainSoul': inputBuilder({
label: 'Should Recast Drain Soul',
submenu: ['Warlock'],
Expand All @@ -989,7 +1017,7 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
label: 'Should Refresh Corruption',
submenu: ['Warlock'],
shortDescription: 'Returns <b>True</b> if the current Corruption has expired, or should be refreshed to get a better snapshot.',
newValue: APLValueWarlockShouldRecastDrainSoul.create,
newValue: APLValueWarlockShouldRefreshCorruption.create,
includeIf: (player: Player<any>, isPrepull: boolean) => player.getClass() == Class.ClassWarlock,
fields: [
AplHelpers.unitFieldConfig('targetUnit', 'targets'),
Expand Down
2 changes: 1 addition & 1 deletion ui/scss/core/components/detailed_results/_timeline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ $combo-points-color: #ffa07a;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
width: 10px;
background-color: yellow;
}
.rotation-timeline-cast {
Expand Down

0 comments on commit 8a7d40b

Please sign in to comment.