def Update(self, gameState: TekkenGameState): 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 Update(self, gameState: TekkenGameState): self.enemyCyclopedia.Update(gameState) if gameState.WasFightReset(): self.botCommands.ClearCommands() self.gameplan = None if self.gameplan == None: char_id = gameState.GetBotCharId() if char_id != None: self.gameplan = GetGameplan(char_id) if self.gameplan != None: BotBehaviors.Basic(gameState, self.botCommands) if self.botCommands.IsAvailable(): BotBehaviors.BlockAllAttacks(gameState, self.botCommands) frameAdvantage = None if gameState.IsBotBlocking(): frameAdvantage = self.enemyCyclopedia.GetFrameAdvantage( gameState.GetOppMoveId()) elif gameState.IsBotGettingHit(): frameAdvantage = self.enemyCyclopedia.GetFrameAdvantage( gameState.GetOppMoveId(), isOnBlock=False) try: frameAdvantage = int(frameAdvantage) * -1 except: frameAdvantage = None if frameAdvantage != None: if frameAdvantage >= 10: if gameState.IsBotWhileStanding(): punish = self.gameplan.GetMoveByFrame( ResponseTypes.ws_punishes, frameAdvantage) else: punish = self.gameplan.GetMoveByFrame( ResponseTypes.st_punishes, frameAdvantage) if punish != None: self.botCommands.AddCommand(punish)
def Update(self, gameState: TekkenGameState): if self.isPlayerOne: gameState.FlipMirror() bot_id = gameState.GetBotMoveId() opp_id = gameState.GetOppMoveId() bot_timer = gameState.GetBotMoveTimer() opp_timer = gameState.GetOppMoveTimer() if (gameState.IsOppWhiffing()) and ( gameState.IsBotBlocking() or gameState.IsBotGettingHit() or gameState.IsBotBeingThrown() or gameState.IsBotStartedBeingJuggled() or gameState.IsBotBeingKnockedDown() or gameState.IsBotJustGrounded()): if gameState.DidBotIdChangeXMovesAgo( self.active_frame_wait ) or gameState.DidBotTimerReduceXMovesAgo( self.active_frame_wait ): #or (opp_id != self.previous_opp_id and (100 < opp_id < 10000)) if not self.active_frame_wait >= gameState.GetOppActiveFrames( ) + 1: self.active_frame_wait += 1 else: self.active_frame_wait = 1 if opp_id in self.FrameData: frameDataEntry = self.FrameData[opp_id] else: frameDataEntry = FrameDataEntry() self.FrameData[opp_id] = frameDataEntry frameDataEntry.currentFrameAdvantage = '??' frameDataEntry.move_id = opp_id frameDataEntry.damage = gameState.GetMostRecentOppDamage() if gameState.GetOppStartup() > 0: frameDataEntry.startup = gameState.GetOppStartup() frameDataEntry.activeFrames = gameState.GetOppActiveFrames( ) frameDataEntry.hitType = AttackType( gameState.GetOppAttackType()).name if gameState.IsOppAttackThrow(): frameDataEntry.hitType += "_THROW" oldRecovery = 0 else: snapshotOpp = gameState.GetLastOppWithDifferentMoveId() if snapshotOpp != None: frameDataEntry.startup = snapshotOpp.startup frameDataEntry.activeFrames = snapshotOpp.GetActiveFrames( ) frameDataEntry.hitType = AttackType( snapshotOpp.attack_type).name if snapshotOpp.IsAttackThrow(): frameDataEntry.hitType += "_THROW" oldRecovery = snapshotOpp.recovery try: frameDataEntry.recovery = gameState.GetOppRecovery( ) - frameDataEntry.startup - frameDataEntry.activeFrames + 1 except: frameDataEntry.recovery = "?!" time_till_recovery_opp = gameState.GetOppRecovery( ) - gameState.GetOppMoveTimer() time_till_recovery_bot = gameState.GetBotRecovery( ) - gameState.GetBotMoveTimer() new_frame_advantage_calc = time_till_recovery_bot - time_till_recovery_opp old_frame_advantage_calc = None if gameState.IsBotBlocking(): old_frame_advantage_calc = gameState.GetBotRecovery( ) + frameDataEntry.startup - gameState.GetOppRecovery( ) split_recovery_breakpoint = 3 #below this number are split recovery moves that don't need startup subtracted, like Steve's ff+2, above it are Lili's d/b+4 or Alisa's d+3+4 if oldRecovery > gameState.GetOppRecovery( ) + split_recovery_breakpoint: #ankle breaker moves and a few others have a split recovery old_frame_advantage_calc -= frameDataEntry.startup frameDataEntry.onBlock = new_frame_advantage_calc frameDataEntry.currentFrameAdvantage = frameDataEntry.WithPlusIfNeeded( frameDataEntry.onBlock) frameDataEntry.blockFrames = frameDataEntry.recovery - frameDataEntry.startup else: # gameState.IsBotGettingHit() or : old_frame_advantage_calc = gameState.GetFrameDataOfCurrentOppMove( ) frameDataEntry.onNormalHit = new_frame_advantage_calc frameDataEntry.currentFrameAdvantage = frameDataEntry.WithPlusIfNeeded( frameDataEntry.onNormalHit) #elif gameState.IsBotStartedBeingJuggled(): #frameDataEntry.onNormalHit = "JUGG" #elif gameState.IsBotBeingKnockedDown(): #frameDataEntry.onNormalHit = "KDWN" #elif gameState.IsBotJustGrounded(): # frameDataEntry.onNormalHit = "GRND" #elif gameState.IsBotBeingThrown(): # pass if self.isPlayerOne: prefix = "p1: " else: prefix = 'p2: ' if old_frame_advantage_calc != new_frame_advantage_calc: print( "Frame advantage inconsistent calculation. Old = " + str(old_frame_advantage_calc) + " New: " + str(new_frame_advantage_calc), file=sys.stderr) print(prefix + str(frameDataEntry)) if self.isPlayerOne: gameState.FlipMirror()