fix kill count tracking in encounter end detection

previous method was including entity resurrections in it's kill count
tracking which was incorrect and really ended up being a function to see
if the given entity was currently alive or not... not useful for
encounter end detection at all based on how we define the rules for them
This commit is contained in:
Gered 2016-04-06 16:37:52 -04:00
parent 5087460cca
commit 418d9c67e2
2 changed files with 13 additions and 2 deletions

View file

@ -144,6 +144,9 @@
(finalize-entities))))
(s/defn count-currently-dead :- s/Num
"returns the number of dead entities by the given name. this takes into account any
resurrections that the entity may have received after prior deaths to attempt to
determine the current proper entity state (alive or dead)"
[encounter :- Encounter
entity-name :- s/Str]
(if-let [entity (get-in encounter [:entities entity-name])]
@ -152,6 +155,14 @@
(- num-deaths num-resurrects))
0))
(s/defn count-deaths :- s/Num
"returns the number of times the given entity died during the encounter."
[encounter :- Encounter
entity-name :- s/Str]
(if-let [entity (get-in encounter [:entities entity-name])]
(count (:deaths entity))
0))
;; damage
(s/defn update-damage-averages :- DamageStatistics

View file

@ -4,7 +4,7 @@
(:require
[clojure.tools.logging :refer [info warn error]]
[schema.core :as s]
[vwowrla.core.encounters.analysis :refer [count-currently-dead get-entity-last-activity]])
[vwowrla.core.encounters.analysis :refer [count-deaths get-entity-last-activity]])
(:use
vwowrla.core.encounters.core
vwowrla.core.schemas
@ -114,7 +114,7 @@
; if there is no entity count specified then there is no specific
; kill requirement of this entity for the encounter to end
(if-not (nil? count)
(let [count-dead (count-currently-dead encounter entity-name)]
(let [count-dead (count-deaths encounter entity-name)]
(>= count-dead count))
true))
trigger-entites)