Refactor launcherCrit ai
This commit is contained in:
@@ -38,20 +38,7 @@ initialiseLamp w (f,g) cr = ( (addLS . f , g), Just $ cr & crUpdate .~ updateLam
|
||||
addLS = over lightSources (IM.insert i (lightAt (_crPos cr) i))
|
||||
|
||||
updateLamp :: Int -> CRUpdate
|
||||
updateLamp i w (f,g) cr = ((handleLS . f, g), internalUpdate)
|
||||
where
|
||||
handleLS w'
|
||||
| _crHP cr < 0 = explosionFlashAt cPos
|
||||
$ mkSoundBreakGlass cPos w' & lightSources %~ IM.delete i
|
||||
| otherwise = w' & lightSources . ix i . lsPos .~ cPos
|
||||
where
|
||||
cPos = _crPos cr
|
||||
internalUpdate
|
||||
| _crHP cr < 0 = Nothing
|
||||
| otherwise = fmap doDamage $ Just cr
|
||||
|
||||
updateLamp' :: Int -> CRUpdate
|
||||
updateLamp' i = unrandUpdate handleLS internalUpdate
|
||||
updateLamp i = unrandUpdate handleLS internalUpdate
|
||||
where
|
||||
handleLS cr w
|
||||
| _crHP cr < 0 = explosionFlashAt cPos
|
||||
@@ -63,7 +50,6 @@ updateLamp' i = unrandUpdate handleLS internalUpdate
|
||||
| _crHP cr < 0 = Nothing
|
||||
| otherwise = Just $ doDamage cr
|
||||
|
||||
|
||||
barrel :: Creature
|
||||
barrel = defaultInanimate
|
||||
{ _crUpdate = updateBarrel
|
||||
|
||||
Reference in New Issue
Block a user