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

Move lust ts #3827

Merged
merged 4 commits into from
Oct 6, 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
36 changes: 32 additions & 4 deletions proto/shaman.proto
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ message ElementalShaman {
Manual = 2;
}
RotationType type = 1;
bool in_thunderstorm_range = 2;
bool in_thunderstorm_range = 2 [deprecated = true];

// These options are used for the manual rotation.
bool use_fire_nova = 4;
Expand All @@ -245,12 +245,26 @@ message ElementalShaman {
bool always_crit_lvb = 7;
bool use_thunderstorm = 8;
double lvb_fs_wait_ms = 12;

enum BloodlustUse {
UnsetBloodlust = 0;
UseBloodlust = 1;
NoBloodlust = 2;
}
BloodlustUse bloodlust = 13;
}

message Options {
ShamanShield shield = 1;
bool bloodlust = 2;
bool bloodlust = 2 [deprecated = true];
ShamanTotems totems = 3;

enum ThunderstormRange {
UnsetTSRange = 0;
TSInRange = 1;
TSOutofRange = 2;
}
ThunderstormRange thunderstormRange = 4;
}

Rotation rotation = 1;
Expand Down Expand Up @@ -311,11 +325,18 @@ message EnhancementShaman {
double delay_gcd_weave = 13;
ItemSwap item_swap = 14;
bool enable_item_swap = 15;

enum BloodlustUse {
UnsetBloodlust = 0;
UseBloodlust = 1;
NoBloodlust = 2;
}
BloodlustUse bloodlust = 16;
}

message Options {
ShamanShield shield = 1;
bool bloodlust = 2;
bool bloodlust = 2 [deprecated = true];
ShamanSyncType sync_type = 3;
ShamanImbue imbue_mh = 4;
ShamanImbue imbue_oh = 5;
Expand All @@ -340,11 +361,18 @@ message RestorationShaman {
bool use_earth_shield = 2;
ShamanHealSpell primary_heal = 3;
bool use_riptide = 4;

enum BloodlustUse {
UnsetBloodlust = 0;
UseBloodlust = 1;
NoBloodlust = 2;
}
BloodlustUse bloodlust = 5;
}

message Options {
ShamanShield shield = 1;
bool bloodlust = 2;
bool bloodlust = 2 [deprecated = true];
ShamanImbue imbue_mh = 4;
int32 earth_shield_p_p_m = 5;
ShamanTotems totems = 6;
Expand Down
10 changes: 9 additions & 1 deletion sim/shaman/elemental/elemental.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func NewElementalShaman(character *core.Character, options *proto.Player) *Eleme
Shield: eleShamOptions.Options.Shield,
}

if eleShamOptions.Rotation.Bloodlust != proto.ElementalShaman_Rotation_UnsetBloodlust {
selfBuffs.Bloodlust = eleShamOptions.Rotation.Bloodlust == proto.ElementalShaman_Rotation_UseBloodlust
}

totems := &proto.ShamanTotems{}
if eleShamOptions.Options.Totems != nil {
totems = eleShamOptions.Options.Totems
Expand All @@ -49,8 +53,12 @@ func NewElementalShaman(character *core.Character, options *proto.Player) *Eleme
rotation = NewAdaptiveRotation(eleShamOptions.Rotation)
}

inRange := eleShamOptions.Rotation.InThunderstormRange
if eleShamOptions.Options.ThunderstormRange != proto.ElementalShaman_Options_UnsetTSRange {
inRange = eleShamOptions.Options.ThunderstormRange == proto.ElementalShaman_Options_TSInRange
}
ele := &ElementalShaman{
Shaman: shaman.NewShaman(character, options.TalentsString, totems, selfBuffs, eleShamOptions.Rotation.InThunderstormRange),
Shaman: shaman.NewShaman(character, options.TalentsString, totems, selfBuffs, inRange),
rotation: rotation,
has4pT6: character.HasSetBonus(shaman.ItemSetSkyshatterRegalia, 4),
}
Expand Down
5 changes: 5 additions & 0 deletions sim/shaman/enhancement/enhancement.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func NewEnhancementShaman(character *core.Character, options *proto.Player) *Enh
ImbueOH: enhOptions.Options.ImbueOh,
}

// Override with new rotation option bloodlust.
if enhOptions.Rotation.Bloodlust != proto.EnhancementShaman_Rotation_UnsetBloodlust {
selfBuffs.Bloodlust = enhOptions.Rotation.Bloodlust == proto.EnhancementShaman_Rotation_UseBloodlust
}

totems := &proto.ShamanTotems{}
if enhOptions.Options.Totems != nil {
totems = enhOptions.Options.Totems
Expand Down
4 changes: 4 additions & 0 deletions sim/shaman/restoration/restoration.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func NewRestorationShaman(character *core.Character, options *proto.Player) *Res
Shield: restoShamOptions.Options.Shield,
}

if restoShamOptions.Rotation.Bloodlust != proto.RestorationShaman_Rotation_UnsetBloodlust {
selfBuffs.Bloodlust = restoShamOptions.Rotation.Bloodlust == proto.RestorationShaman_Rotation_UseBloodlust
}

totems := &proto.ShamanTotems{}
if restoShamOptions.Options.Totems != nil {
totems = restoShamOptions.Options.Totems
Expand Down
31 changes: 31 additions & 0 deletions ui/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import { Party, MAX_PARTY_SIZE } from './party.js';
import { Raid } from './raid.js';
import { Sim } from './sim.js';
import { stringComparator, sum } from './utils.js';
import { ElementalShaman_Options, ElementalShaman_Options_ThunderstormRange, ElementalShaman_Rotation, ElementalShaman_Rotation_BloodlustUse, EnhancementShaman_Rotation, EnhancementShaman_Rotation_BloodlustUse, RestorationShaman_Rotation, RestorationShaman_Rotation_BloodlustUse } from './proto/shaman.js';

export interface AuraStats {
data: AuraStatsProto,
Expand Down Expand Up @@ -1364,6 +1365,36 @@ export class Player<SpecType extends Spec> {
rot.totems = undefined;
this.setRotation(eventID, rot as SpecRotation<SpecType>);
}
const opt = this.getSpecOptions() as SpecOptions<ShamanSpecs>;

// Update Bloodlust to be part of rotation instead of options to support APL casting bloodlust.
if (opt.bloodlust) {
opt.bloodlust = false;

var tRot = this.getRotation();
if (this.spec == Spec.SpecElementalShaman) {
(tRot as ElementalShaman_Rotation).bloodlust = ElementalShaman_Rotation_BloodlustUse.UseBloodlust;
} else if (this.spec == Spec.SpecEnhancementShaman) {
(tRot as EnhancementShaman_Rotation).bloodlust = EnhancementShaman_Rotation_BloodlustUse.UseBloodlust;
} else if (this.spec == Spec.SpecRestorationShaman) {
(tRot as RestorationShaman_Rotation).bloodlust = RestorationShaman_Rotation_BloodlustUse.UseBloodlust;
}

this.setRotation(eventID, tRot as SpecRotation<SpecType>);
this.setSpecOptions(eventID, opt as SpecOptions<SpecType>);
}

// Update Ele TS range option.
if (this.spec == Spec.SpecElementalShaman) {
var eleOpt = this.getSpecOptions() as ElementalShaman_Options;
var eleRot = this.getRotation() as ElementalShaman_Rotation;
if (eleRot.inThunderstormRange) {
eleOpt.thunderstormRange = ElementalShaman_Options_ThunderstormRange.TSInRange;
eleRot.inThunderstormRange = false;
this.setRotation(eventID, eleRot as SpecRotation<SpecType>);
this.setSpecOptions(eventID, eleOpt as SpecOptions<SpecType>);
}
}
}
});
}
Expand Down
1 change: 0 additions & 1 deletion ui/elemental_shaman/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ import { ElementalShamanSimUI } from './sim.js';
const sim = new Sim();
const player = new Player<Spec.SpecElementalShaman>(Spec.SpecElementalShaman, sim);
sim.raid.setPlayer(TypedEvent.nextEventID(), 0, player);

const simUI = new ElementalShamanSimUI(document.body, player);
39 changes: 31 additions & 8 deletions ui/elemental_shaman/inputs.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
import { IconPickerConfig } from '../core/components/icon_picker.js';
import { ElementalShaman_Rotation_RotationType as RotationType, ShamanShield } from '../core/proto/shaman.js';
import { ElementalShaman_Options_ThunderstormRange, ElementalShaman_Rotation_BloodlustUse, ElementalShaman_Rotation_RotationType as RotationType, ShamanShield, ShamanTotems } from '../core/proto/shaman.js';
import { ElementalShaman_Options as ShamanOptions } from '../core/proto/shaman.js';
import { AirTotem } from '../core/proto/shaman.js';
import { Spec } from '../core/proto/common.js';
import { ActionId } from '../core/proto_utils/action_id.js';
import { Player } from '../core/player.js';

import * as InputHelpers from '../core/components/input_helpers.js';
import { EventID, TypedEvent } from 'ui/core/typed_event.js';

// Configuration for spec-specific UI elements on the settings tab.
// These don't need to be in a separate file but it keeps things cleaner.

export const Bloodlust = InputHelpers.makeSpecOptionsBooleanIconInput<Spec.SpecElementalShaman>({
fieldName: 'bloodlust',
id: ActionId.fromSpellId(2825),
export const InThunderstormRange = InputHelpers.makeSpecOptionsBooleanInput<Spec.SpecElementalShaman>({
fieldName: 'thunderstormRange',
// id: ActionId.fromSpellId(59159),
label: "Thunderstorm In Range",
labelTooltip: "When set to true, thunderstorm casts will cause damage.",
getValue: (player: Player<Spec.SpecElementalShaman>) => player.getSpecOptions().thunderstormRange == ElementalShaman_Options_ThunderstormRange.TSInRange,
setValue: (eventID: EventID, player: Player<Spec.SpecElementalShaman>, newValue: boolean) => {
const newOptions = player.getSpecOptions();
if (newValue) {
newOptions.thunderstormRange = ElementalShaman_Options_ThunderstormRange.TSInRange;
} else {
newOptions.thunderstormRange = ElementalShaman_Options_ThunderstormRange.TSOutofRange;
}
player.setSpecOptions(eventID, newOptions);
},
});

export const ShamanShieldInput = InputHelpers.makeSpecOptionsEnumIconInput<Spec.SpecElementalShaman, ShamanShield>({
fieldName: 'shield',
values: [
Expand All @@ -41,10 +55,19 @@ export const ElementalShamanRotationConfig = {
],
}),
InputHelpers.makeRotationBooleanInput<Spec.SpecElementalShaman>({
fieldName: 'inThunderstormRange',
label: 'In Thunderstorm Range',
labelTooltip: 'Thunderstorm will hit all targets when cast. Ignores knockback.',
showWhen: (player: Player<Spec.SpecElementalShaman>) => player.getTalents().thunderstorm,
fieldName: 'bloodlust',
label: 'Use Bloodlust',
labelTooltip: 'Player will cast bloodlust',
getValue: (player: Player<Spec.SpecElementalShaman>) => player.getRotation().bloodlust == ElementalShaman_Rotation_BloodlustUse.UseBloodlust,
setValue: (eventID: EventID, player: Player<Spec.SpecElementalShaman>, newValue: boolean) => {
const newRotation = player.getRotation();
if (newValue) {
newRotation.bloodlust = ElementalShaman_Rotation_BloodlustUse.UseBloodlust;
} else {
newRotation.bloodlust = ElementalShaman_Rotation_BloodlustUse.NoBloodlust;
}
player.setRotation(eventID, newRotation);
},
}),
InputHelpers.makeRotationNumberInput<Spec.SpecElementalShaman>({
fieldName: 'lvbFsWaitMs',
Expand Down
5 changes: 2 additions & 3 deletions ui/elemental_shaman/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ import { Stats } from '../core/proto_utils/stats.js';
import { IndividualSimUI } from '../core/individual_sim_ui.js';
import { EventID, TypedEvent } from '../core/typed_event.js';
import { TotemsSection } from '../core/components/totem_inputs.js';

import * as IconInputs from '../core/components/icon_inputs.js';
import * as OtherInputs from '../core/components/other_inputs.js';
import * as Mechanics from '../core/constants/mechanics.js';

import * as ShamanInputs from './inputs.js';
import * as Presets from './presets.js';
import { ElementalShaman_Options_ThunderstormRange, ElementalShaman_Rotation_BloodlustUse} from '../core/proto/shaman.js';

export class ElementalShamanSimUI extends IndividualSimUI<Spec.SpecElementalShaman> {
constructor(parentElem: HTMLElement, player: Player<Spec.SpecElementalShaman>) {
Expand Down Expand Up @@ -129,7 +128,6 @@ export class ElementalShamanSimUI extends IndividualSimUI<Spec.SpecElementalSham
// IconInputs to include in the 'Player' section on the settings tab.
playerIconInputs: [
ShamanInputs.ShamanShieldInput,
ShamanInputs.Bloodlust,
],
// Inputs to include in the 'Rotation' section on the settings tab.
rotationInputs: ShamanInputs.ElementalShamanRotationConfig,
Expand All @@ -141,6 +139,7 @@ export class ElementalShamanSimUI extends IndividualSimUI<Spec.SpecElementalSham
// Inputs to include in the 'Other' section on the settings tab.
otherInputs: {
inputs: [
ShamanInputs.InThunderstormRange,
OtherInputs.TankAssignment,
],
},
Expand Down
24 changes: 19 additions & 5 deletions ui/enhancement_shaman/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@ import {
ShamanSyncType,
EnhancementShaman_Rotation_PrimaryShock as PrimaryShock,
EnhancementShaman_Rotation_RotationType as RotationType,
EnhancementShaman_Rotation_CustomRotationSpell as CustomRotationSpell
EnhancementShaman_Rotation_CustomRotationSpell as CustomRotationSpell,
EnhancementShaman_Rotation,
EnhancementShaman_Rotation_BloodlustUse
} from '../core/proto/shaman.js';
import { CustomSpell, Spec, ItemSwap, ItemSlot } from '../core/proto/common.js';
import { ActionId } from '../core/proto_utils/action_id.js';
import { Player } from '../core/player.js';

import * as InputHelpers from '../core/components/input_helpers.js';
import { EventID } from 'ui/core/typed_event.js';

// Configuration for spec-specific UI elements on the settings tab.
// These don't need to be in a separate file but it keeps things cleaner.

export const Bloodlust = InputHelpers.makeSpecOptionsBooleanIconInput<Spec.SpecEnhancementShaman>({
fieldName: 'bloodlust',
id: ActionId.fromSpellId(2825),
});
export const ShamanShieldInput = InputHelpers.makeSpecOptionsEnumIconInput<Spec.SpecEnhancementShaman, ShamanShield>({
fieldName: 'shield',
values: [
Expand Down Expand Up @@ -279,6 +278,21 @@ export const EnhancementShamanRotationConfig = {
label: 'Mana % to use Shamanistic Rage',
enableWhen: (player: Player<Spec.SpecEnhancementShaman>) => player.getTalents().shamanisticRage,
}),
InputHelpers.makeRotationBooleanInput<Spec.SpecEnhancementShaman>({
fieldName: 'bloodlust',
label: 'Use Bloodlust',
labelTooltip: 'Player will cast bloodlust',
getValue: (player: Player<Spec.SpecEnhancementShaman>) => player.getRotation().bloodlust == EnhancementShaman_Rotation_BloodlustUse.UseBloodlust,
setValue: (eventID: EventID, player: Player<Spec.SpecEnhancementShaman>, newValue: boolean) => {
const newRotation = player.getRotation();
if (newValue) {
newRotation.bloodlust = EnhancementShaman_Rotation_BloodlustUse.UseBloodlust;
} else {
newRotation.bloodlust = EnhancementShaman_Rotation_BloodlustUse.NoBloodlust;
}
player.setRotation(eventID, newRotation);
},
}),
],
};

Expand Down
1 change: 0 additions & 1 deletion ui/enhancement_shaman/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export class EnhancementShamanSimUI extends IndividualSimUI<Spec.SpecEnhancement
// IconInputs to include in the 'Player' section on the settings tab.
playerIconInputs: [
ShamanInputs.ShamanShieldInput,
ShamanInputs.Bloodlust,
ShamanInputs.ShamanImbueMH,
ShamanInputs.ShamanImbueOH,
],
Expand Down
20 changes: 16 additions & 4 deletions ui/restoration_shaman/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ import {
RestorationShaman_Options as ShamanOptions,
ShamanHealSpell,
ShamanShield,
RestorationShaman_Rotation_BloodlustUse,
} from '../core/proto/shaman.js';

import * as InputHelpers from '../core/components/input_helpers.js';

// Configuration for spec-specific UI elements on the settings tab.
// These don't need to be in a separate file but it keeps things cleaner.

export const Bloodlust = InputHelpers.makeSpecOptionsBooleanIconInput<Spec.SpecRestorationShaman>({
fieldName: 'bloodlust',
id: ActionId.fromSpellId(2825),
});
export const ShamanShieldInput = InputHelpers.makeSpecOptionsEnumIconInput<Spec.SpecRestorationShaman, ShamanShield>({
fieldName: 'shield',
values: [
Expand Down Expand Up @@ -84,6 +81,21 @@ export const RestorationShamanRotationConfig = {
UseRiptide,
UseEarthShield,
TriggerEarthShield,
InputHelpers.makeRotationBooleanInput<Spec.SpecRestorationShaman>({
fieldName: 'bloodlust',
label: 'Use Bloodlust',
labelTooltip: 'Player will cast bloodlust',
getValue: (player: Player<Spec.SpecRestorationShaman>) => player.getRotation().bloodlust == RestorationShaman_Rotation_BloodlustUse.UseBloodlust,
setValue: (eventID: EventID, player: Player<Spec.SpecRestorationShaman>, newValue: boolean) => {
const newRotation = player.getRotation();
if (newValue) {
newRotation.bloodlust = RestorationShaman_Rotation_BloodlustUse.UseBloodlust;
} else {
newRotation.bloodlust = RestorationShaman_Rotation_BloodlustUse.NoBloodlust;
}
player.setRotation(eventID, newRotation);
},
}),
],
};

1 change: 0 additions & 1 deletion ui/restoration_shaman/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export class RestorationShamanSimUI extends IndividualSimUI<Spec.SpecRestoration
// IconInputs to include in the 'Player' section on the settings tab.
playerIconInputs: [
ShamanInputs.ShamanShieldInput,
ShamanInputs.Bloodlust,
],
// Inputs to include in the 'Rotation' section on the settings tab.
rotationInputs: ShamanInputs.RestorationShamanRotationConfig,
Expand Down
Loading