66 lines
2.0 KiB
Haskell
66 lines
2.0 KiB
Haskell
module Dodge.Item.Weapon.Shatter where
|
|
--import Dodge.WorldEvent.HitEffect
|
|
--import Dodge.Item.Weapon.BulletGun.Clip
|
|
import Dodge.Data
|
|
import Dodge.Wall.Damage
|
|
--import Dodge.SoundLogic
|
|
import Dodge.Block.Debris
|
|
import Dodge.Base.Collide
|
|
import Dodge.Zone
|
|
import Dodge.Creature.HandPos
|
|
--import Dodge.ChainEffect
|
|
import Dodge.Default.Weapon
|
|
import Dodge.Default
|
|
--import Dodge.Item.Attachment
|
|
--import Dodge.Item.Weapon.ExtraEffect
|
|
--import Dodge.Item.Weapon.InventoryDisplay
|
|
--import Dodge.Item.Draw
|
|
import Dodge.Item.Weapon.TriggerType
|
|
--import Dodge.SoundLogic.LoadSound
|
|
import Picture
|
|
import Geometry
|
|
import ShapePicture
|
|
import Shape
|
|
--import Sound.Data
|
|
import LensHelp
|
|
|
|
import qualified Data.IntMap.Strict as IM
|
|
|
|
shatterGun :: Item
|
|
shatterGun = defaultWeapon
|
|
& itType . iyBase .~ SHATTERGUN
|
|
& itUse .~ ruseRate 10 shootShatter upHammer
|
|
[ ammoHammerCheck
|
|
, useTimeCheck
|
|
-- , withSoundStart tap3S
|
|
, useAmmoAmount 1
|
|
]
|
|
& itUse . useAim . aimStance .~ TwoHandFlat
|
|
& itDimension . dimSPic .~ shatterGunSPic
|
|
|
|
shatterGunSPic :: Item -> SPic
|
|
shatterGunSPic _ = noPic $ colorSH blue $
|
|
upperPrismPoly 5 (rectNESW xb 8 xa 0)
|
|
++ upperPrismPoly 5 (rectNESW (-xa) 8 (-xb) 0)
|
|
where
|
|
xa = 1
|
|
xb = 9
|
|
shootShatter :: Item -> Creature -> World -> World
|
|
shootShatter it cr w = maybe w (uncurry $ shatterWall w sp ep) $ collidePointWallsWall sp ep
|
|
$ IM.filter canshatter
|
|
$ wallsAlongLine sp ep w
|
|
where
|
|
canshatter wl = case _wlOpacity wl of
|
|
Opaque -> True
|
|
SeeThrough -> True
|
|
_ -> False
|
|
sp = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
|
dir = _crDir cr
|
|
ep = sp +.+ 200 *.* unitVectorAtAngle dir
|
|
|
|
shatterWall :: World -> Point2 -> Point2 -> Point2 -> Wall -> World
|
|
shatterWall w sp ep p wl = w
|
|
& makeDebris (_wlMaterial wl) p
|
|
& makeDebrisDirected 1 2 (pi/2) (argV $ vNormal $ uncurry (-.-) $ _wlLine wl) (_wlMaterial wl) p
|
|
& damageWall (Damage SHATTERING 1000 sp p ep NoDamageEffect) wl
|