Improve frontArmour equipment
This commit is contained in:
@@ -176,7 +176,7 @@ testInventory = IM.fromList $ zip [0..]
|
|||||||
[ makeTypeCraftNum 9 PIPE
|
[ makeTypeCraftNum 9 PIPE
|
||||||
, autoSonar
|
, autoSonar
|
||||||
, autoRadar
|
, autoRadar
|
||||||
, autoRadar
|
, magShield
|
||||||
, frontArmour
|
, frontArmour
|
||||||
, flameShield
|
, flameShield
|
||||||
, powerLegs
|
, powerLegs
|
||||||
|
|||||||
@@ -61,5 +61,7 @@ armourChaseCrit = chaseCrit
|
|||||||
]
|
]
|
||||||
, _crMvType = defaultChaseMvType {_mvTurnRad = f}
|
, _crMvType = defaultChaseMvType {_mvTurnRad = f}
|
||||||
}
|
}
|
||||||
|
& crEquipment . at OnChest .~ Just 0
|
||||||
|
& crInvEquipped . at 0 .~ Just OnChest
|
||||||
where
|
where
|
||||||
f _ = 0.05
|
f _ = 0.05
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Dodge.Data
|
|||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
|
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import qualified Data.IntSet as IS
|
--import qualified Data.IntSet as IS
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
|
||||||
@@ -68,29 +68,6 @@ eqSiteToPos cr es = case es of
|
|||||||
Nothing -> OnLeftWrist
|
Nothing -> OnLeftWrist
|
||||||
_ -> OnRightWrist
|
_ -> OnRightWrist
|
||||||
|
|
||||||
removeEquipmentUsingSite :: EquipSite -> Creature -> Creature
|
|
||||||
removeEquipmentUsingSite esite cr = case esite of
|
|
||||||
GoesOnSpecial -> cr
|
|
||||||
_ -> case cr ^? crEquipment . esiteToPoint of
|
|
||||||
Just invid -> cr & crInvEquipped . at invid .~ Nothing
|
|
||||||
_ -> cr
|
|
||||||
where
|
|
||||||
esiteToPoint = case esite of
|
|
||||||
GoesOnHead -> ix OnHead
|
|
||||||
GoesOnChest -> ix OnChest
|
|
||||||
GoesOnBack -> ix OnBack
|
|
||||||
GoesOnWrist -> ix OnLeftWrist
|
|
||||||
GoesOnLegs -> ix OnLegs
|
|
||||||
|
|
||||||
setEquipmentSite :: EquipSite -> Maybe Int -> Creature -> Creature
|
|
||||||
setEquipmentSite esite = case esite of
|
|
||||||
GoesOnHead -> set (crEquipment . at OnHead)
|
|
||||||
GoesOnChest -> set (crEquipment . at OnChest)
|
|
||||||
GoesOnBack -> set (crEquipment . at OnBack)
|
|
||||||
GoesOnWrist -> set (crEquipment . at OnLeftWrist)
|
|
||||||
GoesOnLegs -> set (crEquipment . at OnLegs)
|
|
||||||
GoesOnSpecial -> const id
|
|
||||||
|
|
||||||
useLeftItem :: Int -> World -> World
|
useLeftItem :: Int -> World -> World
|
||||||
useLeftItem cid w
|
useLeftItem cid w
|
||||||
| _crInvLock cr = w
|
| _crInvLock cr = w
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ module Dodge.Creature.Property
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|
||||||
|
import Data.Maybe
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|
||||||
-- the use of crOldPos is because the damage position is calculated on the
|
-- the use of crOldPos is because the damage position is calculated on the
|
||||||
@@ -14,10 +15,17 @@ import Control.Lens
|
|||||||
crIsArmouredFrom :: Point2 -> Creature -> Bool
|
crIsArmouredFrom :: Point2 -> Creature -> Bool
|
||||||
crIsArmouredFrom p cr
|
crIsArmouredFrom p cr
|
||||||
= p /= _crOldPos cr
|
= p /= _crOldPos cr
|
||||||
&& any (\it -> it ^? itType == Just FRONTARMOUR) (_crInv cr)
|
-- && any (\it -> it ^? itType == Just FRONTARMOUR) (_crInv cr)
|
||||||
|
&& hasFrontArmour cr
|
||||||
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crOldPos cr) < pi/2
|
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crOldPos cr) < pi/2
|
||||||
-- even though angleVV can generate NaN, the comparison seems to deal with it
|
-- even though angleVV can generate NaN, the comparison seems to deal with it
|
||||||
|
|
||||||
|
hasFrontArmour :: Creature -> Bool
|
||||||
|
hasFrontArmour cr = fromMaybe False $ do
|
||||||
|
invid <- cr ^? crEquipment . ix OnChest
|
||||||
|
ittype <- cr ^? crInv . ix invid . itType
|
||||||
|
return $ FRONTARMOUR == ittype
|
||||||
|
|
||||||
--crOnSeg :: Point2 -> Point2 -> Creature -> Bool
|
--crOnSeg :: Point2 -> Point2 -> Creature -> Bool
|
||||||
--crOnSeg p1 p2 cr = circOnSeg p1 p2 (_crPos cr) (_crRad cr)
|
--crOnSeg p1 p2 cr = circOnSeg p1 p2 (_crPos cr) (_crRad cr)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import Picture
|
|||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
--import StrictHelp
|
--import StrictHelp
|
||||||
|
|
||||||
import qualified Data.IntSet as IS
|
--import qualified Data.IntSet as IS
|
||||||
--import Data.Maybe
|
--import Data.Maybe
|
||||||
import Data.Function
|
import Data.Function
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|||||||
+1
-1
@@ -420,7 +420,7 @@ data Item = Item
|
|||||||
{ _itName :: String
|
{ _itName :: String
|
||||||
, _itConsumption :: ItemConsumption
|
, _itConsumption :: ItemConsumption
|
||||||
, _itUse :: ItemUse
|
, _itUse :: ItemUse
|
||||||
, _itEquipPict :: Creature -> Int -> SPic
|
, _itEquipPict :: Creature -> Int -> SPic
|
||||||
, _itScroll :: Float -> Creature -> Item -> Item
|
, _itScroll :: Float -> Creature -> Item -> Item
|
||||||
, _itType :: CombineType
|
, _itType :: CombineType
|
||||||
, _itAttachment :: ItAttachment
|
, _itAttachment :: ItAttachment
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import qualified IntMapHelp as IM
|
|||||||
import ListHelp
|
import ListHelp
|
||||||
import LensHelp
|
import LensHelp
|
||||||
|
|
||||||
import qualified Data.IntSet as IS
|
--import qualified Data.IntSet as IS
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
--import Data.List
|
--import Data.List
|
||||||
--import System.Random
|
--import System.Random
|
||||||
@@ -197,12 +197,12 @@ changeSwapInvSel k w
|
|||||||
n = length $ _crInv $ _creatures w IM.! _yourID w
|
n = length $ _crInv $ _creatures w IM.! _yourID w
|
||||||
numCO = length $ _closeObjects w
|
numCO = length $ _closeObjects w
|
||||||
|
|
||||||
swapIntSetKeys :: Int -> Int -> IS.IntSet -> IS.IntSet
|
--swapIntSetKeys :: Int -> Int -> IS.IntSet -> IS.IntSet
|
||||||
swapIntSetKeys i j is
|
--swapIntSetKeys i j is
|
||||||
| i `IS.member` is && j `IS.member` is = is
|
-- | i `IS.member` is && j `IS.member` is = is
|
||||||
| i `IS.member` is = j `IS.insert` (i `IS.delete` is)
|
-- | i `IS.member` is = j `IS.insert` (i `IS.delete` is)
|
||||||
| j `IS.member` is = i `IS.insert` (j `IS.delete` is)
|
-- | j `IS.member` is = i `IS.insert` (j `IS.delete` is)
|
||||||
| otherwise = is
|
-- | otherwise = is
|
||||||
|
|
||||||
changeAugInvSel :: Int -> World -> World
|
changeAugInvSel :: Int -> World -> World
|
||||||
changeAugInvSel i w
|
changeAugInvSel i w
|
||||||
|
|||||||
@@ -58,17 +58,18 @@ frontArmour = defaultEquipment
|
|||||||
{_eqUse = \_ _ -> id
|
{_eqUse = \_ _ -> id
|
||||||
,_eqSite = GoesOnChest
|
,_eqSite = GoesOnChest
|
||||||
}
|
}
|
||||||
-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ translate 0 (-5) $ pictures
|
, _itEquipPict = pictureOnEquip (emptySH , setDepth 20 $ pictures
|
||||||
-- [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
|
||||||
-- ,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
|
||||||
-- ]
|
|
||||||
, _itEquipPict = \_ _ -> (,) emptySH $ setDepth 20 $ pictures
|
|
||||||
[color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
[color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||||
,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
||||||
]
|
])
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
|
pictureOnEquip :: SPic -> Creature -> Int -> SPic
|
||||||
|
pictureOnEquip sp cr i
|
||||||
|
| isJust (cr ^? crInvEquipped . ix i) = sp
|
||||||
|
| otherwise = mempty
|
||||||
|
|
||||||
flatShield :: Item
|
flatShield :: Item
|
||||||
flatShield = defaultEquipment
|
flatShield = defaultEquipment
|
||||||
{ _itEquipPict = pictureWeaponAim flatShieldEquipSPic
|
{ _itEquipPict = pictureWeaponAim flatShieldEquipSPic
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import ListHelp
|
|||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import qualified Data.IntSet as IS
|
--import qualified Data.IntSet as IS
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import SDL (MouseButton (..))
|
import SDL (MouseButton (..))
|
||||||
--import Data.List
|
--import Data.List
|
||||||
@@ -134,12 +134,12 @@ subInventoryDisplay subinv cfig w = case subinv of
|
|||||||
|
|
||||||
eqPosText :: EquipPosition -> String
|
eqPosText :: EquipPosition -> String
|
||||||
eqPosText ep = case ep of
|
eqPosText ep = case ep of
|
||||||
OnHead -> "ON HEAD"
|
OnHead -> "HEAD"
|
||||||
OnChest -> "ON CHEST"
|
OnChest -> "CHEST"
|
||||||
OnBack -> "ON BACK"
|
OnBack -> "BACK"
|
||||||
OnLeftWrist -> "ON LEFT WRIST"
|
OnLeftWrist -> "L.WRIST"
|
||||||
OnRightWrist -> "ON RIGHT WRIST"
|
OnRightWrist -> "R.WRIST"
|
||||||
OnLegs -> "ON LEGS"
|
OnLegs -> "LEGS"
|
||||||
OnSpecial -> "EQUIPPED"
|
OnSpecial -> "EQUIPPED"
|
||||||
|
|
||||||
topInvW :: Int
|
topInvW :: Int
|
||||||
|
|||||||
Reference in New Issue
Block a user