Cleanup creature update slightly, add show instance for impulses
This commit is contained in:
+30
-6
@@ -44,7 +44,7 @@ import Dodge.GameRoom
|
||||
import Color
|
||||
import Shape
|
||||
|
||||
import qualified Data.Vector as V
|
||||
--import qualified Data.Vector as V
|
||||
import GHC.Generics
|
||||
import Control.Lens
|
||||
import Control.Monad.State
|
||||
@@ -862,10 +862,7 @@ data Impulse
|
||||
| UseItem
|
||||
| SwitchToItem Int
|
||||
| DropItem
|
||||
-- | PickupNearby Int
|
||||
-- | UseWorldObject Int
|
||||
| Bark SoundID -- placeholder for various communication types
|
||||
-- | UseIntrinsicAbility
|
||||
| Melee Int
|
||||
| ChangePosture Posture
|
||||
| MakeSound SoundID
|
||||
@@ -882,6 +879,30 @@ data Impulse
|
||||
| ImpulseUseAheadPos
|
||||
{_impulseUseAheadPos :: Point2 -> Impulse
|
||||
}
|
||||
instance Show Impulse where
|
||||
show imp = case imp of
|
||||
Move p -> "Move "++show p
|
||||
MoveForward f -> "MoveForward "++ show f
|
||||
Turn f -> "Turn "++show f
|
||||
RandomTurn f -> "RandomTurn "++show f
|
||||
TurnToward p f -> "TurnToward "++show p++show f
|
||||
MvTurnToward p -> "MvTurnToward "++show p
|
||||
MvForward -> "MvForward"
|
||||
TurnTo p -> "TurnTo "++show p
|
||||
UseItem -> "UseItem"
|
||||
SwitchToItem i -> "SwitchToItem "++show i
|
||||
DropItem -> "DropItem"
|
||||
Bark sid -> "Bark "++show sid
|
||||
Melee i -> "Melee "++show i
|
||||
ChangePosture post -> "ChangePosture " ++ show post
|
||||
MakeSound sid -> "MakeSound " ++ show sid
|
||||
ChangeStrategy s -> "ChangeStrategy " ++ show s
|
||||
AddGoal g -> "AddGoal " ++ show g
|
||||
ArbitraryImpulseFunction {} -> "ArbitraryImpulseFunction"
|
||||
ArbitraryImpulse {} -> "ArbitraryImpulse"
|
||||
ImpulseUseTargetCID {} -> "ImpulseUseTargetCID"
|
||||
ImpulseUseTarget {} -> "ImpulseUseTarget"
|
||||
ImpulseUseAheadPos {} -> "ImpulseUseAheadPos"
|
||||
-- deriving (Eq,Ord,Show)
|
||||
infixr 9 `WaitThen`
|
||||
infixr 9 `DoActionThen`
|
||||
@@ -979,6 +1000,8 @@ data Action
|
||||
,_mainAction :: Action
|
||||
}
|
||||
deriving (Generic)
|
||||
instance Show Action where
|
||||
show _ = "AnAction"
|
||||
-- deriving (Eq,Ord,Show)
|
||||
data Strategy
|
||||
= Flank Int
|
||||
@@ -993,12 +1016,13 @@ data Strategy
|
||||
| Reload
|
||||
| Flee
|
||||
| MeleeStrike
|
||||
deriving (Generic)
|
||||
deriving (Generic,Show)
|
||||
-- deriving (Eq,Ord,Show)
|
||||
data Goal
|
||||
= LiveLongAndProsper
|
||||
| Kill Int
|
||||
| SentinelAt Point2 Float
|
||||
deriving (Show)
|
||||
|
||||
newtype Zone a = Zone
|
||||
{ _znObjects :: IM.IntMap (IM.IntMap a)
|
||||
@@ -1037,7 +1061,7 @@ isMovementDam dm = case _dmType dm of
|
||||
|
||||
data CreatureState = CrSt
|
||||
{ _crDamage :: [Damage]
|
||||
, _crPastDamage :: V.Vector [Damage]
|
||||
-- , _crPastDamage :: V.Vector [Damage]
|
||||
, _crSpState :: CrSpState
|
||||
, _crDropsOnDeath :: CreatureDropType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user