Cleanup, remove bullet tweaks

This commit is contained in:
2022-03-22 22:41:48 +00:00
parent f030d8264f
commit 7f174b7d18
13 changed files with 57 additions and 160 deletions
+2 -1
View File
@@ -115,9 +115,10 @@ moduleCombinations =
)
, ( ModBullet
, bulletWeapons
, [amod [INCENDIARYMODULE] "+INCENDIARY" (f $ destroyOnImpact bulIncCr bulIncWall)
, [amod [INCENDIARYMODULE] "+INCENDIARY" (f $ bulletDestroySpawn incBall)
,amod [BOUNCEMODULE] "+BOUNCE" (f $ destroyOnImpact bulBounceArmCr bulBounceWall)
,amod [STATICMODULE] "+STATIC" (f $ bulletDestroySpawn aStaticBall)
,amod [CONCUSSMODULE] "+CONCUSS" (f $ bulletDestroySpawn concBall)
]
)
, ( ModTarget
+1
View File
@@ -111,6 +111,7 @@ data CombineType
-- bullet
| INCENDIARYMODULE
| STATICMODULE
| CONCUSSMODULE
| FRAGMODULE
| FLASHMODULE
| BOUNCEMODULE
+1 -1
View File
@@ -103,7 +103,7 @@ multGunCrit :: Creature
multGunCrit = defaultCreature
{ _crPict = basicCrPict red
-- , _crUpdate = stateUpdate (twitchMissAI 300 350)
, _crInv = IM.fromList [(0,multGun),(1,medkit 100)]
, _crInv = IM.fromList [(0,bangCaneX 4),(1,medkit 100)]
, _crInvSel = 0
, _crRad = 10
, _crHP = 300
-37
View File
@@ -1,15 +1,10 @@
module Dodge.Item.Weapon.Bullet
( basicBullet
, incBullet
, staticBullet
, conBullet
, bounceBullet
, ltBullet
, hvBullet
) where
import Dodge.Data
import Dodge.WorldEvent.HitEffect
import Dodge.WorldEvent.SpawnParticle
import Dodge.Particle.Bullet.HitEffect
import Geometry.Data
@@ -21,38 +16,6 @@ basicBullet = BulletAmmo
, _amBulVel = V2 50 0
, _amBulTraj = BasicBulletTrajectory
}
incBullet :: AmmoType
incBullet = BulletAmmo
{ _amString = "INCENDIARY"
, _amBulEff = destroyOnImpact bulIncCr bulIncWall
, _amBulWth = 2
, _amBulVel = V2 50 0
, _amBulTraj = BasicBulletTrajectory
}
staticBullet :: AmmoType
staticBullet = BulletAmmo
{ _amString = "STATIC"
, _amBulEff = bulletDestroySpawn aStaticBall
, _amBulWth = 2
, _amBulVel = V2 50 0
, _amBulTraj = BasicBulletTrajectory
}
conBullet :: AmmoType
conBullet = BulletAmmo
{ _amString = "CONCUSSIVE"
, _amBulEff = destroyOnImpact bulConCr bulConWall
, _amBulWth = 2
, _amBulVel = V2 50 0
, _amBulTraj = BasicBulletTrajectory
}
bounceBullet :: AmmoType
bounceBullet = BulletAmmo
{ _amString = "BOUNCING"
, _amBulEff = destroyOnImpact bulHitCr bulBounceWall
, _amBulWth = 2
, _amBulVel = V2 50 0
, _amBulTraj = BasicBulletTrajectory
}
ltBullet :: AmmoType
ltBullet = BulletAmmo
{ _amString = "LTBULLET"
-3
View File
@@ -14,7 +14,6 @@ module Dodge.Item.Weapon.BulletGun.Cane
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data
--import Dodge.ChainEffect
import Dodge.TweakBullet
import Dodge.Default.Weapon
import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Default
@@ -72,7 +71,6 @@ bangCane = defaultGun
, withSmoke 1 black 20 200 5
, withMuzFlareI
]
, _itTweaks = defaultBulletSelTweak
, _itDimension = ItemDimension
{ _dimRad = 8
, _dimCenter = V3 5 0 0
@@ -292,7 +290,6 @@ miniGunX i = defaultAutoGun
, _randomOffset = 10
}
, _itEquipPict = pictureWeaponAim (miniGunXPictItem i)
, _itTweaks = defaultBulletSelTweak
, _itInvSize = 4
, _itInvDisplay = \it -> head (basicItemDisplay it) :
["*" ++ replicate 13 ' ' ++ "*"
-3
View File
@@ -10,7 +10,6 @@ module Dodge.Item.Weapon.BulletGun.Stick
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data
import Dodge.ChainEffect
import Dodge.TweakBullet
import Dodge.Default.Weapon
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Default
@@ -78,7 +77,6 @@ bangStick i = defaultGun
, _torqueAfter = 0.18 + 0.02 * fromIntegral i
, _randomOffset = 0
}
, _itTweaks = defaultBulletSelTweak
, _itInvSize = fromIntegral i / 3
, _itDimension = ItemDimension
{ _dimRad = 5
@@ -187,7 +185,6 @@ pistol = (bangStick 1)
-- , _itEquipPict = pictureWeaponAim pistolPic
, _itID = Nothing
, _itInvColor = white
, _itTweaks = defaultBulletSelTweak
} & itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
& itParams %~
( ( muzVel .~ 0.8 )
-43
View File
@@ -9,7 +9,6 @@ module Dodge.Item.Weapon.BulletGuns
, hvAutoGun
, autogunSpread
, autoGun
, multGun
, autoGunPic
, longGun
, module Dodge.Item.Weapon.BulletGun.Stick
@@ -23,7 +22,6 @@ import Dodge.Item.Weapon.ZoomScope
--import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data
--import Dodge.ChainEffect
import Dodge.TweakBullet
import Dodge.Default.Weapon
import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Default
@@ -92,7 +90,6 @@ autoGun = defaultAutoGun
, _torqueAfter = 0
, _randomOffset = 0
}
, _itTweaks = defaultBulletSelTweak
}
autoGunPic :: Item -> SPic
autoGunPic it = noPic $
@@ -148,7 +145,6 @@ bangCone = defaultGun
, _dimSPic = const $ noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 5 2)
<> upperPrismPoly 6 (rectNSEW 4 (-4) 15 5)
}
, _itTweaks = defaultBulletSelTweak
}
coneRandItemUpdate :: State StdGen (Item -> Item)
coneRandItemUpdate = do
@@ -273,45 +269,6 @@ ltAutoGun = defaultAutoGun
, _bore = 2
, _gunBarrels = SingleBarrel autogunSpread
}
, _itTweaks = defaultBulletSelTweak
}
multGun :: Item
multGun = defaultGun
{ _itName = "MULTGUN"
, _itType = MULTGUN
, _itConsumption = defaultAmmo
{ _aoType = basicBullet
, _ammoBaseMax = 5
, _ammoLoaded = 2
, _reloadTime = 10
, _reloadType = ActivePartial 1
}
, _itUse = ruseAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart shotgunS
, useAllAmmo
, withRecoil
, withMuzFlareI
, duplicateLoadedBarrels
]
& useAim . aimSpeed .~ 0.4
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
-- , _itFloorPict = multGunSPic
, _itParams = defBulletShooter
{ _muzVel = 1
, _rifling = 0.9
, _bore = 3
, _gunBarrels = MultiBarrel
{_brlNum = 5
,_brlSpread = AlignedBarrels
,_brlInaccuracy = 0
}
}
, _itTweaks = defaultBulletSelTweak
}
longGun :: Item
longGun = defaultGun
+2 -2
View File
@@ -21,9 +21,9 @@ bossKeyItems =
lockRoomKeyItems :: RandomGen g => [ (Int -> State g (SubCompTree Room) , State g CombineType ) ]
lockRoomKeyItems =
-- [(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] )
-- ,(sensorRoomRunPast Electrical, return SPARKGUN )
[(sensorRoomRunPast Electrical, return STATICMODULE )
-- [(sensorRoomRunPast Electrical, takeOne [STATICMODULE,SPARKGUN] )
--,(sensorRoomRunPast Flaming, takeOne [FLAMESPITTER, INCENDIARYMODULE] )
[(sensorRoomRunPast Flaming, takeOne [INCENDIARYMODULE] )
-- ,(sensorRoomRunPast Lasering, return LASGUN )
-- ,(const slowDoorRoomRunPast, return MINIGUN)
-- ,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD])
+12 -30
View File
@@ -110,7 +110,7 @@ damageGamut pdam bdam tor sp p ep =
,Damage PushDam 1 sp p ep . PushBackDamage $ 3 *.* (ep -.- sp)
]
bulletDestroySpawn :: (Point2 -> Particle)
bulletDestroySpawn :: (Point2 -> State StdGen Particle)
-> Particle
-> [(Point2, Either Creature Wall)]
-> World
@@ -118,55 +118,37 @@ bulletDestroySpawn :: (Point2 -> Particle)
bulletDestroySpawn f = destroyOnImpact (bulDestroyCr f) (bulDestroyWall f)
{- | Create a flamelet when hitting a creature. -}
bulDestroyCr :: (Point2 -> Particle) -> Particle -> Point2 -> Creature -> World -> World
bulDestroyCr :: (Point2 -> State StdGen Particle)
-> Particle -> Point2 -> Creature -> World -> World
bulDestroyCr f bt p cr w = w
& instantParticles .:~ (f v & ptPos .~ p)
& instantParticles .:~ (pt & ptPos .~ p)
& bulletHitSound p
& creatures . ix cid . crState . crDamage .:~ Damage Piercing 60 sp p ep NoDamageEffect
& randGen .~ g
where
(pt,g) = randInCirc 1 >>= f & runState $ _randGen w
cid = _crID cr
sp = head $ _ptTrail bt
ep = sp +.+ _ptVel bt
v = evalState (randInCirc 1) $ _randGen w
{- | Create flamelet on wall. -}
bulDestroyWall
:: (Point2 -> Particle)
bulDestroyWall :: (Point2 -> State StdGen Particle)
-> Particle
-> Point2 -- Impact point
-> Wall
-> World
-> World
bulDestroyWall f bt p wl = damageWall (Damage Blunt 50 sp p ep NoDamageEffect) wl
. (instantParticles .:~ (f reflectVel & ptPos .~ pOut))
bulDestroyWall f bt p wl w = w
& damageWall (Damage Piercing 60 sp p ep NoDamageEffect) wl
& (instantParticles .:~ (pt & ptPos .~ pOut))
& randGen .~ g
where
(pt,g) = runState (f reflectVel) (_randGen w)
ep = sp +.+ _ptVel bt
sp = head $ _ptTrail bt
pOut = p +.+ squashNormalizeV (sp -.- p)
wallV = uncurry (-.-) (_wlLine wl)
reflectVel = squashNormalizeV $ reflectIn wallV (_ptVel bt)
{- | Create a flamelet when hitting a creature. -}
bulIncCr :: Particle -> Point2 -> Creature -> World -> World
bulIncCr bt p cr w = w
& makeFlamelet p 20 v Nothing 3 20
& bulletHitSound p
& creatures . ix cid . crState . crDamage .:~ Damage Piercing 60 sp p ep NoDamageEffect
where
cid = _crID cr
sp = head $ _ptTrail bt
ep = sp +.+ _ptVel bt
v = evalState (randInCirc 1) $ _randGen w
{- | Creates a shockwave when hitting a creature. -}
bulConCr :: Particle -> Point2 -> Creature -> World -> World
bulConCr bt p cr
= over (creatures . ix cid . crState . crDamage) (Damage Blunt 10 sp p ep NoDamageEffect :)
. makeShockwaveAt [] p 15 4 1 white
. bulletHitSound p
where
cid = _crID cr
sp = head $ _ptTrail bt
ep = sp +.+ _ptVel bt
{- | Hitting wall effects: create a spark, damage blocks. -}
bulHitWall :: Particle -> Point2 -> Wall -> World -> World
bulHitWall bt p = damageWall (Damage Piercing 100 sp p ep NoDamageEffect)
+2 -6
View File
@@ -5,7 +5,6 @@ import Dodge.PlacementSpot
import Dodge.RoomLink
import Dodge.Default.Room
import Dodge.Item.Weapon.BulletGuns
import Dodge.Item.Weapon.Launcher
import Dodge.Creature
import Dodge.Room.Pillar
import Dodge.Room.Modify.Girder
@@ -177,11 +176,8 @@ randFirstWeapon :: State StdGen PSType
randFirstWeapon = do
takeOne $ map PutFlIt $
replicate 10 pistol
++ replicate 5 ltAutoGun
++ replicate 5 (bangStick 3)
++ replicate 5 multGun
++ replicate 2 autoGun
++ [launcher]
++ replicate 5 (bangStick 4)
++ replicate 5 (bangCaneX 3)
weaponEmptyRoom :: RandomGen g => State g (SubCompTree Room)
weaponEmptyRoom = do
-32
View File
@@ -1,32 +0,0 @@
module Dodge.TweakBullet where
import Dodge.Data
import Dodge.Item.Weapon.Bullet
import qualified Data.IntMap.Strict as IM
import Control.Lens
defaultBulletSelTweak :: ItemTweaks
defaultBulletSelTweak = Tweakable
{_tweakSel = 0
,_tweakParams = IM.fromList $ zip [0..]
[ bulSelTweak
]
}
bulSelTweak :: TweakParam
bulSelTweak = TweakParam
{_doTweak = intToBulAmmo
,_curTweak = 0
,_maxTweak = 4
,_showTweak = _amString . (bulletTypes IM.!)
,_nameTweak = "BULLET TYPE"
}
intToBulAmmo :: Int -> Item -> Item
intToBulAmmo i = itConsumption . aoType .~ bulletTypes IM.! i
bulletTypes :: IM.IntMap AmmoType
bulletTypes = IM.fromList $ zip [0..]
[ basicBullet
, incBullet
, conBullet
, bounceBullet
]
+2
View File
@@ -1,6 +1,8 @@
module Dodge.WorldEvent.Shockwave
( makeShockwaveAt
, inverseShockwaveAt
, drawShockwave
, mvShockwave
) where
import Dodge.Data
import Dodge.Wall.Damage
+35 -2
View File
@@ -5,6 +5,8 @@ module Dodge.WorldEvent.SpawnParticle
, makeFlamelet
, aStaticBall
, makeStaticBall
, incBall
, concBall
) where
import Dodge.Data
import Dodge.Base
@@ -13,6 +15,7 @@ import Dodge.WorldEvent.HitEffect
import Dodge.WorldEvent.ThingsHit
import Dodge.WorldEvent.Cloud
import Dodge.WorldEvent.Flash
import Dodge.WorldEvent.Shockwave
import Dodge.SoundLogic
import Dodge.RandomHelp
import Dodge.Wall.Damage
@@ -111,8 +114,38 @@ moveFlame rotd w pt
reflV wall = (0.3 *.* reflectIn (uncurry (-.-) . swap $ _wlLine wall) vel )
+.+ (0.2 *.* vel)
aStaticBall :: Point2 -> Particle
aStaticBall vel = PtZ
incBall :: RandomGen g => Point2 -> State g Particle
incBall vel = do
rot <- state $ randomR (0,3)
return PtZ
{ _ptDraw = drawFlameletZ rot
, _ptUpdate = moveFlamelet
, _ptVel = vel
, _ptColor = red
, _ptPos = V2 0 0
, _ptCrIgnore = Nothing
, _ptWidth = 3
, _ptTimer = 20
, _ptHitEff = damageBothTypeAmount Flaming 20
, _ptZ = 20
}
concBall :: Point2 -> State g Particle
concBall _ = return Shockwave
{ _ptDraw = drawShockwave
, _ptUpdate = mvShockwave []
, _ptColor = white
, _ptPos = 0
, _ptRad = 15
, _ptDam = 4
, _ptPush = 1
, _ptMaxTime = 10
, _ptTimer = 10
}
aStaticBall :: Point2 -> State g Particle
aStaticBall vel = return PtZ
{ _ptDraw = drawStaticBall
, _ptUpdate = moveStaticBall
, _ptVel = vel