module Dodge.Combine.Module where import Data.Foldable import Dodge.Data.Beam import Dodge.Data.Item import Dodge.Tesla import Geometry import LensHelp moduleModification :: ItemModuleType -> Item -> Item moduleModification imt = case imt of EMPTYMODULE -> id -- BELTMAG -> itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 150 MAGNETMAG -> itUse . heldDelay . rateMax .~ 4 BULPAY BulFlak -> (itUse . amagParams . ampBullet . buSpawn .~ BulFlak) . (itUse . amagParams . ampBullet . buTimer .~ 3) BULPAY thepayload -> itUse . amagParams . ampBullet . buSpawn .~ thepayload BULBODY thebody -> itUse . amagParams . ampBullet . buEffect .~ thebody TARGET {} -> id -- itUse . useTargeting ?~ t BULTRAJ BasicBulletTrajectoryType -> id BULTRAJ MagnetTrajectoryType -> (itUse . amagParams . ampBullet . buTrajectory .~ MagnetTrajectory 0) . (itUse . amagParams . ampBullet . buVel .~ V2 10 0) BULTRAJ FlechetteTrajectoryType -> itUse . amagParams . ampBullet . buTrajectory .~ FlechetteTrajectory 0 BULTRAJ BezierTrajectoryType -> itUse . amagParams . ampBullet . buTrajectory .~ BezierTrajectory 0 0 0 INCENDLAS -> itParams . lasBeam .~ BeamCombine FlameBeamCombine SPLITLAS -> itParams . lasBeam .~ BeamCombine SplitBeamCombine STATICLAS -> (itParams . lasBeam .~ BeamCombine TeslaBeamCombine) . (itParams . subParams ?~ teslaParams) WEPTELE -> makeDirectedTele --LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell LAUNCHHOME -> id ATTACHTORCH -> id where makeDirectedTele it = it -- & itUse . useTargeting ?~ TargetRBPress & itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos -- for the camera: the simplest option is to remove all zoom/offset & itUse . heldAim . aimZoom . izFac .~ 1 & itUse . heldAim . 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) applyModules :: Item -> Item applyModules it = foldl' (flip moduleModification) it (it ^. itType . iyModules)