예제 #1
0
    def run(self):
        AbilityInstance.run(self)
        if self.player.world.is_master:
            # create the bounding circle to check collision against
            bounding_cone = collision.BoundingCone(self.hit_radius,
                                                   self.player.rotation,
                                                   self.hit_angle)

            # get a list of colliding players
            self.targets = self.player.world.get_colliders(
                bounding_cone, self.player.position, [self.player],
                objects.Player)

            # for each player, apply effects
            for player in self.targets:
                # get force vector for other player
                force_vector = ((player.position[0] - self.player.position[0],
                                 player.position[1] - self.player.position[1]))
                force_vector = CollisionDetector.normalise_vector(force_vector)
                player.force_vector = (force_vector[0] *
                                       self.starting_strength,
                                       force_vector[1] *
                                       self.starting_strength)
                print "Gust of wind collided with another player!"

        # end the effect
        self.expire()
예제 #2
0
 def master(self):
     # create the bounding circle to check collision against
     bounding_cone = collision.BoundingCone(self.hit_radius, self.player.rotation, self.hit_angle) 
     # get a list of colliding players
     colliders = self.player.world.get_colliders(bounding_cone, self.player.position,
                                                 [self.player], objects.Player)
     # for each player, apply effects
     for player in colliders:
         player.apply_damage(self.damage, self.player, 403)
         print "Tidal Wave collided with another player!"
예제 #3
0
 def run(self):
     AbilityInstance.run(self)
     if not self.player.world.is_master:
         # This ability doesn't do anything client-side.
         self.expire()
     else:
         self.range = self.player.bounding_shape.radius + 16
         self.bounding_shape = collision.BoundingCone(self.range,
             self.player.rotation, 2*math.pi/3)
         self.hit_players = []
예제 #4
0
 def run(self):
     AbilityInstance.run(self)
     bounding_shape = collision.BoundingCone(
         self.player.bounding_shape.radius + 8,
         self.player.rotation, math.pi/2)
     colliders = self.player.world.get_colliders(
         bounding_shape, self.player.position,
         [self.player], objects.Player)
     print "Fire Primary ability collided with %s game objects." % (len(colliders))
     self.expire()
예제 #5
0
 def run(self):
     AbilityInstance.run(self)
     # @todo: have swing delay
     bounding_shape = collision.BoundingCone(
         self.range,
         self.player.rotation, self.hit_angle)
     colliders = self.player.world.get_colliders(
         bounding_shape, self.player.position,
         [self.player], objects.Player)
     print "Earth Primary ability collided with %s players." % (len(colliders))
     self.expire()
예제 #6
0
 def run(self):
     AbilityInstance.run(self)
     # @todo: have swing delay
     bounding_shape = collision.BoundingCone(self.range,
                                             self.player.rotation,
                                             self.hit_angle)
     colliders = self.player.world.get_colliders(bounding_shape,
                                                 self.player.position,
                                                 [self.player],
                                                 objects.Player)
     if self.player.world.is_master:
         self.master(colliders)
     self.expire()
예제 #7
0
 def run(self):
     AbilityInstance.run(self)
     # create the bounding circle to check collision against
     bounding_cone = collision.BoundingCone(self.hit_radius, self.player.rotation, self.hit_angle) 
     
     # get a list of colliding players
     colliders = self.player.world.get_colliders(bounding_cone, self.player.position,
                                                 [self.player], objects.Player)
     
     # for each player, apply effects
     for player in colliders:
         # @todo: apply damage etc
         print "Tidal Wave collided with another player!"
             
     # end the effect
     self.expire()
예제 #8
0
 def run(self):
     AbilityInstance.run(self)
     # create the bounding circle to check collision against
     bounding_cone = collision.BoundingCone(self.hit_radius, self.player.rotation, self.hit_angle) 
     
     # get a list of colliding players
     colliders = self.player.world.get_colliders(bounding_cone, self.player.position,
                                                 [self.player], objects.Player)
     
     # for each player, apply effects
     for player in colliders:
         # get force vector for other player
         force_vector = ((player.position[0] - self.player.position[0],
                          player.position[1] - self.player.position[1]))
         player.apply_force(force_vector, self.knockback_strength, self.acceleration_factor, self.duration)
         print "Gust of wind collided with another player!"
             
     # end the effect
     self.expire()