Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+13 -14
View File
@@ -1,27 +1,26 @@
module Dodge.Item.Consumable where
import Dodge.Data
--import Dodge.Picture.Layer
import Control.Lens
import Dodge.Data.World
import Dodge.Default
import Dodge.SoundLogic
--import Shape
--import ShapePicture
--import Dodge.Item.Draw
--import Picture
--import Data.Maybe
import Control.Lens
import qualified IntMapHelp as IM
medkit :: Int -> Item
medkit i = defaultConsumable
& itUse . cUse .~ CHeal i
& itType . iyBase .~ Consumable (MEDKIT i)
medkit i =
defaultConsumable
& itUse . cUse .~ CHeal i
& itType . iyBase .~ Consumable (MEDKIT i)
heal25 :: Int -> World -> Maybe World
heal25 = heal 25
heal :: Int -> Int -> World -> Maybe World
heal hp n w | _crHP (_creatures (_cWorld w) IM.! n) >= 10000 = Nothing
| otherwise = Just $ soundStart (CrSound $ _crID cr) (_crPos cr) healS Nothing w
heal hp n w
| _crHP (_creatures (_cWorld w) IM.! n) >= 10000 = Nothing
| otherwise =
Just $
soundStart (CrSound $ _crID cr) (_crPos cr) healS Nothing w
& cWorld . creatures . ix n . crHP %~ min 10000 . (+ hp)
where
cr = _creatures (_cWorld w) IM.! n