Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
module Dodge.Item.Amount where
import Dodge.Data
import Data.Maybe
import Control.Lens
import Data.Maybe
import Dodge.Data.Item
itStackAmount :: Item -> ItAmount
itStackAmount it = fromMaybe 1 $ it ^? itUse . useAmount
+13 -14
View File
@@ -1,27 +1,26 @@
module Dodge.Item.Consumable where
import Dodge.Data
--import Dodge.Picture.Layer
import Control.Lens
import Dodge.Data.World
import Dodge.Default
import Dodge.SoundLogic
--import Shape
--import ShapePicture
--import Dodge.Item.Draw
--import Picture
--import Data.Maybe
import Control.Lens
import qualified IntMapHelp as IM
medkit :: Int -> Item
medkit i = defaultConsumable
& itUse . cUse .~ CHeal i
& itType . iyBase .~ Consumable (MEDKIT i)
medkit i =
defaultConsumable
& itUse . cUse .~ CHeal i
& itType . iyBase .~ Consumable (MEDKIT i)
heal25 :: Int -> World -> Maybe World
heal25 = heal 25
heal :: Int -> Int -> World -> Maybe World
heal hp n w | _crHP (_creatures (_cWorld w) IM.! n) >= 10000 = Nothing
| otherwise = Just $ soundStart (CrSound $ _crID cr) (_crPos cr) healS Nothing w
heal hp n w
| _crHP (_creatures (_cWorld w) IM.! n) >= 10000 = Nothing
| otherwise =
Just $
soundStart (CrSound $ _crID cr) (_crPos cr) healS Nothing w
& cWorld . creatures . ix n . crHP %~ min 10000 . (+ hp)
where
cr = _creatures (_cWorld w) IM.! n
+38 -30
View File
@@ -1,48 +1,56 @@
module Dodge.Item.Craftable where
import Dodge.Data
import Dodge.Default.Weapon
--import Dodge.Particle.Bullet.HitEffect
--import Dodge.WorldEvent.HitEffect
import Dodge.Default.Item
import Color
--import Dodge.Picture.Layer
--import Picture
--import Geometry
import Control.Lens
import Dodge.Data.Item
makeTypeCraftNum :: Int -> CraftType -> Item
makeTypeCraftNum i ct = defaultCraftable
& itInvSize .~ 0.5
& itCurseStatus .~ Uncursed
& itUse . useAmount .~ fromIntegral i
& itType . iyBase .~ CRAFT ct
makeTypeCraftNum i ct =
defaultCraftItem
& itInvSize .~ 0.5
& itCurseStatus .~ Uncursed
& itUse . useAmount .~ fromIntegral i
& itType . iyBase .~ CRAFT ct
makeTypeCraft :: CraftType -> Item
makeTypeCraft = makeTypeCraftNum 1
incendiaryModule :: Item
incendiaryModule = makeTypeCraft INCENDIARYMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
incendiaryModule =
makeTypeCraft INCENDIARYMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
bounceModule :: Item
bounceModule = makeTypeCraft BOUNCEMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
bounceModule =
makeTypeCraft BOUNCEMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
teleportModule :: Item
teleportModule = makeTypeCraft TELEPORTMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
teleportModule =
makeTypeCraft TELEPORTMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
timeModule :: Item
timeModule = makeTypeCraft TIMEMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
timeModule =
makeTypeCraft TIMEMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
sizeModule :: Item
sizeModule = makeTypeCraft SIZEMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
sizeModule =
makeTypeCraft SIZEMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
gravityModule :: Item
gravityModule = makeTypeCraft GRAVITYMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
gravityModule =
makeTypeCraft GRAVITYMODULE
& itInvSize .~ 1
& itInvColor .~ chartreuse
pipe :: Item
pipe = makeTypeCraft PIPE
+8 -7
View File
@@ -6,7 +6,7 @@ module Dodge.Item.Display (
import Data.Maybe
import Data.Sequence
import Dodge.Data
import Dodge.Data.Creature
import Dodge.Inventory.ItemSpace
import Dodge.Module
import LensHelp
@@ -37,6 +37,7 @@ itemString = head . itemDisplay
itemBaseName :: Item -> String
itemBaseName it = case _iyBase $ _itType it of
NoItemType -> show "NoItemType"
CRAFT str -> show str
HELD hit -> case hit ^? xNum of
Just i -> takeWhile (/= ' ') (show hit) ++ show i
@@ -51,7 +52,7 @@ selectedItemDisplay cr it = itemDisplayWithNumber (showSelectedConsumption cr (_
-- | Displays the item name, ammo if loaded, and any selected '_itCharMode'.
showSelectedConsumption :: Creature -> ItemUse -> String
showSelectedConsumption cr iu = case iu of
RightUse{} -> showReloadProgress cr (_heldConsumption iu)
HeldUse{} -> showReloadProgress cr (_heldConsumption iu)
LeftUse{} -> showAutoRechargeProgress (_leftConsumption iu)
EquipUse{} -> ""
_ -> show $ iu ^?! useAmount . getItAmount -- partial, be careful if adding new data constructors
@@ -72,7 +73,7 @@ showReloadProgress cr ic = case cr ^?! crInvSel . iselAction of
showConsumption :: ItemUse -> String
showConsumption iu = case iu of
RightUse{} -> showReloadProgress' (_heldConsumption iu)
HeldUse{} -> showReloadProgress' (_heldConsumption iu)
LeftUse{} -> showAutoRechargeProgress (_leftConsumption iu)
EquipUse{} -> ""
_ -> show $ iu ^?! useAmount . getItAmount
@@ -90,9 +91,9 @@ showLoadActionType la x = case la of
LoadPrime{} -> "P"
maybeWarmupStatus :: Item -> Maybe String
maybeWarmupStatus it = case it ^? itUse . useDelay . warmMax of
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
Nothing -> Nothing
Just m -> case m - (_warmTime . _useDelay $ _itUse it) of
Just m -> case m - (_warmTime . _heldDelay $ _itUse it) of
x
| x <= 1 -> Just "*WARM"
| otherwise ->
@@ -106,6 +107,6 @@ maybeModeStatus it = case it ^? itUse . heldScroll of
_ -> Nothing
maybeRateStatus :: Item -> Maybe String
maybeRateStatus it = case it ^? itUse . useDelay . rateMaxMax of
maybeRateStatus it = case it ^? itUse . heldDelay . rateMaxMax of
Nothing -> Nothing
_ -> Just $ leftPad 3 ' ' (show (_rateMax . _useDelay $ _itUse it))
_ -> Just $ leftPad 3 ' ' (show (_rateMax . _heldDelay $ _itUse it))
+58 -57
View File
@@ -1,82 +1,83 @@
module Dodge.Item.Draw
( pictureWeaponOnAim
, pictureWeaponAim
, twoFlatHRot
, itemSPic
, itemEquipPict
, heldItemOffset
) where
import Dodge.Data
import Dodge.Item.HeldOffset
import ShapePicture
import Dodge.Item.Equipment.Shape
import Dodge.Item.Draw.SPic
module Dodge.Item.Draw (
pictureWeaponOnAim,
pictureWeaponAim,
twoFlatHRot,
itemSPic,
itemEquipPict,
heldItemOffset,
) where
import qualified IntMapHelp as IM
import Control.Lens
import Dodge.Data.Creature
import Dodge.Item.Draw.SPic
import Dodge.Item.Equipment.Shape
import Dodge.Item.HeldOffset
import qualified IntMapHelp as IM
import ShapePicture
itemEquipPict :: Creature -> Item -> SPic
itemEquipPict cr it = case it ^?! itUse of
RightUse {} -> pictureWeaponOnAim cr it
ituse -> case ituse ^? eqEq of
HeldUse{} -> pictureWeaponOnAim cr it
ituse -> case ituse ^? equipEffect of
Just _ -> pictureOnEquip (itemSPic it) cr it
Nothing -> mempty
pictureWeaponOnAim
:: Creature
-> Item
-> SPic
pictureWeaponOnAim ::
Creature ->
Item ->
SPic
pictureWeaponOnAim = pictureWeaponAim itemSPic
pictureWeaponAim
:: (Item -> SPic)
-> Creature
-> Item
-> SPic
pictureWeaponAim ::
(Item -> SPic) ->
Creature ->
Item ->
SPic
pictureWeaponAim f cr itm = case _itLocation itm of
InInv _ i -> pictureWeaponOnAimItem (f itm) cr i
_ -> mempty
{- | Places an item picture onto a creature when the item is selected. -}
pictureWeaponOnAimItem
:: SPic
-> Creature
-> Int -- ^ Position of item in inventory
-> SPic
pictureWeaponOnAimItem p' cr posInInv
-- | Places an item picture onto a creature when the item is selected.
pictureWeaponOnAimItem ::
SPic ->
Creature ->
-- | Position of item in inventory
Int ->
SPic
pictureWeaponOnAimItem p' cr posInInv
| _itIsHeld theIt = overPosSP (heldItemOffset theIt cr) p'
| otherwise = mempty
-- | isSelected && _posture (_crStance cr) == Aiming =
-- shoulderD $ translateSPf (aimingWeaponZeroPos cr theIt) 0 p'
-- | isSelected && isTwoHandFlat
-- = handD holsteredTwoFlat
-- | isSelected && isOneHand
-- = handD holsteredOneHandWep
-- | isSelected
-- = handD holsteredWep
-- | otherwise = mempty
where
-- shoulderD = translateSPz 18
-- handD = translateSPz 15
-- isSelected = crSel cr == posInInv
-- twistWep = translateSPf (-5) 0 p
-- holsteredWep = translateSPf (_crRad cr) 0
-- (rotateSP (strideRot cr + 1.2) (translateSPf (-5) 0 twistWep))
-- holsteredTwoFlat = translateSPf (_crRad cr) 0 (rotateSP (twoFlatHRot cr) p)
-- holsteredOneHandWep = translateSPf (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7)
-- (translateSPf (-2) 0 p)
-- handPos = case cr^? crStance . carriage of
-- Just (Walking x LeftForward) -> f x * 50
-- _ -> 0
where
-- | isSelected && _posture (_crStance cr) == Aiming =
-- shoulderD $ translateSPf (aimingWeaponZeroPos cr theIt) 0 p'
-- | isSelected && isTwoHandFlat
-- = handD holsteredTwoFlat
-- | isSelected && isOneHand
-- = handD holsteredOneHandWep
-- | isSelected
-- = handD holsteredWep
-- | otherwise = mempty
-- shoulderD = translateSPz 18
-- handD = translateSPz 15
-- isSelected = crSel cr == posInInv
-- twistWep = translateSPf (-5) 0 p
-- holsteredWep = translateSPf (_crRad cr) 0
-- (rotateSP (strideRot cr + 1.2) (translateSPf (-5) 0 twistWep))
-- holsteredTwoFlat = translateSPf (_crRad cr) 0 (rotateSP (twoFlatHRot cr) p)
-- holsteredOneHandWep = translateSPf (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7)
-- (translateSPf (-2) 0 p)
-- handPos = case cr^? crStance . carriage of
-- Just (Walking x LeftForward) -> f x * 50
-- _ -> 0
theIt = _crInv cr IM.! posInInv
-- p = fromMaybe p' $ do
-- x <- theIt ^? itUse . useAim . aimHandlePos
-- return $translateSPf (-x) 0 p'
-- isOneHand = theIt ^? itUseAimStance == Just OneHand
-- || isNothing (theIt ^? itUseAimStance)
-- isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat
-- itUseAimStance = itUse . useAim . aimStance
-- itUseAimStance = itUse . useAim . aimStance
-- f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
-- sLen = _strideLength $ _crStance cr
+208 -164
View File
@@ -1,119 +1,138 @@
module Dodge.Item.Draw.SPic where
import Dodge.Data
import Dodge.Item.Weapon.FractionLoaded
import ShapePicture
import Shape
import LensHelp
import Color
import Picture
import Geometry
import Color
import Data.Maybe
import Dodge.Data.Item
import Dodge.Item.Weapon.FractionLoaded
import Geometry
import LensHelp
import Picture
import Shape
import ShapePicture
itemSPic :: Item -> SPic
itemSPic it = foldMap (modulesSPic it) (_iyModules $ _itType it) <> case it ^. itType . iyBase of
CRAFT _ -> defSPic
HELD ht -> heldItemSPic ht it
LEFT lt -> leftItemSPic lt it
EQUIP et -> equipItemSPic et it
Consumable {} -> defSPic
itemSPic it =
foldMap (modulesSPic it) (_iyModules $ _itType it) <> case it ^. itType . iyBase of
NoItemType -> over _1 (colorSH magenta) defSPic
CRAFT _ -> defSPic
HELD ht -> heldItemSPic ht it
LEFT lt -> leftItemSPic lt it
EQUIP et -> equipItemSPic et it
Consumable{} -> defSPic
equipItemSPic :: EquipItemType -> Item -> SPic
equipItemSPic et _ = case et of
MAGSHIELD -> defSPic
FLAMESHIELD -> defSPic
FRONTARMOUR -> (emptySH , setDepth 20 $ pictures
[color yellow $ thickArc 0 (pi/2) 10 5
,color yellow $ thickArc (3*pi/2) (2*pi) 10 5
])
WRISTARMOUR -> defSPic
MAGSHIELD -> defSPic
FLAMESHIELD -> defSPic
FRONTARMOUR ->
( emptySH
, setDepth 20 $
pictures
[ color yellow $ thickArc 0 (pi / 2) 10 5
, color yellow $ thickArc (3 * pi / 2) (2 * pi) 10 5
]
)
WRISTARMOUR -> defSPic
INVISIBILITYEQUIPMENT _ -> noPic (colorSH chartreuse $ upperPrismPoly 3 $ rectWH 2 2)
BRAINHAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
HAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
HEADLAMP -> noPic headLampShape
BRAINHAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
HAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
HEADLAMP -> noPic headLampShape
POWERLEGS -> legsSPic yellow
SPEEDLEGS -> legsSPic green
JUMPLEGS -> legsSPic red
JETPACK -> (,) emptySH $ setDepth 20
$ pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-11) (-3) ]
JUMPLEGS -> legsSPic red
JETPACK ->
(,) emptySH $
setDepth 20 $
pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-11) (-3)]
AUTODETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2)
leftItemSPic :: LeftItemType -> Item -> SPic
leftItemSPic lt _ = case lt of
BLINKER -> defSPic
_ -> defSPic
_ -> defSPic
heldItemSPic :: HeldItemType -> Item -> SPic
heldItemSPic ht it = case ht of
FLATSHIELD -> flatShieldEquipSPic
FORCEFIELDGUN -> defSPic
TORCH -> noPic torchShape
BANGSTICK i -> noPic $ baseStickShapeX it i <> stickClip it
PISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
REVOLVER -> noPic $ baseStickShape <> revolverClip it
REVOLVERX _ -> noPic $ baseStickShape <> revolverClip it
MACHINEPISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
AUTOPISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
SMG -> noPic (baseSMGShape <> makeTinClipAt 0 (V3 7 (-2) 0) it)
BANGCONE -> noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 5 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 5 15)
BLUNDERBUSS -> noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 20 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 20 30)
GRAPECANNON _ -> noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 20 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 20 30)
MINIGUNX i -> miniGunXPictItem i it
VOLLEYGUN i -> volleyGunSPic i it
RIFLE -> noPic $ baseRifleShape <> makeSingleClipAt (V3 5 0 3) it
REPEATER -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
AUTORIFLE -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
BURSTRIFLE -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
BANGROD -> noPic $ baseRodShape <> makeSingleClipAt (V3 5 0 3) it
ELEPHANTGUN -> noPic $ baseAMRShape <> makeSingleClipAt (V3 5 0 3) it
AMR -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
AUTOAMR -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
SNIPERRIFLE -> noPic $ baseAMRShape <> makeSingleClipAt (V3 5 0 3) it
MACHINEGUN -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
FLAMESPITTER -> flamerPic it
FLAMETHROWER -> flamerPic it
FLAMETORRENT -> flamerPic it
FLAMEWALL -> flamerPic it
BLOWTORCH -> flamerPic it
SPARKGUN -> teslaGunPic
TESLAGUN -> teslaGunPic
LASGUN -> lasGunPic it
LASCIRCLE -> lasGunPic it
DUALBEAM -> dualBeamPic it
LASWIDE _ -> lasGunPic it
FORCEFIELDGUN -> defSPic
TORCH -> noPic torchShape
BANGSTICK i -> noPic $ baseStickShapeX it i <> stickClip it
PISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
REVOLVER -> noPic $ baseStickShape <> revolverClip it
REVOLVERX _ -> noPic $ baseStickShape <> revolverClip it
MACHINEPISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
AUTOPISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
SMG -> noPic (baseSMGShape <> makeTinClipAt 0 (V3 7 (-2) 0) it)
BANGCONE ->
noPic $
colorSH cyan $
upperPrismPoly 3 (rectXH 5 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 5 15)
BLUNDERBUSS ->
noPic $
colorSH cyan $
upperPrismPoly 3 (rectXH 20 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 20 30)
GRAPECANNON _ ->
noPic $
colorSH cyan $
upperPrismPoly 3 (rectXH 20 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 20 30)
MINIGUNX i -> miniGunXPictItem i it
VOLLEYGUN i -> volleyGunSPic i it
RIFLE -> noPic $ baseRifleShape <> makeSingleClipAt (V3 5 0 3) it
REPEATER -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
AUTORIFLE -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
BURSTRIFLE -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
BANGROD -> noPic $ baseRodShape <> makeSingleClipAt (V3 5 0 3) it
ELEPHANTGUN -> noPic $ baseAMRShape <> makeSingleClipAt (V3 5 0 3) it
AMR -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
AUTOAMR -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
SNIPERRIFLE -> noPic $ baseAMRShape <> makeSingleClipAt (V3 5 0 3) it
MACHINEGUN -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
FLAMESPITTER -> flamerPic it
FLAMETHROWER -> flamerPic it
FLAMETORRENT -> flamerPic it
FLAMEWALL -> flamerPic it
BLOWTORCH -> flamerPic it
SPARKGUN -> teslaGunPic
TESLAGUN -> teslaGunPic
LASGUN -> lasGunPic it
LASCIRCLE -> lasGunPic it
DUALBEAM -> dualBeamPic it
LASWIDE _ -> lasGunPic it
--SONICGUN -> noPic baseSonicShape
TRACTORGUN -> tractorGunPic it
LAUNCHER -> launcherPic it
LAUNCHERX _ -> launcherPic it
REMOTELAUNCHER -> launcherPic it
POISONSPRAYER -> flamerPic it
DRONELAUNCHER -> defSPic
SHATTERGUN -> shatterGunSPic
TRACTORGUN -> tractorGunPic it
LAUNCHER -> launcherPic it
LAUNCHERX _ -> launcherPic it
REMOTELAUNCHER -> launcherPic it
POISONSPRAYER -> flamerPic it
DRONELAUNCHER -> defSPic
SHATTERGUN -> shatterGunSPic
HELDDETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2)
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic)
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi / 2.5) keyPic)
torchShape :: Shape
torchShape = colorSH blue
$ translateSHf 0 1.5 side
<> translateSHf 0 (-1.5) side
<> translateSHz 2.5 top
<> translateSHz (-0.5) bot
<> back
torchShape =
colorSH blue $
translateSHf 0 1.5 side
<> translateSHf 0 (-1.5) side
<> translateSHz 2.5 top
<> translateSHz (-0.5) bot
<> back
where
side = upperPrismPoly 3 $ rectXH 10 0.5
top = upperPrismPoly 0.5 $ rectXH 10 2
bot = upperPrismPoly 0.5 $ rectXH 9 2
top = upperPrismPoly 0.5 $ rectXH 10 2
bot = upperPrismPoly 0.5 $ rectXH 9 2
back = upperPrismPoly 3 $ rectXH 1 2
modulesSPic :: Item -> ItemModuleType -> SPic
modulesSPic it imt = case imt of
ATTACHTORCH -> noPic (overPosSH (+.+.+ _dimAttachPos (_itDimension it)) torchShape)
_ -> mempty
baseStickShapeX :: Item -> Int -> Shape
baseStickShapeX it i = foldMap f [0..i-1]
baseStickShapeX it i = foldMap f [0 .. i -1]
where
f j = rotateSH ang baseStickShape
where
@@ -125,22 +144,25 @@ baseStickShape = colorSH green $ upperPrismPoly 3 $ rectXH 10 2
stickClip :: Item -> Shape
stickClip it = case it ^? itUse . heldConsumption . laLoaded of
Just x | x > 0 -> foldMap f [0..x-1]
Just x | x > 0 -> foldMap f [0 .. x -1]
_ -> mempty
where
f i = rotateSH ang $ translateSH (V3 5 0 3) $ upperPrismPoly 2 $ square 1.5
where
ang = barrelspread * fromIntegral i
- 0.5 * barrelspread * fromIntegral (_brlNum (_gunBarrels (_itParams it))-1)
ang =
barrelspread * fromIntegral i
- 0.5 * barrelspread * fromIntegral (_brlNum (_gunBarrels (_itParams it)) -1)
barrelspread = it ^?! itParams . gunBarrels . brlSpread . spreadAngle
defSPic :: SPic
defSPic = noPic $ colorSH green $ upperPrismPoly 3 $ square 4
shatterGunSPic :: SPic
shatterGunSPic = noPic $ colorSH blue $
upperPrismPoly 5 (rectNESW xb 8 xa 0)
<> upperPrismPoly 5 (rectNESW (-xa) 8 (-xb) 0)
shatterGunSPic =
noPic $
colorSH blue $
upperPrismPoly 5 (rectNESW xb 8 xa 0)
<> upperPrismPoly 5 (rectNESW (- xa) 8 (- xb) 0)
where
xa = 1
xb = 9
@@ -160,48 +182,60 @@ makeSingleClipAt p it = case it ^? itUse . heldConsumption . laLoaded of
_ -> translateSH p $ upperPrismPoly 1 $ square 1.5
makeTinClipAt :: Float -> Point3 -> Item -> Shape
makeTinClipAt r p it = translateSH p . overPosSH (rotate3z r) $ upperPrismPoly 1 $ reverse
$ rectNSWE 0 (-y) (-2) 2
makeTinClipAt r p it =
translateSH p . overPosSH (rotate3z r) $
upperPrismPoly 1 $
reverse $
rectNSWE 0 (- y) (-2) 2
where
y = fromIntegral y' * 0.3
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laLoaded
volleyGunSPic :: Int -> Item -> SPic
volleyGunSPic i it = noPic $
colorSH red (foldMap
((\y -> upperPrismPoly 3 $ map (+.+ V2 0 y) $ rectXH 15 2)
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5))) [0..i-1]
) <> caneClipX i it
volleyGunSPic i it =
noPic $
colorSH
red
( foldMap
( (\y -> upperPrismPoly 3 $ map (+.+ V2 0 y) $ rectXH 15 2)
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5))
)
[0 .. i -1]
)
<> caneClipX i it
caneClipX :: Int -> Item -> Shape
caneClipX i it = case it ^? itUse . heldConsumption . laLoaded of
Just la | la > 0 -> foldMap
( (\y -> translateSH (V3 5 0 3) . upperPrismPoly 1 $ map (+.+ V2 0 y) $ square 1.5)
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5)))
[0..la-1]
caneClipX i it = case it ^? itUse . heldConsumption . laLoaded of
Just la
| la > 0 ->
foldMap
( (\y -> translateSH (V3 5 0 3) . upperPrismPoly 1 $ map (+.+ V2 0 y) $ square 1.5)
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5))
)
[0 .. la -1]
_ -> mempty
miniGunXPictItem :: Int -> Item -> SPic
miniGunXPictItem i it = miniGunXPict i spin (_laLoaded $ _heldConsumption (_itUse it))
where
spin = (-10) * _laLoaded (_heldConsumption (_itUse it)) + _warmTime (_useDelay $ _itUse it)
spin = (-10) * _laLoaded (_heldConsumption (_itUse it)) + _warmTime (_heldDelay $ _itUse it)
miniGunXPict :: Int -> Int -> Int -> SPic
miniGunXPict i spin _ =
( colorSH red (rotateSHx a barrels)
miniGunXPict i spin _ =
( colorSH red (rotateSHx a barrels)
<> baseRifleShape
-- <> clip (-1) 0
-- <> clip (-7) 0
, mempty
, -- <> clip (-1) 0
-- <> clip (-7) 0
mempty
)
where
aBarrel = translateSH (V3 15 2 2) baseCaneShape
barrels = foldMap (\an -> aBarrel & rotateSHx (2*pi * fromIntegral an / fromIntegral i)) [1..i]
barrels = foldMap (\an -> aBarrel & rotateSHx (2 * pi * fromIntegral an / fromIntegral i)) [1 .. i]
a = fromIntegral spin / 100
--x = fromIntegral am / 10
-- clip y z = translateSH (V3 0 (-1) z) (rotateSHx (negate $ pi/4)
-- . upperPrismPoly 2
--x = fromIntegral am / 10
-- clip y z = translateSH (V3 0 (-1) z) (rotateSHx (negate $ pi/4)
-- . upperPrismPoly 2
-- $ rectNESW (negate $ 3 + 0.25 * x) y 3 (y-5))
baseSonicShape :: Shape
@@ -209,20 +243,20 @@ baseSonicShape = colorSH rose $ upperPrismPoly 3 $ rectXH 25 2
revolverClip :: Item -> Shape
revolverClip it = case it ^? itUse . heldConsumption . laLoaded of
Just al | al > 0 -> translateSH (V3 5 0 1) $ foldMap f [1..al]
Just al | al > 0 -> translateSH (V3 5 0 1) $ foldMap f [1 .. al]
_ -> mempty
where
f i = rotateSHx (fromIntegral i * pi / 3 + pi/6) . translateSH (V3 0 0 2) $ upperPrismPoly 1 $ square 1
f i = rotateSHx (fromIntegral i * pi / 3 + pi / 6) . translateSH (V3 0 0 2) $ upperPrismPoly 1 $ square 1
baseSMGShape :: Shape
baseSMGShape = colorSH green $ upperPrismPoly 3 $ rectXH 20 2
flamerPic :: Item -> SPic
flamerPic it =
( colorSH yellow $
flamerPic it =
( colorSH yellow $
translateSHf tx ty (upperPrismPoly tz $ polyCirc 3 r)
<> upperPrismPoly 5 (rectNESW 2 18 (-2) 0)
, color black $ translate3 (V3 tx ty (tz+0.01)) $ circleSolid (r * am)
<> upperPrismPoly 5 (rectNESW 2 18 (-2) 0)
, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * am)
)
where
tx = 4
@@ -232,94 +266,104 @@ flamerPic it =
am = fractionLoadedAmmo2 it
launcherPic :: Item -> SPic
launcherPic _ =
( colorSH cyan $ prismPoly
(map (+.+.+ V3 20 0 5) $ polyCircx 4 5)
(map (+.+.+ V3 0 0 5) $ polyCircx 4 5)
launcherPic _ =
( colorSH cyan $
prismPoly
(map (+.+.+ V3 20 0 5) $ polyCircx 4 5)
(map (+.+.+ V3 0 0 5) $ polyCircx 4 5)
, mempty
)
baseRodShape :: Shape
baseRodShape = colorSH orange $ upperPrismPoly 3 $ rectXH 20 2
baseAMRShape :: Shape
baseAMRShape = colorSH orange $ upperPrismPoly 3 $ rectXH 30 2
teslaGunPic :: SPic
teslaGunPic = noPic $ colorSH blue $
upperPrismPoly 5 (rectNESW xb 8 xa 0)
<> upperPrismPoly 5 (rectNESW (-xa) 8 (-xb) 0)
teslaGunPic =
noPic $
colorSH blue $
upperPrismPoly 5 (rectNESW xb 8 xa 0)
<> upperPrismPoly 5 (rectNESW (- xa) 8 (- xb) 0)
where
xa = 1
xb = 9
lasGunPic :: Item -> SPic
lasGunPic it =
( colorSH blue $
upperPrismPoly 4 (rectNESW 3 30 1 0)
<> upperPrismPoly 4 (rectNESW (-1) 30 (-3) 0)
<> upperPrismPoly 1 (rectNESW 3 30 (-3) 0)
lasGunPic it =
( colorSH blue $
upperPrismPoly 4 (rectNESW 3 30 1 0)
<> upperPrismPoly 4 (rectNESW (-1) 30 (-3) 0)
<> upperPrismPoly 1 (rectNESW 3 30 (-3) 0)
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0
)
where
amFrac = fractionLoadedAmmo it
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
dualBeamPic :: Item -> SPic
dualBeamPic it =
( colorSH blue $
upperPrismPoly 4 (rectNESW gap 3 (-gap) 1)
<> upperPrismPoly 4 (rectNESW gap (-1) (-gap) (-3))
<> upperPrismPoly 1 (rectNESW gap 3 (-gap) (-3))
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (-gap) (-1)
dualBeamPic it =
( colorSH blue $
upperPrismPoly 4 (rectNESW gap 3 (- gap) 1)
<> upperPrismPoly 4 (rectNESW gap (-1) (- gap) (-3))
<> upperPrismPoly 1 (rectNESW gap 3 (- gap) (-3))
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (- gap) (-1)
)
where
amFrac = fractionLoadedAmmo it
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
gap = _dbGap (_itParams it) - 3
tractorGunPic :: Item -> SPic
tractorGunPic it =
( colorSH red $
upperPrismPoly 4 (rectNESW 3 30 1 0)
<> upperPrismPoly 4 (rectNESW (-1) 30 (-3) 0)
<> upperPrismPoly 1 (rectNESW 3 30 (-3) 0)
tractorGunPic it =
( colorSH red $
upperPrismPoly 4 (rectNESW 3 30 1 0)
<> upperPrismPoly 4 (rectNESW (-1) 30 (-3) 0)
<> upperPrismPoly 1 (rectNESW 3 30 (-3) 0)
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0
)
where
amFrac = fractionLoadedAmmo it
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
flatShieldEquipSPic :: SPic
flatShieldEquipSPic =
flatShieldEquipSPic =
( colorSH yellow $ upperPrismPoly 10 (rectWH 2 10)
, mempty
)
headLampShape :: Shape
headLampShape = colorSH yellow $
translateSH (V3 5 2 4) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 2 0) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 (-2) 4) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 (-2) 0) (upperPrismPoly 4 $ rectWH 4 1)
headLampShape =
colorSH yellow $
translateSH (V3 5 2 4) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 2 0) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 (-2) 4) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 (-2) 0) (upperPrismPoly 4 $ rectWH 4 1)
detectorColor :: Detector -> Color
detectorColor dt = case dt of
ITEMDETECTOR -> blue
CREATUREDETECTOR -> green
WALLDETECTOR -> red
ITEMDETECTOR -> blue
CREATUREDETECTOR -> green
WALLDETECTOR -> red
keyPic :: Picture
keyPic = color green $
pictures [translate (-4) 0 $ thickCircle 4 2
,thickLine 2 $ map toV2 [(0,0),(8,0),(8,-4)]
,thickLine 2 $ map toV2 [(4,0),(4,-4)]
]
keyPic =
color green $
pictures
[ translate (-4) 0 $ thickCircle 4 2
, thickLine 2 $ map toV2 [(0, 0), (8, 0), (8, -4)]
, thickLine 2 $ map toV2 [(4, 0), (4, -4)]
]
latchkeyPic :: Picture
latchkeyPic = color yellow $
pictures [translate (-4) 0 $ thickCircle 4 2
,thickLine 2 $ map toV2 [(0,0),(8,0),(8,-4)]
,thickLine 2 $ map toV2 [(4,0),(4,-4)]
]
latchkeyPic =
color yellow $
pictures
[ translate (-4) 0 $ thickCircle 4 2
, thickLine 2 $ map toV2 [(0, 0), (8, 0), (8, -4)]
, thickLine 2 $ map toV2 [(4, 0), (4, -4)]
]
legsSPic :: Color -> SPic
legsSPic col = noPic $ translateSH (V3 0 4 0) $ colorSH col $ upperPrismPoly 3 $ rectWH 2 2
+17 -25
View File
@@ -1,6 +1,5 @@
module Dodge.Item.Equipment (
module Dodge.Item.Equipment.Booster,
torch,
magShield,
powerLegs,
wristInvisibility,
@@ -25,68 +24,61 @@ magShield :: Item
magShield =
defaultEquipment
& itParams .~ MagShieldParams Nothing
& itUse . eqEq . eqUse .~ EMagShield
& itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . equipEffect . eeUse .~ EMagShield
& itUse . equipEffect . eeSite .~ GoesOnWrist
& itType . iyBase .~ EQUIP MAGSHIELD
flameShield :: Item
flameShield =
defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnChest
& itUse . equipEffect . eeSite .~ GoesOnChest
& itType . iyBase .~ EQUIP FLAMESHIELD
frontArmour :: Item
frontArmour =
defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnChest
& itUse . equipEffect . eeSite .~ GoesOnChest
& itType . iyBase .~ EQUIP FRONTARMOUR
wristArmour :: Item
wristArmour =
defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . eqEq . eqOnEquip .~ EonWristShield
& itUse . eqEq . eqUse .~ EWristShield
& itUse . eqEq . eqOnRemove .~ EoffWristShield
& itUse . equipEffect . eeSite .~ GoesOnWrist
& itUse . equipEffect . eeOnEquip .~ EonWristShield
& itUse . equipEffect . eeUse .~ EWristShield
& itUse . equipEffect . eeOnRemove .~ EoffWristShield
& itType . iyBase .~ EQUIP WRISTARMOUR
torch :: Item
torch =
defaultWeapon
& itEffect . ieInv .~ EffectWhileHeld CreateHeldLight
& itType . iyBase .~ HELD TORCH
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 10
jetPack :: Item
jetPack =
defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnBack
& itUse . equipEffect . eeSite .~ GoesOnBack
& itType . iyBase .~ EQUIP JETPACK
brainHat :: Item
brainHat =
defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnHead
& itUse . equipEffect . eeSite .~ GoesOnHead
& itType . iyBase .~ EQUIP BRAINHAT
hat :: Item
hat =
defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnHead
& itUse . equipEffect . eeSite .~ GoesOnHead
& itType . iyBase .~ EQUIP HAT
headLamp :: Item
headLamp =
defaultEquipment
& itUse . eqEq . eqUse .~ EHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead
& itUse . equipEffect . eeUse .~ EHeadLamp
& itUse . equipEffect . eeSite .~ GoesOnHead
& itType . iyBase .~ EQUIP HEADLAMP
powerLegs :: Item
powerLegs =
defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnLegs
& itUse . equipEffect . eeSite .~ GoesOnLegs
& itType . iyBase .~ EQUIP POWERLEGS
speedLegs :: Item
@@ -102,7 +94,7 @@ jumpLegs =
wristInvisibility :: Item
wristInvisibility =
defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . eqEq . eqOnEquip .~ ECamouflage Invisible --overCID (crCamouflage .~ Invisible)
& itUse . eqEq . eqOnRemove .~ ECamouflage FullyVisible --overCID (crCamouflage .~ FullyVisible)
& itUse . equipEffect . eeSite .~ GoesOnWrist
& itUse . equipEffect . eeOnEquip .~ ECamouflage Invisible --overCID (crCamouflage .~ Invisible)
& itUse . equipEffect . eeOnRemove .~ ECamouflage FullyVisible --overCID (crCamouflage .~ FullyVisible)
& itType . iyBase .~ EQUIP (INVISIBILITYEQUIPMENT GoesOnWrist)
+3 -9
View File
@@ -4,17 +4,11 @@ module Dodge.Item.Equipment.Booster (
import Control.Lens
import Dodge.Data.Item
import Dodge.Default.Weapon
import Picture
import Dodge.Default.Item
boosterGun :: Item
boosterGun =
defaultLeftItem
{ _itInvColor = cyan
, _itUse = luseInstantNoH LBoost
-- , _itEffect = resetAttachmentID
}
& itUse . leftUse .~ LBoost
& itUse . leftDelay .~ NoDelay
& itType . iyBase .~ LEFT BOOSTER
--resetAttachmentID :: ItEffect
--resetAttachmentID = ItInvEffect ResetAttachmentEffect 0
+8 -7
View File
@@ -1,23 +1,24 @@
module Dodge.Item.Equipment.Shape where
import Dodge.Data
import Dodge.Creature.HandPos
import ShapePicture
import LensHelp
import Data.Maybe
import Dodge.Creature.HandPos
import Dodge.Data.Creature
import LensHelp
import ShapePicture
pictureOnEquip :: SPic -> Creature -> Item -> SPic
pictureOnEquip sp cr itm = fromMaybe mempty $ do
i <- itm ^? itLocation . ipInvID
epos <- cr^? crInvEquipped . ix i
epos <- cr ^? crInvEquipped . ix i
return $ equipPosition epos cr sp
equipPosition :: EquipPosition -> Creature -> SPic -> SPic
equipPosition epos cr sh = case epos of
OnLeftWrist -> translateToLeftWrist cr sh
OnRightWrist -> translateToRightWrist cr sh
OnLegs -> translateToLeftLeg cr sh <>
translateToRightLeg cr (mirrorSPxz sh)
OnLegs ->
translateToLeftLeg cr sh
<> translateToRightLeg cr (mirrorSPxz sh)
OnHead -> translateToHead cr sh
OnChest -> translateToChest cr sh
OnBack -> translateToBack cr sh
+70 -23
View File
@@ -1,24 +1,71 @@
module Dodge.Item.Held
where
import Dodge.Default.Weapon
import Dodge.Data.Item
import Control.Lens
flatShield :: Item
flatShield =
defaultWeapon
& itEffect . ieInv .~ EffectIfHeld CreateShieldWall RemoveShieldWall
& itUse
.~ defaultrUse
{ _useAim =
AimParams
{ _aimWeight = 5
, _aimRange = 0
, _aimZoom = ItZoom 20 0.2 1
, _aimStance = TwoHandFlat
, _aimHandlePos = 0
, _aimMuzPos = 0
}
}
& itInvSize .~ 3
& itType . iyBase .~ HELD FLATSHIELD
module Dodge.Item.Held (
module Dodge.Item.Held,
module Dodge.Item.Held.Utility,
module Dodge.Item.Held.Launcher,
module Dodge.Item.Held.Weapons,
module Dodge.Item.Held.Stick,
module Dodge.Item.Held.Cone,
module Dodge.Item.Held.Cane,
module Dodge.Item.Held.Rod,
module Dodge.Item.Held.SprayGuns,
module Dodge.Item.Held.BatteryGuns,
) where
import Dodge.Data.Item
import Dodge.Item.Held.Launcher
import Dodge.Item.Held.BatteryGuns
import Dodge.Item.Held.Utility
import Dodge.Item.Held.Weapons
import Dodge.Item.Held.Stick
import Dodge.Item.Held.Cone
import Dodge.Item.Held.Cane
import Dodge.Item.Held.Rod
import Dodge.Item.Held.SprayGuns
itemFromHeldType :: HeldItemType -> Item
itemFromHeldType ht = case ht of
KEYCARD i -> keyCard i
TORCH -> torch
SHATTERGUN -> shatterGun
BANGSTICK i -> bangStick i
PISTOL -> pistol
REVOLVER -> revolver
REVOLVERX i -> revolverX i
MACHINEPISTOL -> machinePistol
AUTOPISTOL -> autoPistol
SMG -> smg
BANGCONE -> bangCone
BLUNDERBUSS -> blunderbuss
GRAPECANNON i -> grapeCannon i
MINIGUNX i -> miniGunX i
VOLLEYGUN i -> volleyGun i
RIFLE -> rifle
REPEATER -> repeater
AUTORIFLE -> autoRifle
BURSTRIFLE -> burstRifle
BANGROD -> bangRod
ELEPHANTGUN -> elephantGun
AMR -> amr
AUTOAMR -> autoAmr
SNIPERRIFLE -> sniperRifle
MACHINEGUN -> machineGun
FLAMESPITTER -> flameSpitter
FLAMETHROWER -> flameThrower
FLAMETORRENT -> flameTorrent
FLAMEWALL -> flameWall
BLOWTORCH -> blowTorch
SPARKGUN -> sparkGun
TESLAGUN -> teslaGun
LASGUN -> lasGun
LASCIRCLE -> lasCircle
DUALBEAM -> dualBeam
LASWIDE i -> lasWide i
TRACTORGUN -> tractorGun
LAUNCHER -> launcher
LAUNCHERX i -> launcherX i
REMOTELAUNCHER -> remoteLauncher
POISONSPRAYER -> poisonSprayer
DRONELAUNCHER -> undefined
FORCEFIELDGUN -> forceFieldGun
HELDDETECTOR d -> clickDetector d
FLATSHIELD -> flatShield
+170
View File
@@ -0,0 +1,170 @@
module Dodge.Item.Held.BatteryGuns where
import Dodge.Data.Beam
import Dodge.Default.Item
import Color
import Control.Lens
import qualified Data.Map.Strict as M
import Dodge.Data.Item
import Dodge.Reloading.Action
import Dodge.Tesla.ItemParams
import Geometry.Data
import qualified IntMapHelp as IM
sparkGun :: Item
sparkGun =
teslaGun
& itType . iyBase .~ HELD SPARKGUN
& itParams . arcSize .~ 10
teslaGun :: Item
teslaGun =
defaultBatteryGun
& itUse . heldConsumption . laMax .~ 200
& itUse . heldConsumption . laCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
& itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 4 0 0
& itParams .~ teslaParams
& itUse . heldUse .~ HeldTeslaArc --shootTeslaArc
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ TeslaMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimHandlePos .~ 4
& itUse . heldAim . aimMuzPos .~ 4
& itType . iyBase .~ HELD TESLAGUN
lasGun :: Item
lasGun =
defaultAutoBatteryGun
& itUse . heldConsumption
.~ ( defaultLoadable
& laMax .~ 200
& laCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
)
& itParams
.~ Refracting
{ _phaseV = 1
, _lasColor = yellow
, _lasColor2 = yellow
, _lasCycle = 0
, _lasDamage = 11
}
& itTweaks
.~ Tweakable
{ _tweakParams = IM.fromList [(0, lasGunTweak)]
}
& itDimension . dimRad .~ 10
& itDimension . dimCenter .~ V3 15 0 0
& itUse . heldUse .~ HeldLaser --shootLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ LasMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandTwist
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD LASGUN
lasGunTweak :: TweakParam
lasGunTweak =
TweakParam
{ _tweakType = TweakPhaseV
, _tweakVal = 1
, _tweakMax = 3
}
tractorGun :: Item
tractorGun =
lasGun
& itUse . heldConsumption
.~ ( defaultLoadable
& laMax .~ 10000
& laCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
)
& itParams .~ Attracting{_attractionPower = 1}
& itTweaks
.~ Tweakable
{ _tweakParams = IM.fromList [(0, tractorGunTweak)]
}
& itUse . heldUse .~ HeldTractor --aTractorBeam
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ AmmoCheckMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandTwist
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD TRACTORGUN
tractorGunTweak :: TweakParam
tractorGunTweak =
TweakParam
{ _tweakType = TweakTractionPower
, _tweakVal = 1
, _tweakMax = 4
}
lasWide :: Int -> Item
lasWide n =
lasGun
& itType . iyBase .~ HELD (LASWIDE n)
& itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2
& itUse . heldMods .~ LasWideMod n
defaultBatteryGun :: Item
defaultBatteryGun =
defaultHeldItem
& itType . iyModules .~ batteryModules
batteryModules :: M.Map ModuleSlot ItemModuleType
batteryModules =
M.fromList
[ (ModBattery, EMPTYMODULE)
, (ModTeleport, EMPTYMODULE)
]
defaultAutoBatteryGun :: Item
defaultAutoBatteryGun =
defaultHeldItem
& itType . iyModules .~ batteryModules
lasCircle :: Item
lasCircle =
lasGun
& itType . iyBase .~ HELD LASCIRCLE
& itParams . lasColor .~ orange
& itParams . lasDamage .~ 2
& itUse . heldConsumption . laMax .~ 10000
& itUse . heldUse .~ HeldLaser --shootLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldUse .~ HeldCircleLaser --circleLaser
& itUse . heldMods .~ CircleLaserMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandTwist
dualBeam :: Item
dualBeam =
lasGun
& itType . iyBase .~ HELD DUALBEAM
& itUse . heldAim . aimMuzPos .~ 0
& itParams
.~ DualBeam
{ _phaseV = 1
, _lasColor = red
, _lasColor2 = green
, _lasCycle = 0
, _lasDamage = 11
, _lasBeam = BeamCombine LasBeamCombine
, _subParams = Nothing
, _dbGap = 20
}
& itUse . heldUse .~ HeldDualLaser --shootDualLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ DualBeamMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
+3
View File
@@ -0,0 +1,3 @@
module Dodge.Item.Held.BulletGun
where
@@ -1,4 +1,4 @@
module Dodge.Item.Weapon.BulletGun.Cane (
module Dodge.Item.Held.Cane (
volleyGun,
repeater,
rifle,
@@ -7,10 +7,10 @@ module Dodge.Item.Weapon.BulletGun.Cane (
miniGunX,
) where
import Dodge.Data
import Dodge.Data.Item
import Dodge.Default
import Dodge.Reloading.Action
import Geometry
import Geometry.Data
import LensHelp
defaultBangCane :: Item
@@ -31,26 +31,25 @@ defaultBangCane =
}
& itDimension . dimRad .~ 8
& itDimension . dimCenter .~ V3 5 0 0
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ BangCaneMod
& itUse . useAim . aimStance .~ OneHand
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 15
& itType . iyBase .~ error "undefined bangCane baseitemtype"
& itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ BangCaneMod
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 15
& itUse . heldConsumption . laMax .~ 1
& itUse . heldConsumption . laCycle .~ [loadPartialInsert 10 1]
volleyGun :: Int -> Item
volleyGun i =
defaultBangCane
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ VolleyGunMod
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandFlat
& itUse . useAim . aimZoom .~ defaultItZoom{_itZoomFac = 1.5}
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 15
& itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ VolleyGunMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimZoom .~ defaultItZoom{_itZoomFac = 1.5}
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 15
& itUse . heldConsumption . laMax .~ i
& itParams
.~ BulletShooter
@@ -77,13 +76,13 @@ volleyGun i =
rifle :: Item
rifle =
defaultBangCane
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . heldAim . aimStance .~ TwoHandTwist
& itType . iyBase .~ HELD RIFLE
& itUse . heldConsumption . laMax .~ 1
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 5, loadPrime 5]
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimZoom .~ defaultItZoom{_itZoomFac = 2}
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_itZoomFac = 2}
& itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE
repeater :: Item
@@ -98,7 +97,7 @@ autoRifle :: Item
autoRifle =
repeater
& itType . iyBase .~ HELD AUTORIFLE
& itUse . useMods .~ AutoRifleMod
& itUse . heldMods .~ AutoRifleMod
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
-- & itUse . useDelay . rateMax .~ 6
@@ -107,32 +106,31 @@ burstRifle =
repeater
& itType . iyBase .~ HELD BURSTRIFLE
& itParams . gunBarrels . brlInaccuracy .~ 0.05
& itUse . useDelay . rateMax .~ 18
& itUse . useMods .~ BurstRifleMod
& itUse . heldDelay . rateMax .~ 18
& itUse . heldMods .~ BurstRifleMod
miniGunUse :: Int -> ItemUse
miniGunUse i =
defaultrUse
& rUse .~ HeldUseAmmoParams
& useDelay .~ NoDelay
& useMods .~ MiniGunMod i
miniGunX :: Int -> Item
miniGunX i =
defaultAutoGun
{ _itUse =
miniGunUse i
& useDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100}
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom{_itZoomFac = 1.5}
defaultHeldUse
& heldUse .~ HeldUseAmmoParams
& heldMods .~ MiniGunMod i
& heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100}
& heldAim . aimWeight .~ 6
& heldAim . aimRange .~ 1
& heldAim . aimStance .~ TwoHandTwist
& heldAim . aimZoom .~ defaultItZoom{_itZoomFac = 1.5}
& heldConsumption
.~ defaultBulletLoadable
{ _laMax = 1500
, _laLoaded = 1500
}
& heldConsumption . laCycle .~ [loadEject 40, loadInsert 40, loadPrime 40]
miniGunX :: Int -> Item
miniGunX i =
autoRifle
{ _itUse =
miniGunUse i
, _itParams =
BulletShooter
{ _muzVel = 1
@@ -154,4 +152,4 @@ miniGunX i =
& itDimension . dimCenter .~ V3 5 0 0
& itDimension . dimAttachPos .~ V3 5 (-5) 0
& itType . iyBase .~ HELD (MINIGUNX i)
& itUse . useAim . aimMuzPos .~ 40
& itUse . heldAim . aimMuzPos .~ 40
+52
View File
@@ -0,0 +1,52 @@
module Dodge.Item.Held.Cone
where
import Dodge.Default.Item
import Dodge.Data.Item
import Dodge.Reloading.Action
import Control.Lens
import Geometry.Data
bangCone :: Item
bangCone =
defaultBulletWeapon
{ _itParams =
BulletShooter
{ _muzVel = 0.7
, _rifling = 0.8
, _bore = 5
, _gunBarrels = SingleBarrel 0.5
, _recoil = 150
, _torqueAfter = 0.1
, _randomOffset = 12
}
}
& itDimension . dimRad .~ 8
& itDimension . dimCenter .~ V3 5 0 0
& itUse . heldDelay . rateMax .~ 20
& itUse . heldMods .~ BangConeMod
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 15
& itType . iyBase .~ HELD BANGCONE
& itUse . heldConsumption . laMax .~ 5
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 20, loadPrime 5]
blunderbuss :: Item
blunderbuss =
bangCone
& itUse . heldConsumption . laMax .~ 25
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 30, loadPrime 5]
& itUse . heldAim . aimStance .~ TwoHandTwist
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD BLUNDERBUSS
grapeCannon :: Int -> Item
grapeCannon i =
blunderbuss
& itType . iyBase .~ HELD (GRAPECANNON i)
& itUse . heldConsumption . laMax .~ 25 + 25 * i
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert (30 + i * 10), loadPrime 5]
& itParams . recoil .~ (150 + fromIntegral i * 50)
& itParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
& itParams . randomOffset .~ (12 + 4 * fromIntegral i)
+94
View File
@@ -0,0 +1,94 @@
module Dodge.Item.Held.Launcher where
import Dodge.Default.Item
import Dodge.Reloading.Action
import Control.Lens
import Dodge.Data.Item
import qualified IntMapHelp as IM
import Geometry.Data
launcher :: Item
launcher =
defaultHeldItem
& itParams
.~ ShellLauncher
{ _shellSpinDrag = 1
, _shellSpinAmount = 2
, _shellThrustDelay = 20
}
& itTweaks
.~ Tweakable
{ _tweakParams = basicAmPjMoves
}
& itInvSize .~ 3
& itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 10 0 0
& itUse . heldDelay . rateMax .~ 20
& itUse . heldUse .~ HeldPJCreation --usePjCreation
& itUse . heldMods .~ LauncherMod
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandTwist
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 20
& itUse . heldConsumption . laAmmoType
.~ ProjectileAmmo
{ _amPayload = ExplosionPayload
, _amString = "EXPLOSIVE SHELL"
, _amPjDraw = DrawShell
, _amPjCreation = CreateShell
}
& itUse . heldConsumption . laMax .~ 1
& itUse . heldConsumption . laLoaded .~ 1
& itUse . heldConsumption . laCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
& itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
launcherX :: Int -> Item
launcherX i =
launcher
& itType . iyBase .~ HELD (LAUNCHERX i)
& itUse . heldConsumption . laMax .~ i
& itUse . heldConsumption . laLoaded .~ i
& itUse . heldUse .~ HeldPJCreationX i
& itUse . heldMods .~ LauncherXMod i
remoteLauncher :: Item
remoteLauncher =
launcher
& itType . iyBase .~ HELD REMOTELAUNCHER
& itUse . heldUse .~ HeldFireRemoteShell --fireRemoteShell
& itScope .~ RemoteScope (V2 0 0) 1 True
& itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell
basicAmPjMoves :: IM.IntMap TweakParam
basicAmPjMoves =
IM.fromList . zip [0 ..] $
[ spinDrag
, spinStart
, thrustParam
]
spinDrag :: TweakParam
spinDrag =
TweakParam
{ _tweakType = TweakSpinDrag
, _tweakVal = 1
, _tweakMax = 5
}
spinStart :: TweakParam
spinStart =
TweakParam
{ _tweakType = TweakSpinAmount
, _tweakVal = 2
, _tweakMax = 5
}
thrustParam :: TweakParam
thrustParam =
TweakParam
{ _tweakType = TweakThrustDelay
, _tweakVal = 1
, _tweakMax = 5
}
+93
View File
@@ -0,0 +1,93 @@
module Dodge.Item.Held.Rod (
bangRod,
elephantGun,
amr,
autoAmr,
sniperRifle,
machineGun,
) where
import Dodge.Item.Targeting
import Dodge.Data.Item
import Dodge.Default
import Dodge.Item.Weapon.Bullet
import Dodge.Reloading.Action
import Geometry
import LensHelp
bangRod :: Item
bangRod =
defaultBulletWeapon
& itParams
.~ BulletShooter
{ _muzVel = 0.8
, _rifling = 1
, _bore = 2
, _gunBarrels = SingleBarrel 0.1
, _recoil = 50
, _torqueAfter = 0.3
, _randomOffset = 0
}
& itUse . heldDelay . rateMax .~ 12
& itUse . heldMods .~ BangRodMod
& itDimension . dimRad .~ 12
& itDimension . dimCenter .~ V3 5 0 0
& itUse . heldConsumption . laMax .~ 1
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 10, loadPrime 5]
& itType . iyBase .~ HELD BANGROD
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimZoom .~ defaultItZoom{_itZoomFac = 1.5}
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 30
& itUse . heldConsumption . laAmmoType .~ hvBullet
elephantGun :: Item
elephantGun =
bangRod
& itType . iyBase .~ HELD ELEPHANTGUN
& itUse . heldAim . aimStance .~ TwoHandTwist
& itParams . gunBarrels .~ SingleBarrel 0.05
& itUse . heldMods .~ ElephantGunMod
& itParams . recoil .~ 50
& itParams . torqueAfter .~ 0.1
amr :: Item
amr =
elephantGun
& itType . iyBase .~ HELD AMR
& itUse . heldConsumption . laMax .~ 15
autoAmr :: Item
autoAmr =
amr
& itType . iyBase .~ HELD AUTOAMR
& itUse . heldMods .~ AutoAmrMod
sniperRifle :: Item
sniperRifle =
elephantGun
& itType . iyBase .~ HELD SNIPERRIFLE
& itParams . gunBarrels .~ SingleBarrel 0
& itUse . heldAim . aimZoom .~ defaultItZoom{_itZoomMax = 0.5, _itZoomMin = 0.5}
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
& itScope .~ ZoomScope (V2 0 0) 0 1 0.5 False
& itTargeting .~ targetLaser
& itUse . heldAim . aimZoom .~ defaultItZoom{_itZoomFac = 1}
machineGun :: Item
machineGun =
bangRod
& itType . iyBase .~ HELD MACHINEGUN
& itUse . heldDelay . rateMax .~ 25
& itUse . heldMods .~ MachineGunMod
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandTwist
& itUse . heldAim . aimZoom .~ defaultItZoom{_itZoomFac = 1.5}
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
& itUse . heldConsumption . laMax .~ 100
& itUse . heldConsumption . laCycle .~ [loadEject 10, loadInsert 40, loadPrime 10]
& itInvSize .~ 3
& itParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
@@ -1,4 +1,4 @@
module Dodge.Item.Weapon.SprayGuns (
module Dodge.Item.Held.SprayGuns (
poisonSprayer,
flameSpitter,
blowTorch,
@@ -7,8 +7,8 @@ module Dodge.Item.Weapon.SprayGuns (
flameWall,
) where
import Dodge.Data
import Dodge.Default
import Dodge.Data.Item
import Dodge.Default.Item
import Dodge.Reloading.Action
import Geometry
import LensHelp
@@ -22,7 +22,7 @@ poisonSprayer =
{ _amString = "POISONGAS"
, _amCreateGas = CreatePoisonGas --aGasCloud
}
& itUse . useMods .~ PoisonSprayerMod
& itUse . heldMods .~ PoisonSprayerMod
flameSpitter :: Item
flameSpitter =
@@ -31,15 +31,15 @@ flameSpitter =
& itUse . heldConsumption . laMax .~ 10
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
& itUse . useAim . aimStance .~ OneHand
& itUse . useDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
& itUse . useMods .~ FlameSpitterMod
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
& itUse . heldMods .~ FlameSpitterMod
flameTorrent :: Item
flameTorrent =
flameThrower
& itType . iyBase .~ HELD FLAMETORRENT
& itUse . useAim . aimZoom .~ defaultItZoom
& itUse . heldAim . aimZoom .~ defaultItZoom
& itParams . sprayNozzles . ix 0
%~ ( (nzPressure .~ 10)
. (nzMaxWalkAngle .~ 1.5)
@@ -69,7 +69,7 @@ flameWall =
flameThrower :: Item
flameThrower =
defaultAutoGun
defaultHeldItem
{ _itParams =
Sprayer
{ _sprayNozzles =
@@ -86,14 +86,14 @@ flameThrower =
}
& itDimension . dimRad .~ 7
& itDimension . dimCenter .~ V3 9 0 0
& itUse . rUse .~ HeldOverNozzlesUseGasParams -- overNozzles useGasParams
& itUse . useDelay .~ NoDelay
& itUse . useMods .~ FlameThrowerMod
& itUse . useAim . aimWeight .~ 5
& itUse . useAim . aimZoom .~ defaultItZoom{_itZoomMax = 5, _itZoomMin = 1.5}
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 0
& itUse . useAim . aimMuzPos .~ 18
& itUse . heldUse .~ HeldOverNozzlesUseGasParams -- overNozzles useGasParams
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ FlameThrowerMod
& itUse . heldAim . aimWeight .~ 5
& itUse . heldAim . aimZoom .~ defaultItZoom{_itZoomMax = 5, _itZoomMin = 1.5}
& itUse . heldAim . aimStance .~ TwoHandTwist
& itUse . heldAim . aimHandlePos .~ 0
& itUse . heldAim . aimMuzPos .~ 18
& itUse . heldConsumption
.~ ( defaultLoadable
& laMax .~ 250
+110
View File
@@ -0,0 +1,110 @@
module Dodge.Item.Held.Stick (
bangStick,
pistol,
autoPistol,
machinePistol,
smg,
revolver,
revolverX,
) where
import Dodge.Data.Item
import Dodge.Default.Item
import Dodge.Reloading.Action
import Geometry
import LensHelp
bangStick :: Int -> Item
bangStick i =
defaultBulletWeapon
& itParams
.~ BulletShooter
{ _muzVel = 0.8
, _rifling = 0.8
, _bore = 2
, _gunBarrels =
MultiBarrel
{ _brlNum = i
, _brlSpread = SpreadBarrels baseStickSpread
, _brlInaccuracy = 0.01
}
, _recoil = 25
, _torqueAfter = 0.18 + 0.02 * fromIntegral i
, _randomOffset = 0
}
& itType . iyBase .~ HELD (BANGSTICK i)
& itInvSize .~ fromIntegral i / 3
& itDimension . dimRad .~ 5
& itDimension . dimCenter .~ V3 5 0 0
& itUse . heldDelay . rateMax .~ 8
& itUse . heldMods .~ BangStickMod
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 10
& itUse . heldConsumption . laMax .~ i
& itUse . heldConsumption . laCycle .~ [loadPartialInsert 10 1]
baseStickSpread :: Float
baseStickSpread = 0.2
revolver :: Item
revolver =
pistol
& itUse . heldConsumption
.~ ( defaultBulletLoadable
& laMax .~ 6
& laCycle .~ [loadPartialInsert 10 1]
)
& itType . iyBase .~ HELD REVOLVER
pistol :: Item
pistol =
bangStick 1
& itUse . heldConsumption
.~ ( defaultBulletLoadable
& laMax .~ 15
& laCycle .~ [loadEject 5, loadInsert 5, loadPrime 5]
)
& itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ PistolMod
& itParams
%~ ( (muzVel .~ 0.8)
. (rifling .~ 0.8)
. (bore .~ 2)
. (gunBarrels .~ SingleBarrel 0.05)
. (recoil .~ 10)
. (torqueAfter .~ 0.2)
)
& itType . iyBase .~ HELD PISTOL
autoPistol :: Item
autoPistol =
pistol
& itUse . heldMods .~ AutoPistolMod
& itType . iyBase .~ HELD AUTOPISTOL
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
machinePistol :: Item
machinePistol =
autoPistol
& itUse . heldDelay . rateMax .~ 2
& itUse . heldMods .~ MachinePistolMod -- (ammoCheckI : machinePistolAfterHamMods)
& itType . iyBase .~ HELD MACHINEPISTOL
& itType . iyModules . at ModAutoMag .~ Nothing
& itParams . recoil .~ 20
smg :: Item
smg =
autoPistol -- & some parameter affecting stability
& itUse . heldMods .~ SmgMod --(ammoCheckI : smgAfterHamMods)
& itType . iyBase .~ HELD SMG
& itUse . heldAim . aimStance .~ TwoHandTwist
& itUse . heldAim . aimHandlePos .~ 2
& itParams . torqueAfter .~ 0.05
revolverX :: Int -> Item
revolverX i =
revolver
& itUse . heldDelay . rateMax .~ 8
& itUse . heldMods .~ RevolverXMod
& itUse . heldConsumption . laMax .~ i * 6
& itType . iyBase .~ HELD (REVOLVERX i)
+68
View File
@@ -0,0 +1,68 @@
module Dodge.Item.Held.Utility where
import Dodge.Item.Targeting
import Dodge.Default.Item
import Color
import Control.Lens
import Dodge.Data.Item
flatShield :: Item
flatShield =
defaultHeldItem
& itEffect . ieInv .~ EffectIfHeld CreateShieldWall RemoveShieldWall
& itUse . heldAim
.~ AimParams
{ _aimWeight = 5
, _aimRange = 0
, _aimZoom = ItZoom 20 0.2 1
, _aimStance = TwoHandFlat
, _aimHandlePos = 0
, _aimMuzPos = 0
}
& itInvSize .~ 3
& itType . iyBase .~ HELD FLATSHIELD
keyCard :: Int -> Item
keyCard n =
defaultHeldItem
& itInvColor .~ aquamarine
& itType . iyBase .~ HELD (KEYCARD n)
latchkey :: Int -> Item
latchkey _ =
defaultHeldItem
& itInvColor .~ yellow
torch :: Item
torch =
defaultHeldItem
& itEffect . ieInv .~ EffectWhileHeld CreateHeldLight
& itType . iyBase .~ HELD TORCH
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 10
forceFieldGun :: Item
forceFieldGun =
defaultWeapon
& itTargeting .~ (targetRBPress & tgDraw .~ TargetDistanceDraw)
& itParams .~ ParamMID Nothing
& itUse . heldUse .~ HeldForceField --useForceFieldGun
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN
& itUse . heldConsumption .~ (defaultLoadable & laAmmoType .~ ForceFieldAmmo DefaultForceField)
{- |
Sends out pulses that display walls.
-}
clickDetector :: Detector -> Item
clickDetector dt =
defaultWeapon
& itUse . heldDelay . rateMax .~ 20
& itUse . heldUse .~ HeldDetectorEffect dt --detectorEffect dt
& itUse . heldMods .~ AmmoUseCheckMod
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_itZoomFac = 1}
& itType . iyBase .~ HELD (HELDDETECTOR dt)
+14
View File
@@ -0,0 +1,14 @@
module Dodge.Item.Held.Weapons where
import Dodge.Default.Item
import Dodge.Data.Item
import Control.Lens
shatterGun :: Item
shatterGun =
defaultHeldItem
& itType . iyBase .~ HELD SHATTERGUN
& itUse . heldDelay . rateMax .~ 10
& itUse . heldUse .~ HeldShatter --shootShatter
& itUse . heldMods .~ ShatterMod
& itUse . heldAim . aimStance .~ TwoHandFlat
+31 -30
View File
@@ -1,53 +1,54 @@
module Dodge.Item.HeldOffset where
import Dodge.Data
import Dodge.Creature.HandPos
import Geometry
import LensHelp
import Data.Maybe
import Dodge.Creature.HandPos
import Dodge.Data.Creature
import Geometry
import LensHelp
heldItemOffset :: Item -> Creature -> Point3 -> Point3
heldItemOffset itm cr
| isSelected && _posture (_crStance cr) == Aiming =
(+.+.+ V3 (aimingWeaponZeroPos cr itm) 0 shoulderD)
| isSelected && isTwoHandFlat
= (+.+.+ V3 (_crRad cr) 0 handD)
. rotate3 (twoFlatHRot cr)
. transToHandle
| isSelected && isOneHand
= (+.+.+ V3 0 0 handD)
. (+.+.+ V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) 0)
. (+.+.+ V3 (-2) 0 0)
. transToHandle
| isSelected
= (+.+.+ V3 0 0 handD)
. (+.+.+ V3 (_crRad cr) 0 0)
. rotate3 (strideRot cr + 1.2)
. (+.+.+ V3 (-5) 0 0)
-- . (+.+.+ V3 (-5) 0 0)
. transToHandle
(+.+.+ V3 (aimingWeaponZeroPos cr itm) 0 shoulderD)
| isSelected && isTwoHandFlat =
(+.+.+ V3 (_crRad cr) 0 handD)
. rotate3 (twoFlatHRot cr)
. transToHandle
| isSelected && isOneHand =
(+.+.+ V3 0 0 handD)
. (+.+.+ V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) 0)
. (+.+.+ V3 (-2) 0 0)
. transToHandle
| isSelected =
(+.+.+ V3 0 0 handD)
. (+.+.+ V3 (_crRad cr) 0 0)
. rotate3 (strideRot cr + 1.2)
. (+.+.+ V3 (-5) 0 0)
-- . (+.+.+ V3 (-5) 0 0)
. transToHandle
| otherwise = id
where
where
transToHandle = fromMaybe id $ do
x <- itm ^? itUse . useAim . aimHandlePos
x <- itm ^? itUse . heldAim . aimHandlePos
return (-.-.- V3 x 0 0)
shoulderD = 18
handD = 15
isSelected = _itIsHeld itm
handPos = case cr^? crStance . carriage of
handPos = case cr ^? crStance . carriage of
Just (Walking x LeftForward) -> f x * 50
_ -> 0
theIt = itm
isOneHand = theIt ^? itUseAimStance == Just OneHand
|| isNothing (theIt ^? itUseAimStance)
isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat
itUseAimStance = itUse . useAim . aimStance
isOneHand =
theIt ^? itUseAimStance == Just OneHand
|| isNothing (theIt ^? itUseAimStance)
isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat
itUseAimStance = itUse . heldAim . aimStance
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr
strideRot :: Creature -> Float
strideRot cr = case cr ^? crStance . carriage of
Just (Walking x LeftForward) -> f x
Just (Walking x LeftForward) -> f x
Just (Walking x RightForward) -> - f x
_ -> 0
where
@@ -55,4 +56,4 @@ strideRot cr = case cr ^? crStance . carriage of
sLen = _strideLength $ _crStance cr
twoFlatHRot :: Creature -> Float
twoFlatHRot cr = 2*strideRot cr
twoFlatHRot cr = 2 * strideRot cr
+3
View File
@@ -0,0 +1,3 @@
module Dodge.Item.Left
where
+18 -9
View File
@@ -1,19 +1,20 @@
module Dodge.Item.Location where
import Dodge.Data
import qualified IntMapHelp as IM
import Control.Lens
import Data.Maybe
import Dodge.Data.World
import qualified IntMapHelp as IM
setHeldItemLoc :: Creature -> World -> World
setHeldItemLoc cr = fst . getHeldItemLoc cr
getHeldItemLoc :: Creature -> World -> (World,Int)
getHeldItemLoc :: Creature -> World -> (World, Int)
getHeldItemLoc cr w = case maybeitid of
Nothing ->
Nothing ->
( w & cWorld . creatures . ix cid . crInv . ix j . itID ?~ newitid
& cWorld . itemLocations %~ IM.insert newitid (InInv cid j)
, itid)
, itid
)
_ -> (w, itid)
where
cid = _crID cr
@@ -30,12 +31,20 @@ getItem itid w = do
InInv cid invid -> w ^? cWorld . creatures . ix cid . crInv . ix invid
VoidItm -> Nothing
pointerToItemLocation :: Applicative f =>
ItemLocation -> (Item -> f Item) -> World -> f World
pointerToItemLocation ::
Applicative f =>
ItemLocation ->
(Item -> f Item) ->
World ->
f World
pointerToItemLocation (InInv cid invid) = cWorld . creatures . ix cid . crInv . ix invid
pointerToItemLocation (OnFloor flid) = cWorld . floorItems . ix flid . flIt
pointerToItemLocation _ = const pure
pointerToItem :: Applicative f =>
Item -> (Item -> f Item) -> World -> f World
pointerToItem ::
Applicative f =>
Item ->
(Item -> f Item) ->
World ->
f World
pointerToItem = pointerToItemLocation . _itLocation
-13
View File
@@ -1,13 +0,0 @@
module Dodge.Item.PassKey where
import Dodge.Data
import Dodge.Default
import Picture
import LensHelp
keyCard :: Int -> Item
keyCard n = defaultEquipment
& itInvColor .~ aquamarine
& itType . iyBase .~ HELD (KEYCARD n)
latchkey :: Int -> Item
latchkey _ = defaultEquipment
& itInvColor .~ yellow
+3 -3
View File
@@ -1,8 +1,8 @@
module Dodge.Item.Random where
import Dodge.Data
import RandomHelp
import Dodge.Item.Weapon.BulletGuns
import Dodge.Data.Item
import Dodge.Item.Held
import RandomHelp
randBlockBreakWeapon :: RandomGen g => State g Item
randBlockBreakWeapon = takeOne [bangStick 1]
+37
View File
@@ -0,0 +1,37 @@
module Dodge.Item.Targeting where
import Control.Lens
import Dodge.Data.Item.Targeting
defaultTargeting :: Targeting
defaultTargeting =
Targeting
{ _tgPos = Nothing
, _tgUpdate = NoTargetUpdate
, _tgDraw = NoTargetDraw
, _tgID = Nothing
, _tgActive = False
}
targetLaser :: Targeting
targetLaser =
defaultTargeting
& tgUpdate .~ TargetLaserUpdate
targetRBPress :: Targeting
targetRBPress =
defaultTargeting
& tgUpdate .~ TargetRBPressUpdate
& tgDraw .~ SimpleDrawTarget
targetRBCreature :: Targeting
targetRBCreature =
defaultTargeting
& tgUpdate .~ TargetRBCreatureUpdate
& tgDraw .~ TargetRBCreatureDraw
targetCursor :: Targeting
targetCursor =
defaultTargeting
& tgUpdate .~ TargetCursorUpdate
& tgDraw .~ SimpleDrawTarget
+22 -27
View File
@@ -1,29 +1,24 @@
{- | Rexport all weapons -}
module Dodge.Item.Weapon
( module Dodge.Item.Weapon.BulletGuns
, module Dodge.Item.Weapon.Shatter
, module Dodge.Item.Weapon.TriggerType
, module Dodge.Item.Weapon.ExtraEffect
, module Dodge.Item.Weapon.Remote
, module Dodge.Item.Weapon.Grenade
, module Dodge.Item.Weapon.Spawn
, module Dodge.Item.Weapon.Radar
, module Dodge.Item.Weapon.Utility
, module Dodge.Item.Weapon.SprayGuns
, module Dodge.Item.Weapon.BatteryGuns
, module Dodge.Item.Weapon.Launcher
, module Dodge.Item.Weapon.Drone
) where
import Dodge.Item.Weapon.Utility
import Dodge.Item.Weapon.BulletGuns
import Dodge.Item.Weapon.Drone
import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.Shatter
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.Remote
import Dodge.Item.Weapon.Grenade
import Dodge.Item.Weapon.Spawn
import Dodge.Item.Weapon.Radar
import Dodge.Item.Weapon.SprayGuns
-- | Rexport all weapons
module Dodge.Item.Weapon (
module Dodge.Item.Weapon.TriggerType,
module Dodge.Item.Weapon.ExtraEffect,
module Dodge.Item.Weapon.Remote,
module Dodge.Item.Weapon.Grenade,
module Dodge.Item.Weapon.Spawn,
module Dodge.Item.Weapon.Radar,
module Dodge.Item.Weapon.Utility,
module Dodge.Item.Weapon.BatteryGuns,
module Dodge.Item.Weapon.Launcher,
module Dodge.Item.Weapon.Drone,
) where
import Dodge.Item.Weapon.BatteryGuns
import Dodge.Item.Weapon.Drone
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.Grenade
import Dodge.Item.Weapon.Launcher
import Dodge.Item.Weapon.Radar
import Dodge.Item.Weapon.Remote
import Dodge.Item.Weapon.Spawn
import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.Utility
+74 -207
View File
@@ -1,73 +1,32 @@
module Dodge.Item.Weapon.BatteryGuns
( lasGun
, lasCircle
, dualBeam
, lasWide
, sparkGun
, teslaGun
, teslaParams
, tractorGun
, lasRayAt
, flameBeamCombine
, teslaBeamCombine
, splitBeamCombine
, shootTeslaArc
, shootLaser
, circleLaser
, shootDualLaser
, aTractorBeam
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Tesla
import Dodge.Beam
import Dodge.Item.Weapon.LaserPath
import Dodge.Item.Location
import Dodge.Creature.HandPos
import Dodge.Default.Weapon
import Dodge.Base
--import Dodge.Zone
import Geometry
import Picture
import LensHelp
module Dodge.Item.Weapon.BatteryGuns (
teslaParams,
lasRayAt,
flameBeamCombine,
teslaBeamCombine,
splitBeamCombine,
shootTeslaArc,
shootLaser,
circleLaser,
shootDualLaser,
aTractorBeam,
) where
import Dodge.Base
import Dodge.Beam
import Dodge.Creature.HandPos
import Dodge.Data.World
import Dodge.Item.Location
import Dodge.Item.Weapon.LaserPath
import Dodge.Tesla
import Geometry
import qualified IntMapHelp as IM
import qualified Data.Map.Strict as M
import LensHelp
import Picture
--import Control.Monad.State
defaultBatteryGun :: Item
defaultBatteryGun = defaultWeapon
& itType . iyModules .~ batteryModules
batteryModules :: M.Map ModuleSlot ItemModuleType
batteryModules = M.fromList
[(ModBattery, EMPTYMODULE)
,(ModTeleport, EMPTYMODULE)
]
defaultAutoBatteryGun :: Item
defaultAutoBatteryGun = defaultAutoGun
& itType . iyModules .~ batteryModules
sparkGun :: Item
sparkGun = teslaGun
& itType . iyBase .~ HELD SPARKGUN
& itParams . arcSize .~ 10
teslaGun :: Item
teslaGun = defaultBatteryGun
& itUse . heldConsumption . laMax .~ 200
& itUse . heldConsumption . laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
& itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 4 0 0
& itParams .~ teslaParams
& itUse . rUse .~ HeldTeslaArc --shootTeslaArc
& itUse . useDelay .~ NoDelay
& itUse . useMods .~ TeslaMod
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimStance .~ TwoHandFlat
& itUse . useAim . aimHandlePos .~ 4
& itUse . useAim . aimMuzPos .~ 4
& itType . iyBase .~ HELD TESLAGUN
--lasPulse :: Item
--lasPulse = lasGun
-- & itType . iyBase .~ LASPULSE
@@ -75,7 +34,7 @@ teslaGun = defaultBatteryGun
-- [ ammoCheckI
-- , withItem $ \it -> withTempLight 1 (100 * frac it) (xyzV4 (_lasColor $ _itParams it))
-- , withItem $ \it -> withSoundForVol (frac it) tone440sawtoothquietS 2
-- , withItemUpdate itup
-- , withItemUpdate itup
-- $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) (frac it * 0.8)
-- , useAmmoAmount 1
-- ]
@@ -86,26 +45,8 @@ teslaGun = defaultBatteryGun
-- & itParams . lasColor .~ frac it * orange
-- frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
lasCircle :: Item
lasCircle = lasGun
& itType . iyBase .~ HELD LASCIRCLE
& itParams . lasColor .~ orange
& itParams . lasDamage .~ 2
& itUse . heldConsumption . laMax .~ 10000
& itUse . rUse .~ HeldLaser --shootLaser
& itUse . useDelay .~ NoDelay
& itUse . rUse .~ HeldCircleLaser --circleLaser
& itUse . useMods .~ CircleLaserMod
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
lasWide :: Int -> Item
lasWide n = lasGun
& itType . iyBase .~ HELD (LASWIDE n)
& itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2
& itUse . useMods .~ LasWideMod n
--lasWidePulse :: Item
--lasWidePulse = lasGun
-- & itType . iyBase .~ LASGUNWIDEPULSE
@@ -115,7 +56,7 @@ lasWide n = lasGun
-- [ ammoCheckI
-- , withItem $ \it -> withTempLight 1 (100 * frac it) (xyzV4 (_lasColor $ _itParams it))
-- , withItem $ \it -> withSoundForVol (frac it) tone440sawtoothquietS 2
-- , withItemUpdate itup
-- , withItemUpdate itup
-- $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) (frac it * 0.8)
-- , useAmmoAmount 1
-- , withItemUpdate itup $ \it -> duplicateOffsets (xs it)
@@ -171,27 +112,7 @@ lasWide n = lasGun
-- n' = 9 * n
-- xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
dualBeam :: Item
dualBeam = lasGun
& itType . iyBase .~ HELD DUALBEAM
& itUse . useAim . aimMuzPos .~ 0
& itParams .~ DualBeam
{ _phaseV = 1
, _lasColor = red
, _lasColor2 = green
, _lasCycle = 0
, _lasDamage = 11
, _lasBeam = BeamCombine LasBeamCombine
, _subParams = Nothing
, _dbGap = 20
}
& itUse . rUse .~ HeldDualLaser --shootDualLaser
& itUse . useDelay .~ NoDelay
& itUse . useMods .~ DualBeamMod
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandFlat
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
--lasSwing :: Item
--lasSwing = lasGun
-- & itType . iyBase .~ LASGUNSWING
@@ -210,79 +131,20 @@ dualBeam = lasGun
-- where
-- y = 15 * sin (pi * fromIntegral x' * 0.01)
-- x' = _lasCycle $ _itParams it
lasGun :: Item
lasGun = defaultAutoBatteryGun
& itUse . heldConsumption .~ ( defaultLoadable
& laMax .~ 200
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
)
& itParams .~ Refracting
{ _phaseV = 1
, _lasColor = yellow
, _lasColor2 = yellow
, _lasCycle = 0
, _lasDamage = 11
}
& itTweaks .~ Tweakable
{ _tweakParams = IM.fromList [(0,lasGunTweak)]
}
& itDimension . dimRad .~ 10
& itDimension . dimCenter .~ V3 15 0 0
& itUse . rUse .~ HeldLaser --shootLaser
& itUse . useDelay .~ NoDelay
& itUse . useMods .~ LasMod
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD LASGUN
lasGunTweak :: TweakParam
lasGunTweak = TweakParam
{ _tweakType = TweakPhaseV
, _tweakVal = 1
, _tweakMax = 3
}
tractorGun :: Item
tractorGun = lasGun
& itUse . heldConsumption .~
( defaultLoadable
& laMax .~ 10000
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60] )
& itParams .~ Attracting {_attractionPower = 1}
& itTweaks .~ Tweakable
{ _tweakParams = IM.fromList [(0,tractorGunTweak)]
}
& itUse . rUse .~ HeldTractor --aTractorBeam
& itUse . useDelay .~ NoDelay
& itUse . useMods .~ AmmoCheckMod
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD TRACTORGUN
tractorGunTweak :: TweakParam
tractorGunTweak = TweakParam
{ _tweakType = TweakTractionPower
, _tweakVal = 1
, _tweakMax = 4
}
-- | assumes that the item is held
shootTeslaArc :: Item -> Creature -> World -> World
shootTeslaArc it cr w = w'
& cWorld . creatures . ix (_crID cr) . crInv . ix (crSel cr) . itParams .~ ip
where
(w',ip) = shootTeslaArc' (_itParams it) pos dir w
shootTeslaArc it cr w =
w'
& cWorld . creatures . ix (_crID cr) . crInv . ix (crSel cr) . itParams .~ ip
where
(w', ip) = shootTeslaArc' (_itParams it) pos dir w
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
dir = _crDir cr
shootLaser :: Item -> Creature -> World -> World
shootLaser it cr = cWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
where
where
pos = _crPos cr
dir = _crDir cr
phasev = _phaseV . _itParams $ _crInv cr IM.! crSel cr
@@ -291,10 +153,11 @@ shootLaser it cr = cWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam p
-- this has the feel of a left click item
circleLaser :: Item -> Creature -> World -> World
circleLaser it cr w
| hasLOSIndirect cpos pos w = w
& cWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
| hasLOSIndirect cpos pos w =
w
& cWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
| otherwise = w
where
where
cpos = _crPos cr
mwp = mouseWorldPos w
pos = _crPos cr +.+ rotateV dir (V2 0 (max 70 $ dist cpos mwp))
@@ -303,19 +166,21 @@ circleLaser it cr w
dam = _lasDamage $ _itParams it
shootDualLaser :: Item -> Creature -> World -> World
shootDualLaser it cr w = w'
& cWorld . newBeams . positronBeams .:~ dualRayAt (_lasBeam $ _itParams it) itid w (_lasColor $ _itParams it) dam phasev posl dirl
& cWorld . newBeams . electronBeams .:~ basicBeamAt itid w (_lasColor2 $ _itParams it) dam phasev posr dirr
where
(w',itid) = getHeldItemLoc cr w
shootDualLaser it cr w =
w'
& cWorld . newBeams . positronBeams .:~ dualRayAt (_lasBeam $ _itParams it) itid w (_lasColor $ _itParams it) dam phasev posl dirl
& cWorld . newBeams . electronBeams .:~ basicBeamAt itid w (_lasColor2 $ _itParams it) dam phasev posr dirr
where
(w', itid) = getHeldItemLoc cr w
dir = _crDir cr
pos = _crPos cr +.+ aimlength *.* unitVectorAtAngle dir
aimlength = aimingMuzzlePos cr it
gap = _dbGap . _itParams $ it
posl = pos +.+ (-gap) *.* vNormal (unitVectorAtAngle dir)
posl = pos +.+ (- gap) *.* vNormal (unitVectorAtAngle dir)
posr = pos +.+ gap *.* vNormal (unitVectorAtAngle dir)
mwp = mouseWorldPos w
mwp' | dist mwp (_crPos cr) < aimlength + 5 = _crPos cr +.+ (aimlength + 5) *.* unitVectorAtAngle dir
mwp'
| dist mwp (_crPos cr) < aimlength + 5 = _crPos cr +.+ (aimlength + 5) *.* unitVectorAtAngle dir
| otherwise = mwp
dirl = argV $ mwp' -.- posl
dirr = argV $ mwp' -.- posr
@@ -323,29 +188,31 @@ shootDualLaser it cr w = w'
dam = _lasDamage $ _itParams it
basicBeamAt :: Int -> World -> Color -> Int -> Float -> Point2 -> Float -> Beam
basicBeamAt itid w col dam phasev pos dir = Beam
{ _bmDraw = BasicBeamDraw --drawBeam
, _bmPos = pos
, _bmDir = dir
, _bmDamage = dam
, _bmRange = 800
, _bmPhaseV = phasev
, _bmColor = col
, _bmPoints = pos:ps
, _bmFirstPoints = []
, _bmOrigin = Just itid
, _bmType = BeamCombine NoBeamCombine
}
basicBeamAt itid w col dam phasev pos dir =
Beam
{ _bmDraw = BasicBeamDraw --drawBeam
, _bmPos = pos
, _bmDir = dir
, _bmDamage = dam
, _bmRange = 800
, _bmPhaseV = phasev
, _bmColor = col
, _bmPoints = pos : ps
, _bmFirstPoints = []
, _bmOrigin = Just itid
, _bmType = BeamCombine NoBeamCombine
}
where
(_,ps) = reflectLaserAlong phasev pos (pos +.+ 800 *.* unitVectorAtAngle dir) w
(_, ps) = reflectLaserAlong phasev pos (pos +.+ 800 *.* unitVectorAtAngle dir) w
dualRayAt :: BeamType -> Int -> World -> Color -> Int -> Float -> Point2 -> Float -> Beam
dualRayAt bt itid w col dam phasev pos dir = basicBeamAt itid w col dam phasev pos dir
& bmType .~ bt
dualRayAt bt itid w col dam phasev pos dir =
basicBeamAt itid w col dam phasev pos dir
& bmType .~ bt
aTractorBeam :: Item -> Creature -> World -> World
aTractorBeam _ cr w = w & cWorld . tractorBeams .:~ tractorBeamAt spos outpos dir power
where
where
cpos = _crPos cr
spos = cpos +.+ (_crRad cr + 10) *.* unitVectorAtAngle dir
xpos = cpos +.+ 400 *.* unitVectorAtAngle dir
@@ -354,12 +221,12 @@ aTractorBeam _ cr w = w & cWorld . tractorBeams .:~ tractorBeamAt spos outpos di
power = _attractionPower . _itParams $ _crInv cr IM.! crSel cr
tractorBeamAt :: Point2 -> Point2 -> Float -> Point2 -> TractorBeam
tractorBeamAt pos outpos dir power = TractorBeam
{ _tbPos = pos
, _tbStartPos = outpos
, _tbVel = d
, _tbTime = 10
}
where
d = unitVectorAtAngle dir * power
tractorBeamAt pos outpos dir power =
TractorBeam
{ _tbPos = pos
, _tbStartPos = outpos
, _tbVel = d
, _tbTime = 10
}
where
d = unitVectorAtAngle dir * power
+41 -32
View File
@@ -1,46 +1,55 @@
module Dodge.Item.Weapon.Bullet
( basicBullet
, hvBullet
) where
import Dodge.Data
module Dodge.Item.Weapon.Bullet (
basicBullet,
hvBullet,
) where
import Dodge.Data.Item.Use.Consumption.Ammo
import Control.Lens
import Geometry.Data
basicBullet :: AmmoType
basicBullet = BulletAmmo
{ _amString = "BASIC"
, _amBullet = defaultBullet
}
basicBullet =
BulletAmmo
{ _amString = "BASIC"
, _amBullet = defaultBullet
}
defaultBullet :: Bullet
defaultBullet = Bullet
{ _buDelayFraction = 1
, _buEffect = DestroyBullet
, _buSpawn = BulSpark
, _buUpdateMod = NoBulletUpdateMod
, _buTrajectory = BasicBulletTrajectory
, _buVel = V2 50 0
, _buDrag = 1
, _buPos = 0
, _buOldPos = 0
, _buWidth = 2
, _buTimer = 100
, _buDamages = basicBulDams
}
defaultBullet =
Bullet
{ _buDelayFraction = 1
, _buEffect = DestroyBullet
, _buSpawn = BulSpark
, _buUpdateMod = NoBulletUpdateMod
, _buTrajectory = BasicBulletTrajectory
, _buVel = V2 50 0
, _buDrag = 1
, _buPos = 0
, _buOldPos = 0
, _buWidth = 2
, _buTimer = 100
, _buDamages = basicBulDams
}
basicBulDams :: [Damage]
basicBulDams =
[ Damage PIERCING 100 0 0 0 NoDamageEffect
, Damage PUSHDAM 1 0 0 0 . PushBackDamage $ 2
, Damage PUSHDAM 1 0 0 0 . PushBackDamage $ 2
]
hvBullet :: AmmoType
hvBullet = BulletAmmo
{ _amString = "HVBULLET"
, _amBullet = defaultBullet
& buWidth .~ 6
& buVel .~ V2 80 0
& buDamages .~ heavyBulDams
}
hvBullet =
BulletAmmo
{ _amString = "HVBULLET"
, _amBullet =
defaultBullet
& buWidth .~ 6
& buVel .~ V2 80 0
& buDamages .~ heavyBulDams
}
heavyBulDams :: [Damage]
heavyBulDams =
[ Damage PIERCING 300 0 0 0 NoDamageEffect
, Damage PUSHDAM 1 0 0 0 $ PushBackDamage 2
, Damage PUSHDAM 1 0 0 0 $ PushBackDamage 2
]
-83
View File
@@ -1,83 +0,0 @@
module Dodge.Item.Weapon.BulletGun.Rod
( bangRod
, elephantGun
, amr
, autoAmr
, sniperRifle
, machineGun
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Default.Weapon
import Dodge.Item.Weapon.Bullet
import Dodge.Default
import Dodge.Item.Weapon.ExtraEffect
import Geometry
import LensHelp
bangRod :: Item
bangRod = defaultBulletWeapon
& itParams .~ BulletShooter
{ _muzVel = 0.8
, _rifling = 1
, _bore = 2
, _gunBarrels = SingleBarrel 0.1
, _recoil = 50
, _torqueAfter = 0.3
, _randomOffset = 0
}
& itUse . useDelay . rateMax .~ 12
& itUse . useMods .~ BangRodMod
& itDimension . dimRad .~ 12
& itDimension . dimCenter .~ V3 5 0 0
& itUse . heldConsumption . laMax .~ 1
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 5]
& itType . iyBase .~ HELD BANGROD
& itUse . useAim . aimWeight .~ 8
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ OneHand
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 30
& itUse . heldConsumption . laAmmoType .~ hvBullet
elephantGun :: Item
elephantGun = bangRod
& itType . iyBase .~ HELD ELEPHANTGUN
& itUse . useAim . aimStance .~ TwoHandTwist
& itParams . gunBarrels .~ SingleBarrel 0.05
& itUse . useMods .~ ElephantGunMod
& itParams . recoil .~ 50
& itParams . torqueAfter .~ 0.1
amr :: Item
amr = elephantGun
& itType . iyBase .~ HELD AMR
& itUse . heldConsumption . laMax .~ 15
autoAmr :: Item
autoAmr = amr
& itType . iyBase .~ HELD AUTOAMR
& itUse . useMods .~ AutoAmrMod
sniperRifle :: Item
sniperRifle = elephantGun
& itType . iyBase .~ HELD SNIPERRIFLE
& itParams . gunBarrels .~ SingleBarrel 0
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
& itScope .~ ZoomScope (V2 0 0) 0 1 0.5 False
& itTargeting .~ targetLaser
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
machineGun :: Item
machineGun = bangRod
& itType . iyBase .~ HELD MACHINEGUN
& itUse . useDelay . rateMax .~ 25
& itUse . useMods .~ MachineGunMod
& itUse . useAim . aimWeight .~ 8
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& itUse . useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
& itUse . heldConsumption . laMax .~ 100
& itUse . heldConsumption . laCycle .~ [loadEject 10, loadInsert 40 , loadPrime 10]
& itInvSize .~ 3
& itParams. torqueAfter .~ 0.2 -- not sure if this is necessary?
-93
View File
@@ -1,93 +0,0 @@
module Dodge.Item.Weapon.BulletGun.Stick
( bangStick
, pistol
, autoPistol
, machinePistol
, smg
, revolver
, revolverX
) where
import Dodge.Reloading.Action
import Dodge.Data
import Dodge.Default.Weapon
import Geometry
import LensHelp
bangStick :: Int -> Item
bangStick i = defaultBulletWeapon
& itParams .~ BulletShooter
{ _muzVel = 0.8
, _rifling = 0.8
, _bore = 2
, _gunBarrels = MultiBarrel
{_brlNum = i
,_brlSpread = SpreadBarrels baseStickSpread
,_brlInaccuracy = 0.01
}
, _recoil = 25
, _torqueAfter = 0.18 + 0.02 * fromIntegral i
, _randomOffset = 0
}
& itInvSize .~ fromIntegral i / 3
& itDimension . dimRad .~ 5
& itDimension . dimCenter .~ V3 5 0 0
& itUse . useDelay . rateMax .~ 8
& itUse . useMods .~ BangStickMod
& itType . iyBase .~ HELD (BANGSTICK i)
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 10
& itUse . heldConsumption . laMax .~ i
& itUse . heldConsumption . laCycle .~ [loadPartialInsert 10 1]
baseStickSpread :: Float
baseStickSpread = 0.2
revolver :: Item
revolver = pistol
& itUse . heldConsumption .~
(defaultBulletLoadable
& laMax .~ 6
& laCycle .~ [loadPartialInsert 10 1] )
& itType . iyBase .~ HELD REVOLVER
pistol :: Item
pistol = bangStick 1
& itUse . heldConsumption .~ ( defaultBulletLoadable
& laMax .~ 15
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ PistolMod
& itParams %~
( ( muzVel .~ 0.8 )
. ( rifling .~ 0.8 )
. ( bore .~ 2 )
. ( gunBarrels .~ SingleBarrel 0.05 )
. ( recoil .~ 10 )
. ( torqueAfter .~ 0.2 )
)
& itType . iyBase .~ HELD PISTOL
autoPistol :: Item
autoPistol = pistol
& itUse . useMods .~ AutoPistolMod
& itType . iyBase .~ HELD AUTOPISTOL
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
machinePistol :: Item
machinePistol = autoPistol
& itUse . useDelay . rateMax .~ 2
& itUse . useMods .~ MachinePistolMod -- (ammoCheckI : machinePistolAfterHamMods)
& itType . iyBase .~ HELD MACHINEPISTOL
& itType . iyModules . at ModAutoMag .~ Nothing
& itParams . recoil .~ 20
smg :: Item
smg = autoPistol -- & some parameter affecting stability
& itUse . useMods .~ SmgMod --(ammoCheckI : smgAfterHamMods)
& itType . iyBase .~ HELD SMG
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 2
& itParams . torqueAfter .~ 0.05
revolverX :: Int -> Item
revolverX i = revolver
& itUse . useDelay . rateMax .~ 8
& itUse . useMods .~ RevolverXMod
& itUse . heldConsumption . laMax .~ i * 6
& itType . iyBase .~ HELD (REVOLVERX i)
-110
View File
@@ -1,110 +0,0 @@
module Dodge.Item.Weapon.BulletGuns
( bangCone
, blunderbuss
, grapeCannon
, grenadeLauncher
, autogunSpread
--, autoGunPic
, module Dodge.Item.Weapon.BulletGun.Stick
, module Dodge.Item.Weapon.BulletGun.Cane
, module Dodge.Item.Weapon.BulletGun.Rod
) where
import Dodge.Item.Weapon.BulletGun.Stick
import Dodge.Reloading.Action
import Dodge.Item.Weapon.BulletGun.Cane
import Dodge.Item.Weapon.BulletGun.Rod
import Dodge.Data
import Dodge.Default.Weapon
import Geometry
import LensHelp
--autoGun :: Item
--autoGun = defaultAutoGun
-- { _itConsumption = defaultBulletLoadable
-- { _laMax = 30
-- , _laLoaded = 30
-- }
-- & laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10]
---- , _itFloorPict = autoGunPic
---- , _itZoom = defaultItZoom
-- , _itAttachment = AttachCharMode $ Seq.fromList "MS"
-- , _itParams = BulletShooter
-- { _muzVel = 1
-- , _rifling = 0.9
-- , _bore = 2
-- , _gunBarrels = SingleBarrel 0.1
-- , _recoil = 0
-- , _torqueAfter = 0
-- , _randomOffset = 0
-- }
-- }
-- & itUse . useDelay . rateMax .~ 4
-- & itUse . useMods .~
-- [ ammoCheckI
-- , charFiringStratI
-- [('S', hammerCheckI)
-- ]
-- , useTimeCheck
-- , charFiringStratI
-- [('M', torqueBefore 0.08)
-- ,('S', torqueBefore 0.05)
-- ]
-- , withSoundForI autoBS 5
-- --, withSoundForI seagullChatterS 5
-- , useAmmoAmount 1
-- , applyInaccuracy
-- , withMuzFlareI
-- , withSmoke 1 black 20 200 5
-- ]
-- & itUse . useAim . aimWeight .~ 6
-- & itUse . useAim . aimRange .~ 1
-- & itUse . useAim . aimStance .~ TwoHandTwist
-- & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
-- & itUse . heldScroll .~ HeldScrollCharMode
-- & itType . iyBase .~ HELD AUTOGUN
bangCone :: Item
bangCone = defaultBulletWeapon
{ _itParams = BulletShooter
{ _muzVel = 0.7
, _rifling = 0.8
, _bore = 5
, _gunBarrels = SingleBarrel 0.5
, _recoil = 150
, _torqueAfter = 0.1
, _randomOffset = 12
}
}
& itDimension . dimRad .~ 8
& itDimension . dimCenter .~ V3 5 0 0
& itUse . useDelay . rateMax .~ 20
& itUse . useMods .~ BangConeMod
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 15
& itType . iyBase .~ HELD BANGCONE
& itUse . heldConsumption . laMax .~ 5
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 20 , loadPrime 5]
blunderbuss :: Item
blunderbuss = bangCone
& itUse . heldConsumption . laMax .~ 25
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 30 , loadPrime 5]
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD BLUNDERBUSS
grapeCannon :: Int -> Item
grapeCannon i = blunderbuss
& itType . iyBase .~ HELD (GRAPECANNON i)
& itUse . heldConsumption . laMax .~ 25 + 25 * i
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert (30 + i * 10) , loadPrime 5]
& itParams . recoil .~ (150 + fromIntegral i * 50)
& itParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
& itParams . randomOffset .~ (12 + 4 * fromIntegral i)
grenadeLauncher :: Int -> Item
grenadeLauncher _ = bangCone
autogunSpread :: Float
autogunSpread = 0.07
+28 -25
View File
@@ -1,41 +1,44 @@
module Dodge.Item.Weapon.Drone where
import Dodge.Data
import Dodge.Default.Weapon
import Dodge.Default.Item
import Control.Lens
import Dodge.Data.World
import Geometry
import Picture
import ShapePicture
import Shape
import Control.Lens
import ShapePicture
droneLauncher :: Item
droneLauncher = defaultWeapon
& itUse . useDelay . rateMax .~ 20
-- & itUse . rUse .~ aDroneWithItemParams
& itUse . useMods .~ AmmoUseCheckMod
& itUse . useAim . aimWeight .~ 8
& itUse . useAim . aimRange .~ 0.5
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . heldConsumption . laAmmoType .~ DroneAmmo { _amString = "LASDRONE" }
& itUse . heldConsumption . laMax .~ 2
& itType . iyBase .~ HELD DRONELAUNCHER
droneLauncher =
defaultHeldItem
& itUse . heldDelay . rateMax .~ 20
& itUse . heldMods .~ AmmoUseCheckMod
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandTwist
& itUse . heldConsumption . laAmmoType .~ DroneAmmo{_amString = "LASDRONE"}
& itUse . heldConsumption . laMax .~ 2
& itType . iyBase .~ HELD DRONELAUNCHER
lasDronesPic :: Item -> SPic
lasDronesPic _ =
( colorSH chartreuse $ prismPoly
(map (+.+.+ V3 10 0 4.5) $ polyCircx 4 5)
(map (+.+.+ V3 (-10) 0 4.5) $ polyCircx 4 5)
lasDronesPic _ =
( colorSH chartreuse $
prismPoly
(map (+.+.+ V3 10 0 4.5) $ polyCircx 4 5)
(map (+.+.+ V3 (-10) 0 4.5) $ polyCircx 4 5)
, mempty
)
aDroneWithItemParams
:: Item -- ^ Firing item
-> Creature
-> World
-> World
aDroneWithItemParams ::
-- | Firing item
Item ->
Creature ->
World ->
World
aDroneWithItemParams = undefined
--aDroneWithItemParams it cr w = over props (IM.insert i theShell) w
-- where
-- where
-- am = _itConsumption it
-- i = IM.newKey $ _props w
-- pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
+109 -102
View File
@@ -1,95 +1,87 @@
--{-# LANGUAGE BangPatterns #-}
{- |
Extra weapon effects, supplementing explicit use effects.
-}
module Dodge.Item.Weapon.ExtraEffect
(-- itemLaserScopeEffect
autoSonarEffect
, autoEffect
, autoRadarEffect
, targetRBPress
, targetRBCreature
, targetCursor
, targetLaser
, targetLaserUpdate
, targetUpdateWith
, targetRBPressUpdate
, targetRBCreatureUp
, targetCursorUpdate
-- , rbSetTarget
) where
import Dodge.Zoning.Creature
import FoldableHelp
import Dodge.Data
import Dodge.Base
import Dodge.RadarSweep
import Dodge.SoundLogic
import Dodge.Item.Weapon.LaserPath
-}
module Dodge.Item.Weapon.ExtraEffect (
-- itemLaserScopeEffect
autoSonarEffect,
autoEffect,
autoRadarEffect,
targetLaserUpdate,
targetUpdateWith,
targetRBPressUpdate,
targetRBCreatureUp,
targetCursorUpdate,
-- , rbSetTarget
) where
--import Dodge.Item.Attachment.Data
import Dodge.Creature.Test
import Picture
import Geometry.Vector
import LensHelp
import Sound.Data
import qualified Data.Map.Strict as M
import Data.Maybe
import Dodge.Base
import Dodge.Creature.Test
import Dodge.Data.World
import Dodge.Item.Weapon.LaserPath
import Dodge.RadarSweep
import Dodge.SoundLogic
import Dodge.Zoning.Creature
import FoldableHelp
import Geometry.Vector
import LensHelp
import Picture
import qualified SDL
import Sound.Data
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
autoEffect eff t sid itm cr w
| _eparamInt (_eqParams (_eqEq $ _itUse itm)) < 1 = eff itm cr w
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
. itUse . eqEq . eqParams . eparamInt .~ t
& soundStart OnceSound (_crPos cr) sid Nothing
| otherwise = w
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
. itUse . eqEq . eqParams . eparamInt -~ 1
| _eparamInt (_eeParams (_equipEffect $ _itUse itm)) < 1 =
eff itm cr w
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
. itUse
. equipEffect
. eeParams
. eparamInt
.~ t
& soundStart OnceSound (_crPos cr) sid Nothing
| otherwise =
w
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
. itUse
. equipEffect
. eeParams
. eparamInt
-~ 1
{- | Automatically send out radar pulses that detect walls. -}
-- | Automatically send out radar pulses that detect walls.
autoRadarEffect :: Item -> Creature -> World -> World
autoRadarEffect = autoEffect (const (aRadarPulse ObWall)) 100 click1S
{- | Automatically send out sonar pulses that detect creatures. -}
-- | Automatically send out sonar pulses that detect creatures.
autoSonarEffect :: Item -> Creature -> World -> World
autoSonarEffect = autoEffect (const (aRadarPulse ObCreature)) 50 click1S
defaultTargeting :: Targeting
defaultTargeting = Targeting
{ _tgPos = Nothing
, _tgUpdate = NoTargetUpdate
, _tgDraw = NoTargetDraw
, _tgID = Nothing
, _tgActive = False
}
targetLaser :: Targeting
targetLaser = defaultTargeting
& tgUpdate .~ TargetLaserUpdate
targetRBPress :: Targeting
targetRBPress = defaultTargeting
& tgUpdate .~ TargetRBPressUpdate
& tgDraw .~ SimpleDrawTarget
targetRBCreature :: Targeting
targetRBCreature = defaultTargeting
& tgUpdate .~ TargetRBCreatureUpdate
& tgDraw .~ TargetRBCreatureDraw
targetCursor :: Targeting
targetCursor = defaultTargeting
& tgUpdate .~ TargetCursorUpdate
& tgDraw .~ SimpleDrawTarget
targetRBCreatureUp :: Item -> Creature -> World -> Targeting -> (World, Targeting)
targetRBCreatureUp it cr w t
| not $ _itIsHeld it = (w, t
& tgID .~ Nothing
& tgPos .~ Nothing
& tgActive .~ False
| not $ _itIsHeld it =
( w
, t
& tgID .~ Nothing
& tgPos .~ Nothing
& tgActive .~ False
)
| SDL.ButtonRight `M.member` _mouseButtons w && isJust (t ^? tgID . _Just)
&& canSeeTarget = (w, t & updatePos & tgActive .~ True)
| otherwise = (w, t & tgID .~ fmap _crID newtarg & updatePos & tgActive .~ False )
&& canSeeTarget =
(w, t & updatePos & tgActive .~ True)
| otherwise = (w, t & tgID .~ fmap _crID newtarg & updatePos & tgActive .~ False)
where
newtarg = safeMinimumOn (dist mwp . _crPos)
. filter (canseepos . _crPos)
$ crsNearCirc mwp 40 w
newtarg =
safeMinimumOn (dist mwp . _crPos)
. filter (canseepos . _crPos)
$ crsNearCirc mwp 40 w
canseepos p = hasLOS (_crPos cr) p w
mwp = mouseWorldPos w
updatePos t' = t' & tgPos .~ posFromMaybeID (_tgID t')
@@ -100,52 +92,67 @@ targetRBCreatureUp it cr w t
cpos <- w ^? cWorld . creatures . ix cid . crPos
Just $ hasLOS cpos (_crPos cr) w
targetUpdateWith :: (World -> Targeting -> Targeting)
-> Item -> Creature -> World -> Targeting -> (World,Targeting)
targetUpdateWith f it _ w t
targetUpdateWith ::
(World -> Targeting -> Targeting) ->
Item ->
Creature ->
World ->
Targeting ->
(World, Targeting)
targetUpdateWith f it _ w t
| _itIsHeld it = (w, f w t)
| otherwise = (w,t)
| otherwise = (w, t)
targetCursorUpdate :: World -> Targeting -> Targeting
targetCursorUpdate w t
| SDL.ButtonRight `M.member` _mouseButtons w = t
& tgPos . _Just .~ mouseWorldPos w
& tgActive .~ True
| otherwise = t & tgPos %~ const Nothing
& tgActive .~ False
| SDL.ButtonRight `M.member` _mouseButtons w =
t
& tgPos . _Just .~ mouseWorldPos w
& tgActive .~ True
| otherwise =
t & tgPos %~ const Nothing
& tgActive .~ False
targetRBPressUpdate :: World -> Targeting -> Targeting
targetRBPressUpdate w t
| SDL.ButtonRight `M.member` _mouseButtons w = t
& tgPos %~ maybe (Just $ mouseWorldPos w) Just
& tgActive .~ True
| otherwise = t & tgPos %~ const Nothing
& tgActive .~ False
| SDL.ButtonRight `M.member` _mouseButtons w =
t
& tgPos %~ maybe (Just $ mouseWorldPos w) Just
& tgActive .~ True
| otherwise =
t & tgPos %~ const Nothing
& tgActive .~ False
targetLaserUpdate :: Item -> Creature -> World -> Targeting -> (World,Targeting)
targetLaserUpdate :: Item -> Creature -> World -> Targeting -> (World, Targeting)
targetLaserUpdate _ cr w t
| crIsAiming cr = (addLaserPic w,t
& tgPos .~ fmap fst mp
& tgActive .~ True
| crIsAiming cr =
( addLaserPic w
, t
& tgPos .~ fmap fst mp
& tgActive .~ True
)
| otherwise = (w,t & tgPos %~ const Nothing
& tgActive .~ False
| otherwise =
( w
, t & tgPos %~ const Nothing
& tgActive .~ False
)
where
(mp, _) = reflectLaserAlong 0.2 sp ep w
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos w -.- sp)
addLaserPic = cWorld . lasers .:~ LaserStart
{ _lpPhaseV = 1
, _lpDir = _crDir cr
, _lpPos = sp
, _lpColor = col
, _lpType = TargetLaser
}
addLaserPic =
cWorld . lasers
.:~ LaserStart
{ _lpPhaseV = 1
, _lpDir = _crDir cr
, _lpPos = sp
, _lpColor = col
, _lpType = TargetLaser
}
--wpammo = _itConsumption it
-- reloadFrac
-- | _laLoaded wpammo == 0 = 1
-- | otherwise = case _laTransfer wpammo of
-- Transfer _ rs -> fromIntegral rs / fromIntegral (_laReloadTime wpammo)
-- NoTransfer -> 1
-- reloadFrac
-- | _laLoaded wpammo == 0 = 1
-- | otherwise = case _laTransfer wpammo of
-- Transfer _ rs -> fromIntegral rs / fromIntegral (_laReloadTime wpammo)
-- NoTransfer -> 1
col = blue -- mixColors reloadFrac (1-reloadFrac) blue red
+1 -1
View File
@@ -2,7 +2,7 @@ module Dodge.Item.Weapon.FractionLoaded
( fractionLoadedAmmo
, fractionLoadedAmmo2
) where
import Dodge.Data
import Dodge.Data.Item
---- this shouldn't really be used
loadedAmmo :: Item -> Int
+40 -34
View File
@@ -1,56 +1,62 @@
module Dodge.Item.Weapon.LaserPath
( reflectLaserAlong
) where
import Dodge.Data
module Dodge.Item.Weapon.LaserPath (
reflectLaserAlong,
) where
import Data.Bifunctor
import Data.Tuple
import Dodge.Base.Wall
--import Dodge.Creature.HandPos
import Dodge.Data.World
import Dodge.WorldEvent
import Geometry
--import Data.Maybe
--import Data.List
import Data.Bifunctor
import Data.Tuple
--import Streaming
--import qualified Streaming.Prelude as S
-- this needs to be tested with both reflections and refractions
reflectLaserAlong :: Float -> Point2 -> Point2 -> World
-> (Maybe (Point2,Either Creature Wall),[Point2])
reflectLaserAlong ::
Float ->
Point2 ->
Point2 ->
World ->
(Maybe (Point2, Either Creature Wall), [Point2])
{-# INLINE reflectLaserAlong #-}
reflectLaserAlong phasev sp ep w = case thingHitFilt (const True) _wlUnshadowed sp ep w of
Just (p,Right wl)
| _wlReflect wl -> second (p:) $ reflectLaserAlong phasev
(p +.+ unitVectorAtAngle (reflDirWall sp p wl))
(p +.+ dist p ep *.* unitVectorAtAngle (reflDirWall sp p wl))
w
| wlIsSeeThrough wl -> second (p:) $ reflectLaserAlong phasev
(p +.+ normalizeV (refract phasev sp ep wl p))
(refract phasev sp ep wl p)
w
| otherwise -> (Just (p,Right wl), [p])
Just (p,obj) -> (Just (p,obj), [p])
Just (p, Right wl)
| _wlReflect wl ->
second (p :) $
reflectLaserAlong
phasev
(p +.+ unitVectorAtAngle (reflDirWall sp p wl))
(p +.+ dist p ep *.* unitVectorAtAngle (reflDirWall sp p wl))
w
| wlIsSeeThrough wl ->
second (p :) $
reflectLaserAlong
phasev
(p +.+ normalizeV (refract phasev sp ep wl p))
(refract phasev sp ep wl p)
w
| otherwise -> (Just (p, Right wl), [p])
Just (p, obj) -> (Just (p, obj), [p])
Nothing -> (Nothing, [ep])
refract :: Float -> Point2 -> Point2 -> Wall -> Point2 -> Point2
{-# INLINE refract #-}
refract phasev x y wl p
| isEntering = p +.+ rotateV angleRef (normalDist wlNormal)
| otherwise = p +.+ rotateV angleRef' (normalDist wlNormal')
where
refract phasev x y wl p
| isEntering = p +.+ rotateV angleRef (normalDist wlNormal)
| otherwise = p +.+ rotateV angleRef' (normalDist wlNormal')
where
wlNormal = vNormal $ uncurry (-.-) $ swap (_wlLine wl)
wlNormal' = vNormal $ uncurry (-.-) (_wlLine wl)
normalDist wlnormal = magV (p -.- y) *.* normalizeV wlnormal
normalDist wlnormal = magV (p -.- y) *.* normalizeV wlnormal
angleInc = piRange $ argV wlNormal - argV (x -.- y)
angleRef
angleRef
| reflectExternal = angleInc
| otherwise = asin $ sin angleInc / phasev
piRange a'
piRange a'
| a' > pi = a' - 2 * pi
| a' > negate pi = a'
| otherwise = a' + 2 * pi
| otherwise = a' + 2 * pi
isEntering = not $ isLeftOf (x -.- y) (uncurry (-.-) (_wlLine wl))
angleInc' = piRange $ argV wlNormal' - argV (x -.- y)
angleRef'
angleRef'
| reflectInternal = angleInc'
| otherwise = asin $ phasev * sin angleInc'
reflectInternal = 1 < abs (phasev * sin angleInc')
+2 -96
View File
@@ -1,109 +1,15 @@
module Dodge.Item.Weapon.Launcher (
launcher,
launcherX,
remoteLauncher,
fireTrackingShell,
explodeRemoteRocket,
) where
import Control.Lens
import Dodge.Data
import Dodge.Default.Weapon
import Dodge.Data.World
import Dodge.Item.Location
import Dodge.Payload
import Dodge.Projectile.Create
import Dodge.Reloading.Action
import Geometry
import qualified IntMapHelp as IM
launcher :: Item
launcher =
defaultWeapon
{ _itParams =
ShellLauncher
{ _shellSpinDrag = 1
, _shellSpinAmount = 2
, _shellThrustDelay = 20
}
, _itTweaks =
Tweakable
{ _tweakParams = basicAmPjMoves
}
, _itInvSize = 3
}
& itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 10 0 0
& itUse . useDelay . rateMax .~ 20
& itUse . rUse .~ HeldPJCreation --usePjCreation
& itUse . useMods .~ LauncherMod
& itUse . useAim . aimWeight .~ 8
& itUse . useAim . aimRange .~ 0.5
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 20
& itUse . heldConsumption . laAmmoType .~ ProjectileAmmo
{ _amPayload = ExplosionPayload
, _amString = "EXPLOSIVE SHELL"
, _amPjDraw = DrawShell
, _amPjCreation = CreateShell
}
& itUse . heldConsumption . laMax .~ 1
& itUse . heldConsumption . laLoaded .~ 1
& itUse . heldConsumption . laCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
& itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
launcherX :: Int -> Item
launcherX i =
launcher
& itType . iyBase .~ HELD (LAUNCHERX i)
& itUse . heldConsumption . laMax .~ i
& itUse . heldConsumption . laLoaded .~ i
& itUse . rUse .~ HeldPJCreationX i
& itUse . useMods .~ LauncherXMod i
basicAmPjMoves :: IM.IntMap TweakParam
basicAmPjMoves =
IM.fromList . zip [0 ..] $
[ spinDrag
, spinStart
, thrustParam
]
spinDrag :: TweakParam
spinDrag =
TweakParam
{ _tweakType = TweakSpinDrag
, _tweakVal = 1
, _tweakMax = 5
}
spinStart :: TweakParam
spinStart =
TweakParam
{ _tweakType = TweakSpinAmount
, _tweakVal = 2
, _tweakMax = 5
}
thrustParam :: TweakParam
thrustParam =
TweakParam
{ _tweakType = TweakThrustDelay
, _tweakVal = 1
, _tweakMax = 5
}
remoteLauncher :: Item
remoteLauncher =
launcher
& itType . iyBase .~ HELD REMOTELAUNCHER
& itUse . rUse .~ HeldFireRemoteShell --fireRemoteShell
& itScope .~ RemoteScope (V2 0 0) 1 True
& itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell
-- TODO consider allowing tweaking rocket speed
explodeRemoteRocket ::
-- | Item id
Int ->
@@ -115,7 +21,7 @@ explodeRemoteRocket itid pjid w =
w
& cWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote itid 30 pjid]
& cWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile
& itPoint . itUse . rUse .~ HeldDoNothing
& itPoint . itUse . heldUse .~ HeldDoNothing
& usePayload (_prjPayload thepj) (_prjPos thepj)
where
itPoint = pointerToItemLocation $ _itemLocations (_cWorld w) IM.! itid
+14 -23
View File
@@ -1,32 +1,23 @@
module Dodge.Item.Weapon.Radar where
import Dodge.Data
import Dodge.RadarSweep
import Dodge.Default
import Control.Lens
{- |
Sends out pulses that display walls. -}
clickDetector :: Detector -> Item
clickDetector dt = defaultWeapon
& itUse . useDelay . rateMax .~ 20
& itUse . rUse .~ HeldDetectorEffect dt --detectorEffect dt
& itUse . useMods .~ AmmoUseCheckMod
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
& itType . iyBase .~ HELD (HELDDETECTOR dt)
import Dodge.Data.World
import Dodge.Default
import Dodge.RadarSweep
autoDetector :: Detector -> Item
autoDetector dt = defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . eqEq . eqUse .~ EDetector dt --autoEffect (detectorEffect dt) 100 click1S
& itUse . eqEq . eqParams .~ EquipCounter 0
& itUse . eqEq . eqViewDist ?~ 350
& itType . iyBase .~ EQUIP (AUTODETECTOR dt)
autoDetector dt =
defaultEquipment
& itUse . equipEffect . eeSite .~ GoesOnWrist
& itUse . equipEffect . eeUse .~ EDetector dt --autoEffect (detectorEffect dt) 100 click1S
& itUse . equipEffect . eeParams .~ EquipCounter 0
& itUse . equipEffect . eeViewDist ?~ 350
& itType . iyBase .~ EQUIP (AUTODETECTOR dt)
-- , _itEffect = autoRadarEffect
detectorEffect :: Detector -> Item -> Creature -> World -> World
detectorEffect dt = case dt of
ITEMDETECTOR -> const (aRadarPulse ObItem)
CREATUREDETECTOR -> const (aRadarPulse ObCreature)
WALLDETECTOR -> const (aRadarPulse ObWall)
ITEMDETECTOR -> const (aRadarPulse ObItem)
CREATUREDETECTOR -> const (aRadarPulse ObCreature)
WALLDETECTOR -> const (aRadarPulse ObWall)
+21 -17
View File
@@ -1,26 +1,30 @@
module Dodge.Item.Weapon.Remote
( setRemoteScope
, setRemoteBombScope
) where
import Dodge.Data
module Dodge.Item.Weapon.Remote (
setRemoteScope,
setRemoteBombScope,
) where
import Control.Lens
import Dodge.Data.World
import Dodge.Default
import Geometry
import qualified IntMapHelp as IM
import Control.Lens
setRemoteBombScope :: Int -> Prop -> World -> World
setRemoteBombScope itid pj w' = case _itemLocations (_cWorld w') IM.! itid of
InInv cid invid
-> w' & cWorld . creatures . ix cid . crInv . ix invid . itScope
. scopePos .~ (_prPos pj -.- _crPos (_creatures (_cWorld w') IM.! cid))
& cWorld . creatures . ix cid . crInv . ix invid . itUse . useAim . aimZoom
.~ (defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5})
_ -> w'
InInv cid invid ->
w'
& cWorld . creatures . ix cid . crInv . ix invid . itScope
. scopePos
.~ (_prPos pj -.- _crPos (_creatures (_cWorld w') IM.! cid))
& cWorld . creatures . ix cid . crInv . ix invid . itUse . heldAim . aimZoom
.~ (defaultItZoom{_itZoomMax = 0.5, _itZoomMin = 0.5})
_ -> w'
setRemoteScope :: Int -> Point2 -> World -> World
setRemoteScope itid pos w' = case w' ^? cWorld . itemLocations . ix itid of
Just (InInv cid' invid )
-> w' & cWorld . creatures . ix cid' . crInv . ix invid . itScope
. scopePos .~ (pos -.- _crPos (_creatures (_cWorld w') IM.! cid'))
_ -> w'
Just (InInv cid' invid) ->
w'
& cWorld . creatures . ix cid' . crInv . ix invid . itScope
. scopePos
.~ (pos -.- _crPos (_creatures (_cWorld w') IM.! cid'))
_ -> w'
+20 -24
View File
@@ -1,29 +1,19 @@
module Dodge.Item.Weapon.Shatter where
--import Dodge.WorldEvent.HitEffect
--import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data
import Dodge.Wall.Damage
--import Dodge.SoundLogic
import Dodge.Block.Debris
import Dodge.Base.Collide
--import Dodge.Zone
import Dodge.Block.Debris
import Dodge.Creature.HandPos
--import Dodge.ChainEffect
import Dodge.Default.Weapon
import Dodge.Data.World
import Dodge.Wall.Damage
import Geometry
import LensHelp
shatterGun :: Item
shatterGun = defaultWeapon
& itType . iyBase .~ HELD SHATTERGUN
& itUse . useDelay . rateMax .~ 10
& itUse . rUse .~ HeldShatter --shootShatter
& itUse . useMods .~ ShatterMod
& itUse . useAim . aimStance .~ TwoHandFlat
shootShatter :: Item -> Creature -> World -> World
shootShatter it cr w = maybe w (uncurry $ shatterWall w sp ep) $ sequence
$ collidePointWallsFilterStream canshatter sp ep w
shootShatter it cr w =
maybe w (uncurry $ shatterWall w sp ep) $
sequence $
collidePointWallsFilterStream canshatter sp ep w
where
canshatter wl = case _wlOpacity wl of
Opaque -> True
@@ -34,9 +24,15 @@ shootShatter it cr w = maybe w (uncurry $ shatterWall w sp ep) $ sequence
ep = sp +.+ 200 *.* unitVectorAtAngle dir
shatterWall :: World -> Point2 -> Point2 -> Point2 -> Wall -> World
shatterWall w sp ep p wl = w
& makeDebris (_wlMaterial wl) (_wlColor wl) p
& makeDebrisDirected 1 2 (pi/2) (argV $ vNormal $ uncurry (-.-) $ _wlLine wl) (_wlMaterial wl)
(_wlColor wl) p
& damageWall (Damage SHATTERING 1000 sp p ep NoDamageEffect) wl
shatterWall w sp ep p wl =
w
& makeDebris (_wlMaterial wl) (_wlColor wl) p
& makeDebrisDirected
1
2
(pi / 2)
(argV $ vNormal $ uncurry (-.-) $ _wlLine wl)
(_wlMaterial wl)
(_wlColor wl)
p
& damageWall (Damage SHATTERING 1000 sp p ep NoDamageEffect) wl
+15 -13
View File
@@ -1,17 +1,19 @@
module Dodge.Item.Weapon.Shell
( decTimMvVel
) where
import Dodge.Data
import Geometry.Vector
module Dodge.Item.Weapon.Shell (
decTimMvVel,
) where
import Control.Lens
import Dodge.Data.World
import Geometry.Vector
decTimMvVel :: Proj -> World -> World
decTimMvVel pj = cWorld . projectiles . ix pjid %~
( (prjTimer -~ 1)
. (prjPos %~ (+.+ vel) )
. (prjAcc %~ rotateV rot )
)
decTimMvVel pj =
cWorld . projectiles . ix pjid
%~ ( (prjTimer -~ 1)
. (prjPos %~ (+.+ vel))
. (prjAcc %~ rotateV rot)
)
where
rot = _prjSpin pj
vel = _prjVel pj
pjid = _prjID pj
rot = _prjSpin pj
vel = _prjVel pj
pjid = _prjID pj
+25 -24
View File
@@ -1,33 +1,34 @@
module Dodge.Item.Weapon.Spawn where
import Dodge.Data
import Dodge.Default.Weapon
import Dodge.Default.Item
import Control.Lens
import Dodge.Data.World
import Geometry
import qualified IntMapHelp as IM
import Data.Function
import Control.Lens
{- |
Creates a creature next to the creature using the item. -}
Creates a creature next to the creature using the item.
-}
spawnGun :: Creature -> Item
spawnGun _ = defaultWeapon
& itUse . useDelay . rateMax .~ 100
& itUse . rUse .~ HeldDoNothing --(\_ -> spawnCrNextTo cr)
& itUse . useMods .~ HeldModNothing
-- [ ammoCheckI
-- , hammerCheckI
-- ]
& itType . iyBase .~ LEFT SPAWNER
spawnCrNextTo
:: Creature -- ^ Creature to spawn
-> Creature -- ^ existing creature that will be spawned next to
-> World
-> World
spawnGun _ =
defaultHeldItem
& itUse . heldDelay . rateMax .~ 100
& itUse . heldUse .~ HeldDoNothing --(\_ -> spawnCrNextTo cr)
& itUse . heldMods .~ HeldModNothing
& itType . iyBase .~ LEFT SPAWNER
spawnCrNextTo ::
-- | Creature to spawn
Creature ->
-- | existing creature that will be spawned next to
Creature ->
World ->
World
spawnCrNextTo cr sCr w = w & cWorld . creatures %~ IM.insert k newCr
where
k = IM.newKey $ _creatures (_cWorld w)
newCr = cr
& crID .~ k
& crPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)
& crOldPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)
newCr =
cr
& crID .~ k
& crPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)
& crOldPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)
+12 -12
View File
@@ -1,17 +1,17 @@
module Dodge.Item.Weapon.Targeting
( useTargetPos
, removeItTarget
) where
import Dodge.Data
import Geometry.Data
module Dodge.Item.Weapon.Targeting (
useTargetPos,
removeItTarget,
) where
import Control.Lens
--import qualified IntMapHelp as IM
useTargetPos
:: (Maybe Point2 -> Creature -> World -> World)
-> Creature
-> World
-> World
import Dodge.Data.World
import Geometry.Data
useTargetPos ::
(Maybe Point2 -> Creature -> World -> World) ->
Creature ->
World ->
World
useTargetPos f cr w = case cr ^? crInv . ix (crSel cr) . itTargeting . tgPos of
Nothing -> w
Just p -> f p cr w
File diff suppressed because it is too large Load Diff
+11 -35
View File
@@ -1,11 +1,11 @@
module Dodge.Item.Weapon.Utility where
import Dodge.Default.Item.Use
import Control.Lens
import Data.Maybe
import Dodge.Base.Coordinate
import Dodge.Data
import Dodge.Data.World
import Dodge.Default
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Wall.ForceField
import Dodge.Wall.Move
import Geometry
@@ -19,9 +19,9 @@ rewindGun =
defaultLeftItem
{ _itInvColor = cyan
, _itUse =
defaultlUse
& lUse .~ LRewind --useRewindGun
& eqEq . eqSite .~ GoesOnChest
defaultLeftUse
& leftUse .~ LRewind --useRewindGun
& equipEffect . eeSite .~ GoesOnChest
}
& itEffect . ieInv .~ RewindEffect
& itType . iyBase .~ LEFT REWINDER
@@ -35,7 +35,7 @@ rewindGun =
shrinkGun :: Item
shrinkGun =
defaultLeftItem
& itUse .~ (defaultlUse & lUse .~ LShrink)
& itUse .~ (defaultLeftUse & leftUse .~ LShrink)
& itParams .~ ShrinkGunParams FullSize
& itType . iyBase .~ LEFT SHRINKER
@@ -47,9 +47,9 @@ blinkGun =
defaultLeftItem
{ _itInvColor = cyan
, _itUse =
defaultlUse
& lUse .~ LBlink --hammerCheckL (shootL $ const blinkAction)
& eqEq . eqSite .~ GoesOnWrist
defaultLeftUse
& leftUse .~ LBlink --hammerCheckL (shootL $ const blinkAction)
& equipEffect . eeSite .~ GoesOnWrist
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
}
& itType . iyBase .~ LEFT BLINKER
@@ -58,33 +58,9 @@ unsafeBlinkGun :: Item
unsafeBlinkGun =
blinkGun
& itType . iyBase .~ LEFT BLINKERUNSAFE
& itUse . lUse .~ LUnsafeBlink --hammerCheckL (shootL $ const unsafeBlinkAction)
& itUse . eqEq . eqViewDist ?~ 400
& itUse . leftUse .~ LUnsafeBlink --hammerCheckL (shootL $ const unsafeBlinkAction)
& itUse . equipEffect . eeViewDist ?~ 400
--effectGun :: String -> (Creature -> World -> World) -> Item
--effectGun name eff = defaultWeapon
-- { _itUse = defaultrUse
-- & rUse .~ const eff
-- & useMods .~ [hammerCheckI]
-- }
-- & itType . iyBase .~ EFFGUN name
--autoEffectGun :: String -> (Creature -> World -> World) -> Item
--autoEffectGun name eff = defaultWeapon
-- { _itUse = defaultrUse {_rUse = const eff}
-- }
-- & itType . iyBase .~ AUTOEFFGUN name
forceFieldGun :: Item
forceFieldGun =
defaultWeapon
& itTargeting .~ (targetRBPress & tgDraw .~ TargetDistanceDraw)
& itParams .~ ParamMID Nothing
& itUse . rUse .~ HeldForceField --useForceFieldGun
& itUse . useDelay .~ NoDelay
& itUse . useMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN
& itUse . heldConsumption .~ (defaultLoadable & laAmmoType .~ ForceFieldAmmo forceField)
-- I believe because the targeting returns to nothing straight after you release
-- the rmb, it is possible for this to do nothing
+4 -3
View File
@@ -1,10 +1,11 @@
module Dodge.Item.Weapon.ZoomScope where
import Dodge.Data
import Dodge.Data.Creature
import LensHelp
-- should be possible without the creature
zoomLongGun :: Float -> Creature -> Item -> Item
zoomLongGun x _
| x > 0 = itScope . scopeZoomChange %~ (max 15 . (+4))
| x > 0 = itScope . scopeZoomChange %~ (max 15 . (+ 4))
| x < 0 = itScope . scopeZoomChange %~ (min (-15) . subtract 4)
| otherwise = id
--zoomLongGun x _ = itScope . scopeZoomChange .~ round (signum x)