Partial (not working) refactor of damages, energyballs

This commit is contained in:
2025-06-07 12:22:06 +01:00
parent 2b39152060
commit e914555728
10 changed files with 265 additions and 290 deletions
+1 -8
View File
@@ -8,6 +8,7 @@ module Dodge.Data.Bullet (
module Dodge.Data.Damage,
) where
import Dodge.Data.EnergyBall.Type
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -27,13 +28,6 @@ data Bullet = Bullet
}
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data EnergyBallType
= IncBall
| TeslaBall
| ConcBall
| FlashBall
deriving (Show, Eq, Ord, Enum, Bounded, Read) --Generic, Flat)
data BulletEffect
= DestroyBullet
| BounceBullet
@@ -64,7 +58,6 @@ data BulletTrajectoryType
makeLenses ''Bullet
makeLenses ''BulletPayload
deriveJSON defaultOptions ''EnergyBallType
deriveJSON defaultOptions ''BulletEffect
deriveJSON defaultOptions ''BulletPayload
deriveJSON defaultOptions ''BulletTrajectory
+13 -9
View File
@@ -9,22 +9,26 @@ creatures.
-}
module Dodge.Data.Damage (
module Dodge.Data.Damage,
module Dodge.Data.Damage.Type,
) where
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.Damage.Type
import Geometry.Data
data Damage = Damage
{ _dmType :: DamageType
, _dmAmount :: Int
, _dmFrom :: Point2
, _dmAt :: Point2
, _dmTo :: Point2
}
data Damage
= Piercing {_dmAmount :: Int, _dmPos :: Point2, _dmVector :: Point2}
| Blunt {_dmAmount :: Int, _dmPos :: Point2, _dmVector :: Point2}
| Sparking {_dmAmount :: Int}
| Crushing {_dmAmount :: Int}
| Shattering {_dmAmount :: Int, _dmPos :: Point2, _dmVector :: Point2}
| Flaming {_dmAmount :: Int}
| Lasering {_dmAmount :: Int, _dmPos :: Point2, _dmVector :: Point2}
| Flashing {_dmAmount :: Int, _dmPos :: Point2}
| Electrical {_dmAmount :: Int}
| Explosive {_dmAmount :: Int, _dmCenter :: Point2}
| Poison {_dmAmount :: Int}
| Enterrement {_dmAmount :: Int}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
makeLenses ''Damage
-31
View File
@@ -1,31 +0,0 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Damage.Type where
import Data.Aeson
import Data.Aeson.TH
data DamageType
= PIERCING
| BLUNT
| CUTTING
| SPARKING
| CRUSHING
| SHATTERING
| FLAMING
| LASERING
| ELECTRICAL
| EXPLOSIVE
| CONCUSSIVE
| POISONDAM
| ENTERREMENT
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
deriveJSON defaultOptions ''DamageType
instance ToJSONKey DamageType
instance FromJSONKey DamageType
+11 -8
View File
@@ -1,24 +1,27 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.EnergyBall where
module Dodge.Data.EnergyBall (
module Dodge.Data.EnergyBall,
module Dodge.Data.EnergyBall.Type,
) where
import Color
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.Damage.Type
import Dodge.Data.EnergyBall.Type
import Geometry.Data
data EnergyBall = EnergyBall
{ _ebVel :: Point2
, _ebColor :: Color
, _ebPos :: Point2
, _ebWidth :: Float
, _ebTimer :: Int
, _ebEff :: (DamageType, Int)
, -- , _ebColor :: Color
_ebPos :: Point2
, -- , _ebWidth :: Float
_ebTimer :: Int
, _ebEff :: EnergyBallType
, _ebRot :: Float
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)