Work on cleaning up item effects/attachments etc

This commit is contained in:
2022-07-27 16:39:58 +01:00
parent 8d17ce66e9
commit b52adddd5d
39 changed files with 696 additions and 844 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ splitBeamCombine (p,(a,b,_),(x,y,_))
teslaBeamCombine :: (Point2,(Point2,Point2,Beam),(Point2,Point2,Beam)) teslaBeamCombine :: (Point2,(Point2,Point2,Beam),(Point2,Point2,Beam))
-> World -> World -> World -> World
teslaBeamCombine (p,(a,b,bm),(x,y,_)) w teslaBeamCombine (p,(a,b,bm),(x,y,_)) w
= w' & pointerToItem (_itemPositions (_cWorld w) IM.! itid) . itParams . subParams ?~ ip = w' & pointerToItemLocation (_itemLocations (_cWorld w) IM.! itid) . itParams . subParams ?~ ip
where where
itid = fromJust $ _bmOrigin bm itid = fromJust $ _bmOrigin bm
dir = argV (normalizeV (b-.-a)+.+normalizeV (y-.-x)) dir = argV (normalizeV (b-.-a)+.+normalizeV (y-.-x))
+188 -185
View File
@@ -1,118 +1,96 @@
{-# LANGUAGE TupleSections #-} {-# LANGUAGE TupleSections #-}
module Dodge.Combine.Combinations where module Dodge.Combine.Combinations where
--import Geometry
import Dodge.Data import Dodge.Data.Item
--import Dodge.WorldEvent.SpawnParticle import Dodge.Item
--import Dodge.Particle.HitEffect.ExpireAndDamage
--import Dodge.Particle.Damage
import Dodge.Item.Equipment
import Dodge.Item.Craftable
import Dodge.Item.Weapon
--import Dodge.Combine.Module
--import Dodge.Base
import LensHelp import LensHelp
--import Data.Maybe itemCombinations :: [([(ItAmount, ItemBaseType)], Item)]
itemCombinations :: [([(ItAmount,ItemBaseType)],Item)]
itemCombinations = itemCombinations =
[ po [CRAFT PIPE, CRAFT HARDWARE] (bangStick 1) [ po [CRAFT PIPE, CRAFT HARDWARE] (bangStick 1)
, po [HELD (BANGSTICK 1), CRAFT TIN] pistol , po [HELD (BANGSTICK 1), CRAFT TIN] pistol
, po [HELD PISTOL, CRAFT SPRING] autoPistol , po [HELD PISTOL, CRAFT SPRING] autoPistol
, po [HELD AUTOPISTOL, cr PLANK] smg , po [HELD AUTOPISTOL, cr PLANK] smg
, po [HELD AUTOPISTOL, cr SPRING] machinePistol , po [HELD AUTOPISTOL, cr SPRING] machinePistol
, po [HELD (BANGSTICK 1),cr CAN] revolver , po [HELD (BANGSTICK 1), cr CAN] revolver
, po [HELD REVOLVER, cr SPRING] $ revolverX 1 , po [HELD REVOLVER, cr SPRING] $ revolverX 1
, po [cr CAN, cr HARDWARE] bangCone
, po [HELD BANGCONE, cr PLANK] blunderbuss
, po [HELD BLUNDERBUSS, cr DRUM] (grapeCannon 1)
, -- , po [BANGCONE,PUMP,HARDWARE] $ grenadeLauncher 1
-- , po [GRENADELAUNCHER 1,MOTOR,DRUM] $ grenadeLauncher 2
, po [cr CAN,cr HARDWARE] bangCone -- , po [cr PIPE, cr HARDWARE] (volleyGun 1)
, po [HELD BANGCONE,cr PLANK] blunderbuss po [HELD (BANGSTICK 1), cr PLANK] rifle
, po [HELD BLUNDERBUSS,cr DRUM] (grapeCannon 1) , po [HELD (BANGSTICK 1), HELD (BANGSTICK 1), HELD (BANGSTICK 1)] (volleyGun 3)
-- , po [BANGCONE,PUMP,HARDWARE] $ grenadeLauncher 1 , po [HELD RIFLE, cr TIN] repeater
-- , po [GRENADELAUNCHER 1,MOTOR,DRUM] $ grenadeLauncher 2 , po [HELD REPEATER, cr SPRING] autoRifle
, po [HELD REPEATER, cr CAN] burstRifle
-- , po [cr PIPE, cr HARDWARE] (volleyGun 1) -- , po [BURSTRIFLE,cr SPRING,cr HARDWARE] fastBurstRifle
, po [HELD (BANGSTICK 1),cr PLANK] rifle -- , po [FASTBURSTRIFLE,cr SPRING,cr HARDWARE] completeBurstRifle
, po [HELD (BANGSTICK 1),HELD (BANGSTICK 1),HELD (BANGSTICK 1)] (volleyGun 3) ]
, po [HELD RIFLE,cr TIN] repeater ++ [ po [cr MOTOR, HELD (VOLLEYGUN i)] $ miniGunX i | i <- [3 .. 10]
, po [HELD REPEATER,cr SPRING] autoRifle ]
, po [HELD REPEATER,cr CAN] burstRifle ++
-- , po [BURSTRIFLE,cr SPRING,cr HARDWARE] fastBurstRifle -- , po [BANGSTICK 1,cr TUBE] elephantGun
-- , po [FASTBURSTRIFLE,cr SPRING,cr HARDWARE] completeBurstRifle [ po [HELD AMR, cr PIPE] sniperRifle
] , po [HELD RIFLE, cr PIPE] amr
++ [ po [cr MOTOR,HELD (VOLLEYGUN i)] $ miniGunX i | i <- [3..10] , po [HELD AMR, cr SPRING] autoAmr
] ++ , po [HELD AMR, cr MOTOR] machineGun
-- , po [BANGSTICK 1,cr TUBE] elephantGun , p [p 2 $ cr TUBE, o $ cr HARDWARE] launcher
[ po [HELD AMR,cr PIPE] sniperRifle , p [p 2 $ cr TUBE, o $ HELD LAUNCHER] (launcherX 2)
, po [HELD RIFLE,cr PIPE] amr
, po [HELD AMR,cr SPRING] autoAmr
, po [HELD AMR,cr MOTOR] machineGun
, p [p 2 $ cr TUBE,o $ cr HARDWARE] launcher
, p [p 2 $ cr TUBE,o $ HELD LAUNCHER] (launcherX 2)
] ++ [ p [p 2 $ cr TUBE,o $ HELD (LAUNCHERX i)] (launcherX (i+1)) | i <- [2..9]]
++
[ po [cr LIGHTER,cr PUMP,cr CAN] flameSpitter
, po [HELD FLAMESPITTER,cr CAN,cr PUMP] blowTorch
, po [HELD FLAMESPITTER,cr DRUM] flameThrower
, po [HELD FLAMETHROWER,cr DRUM] flameWall
, po [HELD FLAMETHROWER,cr PUMP] flameTorrent
, p [o $ cr PRISM,o $ cr TRANSFORMER,o $ cr PIPE] lasGun
-- , p [o LASGUN,o $ cr PRISM] lasSway
-- , p [o LASGUN,o $ cr HARDWARE] lasSwing
-- , p [o LASGUN,o PIPE] lasGunPulse
, po [HELD LASGUN,HELD LASGUN,cr HARDWARE] dualBeam
-- , p [o LASGUN,o $ cr PIPE, o $ cr PRISM] lasWidePulse
, po [HELD LASGUN, cr TRANSFORMER] (lasWide 2)
, po [HELD LASGUN,HELD LASGUN,HELD LASGUN,cr HARDWARE] lasCircle
, p [o $ cr TRANSFORMER,p 2 $ cr CAN] sparkGun
, p [o (HELD SPARKGUN),p 2 $ cr PIPE] teslaGun
, p [o $ cr TELEPORTMODULE,p 2 $ cr MICROCHIP] blinkGun
, p [o $ LEFT BLINKER, p 2 $ cr MICROCHIP] unsafeBlinkGun
, po [cr MAGNET,cr TIN] magShield
, p [p 2 $ cr PIPE,o $ cr PLATE,o $ cr MOTOR] powerLegs
, p [p 4 $ cr CAN] plateCraft
, p [p 3 $ cr TIN] plateCraft
, p [p 2 $ cr DRUM] plateCraft
, p [p 2 $ cr PLATE] flatShield
, po [cr MICROCHIP, cr PRISM] (makeTypeCraft LIGHTSENSOR)
, po [cr MICROCHIP, cr MAGNET] (makeTypeCraft SOUNDSENSOR)
, po [cr MICROCHIP, cr THERMOMETER] (makeTypeCraft HEATSENSOR)
, po [cr MICROCHIP, cr TRANSMITTER, cr LIGHTSENSOR] (autoDetector ITEMDETECTOR)
, po [cr MICROCHIP, cr TRANSMITTER, cr SOUNDSENSOR] (autoDetector WALLDETECTOR)
, po [cr MICROCHIP, cr TRANSMITTER, cr HEATSENSOR] (autoDetector CREATUREDETECTOR)
, po [cr BATTERY, cr LED] torch
, po [hd TORCH, eq HAT] headLamp
, po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (makeTypeCraft INCENDIARYMODULE)
, po [cr TRANSFORMER, cr BATTERY, cr MICROCHIP] (makeTypeCraft STATICMODULE)
]
++ map (\i -> po [HELD (LASWIDE i),cr TRANSFORMER] $ lasWide (i+1)) [2..9]
-- ++ map (\i -> po [LASGUNWIDE i,cr HARDWARE] $ lasFocus i) [2..10]
++ map (\i -> po [cr PIPE,HELD (BANGSTICK i)] $ bangStick (i+1)) [1..8]
++ map (\i -> po [hd (REVOLVERX i),cr CAN] $ revolverX (i+1)) [1..5]
++ map (\i -> po [hd (VOLLEYGUN i),HELD (BANGSTICK 1)] $ volleyGun (i+1)) [3..5]
++ map (\i -> po [hd (MINIGUNX i),HELD (BANGSTICK 1)] $ miniGunX (i+1)) [3..15]
++ map (\i -> po [hd (GRAPECANNON i),cr DRUM] $ grapeCannon (i+1)) [1,2,3]
++ [ po (_iyBase (_itType it):mtype) $ it & itType . iyModules . ix modtype .~ m
| (modtype,is,ms) <- moduleCombinations
, it <- is
, (mtype,m) <- ms
] ]
++ [p [p 2 $ cr TUBE, o $ HELD (LAUNCHERX i)] (launcherX (i + 1)) | i <- [2 .. 9]]
++ [ po [cr LIGHTER, cr PUMP, cr CAN] flameSpitter
, po [HELD FLAMESPITTER, cr CAN, cr PUMP] blowTorch
, po [HELD FLAMESPITTER, cr DRUM] flameThrower
, po [HELD FLAMETHROWER, cr DRUM] flameWall
, po [HELD FLAMETHROWER, cr PUMP] flameTorrent
, p [o $ cr PRISM, o $ cr TRANSFORMER, o $ cr PIPE] lasGun
, -- , p [o LASGUN,o $ cr PRISM] lasSway
-- , p [o LASGUN,o $ cr HARDWARE] lasSwing
-- , p [o LASGUN,o PIPE] lasGunPulse
po [HELD LASGUN, HELD LASGUN, cr HARDWARE] dualBeam
, -- , p [o LASGUN,o $ cr PIPE, o $ cr PRISM] lasWidePulse
po [HELD LASGUN, cr TRANSFORMER] (lasWide 2)
, po [HELD LASGUN, HELD LASGUN, HELD LASGUN, cr HARDWARE] lasCircle
, p [o $ cr TRANSFORMER, p 2 $ cr CAN] sparkGun
, p [o (HELD SPARKGUN), p 2 $ cr PIPE] teslaGun
, p [o $ cr TELEPORTMODULE, p 2 $ cr MICROCHIP] blinkGun
, p [o $ LEFT BLINKER, p 2 $ cr MICROCHIP] unsafeBlinkGun
, po [cr MAGNET, cr TIN] magShield
, p [p 2 $ cr PIPE, o $ cr PLATE, o $ cr MOTOR] powerLegs
, p [p 4 $ cr CAN] plateCraft
, p [p 3 $ cr TIN] plateCraft
, p [p 2 $ cr DRUM] plateCraft
, p [p 2 $ cr PLATE] flatShield
, po [cr MICROCHIP, cr PRISM] (makeTypeCraft LIGHTSENSOR)
, po [cr MICROCHIP, cr MAGNET] (makeTypeCraft SOUNDSENSOR)
, po [cr MICROCHIP, cr THERMOMETER] (makeTypeCraft HEATSENSOR)
, po [cr MICROCHIP, cr TRANSMITTER, cr LIGHTSENSOR] (autoDetector ITEMDETECTOR)
, po [cr MICROCHIP, cr TRANSMITTER, cr SOUNDSENSOR] (autoDetector WALLDETECTOR)
, po [cr MICROCHIP, cr TRANSMITTER, cr HEATSENSOR] (autoDetector CREATUREDETECTOR)
, po [cr BATTERY, cr LED] torch
, po [hd TORCH, eq HAT] headLamp
, po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (makeTypeCraft INCENDIARYMODULE)
, po [cr TRANSFORMER, cr BATTERY, cr MICROCHIP] (makeTypeCraft STATICMODULE)
]
++ map (\i -> po [HELD (LASWIDE i), cr TRANSFORMER] $ lasWide (i + 1)) [2 .. 9]
-- ++ map (\i -> po [LASGUNWIDE i,cr HARDWARE] $ lasFocus i) [2..10]
++ map (\i -> po [cr PIPE, HELD (BANGSTICK i)] $ bangStick (i + 1)) [1 .. 8]
++ map (\i -> po [hd (REVOLVERX i), cr CAN] $ revolverX (i + 1)) [1 .. 5]
++ map (\i -> po [hd (VOLLEYGUN i), HELD (BANGSTICK 1)] $ volleyGun (i + 1)) [3 .. 5]
++ map (\i -> po [hd (MINIGUNX i), HELD (BANGSTICK 1)] $ miniGunX (i + 1)) [3 .. 15]
++ map (\i -> po [hd (GRAPECANNON i), cr DRUM] $ grapeCannon (i + 1)) [1, 2, 3]
++ [ po (_iyBase (_itType it) : mtype) $ it & itType . iyModules . ix modtype .~ m
| (modtype, is, ms) <- moduleCombinations
, it <- is
, (mtype, m) <- ms
]
where where
p = (,) p = (,)
po xs it = (map o xs,it) po xs it = (map o xs, it)
o = (1,) o = (1,)
cr = CRAFT cr = CRAFT
hd = HELD hd = HELD
@@ -121,81 +99,106 @@ itemCombinations =
-- so there are two requirements for a module combination: the module slot must -- so there are two requirements for a module combination: the module slot must
-- exist on the item, and the item must be in the given list below -- exist on the item, and the item must be in the given list below
-- these two requirements should probably be combined -- these two requirements should probably be combined
moduleCombinations :: [( ModuleSlot, [Item], [([ItemBaseType],ItemModuleType)] )] moduleCombinations :: [(ModuleSlot, [Item], [([ItemBaseType], ItemModuleType)])]
moduleCombinations = moduleCombinations =
[ ( ModRifleMag [
, [repeater ( ModRifleMag
,autoRifle ,
,burstRifle [ repeater
-- ,fastBurstRifle , autoRifle
, burstRifle
-- ,fastBurstRifle
] ]
, [amod [cr DRUM,cr HARDWARE] DRUMMAG ,
,amod [cr MOTOR,cr HARDWARE] BELTMAG [ amod [cr DRUM, cr HARDWARE] DRUMMAG
, amod [cr MOTOR, cr HARDWARE] BELTMAG
] ]
) )
, ( ModHeldAttach ,
, [rifle ( ModHeldAttach
,autoRifle ,
,burstRifle [ rifle
, autoRifle
, burstRifle
] ]
, [amod [cr DUCTTAPE,HELD TORCH] ATTACHTORCH ,
[ amod [cr DUCTTAPE, HELD TORCH] ATTACHTORCH
] ]
) )
, ( ModAutoMag ,
, [autoRifle ( ModAutoMag
,autoPistol ,
,smg [ autoRifle
, autoPistol
, smg
] ]
, [amod [cr MAGNET,cr HARDWARE] MAGNETMAG ,
[ amod [cr MAGNET, cr HARDWARE] MAGNETMAG
] ]
) )
, ( ModBullet ,
, bulletWeapons ( ModBullet
, [amod [cr BOUNCEMODULE] BOUNCEBUL , bulletWeapons
,amod [cr PENMODULE] PENBUL ,
[ amod [cr BOUNCEMODULE] BOUNCEBUL
, amod [cr PENMODULE] PENBUL
] ]
) )
, ( ModBulletSpawn ,
, bulletWeapons ( ModBulletSpawn
, [amod [cr INCENDIARYMODULE] INCENDBUL , bulletWeapons
,amod [cr STATICMODULE] STATICBUL ,
,amod [cr CONCUSSMODULE] CONCUSBUL [ amod [cr INCENDIARYMODULE] INCENDBUL
, amod [cr STATICMODULE] STATICBUL
, amod [cr CONCUSSMODULE] CONCUSBUL
] ]
) )
, ( ModTarget ,
( ModTarget
, homingLaunchers ++ bulletWeapons , homingLaunchers ++ bulletWeapons
, [amod [cr MICROCHIP,cr HEATSENSOR] TARGCR ,
,amod [cr MICROCHIP,cr LIGHTSENSOR] TARGLAS [ amod [cr MICROCHIP, cr HEATSENSOR] TARGCR
,amod [cr MICROCHIP,cr SOUNDSENSOR] TARGPOS , amod [cr MICROCHIP, cr LIGHTSENSOR] TARGLAS
, amod [cr MICROCHIP, cr SOUNDSENSOR] TARGPOS
] ]
) )
, ( ModBulletTrajectory ,
, bulletWeapons ( ModBulletTrajectory
, [amod [cr MAGNET, cr MICROCHIP,cr HARDWARE] MAGNETTRAJ , bulletWeapons
,amod [cr MICROCHIP, cr HARDWARE] FLECHETRAJ ,
,amod [cr ANTIMATTER,cr HARDWARE] BEZIERTRAJ [ amod [cr MAGNET, cr MICROCHIP, cr HARDWARE] MAGNETTRAJ
, amod [cr MICROCHIP, cr HARDWARE] FLECHETRAJ
, amod [cr ANTIMATTER, cr HARDWARE] BEZIERTRAJ
] ]
) )
, ( ModDualBeam ,
, [dualBeam] ( ModDualBeam
, [amod [cr INCENDIARYMODULE] INCENDLAS , [dualBeam]
,amod [cr TRANSFORMER] SPLITLAS ,
,amod [cr STATICMODULE] STATICLAS [ amod [cr INCENDIARYMODULE] INCENDLAS
, amod [cr TRANSFORMER] SPLITLAS
, amod [cr STATICMODULE] STATICLAS
] ]
) )
, ( ModTeleport ,
, teleportableWeapons ( ModTeleport
, [amod [cr TELEPORTMODULE,cr MICROCHIP] WEPTELE , teleportableWeapons
,
[ amod [cr TELEPORTMODULE, cr MICROCHIP] WEPTELE
] ]
) )
, ( ModLauncherHoming ,
, homingLaunchers ( ModLauncherHoming
, [ amod [cr MICROCHIP,cr TRANSMITTER] LAUNCHHOME , homingLaunchers
,
[ amod [cr MICROCHIP, cr TRANSMITTER] LAUNCHHOME
] ]
) )
, ( ModBattery ,
( ModBattery
, batteryGuns , batteryGuns
, [amod [cr BATTERY] EXTRABATTERY ,
[ amod [cr BATTERY] EXTRABATTERY
] ]
) )
] ]
@@ -204,49 +207,49 @@ moduleCombinations =
cr = CRAFT cr = CRAFT
homingLaunchers :: [Item] homingLaunchers :: [Item]
homingLaunchers = launcher : [launcherX i | i <- [2..10]] homingLaunchers = launcher : [launcherX i | i <- [2 .. 10]]
batteryGuns :: [Item] batteryGuns :: [Item]
batteryGuns = batteryGuns =
[ teslaGun [ teslaGun
, sparkGun , sparkGun
, lasGun , lasGun
-- , lasSway -- , lasSway
-- , lasSwing -- , lasSwing
] ++ ]
[ lasWide i | i <- [2..10] ++ [ lasWide i | i <- [2 .. 10]
] ]
-- ++ -- ++
-- [ lasFocus i | i <- [1..10]] -- [ lasFocus i | i <- [1..10]]
teleportableWeapons :: [Item] teleportableWeapons :: [Item]
teleportableWeapons = bulletWeapons ++ batteryGuns ++ homingLaunchers teleportableWeapons = bulletWeapons ++ batteryGuns ++ homingLaunchers
bulletWeapons :: [Item] bulletWeapons :: [Item]
bulletWeapons bulletWeapons =
= [bangStick i | i <- [1..9] ] [bangStick i | i <- [1 .. 9]]
++ [volleyGun i | i <- [3..6] ] ++ [volleyGun i | i <- [3 .. 6]]
++ [revolverX i | i <- [1..5] ] ++ [revolverX i | i <- [1 .. 5]]
++ [miniGunX i | i <- [3..16] ] ++ [miniGunX i | i <- [3 .. 16]]
++ [grapeCannon i | i <- [1,2,3,4] ] ++ [grapeCannon i | i <- [1, 2, 3, 4]]
++ ++ [ pistol
[pistol , autoPistol
,autoPistol , smg
,smg , machinePistol
,machinePistol , revolver
,revolver , rifle
,rifle , repeater
,repeater , autoRifle
,autoRifle , burstRifle
,burstRifle , -- ,fastBurstRifle
-- ,fastBurstRifle -- ,completeBurstRifle
-- ,completeBurstRifle bangCone
,bangCone , blunderbuss
,blunderbuss , machineGun
,machineGun , elephantGun
,elephantGun , sniperRifle
,sniperRifle , amr
,amr , autoAmr
,autoAmr , bangRod
,bangRod ]
]
+1 -4
View File
@@ -21,10 +21,7 @@ import Dodge.Creature.PistolCrit
import Dodge.Creature.SpreadGunCrit import Dodge.Creature.SpreadGunCrit
import Dodge.Data import Dodge.Data
import Dodge.Default import Dodge.Default
import Dodge.Item.Consumable import Dodge.Item
import Dodge.Item.Craftable
import Dodge.Item.Equipment
import Dodge.Item.Weapon
import Geometry.Data import Geometry.Data
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import Picture import Picture
+2 -2
View File
@@ -53,7 +53,7 @@ tryReload cr it w f
| _crID cr == _yourID (_cWorld w) && itNeedsLoading it && _mouseButtons w M.!? SDL.ButtonLeft == Just False = | _crID cr == _yourID (_cWorld w) && itNeedsLoading it && _mouseButtons w M.!? SDL.ButtonLeft == Just False =
crToggleReloading cr crToggleReloading cr
| otherwise = | otherwise =
(runIdentity . pointerToItem (_itPos it) (return . (itUse . useHammer .~ HammerDown))) (runIdentity . pointerToItemLocation (_itLocation it) (return . (itUse . useHammer .~ HammerDown)))
. f . f
itNeedsLoading :: Item -> Bool itNeedsLoading :: Item -> Bool
@@ -116,7 +116,7 @@ useLeftItem cid w
itm <- cr ^? crInv . ix invid itm <- cr ^? crInv . ix invid
f <- cr ^? crInv . ix invid . itUse . lUse f <- cr ^? crInv . ix invid . itUse . lUse
return return
. (runIdentity . pointerToItem (_itPos itm) (return . (itUse . useHammer .~ HammerDown))) . (runIdentity . pointerToItemLocation (_itLocation itm) (return . (itUse . useHammer .~ HammerDown)))
. useL f itm cr . useL f itm cr
$ w $ w
where where
+1 -1
View File
@@ -213,7 +213,7 @@ itemUpdate cr i
| otherwise = baseupdate False | otherwise = baseupdate False
where where
baseupdate bool = updateAutoRecharge . (itUse %~ useUpdate) baseupdate bool = updateAutoRecharge . (itUse %~ useUpdate)
. (itPos .~ InInv (_crID cr) i) . (itLocation .~ InInv (_crID cr) i)
. (itIsHeld .~ bool) . (itIsHeld .~ bool)
updateAutoRecharge :: Item -> Item updateAutoRecharge :: Item -> Item
updateAutoRecharge it = case it ^? itUse . leftConsumption of updateAutoRecharge it = case it ^? itUse . leftConsumption of
+1 -1
View File
@@ -71,7 +71,7 @@ data CWorld = CWorld
, _creatures :: IM.IntMap Creature , _creatures :: IM.IntMap Creature
, _crZoning :: IM.IntMap (IM.IntMap IS.IntSet) , _crZoning :: IM.IntMap (IM.IntMap IS.IntSet)
, _creatureGroups :: IM.IntMap CrGroupParams , _creatureGroups :: IM.IntMap CrGroupParams
, _itemPositions :: IM.IntMap ItemPos , _itemLocations :: IM.IntMap ItemLocation
, _clouds :: [Cloud] , _clouds :: [Cloud]
, _clZoning :: IM.IntMap (IM.IntMap [Cloud]) , _clZoning :: IM.IntMap (IM.IntMap [Cloud])
, _gusts :: IM.IntMap Gust , _gusts :: IM.IntMap Gust
+3 -4
View File
@@ -9,7 +9,7 @@ module Dodge.Data.Item (
module Dodge.Data.Item.Params, module Dodge.Data.Item.Params,
module Dodge.Data.Item.Use, module Dodge.Data.Item.Use,
module Dodge.Data.Item.CurseStatus, module Dodge.Data.Item.CurseStatus,
module Dodge.Data.Item.Attachment, module Dodge.Data.Item.Scope,
module Dodge.Data.Item.Combine, module Dodge.Data.Item.Combine,
module Dodge.Data.Item.Targeting, module Dodge.Data.Item.Targeting,
) where ) where
@@ -20,7 +20,7 @@ import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Dodge.Data.Item.Combine import Dodge.Data.Item.Combine
import Dodge.Data.Item.Effect import Dodge.Data.Item.Effect
import Dodge.Data.Item.Attachment import Dodge.Data.Item.Scope
import Dodge.Data.Item.CurseStatus import Dodge.Data.Item.CurseStatus
import Dodge.Data.Item.Misc import Dodge.Data.Item.Misc
import Dodge.Data.Item.Params import Dodge.Data.Item.Params
@@ -31,9 +31,8 @@ import Dodge.Data.Item.Targeting
data Item = Item data Item = Item
{ _itUse :: ItemUse { _itUse :: ItemUse
, _itType :: ItemType , _itType :: ItemType
, _itAttachment :: ItAttachment
, _itID :: Maybe Int , _itID :: Maybe Int
, _itPos :: ItemPos , _itLocation :: ItemLocation
, _itIsHeld :: Bool , _itIsHeld :: Bool
, _itEffect :: ItEffect , _itEffect :: ItEffect
, _itInvSize :: Float , _itInvSize :: Float
+9 -21
View File
@@ -1,14 +1,14 @@
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Combine where module Dodge.Data.Item.Combine where
import Dodge.Data.Item.Use.Consumption
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Dodge.Data.Equipment.Misc import Dodge.Data.Equipment.Misc
import Dodge.Data.Item.Use.Consumption
data ItemType = ItemType data ItemType = ItemType
{ _iyBase :: ItemBaseType { _iyBase :: ItemBaseType
@@ -79,6 +79,7 @@ data ItemBaseType
data ConsumableItemType data ConsumableItemType
= MEDKIT Int = MEDKIT Int
| EXPLOSIVES
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data EquipItemType data EquipItemType
@@ -90,7 +91,6 @@ data EquipItemType
| BRAINHAT | BRAINHAT
| HAT | HAT
| HEADLAMP | HEADLAMP
| HEADLAMP1
| POWERLEGS | POWERLEGS
| SPEEDLEGS | SPEEDLEGS
| JUMPLEGS | JUMPLEGS
@@ -118,17 +118,13 @@ data HeldItemType
| BANGCONE | BANGCONE
| BLUNDERBUSS | BLUNDERBUSS
| GRAPECANNON {_xNum :: Int} | GRAPECANNON {_xNum :: Int}
| -- | GRENADELAUNCHER Int -- number of chambers that can be reloaded | MINIGUNX {_xNum :: Int}
-- | MORTARCONE / HANDMORTAR
MINIGUNX {_xNum :: Int}
| VOLLEYGUN {_xNum :: Int} | VOLLEYGUN {_xNum :: Int}
| RIFLE | RIFLE
| REPEATER | REPEATER
| AUTORIFLE | AUTORIFLE
| BURSTRIFLE | BURSTRIFLE
| -- | FASTBURSTRIFLE | BANGROD
-- | COMPLETEBURSTRIFLE
BANGROD
| ELEPHANTGUN | ELEPHANTGUN
| AMR | AMR
| AUTOAMR | AUTOAMR
@@ -143,20 +139,12 @@ data HeldItemType
| TESLAGUN | TESLAGUN
| LASGUN | LASGUN
| LASCIRCLE | LASCIRCLE
| -- | LASPULSE | DUALBEAM
DUALBEAM | LASWIDE {_xNum :: Int}
| -- | LASGUNSWING | TRACTORGUN
-- | LASGUNSWAY
-- | LASGUNWIDEPULSE
LASWIDE {_xNum :: Int}
| -- | LASGUNFOCUS Int
-- | SONICGUN
TRACTORGUN
| LAUNCHER | LAUNCHER
| LAUNCHERX {_xNum :: Int} | LAUNCHERX {_xNum :: Int}
| -- | TRACKINGLAUNCHER | REMOTELAUNCHER
REMOTELAUNCHER
| POISONSPRAYER | POISONSPRAYER
| DRONELAUNCHER | DRONELAUNCHER
| SHATTERGUN | SHATTERGUN
+9 -25
View File
@@ -7,39 +7,23 @@ import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
data ItEffect data ItEffect = ItEffect
= NoItEffect { _ieInv :: ItInvEffect --Item -> Creature -> World -> World
| ItInvEffect , _ieOnInsert :: ItInvEffect
{ _ieInv :: ItInvEffect --Item -> Creature -> World -> World , _ieOnDrop :: ItInvEffect --Item -> Creature -> World -> World
, _ieCounter :: Int , _ieOnHeld :: ItInvEffect
} , _ieOnStash :: ItInvEffect
| ItRewindEffect }
{ _ieInv :: ItInvEffect --Item -> Creature -> World -> World
}
| ItEffect
{ _ieInv :: ItInvEffect --Item -> Creature -> World -> World
, _ieFloor :: ItFloorEffect --Int -> World -> World
, _ieCounter :: Int
}
| ItInvEffectID
{ _ieInv :: ItInvEffect --Item -> Creature -> World -> World
, _ieMID :: Maybe Int
} -- the duplication of ieMID may cause errors...
| ItInvEffectDrop
{ _ieInv :: ItInvEffect --Item -> Creature -> World -> World
, _ieDrop :: ItDropEffect --Item -> Creature -> World -> World
, _ieMID :: Maybe Int
}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data ItInvEffect data ItInvEffect
= NoInvEffect = NoInvEffect
| RewindEffect | RewindEffect
| ResetAttachmentEffect | EffectIfHeld ItInvEffect ItInvEffect
| OnOffHeldEffect ItInvEffect ItInvEffect
| CreateHeldLight | CreateHeldLight
| CreateShieldWall | CreateShieldWall
| RemoveShieldWall | RemoveShieldWall
| EffectWhileHeld ItInvEffect
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data ItFloorEffect = NoFloorEffect data ItFloorEffect = NoFloorEffect
+30 -33
View File
@@ -1,53 +1,50 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Misc where module Dodge.Data.Item.Misc where
import GHC.Generics
import Data.Aeson
import Geometry.Data
import Control.Lens import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Geometry.Data
data ItemDimension = ItemDimension data ItemDimension = ItemDimension
{ _dimRad :: Float { _dimRad :: Float
, _dimCenter :: Point3 , _dimCenter :: Point3
, _dimAttachPos :: Point3 , _dimAttachPos :: Point3
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Show, Read)
instance ToJSON ItemDimension where
toEncoding = genericToEncoding defaultOptions data ItemPortage
instance FromJSON ItemDimension
data ItemPortage
= HeldItem = HeldItem
{ _handlePos :: Float { _handlePos :: Float
, _muzPos :: Float , _muzPos :: Float
} }
| WornItem | WornItem
| NoPortage | NoPortage
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Show, Read)
instance ToJSON ItemPortage where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ItemPortage
data ItemValue = ItemValue data ItemValue = ItemValue
{ _ivInt :: Int { _ivInt :: Int
, _ivType :: ItemValueType , _ivType :: ItemValueType
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Show, Read)
instance ToJSON ItemValue where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ItemValue
data ItemValueType = MundaneItem | ArtefactItem data ItemValueType = MundaneItem | ArtefactItem
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Show, Read)
instance ToJSON ItemValueType where
toEncoding = genericToEncoding defaultOptions data ItemLocation
instance FromJSON ItemValueType = InInv {_ipCrID :: Int, _ipInvID :: Int}
data ItemPos | OnFloor {_ipFlID :: Int}
= InInv { _ipCrID :: Int , _ipInvID :: Int }
| OnFloor { _ipFlID :: Int }
| VoidItm | VoidItm
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Show, Read)
instance ToJSON ItemPos where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ItemPos
makeLenses ''ItemDimension makeLenses ''ItemDimension
makeLenses ''ItemPortage makeLenses ''ItemPortage
makeLenses ''ItemValue makeLenses ''ItemValue
makeLenses ''ItemPos makeLenses ''ItemLocation
deriveJSON defaultOptions ''ItemDimension
deriveJSON defaultOptions ''ItemPortage
deriveJSON defaultOptions ''ItemValue
deriveJSON defaultOptions ''ItemValueType
deriveJSON defaultOptions ''ItemLocation
+9 -9
View File
@@ -13,6 +13,12 @@ import Geometry.Data
data ItemParams data ItemParams
= NoParams = NoParams
| MagShieldParams
{_magShieldMgMIX :: Maybe Int}
| ShrinkGunParams
{_shrinkGunStatus :: ShrinkGunStatus}
| FlatShieldParams
{_flatShieldWlMIX :: Maybe Int}
| ShellLauncher | ShellLauncher
{ _shellSpinDrag :: Int { _shellSpinDrag :: Int
, _shellSpinAmount :: Int , _shellSpinAmount :: Int
@@ -62,13 +68,12 @@ data ItemParams
| BoostPropIX {_boostPropIX :: Maybe Int} | BoostPropIX {_boostPropIX :: Maybe Int}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data ShrinkGunStatus = FullSize | Shrunk
deriving (Eq, Ord, Show, Read)
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data GunBarrels data GunBarrels
= MultiBarrel = MultiBarrel
{ _brlSpread :: BarrelSpread { _brlSpread :: BarrelSpread
@@ -82,8 +87,6 @@ data GunBarrels
| SingleBarrel {_brlInaccuracy :: Float} | SingleBarrel {_brlInaccuracy :: Float}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data Nozzle = Nozzle data Nozzle = Nozzle
{ _nzPressure :: Float { _nzPressure :: Float
, _nzDir :: Float , _nzDir :: Float
@@ -94,21 +97,18 @@ data Nozzle = Nozzle
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data BarrelSpread data BarrelSpread
= AlignedBarrels = AlignedBarrels
| SpreadBarrels {_spreadAngle :: Float} | SpreadBarrels {_spreadAngle :: Float}
| RotatingBarrels {_rotatingBarrelInaccuracy :: Float} | RotatingBarrels {_rotatingBarrelInaccuracy :: Float}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
makeLenses ''BarrelSpread makeLenses ''BarrelSpread
makeLenses ''ItemParams makeLenses ''ItemParams
makeLenses ''Nozzle makeLenses ''Nozzle
makeLenses ''GunBarrels makeLenses ''GunBarrels
deriveJSON defaultOptions ''ItemParams deriveJSON defaultOptions ''ItemParams
deriveJSON defaultOptions ''ShrinkGunStatus
deriveJSON defaultOptions ''PreviousArcEffect deriveJSON defaultOptions ''PreviousArcEffect
deriveJSON defaultOptions ''GunBarrels deriveJSON defaultOptions ''GunBarrels
deriveJSON defaultOptions ''Nozzle deriveJSON defaultOptions ''Nozzle
@@ -1,23 +1,13 @@
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Attachment where module Dodge.Data.Item.Scope where
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Geometry.Data import Geometry.Data
data ItAttachment
= AttachFuse {_atFuseTime :: Int}
| AttachTargetPos {_atTargetPos :: Point2}
| AttachInt {_atInt :: Int}
| AttachMInt {_atMInt :: Maybe Int}
| AttachFloat {_atFloat :: Float}
| AttachBool {_atBool :: Bool}
| NoItAttachment
deriving (Eq, Ord, Show, Read)
data Scope data Scope
= NoScope = NoScope
| RemoteScope | RemoteScope
@@ -36,9 +26,7 @@ data Scope
, -- | if the camera offset is also the center of vision , -- | if the camera offset is also the center of vision
_scopeIsCamera :: Bool _scopeIsCamera :: Bool
} }
deriving (Eq, Ord, Show, Read) deriving (Eq, Show, Read)
makeLenses ''ItAttachment
makeLenses ''Scope makeLenses ''Scope
deriveJSON defaultOptions ''ItAttachment
deriveJSON defaultOptions ''Scope deriveJSON defaultOptions ''Scope
+21 -21
View File
@@ -1,37 +1,37 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Tweak where module Dodge.Data.Item.Tweak where
import GHC.Generics
import Data.Aeson
import Control.Lens import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
data ItemTweaks data ItemTweaks
= NoTweaks = NoTweaks
| Tweakable | Tweakable
{ _tweakParams :: IM.IntMap TweakParam { _tweakParams :: IM.IntMap TweakParam
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Show, Read)
instance ToJSON ItemTweaks where
toEncoding = genericToEncoding defaultOptions data TweakType
instance FromJSON ItemTweaks = TweakPhaseV
data TweakType = TweakPhaseV
| TweakTractionPower | TweakTractionPower
| TweakSpinDrag | TweakSpinDrag
| TweakSpinAmount | TweakSpinAmount
| TweakThrustDelay | TweakThrustDelay
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Show, Read)
instance ToJSON TweakType where
toEncoding = genericToEncoding defaultOptions
instance FromJSON TweakType
data TweakParam = TweakParam data TweakParam = TweakParam
{ _tweakType :: TweakType -- Int -> Item -> Item { _tweakType :: TweakType -- Int -> Item -> Item
, _tweakVal :: Int , _tweakVal :: Int
, _tweakMax :: Int , _tweakMax :: Int
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Show, Read)
instance ToJSON TweakParam where
toEncoding = genericToEncoding defaultOptions
instance FromJSON TweakParam
makeLenses ''TweakParam makeLenses ''TweakParam
makeLenses ''ItemTweaks makeLenses ''ItemTweaks
deriveJSON defaultOptions ''ItemTweaks
deriveJSON defaultOptions ''TweakType
deriveJSON defaultOptions ''TweakParam
+19 -19
View File
@@ -1,30 +1,30 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Magnet where module Dodge.Data.Magnet where
import GHC.Generics
import Data.Aeson
import Geometry.Data
import Control.Lens import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Geometry.Data
newtype MagnetUpdate = MagnetUpdateTimer Int newtype MagnetUpdate = MagnetUpdateTimer Int
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read)
instance ToJSON MagnetUpdate where
toEncoding = genericToEncoding defaultOptions data MagnetBuBu
instance FromJSON MagnetUpdate = MagnetBuId
data MagnetBuBu = MagnetBuId
| MagnetBuBuCurveAroundField Float Float | MagnetBuBuCurveAroundField Float Float
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read)
instance ToJSON MagnetBuBu where
toEncoding = genericToEncoding defaultOptions
instance FromJSON MagnetBuBu
data Magnet = Magnet data Magnet = Magnet
{ _mgID :: Int { _mgID :: Int
, _mgUpdate :: MagnetUpdate , _mgUpdate :: MagnetUpdate
, _mgPos :: Point2 , _mgPos :: Point2
, _mgField :: MagnetBuBu , _mgField :: MagnetBuBu
} }
deriving (Eq,Ord,Show,Read,Generic) deriving (Eq, Ord, Show, Read)
instance ToJSON Magnet where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Magnet
makeLenses ''Magnet makeLenses ''Magnet
deriveJSON defaultOptions ''MagnetUpdate
deriveJSON defaultOptions ''MagnetBuBu
deriveJSON defaultOptions ''Magnet
+75 -66
View File
@@ -1,93 +1,102 @@
{- | {- |
Module : Dodge.Default Module : Dodge.Default
Description : Instances of data structures Description : Instances of data structures
This module contains prototypical data structures. This module contains prototypical data structures.
-} -}
module Dodge.Default module Dodge.Default (
( module Dodge.Default module Dodge.Default,
, module Dodge.Default.Item module Dodge.Default.Item,
, module Dodge.Default.LightSource module Dodge.Default.LightSource,
, module Dodge.Default.Weapon module Dodge.Default.Weapon,
, module Dodge.Default.Wall module Dodge.Default.Wall,
, module Dodge.Default.Creature module Dodge.Default.Creature,
, module Dodge.Default.Terminal module Dodge.Default.Terminal,
) where ) where
import Control.Lens
import Dodge.Data
import Dodge.Default.Creature
import Dodge.Default.Item
import Dodge.Default.LightSource
import Dodge.Default.Terminal import Dodge.Default.Terminal
import Dodge.Default.Wall import Dodge.Default.Wall
import Dodge.Default.Creature
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Default.LightSource
import Dodge.Default.Item
import Dodge.Data
import Dodge.SoundLogic import Dodge.SoundLogic
import Geometry import Geometry
import Picture import Picture
import Control.Lens
defaultEquipment :: Item defaultEquipment :: Item
defaultEquipment = defaultItem defaultEquipment =
{ _itInvColor = yellow defaultItem
, _itUse = EquipUse defaultEquip & itInvColor .~ yellow
, _itAttachment = NoItAttachment & itUse .~ EquipUse defaultEquip
}
defaultItZoom :: ItZoom defaultItZoom :: ItZoom
defaultItZoom = ItZoom 20 0.2 1 defaultItZoom = ItZoom 20 0.2 1
defaultConsumable :: Item defaultConsumable :: Item
defaultConsumable = defaultItem defaultConsumable =
& itUse .~ ConsumeUse CDoNothing 1 defaultItem
& itInvColor .~ blue & itUse .~ ConsumeUse CDoNothing 1
& itInvColor .~ blue
defaultFlIt :: FloorItem defaultFlIt :: FloorItem
defaultFlIt = FlIt {_flItRot=0,_flIt = defaultConsumable, _flItPos = V2 0 0, _flItID = 0} defaultFlIt = FlIt{_flItRot = 0, _flIt = defaultConsumable, _flItPos = V2 0 0, _flItID = 0}
defaultMachine :: Machine defaultMachine :: Machine
defaultMachine = Machine defaultMachine =
{ _mcID = 0 Machine
, _mcWallIDs = mempty { _mcID = 0
, _mcDraw = MachineDrawMempty , _mcWallIDs = mempty
, _mcColor = white , _mcDraw = MachineDrawMempty
, _mcPos = V2 0 0 , _mcColor = white
, _mcDir = 0 , _mcPos = V2 0 0
, _mcHP = 1000 , _mcDir = 0
, _mcSensor = NoSensor , _mcHP = 1000
, _mcMaterial = Electronics , _mcSensor = NoSensor
, _mcDamage = [] , _mcMaterial = Electronics
, _mcType = StaticMachine , _mcDamage = []
, _mcName = "" , _mcType = StaticMachine
, _mcMounts = mempty , _mcName = ""
, _mcCloseSound = Nothing , _mcMounts = mempty
} , _mcCloseSound = Nothing
}
defaultButton :: Button defaultButton :: Button
defaultButton = Button defaultButton =
{ _btPict = DefaultDrawButton (dark red) Button
, _btPos = V2 0 0 { _btPict = DefaultDrawButton (dark red)
, _btRot = 0 , _btPos = V2 0 0
, _btEvent = ButtonPress BtNoLabel ButtonDoNothing click1S NoWorldEffect , _btRot = 0
, _btID = 0 , _btEvent = ButtonPress BtNoLabel ButtonDoNothing click1S NoWorldEffect
, _btText = "Button" , _btID = 0
, _btState = BtOff , _btText = "Button"
, _btTermMID = Nothing , _btState = BtOff
, _btName = "" , _btTermMID = Nothing
, _btColor = red , _btName = ""
} , _btColor = red
}
defaultPP :: PressPlate defaultPP :: PressPlate
defaultPP = PressPlate defaultPP =
{ _ppPict = setDepth 1 . color (dim . dim $ bright blue) $ circleSolid 5 PressPlate
, _ppPos = V2 0 0 { _ppPict = setDepth 1 . color (dim . dim $ bright blue) $ circleSolid 5
, _ppRot = 0 , _ppPos = V2 0 0
, _ppEvent = PressPlateId , _ppRot = 0
, _ppID = -1 , _ppEvent = PressPlateId
, _ppText = "Pressure plate" , _ppID = -1
} , _ppText = "Pressure plate"
}
upHammer :: HammerType upHammer :: HammerType
upHammer = HasHammer HammerUp upHammer = HasHammer HammerUp
defaultProximitySensor :: Sensor defaultProximitySensor :: Sensor
defaultProximitySensor = ProximitySensor defaultProximitySensor =
{ _proxStatus = NotClose ProximitySensor
, _proxDist = 40 { _proxStatus = NotClose
, _proxRequirement = RequireImpossible , _proxDist = 40
, _sensToggle = False , _proxRequirement = RequireImpossible
} , _sensToggle = False
}
+13 -3
View File
@@ -1,5 +1,6 @@
module Dodge.Default.Item ( module Dodge.Default.Item (
defaultItem, defaultItem,
defaultItEffect,
) where ) where
import Dodge.Data.Item import Dodge.Data.Item
@@ -12,12 +13,12 @@ defaultItem =
{ _itCurseStatus = Uncursed { _itCurseStatus = Uncursed
, _itType = defaultItemType , _itType = defaultItemType
, -- , _itEquipPict = \_ _ -> (,) emptySH blank , -- , _itEquipPict = \_ _ -> (,) emptySH blank
_itEffect = NoItEffect _itEffect = defaultItEffect
, _itID = Nothing , _itID = Nothing
, _itIsHeld = False , _itIsHeld = False
, _itInvColor = yellow , _itInvColor = yellow
, _itInvSize = 1 , _itInvSize = 1
, _itPos = VoidItm , _itLocation = VoidItm
, _itDimension = ItemDimension 2 0 (V3 10 (-5) 3) , _itDimension = ItemDimension 2 0 (V3 10 (-5) 3)
, _itUse = CraftUse (ItAmount 1) , _itUse = CraftUse (ItAmount 1)
, _itParams = NoParams , _itParams = NoParams
@@ -25,7 +26,16 @@ defaultItem =
, _itScope = NoScope , _itScope = NoScope
, _itTargeting = NoTargeting , _itTargeting = NoTargeting
, _itValue = ItemValue 0 MundaneItem , _itValue = ItemValue 0 MundaneItem
, _itAttachment = NoItAttachment }
defaultItEffect :: ItEffect
defaultItEffect =
ItEffect
{ _ieInv = NoInvEffect
, _ieOnInsert = NoInvEffect
, _ieOnDrop = NoInvEffect
, _ieOnHeld = NoInvEffect
, _ieOnStash = NoInvEffect
} }
defaultItemType :: ItemType defaultItemType :: ItemType
+1 -1
View File
@@ -47,7 +47,7 @@ defaultCWorld = CWorld
, _clZoning = mempty , _clZoning = mempty
, _gusts = IM.empty , _gusts = IM.empty
, _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos) , _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos)
, _itemPositions = IM.empty , _itemLocations = IM.empty
, _props = IM.empty , _props = IM.empty
, _projectiles = IM.empty , _projectiles = IM.empty
, _instantBullets = [] , _instantBullets = []
+117 -3
View File
@@ -1,9 +1,22 @@
module Dodge.Euse where module Dodge.Euse where
import Dodge.LightSource
import Dodge.Item.HeldOffset
import Dodge.Wall.Create
import Color
import Dodge.Default.Wall
import Dodge.Creature.Test
import Dodge.Creature.HandPos
import Geometry
import Dodge.Wall.Move
import Dodge.Wall.Delete
import Dodge.Wall.ForceField
import Dodge.Item.Location
import Dodge.Data import Dodge.Data
import Dodge.Item.Weapon.ExtraEffect import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.Radar import Dodge.Item.Weapon.Radar
import Dodge.SoundLogic.ExternallyGeneratedSounds import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Item.Equipment import qualified IntMapHelp as IM
import LensHelp import LensHelp
useE :: Euse -> Item -> Creature -> World -> World useE :: Euse -> Item -> Creature -> World -> World
@@ -14,7 +27,108 @@ useE eo = case eo of
EWristShield -> setWristShieldPos EWristShield -> setWristShieldPos
EHeadLamp -> createHeadLamp EHeadLamp -> createHeadLamp
ECamouflage vis -> overCID (crCamouflage .~ vis) ECamouflage vis -> overCID (crCamouflage .~ vis)
EonWristShield -> onEquipWristShield EonWristShield -> onEquipWristShield
EoffWristShield -> onRemoveWristShield EoffWristShield -> onRemoveWristShield
useMagShield :: Item -> Creature -> World -> World
useMagShield it cr w = w & cWorld . magnets . at mgid ?~ themagnet
where
themagnet =
Magnet
{ _mgID = mgid
, _mgUpdate = MagnetUpdateTimer 1
, _mgPos = _crPos cr
, _mgField = MagnetBuBuCurveAroundField 50 200
}
mgid = case it ^? itParams . magShieldMgMIX . _Just of
Just mgid' -> mgid'
Nothing -> IM.newKey $ _magnets (_cWorld w)
onEquipWristShield :: Item -> Creature -> World -> World
onEquipWristShield itm cr w =
w
& pointerToItem itm . itUse . eqEq . eqParams .~ EquipID i
& cWorld . walls . at i ?~ forceField{_wlID = i}
& setWristShieldPos (itm & itUse . eqEq . eqParams .~ EquipID i) cr
where
i = IM.newKey (_walls (_cWorld w))
onRemoveWristShield :: Item -> Creature -> World -> World
onRemoveWristShield itm _ =
(pointerToItem itm . itUse . eqEq . eqParams .~ NoEquipParams) . deleteWallID i
where
i = _eparamID $ _eqParams $ _eqEq $ _itUse itm
setWristShieldPos :: Item -> Creature -> World -> World
setWristShieldPos itm cr w =
w
& moveWallIDUnsafe i wlline
where
i = _eparamID $ _eqParams $ _eqEq $ _itUse itm
wlline = (f (V3 (-10) 7 0), f (V3 10 7 0))
invid = _ipInvID (_itLocation itm)
handtrans = case cr ^? crInvEquipped . ix invid of
Just OnLeftWrist -> \cr' -> translatePointToLeftHand cr' . g
_ -> translatePointToRightHand
g
| twists cr = (+.+.+ V3 (-5) 10 0)
| otherwise = id
f = (+.+ _crPos cr) . stripZ . rotate3 (_crDir cr) . handtrans cr
shieldWall :: Int -> Wall
shieldWall crid =
defaultWall
{ _wlColor = yellow
, _wlOpacity = SeeAbove
, _wlPathable = True
, _wlWalkable = True
, _wlFireThrough = True
, _wlReflect = True
, _wlUnshadowed = False
, _wlRotateTo = False
, _wlStructure = CreaturePart crid -- shieldWallDamage
}
-- TODO the reflection should be controled by the particle
--shieldWallDamage :: Damage -> Wall -> Int -> World -> World
--shieldWallDamage dm _ crid w = case _dmType dm of
---- Lasering -> w
-- _ | isMovementDam dm -> w & creatures . ix crid . crState . crDamage .:~ dm
-- _ -> w
createShieldWall :: Item -> Creature -> World -> World
createShieldWall it cr w = case it ^? itParams . flatShieldWlMIX . _Just of
Nothing ->
let (wlid, w') = createWall ((shieldWall crid){_wlLine = wlline, _wlID = wlid}) w
in w' & pointerToItem it . itParams .~ FlatShieldParams (Just wlid)
Just wid -> moveWallID wid wlline w
where
crid = _crID cr
wlline = (a, b)
crdirv = unitVectorAtAngle $ _crDir cr
crpos = _crPos cr
rad = _crRad cr + 2
a = crpos +.+ rad *.* crdirv -.- 10 *.* therot crdirv
b = crpos +.+ rad *.* crdirv +.+ 10 *.* therot crdirv
therot
| crIsAiming cr = vNormal
| otherwise = rotateV (twoFlatHRot cr) . vNormal
removeShieldWall :: Item -> Creature -> World -> World
removeShieldWall it _ w = case it ^? itParams . flatShieldWlMIX . _Just of
Nothing -> w
Just wid ->
w & deleteWallID wid
& pointerToItem it . itParams . flatShieldWlMIX .~ Nothing
createHeadLamp :: Item -> Creature -> World -> World
createHeadLamp _ cr =
cWorld . tempLightSources
.:~ tlsTimeRadColPos
1
200
0.7
((_crPos cr `v2z` 0) +.+.+ rotate3 (_crDir cr) (translatePointToHead cr (V3 5 0 3)))
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
overCID f _ cr = cWorld . creatures . ix (_crID cr) %~ f
+1 -1
View File
@@ -24,7 +24,7 @@ copyItemToFloorID pos it w = (,) flid $ w'
(p',w') = findWallFreeDropPoint (_dimRad $ _itDimension it) pos w (p',w') = findWallFreeDropPoint (_dimRad $ _itDimension it) pos w
rot = fst . randomR (-pi,pi) $ _randGen w rot = fst . randomR (-pi,pi) $ _randGen w
updateLocation = case it ^? itID of updateLocation = case it ^? itID of
Just (Just i') -> cWorld . itemPositions . ix i' .~ OnFloor flid Just (Just i') -> cWorld . itemLocations . ix i' .~ OnFloor flid
_ -> id _ -> id
flid = IM.newKey $ _floorItems (_cWorld w) flid = IM.newKey $ _floorItems (_cWorld w)
theflit = FlIt theflit = FlIt
+2 -2
View File
@@ -76,8 +76,8 @@ rmInvItem cid invid w = case w ^? cWorld . creatures . ix cid . crInv . ix invid
rmf <- itm ^? itUse . eqEq . eqOnRemove rmf <- itm ^? itUse . eqEq . eqOnRemove
return $ useE rmf itm cr return $ useE rmf itm cr
doanyitemeffect = fromMaybe id $ do doanyitemeffect = fromMaybe id $ do
rmf <- itm ^? itEffect . ieDrop rmf <- itm ^? itEffect . ieOnDrop
return $ doDropEffect rmf itm cr return $ doInvEffect rmf itm cr
removeAnySlotEquipment = case w ^? cWorld . creatures . ix cid . crInvEquipped . ix invid of removeAnySlotEquipment = case w ^? cWorld . creatures . ix cid . crInvEquipped . ix invid of
Just epos -> cWorld . creatures . ix cid . crEquipment . at epos .~ Nothing Just epos -> cWorld . creatures . ix cid . crEquipment . at epos .~ Nothing
Nothing -> id Nothing -> id
+1 -1
View File
@@ -31,7 +31,7 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
maybeInvSlot = checkInvSlotsYou it w maybeInvSlot = checkInvSlotsYou it w
updateItLocation invid w' = case _itID it of updateItLocation invid w' = case _itID it of
Nothing -> w' Nothing -> w'
Just j -> w' & cWorld . itemPositions . ix j .~ InInv cid invid Just j -> w' & cWorld . itemLocations . ix j .~ InInv cid invid
--{- | Pick up a specific item. -} --{- | Pick up a specific item. -}
--putItemInInv :: Int -> FloorItem -> World -> World --putItemInInv :: Int -> FloorItem -> World -> World
+14 -17
View File
@@ -1,6 +1,7 @@
module Dodge.ItEffect where module Dodge.ItEffect where
import Dodge.Euse
import Dodge.Data import Dodge.Data
import Dodge.Item.Equipment
import Dodge.LightSource.Torch import Dodge.LightSource.Torch
import Control.Lens import Control.Lens
@@ -8,25 +9,21 @@ doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
doInvEffect iie = case iie of doInvEffect iie = case iie of
NoInvEffect -> const $ const id NoInvEffect -> const $ const id
RewindEffect -> rewindEffect RewindEffect -> rewindEffect
ResetAttachmentEffect -> resetAttachmentEffect -- ResetAttachmentEffect -> resetAttachmentEffect
OnOffHeldEffect f g -> onOffEff f g EffectIfHeld f g -> onOffEff f g
CreateHeldLight -> createHeldLight CreateHeldLight -> createHeldLight
CreateShieldWall -> createShieldWall CreateShieldWall -> createShieldWall
RemoveShieldWall -> removeShieldWall RemoveShieldWall -> removeShieldWall
EffectWhileHeld f -> onOffEff f NoInvEffect
doFloorEffect :: ItFloorEffect -> Int -> World -> World doFloorEffect :: ItFloorEffect -> Int -> World -> World
doFloorEffect NoFloorEffect = const id doFloorEffect NoFloorEffect = const id
doDropEffect :: ItDropEffect -> Item -> Creature -> World -> World
doDropEffect iie = case iie of
NoDropEffect -> const $ const id
onOffEff :: ItInvEffect -> ItInvEffect -> Item -> Creature -> World -> World onOffEff :: ItInvEffect -> ItInvEffect -> Item -> Creature -> World -> World
onOffEff f g it onOffEff f g it
| _itIsHeld it = doInvEffect f it | _itIsHeld it = doInvEffect f it
| otherwise = doInvEffect g it | otherwise = doInvEffect g it
rewindEffect :: Item -> Creature -> World -> World rewindEffect :: Item -> Creature -> World -> World
rewindEffect itm cr w rewindEffect itm cr w
| Just invid == _crLeftInvSel cr = w & cWorld . rewindWorlds %~ (take maxcharge . (cw : )) | Just invid == _crLeftInvSel cr = w & cWorld . rewindWorlds %~ (take maxcharge . (cw : ))
@@ -34,20 +31,20 @@ rewindEffect itm cr w
| otherwise = w & cWorld . rewindWorlds .~ [] | otherwise = w & cWorld . rewindWorlds .~ []
& ptrWpCharge .~ 0 & ptrWpCharge .~ 0
where where
invid = _ipInvID $ _itPos itm invid = _ipInvID $ _itLocation itm
ptrWpCharge = cWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge ptrWpCharge = cWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
cw = _cWorld w cw = _cWorld w
& rewindWorlds .~ [] & rewindWorlds .~ []
resetAttachmentEffect :: Item -> Creature -> World -> World --resetAttachmentEffect :: Item -> Creature -> World -> World
resetAttachmentEffect itm cr w --resetAttachmentEffect itm cr w
| _ieCounter iteff < 0 = w & pointToIt . itAttachment .~ NoItAttachment -- | _ieCounter iteff < 0 = w & pointToIt . itAttachment .~ NoItAttachment
| otherwise = w & pointToIt . itEffect . ieCounter -~ 1 -- | otherwise = w & pointToIt . itEffect . ieCounter -~ 1
where -- where
iteff = _itEffect itm -- iteff = _itEffect itm
invid = _ipInvID $ _itPos itm -- invid = _ipInvID $ _itLocation itm
pointToIt = cWorld . creatures . ix (_crID cr) . crInv . ix invid -- pointToIt = cWorld . creatures . ix (_crID cr) . crInv . ix invid
createHeldLight :: Item -> Creature -> World -> World createHeldLight :: Item -> Creature -> World -> World
createHeldLight itm cr = createTorchLightOffset cr itm 0 createHeldLight itm cr = createTorchLightOffset cr itm 0
+80 -89
View File
@@ -1,19 +1,21 @@
module Dodge.Item module Dodge.Item (
( module Dodge.Item.Weapon module Dodge.Item.Weapon,
, module Dodge.Item.Consumable module Dodge.Item.Held,
, module Dodge.Item.Equipment module Dodge.Item.Consumable,
, module Dodge.Item.PassKey module Dodge.Item.Equipment,
, module Dodge.Item.Craftable module Dodge.Item.PassKey,
, itemFromBase module Dodge.Item.Craftable,
) where itemFromBase,
import Dodge.Data ) where
import Dodge.Item.Weapon
import Dodge.Item.Equipment import Dodge.Data
import Dodge.Item.Consumable import Dodge.Item.Consumable
import Dodge.Item.PassKey import Dodge.Item.Craftable
import Dodge.Item.Craftable import Dodge.Item.Equipment
import Dodge.Item.Held
import Dodge.Item.PassKey
import Dodge.Item.Weapon
-- this is not ideal, should fold the itemtype into a stackable/unstackable type
itemFromBase :: ItemBaseType -> Item itemFromBase :: ItemBaseType -> Item
itemFromBase ibt = case ibt of itemFromBase ibt = case ibt of
HELD ht -> itemFromHeldType ht HELD ht -> itemFromHeldType ht
@@ -21,94 +23,83 @@ itemFromBase ibt = case ibt of
EQUIP et -> itemFromEquipType et EQUIP et -> itemFromEquipType et
Consumable et -> itemFromConsumableType et Consumable et -> itemFromConsumableType et
CRAFT cr -> makeTypeCraft cr CRAFT cr -> makeTypeCraft cr
itemFromConsumableType :: ConsumableItemType -> Item itemFromConsumableType :: ConsumableItemType -> Item
itemFromConsumableType ct = case ct of itemFromConsumableType ct = case ct of
MEDKIT i -> medkit i MEDKIT i -> medkit i
EXPLOSIVES -> undefined
itemFromEquipType :: EquipItemType -> Item itemFromEquipType :: EquipItemType -> Item
itemFromEquipType et = case et of itemFromEquipType et = case et of
MAGSHIELD -> magShield MAGSHIELD -> magShield
FLAMESHIELD -> flameShield FLAMESHIELD -> flameShield
FRONTARMOUR -> frontArmour FRONTARMOUR -> frontArmour
WRISTARMOUR -> wristArmour WRISTARMOUR -> wristArmour
INVISIBILITYEQUIPMENT GoesOnWrist -> wristInvisibility INVISIBILITYEQUIPMENT GoesOnWrist -> wristInvisibility
INVISIBILITYEQUIPMENT _ -> error "need to define invisibility for more than wrist" INVISIBILITYEQUIPMENT _ -> error "need to define invisibility for more than wrist"
BRAINHAT -> brainHat BRAINHAT -> brainHat
HAT -> hat HAT -> hat
HEADLAMP -> headLamp HEADLAMP -> headLamp
HEADLAMP1 -> headLamp1 POWERLEGS -> powerLegs
POWERLEGS -> powerLegs SPEEDLEGS -> speedLegs
SPEEDLEGS -> speedLegs JUMPLEGS -> jumpLegs
JUMPLEGS -> jumpLegs JETPACK -> jetPack
JETPACK -> jetPack AUTODETECTOR d -> autoDetector d
AUTODETECTOR d -> autoDetector d
itemFromLeftType :: LeftItemType -> Item itemFromLeftType :: LeftItemType -> Item
itemFromLeftType lt = case lt of itemFromLeftType lt = case lt of
BOOSTER -> boosterGun BOOSTER -> boosterGun
REWINDER -> rewindGun REWINDER -> rewindGun
BLINKER -> blinkGun BLINKER -> blinkGun
BLINKERUNSAFE -> unsafeBlinkGun BLINKERUNSAFE -> unsafeBlinkGun
SHRINKER -> shrinkGun SHRINKER -> shrinkGun
SPAWNER -> error "need to datify creatures first" SPAWNER -> error "need to datify creatures first"
-- Equipment
-- Equipment
itemFromHeldType :: HeldItemType -> Item itemFromHeldType :: HeldItemType -> Item
itemFromHeldType ht = case ht of itemFromHeldType ht = case ht of
KEYCARD i -> keyCard i KEYCARD i -> keyCard i
TORCH -> torch TORCH -> torch
SHATTERGUN -> shatterGun SHATTERGUN -> shatterGun
BANGSTICK i -> bangStick i BANGSTICK i -> bangStick i
PISTOL -> pistol PISTOL -> pistol
REVOLVER -> revolver REVOLVER -> revolver
REVOLVERX i -> revolverX i REVOLVERX i -> revolverX i
MACHINEPISTOL -> machinePistol MACHINEPISTOL -> machinePistol
AUTOPISTOL -> autoPistol AUTOPISTOL -> autoPistol
SMG -> smg SMG -> smg
BANGCONE -> bangCone BANGCONE -> bangCone
BLUNDERBUSS -> blunderbuss BLUNDERBUSS -> blunderbuss
GRAPECANNON i -> grapeCannon i GRAPECANNON i -> grapeCannon i
--GRENADELAUNCHER Int -- number of chambers that can be reloaded MINIGUNX i -> miniGunX i
-- --| MORTARCONE / HANDMORTAR VOLLEYGUN i -> volleyGun i
MINIGUNX i -> miniGunX i RIFLE -> rifle
VOLLEYGUN i -> volleyGun i REPEATER -> repeater
RIFLE -> rifle AUTORIFLE -> autoRifle
REPEATER -> repeater BURSTRIFLE -> burstRifle
AUTORIFLE -> autoRifle BANGROD -> bangRod
BURSTRIFLE -> burstRifle ELEPHANTGUN -> elephantGun
-- FASTBURSTRIFLE -> fastBurstRifle AMR -> amr
-- COMPLETEBURSTRIFLE -> completeBurstRifle AUTOAMR -> autoAmr
BANGROD -> bangRod SNIPERRIFLE -> sniperRifle
ELEPHANTGUN -> elephantGun MACHINEGUN -> machineGun
AMR -> amr FLAMESPITTER -> flameSpitter
AUTOAMR -> autoAmr FLAMETHROWER -> flameThrower
SNIPERRIFLE -> sniperRifle FLAMETORRENT -> flameTorrent
MACHINEGUN -> machineGun FLAMEWALL -> flameWall
FLAMESPITTER -> flameSpitter BLOWTORCH -> blowTorch
FLAMETHROWER -> flameThrower SPARKGUN -> sparkGun
FLAMETORRENT -> flameTorrent TESLAGUN -> teslaGun
FLAMEWALL -> flameWall LASGUN -> lasGun
BLOWTORCH -> blowTorch LASCIRCLE -> lasCircle
-- SPREADGUN -> spreadGun DUALBEAM -> dualBeam
-- MULTGUN -> multGun LASWIDE i -> lasWide i
SPARKGUN -> sparkGun TRACTORGUN -> tractorGun
TESLAGUN -> teslaGun LAUNCHER -> launcher
LASGUN -> lasGun LAUNCHERX i -> launcherX i
LASCIRCLE -> lasCircle
--LASPULSE -> lasPulse
DUALBEAM -> dualBeam
--LASGUNSWING -> lasSwing
--LASGUNSWAY -> lasSway
-- LASGUNWIDEPULSE -> lasWidePulse
LASWIDE i -> lasWide i
--LASGUNFOCUS i -> lasFocus i
-- SONICGUN -> sonicGun
TRACTORGUN -> tractorGun
LAUNCHER -> launcher
LAUNCHERX i -> launcherX i
-- --| TRACKINGLAUNCHER
REMOTELAUNCHER -> remoteLauncher REMOTELAUNCHER -> remoteLauncher
POISONSPRAYER -> poisonSprayer POISONSPRAYER -> poisonSprayer
DRONELAUNCHER -> droneLauncher DRONELAUNCHER -> droneLauncher
FORCEFIELDGUN -> forceFieldGun FORCEFIELDGUN -> forceFieldGun
HELDDETECTOR d -> clickDetector d HELDDETECTOR d -> clickDetector d
FLATSHIELD -> flatShield
FLATSHIELD -> flatShield
-42
View File
@@ -1,42 +0,0 @@
module Dodge.Item.Attachment
( charFiringStratI
, changeFuse
) where
import Dodge.Data
import Dodge.ChainEffect
import Dodge.Default
import Control.Lens hiding ((|>),(<|))
import Data.Sequence
import Data.Maybe
import qualified IntMapHelp as IM
charFiringStratI
:: [(Char, ChainEffect)] -- ^ Different firing effects for different characters
-> ChainEffect
charFiringStratI strats eff item cr w = case w ^? cWorld . creatures . ix cid . crInv
. ix (crSel $ _creatures (_cWorld w) IM.! cid) . itUse . heldScroll . hsCharMode of
Just (c :<| _) -> fromMaybe id (Prelude.lookup c strats) eff item cr w
_ -> w
where
cid = _crID cr
changeFuse
:: Float -- ^ Old fuse time
-> Creature -- ^ Inventory item reference (I believe)
-> Item
-> Item
changeFuse scrollAmount _ it = it
& ( itAttachment .~ AttachFuse newTime )
& ( itUse . useAim . aimZoom .~ defaultItZoom{_itZoomMax = zm, _itZoomMin = zm} )
where
oldTime = _atFuseTime $ _itAttachment it
newTime = min 90 $ max 20 $ oldTime - round (5 * scrollAmount)
zm = 50 / fromIntegral newTime
--removeItAttachment :: Int -> Int -> World -> World
--removeItAttachment i _ w = w & creatures . ix i . crInv . ix itRef . itAttachment .~ NoItAttachment
-- where
-- cr = _creatures w IM.! i
-- itRef = _crInvSel cr
+1 -1
View File
@@ -33,7 +33,7 @@ pictureWeaponAim
-> Creature -> Creature
-> Item -> Item
-> SPic -> SPic
pictureWeaponAim f cr itm = case _itPos itm of pictureWeaponAim f cr itm = case _itLocation itm of
InInv _ i -> pictureWeaponOnAimItem (f itm) cr i InInv _ i -> pictureWeaponOnAimItem (f itm) cr i
_ -> mempty _ -> mempty
-1
View File
@@ -31,7 +31,6 @@ equipItemSPic et _ = case et of
BRAINHAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4) BRAINHAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
HAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4) HAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
HEADLAMP -> noPic headLampShape HEADLAMP -> noPic headLampShape
HEADLAMP1 -> noPic headLampShape
POWERLEGS -> legsSPic yellow POWERLEGS -> legsSPic yellow
SPEEDLEGS -> legsSPic green SPEEDLEGS -> legsSPic green
JUMPLEGS -> legsSPic red JUMPLEGS -> legsSPic red
+9 -208
View File
@@ -3,283 +3,89 @@ module Dodge.Item.Equipment (
torch, torch,
magShield, magShield,
powerLegs, powerLegs,
flatShield,
wristInvisibility, wristInvisibility,
wristArmour, wristArmour,
hat, hat,
brainHat, brainHat,
frontArmour, frontArmour,
headLamp, headLamp,
headLamp1,
jetPack, jetPack,
speedLegs, speedLegs,
jumpLegs, jumpLegs,
flameShield, flameShield,
useMagShield,
setWristShieldPos,
createHeadLamp,
overCID,
onEquipWristShield,
onRemoveWristShield,
createShieldWall,
removeShieldWall,
) where ) where
import Data.Maybe import Dodge.Data.CamouflageStatus
import Dodge.Creature.HandPos import Dodge.Data.Item
import Dodge.Creature.Test
import Dodge.Data
import Dodge.Default import Dodge.Default
import Dodge.Item.Equipment.Booster import Dodge.Item.Equipment.Booster
import Dodge.Item.HeldOffset
import Dodge.LightSource
import Dodge.Wall
import Dodge.Wall.ForceField
import Geometry
import qualified IntMapHelp as IM
import LensHelp import LensHelp
import Picture
magShield :: Item magShield :: Item
magShield = magShield =
defaultEquipment defaultEquipment
{ _itID = Nothing & itParams .~ MagShieldParams Nothing
, _itAttachment = AttachMInt Nothing & itUse . eqEq . eqUse .~ EMagShield
}
& itUse . eqEq . eqUse .~ EMagShield --useMagShield
& itUse . eqEq . eqSite .~ GoesOnWrist & itUse . eqEq . eqSite .~ GoesOnWrist
& itType . iyBase .~ EQUIP MAGSHIELD & itType . iyBase .~ EQUIP MAGSHIELD
useMagShield :: Item -> Creature -> World -> World
useMagShield it cr w = w & cWorld . magnets . at mgid ?~ themagnet
where
themagnet =
Magnet
{ _mgID = mgid
, _mgUpdate = MagnetUpdateTimer 1
, _mgPos = _crPos cr
, _mgField = MagnetBuBuCurveAroundField 50 200
}
mgid = case it ^? itAttachment . atMInt . _Just of
Just mgid' -> mgid'
Nothing -> IM.newKey $ _magnets (_cWorld w)
-- it = _crInv cr IM.! invid
flameShield :: Item flameShield :: Item
flameShield = flameShield =
defaultEquipment defaultEquipment
{ _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnChest & itUse . eqEq . eqSite .~ GoesOnChest
& itType . iyBase .~ EQUIP FLAMESHIELD & itType . iyBase .~ EQUIP FLAMESHIELD
-- | Slows you down, blocks forward projectiles.
frontArmour :: Item frontArmour :: Item
frontArmour = frontArmour =
defaultEquipment defaultEquipment
{ _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnChest & itUse . eqEq . eqSite .~ GoesOnChest
& itType . iyBase .~ EQUIP FRONTARMOUR & itType . iyBase .~ EQUIP FRONTARMOUR
wristArmour :: Item wristArmour :: Item
wristArmour = wristArmour =
defaultEquipment defaultEquipment
{ _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnWrist & itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . eqEq . eqOnEquip .~ EonWristShield --onEquipWristShield & itUse . eqEq . eqOnEquip .~ EonWristShield
& itUse . eqEq . eqUse .~ EWristShield --setWristShieldPos & itUse . eqEq . eqUse .~ EWristShield
& itUse . eqEq . eqOnRemove .~ EoffWristShield --onRemoveWristShield & itUse . eqEq . eqOnRemove .~ EoffWristShield
& itType . iyBase .~ EQUIP WRISTARMOUR & itType . iyBase .~ EQUIP WRISTARMOUR
onEquipWristShield :: Item -> Creature -> World -> World
onEquipWristShield itm cr w =
w
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itPos itm)) . itUse . eqEq . eqParams .~ EquipID i
& cWorld . walls . at i ?~ forceField{_wlID = i}
& setWristShieldPos (itm & itUse . eqEq . eqParams .~ EquipID i) cr
where
i = IM.newKey (_walls (_cWorld w))
onRemoveWristShield :: Item -> Creature -> World -> World
onRemoveWristShield itm cr w =
w
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itPos itm)) . itUse . eqEq . eqParams .~ NoEquipParams
& deleteWallID i
where
i = _eparamID $ _eqParams $ _eqEq $ _itUse itm
setWristShieldPos :: Item -> Creature -> World -> World
setWristShieldPos itm cr w =
w
& moveWallIDUnsafe i wlline
where
i = _eparamID $ _eqParams $ _eqEq $ _itUse itm
wlline = (f (V3 (-10) 7 0), f (V3 10 7 0))
invid = _ipInvID (_itPos itm)
--wlline = (V2 10 0, V2 (-10) 100)
handtrans = case cr ^? crInvEquipped . ix invid of
Just OnLeftWrist -> \cr' -> translatePointToLeftHand cr' . g
_ -> translatePointToRightHand
g
| twists cr = (+.+.+ V3 (-5) 10 0)
| otherwise = id
f = (+.+ _crPos cr) . stripZ . rotate3 (_crDir cr) . handtrans cr
torch :: Item torch :: Item
torch = torch =
defaultWeapon defaultWeapon
& itEffect .~ effectOnOffHeld CreateHeldLight NoInvEffect -- createHeldLight (const $ const id) & itEffect . ieInv .~ EffectWhileHeld CreateHeldLight
& itType . iyBase .~ HELD TORCH & itType . iyBase .~ HELD TORCH
& itUse . useAim . aimHandlePos .~ 5 & itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 10 & itUse . useAim . aimMuzPos .~ 10
flatShield :: Item
flatShield =
defaultWeapon
& itEffect .~ effectOnOffHeld 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
shieldWall :: Int -> Wall
shieldWall crid =
defaultWall
{ _wlColor = yellow
, _wlOpacity = SeeAbove
, _wlPathable = True
, _wlWalkable = True
, _wlFireThrough = True
, _wlReflect = True
, _wlUnshadowed = False
, _wlRotateTo = False
, _wlStructure = CreaturePart crid -- shieldWallDamage
}
-- TODO the reflection should be controled by the particle
--shieldWallDamage :: Damage -> Wall -> Int -> World -> World
--shieldWallDamage dm _ crid w = case _dmType dm of
---- Lasering -> w
-- _ | isMovementDam dm -> w & creatures . ix crid . crState . crDamage .:~ dm
-- _ -> w
createShieldWall :: Item -> Creature -> World -> World
createShieldWall it cr w = case it ^? itEffect . ieMID . _Just of
Nothing ->
let (wlid, w') = createWall ((shieldWall crid){_wlLine = wlline, _wlID = wlid}) w
in w' & cWorld . creatures . ix crid . crInv . ix invid . itEffect . ieMID ?~ wlid
Just wid -> moveWallID wid wlline w
where
invid = fromJust $ _itID it
crid = _crID cr
wlline = (a, b)
crdirv = unitVectorAtAngle $ _crDir cr
crpos = _crPos cr
rad = _crRad cr + 2
a = crpos +.+ rad *.* crdirv -.- 10 *.* therot crdirv
b = crpos +.+ rad *.* crdirv +.+ 10 *.* therot crdirv
therot
| crIsAiming cr = vNormal
| otherwise = rotateV (twoFlatHRot cr) . vNormal
removeShieldWall :: Item -> Creature -> World -> World
removeShieldWall it cr w = case _ieMID $ _itEffect it of
Nothing -> w
Just wid ->
w & deleteWallID wid
& cWorld . creatures . ix crid . crInv . ix invid . itEffect . ieMID .~ Nothing
where
crid = _crID cr
invid = fromJust (_itID it)
effectOnOffHeld ::
-- | effect when held
ItInvEffect ->
-- | effect when not held
ItInvEffect ->
ItEffect
effectOnOffHeld f f' =
ItInvEffectID
{ _ieInv = OnOffHeldEffect f f'
, _ieMID = Nothing
}
-- | Increases speed, reduces friction, cannot only move forwards.
jetPack :: Item jetPack :: Item
jetPack = jetPack =
defaultEquipment defaultEquipment
{ _itEffect = NoItEffect
, _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnBack & itUse . eqEq . eqSite .~ GoesOnBack
& itType . iyBase .~ EQUIP JETPACK & itType . iyBase .~ EQUIP JETPACK
brainHat :: Item brainHat :: Item
brainHat = brainHat =
defaultEquipment defaultEquipment
{ _itEffect = NoItEffect
, _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ EQUIP BRAINHAT & itType . iyBase .~ EQUIP BRAINHAT
hat :: Item hat :: Item
hat = hat =
defaultEquipment defaultEquipment
{ _itEffect = NoItEffect
, _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ EQUIP HAT & itType . iyBase .~ EQUIP HAT
headLamp1 :: Item
headLamp1 =
defaultEquipment
{ _itEffect = NoItEffect
, _itID = Nothing
}
& itUse . eqEq . eqUse .~ EHeadLamp --createHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ EQUIP HEADLAMP1
headLamp :: Item headLamp :: Item
headLamp = headLamp =
defaultEquipment defaultEquipment
{ _itEffect = NoItEffect & itUse . eqEq . eqUse .~ EHeadLamp
, _itID = Nothing
}
& itUse . eqEq . eqUse .~ EHeadLamp --createHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ EQUIP HEADLAMP & itType . iyBase .~ EQUIP HEADLAMP
createHeadLamp :: Item -> Creature -> World -> World
createHeadLamp _ cr =
cWorld . tempLightSources
.:~ tlsTimeRadColPos
1
200
0.7
((_crPos cr `v2z` 0) +.+.+ rotate3 (_crDir cr) (translatePointToHead cr (V3 5 0 3)))
powerLegs :: Item powerLegs :: Item
powerLegs = powerLegs =
defaultEquipment defaultEquipment
{ _itEffect = NoItEffect
, _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnLegs & itUse . eqEq . eqSite .~ GoesOnLegs
& itType . iyBase .~ EQUIP POWERLEGS & itType . iyBase .~ EQUIP POWERLEGS
@@ -296,12 +102,7 @@ jumpLegs =
wristInvisibility :: Item wristInvisibility :: Item
wristInvisibility = wristInvisibility =
defaultEquipment defaultEquipment
{ _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnWrist & itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . eqEq . eqOnEquip .~ ECamouflage Invisible --overCID (crCamouflage .~ Invisible) & itUse . eqEq . eqOnEquip .~ ECamouflage Invisible --overCID (crCamouflage .~ Invisible)
& itUse . eqEq . eqOnRemove .~ ECamouflage FullyVisible --overCID (crCamouflage .~ FullyVisible) & itUse . eqEq . eqOnRemove .~ ECamouflage FullyVisible --overCID (crCamouflage .~ FullyVisible)
& itType . iyBase .~ EQUIP (INVISIBILITYEQUIPMENT GoesOnWrist) & itType . iyBase .~ EQUIP (INVISIBILITYEQUIPMENT GoesOnWrist)
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
overCID f _ cr = cWorld . creatures . ix (_crID cr) %~ f
+3 -3
View File
@@ -12,9 +12,9 @@ boosterGun =
defaultLeftItem defaultLeftItem
{ _itInvColor = cyan { _itInvColor = cyan
, _itUse = luseInstantNoH LBoost , _itUse = luseInstantNoH LBoost
, _itEffect = resetAttachmentID -- , _itEffect = resetAttachmentID
} }
& itType . iyBase .~ LEFT BOOSTER & itType . iyBase .~ LEFT BOOSTER
resetAttachmentID :: ItEffect --resetAttachmentID :: ItEffect
resetAttachmentID = ItInvEffect ResetAttachmentEffect 0 --resetAttachmentID = ItInvEffect ResetAttachmentEffect 0
+1 -1
View File
@@ -8,7 +8,7 @@ import Data.Maybe
pictureOnEquip :: SPic -> Creature -> Item -> SPic pictureOnEquip :: SPic -> Creature -> Item -> SPic
pictureOnEquip sp cr itm = fromMaybe mempty $ do pictureOnEquip sp cr itm = fromMaybe mempty $ do
i <- itm ^? itPos . ipInvID i <- itm ^? itLocation . ipInvID
epos <- cr^? crInvEquipped . ix i epos <- cr^? crInvEquipped . ix i
return $ equipPosition epos cr sp return $ equipPosition epos cr sp
+24
View File
@@ -0,0 +1,24 @@
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
+11 -7
View File
@@ -12,26 +12,30 @@ getHeldItemLoc :: Creature -> World -> (World,Int)
getHeldItemLoc cr w = case maybeitid of getHeldItemLoc cr w = case maybeitid of
Nothing -> Nothing ->
( w & cWorld . creatures . ix cid . crInv . ix j . itID ?~ newitid ( w & cWorld . creatures . ix cid . crInv . ix j . itID ?~ newitid
& cWorld . itemPositions %~ IM.insert newitid (InInv cid j) & cWorld . itemLocations %~ IM.insert newitid (InInv cid j)
, itid) , itid)
_ -> (w, itid) _ -> (w, itid)
where where
cid = _crID cr cid = _crID cr
j = crSel cr j = crSel cr
newitid = IM.newKey $ _itemPositions (_cWorld w) newitid = IM.newKey $ _itemLocations (_cWorld w)
maybeitid = cr ^? crInv . ix j . itID . _Just maybeitid = cr ^? crInv . ix j . itID . _Just
itid = fromMaybe newitid maybeitid itid = fromMaybe newitid maybeitid
getItem :: Int -> World -> Maybe Item getItem :: Int -> World -> Maybe Item
getItem itid w = do getItem itid w = do
itpos <- w ^? cWorld . itemPositions . ix itid itpos <- w ^? cWorld . itemLocations . ix itid
case itpos of case itpos of
OnFloor flitid -> w ^? cWorld . floorItems . ix flitid . flIt OnFloor flitid -> w ^? cWorld . floorItems . ix flitid . flIt
InInv cid invid -> w ^? cWorld . creatures . ix cid . crInv . ix invid InInv cid invid -> w ^? cWorld . creatures . ix cid . crInv . ix invid
VoidItm -> Nothing VoidItm -> Nothing
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 => pointerToItem :: Applicative f =>
ItemPos -> (Item -> f Item) -> World -> f World Item -> (Item -> f Item) -> World -> f World
pointerToItem (InInv cid invid) = cWorld . creatures . ix cid . crInv . ix invid pointerToItem = pointerToItemLocation . _itLocation
pointerToItem (OnFloor flid) = cWorld . floorItems . ix flid . flIt
pointerToItem _ = const pure
+2 -10
View File
@@ -5,17 +5,9 @@ import Picture
import LensHelp import LensHelp
keyCard :: Int -> Item keyCard :: Int -> Item
keyCard n = defaultEquipment keyCard n = defaultEquipment
{ _itEffect = NoItEffect & itInvColor .~ aquamarine
, _itID = Nothing
-- , _itZoom = defaultItZoom
, _itInvColor = aquamarine
}
& itType . iyBase .~ HELD (KEYCARD n) & itType . iyBase .~ HELD (KEYCARD n)
latchkey :: Int -> Item latchkey :: Int -> Item
latchkey _ = defaultEquipment latchkey _ = defaultEquipment
{ _itEffect = NoItEffect & itInvColor .~ yellow
, _itID = Nothing
-- , _itZoom = defaultItZoom
, _itInvColor = yellow
}
+2 -2
View File
@@ -38,11 +38,11 @@ import qualified SDL
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
autoEffect eff t sid itm cr w autoEffect eff t sid itm cr w
| _eparamInt (_eqParams (_eqEq $ _itUse itm)) < 1 = eff itm cr w | _eparamInt (_eqParams (_eqEq $ _itUse itm)) < 1 = eff itm cr w
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itPos itm) & cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
. itUse . eqEq . eqParams . eparamInt .~ t . itUse . eqEq . eqParams . eparamInt .~ t
& soundStart OnceSound (_crPos cr) sid Nothing & soundStart OnceSound (_crPos cr) sid Nothing
| otherwise = w | otherwise = w
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itPos itm) & cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
. itUse . eqEq . eqParams . eparamInt -~ 1 . itUse . eqEq . eqParams . eparamInt -~ 1
{- | Automatically send out radar pulses that detect walls. -} {- | Automatically send out radar pulses that detect walls. -}
+1 -1
View File
@@ -118,5 +118,5 @@ explodeRemoteRocket itid pjid w =
& itPoint . itUse . rUse .~ HeldDoNothing & itPoint . itUse . rUse .~ HeldDoNothing
& usePayload (_prjPayload thepj) (_prjPos thepj) & usePayload (_prjPayload thepj) (_prjPos thepj)
where where
itPoint = pointerToItem $ _itemPositions (_cWorld w) IM.! itid itPoint = pointerToItemLocation $ _itemLocations (_cWorld w) IM.! itid
thepj = _projectiles (_cWorld w) IM.! pjid thepj = _projectiles (_cWorld w) IM.! pjid
+3 -5
View File
@@ -1,18 +1,16 @@
module Dodge.Item.Weapon.Remote module Dodge.Item.Weapon.Remote
( pointerToItem ( setRemoteScope
, setRemoteScope
, setRemoteBombScope , setRemoteBombScope
) where ) where
import Dodge.Data import Dodge.Data
import Dodge.Default import Dodge.Default
import Geometry import Geometry
import Dodge.Item.Location
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import Control.Lens import Control.Lens
setRemoteBombScope :: Int -> Prop -> World -> World setRemoteBombScope :: Int -> Prop -> World -> World
setRemoteBombScope itid pj w' = case _itemPositions (_cWorld w') IM.! itid of setRemoteBombScope itid pj w' = case _itemLocations (_cWorld w') IM.! itid of
InInv cid invid InInv cid invid
-> w' & cWorld . creatures . ix cid . crInv . ix invid . itScope -> w' & cWorld . creatures . ix cid . crInv . ix invid . itScope
. scopePos .~ (_prPos pj -.- _crPos (_creatures (_cWorld w') IM.! cid)) . scopePos .~ (_prPos pj -.- _crPos (_creatures (_cWorld w') IM.! cid))
@@ -21,7 +19,7 @@ setRemoteBombScope itid pj w' = case _itemPositions (_cWorld w') IM.! itid of
_ -> w' _ -> w'
setRemoteScope :: Int -> Point2 -> World -> World setRemoteScope :: Int -> Point2 -> World -> World
setRemoteScope itid pos w' = case w' ^? cWorld . itemPositions . ix itid of setRemoteScope itid pos w' = case w' ^? cWorld . itemLocations . ix itid of
Just (InInv cid' invid ) Just (InInv cid' invid )
-> w' & cWorld . creatures . ix cid' . crInv . ix invid . itScope -> w' & cWorld . creatures . ix cid' . crInv . ix invid . itScope
. scopePos .~ (pos -.- _crPos (_creatures (_cWorld w') IM.! cid')) . scopePos .~ (pos -.- _crPos (_creatures (_cWorld w') IM.! cid'))
+1 -1
View File
@@ -363,7 +363,7 @@ shootL f item cr w
| otherwise = w | otherwise = w
where where
cid = _crID cr cid = _crID cr
invid = _ipInvID $ _itPos item invid = _ipInvID $ _itLocation item
pointerToItem = cWorld . creatures . ix cid . crInv . ix invid pointerToItem = cWorld . creatures . ix cid . crInv . ix invid
fireCondition = _rateTime (_useDelay (_itUse item)) == 0 fireCondition = _rateTime (_useDelay (_itUse item)) == 0
&& _arLoaded (_leftConsumption (_itUse item)) > 0 && _arLoaded (_leftConsumption (_itUse item)) > 0
+4 -6
View File
@@ -18,12 +18,12 @@ rewindGun :: Item
rewindGun = rewindGun =
defaultLeftItem defaultLeftItem
{ _itInvColor = cyan { _itInvColor = cyan
, _itEffect = ItRewindEffect RewindEffect -- []
, _itUse = , _itUse =
defaultlUse defaultlUse
& lUse .~ LRewind --useRewindGun & lUse .~ LRewind --useRewindGun
& eqEq . eqSite .~ GoesOnChest & eqEq . eqSite .~ GoesOnChest
} }
& itEffect . ieInv .~ RewindEffect
& itType . iyBase .~ LEFT REWINDER & itType . iyBase .~ LEFT REWINDER
& itUse . leftConsumption & itUse . leftConsumption
.~ ChargeableAmmo .~ ChargeableAmmo
@@ -35,10 +35,8 @@ rewindGun =
shrinkGun :: Item shrinkGun :: Item
shrinkGun = shrinkGun =
defaultLeftItem defaultLeftItem
{ _itUse = defaultlUse & lUse .~ LShrink -- hammerCheckL useShrinkGun & itUse .~ (defaultlUse & lUse .~ LShrink)
-- , _itFloorPict = shrinkGunPic & itParams .~ ShrinkGunParams FullSize
, _itAttachment = AttachBool True
}
& itType . iyBase .~ LEFT SHRINKER & itType . iyBase .~ LEFT SHRINKER
shrinkGunPic :: Item -> SPic shrinkGunPic :: Item -> SPic
@@ -100,7 +98,7 @@ useForceFieldGun itm cr w = fromMaybe w $ do
return $ return $
w w
& cWorld . walls %~ IM.insertWith (\_ x -> x) i forceField{_wlID = i} & cWorld . walls %~ IM.insertWith (\_ x -> x) i forceField{_wlID = i}
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itPos itm)) . itParams . paramMID ?~ i & cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itLocation itm)) . itParams . paramMID ?~ i
& moveWallIDUnsafe i wlline & moveWallIDUnsafe i wlline
where where
i = fromMaybe (IM.newKey (_walls (_cWorld w))) $ itm ^? itParams . paramMID . _Just i = fromMaybe (IM.newKey (_walls (_cWorld w))) $ itm ^? itParams . paramMID . _Just
+29 -28
View File
@@ -1,7 +1,6 @@
module Dodge.Luse where module Dodge.Luse where
import Dodge.Base import Dodge.Base
import Data.Maybe
import Dodge.Creature.Action import Dodge.Creature.Action
import Dodge.Data import Dodge.Data
import Dodge.Default.Creature import Dodge.Default.Creature
@@ -38,16 +37,16 @@ useRewindGun _ _ w = case _rewindWorlds (_cWorld w) of
-- creature but using the old crInvSel value -- creature but using the old crInvSel value
-- 22.05.23 this has been changed from using invids to items -- 22.05.23 this has been changed from using invids to items
useShrinkGun :: Item -> Creature -> World -> World useShrinkGun :: Item -> Creature -> World -> World
useShrinkGun it cr w = useShrinkGun it cr w = case it ^? itParams . shrinkGunStatus of
if _atBool $ _itAttachment it Just FullSize -> tryResize 0.5 $ stripNoItems cr . f Shrunk UndroppableIdentified . dropExcept cr invid
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropExcept cr invid Just Shrunk -> tryResize 1 $ f FullSize Uncursed . setMinInvSize defaultInvSize cr
else tryResize 1 $ f True Uncursed . setMinInvSize defaultInvSize cr Nothing -> error "useShrinkGun applied to item with incorrect ItParam"
where where
invid = _ipInvID $ _itPos it invid = _ipInvID $ _itLocation it
tryResize x g = maybe w g $ sizeSelf x cr w tryResize x g = maybe w g $ sizeSelf x cr w
f isInUse cstatus = f isInUse cstatus =
cWorld . creatures . ix (_crID cr) . crInv . ix invid cWorld . creatures . ix (_crID cr) . crInv . ix invid
%~ ((itAttachment . atBool .~ isInUse) . (itCurseStatus .~ cstatus)) %~ ((itParams . shrinkGunStatus .~ isInUse) . (itCurseStatus .~ cstatus))
boostSelfL :: boostSelfL ::
-- | boost amount -- | boost amount
@@ -56,27 +55,29 @@ boostSelfL ::
Creature -> Creature ->
World -> World ->
World World
boostSelfL x itm cr w = case boostPoint x cr w of boostSelfL = undefined
Left p -> crEff p (itUse . leftConsumption . arLoaded .~ 0)
Right p -> crEff p (itUse . leftConsumption . arLoaded -~ 1) --boostSelfL x itm cr w = case boostPoint x cr w of
where -- Left p -> crEff p (itUse . leftConsumption . arLoaded .~ 0)
invid = _ipInvID $ _itPos itm -- Right p -> crEff p (itUse . leftConsumption . arLoaded -~ 1)
cid = _crID cr -- where
cpos = _crPos cr -- invid = _ipInvID $ _itLocation itm
r = _crRad cr -- cid = _crID cr
pid = -- cpos = _crPos cr
fromMaybe -- r = _crRad cr
(IM.newKey $ _props (_cWorld w)) -- pid =
(cr ^? crInv . ix invid . itAttachment . atInt) -- fromMaybe
crEff p ammoEff = -- (IM.newKey $ _props (_cWorld w))
addBoostShockwave pid p (r *.* normalizeV (p -.- cpos)) w -- (cr ^? crInv . ix invid . itAttachment . atInt)
& cWorld . creatures . ix cid -- crEff p ammoEff =
%~ (crPos .~ p) -- addBoostShockwave pid p (r *.* normalizeV (p -.- cpos)) w
. ( crInv . ix invid -- & cWorld . creatures . ix cid
%~ ammoEff -- %~ (crPos .~ p)
. (itEffect . ieCounter .~ 1) -- . ( crInv . ix invid
. (itAttachment .~ AttachInt pid) -- %~ ammoEff
) -- . (itEffect . ieCounter .~ 1)
-- . (itAttachment .~ AttachInt pid)
-- )
-- | Move a creature towards the mouse position, with shockwave -- | Move a creature towards the mouse position, with shockwave
boostPoint :: boostPoint ::
+5 -5
View File
@@ -69,9 +69,9 @@ explodeRemoteRocket' mitid thepj w =
where where
updateitem = fromMaybe (cWorld . projectiles . at pjid .~ Nothing) $ do updateitem = fromMaybe (cWorld . projectiles . at pjid .~ Nothing) $ do
itid <- mitid itid <- mitid
itpos <- w ^? cWorld . itemPositions . ix itid itpos <- w ^? cWorld . itemLocations . ix itid
return $ return $
(pointerToItem itpos . itUse . rUse .~ HeldDoNothing) (pointerToItemLocation itpos . itUse . rUse .~ HeldDoNothing)
. (cWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote itid 30 pjid]) . (cWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote itid 30 pjid])
pjid = _prjID thepj pjid = _prjID thepj
@@ -125,7 +125,7 @@ upProjectile pu pj = case pu of
retireRemoteProj'' :: Int -> Int -> World -> World retireRemoteProj'' :: Int -> Int -> World -> World
retireRemoteProj'' itid pjid w = retireRemoteProj'' itid pjid w =
w w
& pointerToItem (_itemPositions (_cWorld w) IM.! itid) & pointerToItemLocation (_itemLocations (_cWorld w) IM.! itid)
%~ ( (itScope . scopePos .~ V2 0 0) %~ ( (itScope . scopePos .~ V2 0 0)
. (itUse . rUse .~ HeldFireRemoteShell) . (itUse . rUse .~ HeldFireRemoteShell)
) )
@@ -138,7 +138,7 @@ setRemoteDir cid itid pj w = w & cWorld . projectiles . ix (_prjID pj) . prjDir
newdir newdir
| SDL.ButtonRight `M.member` _mouseButtons w | SDL.ButtonRight `M.member` _mouseButtons w
&& w ^? cWorld . creatures . ix cid . crInvSel . iselPos && w ^? cWorld . creatures . ix cid . crInvSel . iselPos
== w ^? cWorld . itemPositions . ix itid . ipInvID = == w ^? cWorld . itemLocations . ix itid . ipInvID =
_cameraRot (_cWorld w) + argV (_mousePos w) _cameraRot (_cWorld w) + argV (_mousePos w)
| otherwise = _prjDir pj | otherwise = _prjDir pj
@@ -189,7 +189,7 @@ pjTrack' itid pj w = rotateToTarget pj w
(_prjPos pj) (_prjPos pj)
tpos tpos
(argV $ _prjAcc pj) (argV $ _prjAcc pj)
itPoint = pointerToItem $ _itemPositions (_cWorld w) IM.! itid itPoint = pointerToItemLocation $ _itemLocations (_cWorld w) IM.! itid
reduceSpinBy' :: Float -> Proj -> World -> World reduceSpinBy' :: Float -> Proj -> World -> World
reduceSpinBy' x pj = cWorld . projectiles . ix (_prjID pj) . prjSpin *~ x reduceSpinBy' x pj = cWorld . projectiles . ix (_prjID pj) . prjSpin *~ x