Chase crit suspicion increases more when you are closer
This commit is contained in:
@@ -47,9 +47,6 @@ basicAwarenessUpdate cr = case _cpAttention $ _crPerception cr of
|
||||
newAwareness = (IM.mapMaybe decreaseAwareness . IM.unionWith combineAwareness is) oldAwareness
|
||||
becomesCognizant = any isCognizant $ IM.unionWith cogRaised oldAwareness newAwareness
|
||||
thejitter = RandImpulseCircMove 1
|
||||
--do
|
||||
--p <- randInCirc 1
|
||||
--return $ Move p
|
||||
maybeBark
|
||||
| becomesCognizant = case vocalizationTest cr of
|
||||
Just sid ->
|
||||
@@ -81,11 +78,7 @@ chaseCritAwarenessUpdate w cr = case _cpAttention $ _crPerception cr of
|
||||
oldAwareness = _cpAwareness $ _crPerception cr
|
||||
newAwareness = (IM.mapMaybe decreaseAwareness . IM.unionWith combineAwareness is) oldAwareness
|
||||
becomesCognizant = any isCognizant $ IM.unionWith cogRaised oldAwareness newAwareness
|
||||
--randBool = takeOne [False,True] & evalState $ _randGen w
|
||||
thejitter = RandImpulseCircMove 2
|
||||
-- do
|
||||
-- p <- randInCirc 2
|
||||
-- return $ Move p
|
||||
maybeBark
|
||||
| becomesCognizant -- && randBool
|
||||
&& cr ^? crVocalization . vcCoolDown == Just 0 =
|
||||
@@ -99,7 +92,7 @@ chaseCritAwarenessUpdate w cr = case _cpAttention $ _crPerception cr of
|
||||
replicate numjits [RandomImpulse thejitter]
|
||||
++ [[ChangeStrategy $ CloseToMelee 0]]
|
||||
)
|
||||
, AimAt 0 (w ^?! cWorld . lWorld . creatures . ix 0 . crPos) --_crPos $ _creatures (_cWorld w) IM.! 0)
|
||||
, AimAt 0 (w ^?! cWorld . lWorld . creatures . ix 0 . crPos)
|
||||
]
|
||||
| otherwise = id
|
||||
|
||||
@@ -149,20 +142,26 @@ newExtraAwareness ::
|
||||
newExtraAwareness cr w cid
|
||||
| dist cpos tpos > 600 = Nothing
|
||||
| not $ canSeeIndirect (_crID cr) cid w = Nothing
|
||||
| otherwise = Just . Suspicious $ doFloatFloat (_viFOV vi) ang * doFloatFloat (_viDist vi) d * awakeLevelPerception cr
|
||||
| otherwise = Just . Suspicious $ visionCheck cr tpos * awakeLevelPerception cr
|
||||
where
|
||||
tpos = w ^?! cWorld . lWorld . creatures . ix cid . crPos -- _crPos $ _creatures (_cWorld w) IM.! cid
|
||||
cpos = _crPos cr
|
||||
|
||||
visionCheck :: Creature -> Point2 -> Float
|
||||
visionCheck cr tpos = doFloatFloat (_viFOV vi) ang * doFloatFloat (_viDist vi) d
|
||||
where
|
||||
vi = _cpVision $ _crPerception cr
|
||||
tpos = w ^?! cWorld . lWorld . creatures . ix cid . crPos -- _crPos $ _creatures (_cWorld w) IM.! cid
|
||||
cpos = _crPos cr
|
||||
ang = angleVV (unitVectorAtAngle (_crDir cr)) (tpos - cpos)
|
||||
d = dist tpos cpos
|
||||
|
||||
|
||||
awakeLevelPerception :: Creature -> Float
|
||||
awakeLevelPerception cr = case _cpVigilance $ _crPerception cr of
|
||||
Comatose -> 0
|
||||
Asleep -> 10
|
||||
Lethargic -> 200
|
||||
Vigilant -> 500
|
||||
Lethargic -> 100
|
||||
Vigilant -> 1000
|
||||
Overstrung -> 10000
|
||||
|
||||
newSounds :: World -> [(Point2, Float)]
|
||||
@@ -174,14 +173,8 @@ newSounds = mapMaybe f . M.elems . _playingSounds
|
||||
|
||||
rememberSounds :: World -> Creature -> Creature
|
||||
rememberSounds w cr =
|
||||
cr
|
||||
& crMemory . soundsToInvestigate .~ closesounds
|
||||
& awakeupdate
|
||||
where
|
||||
awakeupdate
|
||||
| null closesounds = id
|
||||
| otherwise = crPerception . cpVigilance .~ Vigilant
|
||||
closesounds = map fst (filter (soundIsClose w cr) (newSounds w))
|
||||
cr & crMemory . soundsToInvestigate
|
||||
.~ map fst (filter (soundIsClose w cr) (newSounds w))
|
||||
|
||||
-- TODO work out correct form for sounds passing through walls
|
||||
soundIsClose :: World -> Creature -> (Point2, Float) -> Bool
|
||||
|
||||
Reference in New Issue
Block a user