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