Separate out bullet effects, allow for tweaking to change these

This commit is contained in:
2021-11-30 13:11:34 +00:00
parent e75cbdf6cb
commit 4d21c0f31a
13 changed files with 207 additions and 81 deletions
+35 -17
View File
@@ -345,6 +345,7 @@ data Item
, _itDimension :: ItemDimension , _itDimension :: ItemDimension
, _itCurseStatus :: CurseStatus , _itCurseStatus :: CurseStatus
, _itParams :: ItemParams , _itParams :: ItemParams
, _itTweaks :: ItemTweaks
} }
| Consumable | Consumable
{ _itName :: String { _itName :: String
@@ -515,31 +516,47 @@ data AmmoType
| DroneAmmo | DroneAmmo
{ _amString :: String } { _amString :: String }
| GenericAmmo | GenericAmmo
data ItemParams data ItemTweaks
= NoParams = NoTweaks
| ShellLauncher | Tweakable
{ _tweakParams :: IM.IntMap TweakParam { _tweakParams :: IM.IntMap TweakParam
, _tweakSel :: Int , _tweakSel :: Int
, _shellSpinDrag :: Int
, _shellSpinAmount :: Int
, _shellThrustDelay :: Int
}
| Refracting {_phaseVel :: Float}
| MultiBarrel
{ _barrelSpread :: BarrelSpread
, _barrelNum :: Int
}
| SingleBarrel {_inaccuracy :: Float}
| AngleWalk
{ _maxWalkAngle :: Float
, _currentWalkAngle :: Float
, _walkSpeed :: Float
} }
data TweakParam = TweakParam data TweakParam = TweakParam
{ _doTweak :: Int -> Item -> Item { _doTweak :: Int -> Item -> Item
, _curTweak :: Int , _curTweak :: Int
, _maxTweak :: Int , _maxTweak :: Int
, _showTweak :: Int -> String , _showTweak :: Int -> String
, _nameTweak :: String
}
data GunBarrels
= MultiBarrel
{ _brlSpread :: BarrelSpread
, _brlNum :: Int
}
| SingleBarrel {_brlInaccuracy :: Float}
data ItemParams
= NoParams
| ShellLauncher
{ _shellSpinDrag :: Int
, _shellSpinAmount :: Int
, _shellThrustDelay :: Int
}
| Refracting {_phaseV :: Float}
| BulletShooter
{ _muzVel :: Float
, _bore :: Float
, _gunBarrels :: GunBarrels
}
| Sprayer
{ _nozzleSpread :: Float
, _nozzleNum :: Int
}
| AngleWalk
{ _maxWalkAngle :: Float
, _currentWalkAngle :: Float
, _walkSpeed :: Float
} }
data Modification data Modification
= ModIDTimerPoint3Bool = ModIDTimerPoint3Bool
@@ -897,3 +914,4 @@ makeLenses ''Vocalization
makeLenses ''Universe makeLenses ''Universe
makeLenses ''LSParam makeLenses ''LSParam
makeLenses ''ItemParams makeLenses ''ItemParams
makeLenses ''ItemTweaks
+3
View File
@@ -8,7 +8,9 @@ import ShapePicture
import Shape import Shape
import Geometry.Vector3D import Geometry.Vector3D
import Geometry import Geometry
--import Dodge.TweakBullet
--import qualified Data.IntMap.Strict as IM
import Control.Lens import Control.Lens
defaultAmmo :: ItemConsumption defaultAmmo :: ItemConsumption
@@ -101,6 +103,7 @@ defaultGun = Weapon
, _itTargeting = Nothing , _itTargeting = Nothing
, _itParams = NoParams , _itParams = NoParams
, _itDimension = defaultItemDimension , _itDimension = defaultItemDimension
, _itTweaks = NoTweaks
} }
defaultItemDimension :: ItemDimension defaultItemDimension :: ItemDimension
defaultItemDimension = ItemDimension defaultItemDimension = ItemDimension
+6 -6
View File
@@ -125,17 +125,17 @@ wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
invKeyDown = ScancodeCapsLock `S.member` _keys w invKeyDown = ScancodeCapsLock `S.member` _keys w
moveTweakSel :: Int -> World -> World moveTweakSel :: Int -> World -> World
moveTweakSel i w = case yourItem w ^? itParams . tweakParams of moveTweakSel i w = case yourItem w ^? itTweaks . tweakParams of
Just l -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w)) Just l -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
. itParams . tweakSel %~ (`mod` length l) . subtract i . itTweaks . tweakSel %~ (`mod` length l) . subtract i
_ -> w _ -> w
changeTweakParam :: Int -> World -> World changeTweakParam :: Int -> World -> World
changeTweakParam i w = w changeTweakParam i w = w
& creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w)) %~ & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w)) %~
( (itParams . tweakParams . ix paramid . curTweak .~ x) ( (itTweaks . tweakParams . ix paramid . curTweak .~ x)
. _doTweak params x) . _doTweak params x)
where where
it = yourItem w tweaks = _itTweaks $ yourItem w
params = _tweakParams (_itParams it) IM.! paramid params = _tweakParams tweaks IM.! paramid
x = (_curTweak params + i) `mod` _maxTweak params x = (_curTweak params + i) `mod` _maxTweak params
paramid = _tweakSel $ _itParams $ yourItem w paramid = _tweakSel tweaks
+2 -1
View File
@@ -32,8 +32,9 @@ defaultAimParams = AimParams
} }
useAmmoParams :: Item -> Creature -> World -> World useAmmoParams :: Item -> Creature -> World -> World
useAmmoParams it = withVelWthHiteff (_amBulVel b) (_amBulWth b) (_amBulEff b) useAmmoParams it = withVelWthHiteff (muzvel *.* _amBulVel b) (_amBulWth b) (_amBulEff b)
where where
muzvel = _muzVel $ _itParams it
b = _aoType $ _itConsumption it b = _aoType $ _itConsumption it
useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World
+41 -24
View File
@@ -11,11 +11,11 @@ import Dodge.SoundLogic.LoadSound
import Dodge.WorldEvent import Dodge.WorldEvent
import Dodge.WorldEvent.Damage import Dodge.WorldEvent.Damage
--import Dodge.Default --import Dodge.Default
import Dodge.Item.Weapon.InventoryDisplay --import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.AmmoParams import Dodge.Item.Weapon.AmmoParams
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Item.Attachment --import Dodge.Item.Attachment
import Dodge.WorldEvent.HelperParticle import Dodge.WorldEvent.HelperParticle
import Dodge.Base import Dodge.Base
import Dodge.Zone import Dodge.Zone
@@ -26,11 +26,11 @@ import ShapePicture
import Dodge.Picture import Dodge.Picture
import Data.Function import Data.Function
import qualified Data.Sequence as Seq --import qualified Data.Sequence as Seq
import Data.List import Data.List
import Control.Lens import Control.Lens
import System.Random import System.Random
import Data.Maybe --import Data.Maybe
import Data.Tuple import Data.Tuple
import qualified Data.IntMap.Strict as IM import qualified Data.IntMap.Strict as IM
teslaGun :: Item teslaGun :: Item
@@ -51,7 +51,6 @@ teslaGun = defaultGun
& useAim . aimSpeed .~ 0.4 & useAim . aimSpeed .~ 0.4
& useAim . aimStance .~ TwoHandFlat & useAim . aimStance .~ TwoHandFlat
, _itFloorPict = teslaGunPic , _itFloorPict = teslaGunPic
-- , _itZoom = defaultItZoom
} }
teslaGunPic :: Item -> SPic teslaGunPic :: Item -> SPic
teslaGunPic _ = noPic $ colorSH blue $ teslaGunPic _ = noPic $ colorSH blue $
@@ -80,11 +79,30 @@ lasGun = defaultAutoGun
& useAim . aimRange .~ 1 & useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist & useAim . aimStance .~ TwoHandTwist
, _itFloorPict = lasGunPic , _itFloorPict = lasGunPic
, _itAttachment = ItCharMode $ Seq.fromList "/VZ" , _itParams = Refracting {_phaseV = 1}
, _itScroll = scrollCharMode , _itTweaks = Tweakable
, _itInvDisplay = basicWeaponDisplay { _tweakParams = IM.fromList [(0,lasGunTweak)]
, _itParams = Refracting {_phaseVel = 1} , _tweakSel = 0
}
} }
lasGunTweak :: TweakParam
lasGunTweak = TweakParam
{ _doTweak = thetweak
, _curTweak = 1
, _maxTweak = 3
, _showTweak = showPhaseV
, _nameTweak = "PHASE VELOCITY"
}
where
thetweak 0 = itParams . phaseV .~ 0.2
thetweak 1 = itParams . phaseV .~ 1
thetweak 2 = itParams . phaseV .~ 5
thetweak _ = id
showPhaseV 0 = "V"
showPhaseV 1 = "/"
showPhaseV 2 = "Z"
showPhaseV i = "THIS SHOULD NOT BE POSSIBLE" ++ show i
lasGunPic :: Item -> SPic lasGunPic :: Item -> SPic
lasGunPic it = lasGunPic it =
( colorSH blue $ ( colorSH blue $
@@ -133,24 +151,23 @@ aTeslaArc cr w = set randGen g w
chooseColor _ = cyan chooseColor _ = cyan
aLaser :: Creature -> World -> World aLaser :: Creature -> World -> World
aLaser cr = particles %~ (makeLaserAt phaseV pos dir : ) aLaser cr = particles %~ (makeLaserAt phasev pos dir : )
where where
pos = _crPos cr +.+ ((_crRad cr +3) *.* unitVectorAtAngle dir) pos = _crPos cr +.+ ((_crRad cr +3) *.* unitVectorAtAngle dir)
dir = _crDir cr dir = _crDir cr
phaseV = charToPhaseV phasev = _phaseV . _itParams $ _crInv cr IM.! j
$ fromMaybe '/' $ Seq.lookup 0 =<< cr ^? crInv . ix j . itAttachment . itCharMode
j = _crInvSel cr j = _crInvSel cr
charToPhaseV :: Fractional p => Char -> p --charToPhaseV :: Fractional p => Char -> p
charToPhaseV 'V' = 0.2 --charToPhaseV 'V' = 0.2
charToPhaseV '/' = 1 --charToPhaseV '/' = 1
charToPhaseV 'Z' = 5 --charToPhaseV 'Z' = 5
charToPhaseV _ = error "Trying to set an undefined phaseV" --charToPhaseV _ = error "Trying to set an undefined phaseV"
makeLaserAt :: Float -> Point2 -> Float -> Particle makeLaserAt :: Float -> Point2 -> Float -> Particle
makeLaserAt phaseV pos dir = Particle makeLaserAt phasev pos dir = Particle
{ _ptDraw = const blank { _ptDraw = const blank
, _ptUpdate = moveLaser phaseV pos dir , _ptUpdate = moveLaser phasev pos dir
} }
moveLaser moveLaser
:: Float -- ^ Phase velocity, controls deflection through windows :: Float -- ^ Phase velocity, controls deflection through windows
@@ -159,7 +176,7 @@ moveLaser
-> World -> World
-> Particle -> Particle
-> (World, Maybe Particle) -> (World, Maybe Particle)
moveLaser phaseV pos dir w pt moveLaser phasev pos dir w pt
= ( hitEffect w = ( hitEffect w
, Just pt {_ptDraw = const pic ,_ptUpdate = ptSimpleTime 0 } , Just pt {_ptDraw = const pic ,_ptUpdate = ptSimpleTime 0 }
) )
@@ -183,7 +200,7 @@ moveLaser phaseV pos dir w pt
angleInc = piRange $ argV wlNormal - argV (x -.- y) angleInc = piRange $ argV wlNormal - argV (x -.- y)
angleRef angleRef
| reflectExternal = angleInc | reflectExternal = angleInc
| otherwise = asin $ sin angleInc / phaseV | otherwise = asin $ sin angleInc / phasev
piRange a' piRange a'
| a' > pi = a' - 2 * pi | a' > pi = a' - 2 * pi
| a' > negate pi = a' | a' > negate pi = a'
@@ -194,9 +211,9 @@ moveLaser phaseV pos dir w pt
angleInc' = piRange $ argV wlNormal' - argV (x -.- y) angleInc' = piRange $ argV wlNormal' - argV (x -.- y)
angleRef' angleRef'
| reflectInternal = angleInc' | reflectInternal = angleInc'
| otherwise = asin $ phaseV * sin angleInc' | otherwise = asin $ phasev * sin angleInc'
reflectInternal = 1 < abs (phaseV * sin angleInc') reflectInternal = 1 < abs (phasev * sin angleInc')
reflectExternal = 1 < abs (sin angleInc / phaseV) reflectExternal = 1 < abs (sin angleInc / phasev)
h' ws (_,Right wl) = not $ any (\w' -> _wlID w' == _wlID wl) ws h' ws (_,Right wl) = not $ any (\w' -> _wlID w' == _wlID wl) ws
h' _ _ = True h' _ _ = True
+25 -1
View File
@@ -1,5 +1,8 @@
module Dodge.Item.Weapon.Bullet module Dodge.Item.Weapon.Bullet
( basicBullet ( basicBullet
, incBullet
, conBullet
, bounceBullet
, ltBullet , ltBullet
, hvBullet , hvBullet
) where ) where
@@ -10,11 +13,32 @@ import Dodge.Particle.Bullet.HitEffect
import Geometry.Data import Geometry.Data
basicBullet :: AmmoType basicBullet :: AmmoType
basicBullet = BulletAmmo basicBullet = BulletAmmo
{ _amString = "BULLET" { _amString = "BASIC"
, _amBulEff = destroyOnImpact bulHitCr bulHitWall , _amBulEff = destroyOnImpact bulHitCr bulHitWall
, _amBulWth = 2 , _amBulWth = 2
, _amBulVel = V2 50 0 , _amBulVel = V2 50 0
} }
incBullet :: AmmoType
incBullet = BulletAmmo
{ _amString = "INCENDIARY"
, _amBulEff = destroyOnImpact bulIncCr bulIncWall
, _amBulWth = 2
, _amBulVel = V2 50 0
}
conBullet :: AmmoType
conBullet = BulletAmmo
{ _amString = "CONCUSSIVE"
, _amBulEff = destroyOnImpact bulConCr bulConWall
, _amBulWth = 2
, _amBulVel = V2 50 0
}
bounceBullet :: AmmoType
bounceBullet = BulletAmmo
{ _amString = "BOUNCING"
, _amBulEff = destroyOnImpact bulHitCr bulBounceWall
, _amBulWth = 2
, _amBulVel = V2 10 0
}
ltBullet :: AmmoType ltBullet :: AmmoType
ltBullet = BulletAmmo ltBullet = BulletAmmo
{ _amString = "LTBULLET" { _amString = "LTBULLET"
+36 -9
View File
@@ -12,6 +12,7 @@ module Dodge.Item.Weapon.BulletGuns
) )
where where
import Dodge.Data import Dodge.Data
import Dodge.TweakBullet
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Default import Dodge.Default
import Dodge.Item.Attachment import Dodge.Item.Attachment
@@ -67,7 +68,12 @@ autoGun = defaultAutoGun
, _itAttachment = ItCharMode $ Seq.fromList "MS" , _itAttachment = ItCharMode $ Seq.fromList "MS"
, _itScroll = scrollCharMode , _itScroll = scrollCharMode
, _itInvDisplay = basicWeaponDisplay , _itInvDisplay = basicWeaponDisplay
, _itParams = SingleBarrel autogunSpread , _itParams = BulletShooter
{ _muzVel = 1
, _bore = 2
, _gunBarrels = SingleBarrel 0.1
}
, _itTweaks = defaultBulletSelTweak
} }
autoGunPic :: Item -> SPic autoGunPic :: Item -> SPic
autoGunPic it = noPic $ autoGunPic it = noPic $
@@ -105,7 +111,12 @@ pistol = defaultGun
, _itInvDisplay = basicWeaponDisplay , _itInvDisplay = basicWeaponDisplay
, _itInvColor = white , _itInvColor = white
, _itTargeting = Nothing , _itTargeting = Nothing
, _itParams = SingleBarrel 0.05 , _itParams = BulletShooter
{ _muzVel = 0.8
, _bore = 2
, _gunBarrels = SingleBarrel 0.05
}
, _itTweaks = defaultBulletSelTweak
} }
pistolPic :: Item -> SPic pistolPic :: Item -> SPic
pistolPic it = noPic $ colorSH green (prismPoly pistolPic it = noPic $ colorSH green (prismPoly
@@ -177,7 +188,12 @@ ltAutoGun = defaultAutoGun
, modClock 2 withMuzFlareI , modClock 2 withMuzFlareI
] ]
, _itFloorPict = ltAutoGunPic , _itFloorPict = ltAutoGunPic
, _itParams = SingleBarrel 0.1 , _itParams = BulletShooter
{ _muzVel = 1
, _bore = 2
, _gunBarrels = SingleBarrel autogunSpread
}
, _itTweaks = defaultBulletSelTweak
} }
& itDimension . muzzleLength .~ 10 & itDimension . muzzleLength .~ 10
ltAutoGunPic :: Item -> SPic ltAutoGunPic :: Item -> SPic
@@ -239,6 +255,7 @@ miniGun = defaultAutoGun
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
, _itFloorPict = miniGunPictItem , _itFloorPict = miniGunPictItem
, _itEquipPict = pictureWeaponAim miniGunPictItem , _itEquipPict = pictureWeaponAim miniGunPictItem
, _itTweaks = defaultBulletSelTweak
} & itDimension . muzzleLength .~ 15 } & itDimension . muzzleLength .~ 15
where where
recoilAmount = 5 recoilAmount = 5
@@ -299,11 +316,16 @@ spreadGun = defaultGun
, withMuzFlareI , withMuzFlareI
, spreadNumI , spreadNumI
] ]
, _itParams = MultiBarrel , _itParams = BulletShooter
{_barrelNum = 5 { _muzVel = 0.7
,_barrelSpread = SpreadBarrels 0.5 , _bore = 2
, _gunBarrels = MultiBarrel
{_brlNum = 5
,_brlSpread = SpreadBarrels 0.5
}
} }
, _itFloorPict = spreadGunPic , _itFloorPict = spreadGunPic
, _itTweaks = defaultBulletSelTweak
} }
spreadGunPic :: Item -> SPic spreadGunPic :: Item -> SPic
spreadGunPic it = spreadGunPic it =
@@ -338,10 +360,15 @@ multGun = defaultGun
& useAim . aimStance .~ TwoHandTwist & useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
, _itFloorPict = multGunSPic , _itFloorPict = multGunSPic
, _itParams = MultiBarrel , _itParams = BulletShooter
{_barrelNum = 5 { _muzVel = 1
,_barrelSpread = AlignedBarrels , _bore = 3
, _gunBarrels = MultiBarrel
{_brlNum = 5
,_brlSpread = AlignedBarrels
}
} }
, _itTweaks = defaultBulletSelTweak
} }
multGunSPic :: Item -> SPic multGunSPic :: Item -> SPic
multGunSPic it = multGunSPic it =
+12 -9
View File
@@ -21,7 +21,7 @@ import Dodge.Picture.Layer
import Geometry import Geometry
import Picture import Picture
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import Padding --import Padding
import ShapePicture import ShapePicture
import Shape import Shape
@@ -59,12 +59,14 @@ launcher = defaultGun
, _itFloorPict = launcherPic , _itFloorPict = launcherPic
, _itEffect = NoItEffect , _itEffect = NoItEffect
, _itParams = ShellLauncher , _itParams = ShellLauncher
{ _tweakSel = 0 { _shellSpinDrag = 1
, _tweakParams = basicAmPjMoves
, _shellSpinDrag = 1
, _shellSpinAmount = 2 , _shellSpinAmount = 2
, _shellThrustDelay = 1 , _shellThrustDelay = 1
} }
, _itTweaks = Tweakable
{ _tweakSel = 0
, _tweakParams = basicAmPjMoves
}
} }
defaultShellAmmo :: AmmoType defaultShellAmmo :: AmmoType
@@ -92,24 +94,25 @@ spinDrag :: TweakParam
spinDrag = TweakParam spinDrag = TweakParam
{ _doTweak = \i -> itParams . shellSpinDrag .~ i { _doTweak = \i -> itParams . shellSpinDrag .~ i
, _curTweak = 1 , _curTweak = 1
, _showTweak = pjPadText "SPIN SLOWDOWN" . show , _showTweak = show
, _maxTweak = 5 , _maxTweak = 5
, _nameTweak = "SPIN SLOWDOWN"
} }
pjPadText :: String -> String -> String
pjPadText s = (rightPad 12 ' ' s ++ ) . (' ':)
spinStart :: TweakParam spinStart :: TweakParam
spinStart = TweakParam spinStart = TweakParam
{ _doTweak = \i -> itParams . shellSpinAmount .~ i { _doTweak = \i -> itParams . shellSpinAmount .~ i
, _curTweak = 2 , _curTweak = 2
, _showTweak = pjPadText "SPIN AMOUNT" . show , _showTweak = show
, _maxTweak = 5 , _maxTweak = 5
, _nameTweak = "SPIN AMOUNT"
} }
thrustParam :: TweakParam thrustParam :: TweakParam
thrustParam = TweakParam thrustParam = TweakParam
{ _doTweak = \i -> itParams . shellThrustDelay .~ i { _doTweak = \i -> itParams . shellThrustDelay .~ i
, _curTweak = 1 , _curTweak = 1
, _showTweak = pjPadText "THRUST DELAY" . show , _showTweak = show
, _maxTweak = 5 , _maxTweak = 5
, _nameTweak = "THRUST DELAY"
} }
pjThrust :: Int -> Prop -> World -> World pjThrust :: Int -> Prop -> World -> World
+3 -2
View File
@@ -48,8 +48,9 @@ poisonSprayer = defaultAutoGun
& useAim . aimSpeed .~ 0.2 & useAim . aimSpeed .~ 0.2
& useAim . aimRange .~ 0 & useAim . aimRange .~ 0
& useAim . aimStance .~ TwoHandTwist & useAim . aimStance .~ TwoHandTwist
, _itParams = MultiBarrel {_barrelSpread = SpreadBarrels 0.2 , _itParams = Sprayer
, _barrelNum = 3 { _nozzleSpread = 0.2
, _nozzleNum = 3
} }
, _itFloorPict = flamerPic , _itFloorPict = flamerPic
} }
+4 -4
View File
@@ -320,7 +320,7 @@ withMuzFlareI f it cr w = makeTlsTimeRadColPos 3 100 (V3 1 1 0.5) flashPos
applyInaccuracy :: ChainEffect applyInaccuracy :: ChainEffect
applyInaccuracy f it cr w = f it (cr & crDir +~ a) $ set randGen g w applyInaccuracy f it cr w = f it (cr & crDir +~ a) $ set randGen g w
where where
acc = _inaccuracy $ _itParams it acc = _brlInaccuracy . _gunBarrels $ _itParams it
(a, g) = randomR (-acc,acc) $ _randGen w (a, g) = randomR (-acc,acc) $ _randGen w
{- | Applies the effect to a randomly rotated creature. -} {- | Applies the effect to a randomly rotated creature. -}
withRandomDirI withRandomDirI
@@ -391,8 +391,8 @@ spreadNumI eff item cr w = foldr f w dirs
[-spread,-spread+(2*spread/fromIntegral numBul)..spread] [-spread,-spread+(2*spread/fromIntegral numBul)..spread]
(randomRs (0,spread/fromIntegral numBul) (_randGen w)) (randomRs (0,spread/fromIntegral numBul) (_randGen w))
f dir = eff item (cr & crDir +~ dir) f dir = eff item (cr & crDir +~ dir)
spread = _spreadAngle . _barrelSpread $ _itParams item spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
numBul = _barrelNum $ _itParams item numBul = _brlNum . _gunBarrels $ _itParams item
numI :: ChainEffect numI :: ChainEffect
numI eff item cr w = foldr f w poss numI eff item cr w = foldr f w poss
where where
@@ -401,7 +401,7 @@ numI eff item cr w = foldr f w poss
poss :: [V2 Float] poss :: [V2 Float]
poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1] poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
f pos = eff item (cr & crPos %~ (+.+ pos)) f pos = eff item (cr & crPos %~ (+.+ pos))
numBul = _barrelNum $ _itParams item numBul = _brlNum . _gunBarrels $ _itParams item
{- | Uses '_wpSpread' as a parameter for the current offset angle. -} {- | Uses '_wpSpread' as a parameter for the current offset angle. -}
randWalkAngle randWalkAngle
:: (Creature -> World -> World) -- ^ Underlying effect :: (Creature -> World -> World) -- ^ Underlying effect
+2 -2
View File
@@ -102,8 +102,8 @@ hvBulHitCr bt p cr w
sp = head $ _btTrail' bt sp = head $ _btTrail' bt
ep = sp +.+ _btVel' bt ep = sp +.+ _btVel' bt
{- | Create a flamelet when hitting a creature. -} {- | Create a flamelet when hitting a creature. -}
bulIncCr' :: Particle -> Point2 -> Creature -> World -> World bulIncCr :: Particle -> Point2 -> Creature -> World -> World
bulIncCr' bt p cr w bulIncCr bt p cr w
= over (creatures . ix cid . crState . crDamage) = over (creatures . ix cid . crState . crDamage)
( Piercing 60 sp p ep : ) ( Piercing 60 sp p ep : )
$ bulletHitSound p $ bulletHitSound p
+6 -6
View File
@@ -58,7 +58,7 @@ subInventoryDisplay cfig w = case _inventoryMode w of
col = itCol it col = itCol it
cursorsZ :: Configuration -> Int -> Item -> Picture cursorsZ :: Configuration -> Int -> Item -> Picture
cursorsZ cfig ipos it = case it ^? itParams . tweakSel of cursorsZ cfig ipos it = case it ^? itTweaks . tweakSel of
Nothing -> f $ zConnect sp (V2 (155- hw) ( hh - 77.5)) Nothing -> f $ zConnect sp (V2 (155- hw) ( hh - 77.5))
Just jpos -> f $ zConnect sp (V2 (155 - hw) ( hh - (20 * fromIntegral jpos + 77.5))) Just jpos -> f $ zConnect sp (V2 (155 - hw) ( hh - (20 * fromIntegral jpos + 77.5)))
where where
@@ -75,12 +75,12 @@ topInvCursor col iPos cfig w
| otherwise = mainListCursor col iPos cfig | otherwise = mainListCursor col iPos cfig
ammoTweakStrings :: Item -> [String] ammoTweakStrings :: Item -> [String]
ammoTweakStrings it = case it ^? itParams . tweakParams of ammoTweakStrings it = case it ^? itTweaks . tweakParams of
Just l -> map pjTweakString $ IM.elems l Just l -> map tweakString $ IM.elems l
_ -> ["NOT TWEAKABLE"] _ -> ["NOT TWEAKABLE"]
mCurs :: Item -> Configuration -> World -> Picture mCurs :: Item -> Configuration -> World -> Picture
mCurs it cfig w = case it ^? itParams . tweakSel of mCurs it cfig w = case it ^? itTweaks . tweakSel of
Nothing -> [] Nothing -> []
Just i Just i
| ButtonRight `S.member` _mouseButtons w -> | ButtonRight `S.member` _mouseButtons w ->
@@ -93,8 +93,8 @@ mCurs it cfig w = case it ^? itParams . tweakSel of
x = 117.5 x = 117.5
y = 155 y = 155
pjTweakString :: TweakParam -> String tweakString :: TweakParam -> String
pjTweakString pj = _showTweak pj $ _curTweak pj tweakString tp = rightPad 12 ' ' (_nameTweak tp) ++ " " ++ _showTweak tp (_curTweak tp)
displayMidList :: Configuration -> [String] -> String -> Picture displayMidList :: Configuration -> [String] -> String -> Picture
displayMidList cfig strs s = invHead cfig s displayMidList cfig strs s = invHead cfig s
+32
View File
@@ -0,0 +1,32 @@
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
]