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

Prepull Combo Point APL Addition #649

Merged
merged 10 commits into from
Apr 12, 2024
7 changes: 6 additions & 1 deletion proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ message APLListItem {
APLAction action = 3; // The action to be performed.
}

// NextIndex: 23
// NextIndex: 24
message APLAction {
APLValue condition = 1; // If set, action will only execute if value is true or != 0.

Expand Down Expand Up @@ -71,6 +71,7 @@ message APLAction {
APLActionTriggerICD trigger_icd = 11;
APLActionItemSwap item_swap = 17;
APLActionMove move = 18;
APLActionAddComboPoints add_combo_points = 23;

// Class or Spec-specific actions
APLActionCatOptimalRotationAction cat_optimal_rotation_action = 19;
Expand Down Expand Up @@ -247,6 +248,10 @@ message APLActionActivateAuraWithStacks {
string num_stacks = 2;
}

message APLActionAddComboPoints {
string num_points = 2;
}

message APLActionTriggerICD {
ActionID aura_id = 1;
}
Expand Down
1 change: 1 addition & 0 deletions proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ enum OtherAction {
OtherActionHealingModel = 12; // Indicates healing received from healing model.
OtherActionPotion = 13; // Used by APL to generically refer to either the prepull or combat potion.
OtherActionMove = 14; // Used by movement to be able to show it in timeline
OtherActionComboPoints = 15; //Used by APL to generically add Combo Points.
}

message ActionID {
Expand Down
2 changes: 2 additions & 0 deletions sim/core/apl_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ func (rot *APLRotation) newAPLActionImpl(config *proto.APLAction) APLActionImpl
return rot.newActionMove(config.GetMove())
case *proto.APLAction_CustomRotation:
return rot.newActionCustomRotation(config.GetCustomRotation())
case *proto.APLAction_AddComboPoints:
return rot.newActionAddComboPoints(config.GetAddComboPoints())
default:
return nil
}
Expand Down
41 changes: 41 additions & 0 deletions sim/core/apl_actions_misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,47 @@ func (action *APLActionActivateAuraWithStacks) String() string {
return fmt.Sprintf("Activate Aura(%s) Stacks(%d)", action.aura.ActionID, action.numStacks)
}

type APLActionAddComboPoints struct {
defaultAPLActionImpl
character *Character
numPoints int32
metrics *ResourceMetrics
}

func (rot *APLRotation) newActionAddComboPoints(config *proto.APLActionAddComboPoints) APLActionImpl {
character := rot.unit.Env.Raid.GetPlayerFromUnit(rot.unit).GetCharacter()
numPoints, err := strconv.Atoi(config.NumPoints)
metrics := character.NewComboPointMetrics(ActionID{OtherID: proto.OtherAction_OtherActionComboPoints})

if err != nil {
numPoints = 0
}
return &APLActionAddComboPoints{
character: character,
numPoints: int32(numPoints),
metrics: metrics,
}
}

func (action *APLActionAddComboPoints) IsReady(sim *Simulation) bool {
return true
}

func (action *APLActionAddComboPoints) Execute(sim *Simulation) {
numPoints := strconv.Itoa(int(action.numPoints))

if sim.Log != nil {
action.character.Log(sim, "Adding combo points (%s points)", numPoints)
}

action.character.AddComboPoints(sim, action.numPoints, action.metrics)
}

func (action *APLActionAddComboPoints) String() string {
numPoints := strconv.Itoa(int(action.numPoints))
return fmt.Sprintf("Add Combo Points(%s)", numPoints)
}

type APLActionTriggerICD struct {
defaultAPLActionImpl
aura *Aura
Expand Down
16 changes: 16 additions & 0 deletions ui/core/components/individual_sim_ui/apl_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
APLAction,
APLActionActivateAura,
APLActionActivateAuraWithStacks,
APLActionAddComboPoints,
APLActionAutocastOtherCooldowns,
APLActionCancelAura,
APLActionCastPaladinPrimarySeal,
Expand Down Expand Up @@ -559,6 +560,21 @@ const actionKindFactories: { [f in NonNullable<APLActionKind>]: ActionKindConfig
}),
],
}),
['addComboPoints']: inputBuilder({
label: 'Add Combo Points',
submenu: ['Misc'],
shortDescription: 'Add combo points to target.',
includeIf: (player: Player<any>, isPrepull: boolean) => isPrepull,
newValue: () =>
APLActionAddComboPoints.create({
numPoints: '1',
}),
fields: [
AplHelpers.stringFieldConfig('numPoints', {
labelTooltip: 'Desired number of initial combo points.',
}),
],
}),
['cancelAura']: inputBuilder({
label: 'Cancel Aura',
submenu: ['Misc'],
Expand Down
4 changes: 4 additions & 0 deletions ui/core/proto_utils/action_id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export class ActionId {
baseName = 'Energy Tick';
iconUrl = resourceTypeToIcon[ResourceType.ResourceTypeEnergy];
break;
case OtherAction.OtherActionComboPoints:
baseName = 'Combo Point Gain';
iconUrl = resourceTypeToIcon[ResourceType.ResourceTypeComboPoints];
break;
case OtherAction.OtherActionFocusRegen:
baseName = 'Focus Tick';
iconUrl = resourceTypeToIcon[ResourceType.ResourceTypeFocus];
Expand Down
Loading