From 43a5bf012b09eb10a830348bf9847d6d218e13df Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Thu, 1 Feb 2024 14:51:31 -0500 Subject: [PATCH] Implemented wands of flame. --- simalq/tile/item.hy | 20 +++++++++++++++++++- simalq/tile/unimplemented.hy | 1 - tests/test_item.hy | 21 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/simalq/tile/item.hy b/simalq/tile/item.hy index d017cc0..fbfddb1 100644 --- a/simalq/tile/item.hy +++ b/simalq/tile/item.hy @@ -342,7 +342,7 @@ :flavor "Technically magical, but not terribly useful.") (deftile "/ " "a wand of shielding" Usable - :color 'orange + :color 'dark-orange :iq-ix 200 :acquirement-points 100 @@ -412,6 +412,24 @@ :flavor "This fell device vibrates with the barely contained energies of Hades as they hunger for the souls of the living. Aim carefully.") +(deftile "/ " "a wand of flame" Usable + :color 'orange + :iq-ix 154 + :acquirement-points 100 + + :!mon-damage #(2 1 1) + :use (meth [target] + (doc f"Does {(get @mon-damage 1)} fire damage to all monsters in a size-{(- (len @mon-damage) 1)} burst, except at the center square, where they take {(get @mon-damage 0)} fire damage. Futhermore, all webs in the burst are destroyed. You take no damage.") + (for [ + pos (burst-damage target :damage-type DamageType.Fire + :amount @mon-damage + :color 'orange) + tile (list (at pos)) + :if (= tile.stem "web")] + (.rm-from-map tile))) + + :flavor "Clean out the cobwebs and have yourself some barbecued goblin.") + (defclass FireBomb [Usable] (setv diff --git a/simalq/tile/unimplemented.hy b/simalq/tile/unimplemented.hy index 3e3d3dc..4d7a314 100644 --- a/simalq/tile/unimplemented.hy +++ b/simalq/tile/unimplemented.hy @@ -32,7 +32,6 @@ [132 "golem"] [134 "siren"] [152 "random_gate"] - [154 "wand_of_flame"] [158 "ring_of_protection"] [159 "amulet_of_poisonous_touch"] [164 "cyclops"] diff --git a/tests/test_item.hy b/tests/test_item.hy index 8427d95..6510c3c 100644 --- a/tests/test_item.hy +++ b/tests/test_item.hy @@ -488,6 +488,27 @@ (assert (= G.score (+ (* 12 hp) 10 (* 3 hp) (* 4 hp) (* 5 hp))))) +(defn test-wand-flame [] + (init [ + :height 1 + :tiles ["wall" ["orc" :hp 10] ["orc" :hp 10] "web" "wall" ["orc" :hp 10]]]) + + (assert (= G.player.hp 100)) + (use-item "wand of flame" 3 0) + ; The player is unhurt. + (assert (= G.player.hp 100)) + ; Orc 1 takes 1 damage. + (assert-hp [2 0] 9) + ; Orc 2 takes 2 damage. + (assert-hp [3 0] 8) + ; The web is destroyed. + (assert-at [4 0] 'floor) + ; The wall is unaffected. + (assert-at [5 0] "wall") + ; Orc 3 is out of range and undamaged. + (assert-hp [6 0] 10)) + + (defn test-fire-bomb [] "Put some orcs in a line and check how much damage is done to each."