Files
loop/src/Dodge/Combine/Combinations.hs
T
2022-04-06 11:40:22 +01:00

218 lines
7.4 KiB
Haskell

{-# LANGUAGE TupleSections #-}
module Dodge.Combine.Combinations where
import Geometry
import Dodge.Data
import Dodge.WorldEvent.SpawnParticle
import Dodge.Particle.HitEffect.ExpireAndDamage
import Dodge.Particle.Damage
import Dodge.Item.Equipment
import Dodge.Item.Craftable
import Dodge.Item.Weapon.BulletGuns
import Dodge.Item.Weapon.BatteryGuns
import Dodge.Item.Weapon.Launcher
import Dodge.Item.Weapon.SprayGuns
import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Base
import LensHelp
import Data.Maybe
itemCombinations :: [([(Int,CombineType)],Item)]
itemCombinations =
[ po [PIPE, HARDWARE] (bangStick 1)
, po [BANGSTICK 1, TIN] pistol
, po [PISTOL, SPRING, HARDWARE] autoPistol
, po [AUTOPISTOL, PLANK, HARDWARE] smg
, po [AUTOPISTOL, HARDWARE] machinePistol
, po [BANGSTICK 1,CAN] revolver
, po [REVOLVER, SPRING, HARDWARE] $ revolverX 1
, po [TUBE,HARDWARE] bangCone
, po [BANGCONE,PLANK] blunderbuss
, po [BLUNDERBUSS,TUBE] bigBlunderbuss
, po [BIGBLUNDERBUSS,TUBE] biggerBlunderbuss
, po [BIGGERBLUNDERBUSS,TUBE] biggestBlunderbuss
, po [BANGCONE,PUMP,HARDWARE] $ grenadeLauncher 1
, po [GRENADELAUNCHER 1,MOTOR,DRUM] $ grenadeLauncher 2
, p [p 2 PIPE,o HARDWARE] bangCane
, p [p 2 PIPE,o BANGCANE] (bangCaneX 2)
, po [BANGCANE,TIN] rifle
, po [RIFLE,PLANK] repeater
, po [REPEATER,SPRING,HARDWARE] autoRifle
, po [REPEATER,SPRING,CAN] burstRifle
, po [BURSTRIFLE,SPRING,HARDWARE] fastBurstRifle
, po [FASTBURSTRIFLE,SPRING,HARDWARE] completeBurstRifle
, po [MOTOR,BANGCANEX 3] $ miniGunX 3
, po [MOTOR,BANGCANEX 4] $ miniGunX 4
, po [MOTOR,BANGCANEX 5] $ miniGunX 5
, po [MOTOR,BANGCANEX 6] $ miniGunX 6
, p [p 3 PIPE,o HARDWARE] bangRod
, po [BANGROD,PLANK,HARDWARE] elephantGun
, po [ELEPHANTGUN,HARDWARE,PRISM] sniperRifle
, po [ELEPHANTGUN,HARDWARE,TIN] amr
, po [AMR,HARDWARE,SPRING] autoAmr
, po [BANGROD,PLATE,DRUM,MOTOR] machineGun
, p [p 2 TUBE,o HARDWARE] launcher
, p [p 2 TUBE,o LAUNCHER] (launcherX 2)
] ++ [ p [p 2 TUBE,o $ LAUNCHERX i] (launcherX (i+1)) | i <- [2..9]]
++
[ po [LIGHTER,PUMP,CAN] flameSpitter
, po [FLAMESPITTER,CAN,PUMP] blowTorch
, po [FLAMESPITTER,DRUM] flameThrower
, po [FLAMETHROWER,DRUM] flameWall
, po [FLAMETHROWER,PUMP] flameTorrent
, p [o PRISM,o TRANSFORMER,o PIPE] lasGun
, p [o LASGUN,o PRISM] lasGunSway
, p [o LASGUN,o HARDWARE] lasGunSwing
-- , p [o LASGUN,o PIPE] lasGunPulse
, p [o LASGUN,p 2 PIPE] lasGunDual
, p [o LASGUN,o PIPE, o PRISM] lasGunWidePulse
, p [o LASGUN,o TRANSFORMER,o PRISM] (lasGunWide 2)
, p [o TRANSFORMER,p 2 CAN] sparkGun
, p [o SPARKGUN,p 2 PIPE] teslaGun
, po [MAGNET,TIN] magShield
, p [p 4 CAN] plateCraft
, p [p 3 TIN] plateCraft
, p [p 2 DRUM] plateCraft
, p [p 2 PLATE] flatShield
]
++ map (\i -> po [LASGUNWIDE i,TRANSFORMER,PRISM] $ lasGunWide (i+1)) [1..9]
++ map (\i -> po [LASGUNWIDE i,HARDWARE] $ lasGunFocus (i)) [1..10]
++ map (\i -> po [PIPE,BANGSTICK i] $ bangStick (i+1)) [1..8]
++ map (\i -> po [REVOLVERX i,CAN] $ revolverX (i+1)) [1..5]
++ map (\i -> p [o (BANGCANEX i),p 2 PIPE] $ bangCaneX (i+1)) [1..5]
++ map (\i -> po [MINIGUNX i,BANGCANE] $ miniGunX (i+1)) [3..15]
++ [ po (_itType it:mtype) $ it & itModules . ix modtype .~ m
| (modtype,is,ms) <- moduleCombinations
, it <- is
, (mtype,m) <- ms
]
where
p = (,)
po xs it = (map o xs,it)
o = (1,)
moduleCombinations :: [( ModuleSlot, [Item], [([CombineType],ItemModule)] )]
moduleCombinations =
[ ( ModRifleMag
, [repeater
,autoRifle
,burstRifle
,fastBurstRifle
]
, [amod [DRUM,HARDWARE] "+DRUM MAG" (itConsumption . ammoBaseMax .~ 45)
,amod [MOTOR,HARDWARE] "+BELT FEED" (itConsumption . ammoBaseMax .~ 150)
]
)
, ( ModAutoMag
, [autoRifle
,autoPistol
,smg
]
, [amod [MAGNET,HARDWARE] "+MAGNET FEED" (itUse . useDelay . rateMax .~ 4)
]
)
, ( ModBullet
, bulletWeapons
, [amod [INCENDIARYMODULE] "+INCENDIARY" (f $ expireAndDamage $ spawnAtBulDams incBall)
,amod [BOUNCEMODULE] "+BOUNCE" (f $ expireAndDamage bounceBulDams)
,amod [STATICMODULE] "+STATIC" (f $ expireAndDamage $ spawnAtBulDams aStaticBall)
,amod [CONCUSSMODULE] "+CONCUSS" (f $ expireAndDamage $ spawnAtBulDams concBall)
]
)
, ( ModTarget
, homingLaunchers ++ bulletWeapons
, [amod [MICROCHIP,CREATURESENSOR] "+CREATURETARGETING" (itTargeting .~ targetRBCreature)
,amod [MICROCHIP,PRISM] "+LASERTARGETING" (itTargeting .~ targetLaser)
,amod [MICROCHIP,TIN] "+POSTIONALTARGETING" (itTargeting .~ targetRBPress)
]
)
, ( ModBulletTrajectory
, bulletWeapons
, [amod [TELEPORTMODULE,MICROCHIP] "+DIRECTEDTELE" makeDirectedTele
,amod [MAGNET,MICROCHIP,HARDWARE] "+MAGNETTRAJECTORY"
( (itConsumption . aoType . amBulTraj .~ MagnetTrajectory)
. (itConsumption . aoType . amBulVel .~ V2 10 0)
)
,amod [MICROCHIP,HARDWARE] "+FLECHETTETRAJECTORY"
(itConsumption . aoType . amBulTraj .~ FlechetteTrajectory)
,amod [ANTIMATTER,HARDWARE] "+BEZIERTRAJECTORY"
(itConsumption . aoType . amBulTraj .~ BezierTrajectory)
]
)
, ( ModLauncherHoming
, homingLaunchers
, [ amod [MICROCHIP,TRANSMITTER] "+TARGET HOMING"
(itConsumption . aoType . amPjCreation .~ fireTrackingShell)
]
)
, ( ModBattery
, batteryGuns
, [amod [BATTERY] "+BATTERY" (itConsumption . ammoBaseMax +~ 1000)
]
)
]
where
makeDirectedTele it = it
& itTargeting .~ targetRBPress
& itUse . useMods .:~ withPosDirWallCheck directedTelPos
-- for the camera: the simplest option is to remove all zoom/offset
& itUse . useAim . aimZoom . itZoomFac .~ 1
& itUse . useAim . aimRange .~ 0
-- a better option would be to involve a "scope" centered on the firing
-- position
directedTelPos it cr w = (p,a)
where
p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
a = argV (mouseWorldPos w -.- p)
f ameff = itConsumption . aoType . amBulEff .~ ameff
amod cts str func = (cts,ItemModule [str] 1 func)
homingLaunchers :: [Item]
homingLaunchers = launcher : [launcherX i | i <- [2..10]]
batteryGuns :: [Item]
batteryGuns =
[ teslaGun
, sparkGun
, lasGun
, lasGunSway
, lasGunSwing
] ++
[ lasGunWide i | i <- [1..10]
] ++
[ lasGunFocus i | i <- [1..10]]
bulletWeapons :: [Item]
bulletWeapons = [bangStick i | i <- [1..9] ]
++ [bangCaneX i | i <- [1..6] ]
++ [revolverX i | i <- [1..5] ]
++ [miniGunX i | i <- [3..16] ]
++ [bangCane
,pistol
,autoPistol
,smg
,machinePistol
,revolver
,rifle
,repeater
,autoRifle
,burstRifle
,fastBurstRifle
,completeBurstRifle
,bangCone
,blunderbuss
,bigBlunderbuss
,biggerBlunderbuss
,biggestBlunderbuss
]