Add Read/Show instance for Creature

This commit is contained in:
2022-07-22 10:44:54 +01:00
parent 4c5218c633
commit 6b69fc1684
35 changed files with 345 additions and 225 deletions
+9 -17
View File
@@ -1,6 +1,6 @@
module Dodge.Default.Creature where
import Dodge.Data
import Dodge.Creature.Picture
import Dodge.Data.FloatFunction
import Geometry.Data
import Picture
@@ -30,7 +30,7 @@ defaultCreature = Creature
, _crInvEquipped = mempty
, _crLeftInvSel = Nothing
, _crState = defaultState
, _crCorpse = basicCrCorpse
, _crCorpse = MakeDefaultCorpse
, _crMaterial = Flesh
, _crPastDamage = 0
, _crEquipment = M.empty
@@ -78,17 +78,12 @@ defaultPerceptionState = Perception
}
defaultVision :: Vision
defaultVision = Eyes
{ _viFOV = f
, _viDist = g
{ _viFOV = FloatFOV 0.5
, _viDist = FloatLessCheck 500
}
where
f x | abs x < 0.5 * pi = 1
| otherwise = 0
g x | x > 500 = 0
| otherwise = 1
defaultAudition :: Audition
defaultAudition = Ears
{ _auDist = id
{ _auDist = FloatID
}
defaultIntention :: Intention
defaultIntention = Intention
@@ -99,9 +94,9 @@ defaultIntention = Intention
defaultChaseMvType :: CrMvType
defaultChaseMvType = CrMvType
{ _mvSpeed = 2
, _mvTurnRad = f
, _mvTurnRad = FloatAbsCheckGreaterLess (pi/4) 0.2 0.05--f
, _mvTurnJit = 0.2
, _mvAimSpeed = g
, _mvAimSpeed = FloatAbsCheckGreaterLess (pi/8) 0.2 0.01
}
where
g x | x > pi/8 = 0.2
@@ -111,13 +106,10 @@ defaultChaseMvType = CrMvType
defaultAimMvType :: CrMvType
defaultAimMvType = CrMvType
{ _mvSpeed = 3
, _mvTurnRad = const 0.2
, _mvTurnRad = FloatConst 0.2
, _mvTurnJit = 0.05
, _mvAimSpeed = f
, _mvAimSpeed = FloatAbsCheckGreaterLess (pi/8) 0.2 0.01
}
where
f x | x > pi/8 = 0.2
| otherwise = 0.01
defaultAimingCrit :: Creature
defaultAimingCrit = defaultCreature { _crMvType = defaultAimMvType }