Add unsafe blink gun

This commit is contained in:
2022-06-03 10:18:47 +01:00
parent 5ff2fb4910
commit 0c5eeb405f
10 changed files with 79 additions and 54 deletions
+1
View File
@@ -73,6 +73,7 @@ data CombineType
| BOOSTER
| REWINDER
| BLINKER
| BLINKERUNSAFE
| FORCEFIELDGUN
| SHRINKER
-- Equipment
+35 -29
View File
@@ -163,35 +163,41 @@ startInvList :: [Item]
startInvList = [ ]
startInventory :: IM.IntMap Item
startInventory = IM.fromList $ zip [0..] startInvList
inventoryA :: IM.IntMap Item
inventoryA = IM.fromList $ zip [0..]
[ clickDetector ITEMDETECTOR
, makeTypeCraftNum 1 TRANSFORMER
, makeTypeCraftNum 2 CAN
, makeTypeCraftNum 2 PIPE
]
inventoryB :: IM.IntMap Item
inventoryB = IM.fromList $ zip [0..]
[ forceFieldGun
, wristArmour
, wristArmour
, autoRifle
, smg
, machinePistol
, makeTypeCraftNum 4 MICROCHIP
, makeTypeCraftNum 2 TIN
, makeTypeCraftNum 2 HARDWARE
, makeTypeCraftNum 2 CAN
, makeTypeCraftNum 2 PIPE
, makeTypeCraftNum 1 CREATURESENSOR
]
inventoryC :: IM.IntMap Item
inventoryC = IM.fromList $ zip [0..]
[ autoDetector CREATUREDETECTOR
, autoDetector WALLDETECTOR
, autoDetector ITEMDETECTOR
, wristInvisibility
]
inventoryX :: Char -> [Item]
inventoryX c = case c of
'A' ->
[ clickDetector ITEMDETECTOR
, makeTypeCraftNum 1 TRANSFORMER
, makeTypeCraftNum 2 CAN
, makeTypeCraftNum 2 PIPE
]
'B' ->
[ forceFieldGun
, wristArmour
, wristArmour
, autoRifle
, smg
, machinePistol
, makeTypeCraftNum 4 MICROCHIP
, makeTypeCraftNum 2 TIN
, makeTypeCraftNum 2 HARDWARE
, makeTypeCraftNum 2 CAN
, makeTypeCraftNum 2 PIPE
, makeTypeCraftNum 1 CREATURESENSOR
]
'C' ->
[ autoDetector CREATUREDETECTOR
, autoDetector WALLDETECTOR
, autoDetector ITEMDETECTOR
, wristInvisibility
]
'D' ->
[ blinkGun
, unsafeBlinkGun
, autoDetector WALLDETECTOR
]
_ -> []
testInventory :: IM.IntMap Item
testInventory = IM.fromList $ zip [0..]
+29 -1
View File
@@ -9,6 +9,7 @@ module Dodge.Creature.Action
, dropExcept
-- , startReloadingWeapon
, blinkAction
, unsafeBlinkAction
, sizeSelf
-- , crAutoReload
, copyInvItemToFloor
@@ -35,8 +36,8 @@ import Dodge.FloorItem
import Geometry
import Picture
import qualified IntMapHelp as IM
import LensHelp
import Control.Lens
--import Control.Monad
--import Control.Applicative
import Data.Maybe
@@ -177,6 +178,33 @@ blinkAction cr w
r = 1.5 * _crRad cr
p3 = maybe p1 (mvPointTowardAtSpeed r cpos . fst) p2
{- | Teleport a creature to the mouse position.
Can go through walls, if ending up in wall does big damage. -}
unsafeBlinkAction
:: Creature
-> World
-> World
unsafeBlinkAction cr w
| success = soundMultiFrom [TeleSound 0,TeleSound 1] mwp teleS Nothing
. over distortions (distortionBulge ++)
. set (creatures . ix cid . crPos) mwp
. blinkShockwave cid mwp
$ inverseShockwaveAt cpos 40 2 2 w
| otherwise = blinkAction cr w & creatures . ix cid . crState . crDamage .:~
Damage ENTERREMENT 10000 mwp mwp mwp NoDamageEffect
where
success = fromMaybe True $ do
(_,wl) <- collidePointWallsWall mwp cpos $ wallsAlongLine mwp cpos w
return (isLHS mwp `uncurry` _wlLine wl)
distR = 120
distortionBulge =
[RadialDistortion mwp (mwp +.+ V2 distR 0) (mwp +.+ V2 0 distR) 0.1
,RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
]
cid = _crID cr
mwp = mouseWorldPos w
cpos = _crPos cr
blinkShockwave
:: Int -- ^ Blinking creature ID.
-> Point2
-4
View File
@@ -410,10 +410,6 @@ data TerminalLine
{_tlPause :: Int
,_tlString :: World -> (String, Color)
}
-- | TerminalLineChoice
-- {_tlPause :: Int
-- ,_tlOptions :: [(String,World -> World)]
-- }
| TerminalLineInput
{_tlPause :: Int
,_tlScrollCommands :: [TerminalCommand]
+1
View File
@@ -17,4 +17,5 @@ data DamageType
| TORQUEDAM
| PUSHDAM
| POISONDAM
| ENTERREMENT
deriving (Eq,Ord,Show,Read)
+5 -7
View File
@@ -14,6 +14,7 @@ import Data.List --(isPrefixOf, isInfixOf, intercalate)
import Data.Maybe
import LensHelp
import qualified Data.Text as T
import qualified IntMapHelp as IM
--import qualified Debug.Trace
--import Graphics.Rendering.OpenGL.GL.Shaders (validateProgram)
--import Dodge.Data (Universe(Universe))
@@ -22,18 +23,15 @@ applyTerminalString :: String -> Universe -> Universe
applyTerminalString "NOCLIP" = config . debug_noclip %~ not
applyTerminalString "LOADME" = (uvWorld . creatures . ix 0 . crInv .~ stackedInventory)
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
applyTerminalString "LA" = (uvWorld . creatures . ix 0 . crInv .~ inventoryA)
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
applyTerminalString "LB" = (uvWorld . creatures . ix 0 . crInv .~ inventoryB)
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
applyTerminalString "LC" = (uvWorld . creatures . ix 0 . crInv .~ inventoryC)
applyTerminalString "LM" = applyTerminalString "LOADME"
applyTerminalString "LT" = applyTerminalString "LOADTEST"
applyTerminalString ['L',x] =
(uvWorld . creatures . ix 0 . crInv .~ IM.fromList (zip [0..] $ inventoryX x))
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
applyTerminalString "GODON" = uvWorld . creatures . ix 0 . crApplyDamage .~ applyNoDamage
applyTerminalString "GODOFF" = uvWorld . creatures . ix 0 . crApplyDamage .~ defaultApplyDamage
applyTerminalString "LOADTEST" = (uvWorld . creatures . ix 0 . crInv .~ testInventory)
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
applyTerminalString "LM" = applyTerminalString "LOADME"
applyTerminalString "LT" = applyTerminalString "LOADTEST"
applyTerminalString ('s': 'e': 't': '_': 'h': 'p': ' ': hp)
| isNothing (readMaybe hp :: Maybe Int) = id
| otherwise = uvWorld . creatures . ix 0 . crHP .~ read hp
+6 -7
View File
@@ -104,18 +104,17 @@ blinkGun = defaultGun
, _reloadTime = 20
}
, _itUse = defaultlUse
& lUse .~ hammerCheckL (shootL aSelfL)
& lUse .~ hammerCheckL (shootL $ const blinkAction)
& useHammer .~ upHammer
& eqSite .~ GoesOnWrist
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
}
aSelf :: Creature -> World -> World
aSelf = blinkAction
aSelfL :: Item -> Creature -> World -> World
aSelfL _ = blinkAction
unsafeBlinkGun :: Item
unsafeBlinkGun = blinkGun
& itName .~ "BLINKER-UNSAFE"
& itType .~ BLINKERUNSAFE
& itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction)
effectGun :: String -> (Creature -> World -> World) -> Item
effectGun name eff = defaultGun
-6
View File
@@ -17,7 +17,6 @@ import Dodge.Room.Link
--import Dodge.Room.RoadBlock
import Dodge.Placement.Instance
--import Dodge.Default.Room
--import Dodge.Item.Weapon.BulletGuns
--import Dodge.Item.Weapon.Utility
--import Dodge.LevelGen.Data
--import Geometry.Data
@@ -57,11 +56,6 @@ addWarningTerminal outplid = (rmName .++~ "warningTerm-")
termMessages trid _ = defaultTermParams & addInputLine
[unlockCommand trid,quitCommand]
[helpCommand,infoCommand theinfo,commandsCommand]
--termMessages trid = ops trid (genTermMessage $ const ["OPEN DOOR?"])
--ops trid f gw w = f gw w & termFutureLines ++.~ [ TerminalLineInput 0
-- [unlockCommand trid,quitCommand,damageCodeCommand]
-- [helpCommand,infoCommand theinfo,commandsCommand]
-- ]
unlockCommand trid = singleCommand "OPEN" ["YES","Y"] "OPEN THE CONNECTED DOOR." (toggledoor trid)
toggledoor trid w' = w' & triggers . ix (fromJust $ _plMID trid) .~ const True
theinfo = "DOOR CONTROLABLE WITH THE \"OPEN\" COMMAND. THIS TERMINAL CANNOT CLOSE THE DOOR."
+1
View File
@@ -29,6 +29,7 @@ damageBlockWith dm = case _dmType dm of
TORQUEDAM -> id
PUSHDAM -> id
POISONDAM -> id
ENTERREMENT -> id
where
dam = _dmAmount dm
+1
View File
@@ -23,6 +23,7 @@ defaultWallDamage dm wl = wallDamageEffect dm wl . case _dmType dm of
TORQUEDAM -> id
PUSHDAM -> id
POISONDAM -> id
ENTERREMENT -> id
where
sp = _dmFrom dm
p = _dmAt dm