Work on cleaning up item effects/attachments etc
This commit is contained in:
@@ -38,11 +38,11 @@ import qualified SDL
|
||||
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
|
||||
autoEffect eff t sid itm cr w
|
||||
| _eparamInt (_eqParams (_eqEq $ _itUse itm)) < 1 = eff itm cr w
|
||||
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itPos itm)
|
||||
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
|
||||
. itUse . eqEq . eqParams . eparamInt .~ t
|
||||
& soundStart OnceSound (_crPos cr) sid Nothing
|
||||
| otherwise = w
|
||||
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itPos itm)
|
||||
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
|
||||
. itUse . eqEq . eqParams . eparamInt -~ 1
|
||||
|
||||
{- | Automatically send out radar pulses that detect walls. -}
|
||||
|
||||
@@ -118,5 +118,5 @@ explodeRemoteRocket itid pjid w =
|
||||
& itPoint . itUse . rUse .~ HeldDoNothing
|
||||
& usePayload (_prjPayload thepj) (_prjPos thepj)
|
||||
where
|
||||
itPoint = pointerToItem $ _itemPositions (_cWorld w) IM.! itid
|
||||
itPoint = pointerToItemLocation $ _itemLocations (_cWorld w) IM.! itid
|
||||
thepj = _projectiles (_cWorld w) IM.! pjid
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
module Dodge.Item.Weapon.Remote
|
||||
( pointerToItem
|
||||
, setRemoteScope
|
||||
( setRemoteScope
|
||||
, setRemoteBombScope
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Geometry
|
||||
import Dodge.Item.Location
|
||||
|
||||
import qualified IntMapHelp as IM
|
||||
import Control.Lens
|
||||
|
||||
setRemoteBombScope :: Int -> Prop -> World -> World
|
||||
setRemoteBombScope itid pj w' = case _itemPositions (_cWorld w') IM.! itid of
|
||||
setRemoteBombScope itid pj w' = case _itemLocations (_cWorld w') IM.! itid of
|
||||
InInv cid invid
|
||||
-> w' & cWorld . creatures . ix cid . crInv . ix invid . itScope
|
||||
. scopePos .~ (_prPos pj -.- _crPos (_creatures (_cWorld w') IM.! cid))
|
||||
@@ -21,7 +19,7 @@ setRemoteBombScope itid pj w' = case _itemPositions (_cWorld w') IM.! itid of
|
||||
_ -> w'
|
||||
|
||||
setRemoteScope :: Int -> Point2 -> World -> World
|
||||
setRemoteScope itid pos w' = case w' ^? cWorld . itemPositions . ix itid of
|
||||
setRemoteScope itid pos w' = case w' ^? cWorld . itemLocations . ix itid of
|
||||
Just (InInv cid' invid )
|
||||
-> w' & cWorld . creatures . ix cid' . crInv . ix invid . itScope
|
||||
. scopePos .~ (pos -.- _crPos (_creatures (_cWorld w') IM.! cid'))
|
||||
|
||||
@@ -363,7 +363,7 @@ shootL f item cr w
|
||||
| otherwise = w
|
||||
where
|
||||
cid = _crID cr
|
||||
invid = _ipInvID $ _itPos item
|
||||
invid = _ipInvID $ _itLocation item
|
||||
pointerToItem = cWorld . creatures . ix cid . crInv . ix invid
|
||||
fireCondition = _rateTime (_useDelay (_itUse item)) == 0
|
||||
&& _arLoaded (_leftConsumption (_itUse item)) > 0
|
||||
|
||||
@@ -18,12 +18,12 @@ rewindGun :: Item
|
||||
rewindGun =
|
||||
defaultLeftItem
|
||||
{ _itInvColor = cyan
|
||||
, _itEffect = ItRewindEffect RewindEffect -- []
|
||||
, _itUse =
|
||||
defaultlUse
|
||||
& lUse .~ LRewind --useRewindGun
|
||||
& eqEq . eqSite .~ GoesOnChest
|
||||
}
|
||||
& itEffect . ieInv .~ RewindEffect
|
||||
& itType . iyBase .~ LEFT REWINDER
|
||||
& itUse . leftConsumption
|
||||
.~ ChargeableAmmo
|
||||
@@ -35,10 +35,8 @@ rewindGun =
|
||||
shrinkGun :: Item
|
||||
shrinkGun =
|
||||
defaultLeftItem
|
||||
{ _itUse = defaultlUse & lUse .~ LShrink -- hammerCheckL useShrinkGun
|
||||
-- , _itFloorPict = shrinkGunPic
|
||||
, _itAttachment = AttachBool True
|
||||
}
|
||||
& itUse .~ (defaultlUse & lUse .~ LShrink)
|
||||
& itParams .~ ShrinkGunParams FullSize
|
||||
& itType . iyBase .~ LEFT SHRINKER
|
||||
|
||||
shrinkGunPic :: Item -> SPic
|
||||
@@ -100,7 +98,7 @@ useForceFieldGun itm cr w = fromMaybe w $ do
|
||||
return $
|
||||
w
|
||||
& cWorld . walls %~ IM.insertWith (\_ x -> x) i forceField{_wlID = i}
|
||||
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itPos itm)) . itParams . paramMID ?~ i
|
||||
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itLocation itm)) . itParams . paramMID ?~ i
|
||||
& moveWallIDUnsafe i wlline
|
||||
where
|
||||
i = fromMaybe (IM.newKey (_walls (_cWorld w))) $ itm ^? itParams . paramMID . _Just
|
||||
|
||||
Reference in New Issue
Block a user