Skip to content
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

Fix several small bugs related to channel / spriest #3749

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions sim/core/apl_values_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ func (rot *APLRotation) newValueConst(config *proto.APLValueConst) APLValue {
boolVal: config.Val != "",
}

if strings.ToLower(config.Val) == "true" {
result.boolVal = true
result.valType = proto.APLValueType_ValueTypeBool
return result
} else if strings.ToLower(config.Val) == "false" {
result.boolVal = false
result.valType = proto.APLValueType_ValueTypeBool
return result
}

if durVal, err := time.ParseDuration(config.Val); err == nil {
result.durationVal = durVal
result.valType = proto.APLValueType_ValueTypeDuration
Expand Down
4 changes: 3 additions & 1 deletion sim/core/dot.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ func (dot *Dot) TickOnce(sim *Simulation) {
if dot.isChanneled && dot.Spell.Unit.IsUsingAPL {
// Note: even if the clip delay is 0ms, need a WaitUntil so that APL is called after the channel aura fully fades.
if dot.MaxTicksRemaining() == 0 {
dot.Spell.Unit.WaitUntil(sim, sim.CurrentTime+dot.Spell.Unit.ChannelClipDelay)
if dot.Spell.Unit.GCD.IsReady(sim) {
dot.Spell.Unit.WaitUntil(sim, sim.CurrentTime+dot.Spell.Unit.ChannelClipDelay)
}
} else if dot.Spell.Unit.Rotation.shouldInterruptChannel(sim) {
dot.Cancel(sim)
dot.Spell.Unit.WaitUntil(sim, sim.CurrentTime+dot.Spell.Unit.ChannelClipDelay)
Expand Down
36 changes: 18 additions & 18 deletions sim/priest/healing/TestDisc.results
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ dps_results: {
dps_results: {
key: "TestDisc-AllItems-BlessedRegaliaofUndeadCleansing"
value: {
tps: 16.32773
hps: 3210.59379
tps: 16.32466
hps: 3210.02224
}
}
dps_results: {
Expand Down Expand Up @@ -189,15 +189,15 @@ dps_results: {
dps_results: {
key: "TestDisc-AllItems-CrimsonAcolyte'sRaiment"
value: {
tps: 15.23724
hps: 3617.95922
tps: 15.30562
hps: 3620.60223
}
}
dps_results: {
key: "TestDisc-AllItems-CrimsonAcolyte'sRegalia"
value: {
tps: 16.02513
hps: 3708.05555
tps: 16.02929
hps: 3686.08594
}
}
dps_results: {
Expand Down Expand Up @@ -266,15 +266,15 @@ dps_results: {
dps_results: {
key: "TestDisc-AllItems-DislodgedForeignObject-50348"
value: {
tps: 17.0725
tps: 17.0619
hps: 3621.43778
}
}
dps_results: {
key: "TestDisc-AllItems-DislodgedForeignObject-50353"
value: {
tps: 17.17594
hps: 3638.27588
tps: 16.94699
hps: 3639.64227
}
}
dps_results: {
Expand Down Expand Up @@ -308,7 +308,7 @@ dps_results: {
dps_results: {
key: "TestDisc-AllItems-EphemeralSnowflake-50260"
value: {
tps: 18.41134
tps: 18.4095
hps: 3603.63774
}
}
Expand Down Expand Up @@ -386,7 +386,7 @@ dps_results: {
key: "TestDisc-AllItems-GarbofFaith"
value: {
tps: 14.52615
hps: 3418.32699
hps: 3418.75382
}
}
dps_results: {
Expand Down Expand Up @@ -644,15 +644,15 @@ dps_results: {
dps_results: {
key: "TestDisc-AllItems-SanctificationGarb"
value: {
tps: 14.78178
hps: 3535.22675
tps: 14.79011
hps: 3530.40997
}
}
dps_results: {
key: "TestDisc-AllItems-SanctificationRegalia"
value: {
tps: 14.64321
hps: 3507.59616
tps: 14.63905
hps: 3509.97468
}
}
dps_results: {
Expand Down Expand Up @@ -840,15 +840,15 @@ dps_results: {
dps_results: {
key: "TestDisc-AllItems-Zabra'sRaiment"
value: {
tps: 14.84923
hps: 3708.98145
tps: 14.86221
hps: 3732.2729
}
}
dps_results: {
key: "TestDisc-AllItems-Zabra'sRegalia"
value: {
tps: 15.08364
hps: 3426.15129
hps: 3426.83291
}
}
dps_results: {
Expand Down
5 changes: 3 additions & 2 deletions sim/priest/mind_flay.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ func (priest *Priest) newMindFlaySpell(numTicksIdx int32) *core.Spell {
if wait > gcd && priest.Latency > 0 {
base := priest.Latency * 0.67
variation := base + sim.RandomFloat("spriest latency")*base // should vary from 0.66 - 1.33 of given latency
variation = core.MaxFloat(variation, 10) // no player can go under XXXms response time
cast.AfterCastDelay += time.Duration(variation) * time.Millisecond
if sim.Log != nil {
priest.Log(sim, "Latency: %0.02f, AfterCastDelay: %s", priest.Latency, cast.AfterCastDelay)
}
}
},
},
Expand Down Expand Up @@ -151,6 +153,5 @@ func (priest *Priest) AverageMindFlayLatencyDelay(numTicks int, gcd time.Duratio

base := priest.Latency * 0.25
variation := base + 0.5*base
variation = core.MaxFloat(variation, 10)
return time.Duration(variation) * time.Millisecond
}
6 changes: 4 additions & 2 deletions sim/priest/priest.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ type Priest struct {
ShadowWordPain *core.Spell
MindBlast *core.Spell
MindFlay []*core.Spell
MindFlayAPL *core.Spell
MindSear []*core.Spell
MindSearAPL *core.Spell
Penance *core.Spell
PenanceHeal *core.Spell
PowerWordShield *core.Spell
Expand Down Expand Up @@ -133,8 +135,8 @@ func (priest *Priest) Initialize() {
priest.registerPowerInfusionCD()

if priest.IsUsingAPL {
priest.newMindFlaySpell(0)
priest.newMindSearSpell(0)
priest.MindFlayAPL = priest.newMindFlaySpell(0)
priest.MindSearAPL = priest.newMindSearSpell(0)
}

priest.MindFlay = []*core.Spell{
Expand Down
6 changes: 6 additions & 0 deletions sim/priest/shadow_word_pain.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func (priest *Priest) registerShadowWordPainSpell() {
Label: "ShadowWordPain",
OnGain: func(_ *core.Aura, _ *core.Simulation) {
priest.MindBlast.DamageMultiplier *= twistedFaithMultiplier
if priest.MindFlayAPL != nil {
priest.MindFlayAPL.DamageMultiplier *= mindFlayMod
}
for _, spell := range priest.MindFlay {
if spell != nil {
spell.DamageMultiplier *= mindFlayMod
Expand All @@ -57,6 +60,9 @@ func (priest *Priest) registerShadowWordPainSpell() {
},
OnExpire: func(_ *core.Aura, _ *core.Simulation) {
priest.MindBlast.DamageMultiplier /= twistedFaithMultiplier
if priest.MindFlayAPL != nil {
priest.MindFlayAPL.DamageMultiplier /= mindFlayMod
}
for _, spell := range priest.MindFlay {
if spell != nil {
spell.DamageMultiplier /= mindFlayMod
Expand Down
3 changes: 3 additions & 0 deletions sim/priest/talents.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ func (priest *Priest) applyMisery() {
priest.VampiricTouch.RelatedAuras = append(priest.VampiricTouch.RelatedAuras, miseryAuras)
}
if priest.MindFlay[1] != nil {
if priest.IsUsingAPL {
priest.MindFlayAPL.RelatedAuras = append(priest.MindFlayAPL.RelatedAuras, miseryAuras)
}
priest.MindFlay[1].RelatedAuras = append(priest.MindFlay[1].RelatedAuras, miseryAuras)
priest.MindFlay[2].RelatedAuras = append(priest.MindFlay[2].RelatedAuras, miseryAuras)
priest.MindFlay[3].RelatedAuras = append(priest.MindFlay[3].RelatedAuras, miseryAuras)
Expand Down
11 changes: 8 additions & 3 deletions ui/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ export class Player<SpecType extends Spec> {
toProto(forExport?: boolean, forSimming?: boolean): PlayerProto {
const aplIsLaunched = aplLaunchStatuses[this.spec] == LaunchStatus.Launched;
const gear = this.getGear();
const aplRotation = forSimming ? this.getResolvedAplRotation() : this.aplRotation;
return withSpecProto(
this.spec,
PlayerProto.create({
Expand All @@ -1235,10 +1236,12 @@ export class Player<SpecType extends Spec> {
consumes: this.getConsumes(),
bonusStats: this.getBonusStats().toProto(),
buffs: this.getBuffs(),
cooldowns: aplIsLaunched ? Cooldowns.create({ hpPercentForDefensives: this.getCooldowns().hpPercentForDefensives }) : this.getCooldowns(),
cooldowns: (aplIsLaunched || (forSimming && aplRotation.type == APLRotationType.TypeAPL))
? Cooldowns.create({ hpPercentForDefensives: this.getCooldowns().hpPercentForDefensives })
: this.getCooldowns(),
talentsString: this.getTalentsString(),
glyphs: this.getGlyphs(),
rotation: forSimming ? this.getResolvedAplRotation() : this.aplRotation,
rotation: aplRotation,
profession1: this.getProfession1(),
profession2: this.getProfession2(),
reactionTimeMs: this.getReactionTime(),
Expand All @@ -1248,7 +1251,9 @@ export class Player<SpecType extends Spec> {
healingModel: this.getHealingModel(),
database: forExport ? SimDatabase.create() : this.toDatabase(),
}),
aplIsLaunched ? this.specTypeFunctions.rotationCreate() : this.getRotation(),
(aplIsLaunched || (forSimming && aplRotation.type == APLRotationType.TypeAPL))
? this.specTypeFunctions.rotationCreate()
: this.getRotation(),
this.getSpecOptions());
}

Expand Down
28 changes: 21 additions & 7 deletions ui/shadow_priest/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { EquipmentSpec } from '../core/proto/common.js';
import { Flask } from '../core/proto/common.js';
import { Food } from '../core/proto/common.js';
import { Glyphs } from '../core/proto/common.js';
import { ItemSpec } from '../core/proto/common.js';
import { Potions } from '../core/proto/common.js';
import { Faction } from '../core/proto/common.js';
import { RaidBuffs } from '../core/proto/common.js';
import { IndividualBuffs } from '../core/proto/common.js';
import { Debuffs } from '../core/proto/common.js';
Expand Down Expand Up @@ -191,14 +189,30 @@ export const P3_PRESET = {
]
}`),
};
export const ROTATION_PRESET_BASIC_APL = {
name: 'Basic APL',
export const ROTATION_PRESET_DEFAULT = {
name: 'Default',
rotation: SavedRotation.create({
specRotationOptionsJson: Rotation.toJsonString(DefaultRotation),
specRotationOptionsJson: Rotation.toJsonString(Rotation.create()),
rotation: APLRotation.fromJsonString(`{
"type": "TypeAPL",
"prepullActions": [
{"action":{"castSpell":{"spellId":{"otherId":"OtherActionPotion"}}},"doAtValue":{"const":{"val":"-1s"}}},
{"action":{"castSpell":{"spellId":{"spellId":48160}}},"doAtValue":{"const":{"val":"-0.97s"}}}
],
"priorityList": [
{"action":{"condition":{"cmp":{"op":"OpGe","lhs":{"remainingTime":{}},"rhs":{"const":{"val":"0s"}}}},"castSpell":{"spellId":{"spellId":34433}}}},
{"action":{"condition":{"cmp":{"op":"OpGe","lhs":{"currentTime":{}},"rhs":{"const":{"val":"1s"}}}},"autocastOtherCooldowns":{}}},
{"action":{"condition":{"cmp":{"op":"OpGe","lhs":{"currentTime":{}},"rhs":{"const":{"val":"61s"}}}},"castSpell":{"spellId":{"otherId":"OtherActionPotion"}}}},
{"action":{"condition":{"cmp":{"op":"OpLe","lhs":{"remainingTime":{}},"rhs":{"const":{"val":"2s"}}}},"castSpell":{"spellId":{"spellId":48300}}}},
{"action":{"condition":{"and":{"vals":[{"not":{"val":{"dotIsActive":{"spellId":{"spellId":48125}}}}},{"or":{"vals":[{"and":{"vals":[{"cmp":{"op":"OpEq","lhs":{"const":{"val":"5"}},"rhs":{"auraNumStacks":{"auraId":{"spellId":15258}}}}},{"cmp":{"op":"OpGe","lhs":{"remainingTime":{}},"rhs":{"const":{"val":"75s"}}}}]}},{"and":{"vals":[{"cmp":{"op":"OpLe","lhs":{"const":{"val":"3"}},"rhs":{"auraNumStacks":{"auraId":{"spellId":15258}}}}},{"cmp":{"op":"OpLt","lhs":{"remainingTime":{}},"rhs":{"const":{"val":"75s"}}}}]}}]}}]}},"castSpell":{"spellId":{"spellId":48125}}}},
{"action":{"condition":{"cmp":{"op":"OpLe","lhs":{"dotRemainingTime":{"spellId":{"spellId":48160}}},"rhs":{"spellCastTime":{"spellId":{"spellId":48160}}}}},"castSpell":{"spellId":{"spellId":48160}}}},
{"action":{"condition":{"not":{"val":{"dotIsActive":{"spellId":{"spellId":48300}}}}},"castSpell":{"spellId":{"spellId":48300}}}},
{"hide":true,"action":{"condition":{"and":{"vals":[{"cmp":{"op":"OpGe","lhs":{"spellCastTime":{"spellId":{"spellId":48127}}},"rhs":{"const":{"val":"750ms"}}}},{"cmp":{"op":"OpLe","lhs":{"auraRemainingTime":{"auraId":{"spellId":57669}}},"rhs":{"const":{"val":"5s"}}}}]}},"castSpell":{"spellId":{"spellId":48127}}}},
{"hide":true,"action":{"condition":{"cmp":{"op":"OpGe","lhs":{"spellCastTime":{"spellId":{"spellId":48127}}},"rhs":{"const":{"val":"750ms"}}}},"castSpell":{"spellId":{"spellId":48127}}}},
{"action":{"condition":{"cmp":{"op":"OpEq","lhs":{"auraNumStacks":{"auraId":{"spellId":15258}}},"rhs":{"const":{"val":"5"}}}},"strictSequence":{"actions":[{"castSpell":{"spellId":{"spellId":14751}}},{"castSpell":{"spellId":{"spellId":48156}}}]}}},
{"action":{"channelSpell":{"spellId":{"spellId":48156},"interruptIf":{"const":{"val":"true"}}}}},
{"action":{"castSpell":{"spellId":{"spellId":47585}}}}
]
}`),
}`),
}),
};
};
2 changes: 1 addition & 1 deletion ui/shadow_priest/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class ShadowPriestSimUI extends IndividualSimUI<Spec.SpecShadowPriest> {
Presets.StandardTalents,
],
rotations: [
Presets.ROTATION_PRESET_BASIC_APL,
Presets.ROTATION_PRESET_DEFAULT,
],
// Preset gear configurations that the user can quickly select.
gear: [
Expand Down
Loading