diff --git a/src/Dodge/Item/Weapon/AmmoParams.hs b/src/Dodge/Item/Weapon/AmmoParams.hs index 1ded40f46..1367b63e5 100644 --- a/src/Dodge/Item/Weapon/AmmoParams.hs +++ b/src/Dodge/Item/Weapon/AmmoParams.hs @@ -34,7 +34,7 @@ defaultAimParams = AimParams , _aimStance = OneHand } useAmmoParams :: Maybe Float -> Item -> Creature -> World -> World -useAmmoParams vfact it cr w = w & particles .:~ aBulAt +useAmmoParams vfact it cr w = w & instantParticles .:~ aBulAt vfact thetraj -- extra update Nothing -- color (default) diff --git a/src/Dodge/Item/Weapon/BatteryGuns.hs b/src/Dodge/Item/Weapon/BatteryGuns.hs index 690f759c1..f1855774b 100644 --- a/src/Dodge/Item/Weapon/BatteryGuns.hs +++ b/src/Dodge/Item/Weapon/BatteryGuns.hs @@ -255,7 +255,7 @@ updateArc :: ItemParams updateArc = createNewArc shootLaser :: Item -> Creature -> World -> World -shootLaser it cr = particles .:~ lasRayAt phasev pos dir +shootLaser it cr = instantParticles .:~ lasRayAt phasev pos dir where pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir dir = _crDir cr diff --git a/src/Dodge/Particle/Spark.hs b/src/Dodge/Particle/Spark.hs index 8dec94d0d..8c784be20 100644 --- a/src/Dodge/Particle/Spark.hs +++ b/src/Dodge/Particle/Spark.hs @@ -68,7 +68,7 @@ colSparkRandDir :: Float -> Int -> Color -> Point2 -> Float -> World -> World colSparkRandDir randDir time col pos baseDir w = w & instantParticles .:~ spark & randGen .~ g - where + where (a,g) = randomR (-randDir,randDir) $ _randGen w dir = a + baseDir spark = BulletPt diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index 2830c2c35..b88d3c107 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -146,7 +146,7 @@ updateInstantParticles :: World -> World updateInstantParticles w = case _instantParticles w of [] -> w ps -> let (w',ps') = mapAccumR (\a b -> _ptUpdate b a b) (w {_instantParticles=[]}) ps - in updateInstantParticles $ w' & particles %~ (catMaybes ps' ++) + in updateInstantParticles $ w' & particles .++~ catMaybes ps' updateMIM :: ASetter' World (IM.IntMap a) -> (a -> a -> Maybe a) -> World -> World updateMIM f up = f %~ IM.mapMaybe (dbArg up) diff --git a/src/Dodge/Wall/DamageEffect.hs b/src/Dodge/Wall/DamageEffect.hs index 8ba43fe19..de24ef066 100644 --- a/src/Dodge/Wall/DamageEffect.hs +++ b/src/Dodge/Wall/DamageEffect.hs @@ -5,14 +5,13 @@ import Dodge.Particle.Bullet.Spawn import Dodge.Wall.Reflect import Dodge.Wall.Dust import Geometry -import Color import LensHelp import Control.Monad.State defaultWallDamage :: Damage -> Wall -> World -> World defaultWallDamage dm wl = wallDamageEffect dm wl . case _dmType dm of - Lasering -> colSpark 8 lSparkCol outTo (reflDirWall sp p wl) + Lasering -> colSparkRandDir 0.2 8 lSparkCol outTo (reflDirWall sp p wl) Piercing -> colSparkRandDir 0.2 8 pSparkCol outTo (reflDirWall sp p wl) . wlDustAt wl outTo Blunt -> wlDustAt wl outTo @@ -27,9 +26,9 @@ defaultWallDamage dm wl = wallDamageEffect dm wl . case _dmType dm of PoisonDam -> id where sp = _dmFrom dm - p = _dmTo dm + p = _dmAt dm outTo = p +.+ squashNormalizeV (sp -.- p) - pSparkCol = brightX 100 1.5 white + pSparkCol = V4 5 1 0.5 2 lSparkCol = V4 20 (-5) 0 1 wallDamageEffect :: Damage -> Wall -> World -> World @@ -37,8 +36,8 @@ wallDamageEffect dm wl w = case _dmEffect dm of BounceBullet bt -> w & instantParticles .:~ thebouncer where reflectVel = reflVelWall wl (_ptVel bt) - thebouncer = (aBulAt Nothing id (Just (_ptColor bt)) Nothing pOut reflectVel (_btDrag bt) (_ptHitEff bt) (_ptWidth bt) - ) {_ptTimer = _ptTimer bt - 1} + thebouncer = aBulAt Nothing id (Just (_ptColor bt)) Nothing pOut reflectVel (_btDrag bt) (_ptHitEff bt) (_ptWidth bt) + & ptTimer .~ _ptTimer bt - 1 pOut = p +.+ squashNormalizeV (sp -.- p) p = _dmAt dm sp = _dmFrom dm