241 lines
6.8 KiB
Haskell
241 lines
6.8 KiB
Haskell
module Dodge.Creature
|
|
( module Dodge.Creature
|
|
, module Dodge.Creature.Inanimate
|
|
, launcherCrit
|
|
, pistolCrit
|
|
, ltAutoCrit
|
|
, spreadGunCrit
|
|
, autoCrit
|
|
, chaseCrit
|
|
, armourChaseCrit
|
|
, smallChaseCrit
|
|
) where
|
|
import Dodge.Creature.State.Data
|
|
import Dodge.Creature.Update
|
|
--import Dodge.Item.Weapon.Grenade
|
|
import Dodge.Item.Weapon.Booster
|
|
import Dodge.Item.Weapon.Utility
|
|
import Dodge.Item.Weapon.Drone
|
|
import Dodge.Item.Craftable
|
|
--import Dodge.Creature.AlertLevel
|
|
--import Dodge.Creature.SetTarget
|
|
import Dodge.Creature.Volition
|
|
import Dodge.Creature.Test
|
|
--import Dodge.Creature.Impulse
|
|
import Dodge.Creature.SentinelAI
|
|
import Dodge.Creature.LauncherCrit
|
|
import Dodge.Creature.PistolCrit
|
|
import Dodge.Creature.LtAutoCrit
|
|
import Dodge.Creature.SpreadGunCrit
|
|
import Dodge.Creature.AutoCrit
|
|
import Dodge.Creature.ChaseCrit
|
|
import Dodge.Creature.ArmourChase
|
|
import Dodge.Data
|
|
import Dodge.Default
|
|
import Dodge.Item.Weapon
|
|
import Dodge.Item.Equipment
|
|
import Dodge.Item.Consumable
|
|
import Dodge.WorldEvent.Cloud
|
|
import Dodge.Creature.YourControl
|
|
import Dodge.Creature.Inanimate
|
|
import Dodge.Creature.State
|
|
import Dodge.Creature.Picture
|
|
--import Dodge.Creature.ChooseTarget
|
|
--import Dodge.Item
|
|
import Picture
|
|
import Geometry.Data
|
|
import qualified IntMapHelp as IM
|
|
|
|
--import Data.List
|
|
--import Data.Char
|
|
--import Data.Maybe
|
|
--import Data.Function
|
|
import Control.Lens
|
|
--import System.Random
|
|
--import qualified Data.Set as S
|
|
--import qualified Data.Map as M
|
|
|
|
spawnerCrit :: Creature
|
|
spawnerCrit = defaultCreature
|
|
{ --_crUpdate = stateUpdate $ spawnerAI chaseCrit
|
|
_crHP = 300
|
|
, _crPict = basicCrPict blue
|
|
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
|
}
|
|
|
|
miniGunCrit :: Creature
|
|
miniGunCrit = defaultCreature
|
|
{ _crPict = basicCrPict red
|
|
, _crUpdate = defaultImpulsive [sentinelFireType (const shootTillEmpty)]
|
|
, _crActionPlan = ActionPlan
|
|
{ _crImpulse = []
|
|
, _crAction = []
|
|
, _crStrategy = StrategyActions WatchAndWait [StartSentinelPost]
|
|
, _crGoal = []
|
|
}
|
|
-- , _crInv = IM.fromList [(0,autoRifle & itConsumption . ammoLoaded .~ 1000)]
|
|
, _crInv = IM.fromList [(0,miniGunX 3)]
|
|
-- , _crInv = IM.fromList [(0,autoRifle)]
|
|
, _crInvSel = 0
|
|
, _crRad = 10
|
|
, _crState = defaultState
|
|
, _crHP = 500
|
|
, _crMvType = defaultAimMvType
|
|
}
|
|
longCrit :: Creature
|
|
longCrit = defaultCreature
|
|
{ _crPict = basicCrPict red
|
|
-- , _crUpdate = stateUpdate sniperAI
|
|
, _crUpdate = defaultImpulsive [sentinelFireType $ const shootTillEmpty]
|
|
, _crActionPlan = ActionPlan
|
|
{ _crImpulse = []
|
|
, _crAction = []
|
|
, _crStrategy = StrategyActions WatchAndWait [StartSentinelPost]
|
|
, _crGoal = []
|
|
}
|
|
, _crInv = IM.fromList [(0,sniperRifle),(1,medkit 100)]
|
|
, _crInvSel = 0
|
|
, _crRad = 10
|
|
, _crHP = 150
|
|
}
|
|
multGunCrit :: Creature
|
|
multGunCrit = defaultCreature
|
|
{ _crPict = basicCrPict red
|
|
-- , _crUpdate = stateUpdate (twitchMissAI 300 350)
|
|
, _crInv = IM.fromList [(0,bangCaneX 4),(1,medkit 100)]
|
|
, _crInvSel = 0
|
|
, _crRad = 10
|
|
, _crHP = 300
|
|
, _crUpdate = defaultImpulsive [sentinelExtraWatchUpdate
|
|
[ ( const $ not . crHasAmmo
|
|
, \_ _ -> StrategyActions Reload reloadActions
|
|
)
|
|
, (const $ not . crSafeDistFromTarg 150
|
|
, \_ cr -> StrategyActions Flee
|
|
[const (not . crSafeDistFromTarg 150) `DoActionWhile` UseTarget (fleeFrom cr)
|
|
`DoActionThen` DoImpulses [ChangeStrategy WatchAndWait] ]
|
|
)
|
|
, (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
|
[ drawwp `DoActionThen` shootFirstMiss `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait] ]
|
|
)
|
|
]
|
|
]
|
|
, _crActionPlan = ActionPlan
|
|
{ _crImpulse = []
|
|
, _crAction = []
|
|
, _crStrategy = WatchAndWait
|
|
, _crGoal = []
|
|
}
|
|
}
|
|
where
|
|
drawwp = DoActionIfElse NoAction (const crIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
|
reloadActions =
|
|
[ holsterWeapon
|
|
, WaitThen 1 $ DoActionWhileInterrupt NoAction (const crIsReloading) (DoImpulses [ChangeStrategy WatchAndWait])
|
|
]
|
|
|
|
addArmour :: Creature -> Creature
|
|
addArmour = over crInv insarmour
|
|
where
|
|
insarmour xs = IM.insert (IM.newKey xs) frontArmour xs
|
|
{- | The creature you control.
|
|
ID 0. -}
|
|
startCr :: Creature
|
|
startCr = defaultCreature
|
|
{ _crPos = V2 20 0
|
|
, _crOldPos = V2 20 0
|
|
, _crDir = pi/2
|
|
, _crMvDir = pi/2
|
|
, _crID = 0
|
|
, _crPict = basicCrPict black
|
|
, _crUpdate = stateUpdate yourControl
|
|
, _crRad = 10
|
|
, _crMass = 10
|
|
, _crHP = 1000
|
|
, _crMaxHP = 1500
|
|
, _crInv = startInventory
|
|
, _crCorpse = setDepth 5
|
|
$ color (greyN 0.5) $ pictures [color (greyN 0.8) $ circleSolid 10, circLine 10]
|
|
, _crFaction = PlayerFaction
|
|
, _crMvType = MvWalking yourDefaultSpeed
|
|
}
|
|
{- | Items you start with. -}
|
|
startInvList :: [Item]
|
|
startInvList = [ ]
|
|
startInventory :: IM.IntMap Item
|
|
startInventory = IM.fromList $ zip [0..] startInvList
|
|
inventoryA :: IM.IntMap Item
|
|
inventoryA = IM.fromList $ zip [0..]
|
|
[ makeTypeCraftNum 1 TRANSFORMER
|
|
, makeTypeCraftNum 2 CAN
|
|
, makeTypeCraftNum 2 PIPE
|
|
]
|
|
|
|
testInventory :: IM.IntMap Item
|
|
testInventory = IM.fromList $ zip [0..]
|
|
[ makeTypeCraftNum 9 PIPE
|
|
-- , makeModule INCENDIARYMODULE
|
|
-- , makeModule STATICMODULE
|
|
-- , bounceModule
|
|
, medkit 50 & itConsumption . itAmount .~ 3
|
|
, teleportModule
|
|
-- , makeTypeCraftNum 1 LIGHTER
|
|
, makeTypeCraftNum 15 TUBE
|
|
-- , makeTypeCraftNum 9 TRANSFORMER
|
|
, makeTypeCraftNum 5 CREATURESENSOR
|
|
-- , makeTypeCraftNum 9 PRISM
|
|
-- , makeTypeCraftNum 3 DRUM
|
|
-- , makeTypeCraftNum 3 PUMP
|
|
-- , makeTypeCraftNum 3 BATTERY
|
|
-- , makeTypeCraftNum 1 MAGNET
|
|
, makeTypeCraftNum 1 TRANSMITTER
|
|
, makeTypeCraftNum 10 HARDWARE
|
|
, makeTypeCraftNum 3 SPRING
|
|
, makeTypeCraftNum 10 CAN
|
|
-- , makeTypeCraftNum 3 TIN
|
|
, makeTypeCraftNum 3 PLANK
|
|
-- , makeTypeCraftNum 1 MOTOR
|
|
, makeTypeCraftNum 5 MICROCHIP
|
|
-- , makeTypeCraftNum 5 AIUNIT
|
|
]
|
|
stackedInventory :: IM.IntMap Item
|
|
stackedInventory = IM.fromList $ zip [0..]
|
|
[sonicGun
|
|
,burstRifle
|
|
, pipe
|
|
,rewindGun
|
|
,tractorGun
|
|
,longGun
|
|
,autoGun
|
|
,ltAutoGun
|
|
,hvAutoGun
|
|
,pistol
|
|
,teslaGun
|
|
,blinkGun
|
|
,miniGunX 3
|
|
-- ,multGun
|
|
,boosterGun
|
|
,remoteLauncher
|
|
,flatShield
|
|
-- ,grenade
|
|
,spawnGun (lamp 5)
|
|
,lasGun
|
|
,flameThrower
|
|
,poisonSprayer
|
|
,launcher
|
|
,lasDrones
|
|
--,lasGun
|
|
--,grenade
|
|
--,ltAutoGun,flamer,multGun,spreadGun,remoteLauncher
|
|
--,longGun
|
|
--,hvAutoGun
|
|
--,teslaGun
|
|
--,latchkey 0
|
|
--,miniGun
|
|
--,medkit 50
|
|
--,bezierGun
|
|
]
|
|
smokeGenGun :: Item
|
|
smokeGenGun = effectGun "smoke" $ const spawnSmokeAtCursor
|
|
|