Remove left click/hotkey item data types
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
"_gameplay_rotate_to_wall": true,
|
"_gameplay_rotate_to_wall": true,
|
||||||
"_graphics_bloom": true,
|
"_graphics_bloom": true,
|
||||||
"_graphics_cloud_shadows": true,
|
"_graphics_cloud_shadows": true,
|
||||||
"_graphics_distortion_resolution": "HalfRes",
|
"_graphics_distortion_resolution": "FullRes",
|
||||||
"_graphics_distortions": true,
|
"_graphics_distortions": true,
|
||||||
"_graphics_downsize_resolution": "EighthRes",
|
"_graphics_downsize_resolution": "EighthRes",
|
||||||
"_graphics_num_shadow_casters": "NumShadowCasters20",
|
"_graphics_num_shadow_casters": "NumShadowCasters20",
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ digraph {
|
|||||||
graph [rankdir=LR];
|
graph [rankdir=LR];
|
||||||
subgraph 1 {
|
subgraph 1 {
|
||||||
1 [shape=box
|
1 [shape=box
|
||||||
,label="LEFT {_ibtLeft = SCROLLWATCH}"];
|
,label="HELD {_ibtHeld = TIMESCROLLER}"];
|
||||||
2 [shape=box
|
2 [shape=box
|
||||||
,label="LEFT {_ibtLeft = STOPWATCH}"];
|
,label="HELD {_ibtHeld = TIMESTOPPER}"];
|
||||||
3 [shape=box
|
3 [shape=box
|
||||||
,label="LEFT {_ibtLeft = REWINDWATCH}"];
|
,label="HELD {_ibtHeld = REWINDER}"];
|
||||||
11 [shape=box
|
11 [shape=box
|
||||||
,label="EQUIP {_ibtEquip = FUELPACK}"];
|
,label="EQUIP {_ibtEquip = FUELPACK}"];
|
||||||
15 [shape=box
|
15 [shape=box
|
||||||
@@ -64,9 +64,9 @@ digraph {
|
|||||||
81 [shape=box
|
81 [shape=box
|
||||||
,label="HELD {_ibtHeld = TESLAGUN}"];
|
,label="HELD {_ibtHeld = TESLAGUN}"];
|
||||||
83 [shape=box
|
83 [shape=box
|
||||||
,label="LEFT {_ibtLeft = BLINKER}"];
|
,label="HELD {_ibtHeld = BLINKER}"];
|
||||||
86 [shape=box
|
86 [shape=box
|
||||||
,label="LEFT {_ibtLeft = BLINKERUNSAFE}"];
|
,label="HELD {_ibtHeld = BLINKERUNSAFE}"];
|
||||||
88 [shape=box
|
88 [shape=box
|
||||||
,label="EQUIP {_ibtEquip = MAGSHIELD}"];
|
,label="EQUIP {_ibtEquip = MAGSHIELD}"];
|
||||||
91 [shape=box
|
91 [shape=box
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -14,9 +14,9 @@ import LensHelp
|
|||||||
|
|
||||||
watchCombinations :: [([(ItAmount, ItemType)], Item)]
|
watchCombinations :: [([(ItAmount, ItemType)], Item)]
|
||||||
watchCombinations =
|
watchCombinations =
|
||||||
[ po [LEFT STOPWATCH, LEFT REWINDWATCH] scrollWatch
|
[ po [HELD TIMESTOPPER, HELD REWINDER] timeScroller
|
||||||
, po [CRAFT TIMEMODULE, CRAFT MICROCHIP, CRAFT HARDDRIVE] scrollWatch
|
, po [CRAFT TIMEMODULE, CRAFT MICROCHIP, CRAFT HARDDRIVE] timeScroller
|
||||||
, po [CRAFT TIMEMODULE, CRAFT MICROCHIP, CRAFT RAM] scrollWatch
|
, po [CRAFT TIMEMODULE, CRAFT MICROCHIP, CRAFT RAM] timeScroller
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
po xs it = (map o xs, it)
|
po xs it = (map o xs, it)
|
||||||
@@ -92,8 +92,8 @@ itemCombinations =
|
|||||||
-- , po [HELD LASGUN, HELD LASGUN, HELD LASGUN, cr HARDWARE] lasCircle
|
-- , po [HELD LASGUN, HELD LASGUN, HELD LASGUN, cr HARDWARE] lasCircle
|
||||||
, p [o $ cr TRANSFORMER, p 2 $ cr CAN] sparkGun
|
, p [o $ cr TRANSFORMER, p 2 $ cr CAN] sparkGun
|
||||||
, p [o (HELD SPARKGUN), p 2 $ cr PIPE] teslaGun
|
, p [o (HELD SPARKGUN), p 2 $ cr PIPE] teslaGun
|
||||||
, p [o $ cr TELEPORTMODULE, p 2 $ cr MICROCHIP] blinkGun
|
, p [o $ cr TELEPORTMODULE, p 2 $ cr MICROCHIP] blinker
|
||||||
, p [o $ LEFT BLINKER, p 2 $ cr MICROCHIP] unsafeBlinkGun
|
, p [o $ HELD BLINKER, p 2 $ cr MICROCHIP] unsafeBlinker
|
||||||
, po [cr MAGNET, cr TIN] magShield
|
, po [cr MAGNET, cr TIN] magShield
|
||||||
, p [p 2 $ cr PIPE, o $ cr PLATE, o $ cr MOTOR] powerLegs
|
, p [p 2 $ cr PIPE, o $ cr PLATE, o $ cr MOTOR] powerLegs
|
||||||
, p [p 4 $ cr CAN] plateCraft
|
, p [p 4 $ cr CAN] plateCraft
|
||||||
@@ -103,9 +103,9 @@ itemCombinations =
|
|||||||
, po [cr MICROCHIP, cr PRISM] (makeTypeCraft LIGHTSENSOR)
|
, po [cr MICROCHIP, cr PRISM] (makeTypeCraft LIGHTSENSOR)
|
||||||
, po [cr MICROCHIP, cr MICROPHONE] (makeTypeCraft SOUNDSENSOR)
|
, po [cr MICROCHIP, cr MICROPHONE] (makeTypeCraft SOUNDSENSOR)
|
||||||
, po [cr MICROCHIP, cr THERMOMETER] (makeTypeCraft HEATSENSOR)
|
, po [cr MICROCHIP, cr THERMOMETER] (makeTypeCraft HEATSENSOR)
|
||||||
, po [cr MICROCHIP, cr TRANSMITTER, cr LIGHTSENSOR] (clickDetector ITEMDETECTOR)
|
, po [cr MICROCHIP, cr TRANSMITTER, cr LIGHTSENSOR] (detector ITEMDETECTOR)
|
||||||
, po [cr MICROCHIP, cr TRANSMITTER, cr SOUNDSENSOR] (clickDetector WALLDETECTOR)
|
, po [cr MICROCHIP, cr TRANSMITTER, cr SOUNDSENSOR] (detector WALLDETECTOR)
|
||||||
, po [cr MICROCHIP, cr TRANSMITTER, cr HEATSENSOR] (clickDetector CREATUREDETECTOR)
|
, po [cr MICROCHIP, cr TRANSMITTER, cr HEATSENSOR] (detector CREATUREDETECTOR)
|
||||||
, po [AMMOMAG BATTERY, cr LED] torch
|
, po [AMMOMAG BATTERY, cr LED] torch
|
||||||
, po [hd TORCH, eq HAT] headLamp
|
, po [hd TORCH, eq HAT] headLamp
|
||||||
-- , po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (energyBallCraft IncBall)
|
-- , po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (energyBallCraft IncBall)
|
||||||
|
|||||||
@@ -141,9 +141,11 @@ inventoryX c = case c of
|
|||||||
[ wristInvisibility
|
[ wristInvisibility
|
||||||
]
|
]
|
||||||
'D' ->
|
'D' ->
|
||||||
[ blinkGun
|
[ blinker
|
||||||
, unsafeBlinkGun
|
, unsafeBlinker
|
||||||
, clickDetector WALLDETECTOR
|
, pulseChecker
|
||||||
|
, detector WALLDETECTOR
|
||||||
|
, battery
|
||||||
]
|
]
|
||||||
'E' -> fold
|
'E' -> fold
|
||||||
[ makeTypeCraftNum 3 PIPE
|
[ makeTypeCraftNum 3 PIPE
|
||||||
@@ -301,19 +303,18 @@ stackedInventory =
|
|||||||
, megaShellMag
|
, megaShellMag
|
||||||
, megaShellMag
|
, megaShellMag
|
||||||
, pipe
|
, pipe
|
||||||
, scrollWatch
|
, timeScroller
|
||||||
, rewindWatch
|
, rewinder
|
||||||
, stopWatch
|
, timeStopper
|
||||||
, tractorGun
|
, tractorGun
|
||||||
, autoPistol
|
, autoPistol
|
||||||
, tinMag
|
, tinMag
|
||||||
, pistol
|
, pistol
|
||||||
, tinMag
|
, tinMag
|
||||||
, teslaGun
|
, teslaGun
|
||||||
, blinkGun
|
, blinker
|
||||||
, miniGunX 3
|
, miniGunX 3
|
||||||
, beltMag
|
, beltMag
|
||||||
, boosterGun
|
|
||||||
, flatShield
|
, flatShield
|
||||||
-- , lasWide 20
|
-- , lasWide 20
|
||||||
, poisonSprayer
|
, poisonSprayer
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
module Dodge.Creature.Impulse.UseItem (
|
module Dodge.Creature.Impulse.UseItem (
|
||||||
useRootItem,
|
useRootItem,
|
||||||
useItemLeftClick,
|
|
||||||
useItemHotkey,
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Cuse
|
|
||||||
import Dodge.Data.ComposedItem
|
import Dodge.Data.ComposedItem
|
||||||
import Dodge.Data.DoubleTree
|
import Dodge.Data.DoubleTree
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
@@ -17,8 +14,6 @@ import Dodge.Hotkey
|
|||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
import Dodge.Item.Grammar
|
import Dodge.Item.Grammar
|
||||||
import Dodge.Item.Location
|
import Dodge.Item.Location
|
||||||
import Dodge.Luse
|
|
||||||
import Dodge.SelectUse
|
|
||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
|
|
||||||
useRootItem :: Int -> World -> World
|
useRootItem :: Int -> World -> World
|
||||||
@@ -97,41 +92,3 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
|||||||
itRef = cr ^?! crManipulation . manObject . imSelectedItem -- unsafe!! TODO change?
|
itRef = cr ^?! crManipulation . manObject . imSelectedItem -- unsafe!! TODO change?
|
||||||
onequip itm' = doItmCrWdWd ((_eeOnEquip . _uequipEffect . _itUse) itm') itm'
|
onequip itm' = doItmCrWdWd ((_eeOnEquip . _uequipEffect . _itUse) itm') itm'
|
||||||
onremove itm' = doItmCrWdWd ((_eeOnRemove . _uequipEffect . _itUse) itm') itm'
|
onremove itm' = doItmCrWdWd ((_eeOnRemove . _uequipEffect . _itUse) itm') itm'
|
||||||
|
|
||||||
-- need to make sure that the root item is not erroneously selected in the
|
|
||||||
-- following
|
|
||||||
useItemLeftClick :: Creature -> World -> World
|
|
||||||
useItemLeftClick cr w = fromMaybe w $ do
|
|
||||||
guard . not $ _crInvLock cr
|
|
||||||
invid <- cr ^? crManipulation . manObject . imSelectedItem
|
|
||||||
itm <- cr ^? crInv . ix invid
|
|
||||||
ituse <- cr ^? crInv . ix invid . itUse
|
|
||||||
case ituse of
|
|
||||||
UseHeld{} -> return w
|
|
||||||
UseConsume eff -> return $ useC eff itm cr w
|
|
||||||
UseEquip{} -> return $ doequipmentchange invid
|
|
||||||
UseHotkey{} -> return $ doequipmentchange invid
|
|
||||||
UseNothing{} -> return w
|
|
||||||
UseAttach{} -> do
|
|
||||||
return $ selectUse itm cr w
|
|
||||||
_ -> Nothing
|
|
||||||
where
|
|
||||||
doequipmentchange invid = fromMaybe w $ do
|
|
||||||
guard (_crHammerPosition cr == HammerUp)
|
|
||||||
return $ toggleEquipmentAt invid cr w
|
|
||||||
|
|
||||||
-- & f
|
|
||||||
-- where
|
|
||||||
-- f = cWorld . lWorld . creatures . ix (_crID cr') . crHammerPosition .~ HammerDown
|
|
||||||
|
|
||||||
useItemHotkey :: Int -> Int -> World -> World
|
|
||||||
useItemHotkey crid invid w = fromMaybe w $ do
|
|
||||||
cr <- w ^? cWorld . lWorld . creatures . ix crid
|
|
||||||
itm <- cr ^? crInv . ix invid
|
|
||||||
luse <- itm ^? itUse . leftUse
|
|
||||||
return $
|
|
||||||
w
|
|
||||||
& cWorld . lWorld . creatures . ix crid . crInv . ix invid . itUse . leftHammer .~ HammerDown
|
|
||||||
& useL luse itm cr
|
|
||||||
|
|
||||||
-- TODO determine itmShouldBeUsed with reference to config options
|
|
||||||
|
|||||||
@@ -417,22 +417,23 @@ setRBCreatureTargeting cr w ituse
|
|||||||
Just $ hasLOS cpos (_crPos cr) w
|
Just $ hasLOS cpos (_crPos cr) w
|
||||||
|
|
||||||
itemUpdate :: Item -> Item
|
itemUpdate :: Item -> Item
|
||||||
itemUpdate = updateAutoRecharge . (itUse %~ useUpdate)
|
--itemUpdate = updateAutoRecharge . (itUse %~ useUpdate)
|
||||||
|
itemUpdate = itUse %~ useUpdate
|
||||||
|
|
||||||
useUpdate :: ItemUse -> ItemUse
|
useUpdate :: ItemUse -> ItemUse
|
||||||
useUpdate =
|
useUpdate =
|
||||||
(heldHammer %~ moveHammerUp)
|
(heldHammer %~ moveHammerUp)
|
||||||
. (leftHammer %~ moveHammerUp)
|
-- . (leftHammer %~ moveHammerUp)
|
||||||
. (leftDelay . rateTime %~ decreaseToZero)
|
-- . (leftDelay . rateTime %~ decreaseToZero)
|
||||||
. (heldDelay . warmTime %~ decreaseToZero)
|
. (heldDelay . warmTime %~ decreaseToZero)
|
||||||
. (heldDelay . rateTime %~ decreaseToZero)
|
. (heldDelay . rateTime %~ decreaseToZero)
|
||||||
|
|
||||||
updateAutoRecharge :: Item -> Item
|
--updateAutoRecharge :: Item -> Item
|
||||||
updateAutoRecharge it = case it ^? itUse . leftConsumption of
|
--updateAutoRecharge it = case it ^? itUse . leftConsumption of
|
||||||
Just (AutoRecharging l m t p)
|
-- Just (AutoRecharging l m t p)
|
||||||
| l < m && p <= 0 -> it & itUse . leftConsumption .~ AutoRecharging (l + 1) m t t
|
-- | l < m && p <= 0 -> it & itUse . leftConsumption .~ AutoRecharging (l + 1) m t t
|
||||||
| l < m -> it & itUse . leftConsumption . arProgress -~ 1
|
-- | l < m -> it & itUse . leftConsumption . arProgress -~ 1
|
||||||
_ -> it
|
-- _ -> it
|
||||||
|
|
||||||
updateMovement :: Creature -> Creature
|
updateMovement :: Creature -> Creature
|
||||||
updateMovement cr
|
updateMovement cr
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ module Dodge.Creature.YourControl (
|
|||||||
yourControl,
|
yourControl,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Data.ComposedItem
|
||||||
|
import Dodge.HeldUse
|
||||||
|
import Dodge.Data.DoubleTree
|
||||||
|
import Dodge.Item.Grammar
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
@@ -39,14 +43,19 @@ yourControl _ w
|
|||||||
|
|
||||||
handleHotkeys :: World -> World
|
handleHotkeys :: World -> World
|
||||||
handleHotkeys w
|
handleHotkeys w
|
||||||
| SDL.ButtonRight `M.member` _mouseButtons (_input w) = foldl' tryAssignHotkey w allHotkeys
|
-- | SDL.ButtonRight `M.member` _mouseButtons (_input w)
|
||||||
|
| SDL.ScancodeLShift `M.member` _pressedKeys (_input w)
|
||||||
|
|| SDL.ScancodeRShift `M.member` _pressedKeys (_input w)
|
||||||
|
= foldl' tryAssignHotkey w allHotkeys
|
||||||
| otherwise = foldl' useHotKey w (M.intersection thehotkeys (w ^. input . pressedKeys))
|
| otherwise = foldl' useHotKey w (M.intersection thehotkeys (w ^. input . pressedKeys))
|
||||||
where
|
where
|
||||||
--thehotkeys = M.mapKeys hotkeyToScancode $ w ^?! cWorld . lWorld . creatures . ix 0 . crHotkeys
|
|
||||||
thehotkeys = M.mapKeys hotkeyToScancode $ w ^. cWorld . lWorld . hotkeys
|
thehotkeys = M.mapKeys hotkeyToScancode $ w ^. cWorld . lWorld . hotkeys
|
||||||
|
|
||||||
useHotKey :: World -> Int -> World
|
useHotKey :: World -> Int -> World
|
||||||
useHotKey w invid = useItemHotkey 0 invid w
|
useHotKey w invid = fromMaybe w $ do
|
||||||
|
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||||
|
itmloc <- allInvLocs (cr ^. crInv) ^? ix invid . _2 . locLDT
|
||||||
|
return $ heldEffectNoHammerCheck (bimap (^. iatType) (^. _1) itmloc) cr w
|
||||||
|
|
||||||
allHotkeys :: [SDL.Scancode]
|
allHotkeys :: [SDL.Scancode]
|
||||||
allHotkeys = map hotkeyToScancode [minBound .. maxBound]
|
allHotkeys = map hotkeyToScancode [minBound .. maxBound]
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ data Creature = Creature
|
|||||||
, _crManipulation :: Manipulation
|
, _crManipulation :: Manipulation
|
||||||
, _crInvCapacity :: Int
|
, _crInvCapacity :: Int
|
||||||
, _crInvLock :: Bool
|
, _crInvLock :: Bool
|
||||||
-- , _crInvEquipped :: IM.IntMap EquipPosition
|
|
||||||
, _crEquipment :: M.Map EquipPosition Int
|
, _crEquipment :: M.Map EquipPosition Int
|
||||||
-- , _crInvHotkeys :: IM.IntMap Hotkey
|
|
||||||
-- , _crHotkeys :: M.Map Hotkey Int
|
|
||||||
, _crState :: CreatureState
|
, _crState :: CreatureState
|
||||||
, _crCorpse :: CreatureCorpse --Creature -> Corpse -> SPic
|
, _crCorpse :: CreatureCorpse --Creature -> Corpse -> SPic
|
||||||
, _crMaterial :: Material
|
, _crMaterial :: Material
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import Dodge.Data.Item.Targeting
|
|||||||
|
|
||||||
data ItemType
|
data ItemType
|
||||||
= HELD {_ibtHeld :: HeldItemType}
|
= HELD {_ibtHeld :: HeldItemType}
|
||||||
| LEFT {_ibtLeft :: LeftItemType}
|
-- | LEFT {_ibtLeft :: LeftItemType}
|
||||||
| EQUIP {_ibtEquip :: EquipItemType}
|
| EQUIP {_ibtEquip :: EquipItemType}
|
||||||
| CONSUMABLE {_ibtConsumable :: ConsumableItemType}
|
| CONSUMABLE {_ibtConsumable :: ConsumableItemType}
|
||||||
| CRAFT {_ibtCraft :: CraftType}
|
| CRAFT {_ibtCraft :: CraftType}
|
||||||
@@ -116,18 +116,17 @@ data EquipItemType
|
|||||||
| WRIST_ECG
|
| WRIST_ECG
|
||||||
deriving (Eq, Ord, Show, Read)
|
deriving (Eq, Ord, Show, Read)
|
||||||
|
|
||||||
data LeftItemType
|
--data LeftItemType
|
||||||
= BOOSTER
|
-- = STOPWATCH
|
||||||
| STOPWATCH
|
-- | SCROLLWATCH
|
||||||
| REWINDWATCH
|
-- | SPAWNER
|
||||||
| SCROLLWATCH
|
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
| BLINKER
|
|
||||||
| BLINKERUNSAFE
|
|
||||||
| SPAWNER
|
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
||||||
|
|
||||||
data HeldItemType
|
data HeldItemType
|
||||||
= BANGSTICK {_xNum :: Int}
|
= BANGSTICK {_xNum :: Int}
|
||||||
|
| REWINDER
|
||||||
|
| TIMESTOPPER
|
||||||
|
| TIMESCROLLER
|
||||||
| PISTOL
|
| PISTOL
|
||||||
| MACHINEPISTOL
|
| MACHINEPISTOL
|
||||||
| AUTOPISTOL
|
| AUTOPISTOL
|
||||||
@@ -163,6 +162,8 @@ data HeldItemType
|
|||||||
| FLATSHIELD
|
| FLATSHIELD
|
||||||
| KEYCARD Int
|
| KEYCARD Int
|
||||||
| DETECTOR Detector
|
| DETECTOR Detector
|
||||||
|
| BLINKER
|
||||||
|
| BLINKERUNSAFE
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data Detector
|
data Detector
|
||||||
@@ -180,7 +181,7 @@ deriveJSON defaultOptions ''AmmoMagType
|
|||||||
deriveJSON defaultOptions ''AttachType
|
deriveJSON defaultOptions ''AttachType
|
||||||
deriveJSON defaultOptions ''Detector
|
deriveJSON defaultOptions ''Detector
|
||||||
deriveJSON defaultOptions ''EquipItemType
|
deriveJSON defaultOptions ''EquipItemType
|
||||||
deriveJSON defaultOptions ''LeftItemType
|
--deriveJSON defaultOptions ''LeftItemType
|
||||||
deriveJSON defaultOptions ''HeldItemType
|
deriveJSON defaultOptions ''HeldItemType
|
||||||
deriveJSON defaultOptions ''ItemType
|
deriveJSON defaultOptions ''ItemType
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ data ItEffect = ItEffect
|
|||||||
|
|
||||||
data ItInvEffect
|
data ItInvEffect
|
||||||
= NoInvEffect
|
= NoInvEffect
|
||||||
| ChargeIfEquipped
|
-- | ChargeIfEquipped
|
||||||
| ChargeIfInInventory
|
-- | ChargeIfInInventory
|
||||||
| SetCharge Int
|
-- | SetCharge Int
|
||||||
| EffectRootNotroot ItInvEffect ItInvEffect
|
| EffectRootNotroot ItInvEffect ItInvEffect
|
||||||
| CreateShieldWall
|
| CreateShieldWall
|
||||||
| RemoveShieldWall
|
| RemoveShieldWall
|
||||||
|
|||||||
@@ -20,35 +20,16 @@ data Euse
|
|||||||
| EMagShield
|
| EMagShield
|
||||||
| EWristShield
|
| EWristShield
|
||||||
| EHeadLamp
|
| EHeadLamp
|
||||||
-- | EFuelSource {_euseFuelAmount :: Int, _euseFuelMax :: Int}
|
|
||||||
-- | EBatterySource {_euseBatteryAmount :: Int, _euseBatteryMax :: Int}
|
|
||||||
-- | EAmmoSource
|
|
||||||
-- { _euseAmmoAmount :: Int
|
|
||||||
-- , _euseAmmoMax :: Int
|
|
||||||
-- , _euseAmmoLink :: Maybe Int
|
|
||||||
-- }
|
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data Luse
|
--data Luse
|
||||||
= LDoNothing
|
-- = LDoNothing
|
||||||
| LRewind
|
-- | LRewind
|
||||||
| LTimePause
|
-- | LTimePause
|
||||||
| LTimeScroll
|
-- | LTimeScroll
|
||||||
| LBlink
|
|
||||||
| LUnsafeBlink
|
|
||||||
| LBoost
|
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
||||||
|
|
||||||
--data HeldMod
|
|
||||||
-- = PistolMod
|
|
||||||
---- | FireRemoteShellMod
|
|
||||||
-- | ExplodeRemoteShellMod
|
|
||||||
-- | DoNothingMod
|
|
||||||
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
makeLenses ''Euse
|
makeLenses ''Euse
|
||||||
deriveJSON defaultOptions ''Cuse
|
deriveJSON defaultOptions ''Cuse
|
||||||
--deriveJSON defaultOptions ''HeldMod
|
|
||||||
deriveJSON defaultOptions ''Euse
|
deriveJSON defaultOptions ''Euse
|
||||||
--deriveJSON defaultOptions ''Huse
|
--deriveJSON defaultOptions ''Luse
|
||||||
deriveJSON defaultOptions ''Luse
|
|
||||||
|
|||||||
@@ -40,14 +40,15 @@ data ItemUse
|
|||||||
-- , _heldAmmoTypes :: IM.IntMap AmmoType
|
-- , _heldAmmoTypes :: IM.IntMap AmmoType
|
||||||
, _heldParams :: HeldParams
|
, _heldParams :: HeldParams
|
||||||
, _heldTriggerType :: TriggerType
|
, _heldTriggerType :: TriggerType
|
||||||
|
, _useCondition :: UseCondition
|
||||||
}
|
}
|
||||||
| UseHotkey
|
-- | UseHotkey
|
||||||
{ _leftUse :: Luse
|
-- { _leftUse :: Luse
|
||||||
, _leftDelay :: UseDelay
|
-- , _leftDelay :: UseDelay
|
||||||
, _leftHammer :: HammerPosition
|
-- , _leftHammer :: HammerPosition
|
||||||
, _uequipEffect :: EquipEffect
|
-- , _uequipEffect :: EquipEffect
|
||||||
, _leftConsumption :: LeftConsumption
|
-- , _leftConsumption :: LeftConsumption
|
||||||
}
|
-- }
|
||||||
| UseConsume { _cUse :: Cuse }
|
| UseConsume { _cUse :: Cuse }
|
||||||
| UseEquip { _uequipEffect :: EquipEffect }
|
| UseEquip { _uequipEffect :: EquipEffect }
|
||||||
| UseAttach {_uaParams :: AttachParams}
|
| UseAttach {_uaParams :: AttachParams}
|
||||||
@@ -56,6 +57,11 @@ data ItemUse
|
|||||||
| UseBulletMod { _ubMod :: BulletMod }
|
| UseBulletMod { _ubMod :: BulletMod }
|
||||||
deriving (Eq, Show, Read)
|
deriving (Eq, Show, Read)
|
||||||
|
|
||||||
|
data UseCondition
|
||||||
|
= MustBeHeld
|
||||||
|
| UseableAnytime
|
||||||
|
deriving (Eq, Show, Read)
|
||||||
|
|
||||||
data TriggerType = AutoTrigger | HammerTrigger
|
data TriggerType = AutoTrigger | HammerTrigger
|
||||||
deriving (Eq, Show, Read)
|
deriving (Eq, Show, Read)
|
||||||
|
|
||||||
@@ -142,6 +148,11 @@ data MuzzleEffect
|
|||||||
}
|
}
|
||||||
| MuzzleShatter
|
| MuzzleShatter
|
||||||
| MuzzleDetector
|
| MuzzleDetector
|
||||||
|
| MuzzleBlink
|
||||||
|
| MuzzleUnsafeBlink
|
||||||
|
| MuzzleRewind
|
||||||
|
| MuzzleStopper
|
||||||
|
| MuzzleScroller
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data AmmoPerShot
|
data AmmoPerShot
|
||||||
@@ -192,6 +203,8 @@ makeLenses ''AttachParams
|
|||||||
makeLenses ''AmmoParams
|
makeLenses ''AmmoParams
|
||||||
makeLenses ''MuzzleEffect
|
makeLenses ''MuzzleEffect
|
||||||
makeLenses ''AmmoPerShot
|
makeLenses ''AmmoPerShot
|
||||||
|
makeLenses ''UseCondition
|
||||||
|
deriveJSON defaultOptions ''UseCondition
|
||||||
deriveJSON defaultOptions ''MuzzleEffect
|
deriveJSON defaultOptions ''MuzzleEffect
|
||||||
deriveJSON defaultOptions ''FlareType
|
deriveJSON defaultOptions ''FlareType
|
||||||
deriveJSON defaultOptions ''TriggerType
|
deriveJSON defaultOptions ''TriggerType
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module Dodge.Default.Item (
|
|||||||
defaultHeldItem,
|
defaultHeldItem,
|
||||||
singleAmmo,
|
singleAmmo,
|
||||||
defaultBulletWeapon,
|
defaultBulletWeapon,
|
||||||
defaultLeftItem,
|
-- defaultLeftItem,
|
||||||
defaultCraftItem,
|
defaultCraftItem,
|
||||||
defaultConsumable,
|
defaultConsumable,
|
||||||
module Dodge.Default.Item.Use,
|
module Dodge.Default.Item.Use,
|
||||||
@@ -28,8 +28,8 @@ defaultHeldItem =
|
|||||||
, _itParams = NoParams
|
, _itParams = NoParams
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultLeftItem :: Item
|
--defaultLeftItem :: Item
|
||||||
defaultLeftItem = defaultHeldItem & itUse .~ defaultLeftUse
|
--defaultLeftItem = defaultHeldItem & itUse .~ defaultLeftUse
|
||||||
|
|
||||||
defaultCraftItem :: Item
|
defaultCraftItem :: Item
|
||||||
defaultCraftItem = defaultHeldItem & itUse .~ UseNothing
|
defaultCraftItem = defaultHeldItem & itUse .~ UseNothing
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ import Dodge.Default.Item.Use.AimParams
|
|||||||
import Dodge.Default.Item.Use.Consumption
|
import Dodge.Default.Item.Use.Consumption
|
||||||
import Dodge.Default.Item.Use.Equipment
|
import Dodge.Default.Item.Use.Equipment
|
||||||
|
|
||||||
defaultLeftUse :: ItemUse
|
--defaultLeftUse :: ItemUse
|
||||||
defaultLeftUse = UseHotkey
|
--defaultLeftUse = UseHotkey
|
||||||
{ _leftUse = LDoNothing
|
-- { _leftUse = LDoNothing
|
||||||
, _leftDelay = FixedRate{_rateMax = 8, _rateTime = 0}
|
-- , _leftDelay = FixedRate{_rateMax = 8, _rateTime = 0}
|
||||||
, _leftHammer = HammerUp
|
-- , _leftHammer = HammerUp
|
||||||
, _uequipEffect = defaultEquip
|
-- , _uequipEffect = defaultEquip
|
||||||
, _leftConsumption = defaultLeftLoadable
|
-- , _leftConsumption = defaultLeftLoadable
|
||||||
}
|
-- }
|
||||||
|
|
||||||
defaultEquipUse :: ItemUse
|
defaultEquipUse :: ItemUse
|
||||||
defaultEquipUse = UseEquip
|
defaultEquipUse = UseEquip
|
||||||
@@ -42,4 +42,5 @@ defaultHeldUse = UseHeld
|
|||||||
, _weaponRepeat = []
|
, _weaponRepeat = []
|
||||||
}
|
}
|
||||||
, _heldTriggerType = HammerTrigger
|
, _heldTriggerType = HammerTrigger
|
||||||
|
, _useCondition = MustBeHeld
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ module Dodge.HeldUse (
|
|||||||
mcUseHeld,
|
mcUseHeld,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Luse
|
||||||
|
import Dodge.Creature.Action.Blink
|
||||||
import Dodge.RadarSweep
|
import Dodge.RadarSweep
|
||||||
import Color
|
import Color
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
@@ -245,6 +247,11 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
|
|||||||
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
|
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
|
||||||
MuzzleShatter -> shootShatter itm cr w
|
MuzzleShatter -> shootShatter itm cr w
|
||||||
MuzzleDetector -> itemDetectorEffect itm cr w
|
MuzzleDetector -> itemDetectorEffect itm cr w
|
||||||
|
MuzzleBlink -> unsafeBlinkAction cr w
|
||||||
|
MuzzleUnsafeBlink -> blinkActionMousePos cr w
|
||||||
|
MuzzleRewind -> useRewindGun (itm ^. itID) w
|
||||||
|
MuzzleStopper -> useStopWatch itm cr w
|
||||||
|
MuzzleScroller -> useTimeScrollGun itm cr w
|
||||||
where
|
where
|
||||||
mid = magtree ^? ldtValue . itLocation . ilInvID
|
mid = magtree ^? ldtValue . itLocation . ilInvID
|
||||||
itm = itmtree ^. ldtValue
|
itm = itmtree ^. ldtValue
|
||||||
@@ -433,12 +440,6 @@ mcUseHeld hit = case hit of
|
|||||||
LASER -> mcShootLaser
|
LASER -> mcShootLaser
|
||||||
_ -> \_ _ -> id
|
_ -> \_ _ -> id
|
||||||
|
|
||||||
--useHeld :: Huse -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
|
||||||
--useHeld hu = case hu of
|
|
||||||
-- HeldDoNothing -> const $ const id
|
|
||||||
-- HeldDetectorEffect dt -> detectorEffect dt . _ldtValue
|
|
||||||
-- HeldForceField -> useForceFieldGun . _ldtValue
|
|
||||||
|
|
||||||
useGasParams :: Maybe Int -> Muzzle -> Item -> Creature -> World -> World
|
useGasParams :: Maybe Int -> Muzzle -> Item -> Creature -> World -> World
|
||||||
useGasParams mmagid mz itm cr w =
|
useGasParams mmagid mz itm cr w =
|
||||||
createGas
|
createGas
|
||||||
|
|||||||
+7
-15
@@ -14,14 +14,11 @@ import Control.Monad
|
|||||||
assignNewHotkey :: Int -> LWorld -> LWorld
|
assignNewHotkey :: Int -> LWorld -> LWorld
|
||||||
assignNewHotkey invid w = assignHotkey invid (newHotkey w) w
|
assignNewHotkey invid w = assignHotkey invid (newHotkey w) w
|
||||||
|
|
||||||
--newHotkey :: Creature -> Hotkey
|
|
||||||
--newHotkey cr = fromMaybe maxBound $ find (not . (`M.member` usedhks)) [minBound .. maxBound]
|
|
||||||
-- where
|
|
||||||
-- usedhks = cr ^?! crHotkeys
|
|
||||||
newHotkey :: LWorld -> Hotkey
|
newHotkey :: LWorld -> Hotkey
|
||||||
newHotkey lw = fromMaybe maxBound $ find (not . (`M.member` usedhks)) [minBound .. maxBound]
|
newHotkey lw = fromMaybe maxBound $
|
||||||
where
|
find
|
||||||
usedhks = lw ^. hotkeys
|
(not . (`M.member` (lw ^. hotkeys)))
|
||||||
|
[minBound .. maxBound]
|
||||||
|
|
||||||
-- this will not remove the hotkey from its old slot, assumes there is a hotkey
|
-- this will not remove the hotkey from its old slot, assumes there is a hotkey
|
||||||
-- to swap with instead
|
-- to swap with instead
|
||||||
@@ -29,16 +26,11 @@ newHotkey lw = fromMaybe maxBound $ find (not . (`M.member` usedhks)) [minBound
|
|||||||
assignHotkey :: Int -> Hotkey -> LWorld -> LWorld
|
assignHotkey :: Int -> Hotkey -> LWorld -> LWorld
|
||||||
assignHotkey invid hk lw = fromMaybe lw $ do
|
assignHotkey invid hk lw = fromMaybe lw $ do
|
||||||
--guard (invid `IM.member` (cr ^. crInvEquipped))
|
--guard (invid `IM.member` (cr ^. crInvEquipped))
|
||||||
guard $ isJust $ lw ^? creatures . ix 0 . crInv . ix invid . itLocation . ilEquipPosition . _Just
|
guard $ lw ^? creatures . ix 0 . crInv . ix invid . itUse . useCondition
|
||||||
_ <- lw ^? creatures . ix 0 . crInv . ix invid . itUse . leftUse
|
== Just UseableAnytime
|
||||||
|
-- _ <- lw ^? creatures . ix 0 . crInv . ix invid . itUse . leftUse
|
||||||
return $ (setHotkey invid hk . moveOldHotkey invid hk) lw
|
return $ (setHotkey invid hk . moveOldHotkey invid hk) lw
|
||||||
|
|
||||||
--moveOldHotkey :: Int -> Hotkey -> Creature -> Creature
|
|
||||||
--moveOldHotkey invid hk w = fromMaybe w $ do
|
|
||||||
-- oldhk <- w ^? crInvHotkeys . ix invid
|
|
||||||
-- oldid <- w ^? crHotkeys . ix hk
|
|
||||||
-- return $ w & setHotkey oldid oldhk
|
|
||||||
|
|
||||||
moveOldHotkey :: Int -> Hotkey -> LWorld -> LWorld
|
moveOldHotkey :: Int -> Hotkey -> LWorld -> LWorld
|
||||||
moveOldHotkey invid hk w = fromMaybe w $ do
|
moveOldHotkey invid hk w = fromMaybe w $ do
|
||||||
oldhk <- w ^? imHotkeys . ix invid
|
oldhk <- w ^? imHotkeys . ix invid
|
||||||
|
|||||||
+29
-30
@@ -1,8 +1,7 @@
|
|||||||
module Dodge.ItEffect
|
module Dodge.ItEffect (
|
||||||
( doInvEffect
|
doInvEffect,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified IntMapHelp as IM
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.Euse
|
import Dodge.Euse
|
||||||
@@ -10,9 +9,9 @@ import Dodge.Euse
|
|||||||
doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
|
doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
|
||||||
doInvEffect iie = case iie of
|
doInvEffect iie = case iie of
|
||||||
NoInvEffect -> const $ const id
|
NoInvEffect -> const $ const id
|
||||||
ChargeIfEquipped -> chargeIfEquipped
|
-- ChargeIfEquipped -> chargeIfEquipped
|
||||||
ChargeIfInInventory -> chargeIfInInventory
|
-- ChargeIfInInventory -> chargeIfInInventory
|
||||||
SetCharge i -> setItemCharge i
|
-- SetCharge i -> setItemCharge i
|
||||||
EffectRootNotroot f g -> rootNotrootEff f g
|
EffectRootNotroot f g -> rootNotrootEff f g
|
||||||
CreateShieldWall -> createShieldWall
|
CreateShieldWall -> createShieldWall
|
||||||
RemoveShieldWall -> removeShieldWall
|
RemoveShieldWall -> removeShieldWall
|
||||||
@@ -36,27 +35,27 @@ effectWhileAttached f it
|
|||||||
-- , _futureWorlds = []
|
-- , _futureWorlds = []
|
||||||
-- }
|
-- }
|
||||||
|
|
||||||
setItemCharge :: Int -> Item -> Creature -> World -> World
|
--setItemCharge :: Int -> Item -> Creature -> World -> World
|
||||||
setItemCharge i itm cr w =
|
--setItemCharge i itm cr w =
|
||||||
w & ptrWpCharge %~ const i
|
-- w & ptrWpCharge %~ const i
|
||||||
where
|
-- where
|
||||||
invid = _ilInvID $ _itLocation itm
|
-- invid = _ilInvID $ _itLocation itm
|
||||||
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||||
|
--
|
||||||
chargeIfInInventory :: Item -> Creature -> World -> World
|
--chargeIfInInventory :: Item -> Creature -> World -> World
|
||||||
chargeIfInInventory itm cr w =
|
--chargeIfInInventory itm cr w =
|
||||||
w & ptrWpCharge %~ (min maxcharge . (+ 1))
|
-- w & ptrWpCharge %~ (min maxcharge . (+ 1))
|
||||||
where
|
-- where
|
||||||
invid = _ilInvID $ _itLocation itm
|
-- invid = _ilInvID $ _itLocation itm
|
||||||
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||||
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
|
-- maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
|
||||||
|
--
|
||||||
chargeIfEquipped :: Item -> Creature -> World -> World
|
--chargeIfEquipped :: Item -> Creature -> World -> World
|
||||||
chargeIfEquipped itm cr w
|
--chargeIfEquipped itm cr w
|
||||||
| invid `IM.member` (w ^. cWorld . lWorld . imHotkeys) = w &
|
-- | invid `IM.member` (w ^. cWorld . lWorld . imHotkeys) = w &
|
||||||
ptrWpCharge %~ (min maxcharge . (+ 1))
|
-- ptrWpCharge %~ (min maxcharge . (+ 1))
|
||||||
| otherwise = w & ptrWpCharge .~ 0
|
-- | otherwise = w & ptrWpCharge .~ 0
|
||||||
where
|
-- where
|
||||||
invid = _ilInvID $ _itLocation itm
|
-- invid = _ilInvID $ _itLocation itm
|
||||||
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||||
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
|
-- maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
|
||||||
|
|||||||
+1
-11
@@ -21,7 +21,7 @@ import Dodge.Item.Weapon
|
|||||||
itemFromBase :: ItemType -> Item
|
itemFromBase :: ItemType -> Item
|
||||||
itemFromBase = \case
|
itemFromBase = \case
|
||||||
HELD ht -> itemFromHeldType ht
|
HELD ht -> itemFromHeldType ht
|
||||||
LEFT lt -> itemFromLeftType lt
|
-- LEFT lt -> itemFromLeftType lt
|
||||||
EQUIP et -> itemFromEquipType et
|
EQUIP et -> itemFromEquipType et
|
||||||
CONSUMABLE et -> itemFromConsumableType et
|
CONSUMABLE et -> itemFromConsumableType et
|
||||||
CRAFT cr -> makeTypeCraft cr
|
CRAFT cr -> makeTypeCraft cr
|
||||||
@@ -72,13 +72,3 @@ itemFromEquipType et = case et of
|
|||||||
BULLETBELTPACK -> bulletBeltPack
|
BULLETBELTPACK -> bulletBeltPack
|
||||||
BULLETBELTBRACER -> bulletBeltBracer
|
BULLETBELTBRACER -> bulletBeltBracer
|
||||||
WRIST_ECG -> pulseChecker
|
WRIST_ECG -> pulseChecker
|
||||||
|
|
||||||
itemFromLeftType :: LeftItemType -> Item
|
|
||||||
itemFromLeftType lt = case lt of
|
|
||||||
BOOSTER -> boosterGun
|
|
||||||
STOPWATCH -> stopWatch
|
|
||||||
REWINDWATCH -> rewindWatch
|
|
||||||
SCROLLWATCH -> scrollWatch
|
|
||||||
BLINKER -> blinkGun
|
|
||||||
BLINKERUNSAFE -> unsafeBlinkGun
|
|
||||||
SPAWNER -> error "need to datify creatures first"
|
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ itemBaseName itm = case _itType itm of
|
|||||||
HELD hit -> case hit ^? xNum of
|
HELD hit -> case hit ^? xNum of
|
||||||
Just i -> takeWhile (/= ' ') (show hit) ++ show i
|
Just i -> takeWhile (/= ' ') (show hit) ++ show i
|
||||||
Nothing -> show hit
|
Nothing -> show hit
|
||||||
LEFT lit -> show lit
|
|
||||||
EQUIP eit -> showEquipItem eit
|
EQUIP eit -> showEquipItem eit
|
||||||
CONSUMABLE cit -> show cit
|
CONSUMABLE cit -> show cit
|
||||||
ATTACH ait -> showAttachItem ait itm
|
ATTACH ait -> showAttachItem ait itm
|
||||||
@@ -72,13 +71,6 @@ showEquipItem eit = case eit of
|
|||||||
INVISIBILITYEQUIPMENT esite -> "INVISIBILITY " ++ show esite
|
INVISIBILITYEQUIPMENT esite -> "INVISIBILITY " ++ show esite
|
||||||
_ -> show eit
|
_ -> show eit
|
||||||
|
|
||||||
showAutoRechargeProgress :: LeftConsumption -> String
|
|
||||||
showAutoRechargeProgress lc = case lc of
|
|
||||||
AutoRecharging{}
|
|
||||||
| _arLoaded lc < _arMax lc -> show (_arProgress lc) ++ "C" ++ show (_arLoaded lc)
|
|
||||||
| otherwise -> show (_arLoaded lc)
|
|
||||||
ChargeableAmmo{} -> show (_wpCharge lc)
|
|
||||||
|
|
||||||
itemNumberDisplay :: Creature -> ComposedItem -> [String]
|
itemNumberDisplay :: Creature -> ComposedItem -> [String]
|
||||||
itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
|
itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
|
||||||
(_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
|
(_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
|
||||||
@@ -87,7 +79,7 @@ itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
|
|||||||
_ | hasammo -> [maybe "" shortShow
|
_ | hasammo -> [maybe "" shortShow
|
||||||
$ itm ^? itConsumables . magLoadStatus . iaLoaded]
|
$ itm ^? itConsumables . magLoadStatus . iaLoaded]
|
||||||
(_,UseHeld{},_) -> []
|
(_,UseHeld{},_) -> []
|
||||||
(_,UseHotkey{_leftConsumption=lc},_) -> [showAutoRechargeProgress lc]
|
-- (_,UseHotkey{_leftConsumption=lc},_) -> [showAutoRechargeProgress lc]
|
||||||
(_,UseEquip{},_) -> mempty
|
(_,UseEquip{},_) -> mempty
|
||||||
(_,UseNothing,_) -> []
|
(_,UseNothing,_) -> []
|
||||||
(_,UseConsume {},_) -> []
|
(_,UseConsume {},_) -> []
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ itemSPic :: Item -> SPic
|
|||||||
itemSPic it = case it ^. itType of
|
itemSPic it = case it ^. itType of
|
||||||
CRAFT _ -> defSPic
|
CRAFT _ -> defSPic
|
||||||
HELD ht -> heldItemSPic ht it
|
HELD ht -> heldItemSPic ht it
|
||||||
LEFT lt -> leftItemSPic lt it
|
|
||||||
EQUIP et -> equipItemSPic et it
|
EQUIP et -> equipItemSPic et it
|
||||||
CONSUMABLE{} -> defSPic
|
CONSUMABLE{} -> defSPic
|
||||||
ATTACH{} -> defSPic
|
ATTACH{} -> defSPic
|
||||||
@@ -95,11 +94,6 @@ equipItemSPic et _ = case et of
|
|||||||
backpackShape :: Shape
|
backpackShape :: Shape
|
||||||
backpackShape = upperPrismPolyMT 10 $ rectNSWE 5 (-5) (-4) 4
|
backpackShape = upperPrismPolyMT 10 $ rectNSWE 5 (-5) (-4) 4
|
||||||
|
|
||||||
leftItemSPic :: LeftItemType -> Item -> SPic
|
|
||||||
leftItemSPic lt _ = case lt of
|
|
||||||
BLINKER -> defSPic
|
|
||||||
_ -> defSPic
|
|
||||||
|
|
||||||
--ammoPosition :: Item -> HeldItemType -> AmmoPosition
|
--ammoPosition :: Item -> HeldItemType -> AmmoPosition
|
||||||
--ammoPosition itm hit = case hit of
|
--ammoPosition itm hit = case hit of
|
||||||
-- FLATSHIELD -> NoAmmoPosition
|
-- FLATSHIELD -> NoAmmoPosition
|
||||||
@@ -207,6 +201,11 @@ heldItemSPic ht it = case ht of
|
|||||||
LAUNCHERX _ -> launcherPic it
|
LAUNCHERX _ -> launcherPic it
|
||||||
POISONSPRAYER -> flamerPic it
|
POISONSPRAYER -> flamerPic it
|
||||||
DRONELAUNCHER -> defSPic
|
DRONELAUNCHER -> defSPic
|
||||||
|
BLINKER -> defSPic
|
||||||
|
BLINKERUNSAFE -> defSPic
|
||||||
|
REWINDER -> defSPic
|
||||||
|
TIMESTOPPER -> defSPic
|
||||||
|
TIMESCROLLER -> defSPic
|
||||||
SHATTERGUN -> shatterGunSPic
|
SHATTERGUN -> shatterGunSPic
|
||||||
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
|
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
|
||||||
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi / 2.5) keyPic)
|
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi / 2.5) keyPic)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
module Dodge.Item.Equipment (
|
module Dodge.Item.Equipment (
|
||||||
module Dodge.Item.Equipment.Booster,
|
|
||||||
magShield,
|
magShield,
|
||||||
powerLegs,
|
powerLegs,
|
||||||
wristInvisibility,
|
wristInvisibility,
|
||||||
@@ -22,7 +21,6 @@ import Dodge.Item.Weapon.Bullet
|
|||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Item.Equipment.Booster
|
|
||||||
import LensHelp
|
import LensHelp
|
||||||
|
|
||||||
magShield :: Item
|
magShield :: Item
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
module Dodge.Item.Equipment.Booster (
|
|
||||||
boosterGun,
|
|
||||||
) where
|
|
||||||
|
|
||||||
import Control.Lens
|
|
||||||
import Dodge.Data.Item
|
|
||||||
import Dodge.Default.Item
|
|
||||||
|
|
||||||
boosterGun :: Item
|
|
||||||
boosterGun =
|
|
||||||
defaultLeftItem
|
|
||||||
& itUse . leftUse .~ LBoost
|
|
||||||
& itUse . leftDelay .~ NoDelay
|
|
||||||
& itType .~ LEFT BOOSTER
|
|
||||||
@@ -86,9 +86,10 @@ getAmmoLinks itm =
|
|||||||
|
|
||||||
itemToFunction :: Item -> ItemStructuralFunction
|
itemToFunction :: Item -> ItemStructuralFunction
|
||||||
itemToFunction itm = case itm ^. itType of
|
itemToFunction itm = case itm ^. itType of
|
||||||
HELD DETECTOR{} -> GadgetPlatformSF
|
|
||||||
HELD LASER -> WeaponTargetingSF
|
HELD LASER -> WeaponTargetingSF
|
||||||
HELD{} -> HeldPlatformSF
|
HELD{} -> case itm ^? itUse . useCondition of
|
||||||
|
Just MustBeHeld -> HeldPlatformSF
|
||||||
|
_ -> GadgetPlatformSF
|
||||||
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itConsumables . magType
|
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itConsumables . magType
|
||||||
ATTACH REMOTESCREEN -> RemoteScreenSF
|
ATTACH REMOTESCREEN -> RemoteScreenSF
|
||||||
ATTACH BULLETSYNTH -> AmmoModifierSF BulletAmmo
|
ATTACH BULLETSYNTH -> AmmoModifierSF BulletAmmo
|
||||||
@@ -99,7 +100,6 @@ itemToFunction itm = case itm ^. itType of
|
|||||||
BULLETMOD BulletModPayload{} -> AmmoPayloadSF BulletAmmo
|
BULLETMOD BulletModPayload{} -> AmmoPayloadSF BulletAmmo
|
||||||
BULLETMOD BulletModEffect{} -> AmmoEffectSF BulletAmmo
|
BULLETMOD BulletModEffect{} -> AmmoEffectSF BulletAmmo
|
||||||
TARGETING{} -> WeaponTargetingSF
|
TARGETING{} -> WeaponTargetingSF
|
||||||
LEFT{} -> EquipmentPlatformSF
|
|
||||||
EQUIP WRIST_ECG -> TriggerSF
|
EQUIP WRIST_ECG -> TriggerSF
|
||||||
EQUIP{} -> EquipmentPlatformSF
|
EQUIP{} -> EquipmentPlatformSF
|
||||||
_ -> UncomposableIsolateSF
|
_ -> UncomposableIsolateSF
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ module Dodge.Item.Held (
|
|||||||
module Dodge.Item.Held.BatteryGuns,
|
module Dodge.Item.Held.BatteryGuns,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Item.Weapon.Utility
|
||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
import Dodge.Item.Held.Launcher
|
import Dodge.Item.Held.Launcher
|
||||||
import Dodge.Item.Held.BatteryGuns
|
import Dodge.Item.Held.BatteryGuns
|
||||||
@@ -24,6 +25,11 @@ import Dodge.Item.Held.SprayGuns
|
|||||||
|
|
||||||
itemFromHeldType :: HeldItemType -> Item
|
itemFromHeldType :: HeldItemType -> Item
|
||||||
itemFromHeldType ht = case ht of
|
itemFromHeldType ht = case ht of
|
||||||
|
REWINDER -> rewinder
|
||||||
|
TIMESTOPPER -> timeStopper
|
||||||
|
TIMESCROLLER -> timeScroller
|
||||||
|
BLINKERUNSAFE -> unsafeBlinker
|
||||||
|
BLINKER -> blinker
|
||||||
KEYCARD i -> keyCard i
|
KEYCARD i -> keyCard i
|
||||||
TORCH -> torch
|
TORCH -> torch
|
||||||
SHATTERGUN -> shatterGun
|
SHATTERGUN -> shatterGun
|
||||||
@@ -64,5 +70,5 @@ itemFromHeldType ht = case ht of
|
|||||||
-- REMOTELAUNCHER -> remoteLauncher
|
-- REMOTELAUNCHER -> remoteLauncher
|
||||||
POISONSPRAYER -> poisonSprayer
|
POISONSPRAYER -> poisonSprayer
|
||||||
DRONELAUNCHER -> undefined
|
DRONELAUNCHER -> undefined
|
||||||
DETECTOR d -> clickDetector d
|
DETECTOR d -> detector d
|
||||||
FLATSHIELD -> flatShield
|
FLATSHIELD -> flatShield
|
||||||
|
|||||||
@@ -32,9 +32,10 @@ torch =
|
|||||||
{- |
|
{- |
|
||||||
Sends out pulses that display walls.
|
Sends out pulses that display walls.
|
||||||
-}
|
-}
|
||||||
clickDetector :: Detector -> Item
|
detector :: Detector -> Item
|
||||||
clickDetector dt =
|
detector dt =
|
||||||
defaultHeldItem
|
defaultHeldItem
|
||||||
|
& itUse . useCondition .~ UseableAnytime
|
||||||
& itUse . heldDelay . rateMax .~ 20
|
& itUse . heldDelay . rateMax .~ 20
|
||||||
& itUse . heldAim . aimRange .~ 1
|
& itUse . heldAim . aimRange .~ 1
|
||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
|
||||||
|
|||||||
+8
-14
@@ -23,7 +23,6 @@ itmSpaceInfo itm = case itInvHeight itm of
|
|||||||
itmBaseInfo :: Item -> String
|
itmBaseInfo :: Item -> String
|
||||||
itmBaseInfo itm = case itm ^. itType of
|
itmBaseInfo itm = case itm ^. itType of
|
||||||
HELD hit -> heldInfo hit
|
HELD hit -> heldInfo hit
|
||||||
LEFT lit -> leftInfo lit
|
|
||||||
EQUIP eit -> equipInfo eit
|
EQUIP eit -> equipInfo eit
|
||||||
CONSUMABLE cit -> consumableInfo cit
|
CONSUMABLE cit -> consumableInfo cit
|
||||||
CRAFT fit -> craftInfo fit
|
CRAFT fit -> craftInfo fit
|
||||||
@@ -48,6 +47,8 @@ showInt i = case i of
|
|||||||
|
|
||||||
heldInfo :: HeldItemType -> String
|
heldInfo :: HeldItemType -> String
|
||||||
heldInfo hit = case hit of
|
heldInfo hit = case hit of
|
||||||
|
BLINKERUNSAFE -> "A device that allows local teleportation. Potentially hazardous around walls."
|
||||||
|
BLINKER -> "A device that allows local teleportation."
|
||||||
BANGSTICK 1 -> "A firearm with a short barrel that requires reloading after each shot."
|
BANGSTICK 1 -> "A firearm with a short barrel that requires reloading after each shot."
|
||||||
BANGSTICK i -> over _head toUpper (showInt i) ++ " small gun barrels strapped together. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously, with significant spread."
|
BANGSTICK i -> over _head toUpper (showInt i) ++ " small gun barrels strapped together. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously, with significant spread."
|
||||||
PISTOL -> "A small firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
PISTOL -> "A small firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||||
@@ -90,16 +91,9 @@ heldInfo hit = case hit of
|
|||||||
TORCH -> "A stick with a light on the end."
|
TORCH -> "A stick with a light on the end."
|
||||||
FLATSHIELD -> "A panel of metal that blocks unwanted objects from the front of the user."
|
FLATSHIELD -> "A panel of metal that blocks unwanted objects from the front of the user."
|
||||||
KEYCARD i -> "A keycard. It is labelled " ++ show i ++ "."
|
KEYCARD i -> "A keycard. It is labelled " ++ show i ++ "."
|
||||||
|
TIMESTOPPER -> "A device that temporarily pauses time."
|
||||||
leftInfo :: LeftItemType -> String
|
REWINDER -> "A device that rewinds time a short amount."
|
||||||
leftInfo lit = case lit of
|
TIMESCROLLER -> "A device that can be used to scroll through recent events."
|
||||||
BOOSTER -> "A device that allows travel at speed."
|
|
||||||
STOPWATCH -> "A device that temporarily pauses time."
|
|
||||||
REWINDWATCH -> "A device that rewinds time a short amount."
|
|
||||||
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."
|
|
||||||
SPAWNER -> "A device that spawns creatures."
|
|
||||||
|
|
||||||
equipInfo :: EquipItemType -> String
|
equipInfo :: EquipItemType -> String
|
||||||
equipInfo eit = case eit of
|
equipInfo eit = case eit of
|
||||||
@@ -197,9 +191,9 @@ detectorInfo d = case d of
|
|||||||
itmUsageInfo :: Item -> String
|
itmUsageInfo :: Item -> String
|
||||||
itmUsageInfo itm = case itm ^. itType of
|
itmUsageInfo itm = case itm ^. itType of
|
||||||
HELD _ -> heldPositionInfo itm
|
HELD _ -> heldPositionInfo itm
|
||||||
LEFT _ ->
|
-- LEFT _ ->
|
||||||
"This item can be equipped" ++ itmEquipSiteInfo itm
|
-- "This item can be equipped" ++ itmEquipSiteInfo itm
|
||||||
++ ". When equipped, it can be activated."
|
-- ++ ". When equipped, it can be activated."
|
||||||
EQUIP _ -> "This item can be equipped " ++ itmEquipSiteInfo itm ++ "."
|
EQUIP _ -> "This item can be equipped " ++ itmEquipSiteInfo itm ++ "."
|
||||||
CONSUMABLE _ -> "This item can be consumed."
|
CONSUMABLE _ -> "This item can be consumed."
|
||||||
CRAFT _ -> ""
|
CRAFT _ -> ""
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ module Dodge.Item.Weapon.TriggerType (
|
|||||||
-- withPositionWallCheck,
|
-- withPositionWallCheck,
|
||||||
-- withPosDirWallCheck,
|
-- withPosDirWallCheck,
|
||||||
--withWarmUp,
|
--withWarmUp,
|
||||||
hammerCheckL,
|
-- hammerCheckL,
|
||||||
shootL,
|
-- shootL,
|
||||||
useTimeCheck,
|
useTimeCheck,
|
||||||
-- ammoCheckI,
|
-- ammoCheckI,
|
||||||
-- modClock,
|
-- modClock,
|
||||||
@@ -79,8 +79,8 @@ lockInvFor i f it cr =
|
|||||||
-- pos = addZ 0 $ _crPos cr +.+ (_crRad cr + 15) *.* unitVectorAtAngle dir
|
-- pos = addZ 0 $ _crPos cr +.+ (_crRad cr + 15) *.* unitVectorAtAngle dir
|
||||||
-- ps = replicateM 20 randOnUnitSphere & evalState $ _randGen w
|
-- ps = replicateM 20 randOnUnitSphere & evalState $ _randGen w
|
||||||
|
|
||||||
itUseCharge :: Int -> Item -> Item
|
--itUseCharge :: Int -> Item -> Item
|
||||||
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
--itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
||||||
|
|
||||||
--{- | Fires at an increasing rate.
|
--{- | Fires at an increasing rate.
|
||||||
--Has different effect after first fire.
|
--Has different effect after first fire.
|
||||||
@@ -145,41 +145,41 @@ useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
|
|||||||
itRef = item ^?! ldtValue . itLocation . ilInvID
|
itRef = item ^?! ldtValue . itLocation . ilInvID
|
||||||
userate = fromMaybe 0 $ item ^? ldtValue . itUse . heldDelay . rateMax
|
userate = fromMaybe 0 $ item ^? ldtValue . itUse . heldDelay . rateMax
|
||||||
|
|
||||||
{- | Applies a world effect after a hammer position check.
|
--{- | Applies a world effect after a hammer position check.
|
||||||
Arbitrary inventory position.
|
--Arbitrary inventory position.
|
||||||
-}
|
---}
|
||||||
hammerCheckL ::
|
--hammerCheckL ::
|
||||||
-- | Underlying effect
|
-- -- | Underlying effect
|
||||||
(Item -> Creature -> World -> World) ->
|
-- (Item -> Creature -> World -> World) ->
|
||||||
Item ->
|
-- Item ->
|
||||||
Creature ->
|
-- Creature ->
|
||||||
World ->
|
-- World ->
|
||||||
World
|
-- World
|
||||||
hammerCheckL f itm cr w = case itm ^? itUse . leftHammer of
|
--hammerCheckL f itm cr w = case itm ^? itUse . leftHammer of
|
||||||
Just HammerUp -> f itm cr w
|
-- Just HammerUp -> f itm cr w
|
||||||
_ -> w
|
-- _ -> w
|
||||||
|
|
||||||
{- | Applies a world effect after an ammo check.
|
--{- | Applies a world effect after an ammo check.
|
||||||
Arbitrary inventory position -- cannot be replaced with ammoUseCheck.
|
--Arbitrary inventory position -- cannot be replaced with ammoUseCheck.
|
||||||
-}
|
---}
|
||||||
shootL ::
|
--shootL ::
|
||||||
-- | Underlying effect
|
-- -- | Underlying effect
|
||||||
(Item -> Creature -> World -> World) ->
|
-- (Item -> Creature -> World -> World) ->
|
||||||
Item ->
|
-- Item ->
|
||||||
Creature ->
|
-- Creature ->
|
||||||
World ->
|
-- World ->
|
||||||
World
|
-- World
|
||||||
shootL f item cr w
|
--shootL f item cr w
|
||||||
| fireCondition =
|
-- | fireCondition =
|
||||||
f item cr w & cWorld . lWorld . creatures . ix cid . crInv . ix invid
|
-- f item cr w & cWorld . lWorld . creatures . ix cid . crInv . ix invid
|
||||||
%~ ( itUseCharge 1
|
-- %~ ( itUseCharge 1
|
||||||
. (itUse . leftDelay . rateTime .~ _rateMax (_leftDelay (_itUse item)))
|
-- . (itUse . leftDelay . rateTime .~ _rateMax (_leftDelay (_itUse item)))
|
||||||
)
|
-- )
|
||||||
-- | reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
-- -- | reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
||||||
| otherwise = w
|
-- | otherwise = w
|
||||||
where
|
-- where
|
||||||
cid = _crID cr
|
-- cid = _crID cr
|
||||||
invid = _ilInvID $ _itLocation item
|
-- invid = _ilInvID $ _itLocation item
|
||||||
fireCondition =
|
-- fireCondition =
|
||||||
_rateTime (_leftDelay (_itUse item)) == 0
|
-- _rateTime (_leftDelay (_itUse item)) == 0
|
||||||
&& _arLoaded (_leftConsumption (_itUse item)) > 0
|
-- && _arLoaded (_leftConsumption (_itUse item)) > 0
|
||||||
|
|||||||
@@ -1,57 +1,51 @@
|
|||||||
module Dodge.Item.Weapon.Utility
|
module Dodge.Item.Weapon.Utility
|
||||||
( stopWatch
|
( timeStopper
|
||||||
, rewindWatch
|
, rewinder
|
||||||
, scrollWatch
|
, timeScroller
|
||||||
, blinkGun
|
, blinker
|
||||||
, unsafeBlinkGun
|
, unsafeBlinker
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
|
|
||||||
stopWatch :: Item
|
|
||||||
stopWatch =
|
|
||||||
defaultLeftItem
|
|
||||||
& itUse
|
|
||||||
.~ ( defaultLeftUse
|
|
||||||
& leftUse .~ LTimePause
|
|
||||||
& uequipEffect . eeSite .~ GoesOnWrist
|
|
||||||
)
|
|
||||||
& itEffect . ieInv .~ ChargeIfEquipped
|
|
||||||
& itEffect . ieOnDrop .~ SetCharge 0
|
|
||||||
& itType .~ LEFT STOPWATCH
|
|
||||||
& itUse . leftConsumption
|
|
||||||
.~ ChargeableAmmo
|
|
||||||
{ _wpMaxCharge = 100
|
|
||||||
, _wpCharge = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollWatch :: Item
|
blinker :: Item
|
||||||
scrollWatch =
|
blinker =
|
||||||
stopWatch
|
defaultHeldItem
|
||||||
& itUse . leftUse .~ LTimeScroll
|
& itUse . useCondition .~ UseableAnytime
|
||||||
& itType .~ LEFT SCROLLWATCH
|
& itUse . heldDelay . rateMax .~ 20
|
||||||
|
& itUse . heldAim . aimRange .~ 1
|
||||||
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
|
||||||
|
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||||
|
& itUse . heldParams .~ DefaultHeldParams
|
||||||
|
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleBlink
|
||||||
|
& itUse . heldAim . aimMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 10000000
|
||||||
|
& itType .~ HELD BLINKER
|
||||||
|
|
||||||
rewindWatch :: Item
|
unsafeBlinker :: Item
|
||||||
rewindWatch =
|
unsafeBlinker =
|
||||||
stopWatch
|
blinker
|
||||||
& itUse . leftUse .~ LRewind --useRewindGun
|
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleUnsafeBlink
|
||||||
& itType .~ LEFT REWINDWATCH
|
& itType .~ HELD BLINKERUNSAFE
|
||||||
|
-- & itUse . uequipEffect . eeViewDist ?~ 400
|
||||||
|
|
||||||
blinkGun :: Item
|
rewinder :: Item
|
||||||
blinkGun =
|
rewinder =
|
||||||
defaultLeftItem
|
blinker
|
||||||
{ _itUse =
|
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleRewind
|
||||||
defaultLeftUse
|
& itType .~ HELD REWINDER
|
||||||
& leftUse .~ LBlink
|
& itUse . heldAim . aimMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100000
|
||||||
& uequipEffect . eeSite .~ GoesOnWrist
|
|
||||||
}
|
|
||||||
& itType .~ LEFT BLINKER
|
|
||||||
|
|
||||||
unsafeBlinkGun :: Item
|
timeStopper :: Item
|
||||||
unsafeBlinkGun =
|
timeStopper =
|
||||||
blinkGun
|
blinker
|
||||||
& itType .~ LEFT BLINKERUNSAFE
|
& itType .~ HELD TIMESTOPPER
|
||||||
& itUse . leftUse .~ LUnsafeBlink
|
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleStopper
|
||||||
& itUse . uequipEffect . eeViewDist ?~ 400
|
|
||||||
|
timeScroller :: Item
|
||||||
|
timeScroller =
|
||||||
|
timeStopper
|
||||||
|
& itType .~ HELD TIMESCROLLER
|
||||||
|
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleScroller
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ lockRoomMultiItems =
|
|||||||
[
|
[
|
||||||
( blinkAcrossChallenge
|
( blinkAcrossChallenge
|
||||||
, takeOne
|
, takeOne
|
||||||
[ [LEFT BLINKERUNSAFE, HELD $ DETECTOR WALLDETECTOR]
|
[ [HELD BLINKERUNSAFE, HELD $ DETECTOR WALLDETECTOR]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|||||||
+20
-86
@@ -1,28 +1,28 @@
|
|||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
module Dodge.Luse (
|
module Dodge.Luse (
|
||||||
useL,
|
-- useL,
|
||||||
|
useRewindGun,
|
||||||
|
useStopWatch,
|
||||||
|
useTimeScrollGun
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Dodge.Creature.Action
|
import NewInt
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.Item.Weapon.TriggerType
|
--import Dodge.Item.Weapon.TriggerType
|
||||||
import LensHelp
|
import LensHelp
|
||||||
|
|
||||||
useL :: Luse -> Item -> Creature -> World -> World
|
--useL :: Luse -> Item -> Creature -> World -> World
|
||||||
useL = \case
|
--useL = \case
|
||||||
LDoNothing -> const $ const id
|
-- LDoNothing -> const $ const id
|
||||||
LRewind -> useRewindGun
|
-- LRewind -> useRewindGun
|
||||||
LTimePause -> hammerCheckL useStopWatch
|
-- LTimePause -> hammerCheckL useStopWatch
|
||||||
LTimeScroll -> hammerCheckL useTimeScrollGun
|
-- LTimeScroll -> hammerCheckL useTimeScrollGun
|
||||||
LBlink -> hammerCheckL (shootL $ const blinkActionMousePos)
|
|
||||||
LUnsafeBlink -> hammerCheckL (shootL $ const unsafeBlinkAction)
|
|
||||||
LBoost -> boostSelfL 10
|
|
||||||
|
|
||||||
useStopWatch :: Item -> Creature -> World -> World
|
useStopWatch :: Item -> Creature -> World -> World
|
||||||
useStopWatch itm _ =
|
useStopWatch itm _ =
|
||||||
timeFlow
|
timeFlow
|
||||||
.~ PausedTimeFlow
|
.~ PausedTimeFlow
|
||||||
{ _timeFlowCharge = itm ^?! itUse . leftConsumption . wpCharge
|
{ _timeFlowCharge = 100
|
||||||
, _scrollItemID = _itID itm
|
, _scrollItemID = _itID itm
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,17 +31,19 @@ useTimeScrollGun itm _ =
|
|||||||
timeFlow
|
timeFlow
|
||||||
.~ ItemScrollTimeFlow
|
.~ ItemScrollTimeFlow
|
||||||
{ _scrollSmoothing = 0
|
{ _scrollSmoothing = 0
|
||||||
, _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge
|
--, _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge
|
||||||
|
, _reverseAmount = 100
|
||||||
, _futureWorlds = []
|
, _futureWorlds = []
|
||||||
, _scrollItemID = _itID itm
|
, _scrollItemID = _itID itm
|
||||||
}
|
}
|
||||||
|
|
||||||
useRewindGun :: Item -> Creature -> World -> World
|
useRewindGun :: NewInt ItmInt -> World -> World
|
||||||
useRewindGun itm _ =
|
useRewindGun i =
|
||||||
timeFlow
|
timeFlow
|
||||||
.~ RewindLeftClick
|
.~ RewindLeftClick
|
||||||
{ _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge
|
-- { _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge
|
||||||
, _scrollItemID = _itID itm
|
{ _reverseAmount = 100
|
||||||
|
, _scrollItemID = i
|
||||||
}
|
}
|
||||||
|
|
||||||
--useRewindGun _ _ w = case w ^. cwTime . rewindWorlds of
|
--useRewindGun _ _ w = case w ^. cwTime . rewindWorlds of
|
||||||
@@ -52,71 +54,3 @@ useRewindGun itm _ =
|
|||||||
-- & cwTime . rewindWorlds .~ ws
|
-- & cwTime . rewindWorlds .~ ws
|
||||||
-- _ -> w
|
-- _ -> w
|
||||||
|
|
||||||
boostSelfL ::
|
|
||||||
-- | boost amount
|
|
||||||
Float ->
|
|
||||||
Item ->
|
|
||||||
Creature ->
|
|
||||||
World ->
|
|
||||||
World
|
|
||||||
boostSelfL = undefined
|
|
||||||
|
|
||||||
--boostSelfL x itm cr w = case boostPoint x cr w of
|
|
||||||
-- Left p -> crEff p (itUse . leftConsumption . arLoaded .~ 0)
|
|
||||||
-- Right p -> crEff p (itUse . leftConsumption . arLoaded -~ 1)
|
|
||||||
-- where
|
|
||||||
-- invid = _ipInvID $ _itLocation itm
|
|
||||||
-- cid = _crID cr
|
|
||||||
-- cpos = _crPos cr
|
|
||||||
-- r = _crRad cr
|
|
||||||
-- pid =
|
|
||||||
-- fromMaybe
|
|
||||||
-- (IM.newKey $ _props (_cWorld w))
|
|
||||||
-- (cr ^? crInv . ix invid . itAttachment . atInt)
|
|
||||||
-- crEff p ammoEff =
|
|
||||||
-- addBoostShockwave pid p (r *.* normalizeV (p -.- cpos)) w
|
|
||||||
-- & cWorld . creatures . ix cid
|
|
||||||
-- %~ (crPos .~ p)
|
|
||||||
-- . ( crInv . ix invid
|
|
||||||
-- %~ ammoEff
|
|
||||||
-- . (itEffect . ieCounter .~ 1)
|
|
||||||
-- . (itAttachment .~ AttachInt pid)
|
|
||||||
-- )
|
|
||||||
|
|
||||||
---- | Move a creature towards the mouse position, with shockwave
|
|
||||||
--boostPoint ::
|
|
||||||
-- -- | boost amount
|
|
||||||
-- Float ->
|
|
||||||
-- Creature ->
|
|
||||||
-- World ->
|
|
||||||
-- Either Point2 Point2
|
|
||||||
--boostPoint x cr w = case mayp2 of
|
|
||||||
-- Nothing -> Right p1
|
|
||||||
-- Just p2 -> Left $ mvPointTowardAtSpeed r cpos $ fst p2
|
|
||||||
-- where
|
|
||||||
-- cpos = _crPos cr
|
|
||||||
-- r = 1.5 * _crRad cr
|
|
||||||
-- p1 = cpos +.+ x *.* squashNormalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- cpos)
|
|
||||||
-- mayp2 = bouncePoint (const True) 1 cpos p1 w
|
|
||||||
|
|
||||||
--addBoostShockwave ::
|
|
||||||
-- Int ->
|
|
||||||
-- Point2 ->
|
|
||||||
-- Point2 ->
|
|
||||||
-- World ->
|
|
||||||
-- World
|
|
||||||
--addBoostShockwave pjid p v w =
|
|
||||||
-- w & cWorld . lWorld . linearShockwaves
|
|
||||||
-- %~ IM.insertWith f pjid thePJ
|
|
||||||
-- where
|
|
||||||
-- thePJ =
|
|
||||||
-- LinearShockwave
|
|
||||||
-- { _lwPos = p
|
|
||||||
-- , _lwID = pjid
|
|
||||||
-- , _lwPoints = [(p, v)]
|
|
||||||
-- , _lwTimer = maxT
|
|
||||||
-- }
|
|
||||||
-- f newVal oldVal = newVal & lwPoints %~ (++ _lwPoints oldVal)
|
|
||||||
|
|
||||||
--maxT :: Int
|
|
||||||
--maxT = 20
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{-# OPTIONS_GHC -Wno-unused-imports #-}
|
{-# OPTIONS_GHC -Wno-unused-imports #-}
|
||||||
module Dodge.TestString where
|
module Dodge.TestString where
|
||||||
|
|
||||||
|
import qualified SDL as SDL
|
||||||
import Linear
|
import Linear
|
||||||
import Dodge.ListDisplayParams
|
import Dodge.ListDisplayParams
|
||||||
import Dodge.SelectionSections
|
import Dodge.SelectionSections
|
||||||
@@ -22,11 +23,11 @@ import qualified Data.Aeson.Encode.Pretty as AEP
|
|||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Dodge.Data.Universe
|
import Dodge.Data.Universe
|
||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
|
import qualified Data.Map.Strict as M
|
||||||
|
|
||||||
testStringInit :: Universe -> [String]
|
testStringInit :: Universe -> [String]
|
||||||
testStringInit u =
|
testStringInit u =
|
||||||
[show $ u ^? uvWorld . hud . hudElement . diSections . ix (-1) . ssItems . ix 0 . siWidth
|
(map show $ M.toList $ u ^. uvWorld . input . pressedKeys)
|
||||||
]
|
|
||||||
-- fromMaybe mempty $ do
|
-- fromMaybe mempty $ do
|
||||||
-- cr <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0
|
-- cr <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0
|
||||||
-- let itms = IM.elems $ cr ^. crInv
|
-- let itms = IM.elems $ cr ^. crInv
|
||||||
|
|||||||
+19
-14
@@ -25,7 +25,7 @@ import Dodge.DrWdWd
|
|||||||
import Dodge.EnergyBall
|
import Dodge.EnergyBall
|
||||||
import Dodge.Flame
|
import Dodge.Flame
|
||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
import Dodge.Item.Location
|
--import Dodge.Item.Location
|
||||||
import Dodge.Laser.Update
|
import Dodge.Laser.Update
|
||||||
import Dodge.LinearShockwave.Update
|
import Dodge.LinearShockwave.Update
|
||||||
import Dodge.ListDisplayParams
|
import Dodge.ListDisplayParams
|
||||||
@@ -188,13 +188,15 @@ timeFlowUpdate u = case u ^. uvWorld . timeFlow of
|
|||||||
PausedTimeFlow _ itmloc -> over uvWorld (pauseTime itmloc) u
|
PausedTimeFlow _ itmloc -> over uvWorld (pauseTime itmloc) u
|
||||||
|
|
||||||
pauseTime :: NewInt ItmInt -> World -> World
|
pauseTime :: NewInt ItmInt -> World -> World
|
||||||
pauseTime itmloc w
|
--pauseTime itmloc w
|
||||||
| justPressedButtonLeft || outofcharge = w & timeFlow .~ NormalTimeFlow
|
pauseTime _ w
|
||||||
| otherwise = w & pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix (_unNInt itmloc)) . itUse . leftConsumption . wpCharge -~ 1
|
-- | justPressedButtonLeft || outofcharge = w & timeFlow .~ NormalTimeFlow
|
||||||
|
| justPressedButtonLeft = w & timeFlow .~ NormalTimeFlow
|
||||||
|
| otherwise = w -- & pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix (_unNInt itmloc)) . itUse . leftConsumption . wpCharge -~ 1
|
||||||
where
|
where
|
||||||
justPressedButtonLeft = w ^? input . mouseButtons . ix ButtonLeft == Just 0
|
justPressedButtonLeft = w ^? input . mouseButtons . ix ButtonLeft == Just 0
|
||||||
outofcharge = maybe True (== 0) charge
|
-- outofcharge = maybe True (== 0) charge
|
||||||
charge = w ^? pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix (_unNInt itmloc)) . itUse . leftConsumption . wpCharge
|
-- charge = w ^? pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix (_unNInt itmloc)) . itUse . leftConsumption . wpCharge
|
||||||
|
|
||||||
doItemTimeScroll :: Int -> World -> World
|
doItemTimeScroll :: Int -> World -> World
|
||||||
doItemTimeScroll smoothing w = case w ^? input . mouseButtons . ix ButtonLeft of
|
doItemTimeScroll smoothing w = case w ^? input . mouseButtons . ix ButtonLeft of
|
||||||
@@ -224,12 +226,14 @@ scrollTimeBack w = case w ^? pastWorlds . _head of
|
|||||||
& mupdateitem x
|
& mupdateitem x
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
mupdateitem x = fromMaybe id $ do
|
--mupdateitem x = fromMaybe id $ do
|
||||||
i <- w ^? timeFlow . scrollItemID . unNInt
|
mupdateitem _ = fromMaybe id $ do
|
||||||
let pointituse = pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse
|
--i <- w ^? timeFlow . scrollItemID . unNInt
|
||||||
return $
|
_ <- w ^? timeFlow . scrollItemID . unNInt
|
||||||
(pointituse . leftConsumption . wpCharge .~ (x -1))
|
-- let pointituse = pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse
|
||||||
. (pointituse . leftHammer .~ HammerDown)
|
return $ id
|
||||||
|
-- (pointituse . leftConsumption . wpCharge .~ (x -1))
|
||||||
|
-- . (pointituse . leftHammer .~ HammerDown)
|
||||||
|
|
||||||
scrollTimeForward :: World -> World
|
scrollTimeForward :: World -> World
|
||||||
scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
|
scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
|
||||||
@@ -243,8 +247,9 @@ scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
|
|||||||
where
|
where
|
||||||
ramount = (w ^?! timeFlow . reverseAmount) + 1
|
ramount = (w ^?! timeFlow . reverseAmount) + 1
|
||||||
mupdateitem = fromMaybe id $ do
|
mupdateitem = fromMaybe id $ do
|
||||||
i <- w ^? timeFlow . scrollItemID . unNInt
|
--i <- w ^? timeFlow . scrollItemID . unNInt
|
||||||
return $ pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse . leftConsumption . wpCharge .~ ramount
|
_ <- w ^? timeFlow . scrollItemID . unNInt
|
||||||
|
return $ id -- pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse . leftConsumption . wpCharge .~ ramount
|
||||||
|
|
||||||
-- | The update step.
|
-- | The update step.
|
||||||
functionalUpdate :: Universe -> Universe
|
functionalUpdate :: Universe -> Universe
|
||||||
|
|||||||
Reference in New Issue
Block a user