-
Notifications
You must be signed in to change notification settings - Fork 16
/
graph.vue
80 lines (67 loc) · 1.58 KB
/
graph.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<template>
<div :class="[
'c-details-graph',
type, {
empty: total === 0
}
]">
<span
v-for="(v, index) in values"
v-if="v > 0"
:class="[ 'piece', 'p' + index ]"
:style="{ 'flex-grow': v }"></span>
</div>
</template>
<script>
export default {
props: {
type: { type: String, default: 'dps-crit' },
combatant: { type: Object, required: true }
},
computed: {
total() {
return this.values.reduce((p, c) => p + (c || 0), 0)
},
values() {
const c = this.combatant
if(this.type === 'dps-crit') {
return [
(c.swings - c.ch - c.dh - c.cdh),
c.dh,
c.ch,
c.cdh
]
} else if(this.type === 'healer-pct') {
return [
// WARN: SHIELD ESTIMATION
// amount of shield 'created' counted, regardness of it was effective or not
c.shield,
// c.healed - (total of all other graphed values)
(c.healed - c.minion_total - (c.oh + c.minion_over)),
// TODO: this could jump through under zero, possibly merging problem?
c.minion_total - c.minion_over,
c.minion_over,
c.oh - c.minion_over // TODO confirm
]
} else return []
}
}
}
</script>
<style lang="sass">
.c-details-graph
display: flex
align-items: stretch
justify-content: center
height: $details-row-height * 0.5
> .piece
min-width: 1px
&.zero
display: none
+ .piece
margin-left: $_1px
&:first-of-type
margin-left: 0
&.empty .piece
min-width: 0
</style>