Refactor ai
This commit is contained in:
+49
-22
@@ -10,6 +10,8 @@ import Dodge.Creature.ImpulseRat
|
||||
import Dodge.Creature.ActionRat
|
||||
import Dodge.Creature.Rationality.Data
|
||||
import Dodge.Creature.AlertLevel
|
||||
import Dodge.Creature.SetTarget
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Data
|
||||
import Dodge.AIs
|
||||
import Dodge.Default
|
||||
@@ -64,10 +66,10 @@ smallChaseCrit = defaultCreature
|
||||
, _crPict = basicCrPict green
|
||||
, _crState = defaultState
|
||||
{_goals = [[Wait]]
|
||||
,_faction = ChaseCritters
|
||||
}
|
||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 4
|
||||
, _crFaction = ColorFaction green
|
||||
}
|
||||
chaseCrit :: Creature
|
||||
chaseCrit = defaultCreature
|
||||
@@ -76,10 +78,10 @@ chaseCrit = defaultCreature
|
||||
, _crPict = basicCrPict green
|
||||
, _crState = defaultState
|
||||
{_goals = [[Wait]]
|
||||
,_faction = ChaseCritters
|
||||
}
|
||||
, _crInv = IM.empty
|
||||
, _crMeleeCooldown = Just 0
|
||||
, _crFaction = ColorFaction green
|
||||
}
|
||||
armourChaseCrit :: Creature
|
||||
armourChaseCrit = defaultCreature
|
||||
@@ -92,12 +94,12 @@ armourChaseCrit = defaultCreature
|
||||
,(1,medkit 200)
|
||||
]
|
||||
}
|
||||
miniGunCrit' :: Creature
|
||||
miniGunCrit' = defaultCreature
|
||||
miniGunCrit :: Creature
|
||||
miniGunCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ composeInternalAIs
|
||||
[ actionUpdateAI performActions
|
||||
, shootAtTarget targetYouCognizant
|
||||
[ performActions
|
||||
, shootTargetWithStrat targetYouCognizant suppress
|
||||
, basicPerceptionUpdate [0]
|
||||
]
|
||||
, _crInv = IM.fromList [(0,miniGun)]
|
||||
@@ -105,20 +107,6 @@ miniGunCrit' = defaultCreature
|
||||
, _crRad = 10
|
||||
, _crState = defaultState
|
||||
, _crHP = 500
|
||||
, _crRationality = ActionRat
|
||||
{ _crImpulse = []
|
||||
, _crAction = [AimAtCloseSlow 0 (0,0) 0.2 0.01 (pi/4) ]
|
||||
}
|
||||
}
|
||||
miniGunCrit :: Creature
|
||||
miniGunCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate miniAI
|
||||
, _crInv = IM.fromList [(0,miniGun)]
|
||||
, _crInvSel = 0
|
||||
, _crRad = 10
|
||||
, _crState = defaultState {_goals = [[InitGuard]]}
|
||||
, _crHP = 500
|
||||
}
|
||||
longCrit :: Creature
|
||||
longCrit = defaultCreature
|
||||
@@ -133,12 +121,31 @@ longCrit = defaultCreature
|
||||
multGunCrit :: Creature
|
||||
multGunCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate (twitchMissAI 300 350)
|
||||
-- , _crUpdate = stateUpdate (twitchMissAI 300 350)
|
||||
, _crInv = IM.fromList [(0,multGun),(1,medkit 100)]
|
||||
, _crInvSel = 0
|
||||
, _crRad = 10
|
||||
, _crState = defaultState {_goals = [[InitGuard]]}
|
||||
, _crHP = 300
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ composeInternalAIs
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, shootFirstMiss 0)
|
||||
, (crAwayFromPost, goToPostStrat)
|
||||
]
|
||||
, basicPerceptionUpdate [0]
|
||||
, doStrategyActions
|
||||
, reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, overrideInternal (onBoth (&&) crHasTarget (crStratConMatches (GetTo (0,0))))
|
||||
$ \ _ -> crActionPlan . crStrategy .~ WatchAndWait
|
||||
]
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
, _crAction = []
|
||||
, _crStrategy = WatchAndWait
|
||||
, _crGoal = []
|
||||
}
|
||||
}
|
||||
launcherCrit :: Creature
|
||||
launcherCrit = defaultCreature
|
||||
@@ -173,7 +180,25 @@ pistolCrit = defaultCreature
|
||||
autoCrit :: Creature
|
||||
autoCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate basicShooterAI
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ composeInternalAIs
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, shootAdvanceStrat 0)
|
||||
, (crAwayFromPost, goToPostStrat)
|
||||
]
|
||||
, basicPerceptionUpdate [0]
|
||||
, doStrategyActions
|
||||
, reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, overrideInternal (onBoth (&&) crHasTarget (crStratConMatches (GetTo (0,0))))
|
||||
$ \ _ -> crActionPlan . crStrategy .~ WatchAndWait
|
||||
]
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
, _crAction = []
|
||||
, _crStrategy = StrategyActions [StartSentinelPost] WatchAndWait
|
||||
, _crGoal = []
|
||||
}
|
||||
, _crInv = IM.fromList [(0,autoGun),(1,medkit 100)]
|
||||
, _crInvSel = 0
|
||||
, _crRad = 10
|
||||
@@ -246,6 +271,7 @@ startCr = defaultCreature
|
||||
, _crMaxHP = 1500
|
||||
, _crInv = startInventory
|
||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ pictures [color (greyN 0.8) $ circleSolid 10, circLine 10]
|
||||
, _crFaction = PlayerFaction
|
||||
}
|
||||
{- |
|
||||
Items you start with.
|
||||
@@ -253,6 +279,7 @@ Items you start with.
|
||||
startInventory = IM.fromList (zip [0..20]
|
||||
(
|
||||
[bezierGun
|
||||
,multGun
|
||||
,hvAutoGun
|
||||
,remoteLauncher
|
||||
,grenade
|
||||
|
||||
Reference in New Issue
Block a user