diff --git a/src/Level.hs b/src/Level.hs index 6fcff1faa..03129d3e4 100644 --- a/src/Level.hs +++ b/src/Level.hs @@ -29,7 +29,7 @@ data LevelName = LambdaCave Int | Exit -- the strength of the character and the strength of the monsters present -- could further influence the chance, and the chance could also affect -- which monster is generated. -monsterGenChance :: LevelName -> [Monster] -> Rnd Bool +monsterGenChance :: LevelName -> [Movable] -> Rnd Bool monsterGenChance (LambdaCave n) ms = chance $ 1%(fromIntegral (250 + 200 * (L.length ms - n)) `max` 50) monsterGenChance _ _ = return False diff --git a/src/Monster.hs b/src/Monster.hs index 591256a63..88becf6b7 100644 --- a/src/Monster.hs +++ b/src/Monster.hs @@ -19,15 +19,10 @@ heroHP config = in k + b `div` (k + 1) -- | Initial hero. -defaultHero :: Char -> String -> Loc -> Int -> Hero +defaultHero :: Char -> String -> Loc -> Int -> Movable defaultHero symbol name ploc hp = Movable (Hero symbol name) hp hp Nothing TCursor ploc [] 'a' 10 0 --- The types should be equal, becase monsters can be sometimes --- player-controlled and heroes can be alien-controlled or panicked, etc. -type Hero = Movable -type Monster = Movable - data Movable = Movable { mtype :: !MovableType, mhpmax :: !Int, @@ -120,7 +115,7 @@ monsterFrequency = ] -- | Generate monster. -newMonster :: Loc -> Frequency MovableType -> Rnd Monster +newMonster :: Loc -> Frequency MovableType -> Rnd Movable newMonster loc ftp = do tp <- frequency ftp diff --git a/src/State.hs b/src/State.hs index dfa382665..276776393 100644 --- a/src/State.hs +++ b/src/State.hs @@ -121,10 +121,10 @@ insertActor a m = AHero n -> updateLevel (updateHeroes (IM.insert n m)) AMonster n -> updateLevel (updateMonsters (IM.insert n m)) -levelHeroList :: State -> [Hero] +levelHeroList :: State -> [Movable] levelHeroList (State { slevel = Level { lheroes = hs } }) = IM.elems hs -levelMonsterList :: State -> [Monster] +levelMonsterList :: State -> [Movable] levelMonsterList (State { slevel = Level { lmonsters = ms } }) = IM.elems ms updateCursor :: (Cursor -> Cursor) -> State -> State