Work on refactoring positioning relative to creature body
This commit is contained in:
@@ -92,24 +92,17 @@ crAwayFromPost cr = case find sentinelGoal . _apGoal $ _crActionPlan cr of
|
||||
--crCanShoot :: Creature -> Bool
|
||||
--crCanShoot cr = crIsAiming cr && crWeaponReady cr
|
||||
|
||||
crInAimStance :: AimStance -> IM.IntMap Item -> Creature -> Bool
|
||||
crInAimStance as m cr = crIsAiming cr && mitstance == Just as
|
||||
where
|
||||
mitstance = do
|
||||
i <- cr ^? crManipulation . manObject . imRootSelectedItem
|
||||
--itm <- invRootTrees' (cr ^. crInv) ^? ix i
|
||||
itm <- fmap (fmap (\(a,b,_) -> (a,b))) $ invIMDT (fmap (\k -> m ^?! ix k) (cr ^. crInv)) ^? ix (_unNInt i)
|
||||
return $ itemAimStance itm
|
||||
--cr ^? crInv . ix i . itUse . heldAim . aimStance
|
||||
crInAimStance :: AimStance -> Creature -> Bool
|
||||
crInAimStance as cr = cr ^? crStance . posture . aimStance == Just as
|
||||
|
||||
oneH :: IM.IntMap Item -> Creature -> Bool
|
||||
oneH :: Creature -> Bool
|
||||
oneH = crInAimStance OneHand
|
||||
|
||||
twoFlat :: IM.IntMap Item -> Creature -> Bool
|
||||
twoFlat :: Creature -> Bool
|
||||
twoFlat = crInAimStance TwoHandFlat
|
||||
|
||||
twists :: IM.IntMap Item -> Creature -> Bool
|
||||
twists m cr = crInAimStance TwoHandUnder m cr || crInAimStance TwoHandOver m cr
|
||||
twists :: Creature -> Bool
|
||||
twists cr = crInAimStance TwoHandUnder cr || crInAimStance TwoHandOver cr
|
||||
|
||||
-- the use of crOldPos is because the damage position is calculated on the
|
||||
-- previous frame
|
||||
@@ -124,11 +117,10 @@ crIsArmouredFrom m p cr = fromMaybe False $ do
|
||||
&& angleVV (unitVectorAtAngle (_crDir cr + frontarmdirection)) (p -.- _crOldPos cr) < pi / 2
|
||||
where
|
||||
-- even though angleVV can generate NaN, the comparison seems to deal with it
|
||||
|
||||
frontarmdirection
|
||||
| crInAimStance OneHand m cr = 0.5
|
||||
| crInAimStance TwoHandUnder m cr = negate 1
|
||||
| crInAimStance TwoHandOver m cr = negate 1
|
||||
| crInAimStance OneHand cr = 0.5
|
||||
| crInAimStance TwoHandUnder cr = negate 1
|
||||
| crInAimStance TwoHandOver cr = negate 1
|
||||
| otherwise = 0
|
||||
|
||||
--crOnSeg :: Point2 -> Point2 -> Creature -> Bool
|
||||
|
||||
Reference in New Issue
Block a user