Remove all AI code from AI file
This commit is contained in:
@@ -71,10 +71,10 @@ followImpulse cr w imp = case imp of
|
||||
ArbitraryImpulseFunction f -> (id, f w cr)
|
||||
ArbitraryImpulse f -> followImpulse cr w (f cr w)
|
||||
ImpulseUseTargetCID f -> case cr ^? crTarget . _Just of
|
||||
Just tcid -> followImpulse cr w (f tcid)
|
||||
Just tcr -> followImpulse cr w (f $ _crID tcr)
|
||||
_ -> (id,cr)
|
||||
ImpulseUseTarget f -> case cr ^? crTarget . _Just of
|
||||
Just tcid -> followImpulse cr w (f $ _creatures w IM.! tcid)
|
||||
Just tcr -> followImpulse cr w (f tcr)
|
||||
_ -> (id,cr)
|
||||
ImpulseUseAheadPos f -> followImpulse cr w (f (_crPos cr +.+ 20 *.* unitVectorAtAngle (_crDir cr)))
|
||||
_ -> (id , cr)
|
||||
@@ -156,14 +156,13 @@ performAction cr w ac = case ac of
|
||||
| hasLOS cpos p w -> ([TurnToward p (pi/4),MoveForward 3] , Just (PathTo p))
|
||||
| otherwise -> ([], Nothing)
|
||||
LeadTarget p -> case cr ^? crTarget . _Just of
|
||||
Just tcid -> let tcr = _creatures w IM.! tcid
|
||||
in ([TurnTo (_crPos tcr +.+ rotateV (_crDir tcr) p)], Nothing)
|
||||
Just tcr -> ([TurnTo (_crPos tcr +.+ rotateV (_crDir tcr) p)], Nothing)
|
||||
_ -> ([], Nothing)
|
||||
FleeFrom cid -> case w ^? creatures . ix cid of
|
||||
Just tcr -> ([MoveForward 3, TurnToward ((2 *.* _crPos cr) -.- _crPos tcr) (pi/4)], Nothing)
|
||||
_ -> ([], Nothing)
|
||||
UseTargetCID f -> case cr ^? crTarget . _Just of
|
||||
Just tcid -> performAction cr w (f tcid)
|
||||
Just tcr -> performAction cr w (f $ _crID tcr)
|
||||
_ -> ([],Nothing)
|
||||
UseAheadPos f -> performAction cr w (f (_crPos cr +.+ 20 *.* unitVectorAtAngle (_crDir cr)))
|
||||
ArbitraryAction f -> performAction cr w (f cr w)
|
||||
|
||||
Reference in New Issue
Block a user