Cleanup
This commit is contained in:
@@ -1,60 +1,67 @@
|
||||
module Dodge.Item.Weapon.Utility where
|
||||
import Dodge.Data
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Base.Coordinate
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Item.Weapon.ExtraEffect
|
||||
import Dodge.Wall.ForceField
|
||||
import Dodge.Wall.Move
|
||||
import Geometry
|
||||
import Picture
|
||||
import qualified IntMapHelp as IM
|
||||
import Picture
|
||||
import Shape
|
||||
import ShapePicture
|
||||
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
rewindGun :: Item
|
||||
rewindGun = defaultLeftItem
|
||||
{ _itInvColor = cyan
|
||||
, _itConsumption = ChargeableAmmo
|
||||
{ _wpMaxCharge = 250
|
||||
, _wpCharge = 0
|
||||
rewindGun =
|
||||
defaultLeftItem
|
||||
{ _itInvColor = cyan
|
||||
, _itEffect = ItRewindEffect RewindEffect -- []
|
||||
, _itUse =
|
||||
defaultlUse
|
||||
& lUse .~ LRewind --useRewindGun
|
||||
& eqEq . eqSite .~ GoesOnChest
|
||||
}
|
||||
, _itEffect = ItRewindEffect RewindEffect-- []
|
||||
, _itUse = defaultlUse
|
||||
& lUse .~ LRewind --useRewindGun
|
||||
& eqEq . eqSite .~ GoesOnChest
|
||||
}
|
||||
& itType . iyBase .~ LEFT REWINDER
|
||||
& itType . iyBase .~ LEFT REWINDER
|
||||
& itUse . leftConsumption
|
||||
.~ ChargeableAmmo
|
||||
{ _wpMaxCharge = 250
|
||||
, _wpCharge = 0
|
||||
}
|
||||
|
||||
-- needs to shift this item to the current inventory slot
|
||||
shrinkGun :: Item
|
||||
shrinkGun = defaultLeftItem
|
||||
{_itUse = defaultlUse & lUse .~ LShrink -- hammerCheckL useShrinkGun
|
||||
-- , _itFloorPict = shrinkGunPic
|
||||
, _itAttachment = AttachBool True
|
||||
}
|
||||
& itType . iyBase .~ LEFT SHRINKER
|
||||
shrinkGun =
|
||||
defaultLeftItem
|
||||
{ _itUse = defaultlUse & lUse .~ LShrink -- hammerCheckL useShrinkGun
|
||||
-- , _itFloorPict = shrinkGunPic
|
||||
, _itAttachment = AttachBool True
|
||||
}
|
||||
& itType . iyBase .~ LEFT SHRINKER
|
||||
|
||||
shrinkGunPic :: Item -> SPic
|
||||
shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
|
||||
|
||||
|
||||
blinkGun :: Item
|
||||
blinkGun = defaultLeftItem
|
||||
{ _itInvColor = cyan
|
||||
, _itUse = defaultlUse
|
||||
& lUse .~ LBlink --hammerCheckL (shootL $ const blinkAction)
|
||||
& eqEq . eqSite .~ GoesOnWrist
|
||||
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
|
||||
}
|
||||
& itType . iyBase .~ LEFT BLINKER
|
||||
blinkGun =
|
||||
defaultLeftItem
|
||||
{ _itInvColor = cyan
|
||||
, _itUse =
|
||||
defaultlUse
|
||||
& lUse .~ LBlink --hammerCheckL (shootL $ const blinkAction)
|
||||
& eqEq . eqSite .~ GoesOnWrist
|
||||
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
|
||||
}
|
||||
& itType . iyBase .~ LEFT BLINKER
|
||||
|
||||
unsafeBlinkGun :: Item
|
||||
unsafeBlinkGun = blinkGun
|
||||
& itType . iyBase .~ LEFT BLINKERUNSAFE
|
||||
& itUse . lUse .~ LUnsafeBlink --hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||
& itUse . eqEq . eqViewDist ?~ 400
|
||||
unsafeBlinkGun =
|
||||
blinkGun
|
||||
& itType . iyBase .~ LEFT BLINKERUNSAFE
|
||||
& itUse . lUse .~ LUnsafeBlink --hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||
& itUse . eqEq . eqViewDist ?~ 400
|
||||
|
||||
--effectGun :: String -> (Creature -> World -> World) -> Item
|
||||
--effectGun name eff = defaultWeapon
|
||||
@@ -69,34 +76,36 @@ unsafeBlinkGun = blinkGun
|
||||
-- }
|
||||
-- & itType . iyBase .~ AUTOEFFGUN name
|
||||
forceFieldGun :: Item
|
||||
forceFieldGun = defaultWeapon
|
||||
{ _itConsumption = defaultLoadable & laAmmoType .~ ForceFieldAmmo forceField
|
||||
, _itTargeting = targetRBPress & tgDraw .~ TargetDistanceDraw
|
||||
, _itParams = ParamMID Nothing
|
||||
}
|
||||
& itUse . rUse .~ HeldForceField --useForceFieldGun
|
||||
& itUse . useDelay .~ NoDelay
|
||||
& itUse . useMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
|
||||
forceFieldGun =
|
||||
defaultWeapon
|
||||
& itTargeting .~ (targetRBPress & tgDraw .~ TargetDistanceDraw)
|
||||
& itParams .~ ParamMID Nothing
|
||||
& itUse . rUse .~ HeldForceField --useForceFieldGun
|
||||
& itUse . useDelay .~ NoDelay
|
||||
& itUse . useMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
|
||||
-- than the list below
|
||||
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
|
||||
& itType . iyBase .~ HELD FORCEFIELDGUN
|
||||
& itType . iyBase .~ HELD FORCEFIELDGUN
|
||||
& itUse . heldConsumption .~ (defaultLoadable & laAmmoType .~ ForceFieldAmmo forceField)
|
||||
|
||||
-- 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
|
||||
useForceFieldGun itm cr w = fromMaybe w $ do
|
||||
a <- _tgPos $ _itTargeting itm
|
||||
let mwp = mouseWorldPos w
|
||||
b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a)
|
||||
wlline = (a,b)
|
||||
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
|
||||
& moveWallIDUnsafe i wlline
|
||||
wlline = (a, b)
|
||||
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
|
||||
& moveWallIDUnsafe i wlline
|
||||
where
|
||||
i = fromMaybe (IM.newKey (_walls (_cWorld w))) $ itm ^? itParams . paramMID . _Just
|
||||
|
||||
-- grapGun = defaultGun
|
||||
-- grapGun = defaultGun
|
||||
-- { _itName = "grapGun"
|
||||
-- , _itIdentity = GrapGun
|
||||
-- , _wpMaxAmmo = 1
|
||||
|
||||
Reference in New Issue
Block a user