Remove shrink gun

This commit is contained in:
2024-10-06 22:09:55 +01:00
parent 597e8dd89d
commit 650854d13e
18 changed files with 17 additions and 99 deletions
+1 -10
View File
@@ -1,10 +1 @@
/home/justin/Haskell/loop/src/Dodge/DisplayInventory.hs:12:1-30: warning: [-Wunused-imports] All good (597 modules, at 22:09:47)
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
| ^^^^^^^^^^^^^^^^^^^^^^
+1 -4
View File
@@ -186,16 +186,13 @@ youDropItem w = fromMaybe w $ do
curpos <- curpos <-
you w ^? crManipulation . manObject . imSelectedItem you w ^? crManipulation . manObject . imSelectedItem
<|> fmap fst (IM.lookupMax =<< w ^? hud . hudElement . diSections . sssSections . ix 0 . ssItems) <|> fmap fst (IM.lookupMax =<< w ^? hud . hudElement . diSections . sssSections . ix 0 . ssItems)
guard $ not $ _crInvLock (you w) || cursed guard $ not $ _crInvLock (you w)
return $ return $
w w
& dropItem cr curpos & dropItem cr curpos
& soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing & soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
where where
cr = you w cr = you w
cursed = fromMaybe False $ do
it <- yourSelectedItem w
return $ it ^. itCurseStatus /= Uncursed
sizeSelf :: Float -> Creature -> World -> Maybe World sizeSelf :: Float -> Creature -> World -> Maybe World
sizeSelf x cr w sizeSelf x cr w
+1 -1
View File
@@ -5,6 +5,7 @@ module Dodge.Creature.Impulse.UseItem (
useItemHotkey, useItemHotkey,
) where ) where
import Dodge.Luse
import Dodge.SelectUse import Dodge.SelectUse
import Dodge.Item.Grammar import Dodge.Item.Grammar
import Dodge.Data.ComposedItem import Dodge.Data.ComposedItem
@@ -19,7 +20,6 @@ import Dodge.HeldUse
import Dodge.Hotkey import Dodge.Hotkey
import Dodge.Inventory import Dodge.Inventory
import Dodge.Item.Location import Dodge.Item.Location
import Dodge.Luse
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
useRootItem :: Int -> World -> World useRootItem :: Int -> World -> World
-3
View File
@@ -7,7 +7,6 @@ module Dodge.Data.Item (
module Dodge.Data.Item.Misc, module Dodge.Data.Item.Misc,
module Dodge.Data.Item.Params, module Dodge.Data.Item.Params,
module Dodge.Data.Item.Use, module Dodge.Data.Item.Use,
module Dodge.Data.Item.CurseStatus,
module Dodge.Data.Item.Scope, module Dodge.Data.Item.Scope,
module Dodge.Data.Item.Combine, module Dodge.Data.Item.Combine,
module Dodge.Data.Item.Location, module Dodge.Data.Item.Location,
@@ -19,7 +18,6 @@ import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Dodge.Data.Item.Combine import Dodge.Data.Item.Combine
import Dodge.Data.Item.CurseStatus
import Dodge.Data.Item.Effect import Dodge.Data.Item.Effect
import Dodge.Data.Item.Location import Dodge.Data.Item.Location
import Dodge.Data.Item.Misc import Dodge.Data.Item.Misc
@@ -40,7 +38,6 @@ data Item = Item
, _itAmmoSlots :: IM.IntMap AmmoType , _itAmmoSlots :: IM.IntMap AmmoType
, _itInvSize :: Int , _itInvSize :: Int
, _itDimension :: ItemDimension , _itDimension :: ItemDimension
, _itCurseStatus :: CurseStatus
, _itParams :: ItemParams , _itParams :: ItemParams
} }
-1
View File
@@ -123,7 +123,6 @@ data LeftItemType
| SCROLLWATCH | SCROLLWATCH
| BLINKER | BLINKER
| BLINKERUNSAFE | BLINKERUNSAFE
| SHRINKER
| SPAWNER | SPAWNER
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
-17
View File
@@ -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
-10
View File
@@ -12,15 +12,6 @@ import Dodge.Data.CamouflageStatus
import Dodge.Data.Item.Combine import Dodge.Data.Item.Combine
import Control.Lens import Control.Lens
--data Huse
-- = HeldDoNothing
---- | HeldFireRemoteShell
---- | HeldExplodeRemoteShell Int Int
-- | HeldDetectorEffect Detector
-- | HeldForceField
---- | HeldShatter
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Cuse data Cuse
= CDoNothing = CDoNothing
| CHeal Int | CHeal Int
@@ -49,7 +40,6 @@ data Luse
| LRewind | LRewind
| LTimePause | LTimePause
| LTimeScroll | LTimeScroll
| LShrink
| LBlink | LBlink
| LUnsafeBlink | LUnsafeBlink
| LBoost | LBoost
+1 -2
View File
@@ -23,8 +23,7 @@ defaultItemDimension = ItemDimension
defaultHeldItem :: Item defaultHeldItem :: Item
defaultHeldItem = Item defaultHeldItem = Item
{ _itCurseStatus = Uncursed { _itType = HELD PISTOL
, _itType = HELD PISTOL
, _itEffect = defaultItEffect , _itEffect = defaultItEffect
, _itID = 0 -- should this return an error ? const $ error "itID not correctly initialised" ? , _itID = 0 -- should this return an error ? const $ error "itID not correctly initialised" ?
, _itTargeting = NoItTargeting , _itTargeting = NoItTargeting
-1
View File
@@ -9,7 +9,6 @@ module Dodge.DisplayInventory (
updateCombinePositioning, updateCombinePositioning,
) where ) where
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree import Dodge.Data.DoubleTree
import Control.Lens import Control.Lens
import Dodge.Inventory.SelectionList import Dodge.Inventory.SelectionList
+2 -1
View File
@@ -1,3 +1,4 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Inventory.SelectionList ( module Dodge.Inventory.SelectionList (
invSelectionItem, invSelectionItem,
invSelectionItem', invSelectionItem',
@@ -81,6 +82,6 @@ closeObjectToSelectionItem e =
-- --
closeObjectToTextPictures :: Either FloorItem Button -> ([String], Color) 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) Left flit -> let it = _flIt flit in (basicItemDisplay it, itemInvColor . pciToCI $ basePCI it)
Right bt -> ([_btText bt], yellow) Right bt -> ([_btText bt], yellow)
-1
View File
@@ -81,5 +81,4 @@ itemFromLeftType lt = case lt of
SCROLLWATCH -> scrollWatch SCROLLWATCH -> scrollWatch
BLINKER -> blinkGun BLINKER -> blinkGun
BLINKERUNSAFE -> unsafeBlinkGun BLINKERUNSAFE -> unsafeBlinkGun
SHRINKER -> shrinkGun
SPAWNER -> error "need to datify creatures first" SPAWNER -> error "need to datify creatures first"
-1
View File
@@ -8,7 +8,6 @@ makeTypeCraftNum :: Int -> CraftType -> [Item]
makeTypeCraftNum i ct = replicate i $ makeTypeCraftNum i ct = replicate i $
defaultCraftItem defaultCraftItem
& itInvSize .~ 1 & itInvSize .~ 1
& itCurseStatus .~ Uncursed
& itType .~ CRAFT ct & itType .~ CRAFT ct
makeTypeCraft :: CraftType -> Item makeTypeCraft :: CraftType -> Item
+8 -4
View File
@@ -202,12 +202,16 @@ invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . map (fmap (\(x,
-- returns an intmap with trees for all items -- returns an intmap with trees for all items
--invTrees'' :: IM.IntMap Item -> [LocationLDT ItemLink ComposedItem] --invTrees'' :: IM.IntMap Item -> [LocationLDT ItemLink ComposedItem]
invTrees'' :: IM.IntMap Item -> IM.IntMap (Int,LocationLDT ItemLink ComposedItem) invTrees'' :: IM.IntMap Item -> IM.IntMap (Int,LocationLDT ItemLink ComposedItem)
invTrees'' = IM.unions . map (f . LocLDT TopLDT) . IM.elems . invRootTrees invTrees'' inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempty
--invTrees'' = map (LocLDT TopLDT) . IM.elems . invRootTrees
where where
f t = cldtPropagateFold h h g 0 t mempty f t = cldtPropagateFold h h g 0 t id
h x _ _ _ = x + 1 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 -- returns an intmap with trees for root items, indexed by inventory position
invRootTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink ComposedItem) invRootTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink ComposedItem)
-1
View File
@@ -101,7 +101,6 @@ leftInfo lit = case lit of
SCROLLWATCH -> "A device that can be used to scroll through recent events." SCROLLWATCH -> "A device that can be used to scroll through recent events."
BLINKER -> "A device that allows local teleportation." BLINKER -> "A device that allows local teleportation."
BLINKERUNSAFE -> "A device that allows local teleportation. Potentially hazardous around walls." BLINKERUNSAFE -> "A device that allows local teleportation. Potentially hazardous around walls."
SHRINKER -> "A device that shrinks the user."
SPAWNER -> "A device that spawns creatures." SPAWNER -> "A device that spawns creatures."
equipInfo :: EquipItemType -> String equipInfo :: EquipItemType -> String
-1
View File
@@ -4,7 +4,6 @@ module Dodge.Item.InventoryColor
import Dodge.Data.ComposedItem import Dodge.Data.ComposedItem
import Color import Color
import Dodge.Data.Item
import Control.Lens import Control.Lens
itemInvColor :: ComposedItem -> Color itemInvColor :: ComposedItem -> Color
-9
View File
@@ -4,7 +4,6 @@ module Dodge.Item.Weapon.Utility
, scrollWatch , scrollWatch
, blinkGun , blinkGun
, unsafeBlinkGun , unsafeBlinkGun
, shrinkGun
) where ) where
import Control.Lens import Control.Lens
@@ -40,14 +39,6 @@ rewindWatch =
& itUse . leftUse .~ LRewind --useRewindGun & itUse . leftUse .~ LRewind --useRewindGun
& itType .~ LEFT REWINDWATCH & 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 :: Item
blinkGun = blinkGun =
defaultLeftItem defaultLeftItem
+2 -20
View File
@@ -1,10 +1,9 @@
module Dodge.Luse where module Dodge.Luse
where
import Dodge.Base import Dodge.Base
import Dodge.Creature.Action import Dodge.Creature.Action
import Dodge.Data.World import Dodge.Data.World
--import MaybeHelp
import Dodge.Default.Creature
import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.TriggerType
import Geometry import Geometry
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
@@ -16,7 +15,6 @@ useL lu = case lu of
LRewind -> useRewindGun LRewind -> useRewindGun
LTimePause -> hammerCheckL useStopWatch LTimePause -> hammerCheckL useStopWatch
LTimeScroll -> hammerCheckL useTimeScrollGun LTimeScroll -> hammerCheckL useTimeScrollGun
LShrink -> hammerCheckL useShrinkGun
LBlink -> hammerCheckL (shootL $ const blinkActionMousePos) LBlink -> hammerCheckL (shootL $ const blinkActionMousePos)
LUnsafeBlink -> hammerCheckL (shootL $ const unsafeBlinkAction) LUnsafeBlink -> hammerCheckL (shootL $ const unsafeBlinkAction)
LBoost -> boostSelfL 10 LBoost -> boostSelfL 10
@@ -53,22 +51,6 @@ useRewindGun itm _ w = w
-- & cwTime . rewindWorlds .~ ws -- & cwTime . rewindWorlds .~ ws
-- _ -> w -- _ -> 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 :: boostSelfL ::
-- | boost amount -- | boost amount
Float -> Float ->
+1 -12
View File
@@ -10,8 +10,6 @@ import Dodge.Item.Held.Launcher
import Dodge.Cleat import Dodge.Cleat
import Dodge.Data.GenWorld import Dodge.Data.GenWorld
import Dodge.Item.Craftable import Dodge.Item.Craftable
import Dodge.Item.Weapon
import Dodge.LevelGen.PlacementHelper
import Dodge.Room.Containing import Dodge.Room.Containing
import Dodge.Room.Corridor import Dodge.Room.Corridor
import Dodge.Room.Door import Dodge.Room.Door
@@ -20,17 +18,8 @@ import Dodge.Room.RezBox
import Dodge.Room.Room import Dodge.Room.Room
import Dodge.Room.RunPast import Dodge.Room.RunPast
import Dodge.Tree import Dodge.Tree
--import Dodge.LevelGen.PlacementHelper
--import Geometry.Data
--import Padding
--import Shape
import LensHelp
import RandomHelp import RandomHelp
--import Data.Maybe
--import Data.Tree
--import qualified IntMapHelp as IM
powerFakeout' :: RandomGen g => State g (MetaTree Room String) powerFakeout' :: RandomGen g => State g (MetaTree Room String)
powerFakeout' = tToBTree "powerFakeout'" <$> powerFakeout powerFakeout' = tToBTree "powerFakeout'" <$> powerFakeout
@@ -52,7 +41,7 @@ powerFakeout = do
, door , door
] ]
++ randcors ++ randcors
++ [ corridor & rmPmnts .:~ plRRpt 0 (PutFlIt shrinkGun) ++ [ corridor
, keyholeCorridor , keyholeCorridor
, corridor , corridor
, cleatOnward door , cleatOnward door