Skip to content

Commit 586409b

Browse files
committed
Added a method StatusEffect.add.
1 parent 20f5b5c commit 586409b

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

simalq/main.hy

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@
107107
(.damage G.player G.rules.poison-emitter-damage DamageType.Poison)))
108108

109109
; Tick down status effects.
110-
(for [se (list G.player.status-effects)]
111-
(when (get G.player.status-effects se)
112-
(-= (get G.player.status-effects se) 1)))
110+
(for [se StatusEffect]
111+
(when (.player-has? se)
112+
(.add se -1)))
113113

114114
; Tick down the time limit.
115115
(when G.time-left

simalq/tile/item.hy

+5-8
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,14 @@
249249
250250
(defmeth pick-up []
251251
(doc (@help))
252-
(+=
253-
(get G.player.status-effects
254-
(getattr StatusEffect (str @effect)))
255-
@duration)))
252+
(.add @effect @duration)))
256253
257254
(deftile "! " "an amulet of invulnerability" StatusEffectItem
258255
:color 'dark-yellow
259256
:iq-ix 26
260257
:acquirement-points 100
261258
262-
:effect 'Ivln
259+
:effect StatusEffect.Ivln
263260
:duration 20
264261
265262
:help (meth []
@@ -271,7 +268,7 @@
271268
:iq-ix 151
272269
:acquirement-points 150
273270
274-
:effect 'Pass
271+
:effect StatusEffect.Pass
275272
:duration 20
276273
277274
:help (meth []
@@ -283,7 +280,7 @@
283280
:iq-ix 34
284281
:acquirement-points 100
285282
286-
:effect 'Fast
283+
:effect StatusEffect.Fast
287284
:duration 10
288285
289286
:help (meth []
@@ -295,7 +292,7 @@
295292
:iq-ix 25
296293
:acquirement-points 100
297294
298-
:effect 'Ivis
295+
:effect StatusEffect.Ivis
299296
:duration 25
300297
301298
:help (meth []

simalq/tile/scenery.hy

+2-4
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,7 @@
705705
706706
:hook-player-walked-into (meth []
707707
(doc f"Paralyzes you for {G.rules.paralysis-duration} turns. While you're paralyzed, waiting is the only action you can take.")
708-
(+= (get G.player.status-effects StatusEffect.Para)
709-
G.rules.paralysis-duration))
708+
(.add StatusEffect.Para G.rules.paralysis-duration))
710709
711710
:flavor "A magical field that causes you to vividly remember something embarrassing that you did as a teenager, forcing you to briefly freeze in horror. The problem with being royalty is that awkward adolescent moments all too easily become international incidents.")
712711
@@ -717,8 +716,7 @@
717716
:blocks-move F :blocks-monster T
718717
:hook-player-walked-into (meth []
719718
(doc f"The tile is destroyed, but you're paralyzed for {G.rules.paralysis-duration} turns.")
720-
(+= (get G.player.status-effects StatusEffect.Para)
721-
G.rules.paralysis-duration)
719+
(.add StatusEffect.Para G.rules.paralysis-duration)
722720
(@rm-from-map))
723721
724722
:flavor "This spiderweb is the size of a really big spiderweb. Until Idok cleans up the dungeon properly, you'll have to tediously carve your way through the webs with your sword. Got any recommendations for a good smitemaster?")

simalq/util.hy

+3
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@
139139
"Does the player have this status effect?"
140140
(bool (get G.player.status-effects @)))
141141

142+
(defmeth add [duration]
143+
(+= (get G.player.status-effects @) duration))
144+
142145
(defmeth bad? []
143146
(in @ [StatusEffect.Para StatusEffect.Weak])))
144147

0 commit comments

Comments
 (0)