This commit is contained in:
2022-08-02 00:43:37 +01:00
parent e3d26bdfe0
commit 9e3097d681
3 changed files with 32 additions and 210 deletions
-138
View File
@@ -54,144 +54,6 @@ makeShell it cr theupdate w =
pos = _crPos cr +.+ rotateV dir (V2 (_crRad cr + 1) 0)
am = _heldConsumption $ _itUse it
--fireShell :: Item -> Creature -> World -> World
--fireShell it cr = makeShell it cr $ \pj -> pjEffAtTime 35 (trySpinByCID (_crID cr) spinamount) pj
-- . pjThrust thrustdelay pj
-- . reduceSpinBy (1-fromIntegral spindrag*2 / 200) pj
-- . decTimMvVel pj
-- . moveShell pj
-- where
-- params = _itParams it
-- spindrag = _shellSpinDrag params
-- spinamount = _shellSpinAmount params
-- thrustdelay = _shellThrustDelay params
--
--makeShell :: Item -> Creature -> (Proj -> World -> World) -> World -> World
--makeShell it cr theupdate w = w & projectiles %~ IM.insert i Shell
-- { _prjPos = pos
-- , _prjZ = 20
-- , _prjStartPos = pos
-- , _prjVel = rotateV dir (V2 1 0)
-- , _prjID = i
-- , _prjUpdate = theupdate
-- , _prjAcc = rotateV dir (V2 3 0)
-- , _prjDir = dir
-- , _prjDraw = DrawShell
-- , _prjSpin = 0
-- , _prjPayload = _amPayload $ _laAmmoType am
-- , _prjTimer = 50
-- }
-- where
-- i = IM.newKey $ _props w
-- dir = _crDir cr
-- pos = _crPos cr +.+ rotateV dir (V2 (_crRad cr + 1) 0)
-- am = _itConsumption it
--
--moveShell :: Proj
-- -> World
-- -> World
--moveShell pj w
-- | time > 40 = if circOnSomeWall oldPos 4 w
-- then doExplode
-- else w
-- | anythingHitCirc 2 oldPos newPos w = doExplode
-- | time > -300 = w
-- | otherwise = doExplode
-- where
-- time = _prjTimer pj
-- doExplode = w
-- & usePayload (_prjPayload pj) oldPos
-- & stopSoundFrom (ShellSound i)
-- & props %~ IM.delete i
-- i = _prjID pj
-- oldPos = _prjPos pj
-- vel = _prjVel pj
-- newPos = oldPos +.+ vel
--
--usePjCreation :: Item -> Creature -> World -> World
--usePjCreation it = createProjectile (_amPjCreation (_laAmmoType (_itConsumption it))) it
--
--usePjCreationX :: Int -> Item -> Creature -> World -> World
--usePjCreationX i it cr = foldr f
-- (createProjectile (_amPjCreation (_laAmmoType (_itConsumption it))) it cr)
-- [1..i-1]
-- where
-- f n = (. createProjectile (_amPjCreation (_laAmmoType (_itConsumption it))) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i)))
--
--pjEffAtTime
-- :: Int
-- -> (Proj -> World -> World)
-- -> Proj
-- -> World
-- -> World
--pjEffAtTime t f pj
-- | _prjTimer pj == t = f pj
-- | otherwise = id
--
--trySpinByCID
-- :: Int -- ^ creature id
-- -> Int -- ^ Spin amount
-- -> Proj
-- -> World
-- -> World
--trySpinByCID cid i pj w = w & projectiles . ix pjid . prjSpin .~ newSpin
-- where
-- pjid = _prjID pj
-- dir = argV $ _prjVel pj
-- newSpin = case w ^? creatures . ix cid of
-- Just cr -> negate $ min 0.2 $ max (-0.2) $ normalizeAnglePi (dir - _crDir cr) / spinFactor
-- _ -> 0
-- spinFactor = 5 * (6 - fromIntegral i)
--pjThrust :: Int -> Proj -> World -> World
--pjThrust i = pjEffTimeRange (st,et) doThrust
-- where
-- et | i == 0 = 36
-- | otherwise = 40 - (i * 20)
-- st = et - 100
--
--pjTrack :: Int -> Int -> Proj -> World -> World
--pjTrack itid i pj w = pjEffTimeRange (st,et) rotateToTarget pj w
-- where
-- et | i == 0 = 36
-- | otherwise = 40 - (i * 20)
-- st = et - 100
-- rotateToTarget _ = fromMaybe id $ do
-- tpos <- w ^? itPoint . itTargeting . tgPos . _Just
-- return $ projectiles . ix (_prjID pj) . prjSpin .~ turnToAmount 0.15 (_prjPos pj) tpos
-- (argV $ _prjAcc pj)
-- itPoint = pointToItem $ _itemPositions w IM.! itid
--
--doThrust :: Proj -> World -> World
--doThrust pj w = w
-- & randGen .~ g
-- & projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)
-- & soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
-- & makeFlamelet (oldPos -.- vel) 0 (vel +.+ rotateV (pi+sparkD) accel) 3 10
-- & shellTrailCloud (addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)))
-- where
-- accel = _prjAcc pj
-- i = _prjID pj
-- oldPos = _prjPos pj
-- vel = _prjVel pj
-- newPos = oldPos +.+ vel
-- (frict,g) = randomR (0.6,0.9) $ _randGen w
-- (sparkD,_) = randomR (-0.2,0.2) $ _randGen w
-- r1 = randInCirc 10 & evalState $ _randGen w
--
--reduceSpinBy :: Float -> Proj -> World -> World
--reduceSpinBy x pj = projectiles . ix (_prjID pj) . prjSpin *~ x
--
--pjEffTimeRange
-- :: (Int,Int)
-- -> (Proj -> World -> World)
-- -> Proj
-- -> World
-- -> World
--pjEffTimeRange (st,et) f pj
-- | t <= et && t >= st = f pj
-- | otherwise = id
-- where
-- t = _prjTimer pj
fireTrackingShell :: Item -> Creature -> World -> World
fireTrackingShell it cr w = addTrackRocket w'
where