This commit is contained in:
2022-05-21 21:53:49 +01:00
parent e9cc7e64c9
commit f555a4bf05
12 changed files with 32 additions and 31 deletions
+2 -2
View File
@@ -61,7 +61,7 @@ armourChaseCrit = chaseCrit
] ]
, _crMvType = defaultChaseMvType {_mvTurnRad = f} , _crMvType = defaultChaseMvType {_mvTurnRad = f}
} }
& crEquipment . at OnChest .~ Just 0 & crEquipment . at OnChest ?~ 0
& crInvEquipped . at 0 .~ Just OnChest & crInvEquipped . at 0 ?~ OnChest
where where
f _ = 0.05 f _ = 0.05
+2 -2
View File
@@ -48,8 +48,8 @@ toggleEquipmentAt invid itm cr = case cr ^? crInvEquipped . ix invid of
equipUsingSite :: Int -> Item -> Creature -> Creature equipUsingSite :: Int -> Item -> Creature -> Creature
equipUsingSite invid itm cr = cr equipUsingSite invid itm cr = cr
& crInvEquipped . at invid .~ Just epos & crInvEquipped . at invid ?~ epos
& crEquipment . at epos .~ Just invid & crEquipment . at epos ?~ invid
& removeOtherEquipment & removeOtherEquipment
where where
epos = eqSiteToPos cr (_eqSite $ _itUse itm) epos = eqSiteToPos cr (_eqSite $ _itUse itm)
+2 -4
View File
@@ -261,11 +261,9 @@ light4 = light . light . light . light
drawEquipment :: Creature -> SPic drawEquipment :: Creature -> SPic
{-# INLINE drawEquipment #-} {-# INLINE drawEquipment #-}
drawEquipment cr = mconcat $ map f $ IM.toList (_crInv cr) drawEquipment cr = foldMap f (_crInv cr)
where where
f (i,it) = case it ^? itEquipPict of f itm = _itEquipPict itm cr itm
Just g -> g cr i
_ -> emptyBlank
circLine :: Float -> Picture circLine :: Float -> Picture
circLine x = line [V2 0 0,V2 x 0] circLine x = line [V2 0 0,V2 x 0]
+1 -1
View File
@@ -420,7 +420,7 @@ data Item = Item
{ _itName :: String { _itName :: String
, _itConsumption :: ItemConsumption , _itConsumption :: ItemConsumption
, _itUse :: ItemUse , _itUse :: ItemUse
, _itEquipPict :: Creature -> Int -> SPic , _itEquipPict :: Creature -> Item -> SPic
, _itScroll :: Float -> Creature -> Item -> Item , _itScroll :: Float -> Creature -> Item -> Item
, _itType :: CombineType , _itType :: CombineType
, _itAttachment :: ItAttachment , _itAttachment :: ItAttachment
+15 -12
View File
@@ -11,11 +11,11 @@ import Control.Lens
import Data.Maybe import Data.Maybe
pictureWeaponOnAim pictureWeaponOnAim
:: Creature :: Creature
-> Int -- ^ Position of item in inventory -> Item
-> SPic -> SPic
pictureWeaponOnAim cr i = pictureWeaponOnAimItem (itSPic it) cr i pictureWeaponOnAim cr itm = case _itInvPos itm of
where Just i -> pictureWeaponOnAimItem (itSPic itm) cr i
it = _crInv cr IM.! i Nothing -> mempty
itSPic :: Item -> SPic itSPic :: Item -> SPic
itSPic it = _dimSPic (_itDimension it) it itSPic it = _dimSPic (_itDimension it) it
@@ -23,11 +23,14 @@ itSPic it = _dimSPic (_itDimension it) it
pictureWeaponAim pictureWeaponAim
:: (Item -> SPic) :: (Item -> SPic)
-> Creature -> Creature
-> Int -- ^ Position of item in inventory -> Item -- ^ Position of item in inventory
-> SPic -> SPic
pictureWeaponAim f cr i = pictureWeaponOnAimItem pic cr i pictureWeaponAim = const
where --pictureWeaponAim f cr itm = pictureWeaponOnAimItem pic cr i
pic = f (_crInv cr IM.! i) -- where
-- pic = f itm
-- i = fromJust $ _itInvPos itm
--pic = f (_crInv cr IM.! i)
{- | Places an item picture onto a creature when the item is selected. -} {- | Places an item picture onto a creature when the item is selected. -}
pictureWeaponOnAimItem pictureWeaponOnAimItem
@@ -84,10 +87,10 @@ twoFlatHRot cr = 2*strideRot cr
pictureItem pictureItem
:: SPic :: SPic
-> Creature -> Creature
-> Int -- ^ Position of item in inventory -> Item -- ^ Position of item in inventory
-> SPic -> SPic
pictureItem p cr posInInv pictureItem p cr itm = case _itInvPos itm of
| _crInvSel cr == posInInv = drawnWep Just posInInv | _crInvSel cr == posInInv -> drawnWep
| otherwise = emptyBlank _ -> emptyBlank
where where
drawnWep = translateSPf (_crRad cr) 0 p drawnWep = translateSPf (_crRad cr) 0 p
+4 -4
View File
@@ -65,10 +65,10 @@ frontArmour = defaultEquipment
, _itEffect = NoItEffect , _itEffect = NoItEffect
, _itID = Nothing , _itID = Nothing
} }
pictureOnEquip :: SPic -> Creature -> Int -> SPic pictureOnEquip :: SPic -> Creature -> Item -> SPic
pictureOnEquip sp cr i pictureOnEquip sp cr itm = case _itInvPos itm of
| isJust (cr ^? crInvEquipped . ix i) = sp Just i | isJust (cr ^? crInvEquipped . ix i) -> sp
| otherwise = mempty _ -> mempty
flatShield :: Item flatShield :: Item
flatShield = defaultEquipment flatShield = defaultEquipment
+1 -1
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-} --{-# LANGUAGE TupleSections #-}
module Dodge.LockAndKey where module Dodge.LockAndKey where
import Dodge.Data import Dodge.Data
import Dodge.Tree import Dodge.Tree
+1 -1
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-} --{-# LANGUAGE TupleSections #-}
module Dodge.Room.Containing where module Dodge.Room.Containing where
import Dodge.Data import Dodge.Data
import Dodge.Tree import Dodge.Tree
+1 -1
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-} --{-# LANGUAGE TupleSections #-}
module Dodge.Room.LasTurret where module Dodge.Room.LasTurret where
import Dodge.LevelGen.Data import Dodge.LevelGen.Data
import Dodge.PlacementSpot import Dodge.PlacementSpot
+1 -1
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-} --{-# LANGUAGE TupleSections #-}
{- | Rooms containing long doors, probably with a big reveal behind them. {- | Rooms containing long doors, probably with a big reveal behind them.
-} -}
module Dodge.Room.LongDoor where module Dodge.Room.LongDoor where
+1 -1
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-} --{-# LANGUAGE TupleSections #-}
module Dodge.Room.LongRoom where module Dodge.Room.LongRoom where
import Dodge.RoomLink import Dodge.RoomLink
import Dodge.Tree import Dodge.Tree
+1 -1
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-} --{-# LANGUAGE TupleSections #-}
module Dodge.Room.SensorDoor where module Dodge.Room.SensorDoor where
import Dodge.LevelGen.Data import Dodge.LevelGen.Data
import Dodge.PlacementSpot import Dodge.PlacementSpot