Commit before improving item targeting
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
module Dodge.Item.Weapon.Bezier
|
||||
( bezierGun
|
||||
, teleGun
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Base
|
||||
@@ -47,7 +46,6 @@ bezierGun = defaultGun
|
||||
{ _ammoBaseMax = 15
|
||||
}
|
||||
}
|
||||
|
||||
shootBezier :: Point2 -> Creature -> World -> World
|
||||
shootBezier targetp cr w = w & particles .:~ aCurveBulAt
|
||||
(Just cid)
|
||||
@@ -66,6 +64,3 @@ shootBezier targetp cr w = w & particles .:~ aCurveBulAt
|
||||
a <- randInCirc 10
|
||||
b <- randInCirc 20
|
||||
return (a,b)
|
||||
|
||||
teleGun :: Item
|
||||
teleGun = bezierGun
|
||||
|
||||
@@ -291,19 +291,4 @@ remoteBombUnarmedPic :: Picture
|
||||
remoteBombUnarmedPic = color (dark $ dark orange) $ circleSolid 5
|
||||
|
||||
retireRemoteBomb :: Int -> Int -> Int -> World -> World
|
||||
retireRemoteBomb itid 0 pjid w = w
|
||||
& pointToItem (_itemPositions w IM.! itid) %~
|
||||
( (itScope . scopePos .~ V2 0 0)
|
||||
-- . (itZoom .~ defaultItZoom)
|
||||
. (itUse . rUse .~ const throwRemoteBomb)
|
||||
)
|
||||
& props %~ IM.delete pjid
|
||||
retireRemoteBomb itid t pjid w = setScope w
|
||||
& props . ix pjid . pjUpdate .~ (\_ -> retireRemoteBomb itid (t-1) pjid)
|
||||
where
|
||||
setScope w' = case _itemPositions w' IM.! itid of
|
||||
InInv cid invid -> w'
|
||||
& creatures . ix cid . crInv . ix invid . itScope
|
||||
. scopePos .~ (pos -.- _crPos (_creatures w' IM.! cid))
|
||||
_ -> w'
|
||||
pos = fromMaybe (V2 0 0) $ w ^? props . ix pjid . pjPos
|
||||
retireRemoteBomb = retireRemoteProj $ const throwRemoteBomb
|
||||
|
||||
@@ -408,19 +408,7 @@ remoteShellPic t
|
||||
col | t > (-99) = green
|
||||
| otherwise = red
|
||||
retireRemoteRocket :: Int -> Int -> Int -> World -> World
|
||||
retireRemoteRocket itid 0 pjid w =
|
||||
set (pointToItem (_itemPositions w IM.! itid) . itScope . scopePos) (V2 0 0)
|
||||
$ set (pointToItem (_itemPositions w IM.! itid) . itUse . rUse) (const fireRemoteLauncher)
|
||||
(w & props %~ IM.delete pjid)
|
||||
retireRemoteRocket itid t pjid w = setScope w
|
||||
& props . ix pjid . pjUpdate .~ (\_ -> retireRemoteRocket itid (t-1) pjid)
|
||||
where
|
||||
setScope w' = case _itemPositions w' IM.! itid of
|
||||
InInv cid invid -> w'
|
||||
& creatures . ix cid . crInv . ix invid . itScope
|
||||
. scopePos .~ (pos -.- _crPos (_creatures w' IM.! cid))
|
||||
_ -> w'
|
||||
pos = fromMaybe (V2 0 0) $ w ^? props . ix pjid . pjPos
|
||||
retireRemoteRocket = retireRemoteProj $ const fireRemoteLauncher
|
||||
|
||||
setRemoteScope :: Int -> Prop -> World -> World
|
||||
setRemoteScope itid pj w' = case w' ^? itemPositions . ix itid of
|
||||
|
||||
@@ -1,11 +1,33 @@
|
||||
module Dodge.Item.Weapon.Remote
|
||||
( pointToItem
|
||||
, retireRemoteProj
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Geometry
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
|
||||
pointToItem :: Applicative f =>
|
||||
ItemPos -> (Item -> f Item) -> World -> f World
|
||||
pointToItem (InInv cid invid) = creatures . ix cid . crInv . ix invid
|
||||
pointToItem (OnFloor flid) = floorItems . ix flid . flIt
|
||||
|
||||
retireRemoteProj :: (Item -> Creature -> World -> World)
|
||||
-> Int -> Int -> Int -> World -> World
|
||||
retireRemoteProj resetFire itid 0 pjid w = w
|
||||
& pointToItem (_itemPositions w IM.! itid) %~
|
||||
( (itScope . scopePos .~ V2 0 0)
|
||||
. (itUse . rUse .~ resetFire)
|
||||
)
|
||||
& props %~ IM.delete pjid
|
||||
retireRemoteProj resetFire itid t pjid w = setScope w
|
||||
& props . ix pjid . pjUpdate .~ (\_ -> retireRemoteProj resetFire itid (t-1) pjid)
|
||||
where
|
||||
setScope w' = case _itemPositions w' IM.! itid of
|
||||
InInv cid invid -> w'
|
||||
& creatures . ix cid . crInv . ix invid . itScope
|
||||
. scopePos .~ (pos -.- _crPos (_creatures w' IM.! cid))
|
||||
_ -> w'
|
||||
pos = fromMaybe (V2 0 0) $ w ^? props . ix pjid . pjPos
|
||||
|
||||
Reference in New Issue
Block a user