Skip to content

Commit

Permalink
Merge pull request #733 from wowsims/fixes
Browse files Browse the repository at this point in the history
Move prepop potion to consumes panel, and fix rogue thistle tea UI
  • Loading branch information
jimmyt857 authored Aug 21, 2022
2 parents b92c390 + c90c2f8 commit 2c2296b
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 59 deletions.
2 changes: 0 additions & 2 deletions ui/balance_druid/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ export class BalanceDruidSimUI extends IndividualSimUI<Spec.SpecBalanceDruid> {
// Inputs to include in the 'Other' section on the settings tab.
otherInputs: {
inputs: [
OtherInputs.PrepopPotion,

OtherInputs.TankAssignment,
],
},
Expand Down
36 changes: 20 additions & 16 deletions ui/core/components/icon_inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,22 +348,26 @@ function makeMultistateIndividualBuffInput(id: ActionId, numStates: number, fiel
// Custom buffs that don't fit into any of the helper functions above.
//////////////////////////////////////////////////////////////////////

export const makePotionsInput = makeConsumeInputFactory('defaultPotion', [
{ actionId: ActionId.fromItemId(33447), value: Potions.RunicHealingPotion },
{ actionId: ActionId.fromItemId(33448), value: Potions.RunicManaPotion },
{ actionId: ActionId.fromItemId(40093), value: Potions.IndestructiblePotion },
{ actionId: ActionId.fromItemId(40211), value: Potions.PotionOfSpeed },
{ actionId: ActionId.fromItemId(40212), value: Potions.PotionOfWildMagic },

{ actionId: ActionId.fromItemId(22839), value: Potions.DestructionPotion },
{ actionId: ActionId.fromItemId(22838), value: Potions.HastePotion },
{ actionId: ActionId.fromItemId(13442), value: Potions.MightyRagePotion },
{ actionId: ActionId.fromItemId(22832), value: Potions.SuperManaPotion },
{ actionId: ActionId.fromItemId(31677), value: Potions.FelManaPotion },
{ actionId: ActionId.fromItemId(22828), value: Potions.InsaneStrengthPotion },
{ actionId: ActionId.fromItemId(22849), value: Potions.IronshieldPotion },
{ actionId: ActionId.fromItemId(22837), value: Potions.HeroicPotion },
] as Array<IconEnumValueConfig<Player<any>, Potions>>);
function makePotionInputFactory(consumesFieldName: keyof Consumes): (options: Array<Potions>) => InputHelpers.TypedIconEnumPickerConfig<Player<any>, Potions> {
return makeConsumeInputFactory(consumesFieldName, [
{ actionId: ActionId.fromItemId(33447), value: Potions.RunicHealingPotion },
{ actionId: ActionId.fromItemId(33448), value: Potions.RunicManaPotion },
{ actionId: ActionId.fromItemId(40093), value: Potions.IndestructiblePotion },
{ actionId: ActionId.fromItemId(40211), value: Potions.PotionOfSpeed },
{ actionId: ActionId.fromItemId(40212), value: Potions.PotionOfWildMagic },

{ actionId: ActionId.fromItemId(22839), value: Potions.DestructionPotion },
{ actionId: ActionId.fromItemId(22838), value: Potions.HastePotion },
{ actionId: ActionId.fromItemId(13442), value: Potions.MightyRagePotion },
{ actionId: ActionId.fromItemId(22832), value: Potions.SuperManaPotion },
{ actionId: ActionId.fromItemId(31677), value: Potions.FelManaPotion },
{ actionId: ActionId.fromItemId(22828), value: Potions.InsaneStrengthPotion },
{ actionId: ActionId.fromItemId(22849), value: Potions.IronshieldPotion },
{ actionId: ActionId.fromItemId(22837), value: Potions.HeroicPotion },
] as Array<IconEnumValueConfig<Player<any>, Potions>>);
}
export const makePotionsInput = makePotionInputFactory('defaultPotion');
export const makePrepopPotionsInput = makePotionInputFactory('prepopPotion');

export const makeConjuredInput = makeConsumeInputFactory('defaultConjured', [
{ actionId: ActionId.fromItemId(12662), value: Conjured.ConjuredDarkRune },
Expand Down
20 changes: 0 additions & 20 deletions ui/core/components/other_inputs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BooleanPicker } from '../components/boolean_picker.js';
import { EnumPicker, EnumPickerConfig } from '../components/enum_picker.js';
import { Conjured } from '../proto/common.js';
import { Potions } from '../proto/common.js';
import { RaidTarget } from '../proto/common.js';
import { TristateEffect } from '../proto/common.js';
import { Party } from '../party.js';
Expand Down Expand Up @@ -77,25 +76,6 @@ export function makePhaseSelector(parent: HTMLElement, sim: Sim): EnumPicker<Sim
});
}

export const PrepopPotion = {
type: 'enum' as const,
label: 'Prepop Potion',
labelTooltip: 'If set, this potion will be used 1s before combat starts.',
values: [
{ name: 'None', value: Potions.UnknownPotion },
{ name: 'Speed', value: Potions.PotionOfSpeed },
{ name: 'Wild Magic', value: Potions.PotionOfWildMagic },
{ name: 'Indestructible Potion', value: Potions.IndestructiblePotion },
],
changedEvent: (player: Player<any>) => player.consumesChangeEmitter,
getValue: (player: Player<any>) => player.getConsumes().prepopPotion,
setValue: (eventID: EventID, player: Player<any>, newValue: number) => {
const newConsumes = player.getConsumes();
newConsumes.prepopPotion = newValue;
player.setConsumes(eventID, newConsumes);
},
};

export const StartingConjured = {
type: 'enum' as const,
label: 'Starting Conjured',
Expand Down
35 changes: 29 additions & 6 deletions ui/core/individual_sim_ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ export abstract class IndividualSimUI<SpecType extends Spec> extends SimUI {
<div class="consumes-row">
<span>Potions</span>
<div class="consumes-row-inputs">
<div class="consumes-prepot"></div>
<div class="consumes-potions"></div>
<div class="consumes-conjured"></div>
</div>
Expand Down Expand Up @@ -644,6 +645,22 @@ export abstract class IndividualSimUI<SpecType extends Spec> extends SimUI {
}, this);
}

const prepopPotionOptions = this.splitRelevantOptions([
// This list is smaller because some potions don't make sense to use as prepot.
// E.g. healing/mana potions.
{ item: Potions.IndestructiblePotion, stats: [Stat.StatArmor] },
{ item: Potions.PotionOfSpeed, stats: [Stat.StatMeleeHaste, Stat.StatSpellHaste] },
{ item: Potions.PotionOfWildMagic, stats: [Stat.StatMeleeCrit, Stat.StatSpellCrit, Stat.StatSpellPower] },
]);
if (prepopPotionOptions.length) {
const elem = this.rootElem.getElementsByClassName('consumes-prepot')[0] as HTMLElement;
new IconEnumPicker(elem, this.player, IconInputs.makePrepopPotionsInput(prepopPotionOptions));
tippy(elem, {
'content': 'Prepop Potion (1s before combat)',
'allowHTML': true,
});
}

const potionOptions = this.splitRelevantOptions([
{ item: Potions.RunicHealingPotion, stats: [Stat.StatStamina] },
{ item: Potions.RunicManaPotion, stats: [Stat.StatIntellect] },
Expand All @@ -654,9 +671,14 @@ export abstract class IndividualSimUI<SpecType extends Spec> extends SimUI {
if (potionOptions.length) {
const elem = this.rootElem.getElementsByClassName('consumes-potions')[0] as HTMLElement;
new IconEnumPicker(elem, this.player, IconInputs.makePotionsInput(potionOptions));
tippy(elem, {
'content': 'Combat Potion',
'allowHTML': true,
});
}

const conjuredOptions = this.splitRelevantOptions([
this.player.getClass() == Class.ClassRogue ? { item: Conjured.ConjuredRogueThistleTea, stats: [] } : null,
{ item: Conjured.ConjuredHealthstone, stats: [Stat.StatStamina] },
{ item: Conjured.ConjuredDarkRune, stats: [Stat.StatIntellect] },
{ item: Conjured.ConjuredFlameCap, stats: [Stat.StatStrength, Stat.StatAgility, Stat.StatFireSpellPower] },
Expand Down Expand Up @@ -1195,15 +1217,16 @@ export abstract class IndividualSimUI<SpecType extends Spec> extends SimUI {
});
}

splitRelevantOptions<T>(options: Array<StatOption<T>>): Array<T> {
splitRelevantOptions<T>(options: Array<StatOption<T> | null>): Array<T> {
return options
.filter(option => option != null)
.filter(option =>
this.individualConfig.includeBuffDebuffInputs.includes(option.item) ||
option.stats.length == 0 ||
option.stats.some(stat => this.individualConfig.epStats.includes(stat)))
this.individualConfig.includeBuffDebuffInputs.includes(option!.item) ||
option!.stats.length == 0 ||
option!.stats.some(stat => this.individualConfig.epStats.includes(stat)))
.filter(option =>
!this.individualConfig.excludeBuffDebuffInputs.includes(option.item))
.map(option => option.item);
!this.individualConfig.excludeBuffDebuffInputs.includes(option!.item))
.map(option => option!.item);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ui/deathknight/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ export class DeathknightSimUI extends IndividualSimUI<Spec.SpecDeathknight> {
DeathKnightInputs.PrecastGhoulFrenzy,
DeathKnightInputs.PrecastHornOfWinter,

OtherInputs.PrepopPotion,

OtherInputs.TankAssignment,
OtherInputs.InFrontOfTarget,
],
Expand Down
1 change: 0 additions & 1 deletion ui/elemental_shaman/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ export class ElementalShamanSimUI extends IndividualSimUI<Spec.SpecElementalSham
// Inputs to include in the 'Other' section on the settings tab.
otherInputs: {
inputs: [
OtherInputs.PrepopPotion,
OtherInputs.TankAssignment,
],
},
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 @@ -147,7 +147,6 @@ export class EnhancementShamanSimUI extends IndividualSimUI<Spec.SpecEnhancement
otherInputs: {
inputs: [
ShamanInputs.SyncTypeInput,
OtherInputs.PrepopPotion,
OtherInputs.TankAssignment,
OtherInputs.InFrontOfTarget,
],
Expand Down
1 change: 0 additions & 1 deletion ui/feral_druid/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export class FeralDruidSimUI extends IndividualSimUI<Spec.SpecFeralDruid> {
otherInputs: {
inputs: [
DruidInputs.LatencyMs,
OtherInputs.PrepopPotion,
OtherInputs.TankAssignment,
OtherInputs.InFrontOfTarget,
],
Expand Down
1 change: 0 additions & 1 deletion ui/feral_tank_druid/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ export class FeralTankDruidSimUI extends IndividualSimUI<Spec.SpecFeralTankDruid
OtherInputs.HealingCadence,
OtherInputs.HpPercentForDefensives,
DruidInputs.StartingRage,
OtherInputs.PrepopPotion,
OtherInputs.InFrontOfTarget,
],
},
Expand Down
1 change: 0 additions & 1 deletion ui/hunter/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ export class HunterSimUI extends IndividualSimUI<Spec.SpecHunter> {
inputs: [
HunterInputs.PetUptime,
HunterInputs.SniperTrainingUptime,
OtherInputs.PrepopPotion,
OtherInputs.TankAssignment,
OtherInputs.InFrontOfTarget,
],
Expand Down
1 change: 0 additions & 1 deletion ui/mage/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export class MageSimUI extends IndividualSimUI<Spec.SpecMage> {
inputs: [
MageInputs.EvocationTicks,
MageInputs.FocusMagicUptime,
OtherInputs.PrepopPotion,
OtherInputs.DistanceFromTarget,

OtherInputs.TankAssignment,
Expand Down
1 change: 0 additions & 1 deletion ui/retribution_paladin/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ export class RetributionPaladinSimUI extends IndividualSimUI<Spec.SpecRetributio
RetributionPaladinInputs.JudgementSelection,
RetributionPaladinInputs.StartingSealSelection,
RetributionPaladinInputs.DamageTakenPerSecond,
OtherInputs.PrepopPotion,
OtherInputs.TankAssignment,
OtherInputs.InFrontOfTarget,
],
Expand Down
1 change: 0 additions & 1 deletion ui/rogue/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export class RogueSimUI extends IndividualSimUI<Spec.SpecRogue> {
otherInputs: {
inputs: [
OtherInputs.StartingConjured,
OtherInputs.PrepopPotion,
OtherInputs.TankAssignment,
OtherInputs.InFrontOfTarget,
],
Expand Down
1 change: 0 additions & 1 deletion ui/shadow_priest/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export class ShadowPriestSimUI extends IndividualSimUI<Spec.SpecShadowPriest> {
// Inputs to include in the 'Other' section on the settings tab.
otherInputs: {
inputs: [
OtherInputs.PrepopPotion,
OtherInputs.TankAssignment,
],
},
Expand Down
1 change: 0 additions & 1 deletion ui/smite_priest/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export class SmitePriestSimUI extends IndividualSimUI<Spec.SpecSmitePriest> {
// Inputs to include in the 'Other' section on the settings tab.
otherInputs: {
inputs: [
OtherInputs.PrepopPotion,
OtherInputs.TankAssignment,
],
},
Expand Down
2 changes: 0 additions & 2 deletions ui/tank_deathknight/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ export class TankDeathknightSimUI extends IndividualSimUI<Spec.SpecTankDeathknig
// Inputs to include in the 'Other' section on the settings tab.
otherInputs: {
inputs: [
OtherInputs.PrepopPotion,

OtherInputs.TankAssignment,
OtherInputs.InFrontOfTarget,
],
Expand Down
1 change: 0 additions & 1 deletion ui/warlock/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export class WarlockSimUI extends IndividualSimUI<Spec.SpecWarlock> {
// Inputs to include in the 'Other' section on the settings tab.
otherInputs: {
inputs: [
OtherInputs.PrepopPotion,
OtherInputs.DistanceFromTarget,
OtherInputs.TankAssignment,
],
Expand Down

0 comments on commit 2c2296b

Please sign in to comment.