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
52 changes: 29 additions & 23 deletions proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -180,76 +180,82 @@ message ActionMetrics {
// Metrics for a specific action, when cast at a particular target.
message TargetedActionMetrics {
// Raid/Target Index of the unit these metrics are targeted at.
int32 unit_index = 12;
int32 unit_index = 1;

// # of times this action was used by the agent.
int32 casts = 1;
int32 casts = 2;

// # of times this action hit a target. For cleave spells this can be larger than casts.
int32 hits = 2;
int32 hits = 3;

// # of times this action was a critical strike.
int32 crits = 3;
int32 crits = 4;

// # of times this action ticked on a target.
int32 ticks = 21;
int32 ticks = 5;

// # of times this action was a critical tick on a target.
int32 crit_ticks = 22;
int32 crit_ticks = 6;

// # of times this action was a Miss or Resist.
int32 misses = 4;
int32 misses = 7;

// # of times this action was a Dodge.
int32 dodges = 5;
int32 dodges = 8;

// # of times this action was a Parry.
int32 parries = 6;
int32 parries = 9;

// # of times this action was a Block.
int32 blocks = 7;
int32 blocks = 10;

// # of times this action was a Critical Block.
int32 crit_blocks = 20;
int32 crit_blocks = 11;

// # of times this action was a Glance.
int32 glances = 8;
int32 glances = 12;

// # of times this action was a Glancing Block.
int32 glance_blocks = 13;

// Total damage done to this target by this action.
double damage = 9;
double damage = 14;

// Total critical damage done to this target by this action.
double crit_damage = 15;

// Total tick damage done to this target by this action.
double tick_damage = 23;
double tick_damage = 16;

// Total critical tick damage done to this target by this action.
double crit_tick_damage = 24;
double crit_tick_damage = 17;

// Total glancing damage done to this target by this action.
double glance_damage = 18;

// Total glancing damage done to this target by this action.
double glance_damage = 17;
double glance_block_damage = 19;

// Total block damage done to this target by this action.
double block_damage = 18;
double block_damage = 20;

// Total critical block damage done to this target by this action.
double crit_block_damage = 19;
double crit_block_damage = 21;

// Total threat done to this target by this action.
double threat = 10;
double threat = 22;

// Total healing done to this target by this action.
double healing = 11;
double healing = 23;

// Total critical healing done to this target by this action.
double crit_healing = 16;
double crit_healing = 24;

// Total shielding done to this target by this action.
double shielding = 13;
double shielding = 25;

// Total time spent casting this action, in milliseconds, either from hard casts, GCD, or channeling.
double cast_time_ms = 14;
double cast_time_ms = 26;
}

message AggregatorData {
Expand Down
6 changes: 4 additions & 2 deletions sim/core/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,16 @@ func (ho HitOutcome) String() string {
return "Dodge"
} else if ho.Matches(OutcomeParry) {
return "Parry"
} else if ho.Matches(OutcomeGlance) {
return "Glance"
} else if ho.Matches(OutcomeBlock) {
if ho.Matches(OutcomeCrit) {
return "CriticalBlock"
} else if ho.Matches(OutcomeGlance) {
return "GlanceBlock"
} else {
return "Block"
}
} else if ho.Matches(OutcomeGlance) {
return "Glance"
} else if ho.Matches(OutcomeCrit) {
return "Crit" + ho.PartialResistString()
} else if ho.Matches(OutcomeHit) {
Expand Down
152 changes: 80 additions & 72 deletions sim/core/metrics_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,89 +148,95 @@ func (actionMetrics *ActionMetrics) ToProto(actionID ActionID) *proto.ActionMetr

// Metric totals for a spell against a specific target, for the current iteration.
type SpellMetrics struct {
Casts int32
Misses int32
Hits int32
Crits int32
Ticks int32
CritTicks int32
Crushes int32
Dodges int32
Glances int32
Parries int32
Blocks int32
CritBlocks int32

TotalDamage float64 // Damage done by all casts of this spell.
TotalCritDamage float64 // Damage done by all critical casts of this spell.
TotalTickDamage float64 // Damage done by all dots of this spell.
TotalCritTickDamage float64 // Damage done by all critical dots of this spell.
TotalGlanceDamage float64 // Damage done by all glance casts of this spell.
TotalBlockDamage float64 // Damage done by all block casts of this spell.
TotalCritBlockDamage float64 // Damage done by all critical block casts of this spell.
TotalThreat float64 // Threat generated by all casts of this spell.
TotalHealing float64 // Healing done by all casts of this spell.
TotalCritHealing float64 // Healing done by all critical casts of this spell.
TotalShielding float64 // Shielding done by all casts of this spell.
TotalCastTime time.Duration
Casts int32
Misses int32
Hits int32
Crits int32
Ticks int32
CritTicks int32
Crushes int32
Dodges int32
Parries int32
Blocks int32
CritBlocks int32
Glances int32
GlanceBlocks int32

TotalDamage float64 // Damage done by all casts of this spell.
TotalCritDamage float64 // Damage done by all critical casts of this spell.
TotalTickDamage float64 // Damage done by all dots of this spell.
TotalCritTickDamage float64 // Damage done by all critical dots of this spell.
TotalGlanceDamage float64 // Damage done by all glance casts of this spell.
TotalGlanceBlockDamage float64 // Damage done by all glance block casts of this spell.
TotalBlockDamage float64 // Damage done by all block casts of this spell.
TotalCritBlockDamage float64 // Damage done by all critical block casts of this spell.
TotalThreat float64 // Threat generated by all casts of this spell.
TotalHealing float64 // Healing done by all casts of this spell.
TotalCritHealing float64 // Healing done by all critical casts of this spell.
TotalShielding float64 // Shielding done by all casts of this spell.
TotalCastTime time.Duration
}

type TargetedActionMetrics struct {
UnitIndex int32

Casts int32
Hits int32
Crits int32
Ticks int32
CritTicks int32
Misses int32
Dodges int32
Parries int32
Blocks int32
CritBlocks int32
Glances int32

Damage float64
CritDamage float64
TickDamage float64
CritTickDamage float64
GlanceDamage float64
BlockDamage float64
CritBlockDamage float64
Threat float64
Healing float64
CritHealing float64
Shielding float64
CastTime time.Duration
Casts int32
Hits int32
Crits int32
Ticks int32
CritTicks int32
Misses int32
Dodges int32
Parries int32
Blocks int32
CritBlocks int32
Glances int32
GlanceBlocks int32

Damage float64
CritDamage float64
TickDamage float64
CritTickDamage float64
GlanceDamage float64
GlanceBlockDamage float64
BlockDamage float64
CritBlockDamage float64
Threat float64
Healing float64
CritHealing float64
Shielding float64
CastTime time.Duration
}

func (tam *TargetedActionMetrics) ToProto() *proto.TargetedActionMetrics {
return &proto.TargetedActionMetrics{
UnitIndex: tam.UnitIndex,

Casts: tam.Casts,
Hits: tam.Hits,
Crits: tam.Crits,
Ticks: tam.Ticks,
CritTicks: tam.CritTicks,
Misses: tam.Misses,
Dodges: tam.Dodges,
Parries: tam.Parries,
Blocks: tam.Blocks,
CritBlocks: tam.CritBlocks,
Glances: tam.Glances,
Damage: tam.Damage,
CritDamage: tam.CritDamage,
TickDamage: tam.TickDamage,
CritTickDamage: tam.CritTickDamage,
GlanceDamage: tam.GlanceDamage,
BlockDamage: tam.BlockDamage,
CritBlockDamage: tam.CritBlockDamage,
Threat: tam.Threat,
Healing: tam.Healing,
CritHealing: tam.CritHealing,
Shielding: tam.Shielding,
CastTimeMs: float64(tam.CastTime.Milliseconds()),
Casts: tam.Casts,
Hits: tam.Hits,
Crits: tam.Crits,
Ticks: tam.Ticks,
CritTicks: tam.CritTicks,
Misses: tam.Misses,
Dodges: tam.Dodges,
Parries: tam.Parries,
Blocks: tam.Blocks,
CritBlocks: tam.CritBlocks,
Glances: tam.Glances,
GlanceBlocks: tam.GlanceBlocks,
Damage: tam.Damage,
CritDamage: tam.CritDamage,
TickDamage: tam.TickDamage,
CritTickDamage: tam.CritTickDamage,
GlanceDamage: tam.GlanceDamage,
GlanceBlockDamage: tam.GlanceBlockDamage,
BlockDamage: tam.BlockDamage,
CritBlockDamage: tam.CritBlockDamage,
Threat: tam.Threat,
Healing: tam.Healing,
CritHealing: tam.CritHealing,
Shielding: tam.Shielding,
CastTimeMs: float64(tam.CastTime.Milliseconds()),
}
}

Expand Down Expand Up @@ -378,11 +384,13 @@ func (unitMetrics *UnitMetrics) addSpellMetrics(spell *Spell, actionID ActionID,
tam.Blocks += spellTargetMetrics.Blocks
tam.CritBlocks += spellTargetMetrics.CritBlocks
tam.Glances += spellTargetMetrics.Glances
tam.GlanceBlocks += spellTargetMetrics.GlanceBlocks
tam.Damage += spellTargetMetrics.TotalDamage
tam.CritDamage += spellTargetMetrics.TotalCritDamage
tam.TickDamage += spellTargetMetrics.TotalTickDamage
tam.CritTickDamage += spellTargetMetrics.TotalCritTickDamage
tam.GlanceDamage += spellTargetMetrics.TotalGlanceDamage
tam.GlanceBlockDamage += spellTargetMetrics.TotalGlanceBlockDamage
tam.BlockDamage += spellTargetMetrics.TotalBlockDamage
tam.CritBlockDamage += spellTargetMetrics.TotalCritBlockDamage
tam.Threat += spellTargetMetrics.TotalThreat
Expand Down
2 changes: 2 additions & 0 deletions sim/core/sim_concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,13 @@ func (rsrc *raidSimResultCombiner) addActionMetrics(unit *proto.UnitMetrics, add
baseTgt.Blocks += addTgt.Blocks
baseTgt.CritBlocks += addTgt.CritBlocks
baseTgt.Glances += addTgt.Glances
baseTgt.GlanceBlocks += addTgt.GlanceBlocks
baseTgt.Damage += addTgt.Damage
baseTgt.CritDamage += addTgt.CritDamage
baseTgt.TickDamage += addTgt.TickDamage
baseTgt.CritTickDamage += addTgt.CritTickDamage
baseTgt.GlanceDamage += addTgt.GlanceDamage
baseTgt.GlanceBlockDamage += addTgt.GlanceBlockDamage
baseTgt.BlockDamage += addTgt.BlockDamage
baseTgt.CritBlockDamage += addTgt.CritBlockDamage
baseTgt.Threat += addTgt.Threat
Expand Down
19 changes: 16 additions & 3 deletions sim/core/spell_outcome.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// 3. Modify the damage if necessary.
type OutcomeApplier func(sim *Simulation, result *SpellResult, attackTable *AttackTable)

func (spell *Spell) OutcomeAlwaysHit(_ *Simulation, result *SpellResult, _ *AttackTable) {
func (spell *Spell) OutcomeAlwaysHit(sim *Simulation, result *SpellResult, _ *AttackTable) {
result.Outcome = OutcomeHit
spell.SpellMetrics[result.Target.UnitIndex].Hits++
}
Expand Down Expand Up @@ -227,7 +227,6 @@ func (spell *Spell) outcomeMeleeWhite(sim *Simulation, result *SpellResult, atta
unit := spell.Unit
roll := sim.RandomFloat("White Hit Table")
chance := 0.0

if unit.PseudoStats.InFrontOfTarget {
if !result.applyAttackTableMiss(spell, attackTable, roll, &chance) &&
!result.applyAttackTableDodge(spell, attackTable, roll, &chance) &&
Expand All @@ -253,7 +252,6 @@ func (spell *Spell) OutcomeMeleeWhiteNoGlance(sim *Simulation, result *SpellResu
unit := spell.Unit
roll := sim.RandomFloat("White Hit Table")
chance := 0.0

if unit.PseudoStats.InFrontOfTarget {
if !result.applyAttackTableMiss(spell, attackTable, roll, &chance) &&
!result.applyAttackTableDodge(spell, attackTable, roll, &chance) &&
Expand Down Expand Up @@ -418,6 +416,7 @@ func (spell *Spell) OutcomeMeleeSpecialCritOnlyNoHitCounter(sim *Simulation, res
spell.outcomeMeleeSpecialCritOnly(sim, result, attackTable, false)
}
func (spell *Spell) outcomeMeleeSpecialCritOnly(sim *Simulation, result *SpellResult, attackTable *AttackTable, countHits bool) {

if !result.applyAttackTableCritSeparateRoll(sim, spell, attackTable, countHits) {
result.applyAttackTableHit(spell, countHits)
}
Expand All @@ -430,6 +429,7 @@ func (spell *Spell) OutcomeMeleeSpecialBlockAndCritNoHitCounter(sim *Simulation,
spell.outcomeMeleeSpecialBlockAndCrit(sim, result, attackTable, false)
}
func (spell *Spell) outcomeMeleeSpecialBlockAndCrit(sim *Simulation, result *SpellResult, attackTable *AttackTable, countHits bool) {

if spell.Unit.PseudoStats.InFrontOfTarget {
if result.applyAttackTableCritSeparateRoll(sim, spell, attackTable, countHits) {
result.applyAttackTableBlock(sim, spell, attackTable)
Expand Down Expand Up @@ -589,7 +589,14 @@ func (result *SpellResult) applyAttackTableBlock(sim *Simulation, spell *Spell,
if sim.RandomFloat("Block Roll") < chance {
result.Outcome |= OutcomeBlock
if result.DidCrit() {
// Subtract Crits because they happen before Blocks
spell.SpellMetrics[result.Target.UnitIndex].Crits--
spell.SpellMetrics[result.Target.UnitIndex].CritBlocks++
} else if result.DidGlance() {
// Subtract Glances because they happen before Blocks
spell.SpellMetrics[result.Target.UnitIndex].Glances--
spell.SpellMetrics[result.Target.UnitIndex].GlanceBlocks++

} else {
spell.SpellMetrics[result.Target.UnitIndex].Blocks++
}
Expand Down Expand Up @@ -719,7 +726,13 @@ func (result *SpellResult) applyEnemyAttackTableBlock(sim *Simulation, spell *Sp
if sim.RandomFloat("Player Block") < chance {
result.Outcome |= OutcomeBlock
if result.DidCrit() {
// Subtract Crits because they happen before Blocks
spell.SpellMetrics[result.Target.UnitIndex].Crits--
spell.SpellMetrics[result.Target.UnitIndex].CritBlocks++
} else if result.DidGlance() {
// Subtract Glances because they happen before Blocks
spell.SpellMetrics[result.Target.UnitIndex].Glances--
spell.SpellMetrics[result.Target.UnitIndex].GlanceBlocks++
} else {
spell.SpellMetrics[result.Target.UnitIndex].Blocks++
}
Expand Down
Loading
Loading