From 31d5bcd0bbb042d3e02db01cabd5e6b2294b5fa6 Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 4 Apr 2022 17:00:35 +0100 Subject: [PATCH] Develop laser upgrade path slightly --- src/Dodge/Combine/Combinations.hs | 18 ++++++++++++ src/Dodge/Combine/Data.hs | 2 ++ src/Dodge/Creature.hs | 18 +++++++----- src/Dodge/Creature/ChaseCrit.hs | 2 +- src/Dodge/Creature/Perception/Data.hs | 1 + src/Dodge/Creature/Picture.hs | 25 +++++++++------- src/Dodge/Data.hs | 1 + src/Dodge/Item/Weapon/BatteryGuns.hs | 42 +++++++++++++++++++++++++-- src/Dodge/Item/Weapon/TriggerType.hs | 19 ++++++++++++ src/Picture.hs | 2 +- 10 files changed, 108 insertions(+), 22 deletions(-) diff --git a/src/Dodge/Combine/Combinations.hs b/src/Dodge/Combine/Combinations.hs index 9d785a1e4..94caf93e3 100644 --- a/src/Dodge/Combine/Combinations.hs +++ b/src/Dodge/Combine/Combinations.hs @@ -67,6 +67,7 @@ itemCombinations = , po [FLAMETHROWER,PUMP] flameTorrent , p [o PRISM,o TRANSFORMER,o PIPE] lasGun + , p [o LASGUN,o TRANSFORMER,o PRISM] (lasGunWide 2) , p [o TRANSFORMER,p 2 CAN] sparkGun , p [o SPARKGUN,p 2 PIPE] teslaGun @@ -79,6 +80,8 @@ itemCombinations = , p [p 2 PLATE] flatShield ] + ++ map (\i -> po [LASGUNWIDE i,TRANSFORMER,PRISM] $ lasGunWide (i+1)) [1..9] + ++ map (\i -> po [LASGUNWIDE i,HARDWARE] $ lasGunFocus (i)) [1..10] ++ map (\i -> po [PIPE,BANGSTICK i] $ bangStick (i+1)) [1..8] ++ 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] @@ -147,6 +150,11 @@ moduleCombinations = (itConsumption . aoType . amPjCreation .~ fireTrackingShell) ] ) + , ( ModBattery + , batteryGuns + , [amod [BATTERY] "+BATTERY" (itConsumption . ammoBaseMax +~ 1000) + ] + ) ] where makeDirectedTele it = it @@ -167,6 +175,16 @@ moduleCombinations = homingLaunchers :: [Item] homingLaunchers = launcher : [launcherX i | i <- [2..10]] +batteryGuns :: [Item] +batteryGuns = + [ teslaGun + , sparkGun + , lasGun + ] ++ + [ lasGunWide i | i <- [1..10] + ] ++ + [ lasGunFocus i | i <- [1..10]] + bulletWeapons :: [Item] bulletWeapons = [bangStick i | i <- [1..9] ] ++ [bangCaneX i | i <- [1..6] ] diff --git a/src/Dodge/Combine/Data.hs b/src/Dodge/Combine/Data.hs index 26c9d9959..8f0be09f2 100644 --- a/src/Dodge/Combine/Data.hs +++ b/src/Dodge/Combine/Data.hs @@ -50,6 +50,8 @@ data CombineType | SPARKGUN | TESLAGUN | LASGUN + | LASGUNWIDE Int + | LASGUNFOCUS Int | SONICGUN | TRACTORGUN | LAUNCHER diff --git a/src/Dodge/Creature.hs b/src/Dodge/Creature.hs index 431b3ba7c..263d41f0c 100644 --- a/src/Dodge/Creature.hs +++ b/src/Dodge/Creature.hs @@ -179,20 +179,22 @@ testInventory = IM.fromList $ zip [0..] , medkit 50 & itConsumption . itAmount .~ 3 -- , teleportModule , makeTypeCraftNum 1 LIGHTER - , makeTypeCraftNum 15 TUBE +-- , makeTypeCraftNum 15 TUBE + , makeTypeCraftNum 9 TRANSFORMER -- , makeTypeCraftNum 5 CREATURESENSOR - , makeTypeCraftNum 3 PRISM + , makeTypeCraftNum 9 PRISM -- , makeTypeCraftNum 3 DRUM - , makeTypeCraftNum 3 PUMP +-- , makeTypeCraftNum 3 PUMP + , makeTypeCraftNum 3 BATTERY -- , makeTypeCraftNum 1 MAGNET - , makeTypeCraftNum 1 TRANSMITTER +-- , makeTypeCraftNum 1 TRANSMITTER , makeTypeCraftNum 10 HARDWARE , makeTypeCraftNum 3 SPRING - , makeTypeCraftNum 10 CAN - , makeTypeCraftNum 3 TIN +-- , makeTypeCraftNum 10 CAN +-- , makeTypeCraftNum 3 TIN , makeTypeCraftNum 3 PLANK - , makeTypeCraftNum 1 MOTOR - , makeTypeCraftNum 5 MICROCHIP +-- , makeTypeCraftNum 1 MOTOR +-- , makeTypeCraftNum 5 MICROCHIP -- , makeTypeCraftNum 5 AIUNIT ] stackedInventory :: IM.IntMap Item diff --git a/src/Dodge/Creature/ChaseCrit.hs b/src/Dodge/Creature/ChaseCrit.hs index eba240094..2e168db32 100644 --- a/src/Dodge/Creature/ChaseCrit.hs +++ b/src/Dodge/Creature/ChaseCrit.hs @@ -44,7 +44,7 @@ chaseCrit = defaultCreature , targetYouWhenCognizant , const (crMeleeCooldown %~ max 0 . subtract 1) ] - , _crHP = 150 + , _crHP = 1500 , _crPict = basicCrPict green , _crInv = IM.fromList [(0,medkit 200)] , _crMeleeCooldown = 0 diff --git a/src/Dodge/Creature/Perception/Data.hs b/src/Dodge/Creature/Perception/Data.hs index 6f4d2ac12..2dfdd55ce 100644 --- a/src/Dodge/Creature/Perception/Data.hs +++ b/src/Dodge/Creature/Perception/Data.hs @@ -54,6 +54,7 @@ data AttentionDir data AwarenessLevel = Suspicious Float | Cognizant Float + deriving (Eq,Ord) makeLenses ''AttentionDir makeLenses ''PerceptionState diff --git a/src/Dodge/Creature/Picture.hs b/src/Dodge/Creature/Picture.hs index 16b1be75c..89b762d2e 100644 --- a/src/Dodge/Creature/Picture.hs +++ b/src/Dodge/Creature/Picture.hs @@ -79,16 +79,20 @@ creatureDisplayText cfig w cr . setDepth 50 . translate x y . color white - . rotate a + . rotate (0.5 * pi) +-- . rotate (argV v - 0.5 * pi) . scale theScale theScale - . text - $ clockCycle 50 (V.fromList [crDisplayAwake, crDisplayAlert]) w cr + . centerText + $ clockCycle 25 (V.fromList + [ crDisplayAwake + , crDisplayAlert + ] + ) w cr where campos = _cameraViewFrom w theScale = 0.15 / _cameraZoom w cpos = _crPos cr v = cpos -.- campos - a = argV v - 0.5 * pi (V2 x y) = campos +.+ v +.+ _crRad cr *.* normalizeV v crDisplayAlert :: Creature -> String @@ -106,12 +110,13 @@ crDisplayAlert cr g _ = False crDisplayAwake :: Creature -> String -crDisplayAwake cr = case _crAwakeLevel (_crPerception cr) of - Comatose -> "-" - Asleep -> "Z" - Lethargic -> "L" - Vigilant -> "V" - Overstrung -> "O" +crDisplayAwake = show . _crAwakeLevel . _crPerception +--crDisplayAwake cr = case _crAwakeLevel (_crPerception cr) of +-- Comatose -> "-" +-- Asleep -> "Z" +-- Lethargic -> "L" +-- Vigilant -> "V" +-- Overstrung -> "O" --damageMod :: Creature -> Picture -> Picture --damageMod cr pic = piercingMod $ bluntScale pic diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index f59d5f32c..352dc52f0 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -439,6 +439,7 @@ data ModuleSlot | ModTarget | ModBulletTrajectory | ModLauncherHoming + | ModBattery deriving (Eq,Ord) data ItemModule diff --git a/src/Dodge/Item/Weapon/BatteryGuns.hs b/src/Dodge/Item/Weapon/BatteryGuns.hs index ad679c6ad..82101b415 100644 --- a/src/Dodge/Item/Weapon/BatteryGuns.hs +++ b/src/Dodge/Item/Weapon/BatteryGuns.hs @@ -1,5 +1,7 @@ module Dodge.Item.Weapon.BatteryGuns ( lasGun + , lasGunWide + , lasGunFocus , sparkGun , teslaGun , tractorGun @@ -34,14 +36,24 @@ import Data.List (sortOn) import System.Random --import Data.Tuple import qualified Data.IntMap.Strict as IM +import qualified Data.Map.Strict as M import Control.Monad.State + +defaultBatteryGun :: Item +defaultBatteryGun = defaultGun + & itModules .~ M.fromList [(ModBattery, DefaultModule)] + +defaultAutoBatteryGun :: Item +defaultAutoBatteryGun = defaultAutoGun + & itModules .~ M.fromList [(ModBattery, DefaultModule)] + sparkGun :: Item sparkGun = teslaGun & itName .~ "SPARKGUN" & itType .~ SPARKGUN & itParams . arcSize .~ 10 teslaGun :: Item -teslaGun = defaultGun +teslaGun = defaultBatteryGun { _itName = "TESLA" , _itType = TESLAGUN , _itConsumption = defaultAmmo @@ -81,8 +93,34 @@ teslaGunPic _ = noPic $ colorSH blue $ where xa = 1 xb = 9 +lasGunWide :: Int -> Item +lasGunWide n = lasGun + & itName .~ "PARALELLAS"++show n + & itType .~ LASGUNWIDE n + & itUse . useMods .~ + [ ammoCheckI + , withTempLight 1 100 (V3 1 1 0) + , withSoundForI tone440sawtoothquietS 2 + , duplicateOffsets xs + , useAmmoAmount 1 + ] + where + xs = [ 3 * (fromIntegral x - fromIntegral (n-1) /2) | x <- [0..n-1] ] +lasGunFocus :: Int -> Item +lasGunFocus n = lasGun + & itName .~ "FOCALAS"++show n + & itType .~ LASGUNFOCUS n + & itUse . useMods .~ + [ ammoCheckI + , withTempLight 1 100 (V3 1 1 0) + , withSoundForI tone440sawtoothquietS 2 + , duplicateOffsetsFocus xs + , useAmmoAmount 1 + ] + where + xs = [ 3 * (fromIntegral x - fromIntegral (n-1) /2) | x <- [0..n-1] ] lasGun :: Item -lasGun = defaultAutoGun +lasGun = defaultAutoBatteryGun { _itName = "LASGUN" , _itType = LASGUN , _itConsumption = defaultAmmo diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 8f2201d6c..8973a5c50 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -42,6 +42,8 @@ module Dodge.Item.Weapon.TriggerType , sideEffectOnFrame , duplicateLoadedBarrels , duplicateLoaded + , duplicateOffsets + , duplicateOffsetsFocus , hammerCheckI , hammerCheckL , shootL @@ -60,6 +62,7 @@ import Dodge.RandomHelp import Dodge.Inventory.Lock --import Dodge.Creature.HandPos --import Dodge.Default +import Dodge.Base import Sound.Data import Geometry --import Geometry.Vector3D @@ -530,3 +533,19 @@ duplicateLoadedBarrels eff item cr w = foldr f w poss f pos = eff item (cr & crPos %~ (+.+ pos)) numBar = _brlNum . _gunBarrels $ _itParams item numBul = _ammoLoaded $ _itConsumption item + +duplicateOffsetsFocus :: [Float] -> ChainEffect +duplicateOffsetsFocus xs eff item cr w = foldr f w poss + where + poss :: [V2 Float] + poss = map (rotateV (_crDir cr) . V2 0 ) xs + f pos = eff item $ cr + & crPos %~ (+.+ pos) + & crDir .~ argV (mouseWorldPos w -.- (_crPos cr +.+ pos)) + +duplicateOffsets :: [Float] -> ChainEffect +duplicateOffsets xs eff item cr w = foldr f w poss + where + poss :: [V2 Float] + poss = map (rotateV (_crDir cr) . V2 0 ) xs + f pos = eff item (cr & crPos %~ (+.+ pos)) diff --git a/src/Picture.hs b/src/Picture.hs index ed7e5864c..85ca77b93 100644 --- a/src/Picture.hs +++ b/src/Picture.hs @@ -222,7 +222,7 @@ circle rad = thickArc 0 (2*pi) rad 1 centerText :: String -> Picture {-# INLINE centerText #-} -centerText s = translate (25 * (negate . fromIntegral $ length s)) 0 $ text s +centerText s = translate (50 * (negate . fromIntegral $ length s - 1)) 0 $ text s text :: String -> Picture {-# INLINE text #-}