Tweak gormlak movement slightly
- Don't let gormlaks run into things like walls or each other - Add a small element of randomness to gormlaks' motion - Increase gormlaks' vision by a large amount
This commit is contained in:
parent
abea2dcfac
commit
ec39dc0a5b
8 changed files with 115 additions and 36 deletions
|
|
@ -57,11 +57,6 @@ makeApp = pure $ Brick.App
|
|||
runAppM :: AppM a -> GameState -> EventM Name a
|
||||
runAppM appm = fmap fst . runAppT appm
|
||||
|
||||
-- testGormlak :: Creature
|
||||
-- testGormlak =
|
||||
-- let Just (Creature gormlak) = raw "gormlak"
|
||||
-- in Creature.newWithType gormlak
|
||||
|
||||
startEvent :: AppM ()
|
||||
startEvent = do
|
||||
initLevel
|
||||
|
|
@ -264,20 +259,3 @@ attackAt pos =
|
|||
say ["combat", "hit"] msgParams
|
||||
entities . ix creatureID . positioned .= SomeEntity creature'
|
||||
stepGame
|
||||
|
||||
data Collision
|
||||
= Stop
|
||||
| Combat
|
||||
deriving stock (Show, Eq, Ord, Generic)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
collisionAt :: MonadState GameState m => Position -> m (Maybe Collision)
|
||||
collisionAt pos = do
|
||||
ents <- use $ entities . EntityMap.atPosition pos
|
||||
pure $
|
||||
if | null ents -> Nothing
|
||||
| any (entityIs @Creature) ents -> pure Combat
|
||||
| all (entityIs @Item) ents -> Nothing
|
||||
| doors@(_ : _) <- ents ^.. folded . _SomeEntity @Door
|
||||
, all (view open) doors -> Nothing
|
||||
| otherwise -> pure Stop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue