Move creature mass out of record
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -16,7 +16,6 @@ colorLamp col h =
|
||||
{ _crHP = 100
|
||||
, _crType = LampCrit h col Nothing
|
||||
, _crRad = 3
|
||||
, _crMass = 3
|
||||
}
|
||||
|
||||
lamp :: Float -> Creature
|
||||
|
||||
@@ -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
|
||||
@@ -12,8 +12,6 @@ swarmCrit =
|
||||
defaultCreature
|
||||
{ _crHP = 1
|
||||
, _crRad = 2
|
||||
, _crMass = 2
|
||||
-- , _crCorpse = MakeDefaultCorpse
|
||||
, _crFaction = ColorFaction yellow
|
||||
, _crMeleeCooldown = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user