Example #1
0
 def update(self):
     if chance(10):
         direct = self.hunt(True)
         Movable.move(self,direct)
     else:
         if not self.vector:
             Walker.update(self)
Example #2
0
 def update(self):
     if chance(10):
         direct = self.hunt(True)
         Movable.move(self, direct)
     else:
         if not self.vector:
             Walker.update(self)
Example #3
0
 def update(self):
     if chance(70):
         direct = self.hunt()
         if direct:
             self.move(direct)
         else:
             Walker.update(self)
     else:
         Walker.update(self)
     Breakable.update(self)
Example #4
0
    def choice_position(cls, world, location, i, j):
        if len(world.tiles[Point(i, j)]):
            return False

        for ij in world.get_near_cords(i, j):
            for player in world.tiles[Point(*ij)]:
                if isinstance(player, AloneTree):
                    return True
        if chance(98):
            return False
        else:
            return True
Example #5
0
    def choice_position(cls, world, location, i ,j):
        if len(world.tiles[Point(i,j)]):
            return False

        for ij in world.get_near_cords(i,j):
                for player in world.tiles[Point(*ij)]:
                    if isinstance(player, AloneTree):
                        return True
        if chance(98):
            return False
        else:
            return True
Example #6
0
 def update(self):
     if self.alive:
         if chance(50):
             direct = self.hunt(False)
             if direct:
                 delta = random()*TILESIZE
                 direct += Point(delta, -delta)
                 self.strike_ball(direct)
             else:
                 Walker.update(self)
         else:
             Walker.update(self)
             
     Breakable.update(self)
Example #7
0
    def update(self):
        if self.alive:
            if chance(50):
                direct = self.hunt(False)
                if direct:
                    delta = random() * TILESIZE
                    direct += Point(delta, -delta)
                    self.strike_ball(direct)
                else:
                    Walker.update(self)
            else:
                Walker.update(self)

        Breakable.update(self)
Example #8
0
 def run(self):
     d = 1
     t = time()
     while not self.running.is_set():
         if not self.accepted:
             self.accept()
         else:
             
             sleep(ROUND_TIMER)
             self.update()
             self.in_messages = []
             if time()-t>1:
                 d*=-1
                 x = randrange(-500, 500)
                 y = randrange(-500, 500)
                 if d>0:
                     self.send_move(Point(x,y))
                 else:
                     self.send_ball(Point(x,y))
                 if chance(10):
                     self.send_skill()
                 if chance(10):
                     self.send_apply_item(randrange(8))
                 t = time()
Example #9
0
 def die(self):
     if chance(self.cost):
         item = choice(self.loot)(self.position)
         self.world.new_object(item)
     Breakable.die(self)