Make blunderbusses take bullet modules, make flamelets damage walls

This commit is contained in:
2022-03-22 19:29:15 +00:00
parent 27025b6605
commit bda65968b0
4 changed files with 23 additions and 7 deletions
+15 -4
View File
@@ -37,8 +37,7 @@ aFlameParticle t pos vel maycid = PtZ
, _ptCrIgnore = maycid
, _ptWidth = 4
, _ptTimer = t
, _ptHitEff = destroyOnImpact (doFlameDam 1)
(\_ p -> damageWall (Damage Flaming 19 p p p NoDamageEffect))
, _ptHitEff = doFlameDamCrWall
, _ptZ = 20
}
drawFlame
@@ -130,12 +129,20 @@ makeFlamelet (V2 x y) z vel maycid size time w = w
, _ptCrIgnore = maycid
, _ptWidth = size
, _ptTimer = time
, _ptHitEff = destroyOnImpact (doFlameDam 1) noEff
, _ptHitEff = doFlameDamCrWall
, _ptZ = z
}
where
(rot ,g) = randomR (0,3) $ _randGen w
doFlameDamCrWall :: Particle
-> [(Point2, Either Creature Wall)]
-> World
-> (World, Maybe Particle)
doFlameDamCrWall = destroyOnImpact
(doFlameDam 1)
(\_ p -> damageWall (Damage Flaming 19 p p p NoDamageEffect))
drawFlameletZ
:: Float -- ^ Rotation
-> Particle
@@ -183,10 +190,11 @@ drawFlameletZ rot pt = pictures
{- Update of a flamelet.
Applies movement and attaches damage to nearby creatures. -}
-- This should be unified in many ways with moveFlame
moveFlamelet :: World -> Particle -> (World, Maybe Particle)
moveFlamelet w pt
| _ptTimer pt <= 0 = ( w, Nothing)
| otherwise = (flameFlicker pt damcrs, mvPt)
| otherwise = (flameFlicker pt $ damwls damcrs, mvPt)
where
sp = _ptPos pt
vel = _ptVel pt
@@ -197,6 +205,9 @@ moveFlamelet w pt
& ptCrIgnore .~ Nothing
& ptVel .~ 0.8 *.* vel
damcrs = w & creatures %~ IM.map damifclose
damwls w' = foldr (\wl -> fst . hiteff [(ep,Right wl)]) w' $ IM.filter closeWls $ wallsNearPoint ep w
closeWls wl = uncurry circOnSeg (_wlLine wl) ep 5
hiteff = _ptHitEff pt pt
isClose cr = dist ep (_crPos cr) < _crRad cr + size
damifclose cr
| isClose cr = cr & crState . crDamage .:~ Damage Flaming 3 sp ep ep NoDamageEffect