Cleanup, change creature height from Maybe Float to Float
This commit is contained in:
@@ -247,35 +247,32 @@ updateCalmBee cr cid w
|
||||
|
||||
updateSlimeCrit :: Int -> World -> World
|
||||
updateSlimeCrit cid w
|
||||
| r < 5 = w & cWorld . lWorld . creatures . at cid .~ Nothing
|
||||
| cr ^?! crType . slimeSlime < 2500
|
||||
= w & cWorld . lWorld . creatures . at cid .~ Nothing
|
||||
| Just hitp <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmPos
|
||||
, Just hitv <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmVector
|
||||
, Just w' <- splitSlimeCrit' hitp hitv cid cr w = w'
|
||||
| (cr ^?! crType . slimeIsCompressing) && 1 > p
|
||||
= let (w',g) = runState (setSlimeDir cid (cr & crDamage .~ []) w) (w ^. randGen)
|
||||
= let (w',g) = runState (setSlimeDir cid cr w) (w ^. randGen)
|
||||
in w' & randGen .~ g
|
||||
| otherwise = updateCarriage cid $ w
|
||||
& cWorld . lWorld . creatures . ix cid .~ mvslime
|
||||
& cWorld . lWorld . creatures . ix cid %~ mvslime
|
||||
& cWorld . lWorld . creatures . ix cid . crDamage .~ []
|
||||
& tocr %~ doSlimeRadChange
|
||||
& tocr . crType . slimeSplitTimer %~ fsst
|
||||
& tocr . crType . slimeEngulfProgress %~ (max 0 . subtract 0.5)
|
||||
where
|
||||
fsst Nothing = Nothing
|
||||
fsst (Just (x,ps))
|
||||
| x > 0 = Just (x-1,ps)
|
||||
| otherwise = Nothing
|
||||
fsst (Just (x,ps)) | x > 0 = Just (x-1,ps)
|
||||
fsst _ = Nothing
|
||||
tocr = cWorld . lWorld . creatures . ix cid
|
||||
cr = w ^?! cWorld . lWorld . creatures . ix cid
|
||||
v = 0.1 *^ unitVectorAtAngle (cr ^. crDir)
|
||||
mvslime = cr & crType . slimeCompression +~ f (0.1/r)
|
||||
& crPos . _xy +~ v
|
||||
mvslime cr' = cr' & crType . slimeCompression +~ f (0.1/r)
|
||||
& crPos . _xy +~ 0.1 *^ unitVectorAtAngle (cr' ^. crDir)
|
||||
& crType . slimeIsCompressing %~ f'
|
||||
f | t = negate
|
||||
f | cr ^?! crType . slimeIsCompressing = negate
|
||||
| otherwise = id
|
||||
f' | p > 1.5 = const True
|
||||
| otherwise = id
|
||||
t = cr ^?! crType . slimeIsCompressing
|
||||
r = cr ^?! crType . slimeSlime . to slimeToRad
|
||||
p = cr ^?! crType . slimeCompression
|
||||
|
||||
@@ -289,6 +286,7 @@ setSlimeDir cid cr w = do
|
||||
return $ fromMaybe w $ splitSlimeCrit' (x + cxy) (unitVectorAtAngle d) cid cr w
|
||||
else return $ w & tocr . crDir .~ d
|
||||
& tocr . crType . slimeIsCompressing .~ False
|
||||
& tocr . crDamage .~ mempty
|
||||
where
|
||||
tocr = cWorld . lWorld . creatures . ix cid
|
||||
cxy = cr ^. crPos . _xy
|
||||
|
||||
Reference in New Issue
Block a user