Refactor ai
This commit is contained in:
@@ -58,6 +58,11 @@ aCrPos i w = _crPos $ _creatures w IM.! i
|
||||
yourItem :: World -> Item
|
||||
yourItem w = _crInv (you w) IM.! _crInvSel (you w)
|
||||
|
||||
crItem :: World -> Int -> Item
|
||||
crItem w cid = _crInv cr IM.! _crInvSel cr
|
||||
where
|
||||
cr = _creatures w IM.! cid
|
||||
|
||||
yourItemRef w = (creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w)))
|
||||
|
||||
wallNormal :: Wall -> Point2
|
||||
@@ -495,3 +500,9 @@ mvPointToward
|
||||
mvPointToward !ep !p
|
||||
| dist p ep < 1 = ep
|
||||
| otherwise = p +.+ normalizeV (ep -.- p)
|
||||
|
||||
isAnimate :: Creature -> Bool
|
||||
{-# INLINE isAnimate #-}
|
||||
isAnimate cr = case _crActionPlan cr of
|
||||
Inanimate -> False
|
||||
_ -> True
|
||||
|
||||
Reference in New Issue
Block a user