Cleanup, think about removing creature "hammer"

This commit is contained in:
2024-09-22 10:47:47 +01:00
parent 80e5c69489
commit efd3e17cbf
6 changed files with 132 additions and 122 deletions
+8 -1
View File
@@ -1,9 +1,16 @@
module Dodge.Cuse where
import Dodge.Inventory
import Control.Lens
import Dodge.Data.World
import Data.Maybe
useC :: Cuse -> Item -> Creature -> World -> World
useC cu = case cu of
useC cu itm cr = fromMaybe id $ do
i <- itm ^? itLocation . ipInvID
return $ rmInvItem (_crID cr) i . useC' cu itm cr
useC' :: Cuse -> Item -> Creature -> World -> World
useC' cu = case cu of
CDoNothing -> const $ const id
CHeal x -> const $ \cr -> cWorld . lWorld . creatures . ix (_crID cr) . crHP +~ x