This commit is contained in:
2022-07-27 12:49:23 +01:00
parent 6554d219dc
commit 8d17ce66e9
106 changed files with 2911 additions and 2678 deletions
+13 -39
View File
@@ -1,15 +1,13 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
--{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.ActionPlan where
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.Creature.Stance
import Dodge.Data.CreatureEffect
import GHC.Generics
import Geometry.Data
import Sound.Data
@@ -21,22 +19,12 @@ data ActionPlan
, _apStrategy :: Strategy
, _apGoal :: [Goal]
}
deriving (Eq, Ord, Show, Read, Generic)
instance ToJSON ActionPlan where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ActionPlan
deriving (Eq, Ord, Show, Read)
data RandImpulse
= RandImpulseList [Impulse]
| RandImpulseCircMove Float
deriving (Eq, Ord, Show, Read, Generic)
instance ToJSON RandImpulse where
toEncoding = genericToEncoding defaultOptions
instance FromJSON RandImpulse
deriving (Eq, Ord, Show, Read)
data Impulse
= Move Point2
@@ -70,12 +58,7 @@ data Impulse
{ _impulseUseAheadPos :: P2Imp
}
| ImpulseNothing
deriving (Eq, Ord, Show, Read, Generic)
instance ToJSON Impulse where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Impulse
deriving (Eq, Ord, Show, Read)
infixr 9 `WaitThen`
@@ -182,12 +165,7 @@ data Action
{ _sideImpulses :: [Impulse]
, _mainAction :: Action
}
deriving (Eq, Ord, Show, Read, Generic)
instance ToJSON Action where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Action
deriving (Eq, Ord, Show, Read)
data Strategy
= Flank Int
@@ -205,24 +183,20 @@ data Strategy
| Reload
| Flee
| MeleeStrike
deriving (Eq, Ord, Show, Read, Generic)
instance ToJSON Strategy where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Strategy
deriving (Eq, Ord, Show, Read)
data Goal
= LiveLongAndProsper
| Kill Int
| SentinelAt Point2 Float
deriving (Eq, Ord, Show, Read, Generic)
instance ToJSON Goal where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Goal
deriving (Eq, Ord, Show, Read)
deriveJSON defaultOptions ''ActionPlan
deriveJSON defaultOptions ''RandImpulse
deriveJSON defaultOptions ''Impulse
deriveJSON defaultOptions ''Action
deriveJSON defaultOptions ''Strategy
deriveJSON defaultOptions ''Goal
makeLenses ''ActionPlan
makeLenses ''Impulse
makeLenses ''Action