Remove functions from left use item use field
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Creature.Impulse.UseItem
|
|||||||
, useLeftItem
|
, useLeftItem
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Luse
|
||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
import Dodge.Reloading
|
import Dodge.Reloading
|
||||||
import Dodge.Item.Location
|
import Dodge.Item.Location
|
||||||
@@ -104,7 +105,7 @@ useLeftItem cid w
|
|||||||
f <- cr ^? crInv . ix invid . itUse . lUse
|
f <- cr ^? crInv . ix invid . itUse . lUse
|
||||||
return
|
return
|
||||||
. (runIdentity . pointToItem (_itPos itm) (return . (itUse . useHammer .~ HammerDown)))
|
. (runIdentity . pointToItem (_itPos itm) (return . (itUse . useHammer .~ HammerDown)))
|
||||||
. f itm cr
|
. useL f itm cr
|
||||||
$ w
|
$ w
|
||||||
where
|
where
|
||||||
cr = _creatures w IM.! cid
|
cr = _creatures w IM.! cid
|
||||||
|
|||||||
+1
-1
@@ -410,7 +410,7 @@ data ItemUse
|
|||||||
, _heldScroll :: HeldScroll --Float -> Creature -> Item -> Item
|
, _heldScroll :: HeldScroll --Float -> Creature -> Item -> Item
|
||||||
}
|
}
|
||||||
| LeftUse
|
| LeftUse
|
||||||
{ _lUse :: Item -> Creature -> World -> World
|
{ _lUse :: Luse --Item -> Creature -> World -> World
|
||||||
, _useDelay :: UseDelay
|
, _useDelay :: UseDelay
|
||||||
, _useHammer :: HammerPosition
|
, _useHammer :: HammerPosition
|
||||||
, _eqEq :: Equipment
|
, _eqEq :: Equipment
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ data HeldUse = HeldDoNothing
|
|||||||
| HeldForceField
|
| HeldForceField
|
||||||
| HeldShatter
|
| HeldShatter
|
||||||
|
|
||||||
|
data Luse = LDoNothing
|
||||||
|
| LRewind
|
||||||
|
| LShrink
|
||||||
|
| LBlink
|
||||||
|
| LUnsafeBlink
|
||||||
|
| LBoost
|
||||||
|
|
||||||
data HeldMod = HeldModNothing
|
data HeldMod = HeldModNothing
|
||||||
| PoisonSprayerMod
|
| PoisonSprayerMod
|
||||||
| FlameSpitterMod
|
| FlameSpitterMod
|
||||||
|
|||||||
@@ -28,35 +28,6 @@ defaultBulletLoadable = defaultLoadable & laAmmoType .~ basicBullet
|
|||||||
defaultChargeable :: ItemConsumption
|
defaultChargeable :: ItemConsumption
|
||||||
defaultChargeable = ChargeableAmmo 100 100
|
defaultChargeable = ChargeableAmmo 100 100
|
||||||
|
|
||||||
--ruseRate :: Int
|
|
||||||
-- -> (Item -> Creature -> World -> World)
|
|
||||||
-- -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
|
|
||||||
-- -> ItemUse
|
|
||||||
--ruseRate i f usemods = RightUse
|
|
||||||
-- { _rUse = f
|
|
||||||
-- , _useDelay = FixedRate
|
|
||||||
-- { _rateMax = i
|
|
||||||
-- , _rateTime = 0
|
|
||||||
-- }
|
|
||||||
-- , _useMods = usemods
|
|
||||||
-- , _useHammer = HammerUp
|
|
||||||
-- , _useAim = defaultAimParams
|
|
||||||
-- , _heldScroll = \_ _ -> id
|
|
||||||
-- }
|
|
||||||
|
|
||||||
--ruseInstant
|
|
||||||
-- :: (Item -> Creature -> World -> World)
|
|
||||||
-- -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
|
|
||||||
-- -> ItemUse
|
|
||||||
--ruseInstant f usemods = RightUse
|
|
||||||
-- { _rUse = f
|
|
||||||
-- , _useDelay = NoDelay
|
|
||||||
-- , _useMods = usemods
|
|
||||||
-- , _useHammer = HammerUp
|
|
||||||
-- , _useAim = defaultAimParams
|
|
||||||
-- , _heldScroll = \_ _ -> id
|
|
||||||
-- }
|
|
||||||
|
|
||||||
defaultrUse :: ItemUse
|
defaultrUse :: ItemUse
|
||||||
defaultrUse = RightUse
|
defaultrUse = RightUse
|
||||||
{ _rUse = HeldDoNothing
|
{ _rUse = HeldDoNothing
|
||||||
@@ -68,7 +39,7 @@ defaultrUse = RightUse
|
|||||||
}
|
}
|
||||||
defaultlUse :: ItemUse
|
defaultlUse :: ItemUse
|
||||||
defaultlUse = LeftUse
|
defaultlUse = LeftUse
|
||||||
{ _lUse = \_ _ -> id
|
{ _lUse = LDoNothing
|
||||||
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
||||||
, _useHammer = HammerUp
|
, _useHammer = HammerUp
|
||||||
, _eqEq = defaultEquip
|
, _eqEq = defaultEquip
|
||||||
@@ -83,7 +54,7 @@ defaultEquip = Equipment
|
|||||||
, _eqViewDist = Nothing
|
, _eqViewDist = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
luseInstantNoH :: (Item -> Creature -> World -> World) -> ItemUse
|
luseInstantNoH :: Luse -> ItemUse
|
||||||
luseInstantNoH f = defaultlUse
|
luseInstantNoH f = defaultlUse
|
||||||
& lUse .~ f
|
& lUse .~ f
|
||||||
& useDelay .~ NoDelay
|
& useDelay .~ NoDelay
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module Dodge.Item.Equipment.Booster
|
module Dodge.Item.Equipment.Booster
|
||||||
( boosterGun
|
( boosterGun
|
||||||
|
, boostSelfL
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
@@ -112,7 +113,7 @@ boosterGun :: Item
|
|||||||
boosterGun = defaultLeftItem
|
boosterGun = defaultLeftItem
|
||||||
{ _itInvColor = cyan
|
{ _itInvColor = cyan
|
||||||
, _itConsumption = defaultChargeable
|
, _itConsumption = defaultChargeable
|
||||||
, _itUse = luseInstantNoH $ boostSelfL 10
|
, _itUse = luseInstantNoH LBoost
|
||||||
, _itEffect = resetAttachmentID
|
, _itEffect = resetAttachmentID
|
||||||
}
|
}
|
||||||
& itType . iyBase .~ LEFT BOOSTER
|
& itType . iyBase .~ LEFT BOOSTER
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ lasCircle = lasGun
|
|||||||
& itUse . useAim . aimWeight .~ 6
|
& itUse . useAim . aimWeight .~ 6
|
||||||
& itUse . useAim . aimRange .~ 1
|
& itUse . useAim . aimRange .~ 1
|
||||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||||
where
|
|
||||||
|
|
||||||
lasWide :: Int -> Item
|
lasWide :: Int -> Item
|
||||||
lasWide n = lasGun
|
lasWide n = lasGun
|
||||||
@@ -114,7 +113,6 @@ lasWide n = lasGun
|
|||||||
& itParams . lasColor .~ yellow
|
& itParams . lasColor .~ yellow
|
||||||
& itParams . lasDamage .~ 2
|
& itParams . lasDamage .~ 2
|
||||||
& itUse . useMods .~ LasWideMod n
|
& itUse . useMods .~ LasWideMod n
|
||||||
where
|
|
||||||
--lasWidePulse :: Item
|
--lasWidePulse :: Item
|
||||||
--lasWidePulse = lasGun
|
--lasWidePulse = lasGun
|
||||||
-- & itType . iyBase .~ LASGUNWIDEPULSE
|
-- & itType . iyBase .~ LASGUNWIDEPULSE
|
||||||
@@ -201,7 +199,6 @@ dualBeam = lasGun
|
|||||||
& itUse . useAim . aimRange .~ 1
|
& itUse . useAim . aimRange .~ 1
|
||||||
& itUse . useAim . aimStance .~ TwoHandFlat
|
& itUse . useAim . aimStance .~ TwoHandFlat
|
||||||
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
|
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
|
||||||
where
|
|
||||||
--lasSwing :: Item
|
--lasSwing :: Item
|
||||||
--lasSwing = lasGun
|
--lasSwing = lasGun
|
||||||
-- & itType . iyBase .~ LASGUNSWING
|
-- & itType . iyBase .~ LASGUNSWING
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ miniGunUse i = defaultrUse
|
|||||||
& rUse .~ HeldUseAmmoParams
|
& rUse .~ HeldUseAmmoParams
|
||||||
& useDelay .~ NoDelay
|
& useDelay .~ NoDelay
|
||||||
& useMods .~ MiniGunMod i
|
& useMods .~ MiniGunMod i
|
||||||
where
|
|
||||||
|
|
||||||
miniGunX :: Int -> Item
|
miniGunX :: Int -> Item
|
||||||
miniGunX i = defaultAutoGun
|
miniGunX i = defaultAutoGun
|
||||||
|
|||||||
@@ -2,13 +2,9 @@ module Dodge.Item.Weapon.Utility where
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Base.Coordinate
|
import Dodge.Base.Coordinate
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
--import Dodge.Picture.Layer
|
|
||||||
import Dodge.Creature.Action
|
|
||||||
import Dodge.Item.Weapon.TriggerType
|
|
||||||
import Dodge.Item.Weapon.ExtraEffect
|
import Dodge.Item.Weapon.ExtraEffect
|
||||||
import Dodge.Wall.ForceField
|
import Dodge.Wall.ForceField
|
||||||
import Dodge.Wall.Move
|
import Dodge.Wall.Move
|
||||||
--import Sound.Data
|
|
||||||
import Geometry
|
import Geometry
|
||||||
import Picture
|
import Picture
|
||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
@@ -16,10 +12,7 @@ import Shape
|
|||||||
import ShapePicture
|
import ShapePicture
|
||||||
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
--import qualified Data.Map.Strict as M
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
--import Control.Monad
|
|
||||||
|
|
||||||
rewindGun :: Item
|
rewindGun :: Item
|
||||||
rewindGun = defaultLeftItem
|
rewindGun = defaultLeftItem
|
||||||
{ _itInvColor = cyan
|
{ _itInvColor = cyan
|
||||||
@@ -29,7 +22,7 @@ rewindGun = defaultLeftItem
|
|||||||
}
|
}
|
||||||
, _itEffect = ItRewindEffect rewindEffect []
|
, _itEffect = ItRewindEffect rewindEffect []
|
||||||
, _itUse = defaultlUse
|
, _itUse = defaultlUse
|
||||||
& lUse .~ useRewindGun
|
& lUse .~ LRewind --useRewindGun
|
||||||
& eqEq . eqSite .~ GoesOnChest
|
& eqEq . eqSite .~ GoesOnChest
|
||||||
}
|
}
|
||||||
& itType . iyBase .~ LEFT REWINDER
|
& itType . iyBase .~ LEFT REWINDER
|
||||||
@@ -46,24 +39,10 @@ rewindEffect itm cr w
|
|||||||
w' = w & rewindWorlds .~ []
|
w' = w & rewindWorlds .~ []
|
||||||
& timeFlow .~ NormalTimeFlow
|
& timeFlow .~ NormalTimeFlow
|
||||||
|
|
||||||
useRewindGun :: Item -> Creature -> World -> World
|
|
||||||
useRewindGun _ _ w = case _rewindWorlds w of
|
|
||||||
[w'] -> rewindusing w' [w']
|
|
||||||
(w':ws) -> rewindusing w' ws
|
|
||||||
_ -> w
|
|
||||||
where
|
|
||||||
rewindusing w' ws = w
|
|
||||||
& maybeWorld .~ Just' ( w'
|
|
||||||
-- & creatures . ix (_crID cr) .~ cr
|
|
||||||
& upbuts
|
|
||||||
& rewindWorlds .~ ws
|
|
||||||
)
|
|
||||||
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
|
|
||||||
|
|
||||||
-- needs to shift this item to the current inventory slot
|
-- needs to shift this item to the current inventory slot
|
||||||
shrinkGun :: Item
|
shrinkGun :: Item
|
||||||
shrinkGun = defaultLeftItem
|
shrinkGun = defaultLeftItem
|
||||||
{_itUse = defaultlUse {_lUse = hammerCheckL useShrinkGun}
|
{_itUse = defaultlUse & lUse .~ LShrink -- hammerCheckL useShrinkGun
|
||||||
-- , _itFloorPict = shrinkGunPic
|
-- , _itFloorPict = shrinkGunPic
|
||||||
, _itAttachment = AttachBool True
|
, _itAttachment = AttachBool True
|
||||||
}
|
}
|
||||||
@@ -72,24 +51,12 @@ shrinkGun = defaultLeftItem
|
|||||||
shrinkGunPic :: Item -> SPic
|
shrinkGunPic :: Item -> SPic
|
||||||
shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
|
shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
|
||||||
|
|
||||||
-- 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 = if _atBool $ _itAttachment it
|
|
||||||
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropExcept cr invid
|
|
||||||
else tryResize 1 $ f True Uncursed . setMinInvSize defaultInvSize cr
|
|
||||||
where
|
|
||||||
invid = _ipInvID $ _itPos it
|
|
||||||
tryResize x g = maybe w g $ sizeSelf x cr w
|
|
||||||
f isInUse cstatus = creatures . ix (_crID cr) . crInv . ix invid %~
|
|
||||||
( (itAttachment . atBool .~ isInUse) . (itCurseStatus .~ cstatus) )
|
|
||||||
|
|
||||||
blinkGun :: Item
|
blinkGun :: Item
|
||||||
blinkGun = defaultLeftItem
|
blinkGun = defaultLeftItem
|
||||||
{ _itInvColor = cyan
|
{ _itInvColor = cyan
|
||||||
, _itUse = defaultlUse
|
, _itUse = defaultlUse
|
||||||
& lUse .~ hammerCheckL (shootL $ const blinkAction)
|
& lUse .~ LBlink --hammerCheckL (shootL $ const blinkAction)
|
||||||
& eqEq . eqSite .~ GoesOnWrist
|
& eqEq . eqSite .~ GoesOnWrist
|
||||||
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
|
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
|
||||||
}
|
}
|
||||||
@@ -98,7 +65,7 @@ blinkGun = defaultLeftItem
|
|||||||
unsafeBlinkGun :: Item
|
unsafeBlinkGun :: Item
|
||||||
unsafeBlinkGun = blinkGun
|
unsafeBlinkGun = blinkGun
|
||||||
& itType . iyBase .~ LEFT BLINKERUNSAFE
|
& itType . iyBase .~ LEFT BLINKERUNSAFE
|
||||||
& itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction)
|
& itUse . lUse .~ LUnsafeBlink --hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||||
& itUse . eqEq . eqViewDist ?~ 400
|
& itUse . eqEq . eqViewDist ?~ 400
|
||||||
|
|
||||||
--effectGun :: String -> (Creature -> World -> World) -> Item
|
--effectGun :: String -> (Creature -> World -> World) -> Item
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
module Dodge.Luse where
|
||||||
|
import Dodge.Data
|
||||||
|
import Dodge.Item.Weapon.TriggerType
|
||||||
|
import Dodge.Creature.Action
|
||||||
|
import Dodge.Item.Equipment.Booster
|
||||||
|
import Dodge.Default.Creature
|
||||||
|
import LensHelp
|
||||||
|
|
||||||
|
useL :: Luse -> Item -> Creature -> World -> World
|
||||||
|
useL lu = case lu of
|
||||||
|
LDoNothing -> const $ const id
|
||||||
|
LRewind -> useRewindGun
|
||||||
|
LShrink -> hammerCheckL useShrinkGun
|
||||||
|
LBlink -> hammerCheckL (shootL $ const blinkAction)
|
||||||
|
LUnsafeBlink -> hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||||
|
LBoost -> boostSelfL 10
|
||||||
|
|
||||||
|
useRewindGun :: Item -> Creature -> World -> World
|
||||||
|
useRewindGun _ _ w = case _rewindWorlds w of
|
||||||
|
[w'] -> rewindusing w' [w']
|
||||||
|
(w':ws) -> rewindusing w' ws
|
||||||
|
_ -> w
|
||||||
|
where
|
||||||
|
rewindusing w' ws = w
|
||||||
|
& maybeWorld .~ Just' ( w'
|
||||||
|
-- & creatures . ix (_crID cr) .~ cr
|
||||||
|
& upbuts
|
||||||
|
& rewindWorlds .~ ws
|
||||||
|
)
|
||||||
|
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons 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 = if _atBool $ _itAttachment it
|
||||||
|
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropExcept cr invid
|
||||||
|
else tryResize 1 $ f True Uncursed . setMinInvSize defaultInvSize cr
|
||||||
|
where
|
||||||
|
invid = _ipInvID $ _itPos it
|
||||||
|
tryResize x g = maybe w g $ sizeSelf x cr w
|
||||||
|
f isInUse cstatus = creatures . ix (_crID cr) . crInv . ix invid %~
|
||||||
|
( (itAttachment . atBool .~ isInUse) . (itCurseStatus .~ cstatus) )
|
||||||
Reference in New Issue
Block a user