From 82795d9e5aecbcb5b87a1b1ec0af3a3d0c9e1805 Mon Sep 17 00:00:00 2001 From: gered Date: Wed, 9 Mar 2016 13:20:24 -0500 Subject: [PATCH] move old encounter "trigger-on-x?" flags under a :triggers key --- vwowrla.core/resources/encounters.edn | 22 +++++++++---------- .../src/vwowrla/core/encounters/detection.clj | 18 +++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/vwowrla.core/resources/encounters.edn b/vwowrla.core/resources/encounters.edn index 673c7d1..61c4b76 100644 --- a/vwowrla.core/resources/encounters.edn +++ b/vwowrla.core/resources/encounters.edn @@ -22,18 +22,18 @@ "Golemagg the Incinerator" {:entities {"Golemagg the Incinerator" {:count 1} "Core Rager" {}}} - "Majordomo Executus" {:entities {"Majordomo Executus" {:ignore-interactions-with ["Ragnaros"] - :ignore-skills ["Summon Ragnaros"]} - "Flamewaker Healer" {:count 4} - "Flamewaker Elite" {:count 4}} - :trigger-on-damage? true - :trigger-on-debuff? true} + "Majordomo Executus" {:entities {"Majordomo Executus" {:ignore-interactions-with ["Ragnaros"] + :ignore-skills ["Summon Ragnaros"]} + "Flamewaker Healer" {:count 4} + "Flamewaker Elite" {:count 4}} + :triggers {:on-damage? true + :on-debuff? true}} - "Ragnaros" {:entities {"Ragnaros" {:count 1 - :ignore-interactions-with ["Majordomo Executus"]} - "Son of Flame" {:cannot-trigger? true}} - :trigger-on-damage? true - :trigger-on-debuff? true} + "Ragnaros" {:entities {"Ragnaros" {:count 1 + :ignore-interactions-with ["Majordomo Executus"]} + "Son of Flame" {:cannot-trigger? true}} + :triggers {:on-damage? true + :on-debuff? true}} diff --git a/vwowrla.core/src/vwowrla/core/encounters/detection.clj b/vwowrla.core/src/vwowrla/core/encounters/detection.clj index 5f89364..8df4a12 100644 --- a/vwowrla.core/src/vwowrla/core/encounters/detection.clj +++ b/vwowrla.core/src/vwowrla/core/encounters/detection.clj @@ -76,7 +76,8 @@ (not (contained-in? skill non-combat-starting-skills))) ; now look at individual encounter-specific criteria for whether this combat event ; can trigger the encounter or not - (let [encounter (get defined-encounters encounter-name)] + (let [encounter (get defined-encounters encounter-name) + triggers (:triggers encounter)] (cond (ignored-encounter-entity-interaction-event? encounter event) nil @@ -86,15 +87,14 @@ ; if ANY of these are defined, then their criteria MUST pass to ; trigger an encounter - (or (:trigger-on-damage? encounter) - (:trigger-on-aura? encounter) - (:trigger-on-buff? encounter) - (:trigger-on-debuff? encounter)) + triggers (cond - (and (:trigger-on-damage? encounter) damage) encounter-name - (and (:trigger-on-aura? encounter) aura-name) encounter-name - (and (:trigger-on-buff? encounter) (= :buff type)) encounter-name - (and (:trigger-on-debuff? encounter) (= :debuff type)) encounter-name) + (and (:on-damage? triggers) damage) encounter-name + (and (:on-aura? triggers) aura-name) encounter-name + (and (:on-buff? triggers) (= :buff type)) encounter-name + (and (:on-debuff? triggers) (= :debuff type)) encounter-name + ; this is also default behaviour if triggers aren't specified + (:on-anything? triggers) encounter-name) :else encounter-name)))))