Add basic booster
This commit is contained in:
+79
-109
@@ -19,6 +19,7 @@ import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Item.Weapon.ExtraEffect
|
||||
import Dodge.Item.Weapon.UseEffect
|
||||
import Dodge.Item.Weapon.Laser
|
||||
import Dodge.Item.Weapon.Booster
|
||||
import Dodge.Item.Weapon.Grenade
|
||||
import Dodge.Item.Attachment.Data
|
||||
import Dodge.Item.Attachment
|
||||
@@ -41,26 +42,7 @@ import System.Random
|
||||
import qualified Data.Set as S
|
||||
--import qualified Data.Map as M
|
||||
|
||||
pistol
|
||||
,lasGun
|
||||
,tractorGun
|
||||
,launcher
|
||||
,ltAutoGun
|
||||
,hvAutoGun
|
||||
,miniGun
|
||||
,teslaGun
|
||||
,spreadGun
|
||||
,multGun
|
||||
,defaultGun
|
||||
,defaultAutoGun
|
||||
,rezGun
|
||||
,flameLauncher
|
||||
,poisonLauncher
|
||||
,teslaLauncher
|
||||
,remoteLauncher
|
||||
,defaultThrowable
|
||||
-- ,shatterGun
|
||||
,longGun,flamer,blinkGun,forceFieldGun :: Item
|
||||
pistol :: Item
|
||||
pistol = Weapon
|
||||
{ _itName = "PISTOL"
|
||||
, _itIdentity = Pistol
|
||||
@@ -95,8 +77,9 @@ pistol = Weapon
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _itInvColor = white
|
||||
}
|
||||
defaultGun :: Item
|
||||
defaultGun = pistol
|
||||
|
||||
defaultAutoGun :: Item
|
||||
defaultAutoGun = autoGun
|
||||
{ _itScrollUp = const id
|
||||
, _itScrollDown = const id
|
||||
@@ -130,8 +113,6 @@ autoGun = defaultGun
|
||||
, _wpRange = 20
|
||||
, _itHammer = HammerUp
|
||||
, _itFloorPict = onLayer FlItLayer $ color red $ pictures [polygon [(-4,-4),(-4,4),(4,4),(4,-4)]]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||
@@ -152,7 +133,7 @@ autoGunNonTwistEff = withRecoil 40
|
||||
. withMuzFlare
|
||||
. withVelWthHiteff (50,0) 3
|
||||
$ destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||
|
||||
rezGun :: Item
|
||||
rezGun = defaultGun
|
||||
{ _itName = "REANIMATOR"
|
||||
, _wpMaxAmmo = 50
|
||||
@@ -168,8 +149,6 @@ rezGun = defaultGun
|
||||
[polygon $ rectNESW 7 3 1 (-3)
|
||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||
]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 0
|
||||
, _itEquipPict = pictureWeaponOnAim $ color chartreuse $ pictures
|
||||
@@ -177,6 +156,7 @@ rezGun = defaultGun
|
||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||
]
|
||||
}
|
||||
teslaGun :: Item
|
||||
teslaGun = defaultAutoGun
|
||||
{ _itName = "TESLA"
|
||||
, _itIdentity = TeslaGun
|
||||
@@ -193,8 +173,6 @@ teslaGun = defaultAutoGun
|
||||
[polygon $ rectNESW 7 3 1 (-3)
|
||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||
]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itZoom = defaultItZoom
|
||||
, _itAimingRange = 0
|
||||
@@ -203,6 +181,7 @@ teslaGun = defaultAutoGun
|
||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||
]
|
||||
}
|
||||
lasGun :: Item
|
||||
lasGun = defaultAutoGun
|
||||
{ _itName = "LASGUN ////"
|
||||
, _itIdentity = LasGun
|
||||
@@ -216,8 +195,6 @@ lasGun = defaultAutoGun
|
||||
, _wpSpread = 0.001
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itEquipPict = pictureWeaponOnAim $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
||||
@@ -226,6 +203,7 @@ lasGun = defaultAutoGun
|
||||
, _itScrollDown = decCharMode
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
}
|
||||
forceFieldGun :: Item
|
||||
forceFieldGun = defaultGun
|
||||
{ _itName = "FORCEFIELD"
|
||||
, _itIdentity = ForceFieldGun
|
||||
@@ -239,8 +217,6 @@ forceFieldGun = defaultGun
|
||||
, _wpSpread = 0.02
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 0.5
|
||||
}
|
||||
@@ -263,6 +239,7 @@ forceFieldGun = defaultGun
|
||||
-- , _itAimingSpeed = 1
|
||||
-- , _itAimingRange = 0.5
|
||||
-- }
|
||||
tractorGun :: Item
|
||||
tractorGun = defaultAutoGun
|
||||
{ _itName = "TRACTORGUN"
|
||||
, _itIdentity = TractorGun
|
||||
@@ -276,12 +253,11 @@ tractorGun = defaultAutoGun
|
||||
, _wpSpread = 0.00001
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 0.5
|
||||
, _itEquipPict = pictureWeaponOnAim $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
|
||||
}
|
||||
launcher :: Item
|
||||
launcher = defaultGun
|
||||
{ _itName = "ROCKO"
|
||||
, _itIdentity = Launcher
|
||||
@@ -295,24 +271,25 @@ launcher = defaultGun
|
||||
, _wpSpread = 0.02
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.2
|
||||
, _itAimingRange = 0.5
|
||||
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
, _itHammer = NoHammer
|
||||
, _itEffect = NoItEffect
|
||||
}
|
||||
flameLauncher :: Item
|
||||
flameLauncher = launcher
|
||||
{ _itName = "FLROCKO"
|
||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeFlameExplosionAt
|
||||
}
|
||||
|
||||
poisonLauncher :: Item
|
||||
poisonLauncher = launcher
|
||||
{ _itName = "POISROCK"
|
||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makePoisonExplosionAt
|
||||
}
|
||||
|
||||
teslaLauncher :: Item
|
||||
teslaLauncher = launcher
|
||||
{ _itName = "TESLROCK"
|
||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeTeslaExplosionAt
|
||||
@@ -326,8 +303,6 @@ useTargetPos
|
||||
useTargetPos f cr w = case cr ^? crInv . ix (_crInvSel cr) . itAttachment . _Just . itTargetPos of
|
||||
Nothing -> w
|
||||
Just p -> f p cr w
|
||||
where
|
||||
cid = _crID cr
|
||||
|
||||
bezierGun :: Item
|
||||
bezierGun = defaultAutoGun
|
||||
@@ -372,7 +347,7 @@ removeItAttachment i _ w = w & creatures . ix i . crInv . ix itRef . itAttachmen
|
||||
where
|
||||
cr = _creatures w IM.! i
|
||||
itRef = _crInvSel cr
|
||||
|
||||
remoteLauncher :: Item
|
||||
remoteLauncher = defaultGun
|
||||
{ _itName = "ROCKO-REM"
|
||||
, _itIdentity = RemoteLauncher
|
||||
@@ -386,13 +361,12 @@ remoteLauncher = defaultGun
|
||||
, _wpSpread = 0.02
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.2
|
||||
, _itAimingRange = 0.5
|
||||
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
, _itAttachment = Just $ ItScope (0,0) 0 1 True
|
||||
}
|
||||
hvAutoGun :: Item
|
||||
hvAutoGun = defaultAutoGun
|
||||
{ _itName = "AUTO-HV"
|
||||
, _itIdentity = HvAutoGun
|
||||
@@ -402,11 +376,9 @@ hvAutoGun = defaultAutoGun
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 25
|
||||
, _itUseTime = 0
|
||||
, _itUse = rateIncAB 24 10 (torqueBeforeForced 0.1 mkHvBul) $ torqueAfter 0.2 mkHvBul
|
||||
, _itUse = rateIncAB 24 10 (torqueBeforeForced 0.1 mkHvBul) $ torqueAfter 0.2 mkHvBul
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.2
|
||||
, _itAimingRange = 1
|
||||
, _itEquipPict = pictureWeaponOnAim $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
@@ -417,7 +389,7 @@ hvAutoGun = defaultAutoGun
|
||||
. withMuzFlare
|
||||
. withVelWthHiteff (80,0) 6
|
||||
$ penWalls hvBulHitCr' hvBulHitWall' bulHitFF'
|
||||
|
||||
ltAutoGun :: Item
|
||||
ltAutoGun = defaultAutoGun
|
||||
{ _itName = "AUTO-LT"
|
||||
, _itIdentity = LtAutoGun
|
||||
@@ -434,8 +406,6 @@ ltAutoGun = defaultAutoGun
|
||||
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [polygon $ rectNSWE 4 (-4) (-4) 0
|
||||
,circleSolid 4
|
||||
]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 1
|
||||
, _itAimingRange = 0
|
||||
, _itZoom = defaultItZoom
|
||||
@@ -443,6 +413,7 @@ ltAutoGun = defaultAutoGun
|
||||
,circleSolid 4
|
||||
]
|
||||
}
|
||||
miniGun :: Item
|
||||
miniGun = defaultAutoGun
|
||||
{ _itName = "MINI-G"
|
||||
, _itIdentity = MiniGun
|
||||
@@ -460,12 +431,11 @@ miniGun = defaultAutoGun
|
||||
$ destroyOnImpact bulBounceArmCr' bulHitWall' bulHitFF'
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color red $ polygon $ rectNESW 9 5 (-9) (-5)
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itEquipPict = pictureWeaponOnAim $ color red $ polygon $ rectNESW 9 5 (-9) (-5)
|
||||
}
|
||||
spreadGun :: Item
|
||||
spreadGun = defaultGun
|
||||
{ _itName = "SPREAD"
|
||||
, _itIdentity = SpreadGun
|
||||
@@ -482,12 +452,11 @@ spreadGun = defaultGun
|
||||
, _wpSpread = spreadGunSpread
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [ polygon [(-3,0),(3,6),(3,-6)] ]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 1
|
||||
, _itAimingRange = 0
|
||||
, _itEquipPict = pictureWeaponOnAim $ color green $ pictures [ polygon [(-3,0),(3,6),(3,-6)] ]
|
||||
}
|
||||
multGun :: Item
|
||||
multGun = defaultGun
|
||||
{ _itName = "MULTGUN"
|
||||
, _itIdentity = MultGun
|
||||
@@ -504,8 +473,6 @@ multGun = defaultGun
|
||||
, _wpSpread = spreadGunSpread
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer multGunPic
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||
@@ -520,6 +487,7 @@ multGun = defaultGun
|
||||
, polygon $ rectNSEW (-8) (-12) 2 (-2)
|
||||
, polygon [(-1.5,12),(-2,12),(-2,-12),(-1.5,-12)]
|
||||
]
|
||||
longGun :: Item
|
||||
longGun = defaultGun
|
||||
{ _itName = "LONGGUN"
|
||||
, _itIdentity = LongGun
|
||||
@@ -537,8 +505,6 @@ longGun = defaultGun
|
||||
$ penWalls hvBulHitCr' hvBulHitWall' bulHitFF'
|
||||
, _wpRange = 200
|
||||
, _itFloorPict = onLayer FlItLayer $ pictures [color orange $ polygon $ rectNESW 3 6 (-3) (-6) ]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.2
|
||||
, _itAimingRange = 1
|
||||
, _itZoom = defaultItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5}
|
||||
@@ -570,14 +536,12 @@ poisonSprayer = defaultAutoGun
|
||||
, _wpSpread = 0.3
|
||||
, _wpRange = 8
|
||||
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.2
|
||||
, _itAimingRange = 0
|
||||
, _itZoom = defaultItZoom
|
||||
, _itEquipPict = pictureWeaponOnAim $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||
}
|
||||
|
||||
flamer :: Item
|
||||
flamer = defaultAutoGun
|
||||
{ _itName = "FLAMER"
|
||||
, _itIdentity = Flamethrower
|
||||
@@ -587,18 +551,17 @@ flamer = defaultAutoGun
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 0
|
||||
, _itUseTime = 0
|
||||
, _itUse = shoot $ withSidePush 5 $ withSidePushAfter 10 $ randWalkAngle 0.5 0.05 aFlame
|
||||
, _itUse = shoot $ withSidePush 5 $ withSidePushAfter 10 $ randWalkAngle 0.2 0.01 aFlame
|
||||
, _wpSpread = 0
|
||||
, _wpRange = 8
|
||||
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 0.5
|
||||
, _itAimingRange = 0
|
||||
, _itZoom = defaultItZoom {_itAimZoomMax = 5, _itAimZoomMin = 1.5}
|
||||
, _itEquipPict = pictureWeaponOnAim $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||
, _itAttachment = Nothing
|
||||
}
|
||||
blinkGun :: Item
|
||||
blinkGun = defaultGun
|
||||
{ _itName = "BLINKER"
|
||||
, _itIdentity = Blinker
|
||||
@@ -608,16 +571,30 @@ blinkGun = defaultGun
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 0
|
||||
, _itUseTime = 0
|
||||
, _itUse = shoot aSelf
|
||||
, _itUse = hammerCheck $ shoot aSelf
|
||||
, _wpSpread = 0.05
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||
, _itAimingSpeed = 1
|
||||
, _itAimingRange = 0
|
||||
}
|
||||
boosterGun :: Item
|
||||
boosterGun = defaultGun
|
||||
{ _itName = "BOOSTER"
|
||||
, _itIdentity = Blinker
|
||||
, _wpMaxAmmo = 100
|
||||
, _wpLoadedAmmo = 100
|
||||
, _wpReloadTime = 20
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 0
|
||||
, _itUseTime = 0
|
||||
, _itUse = shoot $ boostSelf Nothing 20
|
||||
, _wpSpread = 0.05
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||
, _itAmount = 1
|
||||
, _itMaxStack = 1
|
||||
, _itAimingSpeed = 1
|
||||
, _itAimingRange = 0
|
||||
}
|
||||
|
||||
|
||||
aTeslaArc :: Creature -> World -> World
|
||||
aTeslaArc cr w = aTeslaArc' cr $ soundFrom (CrWeaponSound cid) 25 1 0 w
|
||||
@@ -630,7 +607,6 @@ aTeslaArc' cr w
|
||||
$ over projectiles (IM.insert i (makeTeslaArcAt i pos dir))
|
||||
$ set randGen g w
|
||||
where
|
||||
cid = _crID cr
|
||||
i = newProjectileKey w
|
||||
pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
|
||||
+.+ sideOffset *.* vNormal (unitVectorAtAngle dir)
|
||||
@@ -733,15 +709,17 @@ moveShell time i cid rot accel w
|
||||
|
||||
shellPic :: Picture
|
||||
shellPic = color black $ polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
remoteShellPic :: Int -> Picture
|
||||
remoteShellPic i
|
||||
| rem (i+200) 20 < 9 = polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
remoteShellPic
|
||||
:: Int -- ^ Timer
|
||||
-> Picture
|
||||
remoteShellPic t
|
||||
| rem (t+200) 20 < 9 = polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
| otherwise = pictures
|
||||
[ polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
, color col $ circleSolid 3
|
||||
[ onLayer UPtLayer $ polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
, setLayer 1 $ onLayer HPtLayer $ color col $ circleSolid 3
|
||||
]
|
||||
where
|
||||
col | i > (-99) = green
|
||||
col | t > (-99) = green
|
||||
| otherwise = red
|
||||
|
||||
shellExplosionAt :: Point2 -> World -> World
|
||||
@@ -751,23 +729,19 @@ aGasCloud :: Creature -> World -> World
|
||||
aGasCloud cr w = insertCloud $ set randGen g w
|
||||
where
|
||||
(a,g) = randomR (-0.1,0.1) (_randGen w)
|
||||
cid = _crID cr
|
||||
dir = _crDir cr + a
|
||||
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
||||
--pos2 = (0.5 *.* vel) +.+
|
||||
-- _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
||||
vel = (_crPos cr -.- _crOldPos cr) +.+ 10 *.* unitVectorAtAngle dir
|
||||
insertCloud = makeGasCloud pos vel -- . makeFlame pos2 vel (Just cid)
|
||||
insertCloud = makeGasCloud pos vel
|
||||
|
||||
aFlame :: Creature -> World -> World
|
||||
aFlame cr w = insertFlame w
|
||||
aFlame cr w = w & particles %~ (aFlameParticle t pos vel (Just cid) :)
|
||||
where
|
||||
(t,_) = randomR (99,101) (_randGen w)
|
||||
cid = _crID cr
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
||||
vel = (_crPos cr -.- _crOldPos cr) +.+ 4 *.* unitVectorAtAngle dir
|
||||
insertFlame = makeFlame t pos vel (Just cid) -- . makeFlame pos2 vel (Just cid)
|
||||
|
||||
aSelf :: Creature -> World -> World
|
||||
aSelf = blinkAction
|
||||
@@ -862,7 +836,7 @@ moveRemoteBomb itid time pID w
|
||||
(50 *.* unitVectorAtAngle (negate $ degToRad (10 * fromIntegral time)))
|
||||
[-0.2,-0.15,-0.1,-0.05,0,0.05,0.1,0.15,0.2]
|
||||
|
||||
grenade,remoteBomb :: Item
|
||||
grenade :: Item
|
||||
grenade = Throwable
|
||||
{ _itName = "GRENADE " ++ show fuseTime
|
||||
, _itIdentity = Grenade
|
||||
@@ -909,7 +883,9 @@ teslaGrenade = grenade {
|
||||
fuseTime = 50 :: Int
|
||||
--f x = 50 / fromIntegral x
|
||||
|
||||
defaultThrowable :: Item
|
||||
defaultThrowable = grenade
|
||||
remoteBomb :: Item
|
||||
remoteBomb = defaultThrowable
|
||||
{ _itName = "REMOTEBOMB"
|
||||
, _itIdentity = RemoteBomb
|
||||
@@ -923,8 +899,6 @@ remoteBomb = defaultThrowable
|
||||
, _itEquipPict = pictureWeaponOnAim remoteBombUnarmedPic
|
||||
}
|
||||
|
||||
|
||||
|
||||
fireRemoteLauncher :: Creature -> World -> World
|
||||
fireRemoteLauncher cr w = setLocation
|
||||
$ resetFire
|
||||
@@ -944,11 +918,11 @@ fireRemoteLauncher cr w = setLocation
|
||||
, _pjID = i
|
||||
, _pjUpdate = moveRemoteShell 50 i cid itid dir
|
||||
}
|
||||
j = _crInvSel $ _creatures w IM.! cid
|
||||
j = _crInvSel cr
|
||||
newitid = IM.newKey $ _itemPositions w
|
||||
maybeitid = w ^? creatures . ix cid . crInv . ix j . itID . _Just
|
||||
maybeitid = cr ^? crInv . ix j . itID . _Just
|
||||
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
||||
$ hammerCheck $ \cr -> explodeRemoteRocket itid i
|
||||
$ hammerCheck $ \_ -> explodeRemoteRocket itid i
|
||||
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET"
|
||||
setLocation :: World -> World
|
||||
setLocation w' = case maybeitid of
|
||||
@@ -1015,7 +989,7 @@ moveRemoteShell time i cid itid _ w
|
||||
(frict,g) = randomR (0.6,0.9) $ _randGen w
|
||||
(sparkD,_) = randomR (-0.5,0.5) $ _randGen w
|
||||
dir = argV vel
|
||||
pic = onLayer PtLayer $ uncurry translate newPos
|
||||
pic = uncurry translate newPos
|
||||
$ rotate (argV accel) $ remoteShellPic time
|
||||
piclow = onLayerL [levLayer CrLayer - 2]
|
||||
$ uncurry translate newPos $ rotate (argV accel)
|
||||
@@ -1049,10 +1023,13 @@ explodeRemoteRocket itid pjid w
|
||||
itPoint = pointToItem $ _itemPositions w IM.! itid
|
||||
|
||||
throwRemoteBomb :: Creature -> World -> World
|
||||
throwRemoteBomb cr w = setLocation $ removePict $ resetFire
|
||||
$ resetName $ over projectiles addG w
|
||||
throwRemoteBomb cr w = setLocation
|
||||
$ removePict
|
||||
$ resetFire
|
||||
$ resetName
|
||||
$ over projectiles addG w
|
||||
where
|
||||
n = _crID cr -- to change to cid
|
||||
cid = _crID cr
|
||||
addG = IM.insert i $ Projectile
|
||||
{ _pjPos = p
|
||||
, _pjStartPos = p
|
||||
@@ -1062,29 +1039,23 @@ throwRemoteBomb cr w = setLocation $ removePict $ resetFire
|
||||
, _pjUpdate = moveRemoteBomb itid 50 i
|
||||
}
|
||||
i = newProjectileKey w
|
||||
-- fireDist = zoom *.* (rotateV (_cameraRot w) (_mousePos w) +.+ _cameraCenter w -.- yourPos)
|
||||
--d = argV $ _mousePos w
|
||||
--(l, _) = randomR (1 - grenadeAccL,1+grenadeAccL) (_randGen w)
|
||||
--(a, g) = randomR (-grenadeAccA,grenadeAccA) (_randGen w)
|
||||
v' = 0.02 / _cameraZoom w *.* rotateV (_cameraRot w) ( _mousePos w)
|
||||
v | magV v' > 6 = 6 *.* normalizeV v'
|
||||
| otherwise = v'
|
||||
-- zoom = 1 / _cameraZoom w
|
||||
j = _crInvSel $ _creatures w IM.! n
|
||||
resetName = set (creatures . ix n . crInv . ix j . itName) "REMOTE"
|
||||
removePict = set (creatures . ix n . crInv . ix j . itEquipPict) $ \ _ _ -> blank
|
||||
resetFire = set (creatures . ix n . crInv . ix j . itUse)
|
||||
j = _crInvSel cr
|
||||
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE"
|
||||
removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> blank
|
||||
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
||||
$ hammerCheck $ explodeRemoteBomb itid i
|
||||
cr = _creatures w IM.! n
|
||||
p' = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr,0)
|
||||
p | circOnSomeWall p' 4 w = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr-4,0)
|
||||
| otherwise = p'
|
||||
maybeitid = w ^? creatures . ix n . crInv . ix j . itID . _Just
|
||||
maybeitid = w ^? creatures . ix cid . crInv . ix j . itID . _Just
|
||||
setLocation :: World -> World
|
||||
setLocation w' = case maybeitid of
|
||||
Nothing -> w' & creatures . ix n . crInv . ix j . itID ?~ newitid
|
||||
& itemPositions %~ IM.insert newitid (InInv n j)
|
||||
_ -> w'
|
||||
Nothing -> w' & creatures . ix cid . crInv . ix j . itID ?~ newitid
|
||||
& itemPositions %~ IM.insert newitid (InInv cid j)
|
||||
_ -> w'
|
||||
newitid = IM.newKey $ _itemPositions w
|
||||
itid = fromMaybe newitid maybeitid
|
||||
|
||||
@@ -1092,19 +1063,19 @@ explodeRemoteBomb :: Int -> Int -> Creature -> World -> World
|
||||
explodeRemoteBomb itid pjid cr w
|
||||
= set (projectiles . ix pjid . pjUpdate) (retireRemoteBomb itid 30 pjid)
|
||||
$ set (projectiles . ix pjid . pjPict) blank
|
||||
$ set (creatures . ix n . crInv . ix j . itUse) (const id)
|
||||
$ set (creatures . ix cid . crInv . ix j . itUse) (const id)
|
||||
$ resetName
|
||||
$ resetPict
|
||||
-- $ resetScope
|
||||
$ makeExplosionAt (_pjPos (_projectiles w IM.! pjid)) w
|
||||
-- - $ makeShrapnelBombAt (_pjPos (_projectiles w IM.! pjid)) w
|
||||
where
|
||||
n = _crID cr
|
||||
resetName = set (creatures . ix n . crInv . ix j . itName) "REMOTEBOMB"
|
||||
resetPict = set (creatures . ix n . crInv . ix j . itEquipPict )
|
||||
cid = _crID cr
|
||||
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEBOMB"
|
||||
resetPict = set (creatures . ix cid . crInv . ix j . itEquipPict )
|
||||
(pictureWeaponOnAim remoteBombUnarmedPic)
|
||||
-- resetScope = creatures . ix n . crInv . ix j . itScope . _Just . scopePos .~ (0,0)
|
||||
j = _crInvSel $ _creatures w IM.! n
|
||||
-- resetScope = creatures . ix cid . crInv . ix j . itScope . _Just . scopePos .~ (0,0)
|
||||
j = _crInvSel $ _creatures w IM.! cid
|
||||
remoteBombPic
|
||||
:: Int -- ^ time
|
||||
-> Picture
|
||||
@@ -1227,7 +1198,6 @@ spawnCrNextTo
|
||||
spawnCrNextTo cr sCr w = w & creatures %~ IM.insert k newCr
|
||||
where
|
||||
k = IM.newKey $ _creatures w
|
||||
i = _crID cr
|
||||
newCr = cr
|
||||
& crID .~ k
|
||||
& crPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)
|
||||
|
||||
Reference in New Issue
Block a user