Add twisting weapons and feet
This commit is contained in:
@@ -15,7 +15,9 @@ crMvBy
|
||||
:: Point2 -- ^ Movement translation vector, will be made relative to creature direction
|
||||
-> Creature
|
||||
-> Creature
|
||||
crMvBy p' cr = advanceStepCounter (magV p) $ over crPos (+.+ p) cr
|
||||
crMvBy p' cr = advanceStepCounter (magV p) cr
|
||||
& crPos %~ (+.+ p)
|
||||
& crMvDir .~ argV p
|
||||
where
|
||||
p = (*.*) (equipFactor * aimingFactor) $ rotateV (_crDir cr) p'
|
||||
equipFactor
|
||||
@@ -31,7 +33,9 @@ crMvAbsolute
|
||||
:: Point2 -- ^ Movement translation vector
|
||||
-> Creature
|
||||
-> Creature
|
||||
crMvAbsolute p' cr = advanceStepCounter (magV p) $ over crPos (+.+ p) cr
|
||||
crMvAbsolute p' cr = advanceStepCounter (magV p) cr
|
||||
& crPos %~ (+.+ p)
|
||||
& crMvDir .~ argV p
|
||||
where
|
||||
p = (*.*) (equipFactor * aimingFactor) p'
|
||||
equipFactor
|
||||
|
||||
@@ -9,7 +9,7 @@ import Dodge.Creature.SentinelAI
|
||||
import Dodge.Creature.Rationality
|
||||
import Dodge.Creature.State
|
||||
--import Dodge.Creature.State.Data
|
||||
import Dodge.Item.Weapon
|
||||
import Dodge.Item.Weapon.AutoGun
|
||||
import Dodge.Item.Consumable
|
||||
--import Geometry
|
||||
import Picture
|
||||
|
||||
@@ -9,8 +9,11 @@ module Dodge.Creature.Picture
|
||||
import Dodge.Data
|
||||
--import Dodge.Creature.Stance.Data
|
||||
import Dodge.Creature.State.Data
|
||||
import Dodge.Creature.Stance.Data
|
||||
import Dodge.Creature.Test
|
||||
--import Dodge.Creature.AlertLevel.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Item.Data
|
||||
import Picture
|
||||
import Geometry
|
||||
|
||||
@@ -24,27 +27,16 @@ basicCrPict
|
||||
-> Picture
|
||||
basicCrPict col cr w = pictures $
|
||||
targetingPic ++
|
||||
[ tr . onLayer CrLayer . piercingMod $ bluntScale $ naked
|
||||
-- , drawAwakeLevel cr
|
||||
[ tr . piercingMod $ bluntScale $ naked col cr
|
||||
, trFeet $ feet cr
|
||||
, tr $ drawEquipment cr
|
||||
]
|
||||
where
|
||||
targetingPic = IM.elems $ IM.mapMaybeWithKey f $ _crInv cr
|
||||
f invid it = fmap ((\g -> g invid it cr w) . snd) (it ^? itTargeting . _Just)
|
||||
tr = uncurry translate (_crPos cr) . rotate (_crDir cr)
|
||||
trFeet = uncurry translate (_crPos cr) . rotate (_crMvDir cr)
|
||||
cdir = _crDir cr
|
||||
naked
|
||||
| strikeMelee = color white $ circleSolid $ _crRad cr
|
||||
| pdam > 200 = color red $ circleSolid $ _crRad cr
|
||||
| pdam > 99 = color white $ circleSolid $ _crRad cr
|
||||
| otherwise = pictures
|
||||
[ translate (0.25 * crad) 0 $ circleSolid (crad * 0.5)
|
||||
, scale 0.5 1 $ color col' $ circleSolid $ _crRad cr, circLine $ _crRad cr
|
||||
]
|
||||
crad = _crRad cr
|
||||
pastDams = _crPastDamage $ _crState cr
|
||||
pdam = sum $ concatMap (map _dmAmount) pastDams
|
||||
col' = light . light . light $ light col
|
||||
bluntDam :: Maybe Point2
|
||||
bluntDam = find isBluntDam (concat pastDams) >>= (\dm -> (-.-) <$> dm ^? dmFrom <*> dm ^? dmTo)
|
||||
bluntScale = case fmap argV bluntDam of
|
||||
@@ -58,9 +50,64 @@ basicCrPict col cr w = pictures $
|
||||
piercingMod = case fmap argV piercingDam of
|
||||
Just a -> rotate (a + cdir) . scale 0.8 1.2 . rotate (negate $ cdir + a)
|
||||
_ -> id
|
||||
pastDams = _crPastDamage $ _crState cr
|
||||
|
||||
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 _ RightForward) -> setL
|
||||
[ translate (-up) off $ circleSolid 5
|
||||
, translate (up) (-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
|
||||
off = 5
|
||||
up = 5
|
||||
|
||||
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
|
||||
[ 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
|
||||
]
|
||||
|
||||
| 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
|
||||
]
|
||||
where
|
||||
aboveIt = onLayer HPtLayer
|
||||
onCrL = onLayer CrLayer
|
||||
twistA = negate 1
|
||||
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
|
||||
pdam = sum $ concatMap (map _dmAmount) pastDams
|
||||
crad = _crRad cr
|
||||
pastDams = _crPastDamage $ _crState cr
|
||||
col' = light . light . light $ light col
|
||||
|
||||
--drawAwakeLevel
|
||||
-- :: Creature
|
||||
|
||||
Reference in New Issue
Block a user