Develop laser upgrade path slightly

This commit is contained in:
2022-04-04 17:00:35 +01:00
parent 3698a738f3
commit 31d5bcd0bb
10 changed files with 108 additions and 22 deletions
+40 -2
View File
@@ -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
+19
View File
@@ -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))