diff --git a/src/Dodge/Combine.hs b/src/Dodge/Combine.hs index 2b8292d27..630e2b7e7 100644 --- a/src/Dodge/Combine.hs +++ b/src/Dodge/Combine.hs @@ -39,6 +39,10 @@ itemCombinations = map (first toMultiset) $ , p [RIFLE,SPRING,CAN] assaultRifle , p [PIPE,PIPE,PIPE,HARDWARE] bangRod + , p [BANGROD,PLANK,HARDWARE] elephantGun + , p [ELEPHANTGUN,HARDWARE,TIN] amr + , p [ELEPHANTGUN,HARDWARE,CAN] sniperRifle + , p [BANGROD,PLATE,DRUM,MOTOR] machineGun , p [TUBE,TUBE,TUBE,HARDWARE] launcher ] @@ -49,7 +53,7 @@ itemCombinations = map (first toMultiset) $ p = (,) combinations :: [(M.Map CombineType Int, CombineType)] -combinations = map (second _itCombineType) itemCombinations +combinations = map (second _itType) itemCombinations combineToItem :: M.Map CombineType Int -> Maybe Item combineToItem m = lookup m itemCombinations @@ -82,7 +86,7 @@ itemMultisets (i,it) = case it ^? itConsumption . itAmount' of Nothing -> [ ([i], M.singleton thetype 1 ) ] Just n -> map (\k -> (replicate k i, M.singleton thetype k)) [1..n] where - thetype = _itCombineType it + thetype = _itType it itemTypeAmounts :: Item -> [[CombineType]] @@ -90,13 +94,13 @@ itemTypeAmounts it = case it ^? itConsumption . itAmount' of Nothing -> [[thetype]] Just i -> map (`replicate` thetype) [1 .. i] where - thetype = _itCombineType it + thetype = _itType it combineItemListYou :: World -> [([Int],Item)] combineItemListYou = combineItemList . yourInv combineListYou :: World -> [([Int],CombineType)] -combineListYou = fmap (second _itCombineType) . combineItemListYou +combineListYou = fmap (second _itType) . combineItemListYou toggleCombineInv :: World -> World toggleCombineInv w = case _inventoryMode w of diff --git a/src/Dodge/Combine/Data.hs b/src/Dodge/Combine/Data.hs index 80085ab05..8ad23d242 100644 --- a/src/Dodge/Combine/Data.hs +++ b/src/Dodge/Combine/Data.hs @@ -6,7 +6,6 @@ data CombineType = NOTDEFINED -- Weapons | BANGSTICK Int - | BANGROD | PISTOL | REVOLVER | REVOLVERX Int @@ -20,12 +19,17 @@ data CombineType | GRAPESHOTCANNON | GRENADELAUNCHER Int -- number of chambers that can be reloaded -- | MORTARCONE / HANDMORTAR - | MINIGUN | BANGCANE + | MINIGUN | BANGCANEX Int | RIFLE | AUTORIFLE | ASSAULTRIFLE + | BANGROD + | ELEPHANTGUN + | AMR + | SNIPERRIFLE + | MACHINEGUN | AUTOGUN | SPREADGUN | MULTGUN @@ -67,40 +71,16 @@ data CombineType | PRISM | LIGHTER | MAGNET - | TPipe + | PLATE + | MCHIP + | LED + | NAILBOX + | IRONBAR + | LIGHTSENSOR + | SOUNDSENSOR + | COPPERWIRE + | BATTERY + | FUELCELL + | PORTABLEFUSION | NoCombineType - | TLongPipe - | TVeryLongPipe - | TTube - | TPlate - | TMChip - | TMagnet - | TMotor - | TLED - | THardware - | TNailbox - | TPlank - | TPrism - | TIronBar - | TLightSensor - | TSoundSensor - | THeatSensor - | TCopperWire - | TEmptyCan - | TEmptyTin - | TPistol - | TAutoGun - | TRifle - | TLtAutoGun - | THvAutoGun - | THvRifle - | TMultGun Int - | TSpreadGun Int - | TLauncher Int - | TBattery - | TFuelCell - | TPortableFusion - | TAutoFiringMech - | TFiringMech - | TTargetingModule deriving (Eq,Ord,Show) diff --git a/src/Dodge/Creature/Impulse/Movement.hs b/src/Dodge/Creature/Impulse/Movement.hs index 021ef706a..d15960208 100644 --- a/src/Dodge/Creature/Impulse/Movement.hs +++ b/src/Dodge/Creature/Impulse/Movement.hs @@ -111,6 +111,6 @@ equipSpeed _ = 1 {- | Speed modifier of an item when aiming. -} equipAimSpeed :: Item -> Float -- TODO remove/rethink equipAimSpeed it - | _itCombineType it == FRONTARMOUR = 0.5 - | _itCombineType it == FLAMESHIELD = 0.5 + | _itType it == FRONTARMOUR = 0.5 + | _itType it == FLAMESHIELD = 0.5 | otherwise = 1 diff --git a/src/Dodge/Creature/Property.hs b/src/Dodge/Creature/Property.hs index b9281270b..30c7d6a9a 100644 --- a/src/Dodge/Creature/Property.hs +++ b/src/Dodge/Creature/Property.hs @@ -11,7 +11,7 @@ import Control.Lens crIsArmouredFrom :: Point2 -> Creature -> Bool crIsArmouredFrom p cr = p /= _crPos cr - && any (\it -> it ^? itCombineType == Just FRONTARMOUR) (_crInv cr) + && any (\it -> it ^? itType == Just FRONTARMOUR) (_crInv cr) && angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crPos cr) < pi/2 -- even though angleVV can generate NaN, the comparison seems to deal with it diff --git a/src/Dodge/Creature/State.hs b/src/Dodge/Creature/State.hs index 82b271c07..ca35768b9 100644 --- a/src/Dodge/Creature/State.hs +++ b/src/Dodge/Creature/State.hs @@ -110,7 +110,7 @@ movementSideEff cr w _ -> w | otherwise = footstepSideEffect cr w where - hasJetPack = any (\it -> it ^? itCombineType == Just JETPACK) $ _crInv cr + hasJetPack = any (\it -> it ^? itType == Just JETPACK) $ _crInv cr oldPos = _crOldPos cr momentum' = 0.97 *.* (_crPos cr -.- _crOldPos cr) momentum'' | magV momentum' > 3 = 3 *.* normalizeV momentum' diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 047facba7..8422ac0ef 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -340,7 +340,7 @@ data Item , _itFloorPict :: Item -> SPic , _itEquipPict :: Creature -> Int -> SPic , _itScroll :: Float -> Creature -> Item -> Item - , _itCombineType :: CombineType + , _itType :: CombineType , _itAttachment :: ItAttachment , _itID :: Maybe Int , _itEffect :: ItEffect @@ -353,36 +353,6 @@ data Item , _itParams :: ItemParams , _itTweaks :: ItemTweaks } --- | Consumable --- { _itName :: String --- , _itMaxStack :: Int --- , _itAmount :: Int --- , _cnEffect :: Int -> World -> Maybe World --- , _itFloorPict :: Item -> SPic --- , _itEquipPict :: Creature -> Int -> SPic --- , _itIdentity :: ItemIdentity --- , _itID :: Maybe Int --- , _itInvSize :: Int --- , _itInvDisplay :: Item -> [String] --- , _itInvColor :: Color --- , _itEffect :: ItEffect --- , _itCurseStatus :: CurseStatus --- , _itDimension :: ItemDimension --- } --- | Craftable --- { _itName :: String --- , _itMaxStack :: Int --- , _itAmount :: Int --- , _itFloorPict :: Item -> SPic --- , _itEquipPict :: Creature -> Int -> SPic --- , _itIdentity :: ItemIdentity --- , _itID :: Maybe Int --- , _itInvSize :: Int --- , _itInvDisplay :: Item -> [String] --- , _itInvColor :: Color --- , _itCurseStatus :: CurseStatus --- , _itDimension :: ItemDimension --- } | Equipment { _itName :: String , _itFloorPict :: Item -> SPic @@ -390,7 +360,7 @@ data Item -- , _itIdentity :: ItemIdentity , _itEffect :: ItEffect , _itID :: Maybe Int - , _itCombineType :: CombineType + , _itType :: CombineType , _itZoom :: ItZoom , _itInvSize :: Float , _itInvDisplay :: Item -> [String] @@ -411,7 +381,7 @@ data Item --, _itIdentity :: ItemIdentity , _itID :: Maybe Int , _itAttachment :: ItAttachment - , _itCombineType :: CombineType + , _itType :: CombineType , _itInvSize :: Float , _itInvDisplay :: Item -> [String] , _itInvColor :: Color diff --git a/src/Dodge/Default.hs b/src/Dodge/Default.hs index c7d8eb7bc..fc1b62e19 100644 --- a/src/Dodge/Default.hs +++ b/src/Dodge/Default.hs @@ -133,7 +133,7 @@ defaultState = CrSt defaultEquipment :: Item defaultEquipment = Equipment { _itCurseStatus = Uncursed - , _itCombineType = NOTDEFINED + , _itType = NOTDEFINED , _itName = "genericEquipment" -- ,_itIdentity = Generic , _itFloorPict = \_ -> noShape $ setLayer 0 $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] @@ -164,7 +164,7 @@ defaultConsumable = Item , _itEffect = NoItEffect , _itScroll = \_ _ -> id , _itAttachment = NoItAttachment - , _itCombineType = NoCombineType + , _itType = NoCombineType , _itTargeting = Nothing , _itParams = NoParams , _itDimension = defaultItemDimension diff --git a/src/Dodge/Default/Weapon.hs b/src/Dodge/Default/Weapon.hs index dc97e6fc3..fc639da0f 100644 --- a/src/Dodge/Default/Weapon.hs +++ b/src/Dodge/Default/Weapon.hs @@ -84,7 +84,7 @@ defaultAimParams = AimParams defaultGun :: Item defaultGun = Item { _itName = "default" - , _itCombineType = NoCombineType + , _itType = NoCombineType , _itCurseStatus = Uncursed -- , _itIdentity = Pistol , _itConsumption = defaultAmmo @@ -110,7 +110,7 @@ defaultGun = Item defaultCraftable :: Item defaultCraftable = Item { _itName = "default" - , _itCombineType = NoCombineType + , _itType = NoCombineType , _itCurseStatus = Uncursed -- , _itIdentity = Generic , _itConsumption = NoConsumption diff --git a/src/Dodge/Inventory/CheckSlots.hs b/src/Dodge/Inventory/CheckSlots.hs index 9901d0933..d44d76aee 100644 --- a/src/Dodge/Inventory/CheckSlots.hs +++ b/src/Dodge/Inventory/CheckSlots.hs @@ -23,7 +23,7 @@ checkInvSlotsYou it w findItemSlot :: Item -> IM.IntMap Item -> Int findItemSlot it inv = case _itConsumption it of ItemItselfConsumable _ - -> fromMaybe newslot $ IM.findIndex (\it' -> _itCombineType it == _itCombineType it') inv + -> fromMaybe newslot $ IM.findIndex (\it' -> _itType it == _itType it') inv _ -> newslot where newslot = maybe 0 ((+1) . fst) $ IM.lookupMax inv diff --git a/src/Dodge/Item.hs b/src/Dodge/Item.hs index 6106deb79..c6ea91630 100644 --- a/src/Dodge/Item.hs +++ b/src/Dodge/Item.hs @@ -10,7 +10,7 @@ import Shape keyToken :: Int -> Item keyToken n = defaultEquipment - { _itCombineType = NOTDEFINED + { _itType = NOTDEFINED , _itName = "KEYTOKEN "++show n , _itMaxStack = 5 , _itFloorPict = \_ -> (,) emptySH $ setDepth 0.5 keyPic @@ -30,7 +30,7 @@ keyPic = color green $ latchkey :: Int -> Item latchkey n = defaultEquipment - { _itCombineType = NOTDEFINED + { _itType = NOTDEFINED , _itName = "KEY "++show n , _itMaxStack = 1 , _itFloorPict = \_ -> (,) emptySH $ setDepth 0.5 latchkeyPic diff --git a/src/Dodge/Item/Craftable.hs b/src/Dodge/Item/Craftable.hs index a6d9816c0..c42839c6d 100644 --- a/src/Dodge/Item/Craftable.hs +++ b/src/Dodge/Item/Craftable.hs @@ -10,7 +10,7 @@ makeTypeCraftNum i ct = defaultCraftable { _itInvSize = 0.5 , _itCurseStatus = Uncursed , _itName = show ct - , _itCombineType = ct + , _itType = ct , _itConsumption = ItemItselfConsumable i } diff --git a/src/Dodge/Item/Equipment.hs b/src/Dodge/Item/Equipment.hs index 874f039f6..5772b01e9 100644 --- a/src/Dodge/Item/Equipment.hs +++ b/src/Dodge/Item/Equipment.hs @@ -18,7 +18,7 @@ import Control.Lens magShield :: Item magShield = defaultEquipment - { _itCombineType = MAGSHIELD + { _itType = MAGSHIELD , _itName = "MAGSHIELD" , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \_ _ -> (,) emptySH blank @@ -26,7 +26,7 @@ magShield = defaultEquipment } flameShield :: Item flameShield = defaultEquipment - { _itCombineType = FLAMESHIELD + { _itType = FLAMESHIELD , _itName = "FLAMESHIELD" , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \cr _ -> (,) emptySH $ onLayer CrLayer $ pictures [color cyan $ circle (_crRad cr+2)] @@ -35,7 +35,7 @@ flameShield = defaultEquipment {- | Slows you down, blocks forward projectiles. -} frontArmour :: Item frontArmour = defaultEquipment - { _itCombineType = FRONTARMOUR + { _itType = FRONTARMOUR , _itName = "FARMOUR" , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ translate 0 (-5) $ pictures [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5 @@ -53,7 +53,7 @@ flatShield = defaultEquipment { _itEquipPict = pictureWeaponOnAim' flatShieldEquipSPic -- this will not work any more because the shield has no aim stance , _itEffect = effectOnOffEquip createShieldWall removeShieldWall , _itName = "SHIELD" - , _itCombineType = FLATSHIELD + , _itType = FLATSHIELD } flatShieldEquipSPic :: Item -> SPic flatShieldEquipSPic _ = @@ -131,7 +131,7 @@ effectOnOffEquip f f' = ItInvEffectID {- | Increases speed, reduces friction, cannot only move forwards. -} jetPack :: Item jetPack = defaultEquipment - { _itCombineType = JETPACK + { _itType = JETPACK , _itName = "JETPACK" , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \_ _ -> (,) emptySH $ onLayer CrLayer diff --git a/src/Dodge/Item/Weapon/BatteryGuns.hs b/src/Dodge/Item/Weapon/BatteryGuns.hs index d7a46824c..a6c9aac04 100644 --- a/src/Dodge/Item/Weapon/BatteryGuns.hs +++ b/src/Dodge/Item/Weapon/BatteryGuns.hs @@ -36,7 +36,7 @@ import qualified Data.IntMap.Strict as IM teslaGun :: Item teslaGun = defaultGun { _itName = "TESLA" - , _itCombineType = TESLAGUN + , _itType = TESLAGUN -- , _itIdentity = TeslaGun , _itConsumption = defaultAmmo { _ammoMax = 200 @@ -64,7 +64,7 @@ teslaGunPic _ = noPic $ colorSH blue $ lasGun :: Item lasGun = defaultAutoGun { _itName = "LASGUN ////" - , _itCombineType = LASGUN + , _itType = LASGUN , _itConsumption = defaultAmmo { _ammoMax = 200 , _ammoLoaded = 200 @@ -120,7 +120,7 @@ lasGunPic it = tractorGun :: Item tractorGun = defaultAutoGun { _itName = "TRACTORGUN" - , _itCombineType = TRACTORGUN + , _itType = TRACTORGUN , _itConsumption = defaultAmmo { _ammoMax = 10000 , _ammoLoaded = 10000 diff --git a/src/Dodge/Item/Weapon/Booster.hs b/src/Dodge/Item/Weapon/Booster.hs index fab776cb2..347615676 100644 --- a/src/Dodge/Item/Weapon/Booster.hs +++ b/src/Dodge/Item/Weapon/Booster.hs @@ -112,7 +112,7 @@ maxT = 20 boosterGun :: Item boosterGun = defaultGun { _itName = "BOOSTER" - , _itCombineType = BOOSTER + , _itType = BOOSTER , _itConsumption = defaultAmmo { _ammoMax = 100 , _ammoLoaded = 100 diff --git a/src/Dodge/Item/Weapon/BulletGuns.hs b/src/Dodge/Item/Weapon/BulletGuns.hs index 29c7e5aef..4fc479e50 100644 --- a/src/Dodge/Item/Weapon/BulletGuns.hs +++ b/src/Dodge/Item/Weapon/BulletGuns.hs @@ -7,6 +7,10 @@ module Dodge.Item.Weapon.BulletGuns , revolverX , bangStick , bangRod + , elephantGun + , amr + , sniperRifle + , machineGun , bangCane , bangCaneX , rifle @@ -57,7 +61,7 @@ import System.Random autoGun :: Item autoGun = defaultAutoGun { _itName = "AUTOGUN" - , _itCombineType = AUTOGUN + , _itType = AUTOGUN , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = 30 @@ -118,7 +122,7 @@ bangStick i = defaultGun { _itName = case i of 1 -> "BANGSTICK" _ -> "BANGSTICKx"++ show i - , _itCombineType = BANGSTICK i + , _itType = BANGSTICK i , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = i @@ -157,7 +161,7 @@ bangStick i = defaultGun bangCane :: Item bangCane = defaultGun { _itName = "BANGCANE" - , _itCombineType = BANGCANE + , _itType = BANGCANE ,_itParams = BulletShooter { _muzVel = 0.8 , _rifling = 0.9 @@ -184,12 +188,12 @@ bangCane = defaultGun , _itTweaks = defaultBulletSelTweak } & itUse . useAim . aimSpeed .~ 0.4 & itUse . useAim . aimRange .~ 1 - & itUse . useAim . aimStance .~ TwoHandTwist + & itUse . useAim . aimStance .~ OneHand & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} bangCaneX :: Int -> Item bangCaneX i = bangCane { _itName = "BANGCANEx"++show i - , _itCombineType = BANGCANEX i + , _itType = BANGCANEX i , _itUse = useAmmoParamsRate 6 upHammer [ ammoHammerCheck , useTimeCheck @@ -214,8 +218,9 @@ bangCaneX i = bangCane rifle :: Item rifle = bangCane + & itUse . useAim . aimStance .~ TwoHandTwist & itName .~ "RIFLE" - & itCombineType .~ RIFLE + & itType .~ RIFLE & itConsumption . ammoMax .~ 15 & itConsumption . reloadType .~ ActiveClear & itConsumption . reloadTime .~ 80 @@ -223,13 +228,13 @@ rifle = bangCane autoRifle :: Item autoRifle = rifle & itName .~ "AUTORIFLE" - & itCombineType .~ AUTORIFLE + & itType .~ AUTORIFLE & itUse . useMods %~ ((ammoCheckI :) . tail) -- & itUse . useDelay . rateMax .~ 6 assaultRifle :: Item assaultRifle = rifle & itName .~ "ASSAULTRIFLE" - & itCombineType .~ ASSAULTRIFLE + & itType .~ ASSAULTRIFLE & itUse . useDelay . rateMax .~ 18 & itUse . useMods .~ [ ammoHammerCheck @@ -244,28 +249,68 @@ assaultRifle = rifle , withRecoilI 50 ] - - bangRod :: Item bangRod = bangCane { _itName = "BANGROD" - , _itCombineType = BANGROD + , _itType = BANGROD , _itParams = BulletShooter { _muzVel = 0.8 , _rifling = 1 , _bore = 2 - , _gunBarrels = SingleBarrel 0.05 + , _gunBarrels = SingleBarrel 0.1 } + , _itUse = useAmmoParamsRate 6 upHammer + [ ammoHammerCheck + , useTimeCheck + , withSoundStart autoGunS + , useAmmoAmount 1 + , torqueAfterI 0.3 + , applyInaccuracy + , withMuzFlareI + , withRecoilI 50 + ] , _itFloorPict = longGunSPic - } & itUse . useAim . aimSpeed .~ 0.2 - & itUse . useAim . aimRange .~ 1 - & itUse . useAim . aimStance .~ TwoHandTwist - & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} + } + & itConsumption . reloadType .~ ActiveClear + & itUse . useAim . aimSpeed .~ 0.2 + & itUse . useAim . aimRange .~ 1 + & itUse . useAim . aimStance .~ OneHand + & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} +elephantGun :: Item +elephantGun = bangRod + & itName .~ "ELEPHANTGUN" + & itType .~ ELEPHANTGUN + & itUse . useAim . aimStance .~ TwoHandTwist + & itParams . gunBarrels .~ SingleBarrel 0.05 + & itUse . useMods .~ + [ ammoHammerCheck + , useTimeCheck + , withSoundStart autoGunS + , useAmmoAmount 1 + , torqueAfterI 0.1 + , applyInaccuracy + , withMuzFlareI + , withRecoilI 50 + ] +amr :: Item +amr = elephantGun + & itName .~ "AMR" + & itType .~ AMR + & itConsumption . ammoMax .~ 15 +sniperRifle :: Item +sniperRifle = elephantGun + & itName .~ "SNIPERRIFLE" + & itType .~ SNIPERRIFLE + & itParams . gunBarrels .~ SingleBarrel 0 +machineGun :: Item +machineGun = bangRod + & itName .~ "MACHINEGUN" + & itType .~ MACHINEGUN revolverX :: Int -> Item revolverX i = revolver { _itName = "REVx"++show i - , _itCombineType = REVOLVERX i + , _itType = REVOLVERX i , _itUse = useAmmoParamsRate 8 upHammer [ ammoHammerCheck , useTimeCheck @@ -285,7 +330,7 @@ revolverX i = revolver bangCone :: Item bangCone = defaultGun { _itName = "BANGCONE" - , _itCombineType = BANGCONE + , _itType = BANGCONE , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = 5 @@ -330,7 +375,7 @@ coneRandItemParams = do blunderbuss :: Item blunderbuss = bangCone {_itName = "BLUNDERBUSS" - ,_itCombineType = BLUNDERBUSS + ,_itType = BLUNDERBUSS ,_itUse = useAmmoParamsRate 20 upHammer [ ammoCheckI , hammerCheckI @@ -352,7 +397,7 @@ blunderbuss = bangCone grapeShotCannon :: Item grapeShotCannon = blunderbuss {_itName = "GRAPESHOTCANNON" - ,_itCombineType = GRAPESHOTCANNON + ,_itType = GRAPESHOTCANNON ,_itUse = useAmmoParamsRate 20 upHammer [ ammoCheckI , hammerCheckI @@ -378,7 +423,7 @@ grenadeLauncher _ = bangCone revolver :: Item revolver = pistol { _itName = "REVOLVER" - , _itCombineType = REVOLVER + , _itType = REVOLVER , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = 6 @@ -425,7 +470,7 @@ smgAfterHamMods = pistol :: Item pistol = defaultGun { _itName = "PISTOL" - , _itCombineType = PISTOL + , _itType = PISTOL , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = 15 @@ -466,7 +511,7 @@ bulletClip x = rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW 3 0 (3 - hvAutoGun :: Item hvAutoGun = defaultAutoGun { _itName = "AUTO-HV" - , _itCombineType = HVAUTOGUN + , _itType = HVAUTOGUN , _itConsumption = defaultAmmo { _aoType = hvBullet , _ammoMax = 100 @@ -507,23 +552,23 @@ autoPistol :: Item autoPistol = pistol & itUse . useMods .~ (ammoCheckI : pistolAfterHamMods) & itName .~ "AUTOPISTOL" - & itCombineType .~ AUTOPISTOL + & itType .~ AUTOPISTOL machinePistol :: Item machinePistol = autoPistol & itUse . useDelay . rateMax .~ 2 & itUse . useMods .~ (ammoCheckI : machinePistolAfterHamMods) & itName .~ "MACHINEPISTOL" - & itCombineType .~ MACHINEPISTOL + & itType .~ MACHINEPISTOL smg :: Item smg = autoPistol -- & some parameter affecting stability & itUse . useMods .~ (ammoCheckI : smgAfterHamMods) & itName .~ "SMG" - & itCombineType .~ SMG + & itType .~ SMG & itUse . useAim . aimStance .~ TwoHandTwist ltAutoGun :: Item ltAutoGun = defaultAutoGun { _itName = "AUTO-LT" - , _itCombineType = LTAUTOGUN + , _itType = LTAUTOGUN , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = 15 @@ -563,7 +608,7 @@ ltAutoGunPic it = miniGun :: Item miniGun = defaultAutoGun { _itName = "MINI-G" - , _itCombineType = MINIGUN + , _itType = MINIGUN , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = 1500 @@ -672,7 +717,7 @@ miniGunPict spin am = spreadGun :: Item spreadGun = defaultGun { _itName = "SPREAD" - , _itCombineType = SPREADGUN + , _itType = SPREADGUN , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = 5 @@ -713,7 +758,7 @@ spreadGunPic it = multGun :: Item multGun = defaultGun { _itName = "MULTGUN" - , _itCombineType = MULTGUN + , _itType = MULTGUN , _itConsumption = defaultAmmo { _aoType = basicBullet , _ammoMax = 5 @@ -766,7 +811,7 @@ multGunSPic it = longGun :: Item longGun = defaultGun { _itName = "LONGGUN" - , _itCombineType = LONGGUN + , _itType = LONGGUN , _itConsumption = defaultAmmo { _aoType = hvBullet , _ammoMax = 1 @@ -796,7 +841,7 @@ longGun = defaultGun } longGunSPic :: Item -> SPic longGunSPic _ = - ( colorSH orange $ upperPrismPoly 5 $ rectWH 12 2 + ( colorSH orange $ upperPrismPoly 5 $ rectXH 25 2 , mempty ) diff --git a/src/Dodge/Item/Weapon/Drone.hs b/src/Dodge/Item/Weapon/Drone.hs index a7e33e8f8..987253f83 100644 --- a/src/Dodge/Item/Weapon/Drone.hs +++ b/src/Dodge/Item/Weapon/Drone.hs @@ -21,7 +21,7 @@ import Control.Lens lasDrones :: Item lasDrones = defaultGun { _itName = "DRONES" - , _itCombineType = DRONELAUNCHER + , _itType = DRONELAUNCHER , _itConsumption = defaultAmmo { _aoType = DroneAmmo { _amString = "LASDRONE" } , _ammoMax = 2 diff --git a/src/Dodge/Item/Weapon/Grenade.hs b/src/Dodge/Item/Weapon/Grenade.hs index da69fc090..7a49bfadc 100644 --- a/src/Dodge/Item/Weapon/Grenade.hs +++ b/src/Dodge/Item/Weapon/Grenade.hs @@ -25,7 +25,7 @@ import Control.Lens grenade :: Item grenade = Throwable { _itName = "GRENADE " ++ show fuseTime - , _itCombineType = GRENADE + , _itType = GRENADE , _itInvSize = 1 , _itDimension = defaultItemDimension , _itCurseStatus = Uncursed @@ -212,7 +212,7 @@ defaultThrowable = grenade remoteBomb :: Item remoteBomb = defaultThrowable { _itName = "REMOTEBOMB" - , _itCombineType = REMOTEBOMB + , _itType = REMOTEBOMB , _itMaxStack = 1 , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] diff --git a/src/Dodge/Item/Weapon/Launcher.hs b/src/Dodge/Item/Weapon/Launcher.hs index 0ed63525e..5eb19a9e9 100644 --- a/src/Dodge/Item/Weapon/Launcher.hs +++ b/src/Dodge/Item/Weapon/Launcher.hs @@ -37,7 +37,7 @@ import System.Random launcher :: Item launcher = defaultGun { _itName = "ROCKO" - , _itCombineType = LAUNCHER + , _itType = LAUNCHER , _itConsumption = defaultAmmo { _aoType = defaultShellAmmo { _amPayload = makeExplosionAt @@ -256,7 +256,7 @@ trySpinByCID cid i pj w = w & props . ix pjid . pjSpin .~ newSpin remoteLauncher :: Item remoteLauncher = defaultGun { _itName = "ROCKO-REM" - , _itCombineType = LAUNCHER + , _itType = LAUNCHER , _itConsumption = defaultAmmo { _aoType = defaultShellAmmo { _amPayload = makeExplosionAt diff --git a/src/Dodge/Item/Weapon/Radar.hs b/src/Dodge/Item/Weapon/Radar.hs index 0c2c8e941..8a8fa575a 100644 --- a/src/Dodge/Item/Weapon/Radar.hs +++ b/src/Dodge/Item/Weapon/Radar.hs @@ -20,7 +20,7 @@ Sends out pulses that display walls. -} radar :: Item radar = defaultGun { _itName = "RADAR" - , _itCombineType = RADAR + , _itType = RADAR , _itConsumption = defaultAmmo { _ammoMax = 100 , _ammoLoaded = 100 @@ -40,7 +40,7 @@ Sends out pulses that display creatures. -} sonar :: Item sonar = defaultGun { _itName = "SONAR" - , _itCombineType = RADAR + , _itType = RADAR , _itConsumption = defaultAmmo { _ammoMax = 100 , _ammoLoaded = 100 @@ -59,7 +59,7 @@ sonar = defaultGun Automatically sends out pulses that display creatures. -} autoSonar :: Item autoSonar = defaultEquipment - { _itCombineType = RADAR + { _itType = RADAR , _itName = "AUTOSONAR" , _itMaxStack = 1 , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] @@ -72,7 +72,7 @@ autoSonar = defaultEquipment Automatically sends out pulses that display walls. -} autoRadar :: Item autoRadar = defaultEquipment - { _itCombineType = RADAR + { _itType = RADAR , _itName = "AUTORADAR" , _itMaxStack = 1 , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] diff --git a/src/Dodge/Item/Weapon/SprayGuns.hs b/src/Dodge/Item/Weapon/SprayGuns.hs index af1ba0f81..0d9f772f3 100644 --- a/src/Dodge/Item/Weapon/SprayGuns.hs +++ b/src/Dodge/Item/Weapon/SprayGuns.hs @@ -33,7 +33,7 @@ import System.Random poisonSprayer :: Item poisonSprayer = defaultAutoGun { _itName = "POISON" - , _itCombineType = SPRAYER + , _itType = SPRAYER , _itConsumption = defaultAmmo { _ammoMax = 500 , _ammoLoaded = 500 @@ -57,7 +57,7 @@ poisonSprayer = defaultAutoGun flamer :: Item flamer = defaultAutoGun { _itName = "FLAMER" - , _itCombineType = SQUIRTER + , _itType = SQUIRTER , _itConsumption = defaultAmmo { _ammoMax = 250 , _ammoLoaded = 250 diff --git a/src/Dodge/Item/Weapon/Utility.hs b/src/Dodge/Item/Weapon/Utility.hs index e0176ec05..ed439c136 100644 --- a/src/Dodge/Item/Weapon/Utility.hs +++ b/src/Dodge/Item/Weapon/Utility.hs @@ -19,7 +19,7 @@ import Control.Lens rewindGun :: Item rewindGun = defaultGun { _itName = "REWINDER" - , _itCombineType = REWINDER + , _itType = REWINDER , _itConsumption = ChargeableAmmo { _wpMaxCharge = 250 , _wpCharge = 0 @@ -55,7 +55,7 @@ useRewindGun _ _ w = case _rewindWorlds w of shrinkGun :: Item shrinkGun = defaultGun { _itName = "SHRINKER" - , _itCombineType = SHRINKER + , _itType = SHRINKER , _itConsumption = defaultAmmo { _ammoMax = 100 , _ammoLoaded = 100 @@ -85,7 +85,7 @@ useShrinkGun cr invid w = if _itBool $ _itAttachment it blinkGun :: Item blinkGun = defaultGun { _itName = "BLINKER" - , _itCombineType = BLINKER + , _itType = BLINKER , _itConsumption = defaultAmmo { _ammoMax = 100 , _ammoLoaded = 100 @@ -117,7 +117,7 @@ autoEffectGun name eff = defaultAutoGun forceFieldGun :: Item forceFieldGun = defaultGun { _itName = "FORCEFIELD" - , _itCombineType = FORCEFIELD + , _itType = FORCEFIELD , _itConsumption = defaultAmmo { _ammoMax = 100 , _ammoLoaded = 100 diff --git a/src/Geometry.hs b/src/Geometry.hs index 5fd18d19d..e2d6a8ef1 100644 --- a/src/Geometry.hs +++ b/src/Geometry.hs @@ -16,8 +16,7 @@ module Geometry , module Geometry.Vector , module Geometry.Vector3D , module Geometry.LHS - ) - where + ) where import Geometry.Data import Geometry.Intersect import Geometry.Bezier @@ -67,6 +66,12 @@ rectNSWE !n !s !w !e = [V2 w n, V2 w s, V2 e s, V2 e n] rectWH :: Float -> Float -> [Point2] rectWH w h = rectNSWE h (-h) (-w) w +rectXH :: Float -> Float -> [Point2] +rectXH x h = rectNSWE h (-h) 0 x + +rectXY :: Float -> Float -> [Point2] +rectXY x y = rectNSWE y 0 0 x + square :: Float -> [Point2] square n = rectWH n n