Allow for bullet drag
This commit is contained in:
@@ -20,8 +20,8 @@ data Annotation g
|
|||||||
| TreasureAno [Creature] [Item]
|
| TreasureAno [Creature] [Item]
|
||||||
| AnoApplyInt Int (Int -> State g (SubCompTree Room))
|
| AnoApplyInt Int (Int -> State g (SubCompTree Room))
|
||||||
| PassthroughLockKeyLists Int
|
| PassthroughLockKeyLists Int
|
||||||
[(Int -> State g (SubCompTree Room), State g ItemIdentity)]
|
[(Int -> State g (SubCompTree Room), State g CombineType)]
|
||||||
[(ItemIdentity, State g (SubCompTree Room))]
|
[(CombineType, State g (SubCompTree Room))]
|
||||||
-- | SetLabel Int (State g Room)
|
-- | SetLabel Int (State g Room)
|
||||||
-- | UseLabel Int (State g Room)
|
-- | UseLabel Int (State g Room)
|
||||||
| ChainAnos [[Annotation g]]
|
| ChainAnos [[Annotation g]]
|
||||||
|
|||||||
+17
-7
@@ -1,13 +1,23 @@
|
|||||||
{-# LANGUAGE TupleSections #-}
|
{-# LANGUAGE TupleSections #-}
|
||||||
module Dodge.Combine
|
module Dodge.Combine where
|
||||||
(
|
import Dodge.Data
|
||||||
) where
|
|
||||||
--import Dodge.Data
|
|
||||||
--import Dodge.Combine.Data
|
--import Dodge.Combine.Data
|
||||||
--import Dodge.Combine.Combinations
|
import Dodge.Combine.Combinations
|
||||||
|
import Dodge.Item.Weapon.BulletGuns
|
||||||
|
import Dodge.Item.Craftable
|
||||||
|
|
||||||
--import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
--import qualified Data.IntMap.Strict as IM
|
--import qualified Data.IntMap.Strict as IM
|
||||||
--import qualified Data.IntSet as IS
|
--import qualified Data.IntSet as IS
|
||||||
--import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
|
|
||||||
|
pureCombine :: [ (M.Map CombineType Int, Item) ]
|
||||||
|
pureCombine = map (first toMultiset)
|
||||||
|
[ p [PIPE,HARDWARE] bangStick
|
||||||
|
, p [LONGPIPE,HARDWARE] bangCane
|
||||||
|
, p [VERYLONGPIPE,HARDWARE] bangRod
|
||||||
|
, p [PIPE,PIPE] $ makeTypeCraft LONGPIPE
|
||||||
|
, p [LONGPIPE,PIPE] $ makeTypeCraft VERYLONGPIPE
|
||||||
|
]
|
||||||
|
where
|
||||||
|
p = (,)
|
||||||
|
|||||||
@@ -11,40 +11,36 @@ import qualified Data.Map.Strict as M
|
|||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
|
||||||
combineList :: IM.IntMap ItemCombineType -> [([Int],ItemCombineType)]
|
combineList :: IM.IntMap CombineType -> [([Int],CombineType)]
|
||||||
combineList m = mapMaybe (pushoutmaybe . second (combine . toMultiset) . unzip)
|
combineList m = mapMaybe (pushoutmaybe . second (combine . toMultiset) . unzip)
|
||||||
. powlist
|
. powlistN 4
|
||||||
$ IM.toList m
|
$ IM.toList m
|
||||||
where
|
where
|
||||||
pushoutmaybe (_,Nothing) = Nothing
|
pushoutmaybe (_,Nothing) = Nothing
|
||||||
pushoutmaybe (x,Just y) = Just (x,y)
|
pushoutmaybe (x,Just y) = Just (x,y)
|
||||||
|
|
||||||
|
powlistN :: Int -> [a] ->[[a]]
|
||||||
|
powlistN _ [] = [[]]
|
||||||
|
powlistN n (x:xs)
|
||||||
|
| n <=0 = [[]]
|
||||||
|
| otherwise = ((x:) <$> powlistN (n-1) xs) ++ powlistN n xs
|
||||||
|
|
||||||
|
-- expo
|
||||||
powlist :: [a] -> [[a]]
|
powlist :: [a] -> [[a]]
|
||||||
powlist = filterM (const [True,False])
|
powlist = filterM (const [True,False])
|
||||||
|
|
||||||
combine :: M.Map ItemCombineType Int -> Maybe ItemCombineType
|
combine :: M.Map CombineType Int -> Maybe CombineType
|
||||||
combine m = lookup m combinations
|
combine m = lookup m combinations
|
||||||
|
|
||||||
toMultiset :: Ord a => [a] -> M.Map a Int
|
toMultiset :: Ord a => [a] -> M.Map a Int
|
||||||
toMultiset = foldr (uncurry $ M.insertWith (+)) M.empty . map (,1)
|
toMultiset = foldr (uncurry $ M.insertWith (+)) M.empty . map (,1)
|
||||||
|
|
||||||
combinations :: [(M.Map ItemCombineType Int, ItemCombineType)]
|
combinations :: [(M.Map CombineType Int, CombineType)]
|
||||||
combinations = map (first toMultiset)
|
combinations = map (first toMultiset)
|
||||||
[ ( [ TPistol, TPipe, THardware ] , TRifle )
|
[ ( [ PIPE, HARDWARE ] , BANGSTICK )
|
||||||
, ( [ NoCombineType ] , TPistol )
|
, ( [ LONGPIPE, HARDWARE ] , BANGCANE )
|
||||||
, ( [ TRifle, THardware ] , TPistol )
|
, ( [ VERYLONGPIPE, HARDWARE ] , BANGROD )
|
||||||
, ( [ TPistol, TPistol, THardware ] , TSpreadGun 2 )
|
, ( [ PIPE, PIPE ] , LONGPIPE )
|
||||||
, ( [ TSpreadGun 2, TPistol, THardware ] , TSpreadGun 3 )
|
, ( [ LONGPIPE, PIPE ] , VERYLONGPIPE )
|
||||||
, ( [ TSpreadGun 3, TPistol, THardware ] , TSpreadGun 4 )
|
|
||||||
, ( [ TSpreadGun 4, TPistol, THardware ] , TSpreadGun 5 )
|
|
||||||
, ( [ TPistol, TAutoGun, THardware ] , TLtAutoGun )
|
|
||||||
, ( [ TLtAutoGun, TPipe, THardware ] , TAutoGun )
|
|
||||||
, ( [ TRifle, TRifle, THardware ] , TMultGun 2 )
|
|
||||||
, ( [ TMultGun 2, TRifle, THardware ] , TMultGun 3 )
|
|
||||||
, ( [ TMultGun 3, TRifle, THardware ] , TMultGun 4 )
|
|
||||||
, ( [ TMultGun 4, TRifle, THardware ] , TMultGun 5 )
|
|
||||||
, ( [ TLtAutoGun, TPipe, THardware ] , TAutoGun )
|
|
||||||
, ( [ TPistol, TTube, THardware] , TLauncher 1 )
|
|
||||||
, ( [ TLauncher 1, TTube, TPistol, THardware] , TLauncher 2)
|
|
||||||
, ( [ TLauncher 2, TTube, TPistol, THardware] , TLauncher 3)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,50 @@
|
|||||||
module Dodge.Combine.Data
|
module Dodge.Combine.Data
|
||||||
(ItemCombineType (..)
|
(CombineType (..)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
data ItemCombineType
|
data CombineType
|
||||||
= TPipe
|
= NOTDEFINED
|
||||||
|
-- Weapons
|
||||||
|
| BANGSTICK
|
||||||
|
| BANGCANE
|
||||||
|
| BANGROD
|
||||||
|
| PISTOL
|
||||||
|
| HVAUTOGUN
|
||||||
|
| LTAUTOGUN
|
||||||
|
| MINIGUN
|
||||||
|
| AUTOGUN
|
||||||
|
| SPREADGUN
|
||||||
|
| MULTGUN
|
||||||
|
| LONGGUN
|
||||||
|
| TESLAGUN
|
||||||
|
| LASGUN
|
||||||
|
| TRACTORGUN
|
||||||
|
| LAUNCHER
|
||||||
|
| SPRAYER
|
||||||
|
| SQUIRTER
|
||||||
|
| DRONELAUNCHER
|
||||||
|
| GRENADE
|
||||||
|
| REMOTEBOMB
|
||||||
|
-- Utility items
|
||||||
|
| BOOSTER
|
||||||
|
| REWINDER
|
||||||
|
| BLINKER
|
||||||
|
| FORCEFIELD
|
||||||
|
| SHRINKER
|
||||||
|
-- Equipment
|
||||||
|
| RADAR
|
||||||
|
| MAGSHIELD
|
||||||
|
| FLAMESHIELD
|
||||||
|
| FRONTARMOUR
|
||||||
|
| FLATSHIELD
|
||||||
|
| JETPACK
|
||||||
|
-- Crafting
|
||||||
|
| PIPE
|
||||||
|
| LONGPIPE
|
||||||
|
| VERYLONGPIPE
|
||||||
|
| HARDWARE
|
||||||
|
| SPRING
|
||||||
|
| TPipe
|
||||||
| NoCombineType
|
| NoCombineType
|
||||||
| TLongPipe
|
| TLongPipe
|
||||||
| TVeryLongPipe
|
| TVeryLongPipe
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ creatureTurnToward p turnSpeed cr
|
|||||||
equipSpeed :: Item -> Float
|
equipSpeed :: Item -> Float
|
||||||
equipSpeed _ = 1
|
equipSpeed _ = 1
|
||||||
{- | Speed modifier of an item when aiming. -}
|
{- | Speed modifier of an item when aiming. -}
|
||||||
equipAimSpeed :: Item -> Float
|
equipAimSpeed :: Item -> Float -- TODO remove/rethink
|
||||||
equipAimSpeed it
|
equipAimSpeed it
|
||||||
| _itIdentity it == FrontArmour = 0.5
|
| _itCombineType it == FRONTARMOUR = 0.5
|
||||||
| _itIdentity it == FlameShield = 0.5
|
| _itCombineType it == FLAMESHIELD = 0.5
|
||||||
| otherwise = 1
|
| otherwise = 1
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Dodge.Creature.Impulse.UseItem
|
|||||||
, useLeftItem
|
, useLeftItem
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Inventory
|
--import Dodge.Inventory
|
||||||
|
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
@@ -22,7 +22,7 @@ tryUseItem cr' w = case w ^? creatures . ix (_crID cr') of
|
|||||||
Nothing -> w
|
Nothing -> w
|
||||||
|
|
||||||
itemEffect :: Creature -> Item -> World -> World
|
itemEffect :: Creature -> Item -> World -> World
|
||||||
itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
|
--itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
|
||||||
itemEffect cr it w = case it ^? itUse of
|
itemEffect cr it w = case it ^? itUse of
|
||||||
Just RightUse {_rUse = eff,_useMods = usemods} -> foldr ($) eff usemods it cr w
|
Just RightUse {_rUse = eff,_useMods = usemods} -> foldr ($) eff usemods it cr w
|
||||||
Just LeftUse {} -> w
|
Just LeftUse {} -> w
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import Control.Lens
|
|||||||
crIsArmouredFrom :: Point2 -> Creature -> Bool
|
crIsArmouredFrom :: Point2 -> Creature -> Bool
|
||||||
crIsArmouredFrom p cr
|
crIsArmouredFrom p cr
|
||||||
= p /= _crPos cr
|
= p /= _crPos cr
|
||||||
&& any (\it -> it ^? itIdentity == Just FrontArmour) (_crInv cr)
|
&& any (\it -> it ^? itCombineType == Just FRONTARMOUR) (_crInv cr)
|
||||||
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crPos cr) < pi/2
|
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crPos cr) < pi/2
|
||||||
-- even though angleVV can generate NaN, the comparison seems to deal with it
|
-- even though angleVV can generate NaN, the comparison seems to deal with it
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ movementSideEff cr w
|
|||||||
_ -> w
|
_ -> w
|
||||||
| otherwise = footstepSideEffect cr w
|
| otherwise = footstepSideEffect cr w
|
||||||
where
|
where
|
||||||
hasJetPack = any (\it -> it ^? itIdentity == Just JetPack) $ _crInv cr
|
hasJetPack = any (\it -> it ^? itCombineType == Just JETPACK) $ _crInv cr
|
||||||
oldPos = _crOldPos cr
|
oldPos = _crOldPos cr
|
||||||
momentum' = 0.97 *.* (_crPos cr -.- _crOldPos cr)
|
momentum' = 0.97 *.* (_crPos cr -.- _crOldPos cr)
|
||||||
momentum'' | magV momentum' > 3 = 3 *.* normalizeV momentum'
|
momentum'' | magV momentum' > 3 = 3 *.* normalizeV momentum'
|
||||||
@@ -158,6 +158,7 @@ weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . itConsumption o
|
|||||||
ActivePartial{} | _reloadState am == Nothing' -> w
|
ActivePartial{} | _reloadState am == Nothing' -> w
|
||||||
ActivePartial{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
ActivePartial{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
||||||
Just ChargeableAmmo {} -> w
|
Just ChargeableAmmo {} -> w
|
||||||
|
Just NoConsumption {} -> w
|
||||||
Just ItemItselfConsumable {} -> w
|
Just ItemItselfConsumable {} -> w
|
||||||
Nothing -> w
|
Nothing -> w
|
||||||
where
|
where
|
||||||
|
|||||||
+44
-37
@@ -330,16 +330,16 @@ data ItemConsumption
|
|||||||
{ _itMaxStack' :: Int
|
{ _itMaxStack' :: Int
|
||||||
, _itAmount' :: Int
|
, _itAmount' :: Int
|
||||||
}
|
}
|
||||||
|
| NoConsumption
|
||||||
data Item
|
data Item
|
||||||
= Weapon
|
= Item
|
||||||
{ _itName :: String
|
{ _itName :: String
|
||||||
, _itConsumption :: ItemConsumption
|
, _itConsumption :: ItemConsumption
|
||||||
, _itUse :: ItemUse
|
, _itUse :: ItemUse
|
||||||
, _itFloorPict :: Item -> SPic
|
, _itFloorPict :: Item -> SPic
|
||||||
, _itEquipPict :: Creature -> Int -> SPic
|
, _itEquipPict :: Creature -> Int -> SPic
|
||||||
, _itScroll :: Float -> Creature -> Item -> Item
|
, _itScroll :: Float -> Creature -> Item -> Item
|
||||||
, _itIdentity :: ItemIdentity
|
, _itCombineType :: CombineType
|
||||||
, _itCombineType :: ItemCombineType
|
|
||||||
, _itAttachment :: ItAttachment
|
, _itAttachment :: ItAttachment
|
||||||
, _itID :: Maybe Int
|
, _itID :: Maybe Int
|
||||||
, _itEffect :: ItEffect
|
, _itEffect :: ItEffect
|
||||||
@@ -352,43 +352,44 @@ data Item
|
|||||||
, _itParams :: ItemParams
|
, _itParams :: ItemParams
|
||||||
, _itTweaks :: ItemTweaks
|
, _itTweaks :: ItemTweaks
|
||||||
}
|
}
|
||||||
| Consumable
|
-- | Consumable
|
||||||
{ _itName :: String
|
-- { _itName :: String
|
||||||
, _itMaxStack :: Int
|
-- , _itMaxStack :: Int
|
||||||
, _itAmount :: Int
|
-- , _itAmount :: Int
|
||||||
, _cnEffect :: Int -> World -> Maybe World
|
-- , _cnEffect :: Int -> World -> Maybe World
|
||||||
, _itFloorPict :: Item -> SPic
|
-- , _itFloorPict :: Item -> SPic
|
||||||
, _itEquipPict :: Creature -> Int -> SPic
|
-- , _itEquipPict :: Creature -> Int -> SPic
|
||||||
, _itIdentity :: ItemIdentity
|
-- , _itIdentity :: ItemIdentity
|
||||||
, _itID :: Maybe Int
|
-- , _itID :: Maybe Int
|
||||||
, _itInvSize :: Int
|
-- , _itInvSize :: Int
|
||||||
, _itInvDisplay :: Item -> [String]
|
-- , _itInvDisplay :: Item -> [String]
|
||||||
, _itInvColor :: Color
|
-- , _itInvColor :: Color
|
||||||
, _itEffect :: ItEffect
|
-- , _itEffect :: ItEffect
|
||||||
, _itCurseStatus :: CurseStatus
|
-- , _itCurseStatus :: CurseStatus
|
||||||
, _itDimension :: ItemDimension
|
-- , _itDimension :: ItemDimension
|
||||||
}
|
-- }
|
||||||
| Craftable
|
-- | Craftable
|
||||||
{ _itName :: String
|
-- { _itName :: String
|
||||||
, _itMaxStack :: Int
|
-- , _itMaxStack :: Int
|
||||||
, _itAmount :: Int
|
-- , _itAmount :: Int
|
||||||
, _itFloorPict :: Item -> SPic
|
-- , _itFloorPict :: Item -> SPic
|
||||||
, _itEquipPict :: Creature -> Int -> SPic
|
-- , _itEquipPict :: Creature -> Int -> SPic
|
||||||
, _itIdentity :: ItemIdentity
|
-- , _itIdentity :: ItemIdentity
|
||||||
, _itID :: Maybe Int
|
-- , _itID :: Maybe Int
|
||||||
, _itInvSize :: Int
|
-- , _itInvSize :: Int
|
||||||
, _itInvDisplay :: Item -> [String]
|
-- , _itInvDisplay :: Item -> [String]
|
||||||
, _itInvColor :: Color
|
-- , _itInvColor :: Color
|
||||||
, _itCurseStatus :: CurseStatus
|
-- , _itCurseStatus :: CurseStatus
|
||||||
, _itDimension :: ItemDimension
|
-- , _itDimension :: ItemDimension
|
||||||
}
|
-- }
|
||||||
| Equipment
|
| Equipment
|
||||||
{ _itName :: String
|
{ _itName :: String
|
||||||
, _itFloorPict :: Item -> SPic
|
, _itFloorPict :: Item -> SPic
|
||||||
, _itEquipPict :: Creature -> Int -> SPic
|
, _itEquipPict :: Creature -> Int -> SPic
|
||||||
, _itIdentity :: ItemIdentity
|
-- , _itIdentity :: ItemIdentity
|
||||||
, _itEffect :: ItEffect
|
, _itEffect :: ItEffect
|
||||||
, _itID :: Maybe Int
|
, _itID :: Maybe Int
|
||||||
|
, _itCombineType :: CombineType
|
||||||
, _itZoom :: ItZoom
|
, _itZoom :: ItZoom
|
||||||
, _itInvSize :: Int
|
, _itInvSize :: Int
|
||||||
, _itInvDisplay :: Item -> [String]
|
, _itInvDisplay :: Item -> [String]
|
||||||
@@ -406,9 +407,10 @@ data Item
|
|||||||
, _itUse :: ItemUse
|
, _itUse :: ItemUse
|
||||||
-- , _itZoom :: ItZoom
|
-- , _itZoom :: ItZoom
|
||||||
, _itEquipPict :: Creature -> Int -> SPic
|
, _itEquipPict :: Creature -> Int -> SPic
|
||||||
, _itIdentity :: ItemIdentity
|
--, _itIdentity :: ItemIdentity
|
||||||
, _itID :: Maybe Int
|
, _itID :: Maybe Int
|
||||||
, _itAttachment :: ItAttachment
|
, _itAttachment :: ItAttachment
|
||||||
|
, _itCombineType :: CombineType
|
||||||
, _itInvSize :: Int
|
, _itInvSize :: Int
|
||||||
, _itInvDisplay :: Item -> [String]
|
, _itInvDisplay :: Item -> [String]
|
||||||
, _itInvColor :: Color
|
, _itInvColor :: Color
|
||||||
@@ -475,9 +477,10 @@ data Particle
|
|||||||
, _ptColor :: Color
|
, _ptColor :: Color
|
||||||
}
|
}
|
||||||
| BulletPt
|
| BulletPt
|
||||||
{ _ptDraw :: Particle -> Picture
|
{ _ptDraw :: Particle -> Picture
|
||||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||||
, _btVel' :: Point2
|
, _btVel' :: Point2
|
||||||
|
, _btDrag :: Float
|
||||||
, _btColor' :: Color
|
, _btColor' :: Color
|
||||||
, _btTrail' :: [Point2]
|
, _btTrail' :: [Point2]
|
||||||
, _btPassThrough' :: Maybe Int
|
, _btPassThrough' :: Maybe Int
|
||||||
@@ -547,6 +550,9 @@ data GunBarrels
|
|||||||
{ _brlSpread :: BarrelSpread
|
{ _brlSpread :: BarrelSpread
|
||||||
, _brlNum :: Int
|
, _brlNum :: Int
|
||||||
}
|
}
|
||||||
|
| RotBarrel
|
||||||
|
{ _brlNum :: Int
|
||||||
|
}
|
||||||
| SingleBarrel {_brlInaccuracy :: Float}
|
| SingleBarrel {_brlInaccuracy :: Float}
|
||||||
|
|
||||||
data ItemParams
|
data ItemParams
|
||||||
@@ -559,6 +565,7 @@ data ItemParams
|
|||||||
| Refracting {_phaseV :: Float}
|
| Refracting {_phaseV :: Float}
|
||||||
| BulletShooter
|
| BulletShooter
|
||||||
{ _muzVel :: Float
|
{ _muzVel :: Float
|
||||||
|
, _rifling :: Float
|
||||||
, _bore :: Float
|
, _bore :: Float
|
||||||
, _gunBarrels :: GunBarrels
|
, _gunBarrels :: GunBarrels
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-29
@@ -131,10 +131,11 @@ defaultState = CrSt
|
|||||||
}
|
}
|
||||||
defaultEquipment :: Item
|
defaultEquipment :: Item
|
||||||
defaultEquipment = Equipment
|
defaultEquipment = Equipment
|
||||||
{ _itIdentity = Generic
|
{ _itCurseStatus = Uncursed
|
||||||
, _itCurseStatus = Uncursed
|
, _itCombineType = NOTDEFINED
|
||||||
, _itName = "genericEquipment"
|
, _itName = "genericEquipment"
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ setLayer 0 $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
-- ,_itIdentity = Generic
|
||||||
|
, _itFloorPict = \_ -> noShape $ setLayer 0 $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
@@ -147,21 +148,26 @@ defaultEquipment = Equipment
|
|||||||
defaultItZoom :: ItZoom
|
defaultItZoom :: ItZoom
|
||||||
defaultItZoom = ItZoom 20 0.2 1
|
defaultItZoom = ItZoom 20 0.2 1
|
||||||
defaultConsumable :: Item
|
defaultConsumable :: Item
|
||||||
defaultConsumable = Consumable
|
defaultConsumable = Item
|
||||||
{ _itIdentity = Generic
|
{ _itUse = NoUse
|
||||||
|
-- , _itIdentity = Generic
|
||||||
, _itInvSize = 1
|
, _itInvSize = 1
|
||||||
, _itCurseStatus = Uncursed
|
, _itCurseStatus = Uncursed
|
||||||
, _itName = "genericConsumable"
|
, _itName = "genericConsumable"
|
||||||
, _itMaxStack = 9
|
, _itConsumption = ItemItselfConsumable {_itMaxStack' = 9, _itAmount' = 1}
|
||||||
, _itAmount = 1
|
, _itFloorPict = \_ -> noShape $ onLayer FlItLayer $ color blue $ circleSolid 3
|
||||||
, _cnEffect = \_ _ -> Nothing
|
, _itEquipPict = \_ _ -> mempty
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ circleSolid 3
|
|
||||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itInvColor = blue
|
, _itInvColor = blue
|
||||||
, _itInvDisplay = \it -> [_itName it ++ " x" ++ show (_itAmount it)]
|
, _itInvDisplay = \it -> [_itName it ++ " x" ++ show (_itAmount' $ _itConsumption it)]
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
|
, _itScroll = \_ _ -> id
|
||||||
|
, _itAttachment = NoItAttachment
|
||||||
|
, _itCombineType = NoCombineType
|
||||||
|
, _itTargeting = Nothing
|
||||||
|
, _itParams = NoParams
|
||||||
, _itDimension = defaultItemDimension
|
, _itDimension = defaultItemDimension
|
||||||
|
, _itTweaks = NoTweaks
|
||||||
}
|
}
|
||||||
defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature)
|
defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature)
|
||||||
defaultApplyDamage ds cr = (id, doPoisonDam $ foldl' (flip $ \d c -> snd $ applyIndividualDamage d c) cr ds')
|
defaultApplyDamage ds cr = (id, doPoisonDam $ foldl' (flip $ \d c -> snd $ applyIndividualDamage d c) cr ds')
|
||||||
@@ -193,24 +199,7 @@ applyIndividualDamage (PushDam amount pback) cr
|
|||||||
applyIndividualDamage dt cr
|
applyIndividualDamage dt cr
|
||||||
= ( id , over crHP (\hp -> hp - _dmAmount dt) cr )
|
= ( id , over crHP (\hp -> hp - _dmAmount dt) cr )
|
||||||
defaultFlIt :: FloorItem
|
defaultFlIt :: FloorItem
|
||||||
defaultFlIt = FlIt {_flItRot=0,_flIt = defaultIt, _flItPos = V2 0 0, _flItID = 0}
|
defaultFlIt = FlIt {_flItRot=0,_flIt = defaultConsumable, _flItPos = V2 0 0, _flItID = 0}
|
||||||
defaultIt :: Item
|
|
||||||
defaultIt = Consumable
|
|
||||||
{ _itIdentity = Medkit25
|
|
||||||
, _itInvSize = 1
|
|
||||||
, _itDimension = defaultItemDimension
|
|
||||||
, _itCurseStatus = Uncursed
|
|
||||||
, _itName = "defaultIt"
|
|
||||||
, _itMaxStack = 3
|
|
||||||
, _itAmount = 2
|
|
||||||
, _cnEffect = const return
|
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ square 3
|
|
||||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
|
||||||
, _itID = Nothing
|
|
||||||
, _itInvDisplay = (:[]) . _itName
|
|
||||||
, _itInvColor = blue
|
|
||||||
, _itEffect = NoItEffect
|
|
||||||
}
|
|
||||||
defaultMachine :: Machine
|
defaultMachine :: Machine
|
||||||
defaultMachine = Machine
|
defaultMachine = Machine
|
||||||
{ _mcID = 0
|
{ _mcID = 0
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ defaultAimParams = AimParams
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultGun :: Item
|
defaultGun :: Item
|
||||||
defaultGun = Weapon
|
defaultGun = Item
|
||||||
{ _itName = "default"
|
{ _itName = "default"
|
||||||
, _itCombineType = NoCombineType
|
, _itCombineType = NoCombineType
|
||||||
, _itCurseStatus = Uncursed
|
, _itCurseStatus = Uncursed
|
||||||
, _itIdentity = Pistol
|
-- , _itIdentity = Pistol
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
, _itUse = defaultrUse
|
, _itUse = defaultrUse
|
||||||
, _itFloorPict = const $ noPic $ colorSH green (prismPoly
|
, _itFloorPict = const $ noPic $ colorSH green (prismPoly
|
||||||
@@ -107,6 +107,32 @@ defaultGun = Weapon
|
|||||||
, _itDimension = defaultItemDimension
|
, _itDimension = defaultItemDimension
|
||||||
, _itTweaks = NoTweaks
|
, _itTweaks = NoTweaks
|
||||||
}
|
}
|
||||||
|
defaultCraftable :: Item
|
||||||
|
defaultCraftable = Item
|
||||||
|
{ _itName = "default"
|
||||||
|
, _itCombineType = NoCombineType
|
||||||
|
, _itCurseStatus = Uncursed
|
||||||
|
-- , _itIdentity = Generic
|
||||||
|
, _itConsumption = NoConsumption
|
||||||
|
, _itUse = NoUse
|
||||||
|
, _itFloorPict = const $ noPic $ colorSH green (prismPoly
|
||||||
|
(map (addZ 3) $ rectNESW 3 3 (-3) (-3))
|
||||||
|
(map (addZ 0) $ rectNESW 5 3 (-5) (-7))
|
||||||
|
)
|
||||||
|
-- , _itZoom = ItZoom 20 0.2 1
|
||||||
|
, _itEquipPict = pictureWeaponOnAim
|
||||||
|
, _itScroll = \_ _ -> id
|
||||||
|
, _itAttachment = NoItAttachment
|
||||||
|
, _itID = Nothing
|
||||||
|
, _itEffect = NoItEffect
|
||||||
|
, _itInvDisplay = \it -> take (_itInvSize it) (_itName it : repeat "*")
|
||||||
|
, _itInvColor = green
|
||||||
|
, _itInvSize = 1
|
||||||
|
, _itTargeting = Nothing
|
||||||
|
, _itParams = NoParams
|
||||||
|
, _itDimension = defaultItemDimension
|
||||||
|
, _itTweaks = NoTweaks
|
||||||
|
}
|
||||||
defaultItemDimension :: ItemDimension
|
defaultItemDimension :: ItemDimension
|
||||||
defaultItemDimension = ItemDimension
|
defaultItemDimension = ItemDimension
|
||||||
{ _itDim = V3 4 4 4
|
{ _itDim = V3 4 4 4
|
||||||
|
|||||||
+2
-2
@@ -10,7 +10,7 @@ import Shape
|
|||||||
|
|
||||||
keyToken :: Int -> Item
|
keyToken :: Int -> Item
|
||||||
keyToken n = defaultEquipment
|
keyToken n = defaultEquipment
|
||||||
{ _itIdentity = Generic
|
{ _itCombineType = NOTDEFINED
|
||||||
, _itName = "KEYTOKEN "++show n
|
, _itName = "KEYTOKEN "++show n
|
||||||
, _itMaxStack = 5
|
, _itMaxStack = 5
|
||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
@@ -31,7 +31,7 @@ keyPic = color green $
|
|||||||
|
|
||||||
latchkey :: Int -> Item
|
latchkey :: Int -> Item
|
||||||
latchkey n = defaultEquipment
|
latchkey n = defaultEquipment
|
||||||
{ _itIdentity = Generic
|
{ _itCombineType = NOTDEFINED
|
||||||
, _itName = "KEY "++show n
|
, _itName = "KEY "++show n
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
|
|||||||
@@ -3,21 +3,24 @@ import Dodge.Data
|
|||||||
import Dodge.Picture.Layer
|
import Dodge.Picture.Layer
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
|
import Dodge.Inventory
|
||||||
import Shape
|
import Shape
|
||||||
--import ShapePicture
|
--import ShapePicture
|
||||||
import Dodge.Item.Draw
|
import Dodge.Item.Draw
|
||||||
import Picture
|
import Picture
|
||||||
|
|
||||||
|
import Data.Maybe
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
|
|
||||||
medkit :: Int -> Item
|
medkit :: Int -> Item
|
||||||
medkit i = defaultConsumable
|
medkit i = defaultConsumable
|
||||||
{ _itIdentity = Medkit25
|
{ _itName = "MEDKIT" ++ show i
|
||||||
, _itName = "MEDKIT" ++ show i
|
, _itUse = LeftUse
|
||||||
, _itMaxStack = 9
|
{_lUse = \cr invid w -> fromMaybe w (heal 25 (_crID cr) $ rmInvItem (_crID cr) invid w)
|
||||||
, _itAmount = 1
|
,_useDelay = NoDelay
|
||||||
, _cnEffect = heal i
|
,_useHammer = HasHammer HammerUp
|
||||||
|
}
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ setLayer 0 . onLayer FlItLayer . color blue $ circleSolid 3
|
, _itFloorPict = \_ -> (,) emptySH $ setLayer 0 . onLayer FlItLayer . color blue $ circleSolid 3
|
||||||
, _itEquipPict = pictureItem $ (,) emptySH $ color blue $ circleSolid 3
|
, _itEquipPict = pictureItem $ (,) emptySH $ color blue $ circleSolid 3
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
@@ -31,4 +34,3 @@ heal hp n w | _crHP (_creatures w IM.! n) >= 10000 = Nothing
|
|||||||
& creatures . ix n . crHP %~ min 10000 . (+ hp)
|
& creatures . ix n . crHP %~ min 10000 . (+ hp)
|
||||||
where
|
where
|
||||||
cr = _creatures w IM.! n
|
cr = _creatures w IM.! n
|
||||||
|
|
||||||
|
|||||||
+11
-17
@@ -1,23 +1,17 @@
|
|||||||
module Dodge.Item.Craftable where
|
module Dodge.Item.Craftable where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Default.Weapon
|
import Dodge.Default.Weapon
|
||||||
import Dodge.Picture.Layer
|
--import Dodge.Picture.Layer
|
||||||
import Picture
|
--import Picture
|
||||||
import Geometry
|
--import Geometry
|
||||||
|
|
||||||
pipe :: Item
|
makeTypeCraft :: CombineType -> Item
|
||||||
pipe = Craftable
|
makeTypeCraft ct = defaultCraftable
|
||||||
{ _itIdentity = Generic
|
{ _itInvSize = 1
|
||||||
, _itInvSize = 1
|
|
||||||
, _itDimension = defaultItemDimension
|
|
||||||
, _itCurseStatus = Uncursed
|
, _itCurseStatus = Uncursed
|
||||||
, _itName = "PIPE"
|
, _itName = show ct
|
||||||
, _itMaxStack = 3
|
, _itCombineType = ct
|
||||||
, _itAmount = 3
|
, _itConsumption = ItemItselfConsumable 3 3
|
||||||
, _itFloorPict = \_ -> (,) mempty
|
|
||||||
$ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
|
||||||
, _itEquipPict = \_ _ -> mempty
|
|
||||||
, _itID = Nothing
|
|
||||||
, _itInvDisplay = (:[]) . _itName
|
|
||||||
, _itInvColor = green
|
|
||||||
}
|
}
|
||||||
|
pipe :: Item
|
||||||
|
pipe = makeTypeCraft PIPE
|
||||||
|
|||||||
+35
-35
@@ -13,40 +13,40 @@ data HammerPosition
|
|||||||
| HammerUp
|
| HammerUp
|
||||||
deriving
|
deriving
|
||||||
(Eq, Ord, Show)
|
(Eq, Ord, Show)
|
||||||
data ItemIdentity
|
--data ItemIdentity
|
||||||
= Pistol
|
-- = Pistol
|
||||||
| SpreadGun
|
-- | SpreadGun
|
||||||
| MultGun
|
-- | MultGun
|
||||||
| HvAutoGun
|
-- | HvAutoGun
|
||||||
| AutoGun
|
-- | AutoGun
|
||||||
| LtAutoGun
|
-- | LtAutoGun
|
||||||
| MiniGun
|
-- | MiniGun
|
||||||
| Medkit25
|
-- | Medkit25
|
||||||
| MagShield
|
-- | MagShield
|
||||||
| FrontArmour
|
-- | FrontArmour
|
||||||
| JetPack
|
-- | JetPack
|
||||||
| FlameShield
|
-- | FlameShield
|
||||||
| Generic
|
-- | Generic
|
||||||
| SparkGun
|
-- | SparkGun
|
||||||
| ShatterGun
|
-- | ShatterGun
|
||||||
| LongGun
|
-- | LongGun
|
||||||
| Flamethrower
|
-- | Flamethrower
|
||||||
| Blinker
|
-- | Blinker
|
||||||
| Rewinder
|
-- | Rewinder
|
||||||
| Grenade
|
-- | Grenade
|
||||||
| RemoteBomb
|
-- | RemoteBomb
|
||||||
| TeslaGun
|
-- | TeslaGun
|
||||||
| LasGun
|
-- | LasGun
|
||||||
| ForceFieldGun
|
-- | ForceFieldGun
|
||||||
| GrapGun
|
-- | GrapGun
|
||||||
| TractorGun
|
-- | TractorGun
|
||||||
| Launcher
|
-- | Launcher
|
||||||
| RemoteLauncher
|
-- | RemoteLauncher
|
||||||
| LightningGun
|
-- | LightningGun
|
||||||
| PoisonSprayer
|
-- | PoisonSprayer
|
||||||
| FlatShield
|
-- | FlatShield
|
||||||
deriving
|
-- deriving
|
||||||
(Eq,Show,Ord,Enum)
|
-- (Eq,Show,Ord,Enum)
|
||||||
data AimStance
|
data AimStance
|
||||||
= TwoHandTwist
|
= TwoHandTwist
|
||||||
| TwoHandFlat
|
| TwoHandFlat
|
||||||
@@ -85,7 +85,7 @@ data UseDelay -- should just be Delay
|
|||||||
data BarrelSpread
|
data BarrelSpread
|
||||||
= AlignedBarrels
|
= AlignedBarrels
|
||||||
| SpreadBarrels {_spreadAngle :: Float}
|
| SpreadBarrels {_spreadAngle :: Float}
|
||||||
| RotatingBarrels {_rotatingBarrelAccuracy :: Float}
|
| RotatingBarrels {_rotatingBarrelInaccuracy :: Float}
|
||||||
makeLenses ''BarrelSpread
|
makeLenses ''BarrelSpread
|
||||||
makeLenses ''HammerType
|
makeLenses ''HammerType
|
||||||
makeLenses ''ItZoom
|
makeLenses ''ItZoom
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import Control.Lens
|
|||||||
|
|
||||||
magShield :: Item
|
magShield :: Item
|
||||||
magShield = defaultEquipment
|
magShield = defaultEquipment
|
||||||
{ _itIdentity = MagShield
|
{ _itCombineType = MAGSHIELD
|
||||||
, _itName = "MAGSHIELD"
|
, _itName = "MAGSHIELD"
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||||
@@ -26,7 +26,7 @@ magShield = defaultEquipment
|
|||||||
}
|
}
|
||||||
flameShield :: Item
|
flameShield :: Item
|
||||||
flameShield = defaultEquipment
|
flameShield = defaultEquipment
|
||||||
{ _itIdentity = FlameShield
|
{ _itCombineType = FLAMESHIELD
|
||||||
, _itName = "FLAMESHIELD"
|
, _itName = "FLAMESHIELD"
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||||
, _itEquipPict = \cr _ -> (,) emptySH $ onLayer CrLayer $ pictures [color cyan $ circle (_crRad cr+2)]
|
, _itEquipPict = \cr _ -> (,) emptySH $ onLayer CrLayer $ pictures [color cyan $ circle (_crRad cr+2)]
|
||||||
@@ -35,7 +35,7 @@ flameShield = defaultEquipment
|
|||||||
{- | Slows you down, blocks forward projectiles. -}
|
{- | Slows you down, blocks forward projectiles. -}
|
||||||
frontArmour :: Item
|
frontArmour :: Item
|
||||||
frontArmour = defaultEquipment
|
frontArmour = defaultEquipment
|
||||||
{ _itIdentity = FrontArmour
|
{ _itCombineType = FRONTARMOUR
|
||||||
, _itName = "FARMOUR"
|
, _itName = "FARMOUR"
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ translate 0 (-5) $ pictures
|
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ translate 0 (-5) $ pictures
|
||||||
[color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
[color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||||
@@ -53,7 +53,7 @@ flatShield = defaultEquipment
|
|||||||
{ _itEquipPict = pictureWeaponOnAim' flatShieldEquipSPic -- this will not work any more because the shield has no aim stance
|
{ _itEquipPict = pictureWeaponOnAim' flatShieldEquipSPic -- this will not work any more because the shield has no aim stance
|
||||||
, _itEffect = effectOnOffEquip createShieldWall removeShieldWall
|
, _itEffect = effectOnOffEquip createShieldWall removeShieldWall
|
||||||
, _itName = "SHIELD"
|
, _itName = "SHIELD"
|
||||||
, _itIdentity = FlatShield
|
, _itCombineType = FLATSHIELD
|
||||||
}
|
}
|
||||||
flatShieldEquipSPic :: Item -> SPic
|
flatShieldEquipSPic :: Item -> SPic
|
||||||
flatShieldEquipSPic _ =
|
flatShieldEquipSPic _ =
|
||||||
@@ -131,7 +131,7 @@ effectOnOffEquip f f' = ItInvEffectID
|
|||||||
{- | Increases speed, reduces friction, cannot only move forwards. -}
|
{- | Increases speed, reduces friction, cannot only move forwards. -}
|
||||||
jetPack :: Item
|
jetPack :: Item
|
||||||
jetPack = defaultEquipment
|
jetPack = defaultEquipment
|
||||||
{ _itIdentity = JetPack
|
{ _itCombineType = JETPACK
|
||||||
, _itName = "JETPACK"
|
, _itName = "JETPACK"
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||||
, _itEquipPict = \_ _ -> (,) emptySH $ onLayer CrLayer
|
, _itEquipPict = \_ _ -> (,) emptySH $ onLayer CrLayer
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ module Dodge.Item.Weapon.AmmoParams
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Particle.Bullet.Spawn
|
import Dodge.Particle.Bullet.Spawn
|
||||||
import Geometry
|
import Geometry
|
||||||
|
import LensHelp
|
||||||
|
|
||||||
import Control.Lens
|
--import Control.Lens
|
||||||
|
|
||||||
useAmmoParamsRate :: Int
|
useAmmoParamsRate :: Int
|
||||||
-> HammerType
|
-> HammerType
|
||||||
@@ -32,28 +33,30 @@ defaultAimParams = AimParams
|
|||||||
}
|
}
|
||||||
|
|
||||||
useAmmoParams :: Item -> Creature -> World -> World
|
useAmmoParams :: Item -> Creature -> World -> World
|
||||||
useAmmoParams it = withVelWthHiteff (muzvel *.* _amBulVel b) (_amBulWth b) (_amBulEff b)
|
useAmmoParams it = withVelWthHiteff (muzvel *.* _amBulVel b) (_rifling $ _itParams it) (_amBulWth b) (_amBulEff b)
|
||||||
where
|
where
|
||||||
muzvel = _muzVel $ _itParams it
|
muzvel = _muzVel $ _itParams it
|
||||||
b = _aoType $ _itConsumption it
|
b = _aoType $ _itConsumption it
|
||||||
|
|
||||||
useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World
|
useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World
|
||||||
useAmmoParamsVelMod vfact it = withDelayedVelWthHiteff vfact (_amBulVel b) (_amBulWth b) (_amBulEff b)
|
useAmmoParamsVelMod vfact it = withDelayedVelWthHiteff vfact (_amBulVel b) (_rifling $ _itParams it)
|
||||||
|
(_amBulWth b) (_amBulEff b)
|
||||||
where
|
where
|
||||||
b = _aoType $ _itConsumption it
|
b = _aoType $ _itConsumption it
|
||||||
|
|
||||||
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
|
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
|
||||||
withVelWthHiteff
|
withVelWthHiteff
|
||||||
:: Point2 -- ^ Velocity, x direction is forward with respect to the creature
|
:: Point2 -- ^ Velocity, x direction is forward with respect to the creature
|
||||||
|
-> Float -- ^ drag
|
||||||
-> Float -- ^ Bullet width
|
-> Float -- ^ Bullet width
|
||||||
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
|
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
|
||||||
-> Creature
|
-> Creature
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
withVelWthHiteff vel width hiteff cr = over particles (newbul : )
|
withVelWthHiteff vel drag width hiteff cr = particles .:~ newbul
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
newbul = aGenBulAt (Just cid) pos (rotateV dir vel) hiteff width
|
newbul = aGenBulAt (Just cid) pos (rotateV dir vel) drag hiteff width
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||||
|
|
||||||
@@ -61,15 +64,16 @@ withVelWthHiteff vel width hiteff cr = over particles (newbul : )
|
|||||||
withDelayedVelWthHiteff
|
withDelayedVelWthHiteff
|
||||||
:: Float -- ^ Velocity factor for first step
|
:: Float -- ^ Velocity factor for first step
|
||||||
-> Point2 -- ^ Velocity, x direction is forward with respect to the creature
|
-> Point2 -- ^ Velocity, x direction is forward with respect to the creature
|
||||||
|
-> Float -- ^ Drag
|
||||||
-> Float -- ^ Bullet width
|
-> Float -- ^ Bullet width
|
||||||
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
|
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
|
||||||
-> Creature -- ^ Creature id
|
-> Creature -- ^ Creature id
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
withDelayedVelWthHiteff vfact vel width hiteff cr = over particles (newbul : )
|
withDelayedVelWthHiteff vfact vel drag width hiteff cr = particles .:~ newbul
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
newbul = aDelayedBulAt vfact (Just cid) pos (rotateV dir vel) hiteff width
|
newbul = aDelayedBulAt vfact (Just cid) pos (rotateV dir vel) drag hiteff width
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ import qualified Data.IntMap.Strict as IM
|
|||||||
teslaGun :: Item
|
teslaGun :: Item
|
||||||
teslaGun = defaultGun
|
teslaGun = defaultGun
|
||||||
{ _itName = "TESLA"
|
{ _itName = "TESLA"
|
||||||
, _itIdentity = TeslaGun
|
, _itCombineType = TESLAGUN
|
||||||
|
-- , _itIdentity = TeslaGun
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 200
|
{ _ammoMax = 200
|
||||||
, _ammoLoaded = 200
|
, _ammoLoaded = 200
|
||||||
@@ -63,7 +64,7 @@ teslaGunPic _ = noPic $ colorSH blue $
|
|||||||
lasGun :: Item
|
lasGun :: Item
|
||||||
lasGun = defaultAutoGun
|
lasGun = defaultAutoGun
|
||||||
{ _itName = "LASGUN ////"
|
{ _itName = "LASGUN ////"
|
||||||
, _itIdentity = LasGun
|
, _itCombineType = LASGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 200
|
{ _ammoMax = 200
|
||||||
, _ammoLoaded = 200
|
, _ammoLoaded = 200
|
||||||
@@ -119,7 +120,7 @@ lasGunPic it =
|
|||||||
tractorGun :: Item
|
tractorGun :: Item
|
||||||
tractorGun = defaultAutoGun
|
tractorGun = defaultAutoGun
|
||||||
{ _itName = "TRACTORGUN"
|
{ _itName = "TRACTORGUN"
|
||||||
, _itIdentity = TractorGun
|
, _itCombineType = TRACTORGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 10000
|
{ _ammoMax = 10000
|
||||||
, _ammoLoaded = 10000
|
, _ammoLoaded = 10000
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ maxT = 20
|
|||||||
boosterGun :: Item
|
boosterGun :: Item
|
||||||
boosterGun = defaultGun
|
boosterGun = defaultGun
|
||||||
{ _itName = "BOOSTER"
|
{ _itName = "BOOSTER"
|
||||||
, _itIdentity = Blinker
|
, _itCombineType = BOOSTER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 100
|
{ _ammoMax = 100
|
||||||
, _ammoLoaded = 100
|
, _ammoLoaded = 100
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ bounceBullet = BulletAmmo
|
|||||||
{ _amString = "BOUNCING"
|
{ _amString = "BOUNCING"
|
||||||
, _amBulEff = destroyOnImpact bulHitCr bulBounceWall
|
, _amBulEff = destroyOnImpact bulHitCr bulBounceWall
|
||||||
, _amBulWth = 2
|
, _amBulWth = 2
|
||||||
, _amBulVel = V2 10 0
|
, _amBulVel = V2 40 0
|
||||||
}
|
}
|
||||||
ltBullet :: AmmoType
|
ltBullet :: AmmoType
|
||||||
ltBullet = BulletAmmo
|
ltBullet = BulletAmmo
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
module Dodge.Item.Weapon.BulletGuns
|
module Dodge.Item.Weapon.BulletGuns
|
||||||
( pistol
|
( pistol
|
||||||
|
, bangStick
|
||||||
|
, bangRod
|
||||||
|
, bangCane
|
||||||
, autoGun
|
, autoGun
|
||||||
, multGun
|
, multGun
|
||||||
, miniGun
|
, miniGun
|
||||||
@@ -36,7 +39,7 @@ import Control.Lens
|
|||||||
autoGun :: Item
|
autoGun :: Item
|
||||||
autoGun = defaultAutoGun
|
autoGun = defaultAutoGun
|
||||||
{ _itName = "AUTOGUN"
|
{ _itName = "AUTOGUN"
|
||||||
, _itIdentity = AutoGun
|
, _itCombineType = AUTOGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _aoType = basicBullet
|
||||||
, _ammoMax = 30
|
, _ammoMax = 30
|
||||||
@@ -72,6 +75,7 @@ autoGun = defaultAutoGun
|
|||||||
, _itInvDisplay = basicWeaponDisplay
|
, _itInvDisplay = basicWeaponDisplay
|
||||||
, _itParams = BulletShooter
|
, _itParams = BulletShooter
|
||||||
{ _muzVel = 1
|
{ _muzVel = 1
|
||||||
|
, _rifling = 0.9
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = SingleBarrel 0.1
|
, _gunBarrels = SingleBarrel 0.1
|
||||||
}
|
}
|
||||||
@@ -86,11 +90,48 @@ autoGunPic it = noPic $
|
|||||||
<> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5))
|
<> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5))
|
||||||
where
|
where
|
||||||
x = fromIntegral $ _ammoLoaded $ _itConsumption it
|
x = fromIntegral $ _ammoLoaded $ _itConsumption it
|
||||||
|
bangStick :: Item
|
||||||
|
bangStick = defaultGun
|
||||||
|
{ _itName = "BANGSTICK"
|
||||||
|
, _itCombineType = BANGSTICK
|
||||||
|
, _itConsumption = defaultAmmo
|
||||||
|
{ _aoType = basicBullet
|
||||||
|
, _ammoMax = 1
|
||||||
|
, _ammoLoaded = 1
|
||||||
|
, _reloadTime = 20
|
||||||
|
, _reloadType = ActivePartial 1
|
||||||
|
}
|
||||||
|
, _itUse = useAmmoParamsRate 8 upHammer
|
||||||
|
[ ammoCheckI
|
||||||
|
, hammerCheckI
|
||||||
|
, useTimeCheck
|
||||||
|
, withSoundStart tap3S
|
||||||
|
, useAmmoAmount 1
|
||||||
|
, applyInaccuracy
|
||||||
|
, withMuzFlareI
|
||||||
|
]
|
||||||
|
, _itFloorPict = pistolPic
|
||||||
|
-- , _itZoom = defaultItZoom
|
||||||
|
, _itEquipPict = pictureWeaponAim pistolPic
|
||||||
|
, _itID = Nothing
|
||||||
|
, _itInvDisplay = basicWeaponDisplay
|
||||||
|
, _itInvColor = white
|
||||||
|
, _itTargeting = Nothing
|
||||||
|
, _itParams = BulletShooter
|
||||||
|
{ _muzVel = 0.8
|
||||||
|
, _rifling = 0.8
|
||||||
|
, _bore = 2
|
||||||
|
, _gunBarrels = SingleBarrel 0.05
|
||||||
|
}
|
||||||
|
, _itTweaks = defaultBulletSelTweak
|
||||||
|
}
|
||||||
|
bangCane = bangStick
|
||||||
|
bangRod = bangCane
|
||||||
|
|
||||||
pistol :: Item
|
pistol :: Item
|
||||||
pistol = defaultGun
|
pistol = defaultGun
|
||||||
{ _itName = "PISTOL"
|
{ _itName = "PISTOL"
|
||||||
, _itIdentity = Pistol
|
, _itCombineType = PISTOL
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _aoType = basicBullet
|
||||||
, _ammoMax = 15
|
, _ammoMax = 15
|
||||||
@@ -116,6 +157,7 @@ pistol = defaultGun
|
|||||||
, _itTargeting = Nothing
|
, _itTargeting = Nothing
|
||||||
, _itParams = BulletShooter
|
, _itParams = BulletShooter
|
||||||
{ _muzVel = 0.8
|
{ _muzVel = 0.8
|
||||||
|
, _rifling = 0.8
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = SingleBarrel 0.05
|
, _gunBarrels = SingleBarrel 0.05
|
||||||
}
|
}
|
||||||
@@ -138,7 +180,7 @@ bulletClip x = rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW 3 0 (3 -
|
|||||||
hvAutoGun :: Item
|
hvAutoGun :: Item
|
||||||
hvAutoGun = defaultAutoGun
|
hvAutoGun = defaultAutoGun
|
||||||
{ _itName = "AUTO-HV"
|
{ _itName = "AUTO-HV"
|
||||||
, _itIdentity = HvAutoGun
|
, _itCombineType = HVAUTOGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = hvBullet
|
{ _aoType = hvBullet
|
||||||
, _ammoMax = 100
|
, _ammoMax = 100
|
||||||
@@ -178,7 +220,7 @@ hvAutoGunPic it =
|
|||||||
ltAutoGun :: Item
|
ltAutoGun :: Item
|
||||||
ltAutoGun = defaultAutoGun
|
ltAutoGun = defaultAutoGun
|
||||||
{ _itName = "AUTO-LT"
|
{ _itName = "AUTO-LT"
|
||||||
, _itIdentity = LtAutoGun
|
, _itCombineType = LTAUTOGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = ltBullet
|
{ _aoType = ltBullet
|
||||||
, _ammoMax = 25
|
, _ammoMax = 25
|
||||||
@@ -198,6 +240,7 @@ ltAutoGun = defaultAutoGun
|
|||||||
, _itFloorPict = ltAutoGunPic
|
, _itFloorPict = ltAutoGunPic
|
||||||
, _itParams = BulletShooter
|
, _itParams = BulletShooter
|
||||||
{ _muzVel = 1
|
{ _muzVel = 1
|
||||||
|
, _rifling = 0.8
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = SingleBarrel autogunSpread
|
, _gunBarrels = SingleBarrel autogunSpread
|
||||||
}
|
}
|
||||||
@@ -217,7 +260,7 @@ ltAutoGunPic it =
|
|||||||
miniGun :: Item
|
miniGun :: Item
|
||||||
miniGun = defaultAutoGun
|
miniGun = defaultAutoGun
|
||||||
{ _itName = "MINI-G"
|
{ _itName = "MINI-G"
|
||||||
, _itIdentity = MiniGun
|
, _itCombineType = MINIGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _aoType = basicBullet
|
||||||
, _ammoMax = 1500
|
, _ammoMax = 1500
|
||||||
@@ -262,6 +305,14 @@ miniGun = defaultAutoGun
|
|||||||
& useAim . aimStance .~ TwoHandTwist
|
& useAim . aimStance .~ TwoHandTwist
|
||||||
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||||
, _itFloorPict = miniGunPictItem
|
, _itFloorPict = miniGunPictItem
|
||||||
|
, _itParams = BulletShooter
|
||||||
|
{ _muzVel = 1
|
||||||
|
, _rifling = 0.9
|
||||||
|
, _bore = 2
|
||||||
|
, _gunBarrels = MultiBarrel
|
||||||
|
{_brlSpread = RotatingBarrels 0.01
|
||||||
|
,_brlNum = 4}
|
||||||
|
}
|
||||||
, _itEquipPict = pictureWeaponAim miniGunPictItem
|
, _itEquipPict = pictureWeaponAim miniGunPictItem
|
||||||
, _itTweaks = defaultBulletSelTweak
|
, _itTweaks = defaultBulletSelTweak
|
||||||
, _itInvSize = 4
|
, _itInvSize = 4
|
||||||
@@ -316,7 +367,7 @@ miniGunPict spin am =
|
|||||||
spreadGun :: Item
|
spreadGun :: Item
|
||||||
spreadGun = defaultGun
|
spreadGun = defaultGun
|
||||||
{ _itName = "SPREAD"
|
{ _itName = "SPREAD"
|
||||||
, _itIdentity = SpreadGun
|
, _itCombineType = SPREADGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _aoType = basicBullet
|
||||||
, _ammoMax = 5
|
, _ammoMax = 5
|
||||||
@@ -335,6 +386,7 @@ spreadGun = defaultGun
|
|||||||
]
|
]
|
||||||
, _itParams = BulletShooter
|
, _itParams = BulletShooter
|
||||||
{ _muzVel = 0.7
|
{ _muzVel = 0.7
|
||||||
|
, _rifling = 0.8
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = MultiBarrel
|
, _gunBarrels = MultiBarrel
|
||||||
{_brlNum = 5
|
{_brlNum = 5
|
||||||
@@ -355,7 +407,7 @@ spreadGunPic it =
|
|||||||
multGun :: Item
|
multGun :: Item
|
||||||
multGun = defaultGun
|
multGun = defaultGun
|
||||||
{ _itName = "MULTGUN"
|
{ _itName = "MULTGUN"
|
||||||
, _itIdentity = MultGun
|
, _itCombineType = MULTGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _aoType = basicBullet
|
||||||
, _ammoMax = 5
|
, _ammoMax = 5
|
||||||
@@ -380,6 +432,7 @@ multGun = defaultGun
|
|||||||
, _itFloorPict = multGunSPic
|
, _itFloorPict = multGunSPic
|
||||||
, _itParams = BulletShooter
|
, _itParams = BulletShooter
|
||||||
{ _muzVel = 1
|
{ _muzVel = 1
|
||||||
|
, _rifling = 0.9
|
||||||
, _bore = 3
|
, _bore = 3
|
||||||
, _gunBarrels = MultiBarrel
|
, _gunBarrels = MultiBarrel
|
||||||
{_brlNum = 5
|
{_brlNum = 5
|
||||||
@@ -406,7 +459,7 @@ multGunSPic it =
|
|||||||
longGun :: Item
|
longGun :: Item
|
||||||
longGun = defaultGun
|
longGun = defaultGun
|
||||||
{ _itName = "LONGGUN"
|
{ _itName = "LONGGUN"
|
||||||
, _itIdentity = LongGun
|
, _itCombineType = LONGGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = hvBullet
|
{ _aoType = hvBullet
|
||||||
, _ammoMax = 1
|
, _ammoMax = 1
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import Control.Lens
|
|||||||
lasDrones :: Item
|
lasDrones :: Item
|
||||||
lasDrones = defaultGun
|
lasDrones = defaultGun
|
||||||
{ _itName = "DRONES"
|
{ _itName = "DRONES"
|
||||||
, _itIdentity = Generic
|
, _itCombineType = DRONELAUNCHER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = DroneAmmo { _amString = "LASDRONE" }
|
{ _aoType = DroneAmmo { _amString = "LASDRONE" }
|
||||||
, _ammoMax = 2
|
, _ammoMax = 2
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ import Control.Lens
|
|||||||
grenade :: Item
|
grenade :: Item
|
||||||
grenade = Throwable
|
grenade = Throwable
|
||||||
{ _itName = "GRENADE " ++ show fuseTime
|
{ _itName = "GRENADE " ++ show fuseTime
|
||||||
|
, _itCombineType = GRENADE
|
||||||
, _itInvSize = 1
|
, _itInvSize = 1
|
||||||
, _itDimension = defaultItemDimension
|
, _itDimension = defaultItemDimension
|
||||||
, _itCurseStatus = Uncursed
|
, _itCurseStatus = Uncursed
|
||||||
, _itIdentity = Grenade
|
|
||||||
, _itMaxStack = 8
|
, _itMaxStack = 8
|
||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||||
@@ -213,7 +213,7 @@ defaultThrowable = grenade
|
|||||||
remoteBomb :: Item
|
remoteBomb :: Item
|
||||||
remoteBomb = defaultThrowable
|
remoteBomb = defaultThrowable
|
||||||
{ _itName = "REMOTEBOMB"
|
{ _itName = "REMOTEBOMB"
|
||||||
, _itIdentity = RemoteBomb
|
, _itCombineType = REMOTEBOMB
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2
|
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ basicWeaponDisplay it = [midPadL 10 ' ' thename (' ' : thenumber) ++ theparam]
|
|||||||
Just' x -> show x ++ "R" ++ show (_ammoLoaded am)
|
Just' x -> show x ++ "R" ++ show (_ammoLoaded am)
|
||||||
Just am@ChargeableAmmo{} -> show $ _wpCharge am
|
Just am@ChargeableAmmo{} -> show $ _wpCharge am
|
||||||
Just x@ItemItselfConsumable{} -> show $ _itMaxStack' x
|
Just x@ItemItselfConsumable{} -> show $ _itMaxStack' x
|
||||||
|
Just NoConsumption -> "NOCONSUMPTION"
|
||||||
Nothing -> ""
|
Nothing -> ""
|
||||||
theparam = fromMaybe []
|
theparam = fromMaybe []
|
||||||
. listToMaybe
|
. listToMaybe
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import System.Random
|
|||||||
launcher :: Item
|
launcher :: Item
|
||||||
launcher = defaultGun
|
launcher = defaultGun
|
||||||
{ _itName = "ROCKO"
|
{ _itName = "ROCKO"
|
||||||
, _itIdentity = Launcher
|
, _itCombineType = LAUNCHER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = defaultShellAmmo
|
{ _aoType = defaultShellAmmo
|
||||||
{ _amPayload = makeExplosionAt
|
{ _amPayload = makeExplosionAt
|
||||||
@@ -260,7 +260,7 @@ trySpinByCID cid i pj w = w & props . ix pjid . pjSpin .~ newSpin
|
|||||||
remoteLauncher :: Item
|
remoteLauncher :: Item
|
||||||
remoteLauncher = defaultGun
|
remoteLauncher = defaultGun
|
||||||
{ _itName = "ROCKO-REM"
|
{ _itName = "ROCKO-REM"
|
||||||
, _itIdentity = RemoteLauncher
|
, _itCombineType = LAUNCHER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = defaultShellAmmo
|
{ _aoType = defaultShellAmmo
|
||||||
{ _amPayload = makeExplosionAt
|
{ _amPayload = makeExplosionAt
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Sends out pulses that display walls. -}
|
|||||||
radar :: Item
|
radar :: Item
|
||||||
radar = defaultGun
|
radar = defaultGun
|
||||||
{ _itName = "RADAR"
|
{ _itName = "RADAR"
|
||||||
, _itIdentity = Generic
|
, _itCombineType = RADAR
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 100
|
{ _ammoMax = 100
|
||||||
, _ammoLoaded = 100
|
, _ammoLoaded = 100
|
||||||
@@ -40,7 +40,7 @@ Sends out pulses that display creatures. -}
|
|||||||
sonar :: Item
|
sonar :: Item
|
||||||
sonar = defaultGun
|
sonar = defaultGun
|
||||||
{ _itName = "SONAR"
|
{ _itName = "SONAR"
|
||||||
, _itIdentity = Generic
|
, _itCombineType = RADAR
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 100
|
{ _ammoMax = 100
|
||||||
, _ammoLoaded = 100
|
, _ammoLoaded = 100
|
||||||
@@ -59,7 +59,7 @@ sonar = defaultGun
|
|||||||
Automatically sends out pulses that display creatures. -}
|
Automatically sends out pulses that display creatures. -}
|
||||||
autoSonar :: Item
|
autoSonar :: Item
|
||||||
autoSonar = defaultEquipment
|
autoSonar = defaultEquipment
|
||||||
{ _itIdentity = Generic
|
{ _itCombineType = RADAR
|
||||||
, _itName = "AUTOSONAR"
|
, _itName = "AUTOSONAR"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
@@ -73,7 +73,7 @@ autoSonar = defaultEquipment
|
|||||||
Automatically sends out pulses that display walls. -}
|
Automatically sends out pulses that display walls. -}
|
||||||
autoRadar :: Item
|
autoRadar :: Item
|
||||||
autoRadar = defaultEquipment
|
autoRadar = defaultEquipment
|
||||||
{ _itIdentity = Generic
|
{ _itCombineType = RADAR
|
||||||
, _itName = "AUTORADAR"
|
, _itName = "AUTORADAR"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import System.Random
|
|||||||
poisonSprayer :: Item
|
poisonSprayer :: Item
|
||||||
poisonSprayer = defaultAutoGun
|
poisonSprayer = defaultAutoGun
|
||||||
{ _itName = "POISON"
|
{ _itName = "POISON"
|
||||||
, _itIdentity = PoisonSprayer
|
, _itCombineType = SPRAYER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 500
|
{ _ammoMax = 500
|
||||||
, _ammoLoaded = 500
|
, _ammoLoaded = 500
|
||||||
@@ -57,7 +57,7 @@ poisonSprayer = defaultAutoGun
|
|||||||
flamer :: Item
|
flamer :: Item
|
||||||
flamer = defaultAutoGun
|
flamer = defaultAutoGun
|
||||||
{ _itName = "FLAMER"
|
{ _itName = "FLAMER"
|
||||||
, _itIdentity = Flamethrower
|
, _itCombineType = SQUIRTER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 250
|
{ _ammoMax = 250
|
||||||
, _ammoLoaded = 250
|
, _ammoLoaded = 250
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import Control.Lens
|
|||||||
rewindGun :: Item
|
rewindGun :: Item
|
||||||
rewindGun = defaultGun
|
rewindGun = defaultGun
|
||||||
{ _itName = "REWINDER"
|
{ _itName = "REWINDER"
|
||||||
, _itIdentity = Rewinder
|
, _itCombineType = REWINDER
|
||||||
, _itConsumption = ChargeableAmmo
|
, _itConsumption = ChargeableAmmo
|
||||||
{ _wpMaxCharge = 250
|
{ _wpMaxCharge = 250
|
||||||
, _wpCharge = 0
|
, _wpCharge = 0
|
||||||
@@ -55,7 +55,7 @@ useRewindGun _ _ w = case _rewindWorlds w of
|
|||||||
shrinkGun :: Item
|
shrinkGun :: Item
|
||||||
shrinkGun = defaultGun
|
shrinkGun = defaultGun
|
||||||
{ _itName = "SHRINKER"
|
{ _itName = "SHRINKER"
|
||||||
, _itIdentity = Generic
|
, _itCombineType = SHRINKER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 100
|
{ _ammoMax = 100
|
||||||
, _ammoLoaded = 100
|
, _ammoLoaded = 100
|
||||||
@@ -85,7 +85,7 @@ useShrinkGun cr invid w = if _itBool $ _itAttachment it
|
|||||||
blinkGun :: Item
|
blinkGun :: Item
|
||||||
blinkGun = defaultGun
|
blinkGun = defaultGun
|
||||||
{ _itName = "BLINKER"
|
{ _itName = "BLINKER"
|
||||||
, _itIdentity = Blinker
|
, _itCombineType = BLINKER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 100
|
{ _ammoMax = 100
|
||||||
, _ammoLoaded = 100
|
, _ammoLoaded = 100
|
||||||
@@ -117,7 +117,7 @@ autoEffectGun name eff = defaultAutoGun
|
|||||||
forceFieldGun :: Item
|
forceFieldGun :: Item
|
||||||
forceFieldGun = defaultGun
|
forceFieldGun = defaultGun
|
||||||
{ _itName = "FORCEFIELD"
|
{ _itName = "FORCEFIELD"
|
||||||
, _itIdentity = ForceFieldGun
|
, _itCombineType = FORCEFIELD
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoMax = 100
|
{ _ammoMax = 100
|
||||||
, _ammoLoaded = 100
|
, _ammoLoaded = 100
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ import Control.Monad.State
|
|||||||
-- (const $ return $ chainUses $ map singleUseAll [door,lasTunnel,door] , return FlatShield )
|
-- (const $ return $ chainUses $ map singleUseAll [door,lasTunnel,door] , return FlatShield )
|
||||||
-- ,
|
-- ,
|
||||||
|
|
||||||
lockRoomKeyItems :: RandomGen g => [ (Int -> State g (SubCompTree Room) , State g ItemIdentity ) ]
|
lockRoomKeyItems :: RandomGen g => [ (Int -> State g (SubCompTree Room) , State g CombineType ) ]
|
||||||
lockRoomKeyItems =
|
lockRoomKeyItems =
|
||||||
[(lasCenSensEdge, takeOne [Launcher] )
|
[(lasCenSensEdge, takeOne [LAUNCHER] )
|
||||||
,(const slowDoorRoomRunPast, return MiniGun)
|
,(const slowDoorRoomRunPast, return MINIGUN)
|
||||||
]
|
]
|
||||||
|
|
||||||
itemRooms :: RandomGen g => [(ItemIdentity, State g (SubCompTree Room))]
|
itemRooms :: RandomGen g => [(CombineType, State g (SubCompTree Room))]
|
||||||
itemRooms =
|
itemRooms =
|
||||||
[ (Launcher , corridorBoss launcherCrit )
|
[ (LAUNCHER , corridorBoss launcherCrit )
|
||||||
, (MiniGun , join $ takeOne [roomMiniIntro, minigunFakeout] )
|
, (MINIGUN , join $ takeOne [roomMiniIntro, minigunFakeout] )
|
||||||
]
|
]
|
||||||
|
|
||||||
corridorBoss :: RandomGen g => Creature -> State g (SubCompTree Room)
|
corridorBoss :: RandomGen g => Creature -> State g (SubCompTree Room)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ bulBounceArmCr' bt p cr w
|
|||||||
pOut = p +.+ 2 *.* newDir
|
pOut = p +.+ 2 *.* newDir
|
||||||
reflectVel = magV bulVel *.* newDir
|
reflectVel = magV bulVel *.* newDir
|
||||||
addBouncer = worldEvents %~ ( over particles (bouncer :) . )
|
addBouncer = worldEvents %~ ( over particles (bouncer :) . )
|
||||||
bouncer = (aGenBulAt Nothing pOut reflectVel
|
bouncer = (aGenBulAt Nothing pOut reflectVel (_btDrag bt)
|
||||||
(_btHitEffect' bt) (_btWidth' bt)
|
(_btHitEffect' bt) (_btWidth' bt)
|
||||||
) {_btTimer' = _btTimer' bt - 1}
|
) {_btTimer' = _btTimer' bt - 1}
|
||||||
{- | Bullet pass through creatures. -}
|
{- | Bullet pass through creatures. -}
|
||||||
@@ -79,7 +79,7 @@ bulPenCr' bt p cr w
|
|||||||
sp = head $ _btTrail' bt
|
sp = head $ _btTrail' bt
|
||||||
ep = sp +.+ _btVel' bt
|
ep = sp +.+ _btVel' bt
|
||||||
addPiercer = over particles (piercer :)
|
addPiercer = over particles (piercer :)
|
||||||
piercer = (aGenBulAt (Just cid) p (_btVel' bt)
|
piercer = (aGenBulAt (Just cid) p (_btVel' bt) (_btDrag bt)
|
||||||
(_btHitEffect' bt) (_btWidth' bt)
|
(_btHitEffect' bt) (_btWidth' bt)
|
||||||
) {_btTimer' = _btTimer' bt - 1}
|
) {_btTimer' = _btTimer' bt - 1}
|
||||||
{- | Heavy bullet effects when hitting creature:
|
{- | Heavy bullet effects when hitting creature:
|
||||||
@@ -138,7 +138,7 @@ bulBounceWall bt p wl = damageWall (Blunt 50 sp p ep) wl . over worldEvents addB
|
|||||||
ep = sp +.+ _btVel' bt
|
ep = sp +.+ _btVel' bt
|
||||||
sp = head $ _btTrail' bt
|
sp = head $ _btTrail' bt
|
||||||
pOut = p +.+ squashNormalizeV (sp -.- p)
|
pOut = p +.+ squashNormalizeV (sp -.- p)
|
||||||
bouncer = (aGenBulAt Nothing pOut reflectVel (_btHitEffect' bt) (_btWidth' bt)
|
bouncer = (aGenBulAt Nothing pOut reflectVel 0.5 (_btHitEffect' bt) (_btWidth' bt)
|
||||||
) {_btTimer' = _btTimer' bt - 1}
|
) {_btTimer' = _btTimer' bt - 1}
|
||||||
reflectVel = reflVelWall wl (_btVel' bt)
|
reflectVel = reflVelWall wl (_btVel' bt)
|
||||||
addBouncer = ( over particles (bouncer : ) . )
|
addBouncer = ( over particles (bouncer : ) . )
|
||||||
|
|||||||
@@ -16,13 +16,15 @@ aGenBulAt
|
|||||||
:: Maybe Int -- ^ Pass-through creature id
|
:: Maybe Int -- ^ Pass-through creature id
|
||||||
-> Point2 -- ^ Start position
|
-> Point2 -- ^ Start position
|
||||||
-> Point2 -- ^ Velocity
|
-> Point2 -- ^ Velocity
|
||||||
|
-> Float -- ^ Slowdown
|
||||||
-> HitEffect
|
-> HitEffect
|
||||||
-> Float -- ^ Bullet width
|
-> Float -- ^ Bullet width
|
||||||
-> Particle
|
-> Particle
|
||||||
aGenBulAt maycid pos vel hiteff width = BulletPt
|
aGenBulAt maycid pos vel drag hiteff width = BulletPt
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate = mvBullet
|
, _ptUpdate = mvBullet
|
||||||
, _btVel' = vel
|
, _btVel' = vel
|
||||||
|
, _btDrag = drag
|
||||||
, _btColor' = V4 2 2 2 2
|
, _btColor' = V4 2 2 2 2
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
, _btPassThrough' = maycid
|
, _btPassThrough' = maycid
|
||||||
@@ -35,13 +37,15 @@ aDelayedBulAt
|
|||||||
-> Maybe Int -- ^ Pass-through creature id
|
-> Maybe Int -- ^ Pass-through creature id
|
||||||
-> Point2 -- ^ Start position
|
-> Point2 -- ^ Start position
|
||||||
-> Point2 -- ^ Velocity
|
-> Point2 -- ^ Velocity
|
||||||
|
-> Float -- ^ Drag
|
||||||
-> HitEffect
|
-> HitEffect
|
||||||
-> Float -- ^ Bullet width
|
-> Float -- ^ Bullet width
|
||||||
-> Particle
|
-> Particle
|
||||||
aDelayedBulAt vfact maycid pos vel hiteff width = BulletPt
|
aDelayedBulAt vfact maycid pos vel drag hiteff width = BulletPt
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate = \w -> resetVel . mvBullet w
|
, _ptUpdate = \w -> resetVel . mvBullet w
|
||||||
, _btVel' = vfact *.* vel
|
, _btVel' = vfact *.* vel
|
||||||
|
, _btDrag = drag
|
||||||
, _btColor' = V4 2 2 2 2
|
, _btColor' = V4 2 2 2 2
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
, _btPassThrough' = maycid
|
, _btPassThrough' = maycid
|
||||||
@@ -65,6 +69,7 @@ aCurveBulAt maycid col pos control targ hiteff width = BulletPt
|
|||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate = \w -> mvBullet w . setVel
|
, _ptUpdate = \w -> mvBullet w . setVel
|
||||||
, _btVel' = V2 0 0
|
, _btVel' = V2 0 0
|
||||||
|
, _btDrag = 1
|
||||||
, _btColor' = col
|
, _btColor' = col
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
, _btPassThrough' = maycid
|
, _btPassThrough' = maycid
|
||||||
|
|||||||
@@ -10,23 +10,21 @@ import Dodge.WorldEvent.ThingsHit
|
|||||||
import Geometry
|
import Geometry
|
||||||
--import Geometry.Vector3D
|
--import Geometry.Vector3D
|
||||||
|
|
||||||
|
import Data.Bifunctor
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
{-
|
{-
|
||||||
Update for a generic bullet.
|
Update for a generic bullet.
|
||||||
-}
|
-}
|
||||||
mvBullet :: World -> Particle -> (World, Maybe Particle)
|
mvBullet :: World -> Particle -> (World, Maybe Particle)
|
||||||
mvBullet w bt
|
mvBullet w bt
|
||||||
| t <= 0 = wAnd Nothing
|
| t <= 0 || magV (_btVel' bt) < 1 = wAnd Nothing
|
||||||
| t < 4 = wAnd $ Just $ bt
|
| otherwise = second (fmap dodrag) $ hiteff bt (thingsHitExceptCr mcr p (p +.+ vel) w) w
|
||||||
& btPassThrough' .~ Nothing
|
|
||||||
& btTrail' .~ (p:p:ps)
|
|
||||||
& btTimer' -~ 1
|
|
||||||
-- | otherwise = hiteff bt (thingsHitExceptCr3D' mcr (addZ 20 p) (addZ 20 (p +.+ vel)) w) w
|
|
||||||
| otherwise = hiteff bt (thingsHitExceptCr mcr p (p +.+ vel) w) w
|
|
||||||
where
|
where
|
||||||
|
dodrag = btVel' %~ (drag *.*)
|
||||||
|
drag = _btDrag bt
|
||||||
wAnd = (w,)
|
wAnd = (w,)
|
||||||
mcr = _btPassThrough' bt
|
mcr = _btPassThrough' bt
|
||||||
(p:ps) = _btTrail' bt
|
(p:_) = _btTrail' bt
|
||||||
vel = _btVel' bt
|
vel = _btVel' bt
|
||||||
hiteff = _btHitEffect' bt
|
hiteff = _btHitEffect' bt
|
||||||
t = _btTimer' bt
|
t = _btTimer' bt
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ colSpark' randDir time col pos baseDir w = w
|
|||||||
spark = BulletPt
|
spark = BulletPt
|
||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate = mvBullet
|
, _ptUpdate = mvBullet
|
||||||
|
, _btDrag = 0.9
|
||||||
, _btVel' = rotateV dir (V2 5 0)
|
, _btVel' = rotateV dir (V2 5 0)
|
||||||
, _btColor' = col
|
, _btColor' = col
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ createBarrelSpark pos dir maycid time colid w = w
|
|||||||
{ _ptDraw = drawBul
|
{ _ptDraw = drawBul
|
||||||
, _ptUpdate = mvBullet
|
, _ptUpdate = mvBullet
|
||||||
, _btVel' = rotateV dir (V2 5 0)
|
, _btVel' = rotateV dir (V2 5 0)
|
||||||
|
, _btDrag = 0.9
|
||||||
, _btColor' = numColor colid
|
, _btColor' = numColor colid
|
||||||
, _btTrail' = [pos]
|
, _btTrail' = [pos]
|
||||||
, _btPassThrough' = maycid
|
, _btPassThrough' = maycid
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ module ShapePicture
|
|||||||
, rotateSP
|
, rotateSP
|
||||||
, SPic
|
, SPic
|
||||||
, noPic
|
, noPic
|
||||||
|
, noShape
|
||||||
, _spShape
|
, _spShape
|
||||||
, _spPicture
|
, _spPicture
|
||||||
)
|
)
|
||||||
@@ -20,6 +21,9 @@ type SPic = (Shape, Picture)
|
|||||||
noPic :: Shape -> SPic
|
noPic :: Shape -> SPic
|
||||||
noPic sh = (sh,mempty)
|
noPic sh = (sh,mempty)
|
||||||
|
|
||||||
|
noShape :: Picture -> SPic
|
||||||
|
noShape pic = (mempty,pic)
|
||||||
|
|
||||||
_spShape :: SPic -> Shape
|
_spShape :: SPic -> Shape
|
||||||
_spShape = fst
|
_spShape = fst
|
||||||
_spPicture :: SPic -> Picture
|
_spPicture :: SPic -> Picture
|
||||||
|
|||||||
Reference in New Issue
Block a user