Work on damage sounds

This commit is contained in:
2025-06-22 16:00:53 +01:00
parent 291f77e13d
commit 4e008366f4
7 changed files with 156 additions and 181 deletions
+4 -4
View File
@@ -313,14 +313,14 @@ stackedInventory =
[ torch
, magShield MagnetRepulse
, bangCone
, megaTinMag 100
, megaTinMag 1000
, arHUD
, smallBattery
, makeTypeCraft TRANSFORMER
, remoteScreen
, megaShellMag
, burstRifle
, megaTinMag 100
, megaTinMag 1000
, underBarrelSlot
, gLauncher
, megaShellMag
@@ -343,9 +343,9 @@ stackedInventory =
, timeStopper
, tractorGun
, autoPistol
, tinMag
, megaTinMag 1000
, pistol
, tinMag
, megaTinMag 1000
, blinker
, miniGunX 3
, beltMag
+3 -40
View File
@@ -10,43 +10,8 @@ import Dodge.Spark
import Geometry
import LensHelp
--applyCreatureDamage :: [Damage] -> Creature -> World -> World
--applyCreatureDamage dms cr =
-- case crMaterial (cr ^. crType) of
-- Flesh -> defaultApplyDamage dms cr
-- Crystal -> id
-- _ -> defaultApplyDamage dms cr
--defaultApplyDamage :: [Damage] -> Creature -> World -> World
--defaultApplyDamage ds cr w =
applyCreatureDamage :: [Damage] -> Creature -> World -> World
applyCreatureDamage dms cr w = foldl' (applyIndividualDamage cr) w dms
-- foldl' (applyIndividualDamage cr) w ds'
-- & cWorld . lWorld . creatures . ix (_crID cr) %~ doPoisonDam
-- where
-- (ps, ds') = partition isPoison ds
-- isPoison Poison{} = True
-- isPoison _ = False
-- poisonDam = quot (max 0 (sum (map _dmAmount ps))) 10
-- doPoisonDam = crHP -~ poisonDam
--applyDamageEffect :: Damage -> DamageEffect -> Creature -> World -> World
--applyDamageEffect dm de cr = case de of
-- PushDamage push pushexp pushRad ->
-- cWorld . lWorld . creatures . ix (_crID cr) . crPos .+.+~ pushAmount *.* squashNormalizeV (_crPos cr -.- fromDir)
-- where
-- pushAmount
-- | dist (_crPos cr) fromDir == 0 = 0
-- | otherwise = min 5 $ (push * 5 * pushRad / (dist (_crPos cr) fromDir * crMass (_crType cr))) ** pushexp
-- PushBackDamage pback ->
-- cWorld . lWorld . creatures . ix (_crID cr) . crPos .+.+~ (pback / crMass (_crType cr)) *.* (_dmTo dm -.- fromDir)
-- TorqueDamage rot ->
-- cWorld . lWorld . creatures . ix (_crID cr) . crDir +~ rot
-- NoDamageEffect -> id
-- where
-- fromDir = _dmFrom dm
--p = _dmAt dm
applyIndividualDamage :: Creature -> World -> Damage -> World
applyIndividualDamage cr w dm = damMatSideEffect dm (crMaterial (_crType cr)) (Left cr) $
@@ -56,7 +21,7 @@ applyIndividualDamage cr w dm = damMatSideEffect dm (crMaterial (_crType cr)) (L
applyPiercingDamage :: Creature -> Damage -> World -> World
applyPiercingDamage cr dm
| crIsArmouredFrom p cr = f . makeSpark NormalSpark p1 (argV (p1 -.- p))
| crIsArmouredFrom p cr = f . makeSpark NormalSpark p1 (argV (p1 - p))
| otherwise = f . damageHP cr (_dmAmount dm)
where
f = cWorld . lWorld . creatures . ix (_crID cr) . crPos -~ _dmVector dm
@@ -67,7 +32,5 @@ applyPiercingDamage cr dm
damageHP :: Creature -> Int -> World -> World
damageHP cr x =
cWorld . lWorld . creatures . ix (_crID cr)
%~ ( (crHP -~ x)
. (crPain +~ x)
)
(cWorld . lWorld . creatures . ix (_crID cr) . crHP -~ x)
. (cWorld . lWorld . creatures . ix (_crID cr) . crPain +~ x)
+2 -4
View File
@@ -86,7 +86,5 @@ followImpulse cr w imp = case imp of
posFromID cid' = w ^?! cWorld . lWorld . creatures . ix cid' . crPos
rr a = randomR (- a, a) $ _randGen w
hitCr i =
( cWorld . lWorld . creatures . ix i . crDamage
.:~ Blunt 100 (posFromID i) (posFromID i-cpos)-- (PushBackDamage 5)
)
. soundStart (CrSound cid) cpos hitS Nothing
cWorld . lWorld . creatures . ix i . crDamage
.:~ Blunt 100 (posFromID i) (posFromID i-cpos)
+6 -4
View File
@@ -60,8 +60,10 @@ damageMetal dm ecw w =
Piercing _ p t ->
makeSpark NormalSpark (outTo p t) (rdir p t)
. randsound p [tingS, ting1S, ting2S, ting3S, ting4S, ting5S]
Blunt _ p t -> id
Shattering _ p t -> id
Blunt _ p t ->
makeSpark NormalSpark (outTo p t) (rdir p t)
. randsound p [tingS, ting1S, ting2S, ting3S, ting4S, ting5S]
Shattering _ _ _ -> id
Crushing{} -> id
Explosive{} -> id
Sparking{} -> id
@@ -84,7 +86,7 @@ damageMetal dm ecw w =
damageFlesh :: Damage -> ECW -> World -> World
damageFlesh dm ecw w = w & case dm of
Lasering _ p t -> id
Lasering _ _ _ -> id
Piercing _ p t ->
randsound
p
@@ -98,7 +100,7 @@ damageFlesh dm ecw w = w & case dm of
, bloodShort8S
]
. smokeCloudAt red 20 200 1 (addZ 20 (outTo p t))
Blunt _ p t -> id
Blunt _ p _ -> randsound p [hitS]
Shattering _ p t -> id
Crushing{} -> id
Explosive{} -> id