Add skin colors

This commit is contained in:
2022-06-04 12:25:16 +01:00
parent 2b9ad58f6f
commit 602a004e87
14 changed files with 68 additions and 37 deletions
+1 -2
View File
@@ -15,7 +15,7 @@ import Dodge.Creature.Picture
import Dodge.Creature.Action
import Dodge.Item.Equipment
import Dodge.Item.Consumable
import Picture
--import Picture
import qualified Data.IntMap.Strict as IM
import Control.Lens
@@ -37,7 +37,6 @@ flockArmourChaseCrit = defaultCreature
, _crName = "armourChaseCrit"
, _crHP = 300
, _crPict = basicCrPict
, _crSkinColor = green
, _crInv = IM.fromList
[(0,frontArmour)
,(1,medkit 200)
+2 -1
View File
@@ -18,11 +18,11 @@ import Picture
--
--import Data.Maybe
import qualified Data.IntMap.Strict as IM
import Control.Lens
autoCrit :: Creature
autoCrit = defaultCreature
{ _crPict = basicCrPict
, _crSkinColor = red
, _crUpdate = defaultImpulsive [sentinelAI]
, _crActionPlan = ActionPlan
{ _crImpulse = []
@@ -36,3 +36,4 @@ autoCrit = defaultCreature
, _crHP = 300
, _crMvType = defaultAimMvType
}
& crSkin . skinUpper .~ light4 red
-2
View File
@@ -27,7 +27,6 @@ smallChaseCrit = chaseCrit
{ _crHP = 1
, _crRad = 4
, _crPict = basicCrPict
, _crSkinColor = green
, _crInv = IM.fromList [(0,medkit 200)]
, _crCorpse = setDepth 5 $ color (greyN 0.5) $ circleSolid 4
}
@@ -54,7 +53,6 @@ chaseCrit = defaultCreature
, _crName = "chaseCrit"
, _crHP = 150
, _crPict = basicCrPict
, _crSkinColor = green
, _crInv = IM.fromList [(0,medkit 200)]
, _crMeleeCooldown = 0
, _crFaction = ColorFaction green
+1 -1
View File
@@ -25,7 +25,6 @@ import Control.Lens
launcherCrit :: Creature
launcherCrit = defaultCreature
{ _crPict = basicCrPict
, _crSkinColor = red
, _crUpdate = defaultImpulsive
[ performActions
, watchUpdateStrat
@@ -52,6 +51,7 @@ launcherCrit = defaultCreature
, _crState = defaultState
, _crHP = 300
}
& crSkin . skinUpper .~ light4 red
retreatFire :: Action
retreatFire = ImpulsesList ( [ UseItem ] : replicate 20 [ Turn 0.16 ])
+1 -1
View File
@@ -23,7 +23,6 @@ import Control.Lens
ltAutoCrit :: Creature
ltAutoCrit = defaultCreature
{ _crPict = basicCrPict
, _crSkinColor = red
, _crUpdate = defaultImpulsive
[ performActions
, watchUpdateStrat
@@ -55,6 +54,7 @@ ltAutoCrit = defaultCreature
, _crRad = 10
, _crHP = 500
}
& crSkin . skinUpper .~ light4 red
chooseMovement :: Creature -> World -> Action
chooseMovement cr w
+9 -11
View File
@@ -36,7 +36,7 @@ basicCrPict :: Creature
basicCrPict cr cfig w =
drawCrEquipment cr
<>
(basicCrShape col cr
(basicCrShape cr
, pictures $
targetingPic ++
[ creatureDisplayText cfig w cr
@@ -44,7 +44,6 @@ basicCrPict cr cfig w =
]
)
where
col = _crSkinColor cr
targetingPic = IM.elems $ IM.mapMaybeWithKey f $ _crInv cr
f invid it = fmap (\g -> g invid it cr cfig w) (it ^? itTargeting . tgDraw)
@@ -58,24 +57,23 @@ shapeAtCrPos sh cr _ _ =
)
basicCrShape
:: Color -- ^ Creature color
-> Creature
:: Creature
-> Shape
basicCrShape col cr
basicCrShape cr
| _crCamouflage cr == Invisible = mempty
| otherwise = tr . scaleSH (V3 crsize crsize crsize) $ mconcat
[ --rotdir . _spShape $ drawEquipment cr
rotdir . dm . translateSHz 20 $ scalp cr
, rotdir . dm $ upperBody col cr
, dm . rotmdir $ feet cr
rotdir . dm . colorSH (_skinHead cskin) . translateSHz 20 $ scalp cr
, rotdir . dm $ colorSH (_skinUpper cskin) $ upperBody cr
, dm . rotmdir $ colorSH (_skinLower cskin) $ feet cr
]
where
cskin = _crSkin cr
crsize = 0.1 * _crRad cr
dm = damageModSH cr
tr = uncurryV translateSHf (_crPos cr)
rotdir = rotateSH (_crDir cr)
rotmdir = rotateSH (_crMvDir cr)
. colorSH (greyN 0.3)
creatureDisplayText :: Configuration -> World -> Creature -> Picture
creatureDisplayText cfig w cr
@@ -227,10 +225,10 @@ baseShoulder :: Shape
{-# INLINE baseShoulder #-}
baseShoulder = translateSHz (-10) . scaleSH (V3 0.5 1 1) . upperPrismPolyHalf 10 $ polyCirc 3 1
upperBody :: Color -> Creature -> Shape
upperBody :: Creature -> Shape
{-# INLINE upperBody #-}
--upperBody col cr = colorSH (light4 col) $ mconcat
upperBody col cr = colorSH (light4 col) $ mconcat
upperBody cr = mconcat
[ arms cr
, shoulderSH $ torso cr
]
+1 -1
View File
@@ -27,7 +27,6 @@ import Control.Monad.State
pistolCrit :: Creature
pistolCrit = defaultCreature
{ _crPict = basicCrPict
, _crSkinColor = red
, _crUpdate = defaultImpulsive
[ performActions
, watchUpdateStrat
@@ -54,6 +53,7 @@ pistolCrit = defaultCreature
, _crRad = 10
, _crHP = 500
}
& crSkin . skinUpper .~ light4 red
chooseMovement :: Creature -> World -> Action
chooseMovement cr w = chooseMovement' cr w
`DoActionThen`
+1 -1
View File
@@ -25,7 +25,6 @@ import Control.Lens
spreadGunCrit :: Creature
spreadGunCrit = defaultCreature
{ _crPict = basicCrPict
, _crSkinColor = red
, _crUpdate = defaultImpulsive
[performActions
,watchUpdateStrat
@@ -57,6 +56,7 @@ spreadGunCrit = defaultCreature
, _crRad = 10
, _crHP = 500
}
& crSkin . skinUpper .~ light4 red
chooseMovement :: Creature -> World -> Action
chooseMovement cr w
+1 -2
View File
@@ -77,8 +77,7 @@ checkDeath cr w
removecr
| _crID cr == 0 = (creatures . ix (_crID cr) . crUpdate .~ const id)
. (creatures . ix (_crID cr) . crPict .~ const mempty)
. addGibsAt (_crSkinColor cr) (_crPos cr)
. addGibsAt (_crSkinColor cr) (_crPos cr)
. addCrGibs cr
| otherwise = creatures . at (_crID cr) .~ Nothing
addCorpse = IM.insertNewKey
$ uncurryV translate (_crOldPos cr)
+1 -1
View File
@@ -31,11 +31,11 @@ swarmCrit = defaultCreature
, _crRad = 2
, _crMass = 2
, _crPict = basicCrPict
, _crSkinColor = yellow
, _crCorpse = setDepth 5 $ color (greyN 0.5) $ circleSolid 2
, _crFaction = ColorFaction yellow
, _crMeleeCooldown = 0
}
& crSkin . skinUpper .~ light4 yellow
--swarmCritMoveFunc :: Creature -> Point2 -> Creature -> Point2
--swarmCritMoveFunc tcr cenp cr