forked from WAZAAAAA0/TekkenBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BotFrameTrap.py
51 lines (38 loc) · 1.56 KB
/
BotFrameTrap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
A simple bot that presses buttons when emerging from block or hit stun.
"""
from Bot import Bot
from TekkenGameState import TekkenGameState
from BotData import BotBehaviors
from NotationParser import ParseMoveList
from MatchRecorder import MatchRecorder
class BotFrameTrap(Bot):
def __init__(self, botCommands):
super().__init__(botCommands)
self.SetFrameTrapCommandFromNotationString("+4")
self.recorder = None
self.inputDelay = 0
self.inputDelayCode = None
def Update(self, gameState: TekkenGameState):
if not self.recorder == None:
self.recorder.Update(gameState)
BotBehaviors.Basic(gameState, self.botCommands)
if self.botCommands.IsAvailable():
BotBehaviors.BlockAllAttacks(gameState, self.botCommands)
if gameState.IsBotBlocking() or gameState.IsBotGettingHit():
self.botCommands.AddCommand(self.response)
def SetFrameTrapCommandFromNotationString(self, notation: str):
try:
self.response = ParseMoveList(">, " + notation + ", >>")
#print(self.response)
except:
print("Could not parse move: " + str(notation))
def Record(self):
self.recorder = MatchRecorder()
def Stop(self):
notation = self.recorder.GetInputAsNotation()
#commands = self.recorder.GetInputAsCommands()
#self.botCommands.ClearCommands()
#self.botCommands.AddCommand(commands)
self.recorder = None
return notation