Cleanup
This commit is contained in:
@@ -136,8 +136,8 @@ flatShieldEquipSPic _ =
|
||||
)
|
||||
effectOnEquip :: (Creature -> Item -> World -> World) -> ItEffect
|
||||
effectOnEquip f = ItInvEffectID
|
||||
{ _itInvEffect = g f
|
||||
, _itEffectID = Nothing
|
||||
{ _ieInv = g f
|
||||
, _ieMID = Nothing
|
||||
}
|
||||
where
|
||||
g f' itm cr w
|
||||
@@ -167,9 +167,9 @@ shieldWallDamage dm _ crid w = case _dmType dm of
|
||||
_ -> w
|
||||
|
||||
createShieldWall :: Creature -> Int -> World -> World
|
||||
createShieldWall cr invid w = case _itEffectID $ _itEffect it of
|
||||
createShieldWall cr invid w = case _ieMID $ _itEffect it of
|
||||
Nothing -> let (wlid,w') = createWall ((shieldWall crid) {_wlLine = wlline,_wlID = wlid}) w
|
||||
in w' & creatures . ix crid . crInv . ix invid . itEffect . itEffectID ?~ wlid
|
||||
in w' & creatures . ix crid . crInv . ix invid . itEffect . ieMID ?~ wlid
|
||||
Just wid -> moveWallID wid wlline w
|
||||
where
|
||||
crid = _crID cr
|
||||
@@ -183,10 +183,10 @@ createShieldWall cr invid w = case _itEffectID $ _itEffect it of
|
||||
therot | crIsAiming cr = vNormal
|
||||
| otherwise = rotateV (twoFlatHRot cr) . vNormal
|
||||
removeShieldWall :: Creature -> Int -> World -> World
|
||||
removeShieldWall cr invid w = case _itEffectID $ _itEffect it of
|
||||
removeShieldWall cr invid w = case _ieMID $ _itEffect it of
|
||||
Nothing -> w
|
||||
Just wid -> w & deleteWallID wid
|
||||
& creatures . ix crid . crInv . ix invid . itEffect . itEffectID .~ Nothing
|
||||
& creatures . ix crid . crInv . ix invid . itEffect . ieMID .~ Nothing
|
||||
where
|
||||
crid = _crID cr
|
||||
it = _crInv (_creatures w IM.! crid) IM.! invid
|
||||
@@ -196,8 +196,8 @@ effectOnOffHeld
|
||||
-> (Creature -> Int -> World -> World) -- ^ effect when not held
|
||||
-> ItEffect
|
||||
effectOnOffHeld f f' = ItInvEffectID
|
||||
{ _itInvEffect = g
|
||||
, _itEffectID = Nothing
|
||||
{ _ieInv = g
|
||||
, _ieMID = Nothing
|
||||
}
|
||||
where
|
||||
g itm cr w
|
||||
|
||||
@@ -49,7 +49,7 @@ boostSelfL x itm cr w = case boostPoint x cr w of
|
||||
(crPos .~ p)
|
||||
. (crInv . ix invid %~
|
||||
ammoEff
|
||||
. (itEffect . itEffectCounter .~ 1)
|
||||
. (itEffect . ieCounter .~ 1)
|
||||
. (itAttachment .~ ItInt pid)
|
||||
)
|
||||
|
||||
@@ -124,8 +124,8 @@ resetAttachmentID :: ItEffect
|
||||
resetAttachmentID = ItInvEffect f 0
|
||||
where
|
||||
f itm cr w
|
||||
| _itEffectCounter iteff < 0 = w & pointToIt . itAttachment .~ NoItAttachment
|
||||
| otherwise = w & pointToIt . itEffect . itEffectCounter -~ 1
|
||||
| _ieCounter iteff < 0 = w & pointToIt . itAttachment .~ NoItAttachment
|
||||
| otherwise = w & pointToIt . itEffect . ieCounter -~ 1
|
||||
where
|
||||
iteff = _itEffect itm
|
||||
invid = fromJust $ _itInvPos itm
|
||||
|
||||
@@ -117,16 +117,16 @@ throwGrenade thePayload cr w = setWp $ removePict $ over props addG w
|
||||
fuseTime = _itFuseTime $ _itAttachment $ _crInv cr IM.! j
|
||||
|
||||
throwArmReset :: Int -> ItEffect
|
||||
throwArmReset x = ItInvEffect {_itInvEffect = f ,_itEffectCounter = x }
|
||||
throwArmReset x = ItInvEffect {_ieInv = f ,_ieCounter = x }
|
||||
where
|
||||
f itm cr = creatures . ix (_crID cr) . crInv %~ IM.adjust counterDown i
|
||||
where
|
||||
i = fromJust $ _itInvPos itm
|
||||
counterDown it
|
||||
| _itEffectCounter (_itEffect it) == 0 = it
|
||||
| _ieCounter (_itEffect it) == 0 = it
|
||||
& itUse . useHammer . hammerPosition .~ HammerUp
|
||||
& itEquipPict .~ pictureWeaponAim (\_ -> grenadePic 50)
|
||||
| otherwise = it & itEffect . itEffectCounter -~ 1
|
||||
| otherwise = it & itEffect . ieCounter -~ 1
|
||||
|
||||
--flameGrenade :: Item
|
||||
--flameGrenade = grenade {
|
||||
|
||||
@@ -324,7 +324,7 @@ moveRemoteShell cid itid pj w
|
||||
newPos = oldPos +.+ vel
|
||||
newdir
|
||||
| SDL.ButtonRight `S.member` _mouseButtons w
|
||||
&& w ^? creatures . ix cid . crInvSel == w ^? itemPositions . ix itid . itInvId
|
||||
&& w ^? creatures . ix cid . crInvSel == w ^? itemPositions . ix itid . ipInvId
|
||||
= _cameraRot w + argV (_mousePos w)
|
||||
| otherwise = _pjDir pj
|
||||
accel = rotateV newdir (V2 2 0)
|
||||
|
||||
Reference in New Issue
Block a user