Skip to content

Commit 43a5bf0

Browse files
committed
Implemented wands of flame.
1 parent 3d1ff15 commit 43a5bf0

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

simalq/tile/item.hy

+19-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
:flavor "Technically magical, but not terribly useful.")
343343
344344
(deftile "/ " "a wand of shielding" Usable
345-
:color 'orange
345+
:color 'dark-orange
346346
:iq-ix 200
347347
:acquirement-points 100
348348
@@ -412,6 +412,24 @@
412412
413413
:flavor "This fell device vibrates with the barely contained energies of Hades as they hunger for the souls of the living. Aim carefully.")
414414
415+
(deftile "/ " "a wand of flame" Usable
416+
:color 'orange
417+
:iq-ix 154
418+
:acquirement-points 100
419+
420+
:!mon-damage #(2 1 1)
421+
:use (meth [target]
422+
(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.")
423+
(for [
424+
pos (burst-damage target :damage-type DamageType.Fire
425+
:amount @mon-damage
426+
:color 'orange)
427+
tile (list (at pos))
428+
:if (= tile.stem "web")]
429+
(.rm-from-map tile)))
430+
431+
:flavor "Clean out the cobwebs and have yourself some barbecued goblin.")
432+
415433
416434
(defclass FireBomb [Usable]
417435
(setv

simalq/tile/unimplemented.hy

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
[132 "golem"]
3333
[134 "siren"]
3434
[152 "random_gate"]
35-
[154 "wand_of_flame"]
3635
[158 "ring_of_protection"]
3736
[159 "amulet_of_poisonous_touch"]
3837
[164 "cyclops"]

tests/test_item.hy

+21
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,27 @@
488488
(assert (= G.score (+ (* 12 hp) 10 (* 3 hp) (* 4 hp) (* 5 hp)))))
489489

490490

491+
(defn test-wand-flame []
492+
(init [
493+
:height 1
494+
:tiles ["wall" ["orc" :hp 10] ["orc" :hp 10] "web" "wall" ["orc" :hp 10]]])
495+
496+
(assert (= G.player.hp 100))
497+
(use-item "wand of flame" 3 0)
498+
; The player is unhurt.
499+
(assert (= G.player.hp 100))
500+
; Orc 1 takes 1 damage.
501+
(assert-hp [2 0] 9)
502+
; Orc 2 takes 2 damage.
503+
(assert-hp [3 0] 8)
504+
; The web is destroyed.
505+
(assert-at [4 0] 'floor)
506+
; The wall is unaffected.
507+
(assert-at [5 0] "wall")
508+
; Orc 3 is out of range and undamaged.
509+
(assert-hp [6 0] 10))
510+
511+
491512
(defn test-fire-bomb []
492513
"Put some orcs in a line and check how much damage is done to each."
493514

0 commit comments

Comments
 (0)