Narrow down non-termination to thingsHit[LongLine]

This commit is contained in:
2021-03-15 19:36:33 +01:00
parent 370f41738c
commit f939535657
3 changed files with 24 additions and 99 deletions
+12 -1
View File
@@ -337,7 +337,7 @@ launcher = defaultGun
}
bezierGun = defaultGun
{ _itName = "B-GUN"
, _wpFire = bezierTarget
, _wpFire = bezierControl'
}
remoteLauncher = defaultGun
@@ -1407,6 +1407,8 @@ grenadePic x = pictures [ color (dark $ dark green) $ circleSolid 5
$ scale 0.05 0.05 $ color green $ text $ show $ 1 + quot x 20
]
bezTest cid w = mkBezierBul (0,11) (0,20) (0,20) cid w
bezierTarget :: Int -> World -> World
bezierTarget cid w = setTarget w
where
@@ -1424,6 +1426,15 @@ bezierControl targetp cid w = resetGun $ shootWithSound 0 (mkBezierBul startp co
startp = _crPos cr +.+ rotateV dir (_crRad cr + 1,0)
resetGun = set (creatures . ix cid . crInv . ix j . wpFire) $ bezierTarget
bezierControl' :: Int -> World -> World
bezierControl' cid w = shootWithSound 0 (mkBezierBul startp controlp controlp) cid w
where
j = _crInvSel $ _creatures w IM.! cid
controlp = _crPos cr +.+ (20,20)
cr = _creatures w IM.! cid
dir = _crDir cr
startp = _crPos cr +.+ (11,11)
mkBezierBul :: Point2 -> Point2 -> Point2 -> Int -> World -> World
mkBezierBul startp controlp targetp cid w = over particles' (bbul :) w
where
+6 -4
View File
@@ -22,15 +22,14 @@ bulHitCr' :: Particle' -> Point2 -> Creature -> World -> World
bulHitCr' bt p cr w =
let sp = head $ _btTrail' bt
ep = sp +.+ _btVel' bt
-- mvDams = [TorqueDam 1 d1 , PushDam 1 $ 2 *.* (ep -.- sp) ]
mvDams = [ PushDam 1 $ 2 *.* (ep -.- sp) ]
mvDams = [ PushDam 1 $ 2 *.* bulVel ]
addDamage = over (creatures . ix cid . crState . crDamage)
(\dams -> (Piercing 100 sp p ep : mvDams) ++ dams)
addDamageArmoured = over (creatures . ix cid . crState . crDamage)
(\dams -> mvDams ++ dams)
hitSound = soundMultiFrom [CrHitSound 0] 15 10 0
flashEff = over worldEvents ((.) $ flareAt red p)
bulVel = ep -.- sp
bulVel = _btVel' bt
ck cid = (+.+) (crKnockBack cid *.* bulVel)
crKnockBack cid = (/) 1 $ (+) 2 $ _crMass $ _creatures w IM.! cid
hasArmour cr = any (\it -> it ^? itIdentity == Just FrontArmour) $ _crInv cr
@@ -38,7 +37,10 @@ bulHitCr' bt p cr w =
sID = newParticleKey w
(d1,g) = randomR (-0.7,0.7) $ _randGen w
(colID,_) = randomR (0,11) $ _randGen w
hitEffect = addDamage . hitSound . flashEff $ w
hitEffect = addDamage
. hitSound
. flashEff
$ w
in case hasArmour cr of --shit this is ugly, to refactor
True -> if hitBack
then hitEffect