calculate encounter-wide damage stats sorted by damage in/out
This commit is contained in:
parent
fcaf4cc87a
commit
2492919f9e
|
@ -225,13 +225,19 @@
|
||||||
[encounter :- Encounter
|
[encounter :- Encounter
|
||||||
source-entity-name :- s/Str
|
source-entity-name :- s/Str
|
||||||
target-entity-name :- s/Str
|
target-entity-name :- s/Str
|
||||||
{:keys [skill]
|
{:keys [skill damage damage-type]
|
||||||
:as damage-properties} :- DamageProperties
|
:as damage-properties} :- DamageProperties
|
||||||
timestamp :- Date]
|
timestamp :- Date]
|
||||||
(let [k {:source source-entity-name
|
(let [k {:source source-entity-name
|
||||||
:target target-entity-name
|
:target target-entity-name
|
||||||
:skill skill}]
|
:skill skill}
|
||||||
(update-in encounter [:damage k] #(update-damage-statistics % damage-properties))))
|
; if the target is an enemy, then this damage is "out" (as in, outgoing damage from the raid)
|
||||||
|
in-or-out (if (enemy-entity? target-entity-name) :out :in)]
|
||||||
|
(-> encounter
|
||||||
|
(update-in [:damage in-or-out :total] #(if damage (+ (or % 0) damage) %))
|
||||||
|
(update-in [:damage in-or-out :totals-by-type damage-type] #(if damage (+ (or % 0) damage) %))
|
||||||
|
(update-in [:damage in-or-out skill] #(update-damage-statistics % damage-properties))
|
||||||
|
(update-in [:damage k] #(update-damage-statistics % damage-properties)))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; main combat log entry processing entry points
|
;;; main combat log entry processing entry points
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
(ns vwowrla.core.encounters.core
|
(ns vwowrla.core.encounters.core
|
||||||
(:require
|
(:require
|
||||||
|
[clojure.string :as string]
|
||||||
[schema.core :as s])
|
[schema.core :as s])
|
||||||
(:use
|
(:use
|
||||||
vwowrla.core.schemas
|
vwowrla.core.schemas
|
||||||
|
@ -12,6 +13,12 @@
|
||||||
(def non-combat-starting-auras (get-text-resource-as-lines "non_combat_starting_auras.txt"))
|
(def non-combat-starting-auras (get-text-resource-as-lines "non_combat_starting_auras.txt"))
|
||||||
(def non-combat-starting-skills (get-text-resource-as-lines "non_combat_starting_skills.txt"))
|
(def non-combat-starting-skills (get-text-resource-as-lines "non_combat_starting_skills.txt"))
|
||||||
|
|
||||||
|
(s/defn enemy-entity? :- s/Bool
|
||||||
|
"returns true if the given entity name is a known enemy entity"
|
||||||
|
[entity-name :- (s/maybe s/Str)]
|
||||||
|
(if-not (string/blank? entity-name)
|
||||||
|
(contained-in? entity-name enemy-entity-names)))
|
||||||
|
|
||||||
(s/defn find-defined-encounter-name :- (s/maybe s/Str)
|
(s/defn find-defined-encounter-name :- (s/maybe s/Str)
|
||||||
"returns the name of a defined encounter which includes the given entity in it's
|
"returns the name of a defined encounter which includes the given entity in it's
|
||||||
list of encounter entities. returns nil if there is no encounter which includes the
|
list of encounter entities. returns nil if there is no encounter which includes the
|
||||||
|
|
Reference in a new issue