Add force field gun
This commit is contained in:
@@ -172,7 +172,8 @@ inventoryA = IM.fromList $ zip [0..]
|
||||
]
|
||||
inventoryB :: IM.IntMap Item
|
||||
inventoryB = IM.fromList $ zip [0..]
|
||||
[ wristArmour
|
||||
[ forceFieldGun
|
||||
, wristArmour
|
||||
, wristArmour
|
||||
, autoRifle
|
||||
, smg
|
||||
|
||||
+9
-6
@@ -136,10 +136,10 @@ data World = World
|
||||
, _doubleMouseHammer :: HammerPosition
|
||||
}
|
||||
|
||||
data HUDElement = DisplayInventory {_subInventory :: SubInventory}
|
||||
data HUDElement
|
||||
= DisplayInventory {_subInventory :: SubInventory}
|
||||
| DisplayCarte
|
||||
-- deriving (Eq,Ord,Show)
|
||||
|
||||
data RightButtonOptions
|
||||
= NoRightButtonOptions
|
||||
| EquipOptions
|
||||
@@ -149,13 +149,11 @@ data RightButtonOptions
|
||||
,_opAllocateEquipment :: AllocateEquipment
|
||||
,_opActivateEquipment :: ActivateEquipment
|
||||
}
|
||||
|
||||
data ActivateEquipment
|
||||
= ActivateEquipment {_activateEquipment :: Int }
|
||||
| DeactivateEquipment {_deactivateEquipment :: Int}
|
||||
| ActivateDeactivateEquipment {_activateEquipment :: Int ,_deactivateEquipment :: Int}
|
||||
| NoChangeActivateEquipment
|
||||
|
||||
data AllocateEquipment
|
||||
= DoNotMoveEquipment
|
||||
| PutOnEquipment
|
||||
@@ -487,18 +485,17 @@ data Item = Item
|
||||
, _itTargeting :: Targeting
|
||||
, _itDimension :: ItemDimension
|
||||
, _itCurseStatus :: CurseStatus
|
||||
, _itParams :: ItemParams
|
||||
, _itTweaks :: ItemTweaks
|
||||
, _itModules :: M.Map ModuleSlot ItemModule
|
||||
, _itScope :: Scope
|
||||
, _itValue :: ItemValue
|
||||
, _itParams :: ItemParams
|
||||
}
|
||||
data ItemValue = ItemValue
|
||||
{ _ivInt :: Int
|
||||
, _ivType :: ItemValueType
|
||||
}
|
||||
data ItemValueType = MundaneItem | ArtefactItem
|
||||
|
||||
data Targeting
|
||||
= NoTargeting
|
||||
| Targeting
|
||||
@@ -570,6 +567,11 @@ data ItEffect
|
||||
{_itInvEffect :: Item -> Creature -> World -> World
|
||||
,_itEffectID :: Maybe Int
|
||||
}
|
||||
| ItInvEffectDrop
|
||||
{ _itInvEffect :: Item -> Creature -> World -> World
|
||||
, _itEffectDrop :: Item -> Creature -> World -> World
|
||||
, _itEffectMID :: Maybe Int
|
||||
}
|
||||
data IntID a = IntID Int a
|
||||
|
||||
data WorldBeams = WorldBeams
|
||||
@@ -780,6 +782,7 @@ data ItemParams
|
||||
-> State StdGen (Maybe ArcStep)
|
||||
, _previousArcEffect :: PreviousArcEffect
|
||||
}
|
||||
| ParamMID {_paramMID :: Maybe Int}
|
||||
data ArcStep = ArcStep
|
||||
{ _asPos :: Point2
|
||||
, _asDir :: Float
|
||||
|
||||
@@ -57,6 +57,7 @@ rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itCons
|
||||
& creatures . ix cid . crLeftInvSel %~ g'
|
||||
& removeAnySlotEquipment
|
||||
& dounequipfunction
|
||||
& doanyitemeffect
|
||||
& creatures . ix cid . crInvEquipped %~ IM.delete invid
|
||||
& creatures . ix cid . crInvEquipped %~ IM.mapKeys g
|
||||
-- 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
|
||||
rmf <- itm ^? itUse . eqOnRemove
|
||||
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
|
||||
Just epos -> creatures . ix cid . crEquipment . at epos .~ Nothing
|
||||
Nothing -> id
|
||||
|
||||
@@ -103,8 +103,10 @@ setWristShieldPos itm cr w = w
|
||||
invid = fromJust (_itInvPos itm)
|
||||
--wlline = (V2 10 0, V2 (-10) 100)
|
||||
handtrans = case cr ^? crInvEquipped . ix invid of
|
||||
Just OnLeftWrist -> translatePointToLeftHand
|
||||
Just OnLeftWrist -> \cr' -> translatePointToLeftHand cr' . g
|
||||
_ -> translatePointToRightHand
|
||||
g | twists cr = (+.+.+ V3 (-5) 10 0)
|
||||
| otherwise = id
|
||||
f = (+.+ _crPos cr) . stripZ . rotate3 (_crDir cr) . handtrans cr
|
||||
|
||||
spicForWrist :: SPic -> Creature -> Item -> SPic
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
module Dodge.Item.Weapon.Utility where
|
||||
import Dodge.Data
|
||||
--import Dodge.Base
|
||||
import Dodge.Base.Coordinate
|
||||
import Dodge.Default
|
||||
--import Dodge.Picture.Layer
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Item.Weapon.ExtraEffect
|
||||
import Dodge.Default.Weapon
|
||||
import Dodge.Wall.ForceField
|
||||
import Dodge.Wall.Move
|
||||
--import Sound.Data
|
||||
import Geometry
|
||||
import Picture
|
||||
--import qualified IntMapHelp as IM
|
||||
import qualified IntMapHelp as IM
|
||||
import Shape
|
||||
import ShapePicture
|
||||
|
||||
@@ -134,9 +137,23 @@ forceFieldGun = defaultGun
|
||||
, _reloadTime = 40
|
||||
, _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)]
|
||||
, _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
|
||||
-- { _itName = "grapGun"
|
||||
-- , _itIdentity = GrapGun
|
||||
|
||||
@@ -127,7 +127,7 @@ drawWallIDs cfig w
|
||||
. text
|
||||
$ show $ _wlID wl
|
||||
where
|
||||
p = worldPosToScreen w $ 0.5 *.* ( uncurry (+.+) $ _wlLine wl)
|
||||
p = worldPosToScreen w $ 0.5 *.* uncurry (+.+) (_wlLine wl)
|
||||
|
||||
drawPathing :: Configuration -> World -> Picture
|
||||
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