示例#1
0
	def check_dmg_done(self, roster):
		#Check which units are within range of receiving dmg from my attack
		x_range = self.attacks_dict.get(self.attack_status).get("x_range")
		y_range = self.attacks_dict.get(self.attack_status).get("y_range")

		for enemy in roster:
			if engine.in_range_cross(self, enemy, x_range, y_range, self.direction):
				enemy.lose_health(self.attacks_dict.get(self.attack_status).get("dmg"))
		return self.attacks_dict.get(self.attack_status).get("dmg")
    def check_dmg_done(self, roster):
        #Check which units are within range of receiving dmg from my attack
        x_range = self.attacks_dict.get(self.attack_status).get("x_range")
        y_range = self.attacks_dict.get(self.attack_status).get("y_range")

        for enemy in roster:
            if engine.in_range_cross(self, enemy, x_range, y_range,
                                     self.direction):
                enemy.lose_health(
                    self.attacks_dict.get(self.attack_status).get("dmg"))
        return self.attacks_dict.get(self.attack_status).get("dmg")
	def check_attack_2(self):
		"""
		Check if another targeted unit is within range of attack
		"""

		unit_x,unit_y = self.get_position()
		player_ofa = self.AI.find_closest_player()
		pl_x, pl_y = player_ofa.get_position()
		pl_to_enm_right = (abs(pl_x-unit_x)) - player_ofa.width
		pl_to_enm_left = (abs(unit_x-pl_x)) - self.width
		pl_to_enm_top =  (abs(pl_y-unit_y)) - player_ofa.height
		pl_to_enm_bottom = (abs(pl_y-unit_y)) - self.height

		x2_attk_rng = self.attacks_dict["two"]["x_range"]
		y2_attk_rng = self.attacks_dict["two"]["y_range"]
		offset = 0.5

		return engine.in_range_cross(self, player_ofa, x2_attk_rng, y2_attk_rng, self.direction)
    def check_attack_2(self):
        """
		Check if another targeted unit is within range of attack
		"""

        unit_x, unit_y = self.get_position()
        player_ofa = self.AI.find_closest_player()
        pl_x, pl_y = player_ofa.get_position()
        pl_to_enm_right = (abs(pl_x - unit_x)) - player_ofa.width
        pl_to_enm_left = (abs(unit_x - pl_x)) - self.width
        pl_to_enm_top = (abs(pl_y - unit_y)) - player_ofa.height
        pl_to_enm_bottom = (abs(pl_y - unit_y)) - self.height

        x2_attk_rng = self.attacks_dict["two"]["x_range"]
        y2_attk_rng = self.attacks_dict["two"]["y_range"]
        offset = 0.5

        return engine.in_range_cross(self, player_ofa, x2_attk_rng,
                                     y2_attk_rng, self.direction)