Commit before improving item targeting

This commit is contained in:
2022-02-22 10:47:15 +00:00
parent ff84363a13
commit 69490bb984
12 changed files with 83 additions and 50 deletions
+1 -13
View File
@@ -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