Files
loop/src/Dodge/Combine/Combinations.hs
T
2022-02-21 20:51:01 +00:00

152 lines
5.0 KiB
Haskell

{-# LANGUAGE TupleSections #-}
module Dodge.Combine.Combinations where
import Geometry
import Dodge.Data
import Dodge.WorldEvent.HitEffect
import Dodge.Particle.Bullet.HitEffect
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.Bezier
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 [PIPE,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 [AUTORIFLE,MICROCHIP,MAGNET] bezierGun
, 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,TIN] amr
, po [ELEPHANTGUN,HARDWARE,CAN] sniperRifle
, po [BANGROD,PLATE,DRUM,MOTOR] machineGun
, p [p 3 TUBE,o HARDWARE] launcher
, po [LIGHTER,PIPE,CAN] flameStick
, po [FLAMESTICK,CAN,PUMP] blowTorch
, po [FLAMESTICK,IRONBAR,DRUM] flameThrower
, po [FLAMESTICK,DRUM,DRUM] flameWall
, p [o PRISM,p 2 PIPE,o HARDWARE] lasGun
, po [MAGNET,TIN] magShield
, p [p 4 CAN] plateCraft
, p [p 2 PLATE] flatShield
]
++ 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 $ destroyOnImpact bulIncCr bulIncWall)
,amod [BOUNCEMODULE] "+BOUNCE" (f $ destroyOnImpact bulBounceArmCr' bulBounceWall)
]
)
, ( ModBulletTarget
, bulletWeapons
, [amod [TELEPORTMODULE,MICROCHIP] "+TELEPORT" (itUse . useMods .:~ withPositionWallCheck (const . const mouseWorldPos))
,amod [TELEPORTMODULE] "+DIRECTEDTELE" makeDirectedTele
]
)
]
where
makeDirectedTele it = it & itEffect .~ rbSetTarget
& itUse . useMods .:~ withPosDirWallCheck directedTelPos
& itUse . useAim . aimZoom . itZoomFac .~ 1
directedTelPos it cr w = (p,a)
where
p = fromMaybe (_crPos cr) $ do
(g,_) <- _itTargeting it
g w
a = argV (mouseWorldPos w -.- p)
f ameff = itConsumption . aoType . amBulEff .~ ameff
amod cts str func = (cts,ItemModule [str] 1 func)
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
]