refactor: pass creature to weapon use function, as opposed to just id

This commit is contained in:
2021-05-23 22:07:46 +02:00
parent 3ae454acf4
commit cda035b1d1
11 changed files with 235 additions and 219 deletions
+6 -4
View File
@@ -32,14 +32,16 @@ decCharMode
decCharMode i = creatures . ix 0 . crInv . ix i . itAttachment . _Just %~ decCharMode'
charFiringStrat
:: [(Char, Int -> World -> World)] -- ^ Different firing effects for different characters
-> Int -- ^ Creature id
:: [(Char, Creature -> World -> World)] -- ^ Different firing effects for different characters
-> Creature -- ^ Creature id
-> World
-> World
charFiringStrat strats cid w = case w ^? creatures . ix cid . crInv
charFiringStrat strats cr w = case w ^? creatures . ix cid . crInv
. ix (_crInvSel $ _creatures w IM.! cid) . itAttachment . _Just . itCharMode of
Just (c :<| _) -> fromJust (Prelude.lookup c strats) cid w
Just (c :<| _) -> fromJust (Prelude.lookup c strats) cr w
_ -> w
where
cid = _crID cr
increaseFuse
:: Int -- ^ Old fuse time