Start work on crafting/combinations

This commit is contained in:
2021-12-02 00:50:29 +00:00
parent ce06845278
commit 85ededc158
28 changed files with 189 additions and 112 deletions
+4 -4
View File
@@ -46,7 +46,7 @@ teslaGun = defaultGun
[ ammoCheckI
, withTempLight 1 100 (V3 0 0 1)
, withSoundForI elecCrackleS 1
, useAmmo 1
, useAmmoAmount 1
]
& useAim . aimSpeed .~ 0.4
& useAim . aimStance .~ TwoHandFlat
@@ -73,7 +73,7 @@ lasGun = defaultAutoGun
[ ammoCheckI
, withTempLight 1 100 (V3 1 1 0)
, withSoundForI tone440sawtoothquietS 2
, useAmmo 1
, useAmmoAmount 1
]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 1
@@ -286,7 +286,7 @@ tractorPullPos q p1 p = p -.- m *.* (0.3/ x' *.* q +.+ g y *.* p4)
| x > -5 = -0.02
| otherwise = (x - 10) / 250
--p4 = vNormal p5
p4 = vNormal $ safeNormalizeV q
p4 = vNormal $ squashNormalizeV q
p3 = p1 +.+ p4
tractorSPic :: Prop -> SPic
@@ -301,6 +301,6 @@ tractorSPic pj = (,) mempty $ setLayer 1 $ setDepth 20 $ color (withAlpha 0.5 co
size = fromIntegral (_pjTime pj)
spos = _pjPos pj
xpos = _pjStartPos pj
d = safeNormalizeV $ spos -.- xpos
d = squashNormalizeV $ spos -.- xpos
n = vNormal d
col = mixColors 0.5 0.5 white blue
+1 -1
View File
@@ -28,7 +28,7 @@ bezierGun = defaultGun
[ ammoCheckI
, useTimeCheck
, withSoundStart tap2S
, useAmmo 1
, useAmmoAmount 1
, withMuzFlareI
. withRecoilI 40
. torqueBefore 0.05
+1 -1
View File
@@ -27,7 +27,7 @@ boostPoint x cr w = case mayp2 of
where
cpos = _crPos cr
r = 1.5 * _crRad cr
p1 = cpos +.+ x *.* safeNormalizeV (mouseWorldPos w -.- cpos)
p1 = cpos +.+ x *.* squashNormalizeV (mouseWorldPos w -.- cpos)
mayp2 = reflectPointWalls cpos p1 $ wallsAlongLine cpos p1 w
boostSelfL
+11 -10
View File
@@ -55,7 +55,7 @@ autoGun = defaultAutoGun
]
, withSoundForI autoBS 5
--, withSoundForI seagullChatterS 5
, useAmmo 1
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withSmoke 1 black 20 200 5
@@ -103,7 +103,7 @@ pistol = defaultGun
, hammerCheckI
, useTimeCheck
, withSoundStart tap3S
, useAmmo 1
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
]
@@ -189,7 +189,7 @@ ltAutoGun = defaultAutoGun
[ ammoCheckI
, useTimeCheck
, withSoundStart tap1S
, useAmmo 1
, useAmmoAmount 1
, applyInaccuracy
, torqueAfterI 0.2
, withSidePushI 50
@@ -252,7 +252,7 @@ miniGun = defaultAutoGun
, afterRecoil recoilAmount
, withRandomOffsetI 9
, withOldDir od3
, useAmmo 4
, useAmmoAmount 4
, withMuzFlareI
, withSmoke 1 black 20 200 5
]
@@ -328,7 +328,7 @@ spreadGun = defaultGun
, hammerCheckI
, useTimeCheck
, withSoundStart shotgunS
, useAmmo 1
, useAmmoAmount 1
, withRecoilI 100
, withMuzFlareI
, spreadNumI
@@ -358,19 +358,20 @@ multGun = defaultGun
, _itIdentity = MultGun
, _itConsumption = defaultAmmo
{ _aoType = basicBullet
, _ammoMax = 2
, _ammoMax = 5
, _ammoLoaded = 2
, _reloadTime = 40
, _reloadTime = 10
, _reloadType = ActivePartial 1
}
, _itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart shotgunS
, useAmmo 1
, useAllAmmo
, withRecoilI 200
, withMuzFlareI
, numI
, duplicateEachLoadedBarrel
]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 1
@@ -418,7 +419,7 @@ longGun = defaultGun
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAmmo 1
, useAmmoAmount 1
, withThickSmokeI
, torqueAfterI 0.05
, withMuzFlareI
+1 -1
View File
@@ -32,7 +32,7 @@ lasDrones = defaultGun
[ ammoCheckI
, useTimeCheck
, withSoundStart tap4S
, useAmmo 1
, useAmmoAmount 1
]
& useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 0.5
+1 -1
View File
@@ -52,7 +52,7 @@ launcher = defaultGun
[ ammoCheckI
, useTimeCheck
, withSoundStart tap4S
, useAmmo 1
, useAmmoAmount 1
]
& useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 0.5
+2 -2
View File
@@ -42,7 +42,7 @@ poisonSprayer = defaultAutoGun
, _itUse = ruseInstant (const aGasCloud) NoHammer
[ ammoCheckI
, withSoundForI foamSprayLoopS 5
, useAmmo 1
, useAmmoAmount 1
-- , spreadNumI
]
& useAim . aimSpeed .~ 0.2
@@ -65,7 +65,7 @@ flamer = defaultAutoGun
}
, _itUse = ruseInstant (\_ -> randWalkAngle aFlame) NoHammer
[ ammoCheckI
, useAmmo 1
, useAmmoAmount 1
, withSidePushI 5
--, withTempLight 1 100 (V3 1 0 0)
, withSidePushAfterI 20
+21 -8
View File
@@ -1,7 +1,8 @@
{- |
Weapon effects when pulling the trigger. -}
module Dodge.Item.Weapon.TriggerType
( useAmmo
( useAmmoAmount
, useAllAmmo
, withMuzFlareI
, withOldDir
, trigDoAlso
@@ -25,7 +26,8 @@ module Dodge.Item.Weapon.TriggerType
, withSidePushI
, withWarmUp
, spreadNumI
, numI
, numBarrels
, duplicateEachLoadedBarrel
, randWalkAngle -- ^ should be made into a modifier, perhaps
, hammerCheckI
, hammerCheckL
@@ -217,10 +219,11 @@ withSidePushAfterI maxSide eff item cr w = over (creatures . ix cid) push . eff
cid = _crID cr
push = over crPos (+.+ rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr)))
(pushAmount, g) = randomR (-maxSide,maxSide) $ _randGen w
useAmmo
:: Int -- ^ amount of ammo to use
-> ChainEffect
useAmmo amAmount eff item cr = eff item cr
useAllAmmo :: ChainEffect
useAllAmmo eff item cr = eff item cr
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded .~ 0)
useAmmoAmount :: Int -> ChainEffect
useAmmoAmount amAmount eff item cr = eff item cr
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded -~ amAmount)
{- |
Applies a world effect after an item use cooldown check. -}
@@ -393,8 +396,18 @@ spreadNumI eff item cr w = foldr f w dirs
f dir = eff item (cr & crDir +~ dir)
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
numBul = _brlNum . _gunBarrels $ _itParams item
numI :: ChainEffect
numI eff item cr w = foldr f w poss
duplicateEachLoadedBarrel :: ChainEffect
duplicateEachLoadedBarrel eff item cr w = foldr f w poss
where
cp :: Float
cp = -0.5 * (fromIntegral numBar - 1)
poss :: [V2 Float]
poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
f pos = eff item (cr & crPos %~ (+.+ pos))
numBar = _brlNum . _gunBarrels $ _itParams item
numBul = _ammoLoaded $ _itConsumption item
numBarrels :: ChainEffect
numBarrels eff item cr w = foldr f w poss
where
cp :: Float
cp = -0.5 * fromIntegral numBul