forked from roguelike2d/TekkenBot
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBotTest.py
61 lines (50 loc) · 1.97 KB
/
BotTest.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
52
53
54
55
56
57
"""
A simple bot that presses buttons when emerging from block or hit stun.
"""
import time
import random
import csv
import xml.etree.ElementTree as ET
import NotationParser
import movelist
import tkinter
from AcademyBot import AcademyBot
from TekkenGameState import TekkenGameState
from BotData import BotBehaviors
from NotationParser import ParseMoveList
from MatchRecorder import MatchRecorder
from CharacterData import *
from MoveInfoEnums import *
from movelist import MoveList
class BotTest(AcademyBot):
def __init__(self, botCommands):
super().__init__(botCommands)
self.Command = None
self.Delay = 60
self.LastMoveName = None
# self.FrameLastAction = 0
# self.frameCounter = 0
self.LastBotMoveName = None
self.LastPlayerMoveName = None
def Update(self, gameState: TekkenGameState):
successfulUpdate = super().Update(gameState)
if(self.overlay != None):
self.overlay.WriteToOverlay("Stance: " + str(self.Stance))
# print("Botmove: " + self.BotMove)
# if self.LastMoveName != self.BotMove:
# self.LastMoveName = self.BotMove
#self.botCommands.AddCommand(self.botCommands.ForwarddashSmall())
BotBehaviors.BlockAllAttacks(gameState, self.botCommands)
currentPlayerMoveName = gameState.GetCurrentOppMoveName()
if(currentPlayerMoveName != self.LastPlayerMoveName):
char_id = gameState.stateLog[-1].opp.char_id
self.LastPlayerMoveName = currentPlayerMoveName
print(str(char_id) + ": " + self.LastPlayerMoveName)
###Testing
test = self.OppMovelist.getMoveById(5)
if(self.OppMovelist.DidMoveJustHappen(self.BotMoveHistory, test)):
print("Move happened")
return successfulUpdate
#if self.botCommands.IsAvailable():
#BotBehaviors.BlockAllAttacks(gameState, self.botCommands)
#Check to see if the bot is standing