Skip to content

Commit

Permalink
Merge pull request #3706 from wowsims/apl
Browse files Browse the repository at this point in the history
Add option for channel clip delay. Currently only affects full-length channels
  • Loading branch information
jimmyt857 committed Sep 20, 2023
2 parents 0a9a128 + 97613b6 commit da48bab
Show file tree
Hide file tree
Showing 29 changed files with 664 additions and 619 deletions.
1 change: 1 addition & 0 deletions proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ message Player {
APLRotation rotation = 40;

int32 reaction_time_ms = 41;
int32 channel_clip_delay_ms = 42;
bool in_front_of_target = 23;
double distance_from_target = 33;

Expand Down
4 changes: 2 additions & 2 deletions proto/priest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ message ShadowPriest {
}
RotationType rotation_type = 1;
PreCastOption precast_type = 2;
double latency = 3; // Latency between actions
double latency = 3 [deprecated = true]; // Latency between actions
}
Rotation rotation = 1;

Expand All @@ -167,7 +167,7 @@ message ShadowPriest {
bool use_mind_blast = 4;
bool use_shadow_word_death = 5;
UnitReference power_infusion_target = 6;
double latency = 7; // Latency between actions
double latency = 7 [deprecated = true]; // Latency between actions
}
Options options = 3;
}
Expand Down
1 change: 1 addition & 0 deletions proto/ui.proto
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ message SavedSettings {
repeated Profession professions = 9;

int32 reaction_time_ms = 10;
int32 channel_clip_delay_ms = 14;
bool in_front_of_target = 11;
double distance_from_target = 12;
HealingModel healing_model = 13;
Expand Down
3 changes: 2 additions & 1 deletion sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func NewCharacter(party *Party, partyIndex int, player *proto.Player) Character

StatDependencyManager: stats.NewStatDependencyManager(),

ReactionTime: time.Duration(player.ReactionTimeMs) * time.Millisecond,
ReactionTime: MaxDuration(0, time.Duration(player.ReactionTimeMs)*time.Millisecond),
ChannelClipDelay: MaxDuration(0, time.Duration(player.ChannelClipDelayMs)*time.Millisecond),
DistanceFromTarget: player.DistanceFromTarget,
IsUsingAPL: player.Rotation != nil && player.Rotation.Type == proto.APLRotation_TypeAPL,
},
Expand Down
2 changes: 1 addition & 1 deletion sim/core/dot.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (dot *Dot) TickOnce(sim *Simulation) {
if dot.isChanneled && dot.Spell.Unit.IsUsingAPL {
if dot.MaxTicksRemaining() == 0 {
// If this was the last tick, wait 0ms to call the APL after the channel aura fully fades.
dot.Spell.Unit.WaitUntil(sim, sim.CurrentTime)
dot.Spell.Unit.WaitUntil(sim, sim.CurrentTime+dot.Spell.Unit.ChannelClipDelay)
} else {
// Give the APL settings a chance to interrupt the channel.
dot.Spell.Unit.Rotation.DoNextAction(sim)
Expand Down
1 change: 1 addition & 0 deletions sim/core/spell.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ func (unit *Unit) RegisterSpell(config SpellConfig) *Spell {

if unit.IsUsingAPL {
config.Cast.DefaultCast.ChannelTime = 0
config.Cast.DefaultCast.AfterCastDelay = 0
}

spell := &Spell{
Expand Down
26 changes: 16 additions & 10 deletions sim/core/test_generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package core

import (
"fmt"
"golang.org/x/exp/slices"
"strings"

"golang.org/x/exp/slices"

"github.com/wowsims/wotlk/sim/core/proto"
googleProto "google.golang.org/protobuf/proto"
)
Expand Down Expand Up @@ -163,15 +164,18 @@ func (combos *SettingsCombos) GetTest(testIdx int) (string, *proto.ComputeStatsR
rsr := &proto.RaidSimRequest{
Raid: SinglePlayerRaidProto(
WithSpec(&proto.Player{
Race: race,
Class: combos.Class,
Equipment: gearSetCombo.GearSet,
TalentsString: talentSetCombo.Talents,
Glyphs: talentSetCombo.Glyphs,
Consumes: buffsCombo.Consumes,
Buffs: buffsCombo.Player,
Profession1: proto.Profession_Engineering,
Cooldowns: combos.Cooldowns,
Race: race,
Class: combos.Class,
Equipment: gearSetCombo.GearSet,
TalentsString: talentSetCombo.Talents,
Glyphs: talentSetCombo.Glyphs,
Consumes: buffsCombo.Consumes,
Buffs: buffsCombo.Player,
Profession1: proto.Profession_Engineering,
Cooldowns: combos.Cooldowns,
DistanceFromTarget: 30,
ReactionTimeMs: 150,
ChannelClipDelayMs: 50,
}, specOptionsCombo.SpecOptions),
buffsCombo.Party,
buffsCombo.Raid,
Expand Down Expand Up @@ -470,6 +474,8 @@ func FullCharacterTestSuiteGenerator(config CharacterSuiteConfig) TestGenerator

InFrontOfTarget: config.InFrontOfTarget,
DistanceFromTarget: 30,
ReactionTimeMs: 150,
ChannelClipDelayMs: 50,
},
config.SpecOptions.SpecOptions)

Expand Down
3 changes: 3 additions & 0 deletions sim/core/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ type Unit struct {
// Used by certain APL values and actions.
ReactionTime time.Duration

// Amount of time following a post-GCD channel tick, to when the next action can be performed.
ChannelClipDelay time.Duration

// How far this unit is from its target(s). Measured in yards, this is used
// for calculating spell travel time for certain spells.
DistanceFromTarget float64
Expand Down
Loading

0 comments on commit da48bab

Please sign in to comment.