Move creature mass out of record

This commit is contained in:
2025-06-06 09:10:03 +01:00
parent aa219acf8d
commit 73c79f2f4d
12 changed files with 76 additions and 67 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
module Dodge.Creature.Damage where
import Dodge.Creature.Mass
import Color
import Data.List
import Dodge.Creature.Test
@@ -35,9 +36,9 @@ applyDamageEffect dm de cr = case de of
where
pushAmount
| dist (_crPos cr) fromDir == 0 = 0
| otherwise = min 5 $ (push * 5 * pushRad / (dist (_crPos cr) fromDir * _crMass cr)) ** pushexp
| 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 cr) *.* (_dmTo dm -.- fromDir)
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
-1
View File
@@ -16,7 +16,6 @@ colorLamp col h =
{ _crHP = 100
, _crType = LampCrit h col Nothing
, _crRad = 3
, _crMass = 3
}
lamp :: Float -> Creature
+13
View File
@@ -0,0 +1,13 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Creature.Mass (crMass) where
import Dodge.Data.Creature.Misc
crMass :: CreatureType -> Float
crMass = \case
Avatar {} -> 10
AvatarDead -> 10
ChaseCrit -> 10
SwarmCrit -> 2
AutoCrit -> 10
BarrelCrit{} -> 10
LampCrit {} -> 3
-2
View File
@@ -12,8 +12,6 @@ swarmCrit =
defaultCreature
{ _crHP = 1
, _crRad = 2
, _crMass = 2
-- , _crCorpse = MakeDefaultCorpse
, _crFaction = ColorFaction yellow
, _crMeleeCooldown = 0
}