Skip to content

Commit

Permalink
Merge pull request #3302 from wowsims/balance_apl
Browse files Browse the repository at this point in the history
Balance APL + cast time APL value
  • Loading branch information
lologarithm authored Jul 12, 2023
2 parents 052ced0 + 73ffe36 commit a22fa83
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 12 deletions.
6 changes: 6 additions & 0 deletions proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ message APLValue {
APLValueSpellCanCast spell_can_cast = 19;
APLValueSpellIsReady spell_is_ready = 20;
APLValueSpellTimeToReady spell_time_to_ready = 21;
APLValueSpellCastTime spell_cast_time = 35;

// Aura values
APLValueAuraIsActive aura_is_active = 22;
Expand All @@ -91,6 +92,8 @@ message APLValue {
// Dot values
APLValueDotIsActive dot_is_active = 6;
APLValueDotRemainingTime dot_remaining_time = 13;

// Last Index - 35
}
}

Expand Down Expand Up @@ -234,6 +237,9 @@ message APLValueSpellIsReady {
message APLValueSpellTimeToReady {
ActionID spell_id = 1;
}
message APLValueSpellCastTime {
ActionID spell_id = 1;
}

message APLValueAuraIsActive {
ActionID aura_id = 1;
Expand Down
2 changes: 2 additions & 0 deletions sim/core/apl_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ func (rot *APLRotation) newAPLValue(config *proto.APLValue) APLValue {
return rot.newValueSpellIsReady(config.GetSpellIsReady())
case *proto.APLValue_SpellTimeToReady:
return rot.newValueSpellTimeToReady(config.GetSpellTimeToReady())
case *proto.APLValue_SpellCastTime:
return rot.newValueSpellCastTime(config.GetSpellCastTime())

// Auras
case *proto.APLValue_AuraIsActive:
Expand Down
22 changes: 22 additions & 0 deletions sim/core/apl_values_spell.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,25 @@ func (value *APLValueSpellTimeToReady) Type() proto.APLValueType {
func (value *APLValueSpellTimeToReady) GetDuration(sim *Simulation) time.Duration {
return value.spell.TimeToReady(sim)
}

type APLValueSpellCastTime struct {
defaultAPLValueImpl
spell *Spell
}

func (rot *APLRotation) newValueSpellCastTime(config *proto.APLValueSpellCastTime) APLValue {
unit := rot.unit
spell := unit.aplGetSpell(config.SpellId)
if spell == nil {
return nil
}
return &APLValueSpellCastTime{
spell: spell,
}
}
func (value *APLValueSpellCastTime) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeDuration
}
func (value *APLValueSpellCastTime) GetDuration(sim *Simulation) time.Duration {
return value.spell.Unit.ApplyCastSpeedForSpell(value.spell.DefaultCast.CastTime, value.spell)
}
2 changes: 1 addition & 1 deletion sim/druid/barkskin.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (druid *Druid) registerBarkskinCD() {

druid.Barkskin = druid.RegisterSpell(core.SpellConfig{
ActionID: actionId,
Flags: SpellFlagOmenTrigger,
Flags: SpellFlagOmenTrigger | core.SpellFlagAPL,
Cast: core.CastConfig{
CD: core.Cooldown{
Timer: druid.NewTimer(),
Expand Down
1 change: 1 addition & 0 deletions sim/druid/faerie_fire.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func (druid *Druid) registerFaerieFireSpell() {
}
flatThreatBonus = 632.
}
flags |= core.SpellFlagAPL

druid.FaerieFireAuras = druid.NewEnemyAuraArray(func(target *core.Unit) *core.Aura {
return core.FaerieFireAura(target, druid.Talents.ImprovedFaerieFire)
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/force_of_nature.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (druid *Druid) registerForceOfNatureCD() {
})
druid.ForceOfNature = druid.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 65861},

Flags: core.SpellFlagAPL,
ManaCost: core.ManaCostOptions{
BaseCost: 0.12,
Multiplier: 1,
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/hurricane.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (druid *Druid) registerHurricaneSpell() {
ActionID: core.ActionID{SpellID: 48467},
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellDamage,
Flags: core.SpellFlagChanneled | SpellFlagOmenTrigger,
Flags: core.SpellFlagChanneled | SpellFlagOmenTrigger | core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.81,
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/insect_swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (druid *Druid) registerInsectSwarmSpell() {
ActionID: core.ActionID{SpellID: 48468},
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellDamage,
Flags: SpellFlagOmenTrigger,
Flags: SpellFlagOmenTrigger | core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.08,
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/moonfire.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (druid *Druid) registerMoonfireSpell() {
ActionID: core.ActionID{SpellID: 48463},
SpellSchool: core.SpellSchoolArcane,
ProcMask: core.ProcMaskSpellDamage,
Flags: SpellFlagNaturesGrace | SpellFlagOmenTrigger,
Flags: SpellFlagNaturesGrace | SpellFlagOmenTrigger | core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.21,
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/rebirth.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (druid *Druid) registerRebirthSpell() {

druid.Rebirth = druid.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 48477},
Flags: SpellFlagOmenTrigger,
Flags: SpellFlagOmenTrigger | core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: baseCost,
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/starfall.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (druid *Druid) registerStarfallSpell() {
ActionID: core.ActionID{SpellID: 53201},
SpellSchool: core.SpellSchoolArcane,
ProcMask: core.ProcMaskSpellDamage,
Flags: SpellFlagNaturesGrace | SpellFlagOmenTrigger,
Flags: SpellFlagNaturesGrace | SpellFlagOmenTrigger | core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.35,
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/starfire.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (druid *Druid) registerStarfireSpell() {
ActionID: core.ActionID{SpellID: 48465},
SpellSchool: core.SpellSchoolArcane,
ProcMask: core.ProcMaskSpellDamage,
Flags: SpellFlagNaturesGrace | SpellFlagOmenTrigger,
Flags: SpellFlagNaturesGrace | SpellFlagOmenTrigger | core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.16,
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/typhoon.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (druid *Druid) registerTyphoonSpell() {
ActionID: core.ActionID{SpellID: 61384},
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellDamage,
Flags: SpellFlagOmenTrigger,
Flags: SpellFlagOmenTrigger | core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.25,
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/wrath.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (druid *Druid) registerWrathSpell() {
ActionID: core.ActionID{SpellID: 48461},
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellDamage,
Flags: SpellFlagNaturesGrace | SpellFlagOmenTrigger,
Flags: SpellFlagNaturesGrace | SpellFlagOmenTrigger | core.SpellFlagAPL,
MissileSpeed: 20,

ManaCost: core.ManaCostOptions{
Expand Down
24 changes: 23 additions & 1 deletion ui/balance_druid/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
RaidTarget, Spec,
TristateEffect
} from '../core/proto/common.js';
import { SavedTalents } from '../core/proto/ui.js';
import { SavedRotation, SavedTalents } from '../core/proto/ui.js';

import {
BalanceDruid_Options as BalanceDruidOptions,
Expand All @@ -28,6 +28,7 @@ import {
import * as Tooltips from '../core/constants/tooltips.js';
import { NO_TARGET } from "../core/proto_utils/utils";
import { Player } from "../core/player";
import { APLRotation } from '../core/proto/apl.js';

// Preset options for this spec.
// Eventually we will import these values for the raid sim too, so its good to
Expand Down Expand Up @@ -274,3 +275,24 @@ export const P3_PRESET_ALLI = {
}`),
};


export const ROTATION_PRESET_BASIC_APL = {
name: 'Basic APL',
rotation: SavedRotation.create({
specRotationOptionsJson: BalanceDruidRotation.toJsonString(DefaultRotation),
rotation: APLRotation.fromJsonString(`{
"enabled": true,
"priorityList": [
{"hide":true,"action":{"condition":{"not":{"val":{"auraIsActive":{"auraId":{}}}}},"castSpell":{"spellId":{"spellId":770}}}},
{"action":{"condition":{"or":{"vals":[{"cmp":{"op":"OpGt","lhs":{"auraRemainingTime":{"auraId":{"spellId":48518}}},"rhs":{"const":{"val":"10s"}}}},{"cmp":{"op":"OpLt","lhs":{"remainingTime":{}},"rhs":{"const":{"val":"15s"}}}}]}},"autocastOtherCooldowns":{}}},
{"action":{"condition":{"spellIsReady":{"spellId":{"spellId":65861}}},"castSpell":{"spellId":{"spellId":65861}}}},
{"action":{"condition":{"and":{"vals":[{"not":{"val":{"auraIsActive":{"auraId":{"spellId":48518}}}}},{"spellIsReady":{"spellId":{"spellId":53201}}}]}},"castSpell":{"spellId":{"spellId":53201}}}},
{"action":{"condition":{"cmp":{"op":"OpGt","lhs":{"numberTargets":{}},"rhs":{"const":{"val":"3"}}}},"castSpell":{"spellId":{"spellId":48467}}}},
{"action":{"condition":{"cmp":{"op":"OpLt","lhs":{"auraRemainingTime":{"auraId":{"spellId":48518}}},"rhs":{"spellCastTime":{"spellId":{"spellId":48465}}}}},"multidot":{"spellId":{"spellId":48463},"maxDots":3,"maxOverlap":{"const":{"val":"0ms"}}}}},
{"action":{"condition":{"cmp":{"op":"OpLt","lhs":{"auraRemainingTime":{"auraId":{"spellId":48518}}},"rhs":{"spellCastTime":{"spellId":{"spellId":48465}}}}},"multidot":{"spellId":{"spellId":48468},"maxDots":3,"maxOverlap":{"const":{"val":"0ms"}}}}},
{"action":{"condition":{"cmp":{"op":"OpGt","lhs":{"auraRemainingTime":{"auraId":{"spellId":48517}}},"rhs":{"spellCastTime":{"spellId":{"spellId":48461}}}}},"castSpell":{"spellId":{"spellId":48461}}}},
{"action":{"castSpell":{"spellId":{"spellId":48465}}}}
]
}`),
}),
};
3 changes: 3 additions & 0 deletions ui/balance_druid/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ export class BalanceDruidSimUI extends IndividualSimUI<Spec.SpecBalanceDruid> {
Presets.Phase2Talents,
Presets.Phase3Talents,
],
rotations: [
Presets.ROTATION_PRESET_BASIC_APL,
],
// Preset gear configurations that the user can quickly select.
gear: [
Presets.PRE_RAID_PRESET,
Expand Down
10 changes: 10 additions & 0 deletions ui/core/components/individual_sim_ui/apl_values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
APLValueRuneCooldown,
APLValueNextRuneCooldown,
APLValueNumberTargets,
APLValueSpellCastTime,
APLValueCurrentNonDeathRuneCount,
} from '../../proto/apl.js';

Expand Down Expand Up @@ -546,6 +547,15 @@ const valueTypeFactories: Record<NonNullable<APLValueType>, ValueTypeConfig<any>
AplHelpers.actionIdFieldConfig('spellId', 'castable_spells'),
],
}),
['spellCastTime']: inputBuilder({
label: 'Cast Time',
submenu: ['Spell'],
shortDescription: 'Amount of time to cast the spell including any haste and spell cast time adjustments.',
newValue: APLValueSpellCastTime.create,
fields: [
AplHelpers.actionIdFieldConfig('spellId', 'castable_spells'),
],
}),

// Auras
['auraIsActive']: inputBuilder({
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 @@ -40,7 +40,7 @@ export const simLaunchStatuses: Record<Spec, LaunchStatus> = {

// Alpha and Beta show an info notice at the top of the page.
export const aplLaunchStatuses: Record<Spec, LaunchStatus> = {
[Spec.SpecBalanceDruid]: LaunchStatus.Unlaunched,
[Spec.SpecBalanceDruid]: LaunchStatus.Alpha,
[Spec.SpecFeralDruid]: LaunchStatus.Unlaunched,
[Spec.SpecFeralTankDruid]: LaunchStatus.Unlaunched,
[Spec.SpecRestorationDruid]: LaunchStatus.Unlaunched,
Expand Down

0 comments on commit a22fa83

Please sign in to comment.