Delete cruft, add Reader monad to some internal ai
This commit is contained in:
@@ -29,6 +29,5 @@ heal25 :: Int -> World -> Maybe World
|
||||
heal25 = heal 25
|
||||
heal :: Int -> Int -> World -> Maybe World
|
||||
heal hp n w | _crHP (_creatures w IM.! n) >= 10000 = Nothing
|
||||
| otherwise = Just $ soundOnce healSound
|
||||
$ over (creatures . ix n . crHP) ((min 10000) . (+ hp) ) w
|
||||
| otherwise = Just $ soundOnce healSound w & creatures . ix n . crHP %~ min 10000 . (+ hp)
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
{- |
|
||||
Definitions of weapons.
|
||||
In progress: move out effects into other modules.
|
||||
-}
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
{- | Definitions of weapons.
|
||||
In progress: move out effects into other modules. -}
|
||||
module Dodge.Item.Weapon
|
||||
( module Dodge.Item.Weapon
|
||||
)
|
||||
|
||||
@@ -145,7 +145,7 @@ bulHitWall' bt p x w = damageBlocks x
|
||||
spid = newKey $ _projectiles w
|
||||
reflectDir wall = a + argV (reflectIn (uncurry (-.-) (_wlLine wall)) (p -.- sp) )
|
||||
damageBlocks wall w = case wall ^? blHP of
|
||||
Just hp -> foldr (\j -> (walls . ix j . blHP -~ 5)) w (_blIDs wall)
|
||||
Just hp -> foldr (\j -> walls . ix j . blHP -~ 5) w (_blIDs wall)
|
||||
_ -> w
|
||||
{- | Bounce off walls, do damage to blocks. -}
|
||||
bulBounceWall' :: Particle -> Point2 -> Wall -> World -> World
|
||||
@@ -155,7 +155,7 @@ bulBounceWall' bt p wl w = damageBlocks wl $ over worldEvents addBouncer w
|
||||
pOut = p +.+ safeNormalizeV (sp -.- p)
|
||||
damageBlocks wall w
|
||||
= case wall ^? blHP of
|
||||
Just hp -> foldr (\j -> (walls . ix j . blHP -~ 5)) w (_blIDs wall)
|
||||
Just hp -> foldr (\j -> walls . ix j . blHP -~ 5) w (_blIDs wall)
|
||||
_ -> w
|
||||
bouncer = (aGenBulAt' Nothing (_btColor' bt) pOut reflectVel
|
||||
(_btHitEffect' bt) (_btWidth' bt)
|
||||
@@ -180,7 +180,7 @@ bulIncWall' bt p wl w = damageBlocks wl $ incFlamelets w
|
||||
pOut = p +.+ safeNormalizeV (sp -.- p)
|
||||
damageBlocks wall w
|
||||
= case wall ^? blHP of
|
||||
Just hp -> foldr (\j -> (walls . ix j . blHP -~ 5)) w (_blIDs wall)
|
||||
Just hp -> foldr (\j -> walls . ix j . blHP -~ 5) w (_blIDs wall)
|
||||
_ -> w
|
||||
wallV = uncurry (-.-) (_wlLine wl)
|
||||
reflectVel = safeNormalizeV $ reflectIn wallV (_btVel' bt)
|
||||
@@ -198,9 +198,9 @@ bulConWall' bt p wl w = damageBlocks wl $ mkwave w
|
||||
pOut = p +.+ safeNormalizeV (sp -.- p)
|
||||
damageBlocks wall w
|
||||
= case wall ^? blHP of
|
||||
Just hp -> foldr (\j -> (walls . ix j . blHP -~ 5)) w (_blIDs wall)
|
||||
Just hp -> foldr (\j -> walls . ix j . blHP -~ 5) w (_blIDs wall)
|
||||
_ -> w
|
||||
mkwave = over worldEvents ((makeShockwaveAt [] p 15 4 1 white) . )
|
||||
mkwave = over worldEvents ( makeShockwaveAt [] p 15 4 1 white . )
|
||||
|
||||
hvBulHitWall'
|
||||
:: Particle
|
||||
@@ -218,7 +218,7 @@ hvBulHitWall' bt p x w = damageBlocks x $ set randGen g $ foldr ($) w (sparks p
|
||||
argV (reflectIn (uncurry (-.-) (_wlLine wall)) (p -.- sp) )
|
||||
sv = unitVectorAtAngle $ reflectDir x
|
||||
damageBlocks wall w = case wall ^? blHP of
|
||||
Just hp -> foldr (\j -> (walls . ix j . blHP -~ 20)) w (_blIDs wall)
|
||||
Just hp -> foldr (\j -> walls . ix j . blHP -~ 20) w (_blIDs wall)
|
||||
_ -> w
|
||||
cs = take 10 $ randomRs (0,11) $ _randGen w
|
||||
ds = randomRs (-0.7,0.7) $ _randGen w
|
||||
|
||||
@@ -370,7 +370,7 @@ spreadNumVelWthHiteff spread num vel wth eff cid w = over particles (newbuls ++)
|
||||
poss dirs colids
|
||||
poss = map ((+.+) $ _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr))
|
||||
$ (replicateM num . randInCirc) 5 & evalState $ _randGen w
|
||||
dirs = map ((_crDir cr) +) $ zipWith (+)
|
||||
dirs = map (_crDir cr +) $ zipWith (+)
|
||||
[-spread,-spread+(2*spread/fromIntegral num)..]
|
||||
(randomRs (0,spread/5) (_randGen w))
|
||||
colids = take num $ randomRs (0,11) (_randGen w)
|
||||
|
||||
@@ -96,7 +96,7 @@ mvRadar x p w pt =
|
||||
)
|
||||
where
|
||||
pic = onLayerL [levLayer ShadowLayer, 1] $ pictures sweepPics
|
||||
putBlips = over worldEvents ( ( over particles (blips ++) ) . )
|
||||
putBlips = over worldEvents ( over particles (blips ++) . )
|
||||
blips = map (\p -> blipAt p (withAlpha (0.5*globalAlpha) red) 50) circPoints
|
||||
circPoints = mapMaybe (\wl -> uncurry collidePointCircCorrect (_wlLine wl) r p)
|
||||
$ map (over wlLine swp) (IM.elems $ wallsAlongCirc p r w)
|
||||
|
||||
Reference in New Issue
Block a user