Skip to content

Commit

Permalink
Added a method StatusEffect.add.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodiologist committed Jan 26, 2024
1 parent 20f5b5c commit 586409b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
6 changes: 3 additions & 3 deletions simalq/main.hy
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@
(.damage G.player G.rules.poison-emitter-damage DamageType.Poison)))

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

; Tick down the time limit.
(when G.time-left
Expand Down
13 changes: 5 additions & 8 deletions simalq/tile/item.hy
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,14 @@
(defmeth pick-up []
(doc (@help))
(+=
(get G.player.status-effects
(getattr StatusEffect (str @effect)))
@duration)))
(.add @effect @duration)))
(deftile "! " "an amulet of invulnerability" StatusEffectItem
:color 'dark-yellow
:iq-ix 26
:acquirement-points 100
:effect 'Ivln
:effect StatusEffect.Ivln
:duration 20
:help (meth []
Expand All @@ -271,7 +268,7 @@
:iq-ix 151
:acquirement-points 150
:effect 'Pass
:effect StatusEffect.Pass
:duration 20
:help (meth []
Expand All @@ -283,7 +280,7 @@
:iq-ix 34
:acquirement-points 100
:effect 'Fast
:effect StatusEffect.Fast
:duration 10
:help (meth []
Expand All @@ -295,7 +292,7 @@
:iq-ix 25
:acquirement-points 100
:effect 'Ivis
:effect StatusEffect.Ivis
:duration 25
:help (meth []
Expand Down
6 changes: 2 additions & 4 deletions simalq/tile/scenery.hy
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,7 @@
:hook-player-walked-into (meth []
(doc f"Paralyzes you for {G.rules.paralysis-duration} turns. While you're paralyzed, waiting is the only action you can take.")
(+= (get G.player.status-effects StatusEffect.Para)
G.rules.paralysis-duration))
(.add StatusEffect.Para G.rules.paralysis-duration))
: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.")
Expand All @@ -717,8 +716,7 @@
:blocks-move F :blocks-monster T
:hook-player-walked-into (meth []
(doc f"The tile is destroyed, but you're paralyzed for {G.rules.paralysis-duration} turns.")
(+= (get G.player.status-effects StatusEffect.Para)
G.rules.paralysis-duration)
(.add StatusEffect.Para G.rules.paralysis-duration)
(@rm-from-map))
: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?")
Expand Down
3 changes: 3 additions & 0 deletions simalq/util.hy
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
"Does the player have this status effect?"
(bool (get G.player.status-effects @)))

(defmeth add [duration]
(+= (get G.player.status-effects @) duration))

(defmeth bad? []
(in @ [StatusEffect.Para StatusEffect.Weak])))

Expand Down

0 comments on commit 586409b

Please sign in to comment.