From 650854d13eee5a60e5447fd174c6a3ab8d51d977 Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 6 Oct 2024 22:09:55 +0100 Subject: [PATCH] Remove shrink gun --- ghcidOutput | 11 +---------- src/Dodge/Creature/Action.hs | 5 +---- src/Dodge/Creature/Impulse/UseItem.hs | 2 +- src/Dodge/Data/Item.hs | 3 --- src/Dodge/Data/Item/Combine.hs | 1 - src/Dodge/Data/Item/CurseStatus.hs | 17 ----------------- src/Dodge/Data/Item/HeldUse.hs | 10 ---------- src/Dodge/Default/Item.hs | 3 +-- src/Dodge/DisplayInventory.hs | 1 - src/Dodge/Inventory/SelectionList.hs | 3 ++- src/Dodge/Item.hs | 1 - src/Dodge/Item/Craftable.hs | 1 - src/Dodge/Item/Grammar.hs | 12 ++++++++---- src/Dodge/Item/Info.hs | 1 - src/Dodge/Item/InventoryColor.hs | 1 - src/Dodge/Item/Weapon/Utility.hs | 9 --------- src/Dodge/Luse.hs | 22 ++-------------------- src/Dodge/Room/Start.hs | 13 +------------ 18 files changed, 17 insertions(+), 99 deletions(-) delete mode 100644 src/Dodge/Data/Item/CurseStatus.hs diff --git a/ghcidOutput b/ghcidOutput index 771ae6220..5793b79ee 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1,10 +1 @@ -/home/justin/Haskell/loop/src/Dodge/DisplayInventory.hs:12:1-30: warning: [-Wunused-imports] - The import of ‘Dodge.Data.ComposedItem’ is redundant - | -12 | import Dodge.Data.ComposedItem - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/InventoryColor.hs:7:1-22: warning: [-Wunused-imports] - The import of ‘Dodge.Data.Item’ is redundant - | -7 | import Dodge.Data.Item - | ^^^^^^^^^^^^^^^^^^^^^^ +All good (597 modules, at 22:09:47) diff --git a/src/Dodge/Creature/Action.hs b/src/Dodge/Creature/Action.hs index 3a0f44f58..2ebf724a1 100644 --- a/src/Dodge/Creature/Action.hs +++ b/src/Dodge/Creature/Action.hs @@ -186,16 +186,13 @@ youDropItem w = fromMaybe w $ do curpos <- you w ^? crManipulation . manObject . imSelectedItem <|> fmap fst (IM.lookupMax =<< w ^? hud . hudElement . diSections . sssSections . ix 0 . ssItems) - guard $ not $ _crInvLock (you w) || cursed + guard $ not $ _crInvLock (you w) return $ w & dropItem cr curpos & soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing where cr = you w - cursed = fromMaybe False $ do - it <- yourSelectedItem w - return $ it ^. itCurseStatus /= Uncursed sizeSelf :: Float -> Creature -> World -> Maybe World sizeSelf x cr w diff --git a/src/Dodge/Creature/Impulse/UseItem.hs b/src/Dodge/Creature/Impulse/UseItem.hs index cf4030113..70b003039 100644 --- a/src/Dodge/Creature/Impulse/UseItem.hs +++ b/src/Dodge/Creature/Impulse/UseItem.hs @@ -5,6 +5,7 @@ module Dodge.Creature.Impulse.UseItem ( useItemHotkey, ) where +import Dodge.Luse import Dodge.SelectUse import Dodge.Item.Grammar import Dodge.Data.ComposedItem @@ -19,7 +20,6 @@ import Dodge.HeldUse import Dodge.Hotkey import Dodge.Inventory import Dodge.Item.Location -import Dodge.Luse import qualified IntMapHelp as IM useRootItem :: Int -> World -> World diff --git a/src/Dodge/Data/Item.hs b/src/Dodge/Data/Item.hs index dcc45013d..3809f0727 100644 --- a/src/Dodge/Data/Item.hs +++ b/src/Dodge/Data/Item.hs @@ -7,7 +7,6 @@ module Dodge.Data.Item ( module Dodge.Data.Item.Misc, module Dodge.Data.Item.Params, module Dodge.Data.Item.Use, - module Dodge.Data.Item.CurseStatus, module Dodge.Data.Item.Scope, module Dodge.Data.Item.Combine, module Dodge.Data.Item.Location, @@ -19,7 +18,6 @@ import Control.Lens import Data.Aeson import Data.Aeson.TH import Dodge.Data.Item.Combine -import Dodge.Data.Item.CurseStatus import Dodge.Data.Item.Effect import Dodge.Data.Item.Location import Dodge.Data.Item.Misc @@ -40,7 +38,6 @@ data Item = Item , _itAmmoSlots :: IM.IntMap AmmoType , _itInvSize :: Int , _itDimension :: ItemDimension - , _itCurseStatus :: CurseStatus , _itParams :: ItemParams } diff --git a/src/Dodge/Data/Item/Combine.hs b/src/Dodge/Data/Item/Combine.hs index 59b8383c5..211f8a9f6 100644 --- a/src/Dodge/Data/Item/Combine.hs +++ b/src/Dodge/Data/Item/Combine.hs @@ -123,7 +123,6 @@ data LeftItemType | SCROLLWATCH | BLINKER | BLINKERUNSAFE - | SHRINKER | SPAWNER deriving (Eq, Ord, Show, Read) --Generic, Flat) diff --git a/src/Dodge/Data/Item/CurseStatus.hs b/src/Dodge/Data/Item/CurseStatus.hs deleted file mode 100644 index 8ef5ba948..000000000 --- a/src/Dodge/Data/Item/CurseStatus.hs +++ /dev/null @@ -1,17 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE StrictData #-} -{-# LANGUAGE TemplateHaskell #-} - -module Dodge.Data.Item.CurseStatus where - -import Data.Aeson -import Data.Aeson.TH - -data CurseStatus - = Uncursed - | UndroppableIdentified - | UndroppableUnidentified - deriving (Eq, Ord, Show, Read) --Generic, Flat) - -deriveJSON defaultOptions ''CurseStatus diff --git a/src/Dodge/Data/Item/HeldUse.hs b/src/Dodge/Data/Item/HeldUse.hs index 59404a004..a7f27ddce 100644 --- a/src/Dodge/Data/Item/HeldUse.hs +++ b/src/Dodge/Data/Item/HeldUse.hs @@ -12,15 +12,6 @@ import Dodge.Data.CamouflageStatus import Dodge.Data.Item.Combine import Control.Lens ---data Huse --- = HeldDoNothing ----- | HeldFireRemoteShell ----- | HeldExplodeRemoteShell Int Int --- | HeldDetectorEffect Detector --- | HeldForceField ----- | HeldShatter --- deriving (Eq, Ord, Show, Read) --Generic, Flat) - data Cuse = CDoNothing | CHeal Int @@ -49,7 +40,6 @@ data Luse | LRewind | LTimePause | LTimeScroll - | LShrink | LBlink | LUnsafeBlink | LBoost diff --git a/src/Dodge/Default/Item.hs b/src/Dodge/Default/Item.hs index e20e186fe..e6edb2ee0 100644 --- a/src/Dodge/Default/Item.hs +++ b/src/Dodge/Default/Item.hs @@ -23,8 +23,7 @@ defaultItemDimension = ItemDimension defaultHeldItem :: Item defaultHeldItem = Item - { _itCurseStatus = Uncursed - , _itType = HELD PISTOL + { _itType = HELD PISTOL , _itEffect = defaultItEffect , _itID = 0 -- should this return an error ? const $ error "itID not correctly initialised" ? , _itTargeting = NoItTargeting diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index f0780b386..91f77e392 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -9,7 +9,6 @@ module Dodge.DisplayInventory ( updateCombinePositioning, ) where -import Dodge.Data.ComposedItem import Dodge.Data.DoubleTree import Control.Lens import Dodge.Inventory.SelectionList diff --git a/src/Dodge/Inventory/SelectionList.hs b/src/Dodge/Inventory/SelectionList.hs index 2594cd463..1db07416c 100644 --- a/src/Dodge/Inventory/SelectionList.hs +++ b/src/Dodge/Inventory/SelectionList.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE LambdaCase #-} module Dodge.Inventory.SelectionList ( invSelectionItem, invSelectionItem', @@ -81,6 +82,6 @@ closeObjectToSelectionItem e = -- closeObjectToTextPictures :: Either FloorItem Button -> ([String], Color) -closeObjectToTextPictures e = case e of +closeObjectToTextPictures = \case Left flit -> let it = _flIt flit in (basicItemDisplay it, itemInvColor . pciToCI $ basePCI it) Right bt -> ([_btText bt], yellow) diff --git a/src/Dodge/Item.hs b/src/Dodge/Item.hs index 6901b3e10..f70aadf29 100644 --- a/src/Dodge/Item.hs +++ b/src/Dodge/Item.hs @@ -81,5 +81,4 @@ itemFromLeftType lt = case lt of SCROLLWATCH -> scrollWatch BLINKER -> blinkGun BLINKERUNSAFE -> unsafeBlinkGun - SHRINKER -> shrinkGun SPAWNER -> error "need to datify creatures first" diff --git a/src/Dodge/Item/Craftable.hs b/src/Dodge/Item/Craftable.hs index b7f238a69..3e60f6d4b 100644 --- a/src/Dodge/Item/Craftable.hs +++ b/src/Dodge/Item/Craftable.hs @@ -8,7 +8,6 @@ makeTypeCraftNum :: Int -> CraftType -> [Item] makeTypeCraftNum i ct = replicate i $ defaultCraftItem & itInvSize .~ 1 - & itCurseStatus .~ Uncursed & itType .~ CRAFT ct makeTypeCraft :: CraftType -> Item diff --git a/src/Dodge/Item/Grammar.hs b/src/Dodge/Item/Grammar.hs index 2f844ec15..d6841932c 100644 --- a/src/Dodge/Item/Grammar.hs +++ b/src/Dodge/Item/Grammar.hs @@ -202,12 +202,16 @@ invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . map (fmap (\(x, -- returns an intmap with trees for all items --invTrees'' :: IM.IntMap Item -> [LocationLDT ItemLink ComposedItem] invTrees'' :: IM.IntMap Item -> IM.IntMap (Int,LocationLDT ItemLink ComposedItem) -invTrees'' = IM.unions . map (f . LocLDT TopLDT) . IM.elems . invRootTrees ---invTrees'' = map (LocLDT TopLDT) . IM.elems . invRootTrees +invTrees'' inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempty where - f t = cldtPropagateFold h h g 0 t mempty + f t = cldtPropagateFold h h g 0 t id h x _ _ _ = x + 1 - g x ldt = IM.insert (ldt ^?! locLDT . ldtValue . cItem . itLocation . ilInvID) (x,ldt) + g x ldt = (.) (IM.insert (ldt ^?! locLDT . ldtValue . cItem . itLocation . ilInvID) (x,ldt)) +--invTrees'' = IM.unions . map (f . LocLDT TopLDT) . IM.elems . invRootTrees +-- where +-- f t = cldtPropagateFold h h g 0 t mempty +-- h x _ _ _ = x + 1 +-- g x ldt = IM.insert (ldt ^?! locLDT . ldtValue . cItem . itLocation . ilInvID) (x,ldt) -- returns an intmap with trees for root items, indexed by inventory position invRootTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink ComposedItem) diff --git a/src/Dodge/Item/Info.hs b/src/Dodge/Item/Info.hs index 05c9ab5dd..181722fcf 100644 --- a/src/Dodge/Item/Info.hs +++ b/src/Dodge/Item/Info.hs @@ -101,7 +101,6 @@ leftInfo lit = case lit of SCROLLWATCH -> "A device that can be used to scroll through recent events." BLINKER -> "A device that allows local teleportation." BLINKERUNSAFE -> "A device that allows local teleportation. Potentially hazardous around walls." - SHRINKER -> "A device that shrinks the user." SPAWNER -> "A device that spawns creatures." equipInfo :: EquipItemType -> String diff --git a/src/Dodge/Item/InventoryColor.hs b/src/Dodge/Item/InventoryColor.hs index 128e47f6a..1e1aae1ee 100644 --- a/src/Dodge/Item/InventoryColor.hs +++ b/src/Dodge/Item/InventoryColor.hs @@ -4,7 +4,6 @@ module Dodge.Item.InventoryColor import Dodge.Data.ComposedItem import Color -import Dodge.Data.Item import Control.Lens itemInvColor :: ComposedItem -> Color diff --git a/src/Dodge/Item/Weapon/Utility.hs b/src/Dodge/Item/Weapon/Utility.hs index bac0a10e2..dae364ade 100644 --- a/src/Dodge/Item/Weapon/Utility.hs +++ b/src/Dodge/Item/Weapon/Utility.hs @@ -4,7 +4,6 @@ module Dodge.Item.Weapon.Utility , scrollWatch , blinkGun , unsafeBlinkGun - , shrinkGun ) where import Control.Lens @@ -40,14 +39,6 @@ rewindWatch = & itUse . leftUse .~ LRewind --useRewindGun & itType .~ LEFT REWINDWATCH --- needs to shift this item to the current inventory slot -shrinkGun :: Item -shrinkGun = - defaultLeftItem - & itUse .~ (defaultLeftUse & leftUse .~ LShrink) - & itParams .~ ShrinkGunParams FullSize - & itType .~ LEFT SHRINKER - blinkGun :: Item blinkGun = defaultLeftItem diff --git a/src/Dodge/Luse.hs b/src/Dodge/Luse.hs index 4b63129ac..f41b47e0f 100644 --- a/src/Dodge/Luse.hs +++ b/src/Dodge/Luse.hs @@ -1,10 +1,9 @@ -module Dodge.Luse where +module Dodge.Luse + where import Dodge.Base import Dodge.Creature.Action import Dodge.Data.World ---import MaybeHelp -import Dodge.Default.Creature import Dodge.Item.Weapon.TriggerType import Geometry import qualified IntMapHelp as IM @@ -16,7 +15,6 @@ useL lu = case lu of LRewind -> useRewindGun LTimePause -> hammerCheckL useStopWatch LTimeScroll -> hammerCheckL useTimeScrollGun - LShrink -> hammerCheckL useShrinkGun LBlink -> hammerCheckL (shootL $ const blinkActionMousePos) LUnsafeBlink -> hammerCheckL (shootL $ const unsafeBlinkAction) LBoost -> boostSelfL 10 @@ -53,22 +51,6 @@ useRewindGun itm _ w = w -- & cwTime . rewindWorlds .~ ws -- _ -> w --- be careful changing this around; potential problems include updating the --- creature but using the old crInvSel value --- 22.05.23 this has been changed from using invids to items -useShrinkGun :: Item -> Creature -> World -> World -useShrinkGun it cr w = case it ^? itParams . shrinkGunStatus of - --Just FullSize -> tryResize 0.5 $ stripNoItems cr . f Shrunk UndroppableIdentified . dropExcept cr invid - Just FullSize -> tryResize 0.5 $ f Shrunk UndroppableIdentified . dropExcept cr invid - Just Shrunk -> tryResize 1 $ f FullSize Uncursed . setMinInvSize defaultInvSize cr - Nothing -> error "useShrinkGun applied to item with incorrect ItParam" - where - invid = _ilInvID $ _itLocation it - tryResize x g = maybe w g $ sizeSelf x cr w - f isInUse cstatus = - cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid - %~ ((itParams . shrinkGunStatus .~ isInUse) . (itCurseStatus .~ cstatus)) - boostSelfL :: -- | boost amount Float -> diff --git a/src/Dodge/Room/Start.hs b/src/Dodge/Room/Start.hs index d144984cb..e35de9db9 100644 --- a/src/Dodge/Room/Start.hs +++ b/src/Dodge/Room/Start.hs @@ -10,8 +10,6 @@ import Dodge.Item.Held.Launcher import Dodge.Cleat import Dodge.Data.GenWorld import Dodge.Item.Craftable -import Dodge.Item.Weapon -import Dodge.LevelGen.PlacementHelper import Dodge.Room.Containing import Dodge.Room.Corridor import Dodge.Room.Door @@ -20,17 +18,8 @@ import Dodge.Room.RezBox import Dodge.Room.Room import Dodge.Room.RunPast import Dodge.Tree ---import Dodge.LevelGen.PlacementHelper ---import Geometry.Data ---import Padding ---import Shape -import LensHelp import RandomHelp ---import Data.Maybe ---import Data.Tree ---import qualified IntMapHelp as IM - powerFakeout' :: RandomGen g => State g (MetaTree Room String) powerFakeout' = tToBTree "powerFakeout'" <$> powerFakeout @@ -52,7 +41,7 @@ powerFakeout = do , door ] ++ randcors - ++ [ corridor & rmPmnts .:~ plRRpt 0 (PutFlIt shrinkGun) + ++ [ corridor , keyholeCorridor , corridor , cleatOnward door