Skip to content

Commit

Permalink
Merge pull request #3272 from wowsims/apl
Browse files Browse the repository at this point in the history
Fix more APL bugs and update default rotation
  • Loading branch information
jimmyt857 authored Jul 8, 2023
2 parents 99f29f7 + e1e65b9 commit e3d0d09
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 7 deletions.
1 change: 1 addition & 0 deletions proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ message RaidSimResult {
// RPC ComputeStats
message ComputeStatsRequest {
Raid raid = 1;
Encounter encounter = 2;
}
message AuraStats {
ActionID id = 1;
Expand Down
6 changes: 5 additions & 1 deletion sim/core/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import (
* Returns character stats taking into account gear / buffs / consumes / etc
*/
func ComputeStats(csr *proto.ComputeStatsRequest) *proto.ComputeStatsResult {
_, raidStats := NewEnvironment(csr.Raid, &proto.Encounter{})
encounter := csr.Encounter
if encounter == nil {
encounter = &proto.Encounter{}
}
_, raidStats := NewEnvironment(csr.Raid, encounter)

return &proto.ComputeStatsResult{
RaidStats: raidStats,
Expand Down
9 changes: 8 additions & 1 deletion sim/core/apl_actions_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ func (rot *APLRotation) newActionMultidot(config *proto.APLActionMultidot) APLAc
maxOverlap = rot.newValueConst(&proto.APLValueConst{Val: "0ms"})
}

maxDots := config.MaxDots
numTargets := unit.Env.GetNumTargets()
if numTargets < maxDots {
rot.validationWarning("Encounter only has %d targets. Using that for Max Dots instead of %d", numTargets, maxDots)
maxDots = numTargets
}

return &APLActionMultidot{
spell: spell,
maxDots: MinInt32(config.MaxDots, unit.Env.GetNumTargets()),
maxDots: maxDots,
maxOverlap: maxOverlap,
}
}
Expand Down
2 changes: 1 addition & 1 deletion sim/hunter/raptor_strike.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (hunter *Hunter) registerRaptorStrikeSpell() {
ActionID: core.ActionID{SpellID: 48996},
SpellSchool: core.SpellSchoolPhysical,
ProcMask: core.ProcMaskMeleeMHAuto | core.ProcMaskMeleeMHSpecial,
Flags: core.SpellFlagMeleeMetrics | core.SpellFlagIncludeTargetBonusDamage | core.SpellFlagAPL,
Flags: core.SpellFlagMeleeMetrics | core.SpellFlagIncludeTargetBonusDamage,

ManaCost: core.ManaCostOptions{
BaseCost: 0.04,
Expand Down
7 changes: 5 additions & 2 deletions ui/core/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class Sim {
this.encounter.changeEmitter,
]);

this.raid.changeEmitter.on(eventID => this.updateCharacterStats(eventID));
TypedEvent.onAny([this.raid.changeEmitter, this.encounter.changeEmitter]).on(eventID => this.updateCharacterStats(eventID));
}

waitForInit(): Promise<void> {
Expand Down Expand Up @@ -277,7 +277,10 @@ export class Sim {
// request is in-flight.
const players = this.raid.getPlayers();

const req = ComputeStatsRequest.create({ raid: this.getModifiedRaidProto() });
const req = ComputeStatsRequest.create({
raid: this.getModifiedRaidProto(),
encounter: this.encounter.toProto(),
});
const result = await this.workerPool.computeStats(req);

if (result.errorResult != "") {
Expand Down
12 changes: 12 additions & 0 deletions ui/hunter/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,24 @@ export const ROTATION_PRESET_DEFAULT = {
"condition": {"cmp": {"op": "OpGt", "lhs": {"currentTime": {}}, "rhs": { "const": {"val": "10s"}}}},
"autocastOtherCooldowns": {}
}},
{"action": {
"condition":{"and":{"vals":[{"not":{"val":{"auraIsActive":{"auraId":{"spellId":34074}}}}},{"cmp":{"op":"OpLt","lhs":{"currentManaPercent":{}},"rhs":{"const":{"val":"10%"}}}}]}},
"castSpell":{"spellId":{"spellId":34074}}
}},
{"action":{
"condition":{"and":{"vals":[{"not":{"val":{"auraIsActive":{"auraId":{"spellId":61847}}}}},{"cmp":{"op":"OpGt","lhs":{"currentManaPercent":{}},"rhs":{"const":{"val":"30%"}}}}]}},
"castSpell":{"spellId":{"spellId":61847}}
}},
{"action": {
"condition": {"not": {"val": {"dotIsActive": {"spellId": { "spellId": 49001 }}}}},
"castSpell": {"spellId": { "spellId": 49001 }}
}},
{"action": {"castSpell": {"spellId": { "spellId": 61006 }}}},
{"action": {"castSpell": {"spellId": { "spellId": 63672 }}}},
{"action":{
"condition":{"dotIsActive":{"spellId":{"spellId":60053}}},
"castSpell":{"spellId":{"spellId":60052}}
}},
{"action": {
"condition": {"not": {"val": {"dotIsActive": {"spellId": { "spellId": 60053 }}}}},
"castSpell": {"spellId": { "spellId": 60053 }}
Expand Down
4 changes: 2 additions & 2 deletions ui/shared/bootstrap_overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ body.addEventListener('mouseover', event => {
body.addEventListener('mouseleave', event => {
let e = event as MouseEvent;
let target = event.target as HTMLElement;
let toggle = target.closest('[data-bs-toggle=dropdown]');
let toggle = target.closest('[data-bs-toggle=dropdown]') as HTMLElement | null;
// Hide dropdowns when hovering off of the toggle, so long as the new target is not part of the dropdown as well
if (toggle) {
let dropdown = Dropdown.getOrCreateInstance(toggle);
let dropdownMenu = toggle.nextElementSibling as HTMLElement;
let relatedTarget = e.relatedTarget as HTMLElement;
if (relatedTarget == null || !isDescendant(relatedTarget, dropdownMenu))
if (relatedTarget == null || (!isDescendant(relatedTarget, dropdownMenu) && !isDescendant(relatedTarget, toggle)))
dropdown.hide();
}

Expand Down

0 comments on commit e3d0d09

Please sign in to comment.