module Dodge.WorldEvent.Damage
    ( damThingHitWith
    ) where
import Dodge.Data
import Geometry
import Dodge.Wall.Damage
import LensHelp

damThingHitWith 
    :: (Point2 -> Point2 -> Point2 -> Damage)
    -> Point2
    -> Point2
    -> Maybe (Point2, Either Creature Wall)
    -> World 
    -> World
damThingHitWith partDT sp ep mayEiCrWl = case mayEiCrWl of
    Just (hitp,Left  cr) -> creatures . ix (_crID cr) . crState . csDamage .:~ partDT sp hitp ep
    Just (hitp,Right wl) -> damageWall (partDT sp hitp ep) wl
    Nothing -> id
