diff --git a/src/Dodge/Combine/Combinations.hs b/src/Dodge/Combine/Combinations.hs index 121d44cc9..a9bd0e191 100644 --- a/src/Dodge/Combine/Combinations.hs +++ b/src/Dodge/Combine/Combinations.hs @@ -59,9 +59,9 @@ itemCombinations = , p [p 2 TUBE,o LAUNCHER] (launcherX 2) ] ++ [ p [p 2 TUBE,o $ LAUNCHERX i] (launcherX (i+1)) | i <- [2..9]] ++ - [ po [LIGHTER,PUMP,CAN] flameStick - , po [FLAMESTICK,CAN,PUMP] blowTorch - , po [FLAMESTICK,DRUM] flameThrower + [ po [LIGHTER,PUMP,CAN] flameSpitter + , po [FLAMESPITTER,CAN,PUMP] blowTorch + , po [FLAMESPITTER,DRUM] flameThrower , po [FLAMETHROWER,DRUM] flameWall , po [FLAMETHROWER,PUMP] flameTorrent diff --git a/src/Dodge/Combine/Data.hs b/src/Dodge/Combine/Data.hs index f208141fb..72889b427 100644 --- a/src/Dodge/Combine/Data.hs +++ b/src/Dodge/Combine/Data.hs @@ -38,7 +38,7 @@ data CombineType | AUTOAMR | SNIPERRIFLE | MACHINEGUN - | FLAMESTICK + | FLAMESPITTER | FLAMETHROWER | FLAMETORRENT | FLAMEWALL diff --git a/src/Dodge/Creature.hs b/src/Dodge/Creature.hs index df3844c18..46d978612 100644 --- a/src/Dodge/Creature.hs +++ b/src/Dodge/Creature.hs @@ -169,18 +169,18 @@ testInventory = IM.fromList $ zip [0..] [ makeTypeCraftNum 9 PIPE , incendiaryModule , bounceModule - , medkit 50 - , teleportModule +-- , medkit 50 +-- , teleportModule , makeTypeCraftNum 1 LIGHTER - , makeTypeCraftNum 5 TUBE + , makeTypeCraftNum 15 TUBE -- , makeTypeCraftNum 5 CREATURESENSOR , makeTypeCraftNum 3 PRISM -- , makeTypeCraftNum 3 DRUM --- , makeTypeCraftNum 3 PUMP + , makeTypeCraftNum 3 PUMP -- , makeTypeCraftNum 1 MAGNET , makeTypeCraftNum 1 TRANSMITTER - , makeTypeCraftNum 5 HARDWARE - , makeTypeCraftNum 3 SPRING + , makeTypeCraftNum 1 HARDWARE +-- , makeTypeCraftNum 3 SPRING , makeTypeCraftNum 10 CAN , makeTypeCraftNum 3 TIN , makeTypeCraftNum 3 PLANK @@ -191,7 +191,7 @@ testInventory = IM.fromList $ zip [0..] stackedInventory :: IM.IntMap Item stackedInventory = IM.fromList $ zip [0..] [sonicGun - ,spreadGun + ,burstRifle , pipe ,rewindGun ,tractorGun diff --git a/src/Dodge/Item/Weapon/SprayGuns.hs b/src/Dodge/Item/Weapon/SprayGuns.hs index d7766bda0..74b01401f 100644 --- a/src/Dodge/Item/Weapon/SprayGuns.hs +++ b/src/Dodge/Item/Weapon/SprayGuns.hs @@ -1,6 +1,6 @@ module Dodge.Item.Weapon.SprayGuns ( poisonSprayer - , flameStick + , flameSpitter , blowTorch , flameThrower , flameTorrent @@ -33,6 +33,7 @@ import LensHelp import Data.Traversable import qualified Data.IntMap.Strict as IM +import Control.Monad.State --import Data.Function import System.Random poisonSprayer :: Item @@ -64,14 +65,29 @@ flamerPic it = tz = 3 r = 5 am = fractionLoadedAmmo2 it -flameStick :: Item -flameStick = flameThrower - & itName .~ "FLAMESTICK" - & itType .~ FLAMESTICK +flameSpitter :: Item +flameSpitter = flameThrower + & itName .~ "FLAMESPITTER" + & itType .~ FLAMESPITTER & itConsumption . ammoBaseMax .~ 10 & itConsumption . reloadTime .~ 20 & itParams . sprayNozzles . ix 0 . nzPressure .~ 4 & itUse . useAim . aimStance .~ OneHand + & itUse . useDelay .~ FixedRate {_rateMax =12,_rateTime = 0} + & itUse . useMods .~ + [ ammoCheckI + , useTimeCheck + , lockInvFor 10 + , repeatOnFrames [1..9] + , withRandomItemParams f + , useAmmoAmount 1 + , withSidePushI 5 + , withSidePushAfterI 20 + ] + where + f = do + nzpres <- state $ randomR (3,4) + return $ sprayNozzles . ix 0 . nzPressure .~ nzpres flameTorrent :: Item flameTorrent = flameThrower diff --git a/src/Dodge/LevelGen/Data.hs b/src/Dodge/LevelGen/Data.hs index d5eac79f4..c1ac634c3 100644 --- a/src/Dodge/LevelGen/Data.hs +++ b/src/Dodge/LevelGen/Data.hs @@ -249,6 +249,11 @@ ps0jPushPS :: PSType -> Placement -> Placement ps0jPushPS pst plmnt = Placement (PSNoShiftCont (V2 0 0) 0) pst Nothing $ \p -> Just $ plmnt & plSpot .~ _plSpot p +-- the NoShiftCont is necessary when shifting then combining rooms +ps0PushPS :: PSType -> (Placement -> Maybe Placement) -> Placement +ps0PushPS pst f = Placement (PSNoShiftCont (V2 0 0) 0) pst Nothing + $ \pl -> f pl & _Just . plSpot %~ const (_plSpot pl) + addPlmnt :: Placement -> Placement -> Placement addPlmnt pl pl2 = case pl2 of (PlacementUsingPos p f) -> PlacementUsingPos p (fmap (addPlmnt pl) f) diff --git a/src/Dodge/LockAndKey.hs b/src/Dodge/LockAndKey.hs index b8fc7937e..2bbc9cace 100644 --- a/src/Dodge/LockAndKey.hs +++ b/src/Dodge/LockAndKey.hs @@ -14,14 +14,14 @@ import Control.Monad.State lockRoomKeyItems :: RandomGen g => [ (Int -> State g (SubCompTree Room) , State g CombineType ) ] lockRoomKeyItems = - --[(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] ) - --,(sensorRoomRunPast Electrical, return SPARKGUN ) - [(sensorRoomRunPast Flaming, return FLAMESTICK ) --- ,(sensorRoomRunPast Lasering, return LASGUN ) --- ,(const slowDoorRoomRunPast, return MINIGUN) --- ,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD]) --- ,(const glassLessonRunPast, takeOne [LASGUN]) --- ,(const $ lasTunnelRunPast 400, return FLATSHIELD) + [(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] ) + ,(sensorRoomRunPast Electrical, return SPARKGUN ) + ,(sensorRoomRunPast Flaming, return FLAMESPITTER ) + ,(sensorRoomRunPast Lasering, return LASGUN ) + ,(const slowDoorRoomRunPast, return MINIGUN) + ,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD]) + ,(const glassLessonRunPast, takeOne [LASGUN]) + ,(const $ lasTunnelRunPast 400, return FLATSHIELD) ] itemRooms :: RandomGen g => [(CombineType, State g (SubCompTree Room))] @@ -40,7 +40,7 @@ itemRooms = [rc $ map makeTypeCraft [TRANSFORMER,CAN,CAN] ] ) - , (FLAMESTICK , join $ takeOne + , (FLAMESPITTER , join $ takeOne [rc $ map makeTypeCraft [LIGHTER,PUMP,CAN] ] ) diff --git a/src/Dodge/Placement/Instance/Terminal.hs b/src/Dodge/Placement/Instance/Terminal.hs index 10d46d348..4b8a92a95 100644 --- a/src/Dodge/Placement/Instance/Terminal.hs +++ b/src/Dodge/Placement/Instance/Terminal.hs @@ -1,8 +1,12 @@ {-# LANGUAGE TupleSections #-} -module Dodge.Placement.Instance.Terminal where +module Dodge.Placement.Instance.Terminal + ( putTerminal + ) where import Dodge.Data import Dodge.LevelGen.Data import Dodge.Default +import Dodge.Machine +import Dodge.WorldEvent.Explosion import Color import Geometry import ShapePicture @@ -12,10 +16,12 @@ import Shape import Data.Maybe putTerminal :: (GenParams -> TerminalParams) -> Placement -putTerminal f = PlacementGenUpdate g $ ps0jPushPS (PutButton $ thebutton) - $ pt0 (PutMachine (dark magenta) (reverse $ square 10) defaultMachine +putTerminal f = PlacementGenUpdate g $ ps0PushPS (PutButton $ thebutton) + $ \pl -> Just $ pt0 (PutMachine terminalColor (reverse $ square 10) defaultMachine { _mcDraw = drawTerminal , _mcHP = 100 + , _mcUpdate = machineUpdateDeathEff $ \mc -> (buttons . at (fromJust (_plMID pl)) .~ Nothing) + . makeExplosionAt (_mcPos mc) }) $ const Nothing where @@ -31,8 +37,11 @@ putTerminal f = PlacementGenUpdate g $ ps0jPushPS (PutButton $ thebutton) , _btTerminalParams = TerminalParams [] [] 10 } +terminalColor :: Color +terminalColor = dark magenta + drawTerminal :: Machine -> SPic -drawTerminal _ = noPic $ colorSH (dark green) $ upperPrismPoly 15 $ square 10 +drawTerminal _ = noPic $ colorSH terminalColor $ upperPrismPoly 15 $ square 10 displayTerminalMessage :: Int -> World -> World displayTerminalMessage btid w = w & hud . hudElement .~ DisplayInventory DisplayTerminal diff --git a/src/Dodge/WorldEvent/Explosion.hs b/src/Dodge/WorldEvent/Explosion.hs index 032c1ed8c..9a13bfd76 100644 --- a/src/Dodge/WorldEvent/Explosion.hs +++ b/src/Dodge/WorldEvent/Explosion.hs @@ -20,13 +20,12 @@ import Dodge.WorldEvent.Shockwave import Geometry --import Geometry.Vector3D import Picture +import LensHelp import Control.Monad.State import Data.List --import Data.Maybe import System.Random ---import qualified Data.IntMap.Strict as IM -import Control.Lens makePoisonExplosionAt :: Point2 -- ^ Position @@ -71,24 +70,28 @@ makeFlameExplosionAt p w -- particle passes through for the first frame of its existence makeExplosionAt :: Point2 -> World -> World -makeExplosionAt p w - = soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing - . addFlames - -- . explosionFlashAt p - . over tempLightSources (theTLS :) - $ makeShockwaveAt [] p 50 50 1 white w +makeExplosionAt p w = w + & soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing + & addFlames + & tempLightSources .:~ theTLS + & makeShockwaveAt [] p 50 50 1 white where theTLS = tlsTimeRadColPos 20 150 (V3 1 0.5 0) (addZ 20 p) - fVs = replicateM 15 (randInCirc 1) & evalState $ _randGen w - fPs'' = replicateM 15 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w + fVs = replicateM 100 (randInCirc 1) & evalState $ _randGen w + --fPs'' = replicateM 100 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w + fPs'' = replicateM 100 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w (fPs',zs) = let (a,b,c) = unzip3 $ map fromV3 fPs'' in (zipWith V2 a b, c) - fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs' + --fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs' + fPs = map (pushAgainstWalls . (+.+) p) fPs' inversePushOut v = (15 - magV v) * 0.01 *.* v fVs' = zipWith (+.+) fVs $ map inversePushOut fPs' sizes = randomRs (2,9) $ _randGen w - times = randomRs (20,25) $ _randGen w + --times = randomRs (20,25) $ _randGen w + times = randomRs (15,20) $ _randGen w mF q z v size time = makeFlamelet q z v Nothing size time newFs = zipWith5 mF fPs zs (fmap (3 *.*) fVs') sizes times addFlames w' = foldr ($) w' newFs - pushAgainstWalls q = maybe q (uncurry (+.+)) $ reflectPointWalls p q $ wallsNearPoint q w + --pushAgainstWalls q = maybe q (uncurry (+.+)) $ reflectPointWalls p q wls + pushAgainstWalls q = maybe q fst $ reflectPointWalls p q wls + wls = wallsNearPoint p w diff --git a/src/Dodge/WorldEvent/Flash.hs b/src/Dodge/WorldEvent/Flash.hs index e1687681b..da01aca5e 100644 --- a/src/Dodge/WorldEvent/Flash.hs +++ b/src/Dodge/WorldEvent/Flash.hs @@ -63,8 +63,6 @@ explosionFlashAt p = tempLightSources .:~ tlsTimeRadFunPos 20 150 intensityFunc flameFlicker :: Particle -> World -> World flameFlicker pt - | _ptTimer pt `mod` 5 == 0 = tempLightSources - .:~ tlsTimeRadColPos 1 70 (V3 0.5 0 0) (V3 x y 10) + | _ptTimer pt `mod` 7 == 0 = tempLightSources + .:~ tlsTimeRadColPos 1 70 (V3 0.5 0 0) (addZ 10 $ _ptPos pt) | otherwise = id - where - V2 x y = _ptPos pt diff --git a/src/Dodge/WorldEvent/SpawnParticle.hs b/src/Dodge/WorldEvent/SpawnParticle.hs index 71095a886..9c46a4a2f 100644 --- a/src/Dodge/WorldEvent/SpawnParticle.hs +++ b/src/Dodge/WorldEvent/SpawnParticle.hs @@ -80,7 +80,7 @@ moveFlame rotd w pt | time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing) | otherwise = case thingsHitExceptCr (_ptCrIgnore pt) sp ep w of ((_,Left _):_) -> (doSound $ damwls damcrs , mvPt 0.7) - (th@(p,Right wl):_) -> (doSound . fst $ hiteff [th] damcrs , rfl wl p) + ((p,Right wl):_) -> (doSound $ damwls damcrs , rfl wl p) _ -> (flameFlicker pt . damwls $ doSound damcrs , mvPt 0.98) where time = _ptTimer pt