Add force field gun
This commit is contained in:
@@ -172,7 +172,8 @@ inventoryA = IM.fromList $ zip [0..]
|
|||||||
]
|
]
|
||||||
inventoryB :: IM.IntMap Item
|
inventoryB :: IM.IntMap Item
|
||||||
inventoryB = IM.fromList $ zip [0..]
|
inventoryB = IM.fromList $ zip [0..]
|
||||||
[ wristArmour
|
[ forceFieldGun
|
||||||
|
, wristArmour
|
||||||
, wristArmour
|
, wristArmour
|
||||||
, autoRifle
|
, autoRifle
|
||||||
, smg
|
, smg
|
||||||
|
|||||||
+9
-6
@@ -136,10 +136,10 @@ data World = World
|
|||||||
, _doubleMouseHammer :: HammerPosition
|
, _doubleMouseHammer :: HammerPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
data HUDElement = DisplayInventory {_subInventory :: SubInventory}
|
data HUDElement
|
||||||
|
= DisplayInventory {_subInventory :: SubInventory}
|
||||||
| DisplayCarte
|
| DisplayCarte
|
||||||
-- deriving (Eq,Ord,Show)
|
-- deriving (Eq,Ord,Show)
|
||||||
|
|
||||||
data RightButtonOptions
|
data RightButtonOptions
|
||||||
= NoRightButtonOptions
|
= NoRightButtonOptions
|
||||||
| EquipOptions
|
| EquipOptions
|
||||||
@@ -149,13 +149,11 @@ data RightButtonOptions
|
|||||||
,_opAllocateEquipment :: AllocateEquipment
|
,_opAllocateEquipment :: AllocateEquipment
|
||||||
,_opActivateEquipment :: ActivateEquipment
|
,_opActivateEquipment :: ActivateEquipment
|
||||||
}
|
}
|
||||||
|
|
||||||
data ActivateEquipment
|
data ActivateEquipment
|
||||||
= ActivateEquipment {_activateEquipment :: Int }
|
= ActivateEquipment {_activateEquipment :: Int }
|
||||||
| DeactivateEquipment {_deactivateEquipment :: Int}
|
| DeactivateEquipment {_deactivateEquipment :: Int}
|
||||||
| ActivateDeactivateEquipment {_activateEquipment :: Int ,_deactivateEquipment :: Int}
|
| ActivateDeactivateEquipment {_activateEquipment :: Int ,_deactivateEquipment :: Int}
|
||||||
| NoChangeActivateEquipment
|
| NoChangeActivateEquipment
|
||||||
|
|
||||||
data AllocateEquipment
|
data AllocateEquipment
|
||||||
= DoNotMoveEquipment
|
= DoNotMoveEquipment
|
||||||
| PutOnEquipment
|
| PutOnEquipment
|
||||||
@@ -487,18 +485,17 @@ data Item = Item
|
|||||||
, _itTargeting :: Targeting
|
, _itTargeting :: Targeting
|
||||||
, _itDimension :: ItemDimension
|
, _itDimension :: ItemDimension
|
||||||
, _itCurseStatus :: CurseStatus
|
, _itCurseStatus :: CurseStatus
|
||||||
, _itParams :: ItemParams
|
|
||||||
, _itTweaks :: ItemTweaks
|
, _itTweaks :: ItemTweaks
|
||||||
, _itModules :: M.Map ModuleSlot ItemModule
|
, _itModules :: M.Map ModuleSlot ItemModule
|
||||||
, _itScope :: Scope
|
, _itScope :: Scope
|
||||||
, _itValue :: ItemValue
|
, _itValue :: ItemValue
|
||||||
|
, _itParams :: ItemParams
|
||||||
}
|
}
|
||||||
data ItemValue = ItemValue
|
data ItemValue = ItemValue
|
||||||
{ _ivInt :: Int
|
{ _ivInt :: Int
|
||||||
, _ivType :: ItemValueType
|
, _ivType :: ItemValueType
|
||||||
}
|
}
|
||||||
data ItemValueType = MundaneItem | ArtefactItem
|
data ItemValueType = MundaneItem | ArtefactItem
|
||||||
|
|
||||||
data Targeting
|
data Targeting
|
||||||
= NoTargeting
|
= NoTargeting
|
||||||
| Targeting
|
| Targeting
|
||||||
@@ -570,6 +567,11 @@ data ItEffect
|
|||||||
{_itInvEffect :: Item -> Creature -> World -> World
|
{_itInvEffect :: Item -> Creature -> World -> World
|
||||||
,_itEffectID :: Maybe Int
|
,_itEffectID :: Maybe Int
|
||||||
}
|
}
|
||||||
|
| ItInvEffectDrop
|
||||||
|
{ _itInvEffect :: Item -> Creature -> World -> World
|
||||||
|
, _itEffectDrop :: Item -> Creature -> World -> World
|
||||||
|
, _itEffectMID :: Maybe Int
|
||||||
|
}
|
||||||
data IntID a = IntID Int a
|
data IntID a = IntID Int a
|
||||||
|
|
||||||
data WorldBeams = WorldBeams
|
data WorldBeams = WorldBeams
|
||||||
@@ -780,6 +782,7 @@ data ItemParams
|
|||||||
-> State StdGen (Maybe ArcStep)
|
-> State StdGen (Maybe ArcStep)
|
||||||
, _previousArcEffect :: PreviousArcEffect
|
, _previousArcEffect :: PreviousArcEffect
|
||||||
}
|
}
|
||||||
|
| ParamMID {_paramMID :: Maybe Int}
|
||||||
data ArcStep = ArcStep
|
data ArcStep = ArcStep
|
||||||
{ _asPos :: Point2
|
{ _asPos :: Point2
|
||||||
, _asDir :: Float
|
, _asDir :: Float
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itCons
|
|||||||
& creatures . ix cid . crLeftInvSel %~ g'
|
& creatures . ix cid . crLeftInvSel %~ g'
|
||||||
& removeAnySlotEquipment
|
& removeAnySlotEquipment
|
||||||
& dounequipfunction
|
& dounequipfunction
|
||||||
|
& doanyitemeffect
|
||||||
& creatures . ix cid . crInvEquipped %~ IM.delete invid
|
& creatures . ix cid . crInvEquipped %~ IM.delete invid
|
||||||
& creatures . ix cid . crInvEquipped %~ IM.mapKeys g
|
& creatures . ix cid . crInvEquipped %~ IM.mapKeys g
|
||||||
-- TODO check whether this can be mapKeysMonotonic
|
-- TODO check whether this can be mapKeysMonotonic
|
||||||
@@ -66,6 +67,9 @@ rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itCons
|
|||||||
dounequipfunction = fromMaybe id $ do
|
dounequipfunction = fromMaybe id $ do
|
||||||
rmf <- itm ^? itUse . eqOnRemove
|
rmf <- itm ^? itUse . eqOnRemove
|
||||||
return $ rmf itm cr
|
return $ rmf itm cr
|
||||||
|
doanyitemeffect = fromMaybe id $ do
|
||||||
|
rmf <- itm ^? itEffect . itEffectDrop
|
||||||
|
return $ rmf itm cr
|
||||||
removeAnySlotEquipment = case w ^? creatures . ix cid . crInvEquipped . ix invid of
|
removeAnySlotEquipment = case w ^? creatures . ix cid . crInvEquipped . ix invid of
|
||||||
Just epos -> creatures . ix cid . crEquipment . at epos .~ Nothing
|
Just epos -> creatures . ix cid . crEquipment . at epos .~ Nothing
|
||||||
Nothing -> id
|
Nothing -> id
|
||||||
|
|||||||
@@ -103,8 +103,10 @@ setWristShieldPos itm cr w = w
|
|||||||
invid = fromJust (_itInvPos itm)
|
invid = fromJust (_itInvPos itm)
|
||||||
--wlline = (V2 10 0, V2 (-10) 100)
|
--wlline = (V2 10 0, V2 (-10) 100)
|
||||||
handtrans = case cr ^? crInvEquipped . ix invid of
|
handtrans = case cr ^? crInvEquipped . ix invid of
|
||||||
Just OnLeftWrist -> translatePointToLeftHand
|
Just OnLeftWrist -> \cr' -> translatePointToLeftHand cr' . g
|
||||||
_ -> translatePointToRightHand
|
_ -> translatePointToRightHand
|
||||||
|
g | twists cr = (+.+.+ V3 (-5) 10 0)
|
||||||
|
| otherwise = id
|
||||||
f = (+.+ _crPos cr) . stripZ . rotate3 (_crDir cr) . handtrans cr
|
f = (+.+ _crPos cr) . stripZ . rotate3 (_crDir cr) . handtrans cr
|
||||||
|
|
||||||
spicForWrist :: SPic -> Creature -> Item -> SPic
|
spicForWrist :: SPic -> Creature -> Item -> SPic
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
module Dodge.Item.Weapon.Utility where
|
module Dodge.Item.Weapon.Utility where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
--import Dodge.Base
|
import Dodge.Base.Coordinate
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
--import Dodge.Picture.Layer
|
--import Dodge.Picture.Layer
|
||||||
import Dodge.Creature.Action
|
import Dodge.Creature.Action
|
||||||
import Dodge.Item.Weapon.TriggerType
|
import Dodge.Item.Weapon.TriggerType
|
||||||
|
import Dodge.Item.Weapon.ExtraEffect
|
||||||
import Dodge.Default.Weapon
|
import Dodge.Default.Weapon
|
||||||
|
import Dodge.Wall.ForceField
|
||||||
|
import Dodge.Wall.Move
|
||||||
--import Sound.Data
|
--import Sound.Data
|
||||||
import Geometry
|
import Geometry
|
||||||
import Picture
|
import Picture
|
||||||
--import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
import Shape
|
import Shape
|
||||||
import ShapePicture
|
import ShapePicture
|
||||||
|
|
||||||
@@ -134,9 +137,23 @@ forceFieldGun = defaultGun
|
|||||||
, _reloadTime = 40
|
, _reloadTime = 40
|
||||||
, _reloadState = Nothing'
|
, _reloadState = Nothing'
|
||||||
}
|
}
|
||||||
, _itUse = undefined
|
, _itUse = ruseInstant useForceFieldGun (HasHammer HammerUp)
|
||||||
|
[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
|
||||||
-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
|
-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
|
||||||
|
, _itTargeting = targetRBPress
|
||||||
|
, _itParams = ParamMID Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useForceFieldGun :: Item -> Creature -> World -> World
|
||||||
|
useForceFieldGun itm cr w = w
|
||||||
|
& walls %~ IM.insertWith (\_ x -> x) i forceField {_wlID = i}
|
||||||
|
& creatures . ix (_crID cr) . crInv . ix (fromJust (_itInvPos itm)) . itParams . paramMID ?~ i
|
||||||
|
& moveWallIDUnsafe i wlline
|
||||||
|
where
|
||||||
|
i = fromMaybe (IM.newKey (_walls w)) $ itm ^? itParams . paramMID . _Just
|
||||||
|
a = fromJust . _tgPos $ _itTargeting itm
|
||||||
|
wlline = (a,mouseWorldPos w)
|
||||||
|
|
||||||
-- grapGun = defaultGun
|
-- grapGun = defaultGun
|
||||||
-- { _itName = "grapGun"
|
-- { _itName = "grapGun"
|
||||||
-- , _itIdentity = GrapGun
|
-- , _itIdentity = GrapGun
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ drawWallIDs cfig w
|
|||||||
. text
|
. text
|
||||||
$ show $ _wlID wl
|
$ show $ _wlID wl
|
||||||
where
|
where
|
||||||
p = worldPosToScreen w $ 0.5 *.* ( uncurry (+.+) $ _wlLine wl)
|
p = worldPosToScreen w $ 0.5 *.* uncurry (+.+) (_wlLine wl)
|
||||||
|
|
||||||
drawPathing :: Configuration -> World -> Picture
|
drawPathing :: Configuration -> World -> Picture
|
||||||
drawPathing cfig w
|
drawPathing cfig w
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
module Dodge.Wall.ForceField where
|
||||||
|
import Dodge.Data
|
||||||
|
import Dodge.Default.Wall
|
||||||
|
import Color
|
||||||
|
|
||||||
|
forceField :: Wall
|
||||||
|
forceField = defaultWall
|
||||||
|
{_wlColor = orange
|
||||||
|
,_wlOpacity = SeeAbove
|
||||||
|
,_wlPathable = True
|
||||||
|
,_wlWalkable = True
|
||||||
|
,_wlFireThrough = True
|
||||||
|
,_wlReflect = True
|
||||||
|
,_wlDraw = True
|
||||||
|
,_wlRotateTo = False
|
||||||
|
,_wlStructure = StandaloneWall
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user