|
137 | 137 |
|
138 | 138 |
|
139 | 139 | (defn test-food-shoot []
|
| 140 | + "We also test poison-gas bombs here, because they have the same |
| 141 | + effect when used as a jar of poison does when shot." |
| 142 | + |
140 | 143 | (init [
|
141 |
| - :map " |
142 |
| - @ % ☠ ██o o |
143 |
| - ████##██G ██ |
144 |
| - ████o ██████" |
145 |
| - :map-marks { |
146 |
| - "% " "snack" |
147 |
| - "☠ " "jar of poison" |
148 |
| - "##" ["cracked wall" :hp 2] |
149 |
| - "o " ["orc" :hp 4]}]) |
| 144 | + :tiles ["snack"]]) |
150 | 145 | ; Shooting a snack (or most other foods) just destroys it.
|
151 | 146 | (assert-at 'E "snack")
|
152 | 147 | (shoot 'E)
|
153 | 148 | (assert-at 'E 'floor)
|
154 |
| - ; Shooting a jar of poison creates a 5 × 5 cloud of poison, which |
155 |
| - ; can damage both the player and monsters. It goes through walls. |
156 |
| - (wk 'E) |
157 |
| - (assert-at 'E "jar of poison") |
158 |
| - (assert (= G.player.hp 100)) |
159 |
| - (shoot 'E) |
160 |
| - (assert-at 'E 'floor) |
161 |
| - ; The player takes 20 damage. |
162 |
| - (assert (= G.player.hp 80)) |
163 |
| - ; The two orcs in the blast radius take 3 damage each. |
164 |
| - (assert-hp [2 0] 1) |
165 |
| - (assert-hp [4 2] 1) |
166 |
| - ; The ghost, being undead, takes no damage from poison. |
167 |
| - (assert-hp [4 1] 1) |
168 |
| - ; Cracked walls are also immune to poison. |
169 |
| - (assert-hp [2 1] 2) |
170 |
| - ; The third orc is outside of the blast radius. |
171 |
| - (assert-hp [5 2] 4) |
172 |
| - ; Points are earned for all damage dealt. |
173 |
| - (assert (= G.score (py "3*3 + 3*3")))) |
| 149 | + |
| 150 | + (for [use-bomb? [F T]] |
| 151 | + (init [ |
| 152 | + :map " |
| 153 | + @ ☠ ██o o |
| 154 | + ██##██G ██ |
| 155 | + ██o ██████" |
| 156 | + :map-marks { |
| 157 | + "☠ " "jar of poison" |
| 158 | + "##" ["cracked wall" :hp 2] |
| 159 | + "o " ["orc" :hp 4]}]) |
| 160 | + ; Shooting a jar of poison (or using a poison-gas bomb) creates a |
| 161 | + ; 5 × 5 cloud of poison, which can damage both the player and |
| 162 | + ; monsters. It goes through walls. |
| 163 | + (assert-at 'E "jar of poison") |
| 164 | + (assert (= G.player.hp 100)) |
| 165 | + (if use-bomb? |
| 166 | + (use-item "poison-gas bomb" 1 2) |
| 167 | + (shoot 'E)) |
| 168 | + (assert-at 'E (if use-bomb? "jar of poison" 'floor)) |
| 169 | + ; The player takes 20 damage. |
| 170 | + (assert (= G.player.hp 80)) |
| 171 | + ; The two orcs in the blast radius take 3 damage each. |
| 172 | + (assert-hp [1 0] 1) |
| 173 | + (assert-hp [3 2] 1) |
| 174 | + ; The ghost, being undead, takes no damage from poison. |
| 175 | + (assert-hp [3 1] 1) |
| 176 | + ; Cracked walls are also immune to poison. |
| 177 | + (assert-hp [1 1] 2) |
| 178 | + ; The third orc is outside of the blast radius. |
| 179 | + (assert-hp [4 2] 4) |
| 180 | + ; Points are earned for all damage dealt. |
| 181 | + (assert (= G.score (py "3*3 + 3*3"))))) |
174 | 182 |
|
175 | 183 |
|
176 | 184 | (defn test-amulet-of-invulnerability []
|
|
0 commit comments