Add different weapon positions based on handedness

This commit is contained in:
2021-06-07 20:28:54 +02:00
parent c9ca94e82e
commit fb7a90df71
7 changed files with 90 additions and 34 deletions
+47 -20
View File
@@ -29,6 +29,7 @@ basicCrPict col cr w = pictures $
targetingPic ++
[ tr . piercingMod $ bluntScale $ naked col cr
, trFeet $ feet cr
, tr $ arms col cr
, tr $ drawEquipment cr
]
where
@@ -54,41 +55,68 @@ basicCrPict col cr w = pictures $
feet :: Creature -> Picture
feet cr = case cr ^? crStance . carriage of
Just (Walking _ LeftForward) -> setL
[ translate up off $ circleSolid 5
, translate (-up) (-off) $ circleSolid 5
Just (Walking sa LeftForward) -> setL
[ translate (f sa) off $ circleSolid 5
, translate (-f sa) (-off) $ circleSolid 5
]
Just (Walking _ RightForward) -> setL
[ translate (-up) off $ circleSolid 5
, translate (up) (-off) $ circleSolid 5
Just (Walking sa RightForward) -> setL
[ translate (-f sa) off $ circleSolid 5
, translate (f sa) (-off) $ circleSolid 5
]
_ -> setL
[ translate 0 off $ circleSolid 5
, translate 0 (-off) $ circleSolid 5
]
where
setL = onLayerL [levLayer CrLayer, (-2)] . color (greyN 0.2) . pictures
setL = onLayerL [levLayer CrLayer, (-5)] . color (greyN 0.3) . pictures
off = 5
up = 5
sLen = _strideLength $ _crStance cr
f i = 6 * fromIntegral (sLen - i) / fromIntegral sLen
arms :: Color -> Creature -> Picture
arms col cr
| aimingTwist = blank
| otherwise = case cr ^? crStance . carriage of
Just (Walking sa LeftForward) -> setL
[ translate (-f sa) (-off) . sc $ circleSolid 4
]
Just (Walking sa RightForward) -> setL
[ translate (-f sa) off . sc $ circleSolid 4
]
_ -> blank
where
sc = scale 1 1
setL = onLayerL [levLayer CrLayer, (-4)] . color (light4 col) . pictures
off = 8
sLen = _strideLength $ _crStance cr
f i = negate 2 + negate 6 * fromIntegral (sLen - i) / fromIntegral sLen
aimingTwist = crIsAiming' cr -- && crIt ^? itAimStance == Just TwoHandTwist
--crIt = _crInv cr IM.! _crInvSel cr
naked :: Color -> Creature -> Picture
naked col cr
| strikeMelee = onCrL . color white $ circleSolid $ _crRad cr
| pdam > 200 = onCrL . color red $ circleSolid $ _crRad cr
| pdam > 99 = onCrL . color white $ circleSolid $ _crRad cr
| aimingTwist = rotate twistA $ pictures
| aimingOneHand = rotate (negate twistA * 0.5) $ pictures
[ translate (0.25 * crad) 0 $ circleSolid (crad * 0.5)
, onCrL . translate 8 (-8) . color col' $ circleSolid 4
, translate 0 3 . rotate (negate 0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr
, translate 0 (negate 3) . rotate (0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr
]
| aimingTwist = translate 0 (0.5* crad) . rotate twistA $ pictures
[ aboveIt . translate (negate 0.25 * crad) 0.25 $
circleSolid (crad * 0.5)
, onCrL . translate 0 3 . rotate (negate 0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr, circLine $ _crRad cr
, onCrL . translate 0 (negate 3) . rotate (0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr, circLine $ _crRad cr
--, shoulderRot . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr, circLine $ _crRad cr
, onCrL . translate 12 (4) . color col' $ circleSolid 4
, onCrL . translate 4 (-10) . color col' $ circleSolid 4
, onCrL . rotate (negate 0.2) . translate 2 3 . rotate (negate 0.4) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr
, onCrL . rotate (negate 0.2) . translate 0 (negate 3) . rotate (0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr
]
| otherwise = onCrL $ pictures
[ translate (0.25 * crad) 0 $ circleSolid (crad * 0.5)
, translate 0 3 . rotate (negate 0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr, circLine $ _crRad cr
, translate 0 (negate 3) . rotate (0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr, circLine $ _crRad cr
--, shoulderRot . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr, circLine $ _crRad cr
, translate 0 3 . rotate (negate 0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr
, translate 0 (negate 3) . rotate (0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr
]
where
aboveIt = onLayer HPtLayer
@@ -97,10 +125,6 @@ naked col cr
aimingOneHand = crIsAiming' cr && crIt ^? itAimStance == Just OneHand
aimingTwist = crIsAiming' cr && crIt ^? itAimStance == Just TwoHandTwist
crIt = _crInv cr IM.! _crInvSel cr
shoulderRot = case cr ^? crStance . carriage of
Just (Walking _ LeftForward) -> rotate 0.1
Just (Walking _ RightForward) -> rotate $ negate 0.1
_ -> id
strikeMelee = case _crMeleeCooldown cr of
Nothing -> False
Just x -> x > 5
@@ -109,6 +133,9 @@ naked col cr
pastDams = _crPastDamage $ _crState cr
col' = light . light . light $ light col
light4 :: Color -> Color
light4 = light . light . light . light
--drawAwakeLevel
-- :: Creature
-- -> Picture