Skip to content

Commit

Permalink
Launch APL for mage sim
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyt857 committed Oct 9, 2023
1 parent 20f14c5 commit 13eadf7
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 23 deletions.
6 changes: 3 additions & 3 deletions proto/mage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ message Mage {
Type type = 1;

// Arcane Options.
int32 extra_blasts_during_first_ap = 10;
int32 missile_barrage_below_arcane_blast_stacks = 14;
int32 extra_blasts_during_first_ap = 10 [deprecated = true];
int32 missile_barrage_below_arcane_blast_stacks = 14 [deprecated = true];
double missile_barrage_below_mana_percent = 15;
double blast_without_missile_barrage_above_mana_percent = 16;
double only_3_arcane_blast_stacks_below_mana_percent = 17;
Expand All @@ -182,7 +182,7 @@ message Mage {
Flamestrike = 1;
Blizzard = 2;
}
AoeRotation aoe = 7;
AoeRotation aoe = 7 [deprecated = true];
}
Rotation rotation = 1;

Expand Down
2 changes: 1 addition & 1 deletion ui/core/launched_sims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const aplLaunchStatuses: Record<Spec, LaunchStatus> = {
[Spec.SpecEnhancementShaman]: LaunchStatus.Beta,
[Spec.SpecRestorationShaman]: LaunchStatus.Launched,
[Spec.SpecHunter]: LaunchStatus.Launched,
[Spec.SpecMage]: LaunchStatus.Beta,
[Spec.SpecMage]: LaunchStatus.Launched,
[Spec.SpecRogue]: LaunchStatus.Beta,
[Spec.SpecHolyPaladin]: LaunchStatus.Launched,
[Spec.SpecProtectionPaladin]: LaunchStatus.Launched,
Expand Down
2 changes: 1 addition & 1 deletion ui/mage/apls/arcane.apl.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{"action":{"autocastOtherCooldowns":{}}},
{"action":{"condition":{"not":{"val":{"auraIsActive":{"auraId":{"spellId":12472}}}}},"castSpell":{"spellId":{"spellId":26297}}}},
{"action":{"condition":{"not":{"val":{"auraIsActive":{"auraId":{"spellId":12472}}}}},"castSpell":{"spellId":{"spellId":54758}}}},
{"action":{"condition":{"not":{"val":{"auraIsActive":{"auraId":{"spellId":12472}}}}},"castSpell":{"spellId":{"itemId":40211}}}},
{"action":{"condition":{"not":{"val":{"auraIsActive":{"auraId":{"spellId":12472}}}}},"castSpell":{"spellId":{"otherId":"OtherActionPotion"}}}},
{"action":{"condition":{"cmp":{"op":"OpLt","lhs":{"auraNumStacks":{"auraId":{"spellId":36032}}},"rhs":{"const":{"val":"4"}}}},"castSpell":{"spellId":{"spellId":42897}}}},
{"action":{"condition":{"auraIsActiveWithReactionTime":{"auraId":{"spellId":44401}}},"castSpell":{"spellId":{"spellId":42846}}}},
{"action":{"condition":{"cmp":{"op":"OpLe","lhs":{"currentManaPercent":{}},"rhs":{"const":{"val":"25%"}}}},"castSpell":{"spellId":{"spellId":12051}}}},
Expand Down
12 changes: 0 additions & 12 deletions ui/mage/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ export const MageRotationConfig = {
labelTooltip: 'When above this mana %, spam AB until a Missile Barrage proc occurs.',
showWhen: (player: Player<Spec.SpecMage>) => player.getRotation().type == RotationType.Arcane,
}),
InputHelpers.makeRotationNumberInput<Spec.SpecMage>({
fieldName: 'extraBlastsDuringFirstAp',
label: 'Extra ABs during first AP',
labelTooltip: 'Extend AB streak by this mana casts, during the first Arcane Power CD duration.',
showWhen: (player: Player<Spec.SpecMage>) => player.getRotation().type == RotationType.Arcane,
}),
InputHelpers.makeRotationNumberInput<Spec.SpecMage>({
fieldName: 'missileBarrageBelowArcaneBlastStacks',
label: 'Use Missile Barrage below n AB stacks',
labelTooltip: 'Setting this to 1 or 2 can potentially be a DPS increase with Arcane Barrage rotation or T8 4pc set bonus.',
showWhen: (player: Player<Spec.SpecMage>) => player.getRotation().type == RotationType.Arcane,
}),
InputHelpers.makeRotationNumberInput<Spec.SpecMage>({
fieldName: 'missileBarrageBelowManaPercent',
percent: true,
Expand Down
43 changes: 40 additions & 3 deletions ui/mage/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '../core/proto/mage.js';

import * as Tooltips from '../core/constants/tooltips.js';
import { APLRotation } from '../core/proto/apl.js';
import { APLRotation, APLRotation_Type } from '../core/proto/apl.js';

import ArcaneApl from './apls/arcane.apl.json';
import FireApl from './apls/fire.apl.json';
Expand Down Expand Up @@ -161,8 +161,6 @@ export const DefaultArcaneRotation = MageRotation.create({
type: RotationType.Arcane,
only3ArcaneBlastStacksBelowManaPercent: 0.15,
blastWithoutMissileBarrageAboveManaPercent: 0.2,
extraBlastsDuringFirstAp: 0,
missileBarrageBelowArcaneBlastStacks: 0,
missileBarrageBelowManaPercent: 0,
});

Expand All @@ -185,6 +183,19 @@ export const OtherDefaults = {
profession2: Profession.Tailoring,
};

export const ARCANE_ROTATION_PRESET_SIMPLE = {
name: 'Simple Arcane',
enableWhen: (player: Player<Spec.SpecMage>) => player.getTalentTree() == 0,
rotation: SavedRotation.create({
rotation: {
type: APLRotation_Type.TypeSimple,
simple: {
specRotationJson: MageRotation.toJsonString(DefaultArcaneRotation),
},
},
}),
}

export const ARCANE_ROTATION_PRESET_DEFAULT = {
name: 'Arcane',
enableWhen: (player: Player<Spec.SpecMage>) => player.getTalentTree() == 0,
Expand All @@ -194,6 +205,19 @@ export const ARCANE_ROTATION_PRESET_DEFAULT = {
}),
}

export const FIRE_ROTATION_PRESET_SIMPLE = {
name: 'Simple Fire',
enableWhen: (player: Player<Spec.SpecMage>) => player.getTalentTree() == 1,
rotation: SavedRotation.create({
rotation: {
type: APLRotation_Type.TypeSimple,
simple: {
specRotationJson: MageRotation.toJsonString(DefaultFireRotation),
},
},
}),
}

export const FIRE_ROTATION_PRESET_DEFAULT = {
name: 'Fire',
enableWhen: (player: Player<Spec.SpecMage>) => player.getTalentTree() == 1,
Expand All @@ -212,6 +236,19 @@ export const FROSTFIRE_ROTATION_PRESET_DEFAULT = {
}),
}

export const FROST_ROTATION_PRESET_SIMPLE = {
name: 'Simple Frost',
enableWhen: (player: Player<Spec.SpecMage>) => player.getTalentTree() == 2,
rotation: SavedRotation.create({
rotation: {
type: APLRotation_Type.TypeSimple,
simple: {
specRotationJson: MageRotation.toJsonString(DefaultFrostRotation),
},
},
}),
}

export const FROST_ROTATION_PRESET_DEFAULT = {
name: 'Frost',
enableWhen: (player: Player<Spec.SpecMage>) => player.getTalentTree() == 2,
Expand Down
95 changes: 92 additions & 3 deletions ui/mage/sim.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import {Debuffs, IndividualBuffs, PartyBuffs, RaidBuffs, Spec, Stat, TristateEffect} from '../core/proto/common.js';
import {APLRotation, APLRotation_Type,} from '../core/proto/apl.js';
import {Cooldowns, Debuffs, IndividualBuffs, PartyBuffs, RaidBuffs, Spec, Stat, TristateEffect} from '../core/proto/common.js';
import {APLAction, APLListItem, APLPrepullAction, APLRotation} from '../core/proto/apl.js';
import {Stats} from '../core/proto_utils/stats.js';
import {Player} from '../core/player.js';
import {IndividualSimUI} from '../core/individual_sim_ui.js';
import {
Mage_Rotation as MageRotation,
Mage_Rotation_PrimaryFireSpell as PrimaryFireSpell,
Mage_Rotation_Type as RotationType,
} from '../core/proto/mage.js';

import {Mage_Rotation_Type as RotationType,} from '../core/proto/mage.js';
import * as OtherInputs from '../core/components/other_inputs.js';
import * as Mechanics from '../core/constants/mechanics.js';
import * as AplUtils from '../core/proto_utils/apl_utils.js';

import * as MageInputs from './inputs.js';
import * as Presets from './presets.js';
Expand Down Expand Up @@ -141,6 +146,9 @@ export class MageSimUI extends IndividualSimUI<Spec.SpecMage> {
presets: {
// Preset rotations that the user can quickly select.
rotations: [
Presets.ARCANE_ROTATION_PRESET_SIMPLE,
Presets.FIRE_ROTATION_PRESET_SIMPLE,
Presets.FROST_ROTATION_PRESET_SIMPLE,
Presets.ARCANE_ROTATION_PRESET_DEFAULT,
Presets.FIRE_ROTATION_PRESET_DEFAULT,
Presets.FROSTFIRE_ROTATION_PRESET_DEFAULT,
Expand Down Expand Up @@ -204,6 +212,87 @@ export class MageSimUI extends IndividualSimUI<Spec.SpecMage> {
return Presets.FROST_ROTATION_PRESET_DEFAULT.rotation.rotation!;
}
},

simpleRotation: (player: Player<Spec.SpecMage>, simple: MageRotation, cooldowns: Cooldowns): APLRotation => {
let [prepullActions, actions] = AplUtils.standardCooldownDefaults(cooldowns);

const prepullMirrorImage = APLPrepullAction.fromJsonString(`{"action":{"castSpell":{"spellId":{"spellId":55342}}},"doAtValue":{"const":{"val":"-2s"}}}`);

const berserking = APLAction.fromJsonString(`{"condition":{"not":{"val":{"auraIsActive":{"auraId":{"spellId":12472}}}}},"castSpell":{"spellId":{"spellId":26297}}}`);
const hyperspeedAcceleration = APLAction.fromJsonString(`{"condition":{"not":{"val":{"auraIsActive":{"auraId":{"spellId":12472}}}}},"castSpell":{"spellId":{"spellId":54758}}}`);
const combatPot = APLAction.fromJsonString(`{"condition":{"not":{"val":{"auraIsActive":{"auraId":{"spellId":12472}}}}},"castSpell":{"spellId":{"otherId":"OtherActionPotion"}}}`);
const evocation = APLAction.fromJsonString(`{"condition":{"cmp":{"op":"OpLe","lhs":{"currentManaPercent":{}},"rhs":{"const":{"val":"25%"}}}},"castSpell":{"spellId":{"spellId":12051}}}`);

const arcaneBlastBelowStacks = APLAction.fromJsonString(`{"condition":{"or":{"vals":[{"cmp":{"op":"OpLt","lhs":{"auraNumStacks":{"auraId":{"spellId":36032}}},"rhs":{"const":{"val":"4"}}}},{"and":{"vals":[{"cmp":{"op":"OpLt","lhs":{"auraNumStacks":{"auraId":{"spellId":36032}}},"rhs":{"const":{"val":"3"}}}},{"cmp":{"op":"OpLt","lhs":{"currentManaPercent":{}},"rhs":{"const":{"val":"${(simple.only3ArcaneBlastStacksBelowManaPercent * 100).toFixed(0)}%"}}}}]}}]}},"castSpell":{"spellId":{"spellId":42897}}}`);
const arcaneMissilesWithMissileBarrageBelowMana = APLAction.fromJsonString(`{"condition":{"and":{"vals":[{"auraIsActiveWithReactionTime":{"auraId":{"spellId":44401}}},{"cmp":{"op":"OpLt","lhs":{"currentManaPercent":{}},"rhs":{"const":{"val":"${(simple.missileBarrageBelowManaPercent * 100).toFixed(0)}%"}}}}]}},"castSpell":{"spellId":{"spellId":42846}}}`);
const arcaneMisslesWithMissileBarrage = APLAction.fromJsonString(`{"condition":{"auraIsActiveWithReactionTime":{"auraId":{"spellId":44401}}},"castSpell":{"spellId":{"spellId":42846}}}`);
const arcaneBlastAboveMana = APLAction.fromJsonString(`{"condition":{"cmp":{"op":"OpGt","lhs":{"currentManaPercent":{}},"rhs":{"const":{"val":"${(simple.blastWithoutMissileBarrageAboveManaPercent * 100).toFixed(0)}%"}}}},"castSpell":{"spellId":{"spellId":42897}}}`);
const arcaneMissiles = APLAction.fromJsonString(`{"castSpell":{"spellId":{"spellId":42846}}}`);
const arcaneBarrage = APLAction.fromJsonString(`{"castSpell":{"spellId":{"spellId":44781}}}`);

const maintainImpScorch = APLAction.fromJsonString(`{"condition":{"auraShouldRefresh":{"auraId":{"spellId":12873},"maxOverlap":{"const":{"val":"4s"}}}},"castSpell":{"spellId":{"spellId":42859}}}`);
const pyroWithHotStreak = APLAction.fromJsonString(`{"condition":{"auraIsActiveWithReactionTime":{"auraId":{"spellId":44448}}},"castSpell":{"spellId":{"spellId":42891}}}`);
const livingBomb = APLAction.fromJsonString(`{"condition":{"and":{"vals":[{"cmp":{"op":"OpGt","lhs":{"remainingTime":{}},"rhs":{"const":{"val":"12s"}}}}]}},"multidot":{"spellId":{"spellId":55360},"maxDots":10,"maxOverlap":{"const":{"val":"0ms"}}}}`);
const cheekyFireBlastFinisher = APLAction.fromJsonString(`{"condition":{"cmp":{"op":"OpLe","lhs":{"remainingTime":{}},"rhs":{"spellCastTime":{"spellId":{"spellId":42859}}}}},"castSpell":{"spellId":{"spellId":42873}}}`);
const scorchFinisher = APLAction.fromJsonString(`{"condition":{"cmp":{"op":"OpLe","lhs":{"remainingTime":{}},"rhs":{"const":{"val":"4s"}}}},"castSpell":{"spellId":{"spellId":42859}}}`);
const fireball = APLAction.fromJsonString(`{"castSpell":{"spellId":{"spellId":42833}}}`);
const frostfireBolt = APLAction.fromJsonString(`{"castSpell":{"spellId":{"spellId":47610}}}`);
const scorch = APLAction.fromJsonString(`{"castSpell":{"spellId":{"spellId":42859}}}`);

const deepFreeze = APLAction.fromJsonString(`{"condition":{"auraIsActive":{"auraId":{"spellId":44545}}},"castSpell":{"spellId":{"spellId":44572}}}`);
const frostfireBoltWithBrainFreeze = APLAction.fromJsonString(`{"condition":{"auraIsActiveWithReactionTime":{"auraId":{"spellId":44549}}},"castSpell":{"spellId":{"spellId":47610}}}`);
const frostbolt = APLAction.fromJsonString(`{"castSpell":{"spellId":{"spellId":42842}}}`);
const iceLance = APLAction.fromJsonString(`{"condition":{"cmp":{"op":"OpEq","lhs":{"auraNumStacks":{"auraId":{"spellId":44545}}},"rhs":{"const":{"val":"1"}}}},"castSpell":{"spellId":{"spellId":42914}}}`);

prepullActions.push(prepullMirrorImage);
if (player.getTalents().improvedScorch > 0 && simple.maintainImprovedScorch) {
actions.push(maintainImpScorch);
}

//const talentTree = player.getTalentTree();
if (simple.type == RotationType.Arcane) {
actions.push(...[
berserking,
hyperspeedAcceleration,
combatPot,
simple.missileBarrageBelowManaPercent > 0 ? arcaneMissilesWithMissileBarrageBelowMana : null,
arcaneBlastBelowStacks,
arcaneMisslesWithMissileBarrage,
evocation,
arcaneBlastAboveMana,
simple.useArcaneBarrage ? arcaneBarrage : null,
arcaneMissiles,
].filter(a => a) as Array<APLAction>)
} else if (simple.type == RotationType.Fire) {
actions.push(...[
pyroWithHotStreak,
livingBomb,
cheekyFireBlastFinisher,
scorchFinisher,
simple.primaryFireSpell == PrimaryFireSpell.Fireball
? fireball
: (simple.primaryFireSpell == PrimaryFireSpell.FrostfireBolt
? frostfireBolt : scorch),
].filter(a => a) as Array<APLAction>)
} else if (simple.type == RotationType.Frost) {
actions.push(...[
berserking,
hyperspeedAcceleration,
evocation,
deepFreeze,
frostfireBoltWithBrainFreeze,
simple.useIceLance ? iceLance : null,
frostbolt,
].filter(a => a) as Array<APLAction>)
}

return APLRotation.create({
prepullActions: prepullActions,
priorityList: actions.map(action => APLListItem.create({
action: action,
}))
});
},
});
}
}

0 comments on commit 13eadf7

Please sign in to comment.