Work on bullet module system
This commit is contained in:
@@ -67,6 +67,7 @@ addModules (ps,it) = (is , ) <$> [ (it & itModules .~ themodules,s) | (themodule
|
|||||||
where
|
where
|
||||||
(ms,is) = unzip ps
|
(ms,is) = unzip ps
|
||||||
combinedmodules = foldr f [(_itModules it,[])] ms
|
combinedmodules = foldr f [(_itModules it,[])] ms
|
||||||
|
f :: ItemModules -> [(ItemModules,[String])] -> [(ItemModules,[String])]
|
||||||
f ims imss = concatMap (g ims) imss
|
f ims imss = concatMap (g ims) imss
|
||||||
g ims (ims',s) = map (second (s++)) $ combineModules ims ims'
|
g ims (ims',s) = map (second (s++)) $ combineModules ims ims'
|
||||||
|
|
||||||
@@ -75,10 +76,11 @@ combineModules (ItemModules a1) (ItemModules a2)
|
|||||||
= [(ItemModules a,ss) | (a,ss) <- combineModule a1 a2]
|
= [(ItemModules a,ss) | (a,ss) <- combineModule a1 a2]
|
||||||
|
|
||||||
combineModule :: ItemModule a -> ItemModule a -> [(ItemModule a,[String])]
|
combineModule :: ItemModule a -> ItemModule a -> [(ItemModule a,[String])]
|
||||||
combineModule BlockedModule (ItemModule _ ss _) = [(BlockedModule, "WARNING:REMOVES":ss)]
|
combineModule (ItemModule _ ss _) BlockedModule = [(BlockedModule, "WARNING:REMOVES":ss)]
|
||||||
combineModule BlockedModule _ = [(BlockedModule,["a"])]
|
combineModule _ BlockedModule = [(BlockedModule, [])]
|
||||||
combineModule m BlockedModule = [(m,[])]
|
combineModule BlockedModule m = [(m,[])]
|
||||||
combineModule DefaultModule m = [(m,[])]
|
combineModule DefaultModule m = [(m,[])]
|
||||||
|
combineModule (ItemModule _ ss _) m@ItemModule{} = [(m,"WARNING:REMOVES":ss)]
|
||||||
combineModule m _ = [(m,[])]
|
combineModule m _ = [(m,[])]
|
||||||
|
|
||||||
toggleCombineInv :: World -> World
|
toggleCombineInv :: World -> World
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
{-# LANGUAGE TupleSections #-}
|
{-# LANGUAGE TupleSections #-}
|
||||||
module Dodge.Combine.Combinations where
|
module Dodge.Combine.Combinations where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.WorldEvent.HitEffect
|
||||||
|
import Dodge.Particle.Bullet.HitEffect
|
||||||
import Dodge.Item.Equipment
|
import Dodge.Item.Equipment
|
||||||
import Dodge.Item.Craftable
|
import Dodge.Item.Craftable
|
||||||
import Dodge.Item.Weapon.BulletGuns
|
import Dodge.Item.Weapon.BulletGuns
|
||||||
@@ -8,6 +10,7 @@ import Dodge.Item.Weapon.BatteryGuns
|
|||||||
import Dodge.Item.Weapon.Launcher
|
import Dodge.Item.Weapon.Launcher
|
||||||
import Dodge.Item.Weapon.SprayGuns
|
import Dodge.Item.Weapon.SprayGuns
|
||||||
|
|
||||||
|
import Control.Lens
|
||||||
itemCombinations :: [([(Int,CombineType)],Item)]
|
itemCombinations :: [([(Int,CombineType)],Item)]
|
||||||
itemCombinations =
|
itemCombinations =
|
||||||
[ po [PIPE, HARDWARE] (bangStick 1)
|
[ po [PIPE, HARDWARE] (bangStick 1)
|
||||||
@@ -64,8 +67,20 @@ itemCombinations =
|
|||||||
++ map (\i -> po [REVOLVERX i,CAN] $ revolverX (i+1)) [1..5]
|
++ map (\i -> po [REVOLVERX i,CAN] $ revolverX (i+1)) [1..5]
|
||||||
++ map (\i -> p [o (BANGCANEX i),p 2 PIPE] $ bangCaneX (i+1)) [1..5]
|
++ map (\i -> p [o (BANGCANEX i),p 2 PIPE] $ bangCaneX (i+1)) [1..5]
|
||||||
++ map (\i -> po [MINIGUNX i,BANGCANE] $ miniGunX (i+1)) [3..15]
|
++ map (\i -> po [MINIGUNX i,BANGCANE] $ miniGunX (i+1)) [3..15]
|
||||||
|
++ [ po [itype,mtype] $ it & itModules . modHitEffect .~ m
|
||||||
|
| (itype,it) <- firearmTypes , (mtype,m) <- bulletModules
|
||||||
|
]
|
||||||
where
|
where
|
||||||
p = (,)
|
p = (,)
|
||||||
po xs it = (map o xs,it)
|
po xs it = (map o xs,it)
|
||||||
o = (1,)
|
o = (1,)
|
||||||
|
|
||||||
|
firearmTypes :: [(CombineType,Item)]
|
||||||
|
firearmTypes
|
||||||
|
= [(BANGSTICK i,bangStick i) | i <- [1..9] ]
|
||||||
|
++ [(BANGCANEX i,bangCaneX i) | i <- [1..6] ]
|
||||||
|
bulletModules :: [(CombineType,ItemModule HitEffect)]
|
||||||
|
bulletModules =
|
||||||
|
[(INCENDIARYMODULE, ItemModule (destroyOnImpact bulIncCr bulIncWall) ["+INCENDIARY"] 1 )
|
||||||
|
,(BOUNCEMODULE, ItemModule (destroyOnImpact bulBounceArmCr' bulBounceWall) ["+BOUNCE"] 1 )
|
||||||
|
]
|
||||||
|
|||||||
@@ -93,5 +93,8 @@ data CombineType
|
|||||||
| BATTERY
|
| BATTERY
|
||||||
| FUELCELL
|
| FUELCELL
|
||||||
| PORTABLEFUSION
|
| PORTABLEFUSION
|
||||||
|
-- Modules
|
||||||
|
| INCENDIARYMODULE
|
||||||
|
| BOUNCEMODULE
|
||||||
| NoCombineType
|
| NoCombineType
|
||||||
deriving (Eq,Ord,Show)
|
deriving (Eq,Ord,Show)
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ startInventory = IM.fromList $ zip [0..] startInvList
|
|||||||
testInventory :: IM.IntMap Item
|
testInventory :: IM.IntMap Item
|
||||||
testInventory = IM.fromList $ zip [0..]
|
testInventory = IM.fromList $ zip [0..]
|
||||||
[ makeTypeCraftNum 9 PIPE
|
[ makeTypeCraftNum 9 PIPE
|
||||||
|
, incendiaryModule
|
||||||
|
, bounceModule
|
||||||
, makeTypeCraftNum 5 TUBE
|
, makeTypeCraftNum 5 TUBE
|
||||||
, makeTypeCraftNum 1 MAGNET
|
, makeTypeCraftNum 1 MAGNET
|
||||||
, makeTypeCraftNum 5 HARDWARE
|
, makeTypeCraftNum 5 HARDWARE
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
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.Particle.Bullet.HitEffect
|
||||||
|
--import Dodge.WorldEvent.HitEffect
|
||||||
|
import Color
|
||||||
--import Dodge.Picture.Layer
|
--import Dodge.Picture.Layer
|
||||||
--import Picture
|
--import Picture
|
||||||
--import Geometry
|
--import Geometry
|
||||||
|
import Control.Lens
|
||||||
|
|
||||||
makeTypeCraftNum :: Int -> CombineType -> Item
|
makeTypeCraftNum :: Int -> CombineType -> Item
|
||||||
makeTypeCraftNum i ct = defaultCraftable
|
makeTypeCraftNum i ct = defaultCraftable
|
||||||
@@ -16,6 +20,16 @@ makeTypeCraftNum i ct = defaultCraftable
|
|||||||
|
|
||||||
makeTypeCraft :: CombineType -> Item
|
makeTypeCraft :: CombineType -> Item
|
||||||
makeTypeCraft = makeTypeCraftNum 1
|
makeTypeCraft = makeTypeCraftNum 1
|
||||||
|
|
||||||
|
incendiaryModule :: Item
|
||||||
|
incendiaryModule = makeTypeCraft INCENDIARYMODULE
|
||||||
|
& itInvSize .~ 1
|
||||||
|
& itInvColor .~ chartreuse
|
||||||
|
bounceModule :: Item
|
||||||
|
bounceModule = makeTypeCraft BOUNCEMODULE
|
||||||
|
& itInvSize .~ 1
|
||||||
|
& itInvColor .~ chartreuse
|
||||||
|
|
||||||
pipe :: Item
|
pipe :: Item
|
||||||
pipe = makeTypeCraft PIPE
|
pipe = makeTypeCraft PIPE
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ module Dodge.Item.Weapon.BulletGun.Cane
|
|||||||
, fastBurstRifle
|
, fastBurstRifle
|
||||||
, miniGunX
|
, miniGunX
|
||||||
) where
|
) where
|
||||||
import Dodge.Particle.Bullet.HitEffect
|
--import Dodge.Particle.Bullet.HitEffect
|
||||||
import Dodge.WorldEvent.HitEffect
|
--import Dodge.WorldEvent.HitEffect
|
||||||
import Dodge.Item.Weapon.BulletGun.Clip
|
import Dodge.Item.Weapon.BulletGun.Clip
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
--import Dodge.ChainEffect
|
--import Dodge.ChainEffect
|
||||||
@@ -42,8 +42,6 @@ import Data.Maybe
|
|||||||
bangCane :: Item
|
bangCane :: Item
|
||||||
bangCane = defaultGun
|
bangCane = defaultGun
|
||||||
{ _itName = "BANGCANE"
|
{ _itName = "BANGCANE"
|
||||||
, _itModules = ItemModules
|
|
||||||
{ _modHitEffect = ItemModule (destroyOnImpact bulIncCr bulIncWall) ["+INCENDIARY"] 1}
|
|
||||||
, _itType = BANGCANE
|
, _itType = BANGCANE
|
||||||
,_itParams = BulletShooter
|
,_itParams = BulletShooter
|
||||||
{ _muzVel = 0.8
|
{ _muzVel = 0.8
|
||||||
@@ -147,6 +145,8 @@ rifle = bangCane
|
|||||||
, _dimSPic = \it -> noPic $ baseRifleShape
|
, _dimSPic = \it -> noPic $ baseRifleShape
|
||||||
<> makeSingleClipAt (V3 5 0 3) it
|
<> makeSingleClipAt (V3 5 0 3) it
|
||||||
}
|
}
|
||||||
|
, _itModules = ItemModules
|
||||||
|
{ _modHitEffect = DefaultModule }
|
||||||
}
|
}
|
||||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||||
& itName .~ "RIFLE"
|
& itName .~ "RIFLE"
|
||||||
|
|||||||
Reference in New Issue
Block a user