about summary refs log tree commit diff
path: root/src/Xanthous/Entities/Creature.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xanthous/Entities/Creature.hs')
-rw-r--r--src/Xanthous/Entities/Creature.hs25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/Xanthous/Entities/Creature.hs b/src/Xanthous/Entities/Creature.hs
index 5af24a8cd3eb..024859473f21 100644
--- a/src/Xanthous/Entities/Creature.hs
+++ b/src/Xanthous/Entities/Creature.hs
@@ -1,28 +1,33 @@
 {-# LANGUAGE RecordWildCards #-}
 {-# LANGUAGE TemplateHaskell #-}
--- |
-
-module Xanthous.Entities.Creature where
-
-import Data.Word
-
+--------------------------------------------------------------------------------
+module Xanthous.Entities.Creature
+  ( Creature(..)
+  , creatureType
+  , hitpoints
+  , newWithType
+  , damage
+  ) where
+--------------------------------------------------------------------------------
 import Xanthous.Prelude
+--------------------------------------------------------------------------------
+import Data.Word
+--------------------------------------------------------------------------------
 import Xanthous.Entities.RawTypes hiding (Creature)
-import Xanthous.Entities (Draw(..), Entity(..))
+import Xanthous.Entities (Draw(..), Entity(..), DrawRawChar(..))
+--------------------------------------------------------------------------------
 
 data Creature = Creature
   { _creatureType :: CreatureType
   , _hitpoints :: Word16
   }
   deriving stock (Eq, Show, Generic)
+  deriving Draw via DrawRawChar "_creatureType" Creature
 makeLenses ''Creature
 
 instance Entity Creature where
   blocksVision _ = False
 
-instance Draw Creature where
-  draw = draw .view (creatureType . char)
-
 newWithType :: CreatureType -> Creature
 newWithType _creatureType =
   let _hitpoints = _creatureType ^. maxHitpoints