Creature zoning refactor

This commit is contained in:
2022-06-28 11:50:53 +01:00
parent 61ad58c04a
commit 0cb6657f35
4 changed files with 25 additions and 27 deletions
+5 -2
View File
@@ -240,9 +240,12 @@ makeGasCloud pos vel w = w
(col, g) = runState (takeOne [green,yellow]) $ _randGen w
{- Attach poison cloud damage to creatures near cloud. -}
cloudPoisonDamage :: Cloud -> World -> World
cloudPoisonDamage c w = w & creatures %~ flip (foldl' (flip $ IM.adjust doDam)) damagedCrs
cloudPoisonDamage c w = w & creatures
%~ dodamagesto damagedCrs
where
damagedCrs = IM.keys $ IM.filter f $ creaturesNearPoint clpos w
dodamagesto :: StreamOf Creature -> IM.IntMap Creature -> IM.IntMap Creature
dodamagesto = undefined
damagedCrs = S.filter f $ crsNearPoint clpos w
f cr = dist3 (addZ 20 $ _crPos cr) (_clPos c) < _crRad cr + _clRad c + 10
doDam cr = cr & crState . csDamage .:~ Damage POISONDAM 1 clpos clpos clpos NoDamageEffect
clpos = stripZ $ _clPos c