Start to implement equipment sites on body
This commit is contained in:
@@ -19,7 +19,7 @@ magShield :: Item
|
||||
magShield = defaultEquipment
|
||||
{ _itType = MAGSHIELD
|
||||
, _itName = "MAGSHIELD"
|
||||
, _itUse = EquipUse useMagShield
|
||||
, _itUse = EquipUse useMagShield GoesOnWrist
|
||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||
, _itID = Nothing
|
||||
, _itAttachment = ItMInt Nothing
|
||||
@@ -38,11 +38,14 @@ useMagShield cr invid w = w & magnets . at mgid ?~ themagnet
|
||||
Nothing -> IM.newKey $ _magnets w
|
||||
it = _crInv cr IM.! invid
|
||||
|
||||
|
||||
flameShield :: Item
|
||||
flameShield = defaultEquipment
|
||||
{ _itType = FLAMESHIELD
|
||||
, _itName = "FLAMESHIELD"
|
||||
, _itUse = EquipUse
|
||||
{_eqUse = \_ _ -> id
|
||||
,_eqSite = GoesOnChest
|
||||
}
|
||||
, _itEquipPict = \cr _ -> (,) emptySH $ setDepth 20 $ pictures [color cyan $ circle (_crRad cr+2)]
|
||||
, _itID = Nothing
|
||||
}
|
||||
@@ -51,6 +54,10 @@ frontArmour :: Item
|
||||
frontArmour = defaultEquipment
|
||||
{ _itType = FRONTARMOUR
|
||||
, _itName = "FARMOUR"
|
||||
, _itUse = EquipUse
|
||||
{_eqUse = \_ _ -> id
|
||||
,_eqSite = GoesOnChest
|
||||
}
|
||||
-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ translate 0 (-5) $ pictures
|
||||
-- [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||
-- ,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
||||
@@ -65,7 +72,7 @@ frontArmour = defaultEquipment
|
||||
flatShield :: Item
|
||||
flatShield = defaultEquipment
|
||||
{ _itEquipPict = pictureWeaponAim flatShieldEquipSPic
|
||||
, _itEffect = effectOnOffEquip createShieldWall removeShieldWall
|
||||
, _itEffect = effectOnOffHeld createShieldWall removeShieldWall
|
||||
-- the above seems to work, but I am not sure why: it may break on edge
|
||||
-- cases
|
||||
, _itName = "FLATSHIELD"
|
||||
@@ -150,11 +157,11 @@ removeShieldWall cr invid w = case _itEffectID $ _itEffect it of
|
||||
crid = _crID cr
|
||||
it = _crInv (_creatures w IM.! crid) IM.! invid
|
||||
|
||||
effectOnOffEquip
|
||||
:: (Creature -> Int -> World -> World) -- ^ effect when equiped
|
||||
-> (Creature -> Int -> World -> World) -- ^ effect when not equiped
|
||||
effectOnOffHeld
|
||||
:: (Creature -> Int -> World -> World) -- ^ effect when held
|
||||
-> (Creature -> Int -> World -> World) -- ^ effect when not held
|
||||
-> ItEffect
|
||||
effectOnOffEquip f f' = ItInvEffectID
|
||||
effectOnOffHeld f f' = ItInvEffectID
|
||||
{ _itInvEffect = g
|
||||
, _itEffectID = Nothing
|
||||
}
|
||||
|
||||
@@ -112,15 +112,15 @@ mvSonicWave w pt
|
||||
dosplit :: [Maybe ((Point2,Float),(Bool,Bool))] -> [[(Point2,Float)]]
|
||||
dosplit (x:xs) = case x of
|
||||
Nothing -> [] : dosplit xs
|
||||
Just (pair,(True,True)) -> onHead (pair:) $ dosplit xs
|
||||
Just (pair,(False,True)) -> [] : onHead (pair:) (dosplit xs)
|
||||
Just (pair,(True,True)) -> overHead (pair:) $ dosplit xs
|
||||
Just (pair,(False,True)) -> [] : overHead (pair:) (dosplit xs)
|
||||
Just (pair,(True,False)) -> [pair] : dosplit xs
|
||||
Just (_,(False,False)) -> [] : dosplit xs
|
||||
dosplit [] = [[]]
|
||||
|
||||
onHead :: (a -> a) -> [a] -> [a]
|
||||
onHead f (x:xs) = f x: xs
|
||||
onHead _ [] = []
|
||||
overHead :: (a -> a) -> [a] -> [a]
|
||||
overHead f (x:xs) = f x: xs
|
||||
overHead _ [] = []
|
||||
|
||||
|
||||
reflectShockLine :: Wall -> Point2 -> Point2 -> Point2 -> Maybe ((Point2,Float),(Bool,Bool))
|
||||
|
||||
Reference in New Issue
Block a user