def _get_fight_costs( games, max_frame_gap, ignore_end_frames, limit_ratio_change_mult ): game_fights = {} game_fight_player_costs = {} game_fight_net_costs = {} game_fight_player_dpf = {} for game in games: fights, fight_player_costs,fight_net_costs,fight_player_dpf = [],[],[],[] game_fights[game.game_id] = fights game_fight_player_costs[game.game_id] = fight_player_costs game_fight_net_costs[game.game_id] = fight_net_costs game_fight_player_dpf[game.game_id] = fight_player_dpf for fight in FightUtils.iter_fights(game, max_frame_gap): fights.append(fight) # fetch the fight_participant's final_frame = game.aa_list[ len(game.aa_list)-1].died_frame - ignore_end_frames born,rein,dead = FightUtils.get_fight_participants(game,fight, final_frame) player_costs = Costs.get_player_fight_costs(game, fight, ignore_end_frames, born=born, rein=rein, dead=dead) net_costs = Costs.NetFightCosts(player_costs[0], player_costs[1], limit_ratio_change_mult) player_dpf = get_player_dpf( dead ) # dpf presented relative to 'reference_player'. This excludes team games. if net_costs.army_ratio and net_costs.reference_player_index == 1: player_dpf[0], player_dpf[1] = player_dpf[1], player_dpf[0] fight_player_dpf.append(player_dpf) fight_player_costs.append(player_costs) fight_net_costs.append(net_costs) return game_fights, game_fight_player_costs, game_fight_net_costs, game_fight_player_dpf
def _get_fight_costs( games, max_frame_gap, ignore_end_frames, limit_ratio_change_mult ): game_fights = {} game_fight_player_costs = {} game_fight_net_costs = {} for game in games: fights, fight_player_costs,fight_net_costs = [],[],[] game_fights[game.game_id] = fights game_fight_player_costs[game.game_id] = fight_player_costs game_fight_net_costs[game.game_id] = fight_net_costs for fight in FightUtils.iter_fights(game, max_frame_gap): fights.append(fight) player_costs = Costs.get_player_fight_costs(game,fight, ignore_end_frames, born=None, rein=None, dead=None) net_costs = Costs.NetFightCosts(player_costs[0], player_costs[1], limit_ratio_change_mult) fight_player_costs.append(player_costs) fight_net_costs.append(net_costs) return game_fights, game_fight_player_costs, game_fight_net_costs