Skip to content
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
12 changes: 12 additions & 0 deletions assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,10 @@
"label": "Cast",
"tooltip": "Casts the spell if possible, i.e. resource/cooldown/GCD/etc requirements are all met."
},
"cancel_cast": {
"label": "Cancel Cast",
"tooltip": "Cancels the current spell cast. (This is only evaluated during hardcasting and requires \"ReactToEvent\" to be added to the trigger in the Sim core."
},
"cast_at_player": {
"label": "Cast at Player",
"tooltip": "Casts a friendly spell if possible, i.e. resource/cooldown/GCD/etc requirements are all met."
Expand Down Expand Up @@ -1337,6 +1341,10 @@
"label": "Time To Next Auto",
"tooltip": "Amount of time remaining before the next Main-hand or Off-hand melee attack, or <b>0</b> if autoattacks are not engaged."
},
"remaining_cast_time": {
"label": "Remaining Cast Time",
"tooltip": "Amount of time remaining before the current spell cast completes."
},
"spell_known": {
"label": "Spell Known",
"tooltip": "<b>True</b> if the spell is currently known, otherwise <b>False</b>."
Expand Down Expand Up @@ -1370,6 +1378,10 @@
"label": "CPM",
"tooltip": "Casts Per Minute for the spell so far in the current iteration."
},
"is_casting": {
"label": "Is Casting",
"tooltip": "<b>True</b> if this spell is currently being cast, otherwise <b>False</b>."
},
"is_channeling": {
"label": "Is Channeling",
"tooltip": "<b>True</b> if this spell is currently being channeled, otherwise <b>False</b>."
Expand Down
12 changes: 12 additions & 0 deletions assets/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,10 @@
"label": "Lancer",
"tooltip": "Lance le sort si possible, c'est-à-dire si toutes les exigences de ressources/temps de recharge/GCD/etc sont remplies."
},
"cancel_cast": {
"label": "Annuler le lancement",
"tooltip": "Annule le lancement du sort en cours. (Cela n'est évalué que pendant le lancement dur et nécessite que \"ReactToEvent\" soit ajouté au déclencheur dans le cœur du Sim."
},
"cast_at_player": {
"label": "Lancer sur le joueur",
"tooltip": "Lance un sort amical si possible, c'est-à-dire si toutes les exigences de ressources/temps de recharge/GCD/etc sont remplies."
Expand Down Expand Up @@ -1337,6 +1341,10 @@
"label": "Temps jusqu’à prochaine Auto",
"tooltip": "Quantité de temps restant avant la prochaine attaque de mêlée Main gauche ou Main droite, ou <b>0</b> si les attaques automatiques ne sont pas activés."
},
"remaining_cast_time": {
"label": "Temps d'incantation restant",
"tooltip": "Quantité de temps restant avant que l'incantation du sort en cours ne soit terminée."
},
"spell_known": {
"label": "Sort connu",
"tooltip": "<b>Vrai</b> si le sort est actuellement connu, sinon <b>Faux</b>."
Expand Down Expand Up @@ -1370,6 +1378,10 @@
"label": "CPM",
"tooltip": "Lancers par minute pour le sort jusqu'à présent dans l'itération actuelle."
},
"is_casting": {
"label": "Est en train de lancer",
"tooltip": "<b>Vrai</b> si ce sort est actuellement en train d'être lancé, sinon <b>Faux</b>."
},
"is_channeling": {
"label": "Canalise",
"tooltip": "<b>Vrai</b> si ce sort est actuellement canalisé, sinon <b>Faux</b>."
Expand Down
14 changes: 12 additions & 2 deletions proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ message APLGroup {
repeated APLValueVariable variables = 3; // Variables that can be used in this group
}

// NextIndex: 30
// NextIndex: 31
message APLAction {
APLValue condition = 1; // If set, action will only execute if value is true or != 0.

oneof action {
// Casting
APLActionCastSpell cast_spell = 3;
APLActionCancelSpellCast cancel_spell_cast = 30;
APLActionCastFriendlySpell cast_friendly_spell = 20;
APLActionChannelSpell channel_spell = 16;
APLActionMultidot multidot = 8;
Expand Down Expand Up @@ -99,7 +100,7 @@ message APLAction {
}


// NextIndex: 125
// NextIndex: 127
message APLValue {
UUID uuid = 85;

Expand Down Expand Up @@ -172,6 +173,9 @@ message APLValue {
// Autoattack values
APLValueAutoTimeToNext auto_time_to_next = 40;

// Casting values
APLValueRemainingCastTime remaining_cast_time = 125;

// Spell values
APLValueSpellIsKnown spell_is_known = 74;
APLValueSpellCanCast spell_can_cast = 19;
Expand All @@ -188,6 +192,7 @@ message APLValue {
APLValueSpellGCDHastedDuration spell_gcd_hasted_duration = 115;
APLValueSpellFullCooldown spell_full_cooldown = 116;
APLValueSpellInFlight spell_in_flight = 118;
APLValueSpellIsCasting spell_is_casting = 126 ;

// Aura values
APLValueAuraIsKnown aura_is_known = 73;
Expand Down Expand Up @@ -271,6 +276,7 @@ message APLActionCastSpell {
ActionID spell_id = 1;
UnitReference target = 2;
}
message APLActionCancelSpellCast {}

message APLActionCastFriendlySpell {
ActionID spell_id = 1;
Expand Down Expand Up @@ -607,6 +613,7 @@ message APLValueGCDIsReady {}
message APLValueGCDTimeToReady {}

message APLValueAutoTimeToNext {}
message APLValueRemainingCastTime {}

message APLValueSpellIsKnown {
ActionID spell_id = 1;
Expand Down Expand Up @@ -660,6 +667,9 @@ message APLValueSpellFullCooldown{
message APLValueSpellInFlight{
ActionID spell_id = 1;
}
message APLValueSpellIsCasting{
ActionID spell_id = 1;
}

message APLValueAuraIsKnown {
UnitReference source_unit = 2;
Expand Down
51 changes: 51 additions & 0 deletions schemas/translation.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3918,6 +3918,22 @@
"tooltip"
]
},
"cancel_cast": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"tooltip": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"label",
"tooltip"
]
},
"cast_at_player": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -4564,6 +4580,7 @@
"additionalProperties": false,
"required": [
"cast",
"cancel_cast",
"cast_at_player",
"multi_dot",
"strict_multi_dot",
Expand Down Expand Up @@ -5536,6 +5553,22 @@
"tooltip"
]
},
"remaining_cast_time": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"tooltip": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"label",
"tooltip"
]
},
"spell_known": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -5668,6 +5701,22 @@
"tooltip"
]
},
"is_casting": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"tooltip": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"label",
"tooltip"
]
},
"is_channeling": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -6568,6 +6617,7 @@
"gcd_is_ready",
"gcd_time_to_ready",
"time_to_next_auto",
"remaining_cast_time",
"spell_known",
"current_cost",
"can_cast",
Expand All @@ -6576,6 +6626,7 @@
"cast_time",
"travel_time",
"cpm",
"is_casting",
"is_channeling",
"channeled_ticks",
"number_of_charges",
Expand Down
3 changes: 3 additions & 0 deletions sim/common/mop/trinkets_phase_3_52.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ func init() {
)
// Manually override Crit % to Crit Rating
statBuffAura.BuffedStatTypes = []stats.Stat{stats.CritRating}
statBuffAura.Aura.ApplyOnGain(func(aura *core.Aura, sim *core.Simulation) {
character.ReactToEvent(sim, false)
})

triggerAura := character.MakeProcTriggerAura(core.ProcTrigger{
Name: fmt.Sprintf("%s (%s)", label, versionLabel),
Expand Down
2 changes: 2 additions & 0 deletions sim/core/apl_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ func (rot *APLRotation) newAPLActionImpl(config *proto.APLAction) APLActionImpl
// Casting
case *proto.APLAction_CastSpell:
return rot.newActionCastSpell(config.GetCastSpell())
case *proto.APLAction_CancelSpellCast:
return rot.newActionCancelSpellCast(config.GetCancelSpellCast())
case *proto.APLAction_CastFriendlySpell:
return rot.newActionCastFriendlySpell(config.GetCastFriendlySpell())
case *proto.APLAction_ChannelSpell:
Expand Down
20 changes: 20 additions & 0 deletions sim/core/apl_actions_casting.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ func (action *APLActionCastSpell) String() string {
return fmt.Sprintf("Cast Spell(%s)", action.spell.ActionID)
}

type APLActionCancelSpellCast struct {
defaultAPLActionImpl
unit *Unit
}

func (rot *APLRotation) newActionCancelSpellCast(_ *proto.APLActionCancelSpellCast) APLActionImpl {
return &APLActionCancelSpellCast{
unit: rot.unit,
}
}
func (action *APLActionCancelSpellCast) IsReady(sim *Simulation) bool {
return action.unit.Hardcast.Expires > sim.CurrentTime
}
func (action *APLActionCancelSpellCast) Execute(sim *Simulation) {
action.unit.CancelHardcast(sim)
}
func (action *APLActionCancelSpellCast) String() string {
return fmt.Sprintf("Cancel Spell Cast(%s)", action.unit.Hardcast.ActionID)
}

type APLActionCastFriendlySpell struct {
defaultAPLActionImpl
spell *Spell
Expand Down
6 changes: 6 additions & 0 deletions sim/core/apl_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ func (rot *APLRotation) newAPLValueWithContext(config *proto.APLValue, groupVari
case *proto.APLValue_AutoTimeToNext:
value = rot.newValueAutoTimeToNext(config.GetAutoTimeToNext(), config.Uuid)

// Casting
case *proto.APLValue_RemainingCastTime:
value = rot.newValueRemainingCastTime(config.GetRemainingCastTime(), config.Uuid)

// Spells
case *proto.APLValue_SpellIsKnown:
value = rot.newValueSpellIsKnown(config.GetSpellIsKnown(), config.Uuid)
Expand All @@ -200,6 +204,8 @@ func (rot *APLRotation) newAPLValueWithContext(config *proto.APLValue, groupVari
value = rot.newValueSpellTravelTime(config.GetSpellTravelTime(), config.Uuid)
case *proto.APLValue_SpellCpm:
value = rot.newValueSpellCPM(config.GetSpellCpm(), config.Uuid)
case *proto.APLValue_SpellIsCasting:
value = rot.newValueSpellIsCasting(config.GetSpellIsCasting(), config.Uuid)
case *proto.APLValue_SpellIsChanneling:
value = rot.newValueSpellIsChanneling(config.GetSpellIsChanneling(), config.Uuid)
case *proto.APLValue_SpellChanneledTicks:
Expand Down
27 changes: 27 additions & 0 deletions sim/core/apl_values_casting.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package core

import (
"time"

"github.com/wowsims/mop/sim/core/proto"
)

type APLValueRemainingCastTime struct {
DefaultAPLValueImpl
unit *Unit
}

func (rot *APLRotation) newValueRemainingCastTime(_ *proto.APLValueRemainingCastTime, _ *proto.UUID) APLValue {
return &APLValueRemainingCastTime{
unit: rot.unit,
}
}
func (value *APLValueRemainingCastTime) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeDuration
}
func (value *APLValueRemainingCastTime) GetDuration(sim *Simulation) time.Duration {
return max(0, value.unit.Hardcast.Expires-sim.CurrentTime)
}
func (value *APLValueRemainingCastTime) String() string {
return "Remaining Cast Time"
}
24 changes: 24 additions & 0 deletions sim/core/apl_values_spell.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,30 @@ func (value *APLValueSpellCPM) String() string {
return fmt.Sprintf("CPM(%s)", value.spell.ActionID)
}

type APLValueSpellIsCasting struct {
DefaultAPLValueImpl
spell *Spell
}

func (rot *APLRotation) newValueSpellIsCasting(config *proto.APLValueSpellIsCasting, _ *proto.UUID) APLValue {
spell := rot.GetAPLSpell(config.SpellId)
if spell == nil {
return nil
}
return &APLValueSpellIsCasting{
spell: spell,
}
}
func (action *APLValueSpellIsCasting) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeBool
}
func (action *APLValueSpellIsCasting) GetBool(sim *Simulation) bool {
return action.spell.Unit.Hardcast.Expires > sim.CurrentTime
}
func (action *APLValueSpellIsCasting) String() string {
return fmt.Sprintf("IsCasting(%s)", action.spell.ActionID)
}

type APLValueSpellIsChanneling struct {
DefaultAPLValueImpl
spell *Spell
Expand Down
10 changes: 9 additions & 1 deletion sim/core/gcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (unit *Unit) ReactToEvent(sim *Simulation, randomizeReactionTime bool) {
newEvaluationTime := sim.CurrentTime + unit.ReactionTime

if randomizeReactionTime {
newEvaluationTime = sim.CurrentTime + DurationFromSeconds(sim.RandomFloat("Reaction Time") * 2 * unit.ReactionTime.Seconds())
newEvaluationTime = sim.CurrentTime + DurationFromSeconds(sim.RandomFloat("Reaction Time")*2*unit.ReactionTime.Seconds())
}

if unit.NextRotationActionAt() > newEvaluationTime {
Expand All @@ -89,8 +89,16 @@ func (unit *Unit) CancelGCDTimer(sim *Simulation) {
}

func (unit *Unit) CancelHardcast(sim *Simulation) {
harcastEndTime := unit.Hardcast.Expires
unit.hardcastAction.Cancel(sim)
unit.Hardcast.Expires = startingCDTime
unit.SetGCDTimer(sim, sim.CurrentTime+unit.ReactionTime)
spell := unit.GetSpell(unit.Hardcast.ActionID)

if sim.Log != nil && !spell.Flags.Matches(SpellFlagNoLogs) {
cancelTime := spell.CurCast.CastTime - (harcastEndTime - sim.CurrentTime)
spell.Unit.Log(sim, "Cancelled %s after %s", spell.ActionID, cancelTime)
}
}

func (unit *Unit) WaitUntil(sim *Simulation, readyTime time.Duration) {
Expand Down
Loading