begin adding healing event handling

This commit is contained in:
Gered 2016-04-05 18:51:04 -04:00
parent 7eddf36e16
commit 2832cecd9e
3 changed files with 34 additions and 3 deletions

View file

@ -259,6 +259,15 @@
(update-entity-damage-stats :in target-name damage-properties timestamp)
(update-entity-damage-stats :out source-name damage-properties timestamp)))
(s/defn process-source-to-target-healing :- Encounter
[source-name :- s/Str
target-name :- s/Str
{:keys [skill]
:as heal-properties} :- HealProperties
timestamp :- Date
encounter :- Encounter]
encounter)
(s/defn process-entity-death :- Encounter
[entity-name :- s/Str
timestamp :- Date

View file

@ -122,12 +122,30 @@
(s/defmethod handle-event :skill-heals-target :- Encounter
[{:keys [source-name skill crit? target-name amount timestamp]} :- CombatEvent
encounter :- Encounter]
encounter)
(analysis/process-source-to-target-healing
source-name
target-name
{:skill skill
:actual-skill? true
:amount amount
:crit? crit?}
timestamp
encounter))
(s/defmethod handle-event :resource-gained :- Encounter
[{:keys [target-name amount resource-type source-name skill timestamp]} :- CombatEvent
encounter :- Encounter]
encounter)
(condp = resource-type
:health (analysis/process-source-to-target-healing
source-name
target-name
{:skill skill
;:actual-skill? true ; TODO: this is not always true. e.g. if a potion is used (how to determine this?)
:amount amount
:crit? false}
timestamp
encounter)
encounter))
(s/defmethod handle-event :resource-lost :- Encounter
[{:keys [target-name amount resource-type source-name skill timestamp]} :- CombatEvent

View file

@ -93,4 +93,8 @@
; TODO
(def DamageProperties
{s/Any s/Any})
{s/Any s/Any})
; TODO
(def HealProperties
{s/Any s/Any})