diff --git a/vwowrla.core/src/vwowrla/core/encounters/analysis.clj b/vwowrla.core/src/vwowrla/core/encounters/analysis.clj index bd9155f..c859c9a 100644 --- a/vwowrla.core/src/vwowrla/core/encounters/analysis.clj +++ b/vwowrla.core/src/vwowrla/core/encounters/analysis.clj @@ -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 diff --git a/vwowrla.core/src/vwowrla/core/encounters/detection.clj b/vwowrla.core/src/vwowrla/core/encounters/detection.clj index 8df4a12..d5b4c85 100644 --- a/vwowrla.core/src/vwowrla/core/encounters/detection.clj +++ b/vwowrla.core/src/vwowrla/core/encounters/detection.clj @@ -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)