This commit is contained in:
2022-12-31 23:01:54 +00:00
parent 0dc9a09723
commit 8838d1120b
6 changed files with 54 additions and 71 deletions
+16 -57
View File
@@ -1,18 +1,17 @@
module Dodge.Item.Weapon.Utility where
module Dodge.Item.Weapon.Utility
( stopWatch
, rewindWatch
, scrollWatch
, blinkGun
, unsafeBlinkGun
, shrinkGun
-- , useForceFieldGun
) where
import Control.Lens
import Data.Maybe
import Dodge.Base.Coordinate
import Dodge.Data.World
import Dodge.Data.Item
import Dodge.Default
--import Dodge.Default.Item.Use
import Dodge.Wall.ForceField
import Dodge.Wall.Move
import Geometry
import qualified IntMapHelp as IM
import Picture
import Shape
import ShapePicture
stopWatch :: Item
stopWatch =
@@ -23,7 +22,8 @@ stopWatch =
& equipEffect . eeSite .~ GoesOnWrist
)
& itInvColor .~ cyan
& itEffect . ieInv .~ ChargeIfInInventory
& itEffect . ieInv .~ ChargeIfEquipped
& itEffect . ieOnDrop .~ SetCharge 0
& itType . iyBase .~ LEFT STOPWATCH
& itUse . leftConsumption
.~ ChargeableAmmo
@@ -33,37 +33,15 @@ stopWatch =
scrollWatch :: Item
scrollWatch =
defaultLeftItem
& itUse
.~ ( defaultLeftUse
& leftUse .~ LTimeScroll
& equipEffect . eeSite .~ GoesOnWrist
)
& itInvColor .~ cyan
& itEffect . ieInv .~ ChargeIfInInventory
stopWatch
& itUse . leftUse .~ LTimeScroll
& itType . iyBase .~ LEFT SCROLLWATCH
& itUse . leftConsumption
.~ ChargeableAmmo
{ _wpMaxCharge = 100
, _wpCharge = 0
}
rewindWatch :: Item
rewindWatch =
defaultLeftItem
& itUse
.~ ( defaultLeftUse
& leftUse .~ LRewind --useRewindGun
& equipEffect . eeSite .~ GoesOnWrist
)
& itInvColor .~ cyan
& itEffect . ieInv .~ ChargeIfEquipped
stopWatch
& itUse . leftUse .~ LRewind --useRewindGun
& itType . iyBase .~ LEFT REWINDWATCH
& itUse . leftConsumption
.~ ChargeableAmmo
{ _wpMaxCharge = 100
, _wpCharge = 0
}
-- needs to shift this item to the current inventory slot
shrinkGun :: Item
@@ -73,9 +51,6 @@ shrinkGun =
& itParams .~ ShrinkGunParams FullSize
& itType . iyBase .~ LEFT SHRINKER
shrinkGunPic :: Item -> SPic
shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
blinkGun :: Item
blinkGun =
defaultLeftItem
@@ -95,22 +70,6 @@ unsafeBlinkGun =
& itUse . leftUse .~ LUnsafeBlink --hammerCheckL (shootL $ const unsafeBlinkAction)
& itUse . equipEffect . eeViewDist ?~ 400
-- I believe because the targeting returns to nothing straight after you release
-- the rmb, it is possible for this to do nothing
-- TODO investigate more and fix
useForceFieldGun :: Item -> Creature -> World -> World
useForceFieldGun itm cr w = fromMaybe w $ do
a <- _tgPos $ _itTargeting itm
let mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a)
wlline = (a, b)
return $
w
& cWorld . lWorld . walls %~ IM.insertWith (\_ x -> x) i forceField{_wlID = i}
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itLocation itm)) . itParams . paramMID ?~ i
& moveWallIDUnsafe i wlline
where
i = fromMaybe (IM.newKey (_walls (_lWorld (_cWorld w)))) $ itm ^? itParams . paramMID . _Just
-- grapGun = defaultGun
-- { _itName = "grapGun"