From ec47b76779fbbe22387fdff82f9c66d1f4f3bf20 Mon Sep 17 00:00:00 2001 From: rosenrusinov Date: Fri, 14 Jul 2023 13:48:04 +0200 Subject: [PATCH 1/2] add spell travel time --- proto/apl.proto | 4 ++++ sim/core/apl_value.go | 2 ++ sim/core/apl_values_spell.go | 22 +++++++++++++++++++ .../individual_sim_ui/apl_values.ts | 14 ++++++++++-- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/proto/apl.proto b/proto/apl.proto index b2e809addd..1321818bf3 100644 --- a/proto/apl.proto +++ b/proto/apl.proto @@ -83,6 +83,7 @@ message APLValue { APLValueSpellIsReady spell_is_ready = 20; APLValueSpellTimeToReady spell_time_to_ready = 21; APLValueSpellCastTime spell_cast_time = 35; + APLValueSpellTravelTime spell_travel_time = 36; // Aura values APLValueAuraIsActive aura_is_active = 22; @@ -240,6 +241,9 @@ message APLValueSpellTimeToReady { message APLValueSpellCastTime { ActionID spell_id = 1; } +message APLValueSpellTravelTime { + ActionID spell_id = 1; +} message APLValueAuraIsActive { ActionID aura_id = 1; diff --git a/sim/core/apl_value.go b/sim/core/apl_value.go index 7d925524f7..845ad0c78b 100644 --- a/sim/core/apl_value.go +++ b/sim/core/apl_value.go @@ -116,6 +116,8 @@ func (rot *APLRotation) newAPLValue(config *proto.APLValue) APLValue { return rot.newValueSpellTimeToReady(config.GetSpellTimeToReady()) case *proto.APLValue_SpellCastTime: return rot.newValueSpellCastTime(config.GetSpellCastTime()) + case *proto.APLValue_SpellTravelTime: + return rot.newValueSpellTravelTime(config.GetSpellTravelTime()) // Auras case *proto.APLValue_AuraIsActive: diff --git a/sim/core/apl_values_spell.go b/sim/core/apl_values_spell.go index 52ec236562..04359b0489 100644 --- a/sim/core/apl_values_spell.go +++ b/sim/core/apl_values_spell.go @@ -97,3 +97,25 @@ func (value *APLValueSpellCastTime) Type() proto.APLValueType { func (value *APLValueSpellCastTime) GetDuration(sim *Simulation) time.Duration { return value.spell.Unit.ApplyCastSpeedForSpell(value.spell.DefaultCast.CastTime, value.spell) } + +type APLValueSpellTravelTime struct { + defaultAPLValueImpl + spell *Spell +} + +func (rot *APLRotation) newValueSpellTravelTime(config *proto.APLValueSpellTravelTime) APLValue { + unit := rot.unit + spell := unit.aplGetSpell(config.SpellId) + if spell == nil { + return nil + } + return &APLValueSpellTravelTime{ + spell: spell, + } +} +func (value *APLValueSpellTravelTime) Type() proto.APLValueType { + return proto.APLValueType_ValueTypeDuration +} +func (value *APLValueSpellTravelTime) GetDuration(sim *Simulation) time.Duration { + return time.Duration(float64(time.Second) * value.spell.Unit.DistanceFromTarget / value.spell.MissileSpeed) +} diff --git a/ui/core/components/individual_sim_ui/apl_values.ts b/ui/core/components/individual_sim_ui/apl_values.ts index 09bb3ecd76..195708989f 100644 --- a/ui/core/components/individual_sim_ui/apl_values.ts +++ b/ui/core/components/individual_sim_ui/apl_values.ts @@ -36,6 +36,7 @@ import { APLValueNumberTargets, APLValueSpellCastTime, APLValueCurrentNonDeathRuneCount, + APLValueSpellTravelTime, } from '../../proto/apl.js'; import { EventID, TypedEvent } from '../../typed_event.js'; @@ -464,7 +465,7 @@ const valueTypeFactories: Record, ValueTypeConfig ], }), ['currentRuneActive']: inputBuilder({ - label: 'Rune Ready', + label: 'Rune Is Ready', submenu: ['Resources', 'Runes'], shortDescription: 'Is the rune of a certain slot currently available.', newValue: APLValueCurrentRuneActive.create, @@ -473,7 +474,7 @@ const valueTypeFactories: Record, ValueTypeConfig ], }), ['currentRuneDeath']: inputBuilder({ - label: 'Rune Death', + label: 'Rune Is Death', submenu: ['Resources', 'Runes'], shortDescription: 'Is the rune of a certain slot currently converted to Death.', newValue: APLValueCurrentRuneDeath.create, @@ -556,6 +557,15 @@ const valueTypeFactories: Record, ValueTypeConfig AplHelpers.actionIdFieldConfig('spellId', 'castable_spells'), ], }), + ['spellTravelTime']: inputBuilder({ + label: 'Travel Time', + submenu: ['Spell'], + shortDescription: 'Amount of time for the spell to travel to the target.', + newValue: APLValueSpellTravelTime.create, + fields: [ + AplHelpers.actionIdFieldConfig('spellId', 'castable_spells'), + ], + }), // Auras ['auraIsActive']: inputBuilder({ From 9b1bf9f00bb0f55376e1697cb4587399c1d5bc0b Mon Sep 17 00:00:00 2001 From: rosenrusinov Date: Fri, 14 Jul 2023 14:10:27 +0200 Subject: [PATCH 2/2] add channel time --- proto/apl.proto | 6 ++++- sim/core/apl_value.go | 2 ++ sim/core/apl_values_spell.go | 22 +++++++++++++++++++ .../individual_sim_ui/apl_values.ts | 10 +++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/proto/apl.proto b/proto/apl.proto index 1321818bf3..24d2042c13 100644 --- a/proto/apl.proto +++ b/proto/apl.proto @@ -83,7 +83,8 @@ message APLValue { APLValueSpellIsReady spell_is_ready = 20; APLValueSpellTimeToReady spell_time_to_ready = 21; APLValueSpellCastTime spell_cast_time = 35; - APLValueSpellTravelTime spell_travel_time = 36; + APLValueSpellChannelTime spell_channel_time = 36; + APLValueSpellTravelTime spell_travel_time = 37; // Aura values APLValueAuraIsActive aura_is_active = 22; @@ -241,6 +242,9 @@ message APLValueSpellTimeToReady { message APLValueSpellCastTime { ActionID spell_id = 1; } +message APLValueSpellChannelTime { + ActionID spell_id = 1; +} message APLValueSpellTravelTime { ActionID spell_id = 1; } diff --git a/sim/core/apl_value.go b/sim/core/apl_value.go index 845ad0c78b..ed51bd46de 100644 --- a/sim/core/apl_value.go +++ b/sim/core/apl_value.go @@ -116,6 +116,8 @@ func (rot *APLRotation) newAPLValue(config *proto.APLValue) APLValue { return rot.newValueSpellTimeToReady(config.GetSpellTimeToReady()) case *proto.APLValue_SpellCastTime: return rot.newValueSpellCastTime(config.GetSpellCastTime()) + case *proto.APLValue_SpellChannelTime: + return rot.newValueSpellChannelTime(config.GetSpellChannelTime()) case *proto.APLValue_SpellTravelTime: return rot.newValueSpellTravelTime(config.GetSpellTravelTime()) diff --git a/sim/core/apl_values_spell.go b/sim/core/apl_values_spell.go index 04359b0489..e3a6d9fc8f 100644 --- a/sim/core/apl_values_spell.go +++ b/sim/core/apl_values_spell.go @@ -98,6 +98,28 @@ func (value *APLValueSpellCastTime) GetDuration(sim *Simulation) time.Duration { return value.spell.Unit.ApplyCastSpeedForSpell(value.spell.DefaultCast.CastTime, value.spell) } +type APLValueSpellChannelTime struct { + defaultAPLValueImpl + spell *Spell +} + +func (rot *APLRotation) newValueSpellChannelTime(config *proto.APLValueSpellChannelTime) APLValue { + unit := rot.unit + spell := unit.aplGetSpell(config.SpellId) + if spell == nil { + return nil + } + return &APLValueSpellChannelTime{ + spell: spell, + } +} +func (value *APLValueSpellChannelTime) Type() proto.APLValueType { + return proto.APLValueType_ValueTypeDuration +} +func (value *APLValueSpellChannelTime) GetDuration(sim *Simulation) time.Duration { + return value.spell.Unit.ApplyCastSpeedForSpell(value.spell.DefaultCast.ChannelTime, value.spell) +} + type APLValueSpellTravelTime struct { defaultAPLValueImpl spell *Spell diff --git a/ui/core/components/individual_sim_ui/apl_values.ts b/ui/core/components/individual_sim_ui/apl_values.ts index 195708989f..64888b4e4f 100644 --- a/ui/core/components/individual_sim_ui/apl_values.ts +++ b/ui/core/components/individual_sim_ui/apl_values.ts @@ -37,6 +37,7 @@ import { APLValueSpellCastTime, APLValueCurrentNonDeathRuneCount, APLValueSpellTravelTime, + APLValueSpellChannelTime, } from '../../proto/apl.js'; import { EventID, TypedEvent } from '../../typed_event.js'; @@ -557,6 +558,15 @@ const valueTypeFactories: Record, ValueTypeConfig AplHelpers.actionIdFieldConfig('spellId', 'castable_spells'), ], }), + ['spellChannelTime']: inputBuilder({ + label: 'Channel Time', + submenu: ['Spell'], + shortDescription: 'Amount of time to channel the spell including any haste and spell cast time adjustments.', + newValue: APLValueSpellChannelTime.create, + fields: [ + AplHelpers.actionIdFieldConfig('spellId', 'castable_spells'), + ], + }), ['spellTravelTime']: inputBuilder({ label: 'Travel Time', submenu: ['Spell'],