Add squash when receiving blunt damage
This commit is contained in:
+27
-23
@@ -43,7 +43,7 @@ spawnerCrit :: Creature
|
||||
spawnerCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate $ spawnerAI chaseCrit
|
||||
, _crHP = 300
|
||||
, _crPict = enemyPict blue
|
||||
, _crPict = basicCrPict blue
|
||||
, _crState = defaultState {_goals = [[WaitFor 0]]
|
||||
}
|
||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||
@@ -53,7 +53,7 @@ smallChaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate chaseAI
|
||||
, _crHP = 1
|
||||
, _crRad = 4
|
||||
, _crPict = enemyPict green
|
||||
, _crPict = basicCrPict green
|
||||
, _crState = defaultState {_goals = [[Wait]]
|
||||
,_faction = ChaseCritters}
|
||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||
@@ -63,7 +63,7 @@ chaseCrit :: Creature
|
||||
chaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate chaseAI
|
||||
, _crHP = 300
|
||||
, _crPict = enemyPict green
|
||||
, _crPict = basicCrPict green
|
||||
, _crState = defaultState {_goals = [[Wait]]
|
||||
,_faction = ChaseCritters}
|
||||
, _crInv = IM.empty
|
||||
@@ -72,7 +72,7 @@ armourChaseCrit :: Creature
|
||||
armourChaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate chaseAI
|
||||
, _crHP = 300
|
||||
, _crPict = enemyPict green
|
||||
, _crPict = basicCrPict green
|
||||
, _crState = defaultState {_goals = [[Wait]]}
|
||||
, _crInv = IM.fromList
|
||||
[(0,frontArmour)
|
||||
@@ -81,7 +81,7 @@ armourChaseCrit = defaultCreature
|
||||
}
|
||||
miniGunCrit :: Creature
|
||||
miniGunCrit = defaultCreature
|
||||
{ _crPict = enemyPict red
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate miniAI
|
||||
, _crInv = IM.fromList [(0,miniGun)]
|
||||
, _crInvSel = 0
|
||||
@@ -91,7 +91,7 @@ miniGunCrit = defaultCreature
|
||||
}
|
||||
longCrit :: Creature
|
||||
longCrit = defaultCreature
|
||||
{ _crPict = enemyPict red
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate sniperAI
|
||||
, _crInv = IM.fromList [(0,longGun),(1,medkit 100)]
|
||||
, _crInvSel = 0
|
||||
@@ -101,7 +101,7 @@ longCrit = defaultCreature
|
||||
}
|
||||
multGunCrit :: Creature
|
||||
multGunCrit = defaultCreature
|
||||
{ _crPict = enemyPict red
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate (twitchMissAI 300 350)
|
||||
, _crInv = IM.fromList [(0,multGun),(1,medkit 100)]
|
||||
, _crInvSel = 0
|
||||
@@ -111,7 +111,7 @@ multGunCrit = defaultCreature
|
||||
}
|
||||
launcherCrit :: Creature
|
||||
launcherCrit = defaultCreature
|
||||
{ _crPict = enemyPict red
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate (launcherAI 150 200)
|
||||
, _crInv = IM.fromList [(0,launcher)]
|
||||
, _crInvSel = 0
|
||||
@@ -121,7 +121,7 @@ launcherCrit = defaultCreature
|
||||
}
|
||||
spreadGunCrit :: Creature
|
||||
spreadGunCrit = defaultCreature
|
||||
{ _crPict = enemyPict red
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate chargeAI
|
||||
, _crInv = IM.fromList [(0,spreadGun),(1,medkit 100)]
|
||||
, _crInvSel = 0
|
||||
@@ -131,7 +131,7 @@ spreadGunCrit = defaultCreature
|
||||
}
|
||||
pistolCrit :: Creature
|
||||
pistolCrit = defaultCreature
|
||||
{ _crPict = enemyPict red
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate (dodgeAI 150 200)
|
||||
, _crInv = IM.fromList [(0,pistol),(1,medkit 100)]
|
||||
, _crInvSel = 0
|
||||
@@ -141,7 +141,7 @@ pistolCrit = defaultCreature
|
||||
}
|
||||
autoCrit :: Creature
|
||||
autoCrit = defaultCreature
|
||||
{ _crPict = enemyPict red
|
||||
{ _crPict = basicCrPict red
|
||||
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
||||
, _crUpdate = stateUpdate basicShooterAI
|
||||
--, _crUpdate = shooterFootsteps n . makeStateAI autoShooterAI n
|
||||
@@ -250,11 +250,11 @@ startCr = defaultCreature
|
||||
, _crOldPos = (0,0)
|
||||
, _crDir = 0
|
||||
, _crID = 0
|
||||
, _crPict = basicCrPict $ greyN 0.8
|
||||
, _crPict = basicCrPict $ black
|
||||
, _crUpdate = stateUpdate yourControl
|
||||
, _crRad = 10
|
||||
, _crMass = 10
|
||||
, _crHP = 1000
|
||||
, _crHP = 1000000
|
||||
, _crMaxHP = 1500
|
||||
, _crInv = startInventory
|
||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ pictures [color (greyN 0.8) $ circleSolid 10, circLine 10]
|
||||
@@ -287,9 +287,6 @@ startInventory = IM.fromList (zip [0..20]
|
||||
|
||||
smokeGenGun = effectGun "smoke" $ \_ -> spawnSmokeAtCursor
|
||||
|
||||
enemyPict :: Color -> Creature -> Picture
|
||||
enemyPict col = equipOnTop $ sizeEnemy (light $ light $ light $ light col)
|
||||
|
||||
sizeEnemy col cr
|
||||
| pdam > 200 = color red $ circleSolid $ _crRad cr
|
||||
| pdam > 100 = color white $ circleSolid $ _crRad cr
|
||||
@@ -297,17 +294,24 @@ sizeEnemy col cr
|
||||
| otherwise = pictures [color col $ circleSolid $ _crRad cr
|
||||
, circLine $ _crRad cr ]
|
||||
where
|
||||
pdam = _crPastDamage $ _crState cr
|
||||
pdam = sum $ concatMap (map _dmAmount) $ _crPastDamage $ _crState cr
|
||||
|
||||
sizeColEnemy r col = pictures [color col $ circleSolid r, circLine r]
|
||||
|
||||
basicCrPict :: Color -> Creature -> Picture
|
||||
basicCrPict col cr = pictures [ onLayer CrLayer naked , drawEquipment cr]
|
||||
basicCrPict col cr = pictures [ onLayer CrLayer $ bluntScale naked , drawEquipment cr]
|
||||
where
|
||||
cdir = _crDir cr
|
||||
naked | pdam > 200 = color red $ circleSolid $ _crRad cr
|
||||
| pdam > 100 = color white $ circleSolid $ _crRad cr
|
||||
| mod pdam 2 == 1 = color white $ circleSolid $ _crRad cr
|
||||
-- | crDam > _crHP cr && odd (crDam - _crHP cr)
|
||||
-- = [color white $ circleSolid $ _crRad cr]
|
||||
| otherwise = pictures [color col $ circleSolid $ _crRad cr, circLine $ _crRad cr]
|
||||
pdam = _crPastDamage $ _crState cr
|
||||
| otherwise = pictures [color col' $ circleSolid $ _crRad cr, circLine $ _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
|
||||
Just a -> rotate (a + cdir) . scale 0.8 1.2 . rotate (negate $ cdir + a)
|
||||
_ -> id
|
||||
isBluntDam (Blunt {}) = True
|
||||
isBluntDam _ = False
|
||||
|
||||
Reference in New Issue
Block a user