Skip to content

Commit

Permalink
Merge pull request #3269 from wowsims/apl
Browse files Browse the repository at this point in the history
Fix a few apl bugs
  • Loading branch information
jimmyt857 authored Jul 8, 2023
2 parents fe4e72d + fc43fa8 commit 13646a9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
3 changes: 2 additions & 1 deletion sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ func (unit *Unit) newAPLRotation(config *proto.APLRotation) *APLRotation {
rotation.curWarnings = nil
}

for i, action := range rotation.allAPLActions() {
for i, action := range rotation.priorityList {
action.impl.Finalize(rotation)

rotation.priorityListWarnings[configIdxs[i]] = append(rotation.priorityListWarnings[configIdxs[i]], rotation.curWarnings...)
rotation.curWarnings = nil

Expand Down
12 changes: 10 additions & 2 deletions sim/core/apl_actions_sequences.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ func (rot *APLRotation) newActionSequence(config *proto.APLActionSequence) APLAc
func (action *APLActionSequence) GetInnerActions() []*APLAction {
return Flatten(MapSlice(action.actions, func(action *APLAction) []*APLAction { return action.GetAllActions() }))
}
func (action *APLActionSequence) Finalize(*APLRotation) {}
func (action *APLActionSequence) Finalize(rot *APLRotation) {
for _, subaction := range action.actions {
subaction.impl.Finalize(rot)
}
}
func (action *APLActionSequence) Reset(*Simulation) {
action.curIdx = 0
}
Expand Down Expand Up @@ -92,7 +96,11 @@ func (rot *APLRotation) newActionStrictSequence(config *proto.APLActionStrictSeq
func (action *APLActionStrictSequence) GetInnerActions() []*APLAction {
return Flatten(MapSlice(action.actions, func(action *APLAction) []*APLAction { return action.GetAllActions() }))
}
func (action *APLActionStrictSequence) Finalize(*APLRotation) {}
func (action *APLActionStrictSequence) Finalize(rot *APLRotation) {
for _, subaction := range action.actions {
subaction.impl.Finalize(rot)
}
}
func (action *APLActionStrictSequence) Reset(*Simulation) {
action.curIdx = 0
}
Expand Down
1 change: 1 addition & 0 deletions sim/hunter/explosive_trap.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func (hunter *Hunter) registerExplosiveTrapSpell(timer *core.Timer) {
ActionID: core.ActionID{SpellID: 49067},
SpellSchool: core.SpellSchoolFire,
ProcMask: core.ProcMaskSpellDamage,
Flags: core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.19,
Expand Down
19 changes: 16 additions & 3 deletions ui/core/proto_utils/action_id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ export class ActionId {
const baseName = tooltipData['name'];
let name = baseName;
switch (baseName) {
case 'Explosive Shot':
if (this.spellId == 60053) {
name += ' (R4)';
} else if (this.spellId == 60052) {
name += ' (R3)';
}
break;
case 'Explosive Trap':
if (this.tag == 1) {
name += ' (Weaving)';
}
break;
case 'Arcane Blast':
if (this.tag == 1) {
name += ' (No Stacks)';
Expand Down Expand Up @@ -408,7 +420,7 @@ export class ActionId {
} else if (this.otherId) {
return 'other-' + this.otherId;
} else {
return 'empty-action';
throw new Error('Empty action id!');
}
}

Expand Down Expand Up @@ -481,7 +493,8 @@ export class ActionId {
}
}

private static readonly logRegex = /{((SpellID)|(ItemID)|(OtherID)): (\d+)(, Tag: (-?\d+))?}/g;
private static readonly logRegex = /{((SpellID)|(ItemID)|(OtherID)): (\d+)(, Tag: (-?\d+))?}/;
private static readonly logRegexGlobal = new RegExp(ActionId.logRegex, 'g');
private static fromMatch(match: RegExpMatchArray): ActionId {
const idType = match[1];
const id = parseInt(match[5]);
Expand All @@ -503,7 +516,7 @@ export class ActionId {
}

static async replaceAllInString(str: string): Promise<string> {
const matches = [...str.matchAll(ActionId.logRegex)];
const matches = [...str.matchAll(ActionId.logRegexGlobal)];

const replaceData = await Promise.all(matches.map(async match => {
const actionId = ActionId.fromMatch(match);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,7 @@

.apl-picker-builder-root.apl-action-sequence .apl-action-condition {
display: none;
}
.apl-picker-builder-root.apl-action-strictSequence .apl-action-condition {
display: none;
}

0 comments on commit 13646a9

Please sign in to comment.