def miner_to_smith(world, entity, smith):
    entity_pt = entities.get_position(entity)
    if not smith:
        return ([entity_pt], False)
    smith_pt = entities.get_position(smith)
    if adjacent(entity_pt, smith_pt):
        entities.set_resource_count(entity, 0)
        return ([], True)
    else:
        new_pt = next_position(world, entity_pt, smith_pt)
        return (worldmodel.move_entity(world, entity, new_pt), False)
Example #2
0
 def miner_to_ore(self, world, ore):
     entity_pt = self.get_position()
     if not ore:
         return ([entity_pt], False)
     ore_pt = ore.get_position()
     if actions.adjacent(entity_pt, ore_pt):
         self.set_resource_count(1 + self.get_resource_count())
         worldmodel.remove_entity(world, ore)
         return ([ore_pt], True)
     else:
         new_pt = actions.next_position(world, entity_pt, ore_pt)
         return (worldmodel.move_entity(world, self, new_pt), False)
Example #3
0
def miner_to_ore(world, entity, ore):
    entity_pt = entity.get_position()
    if not ore:
        return ([entity_pt], False)
    ore_pt = ore.get_position()
    if adjacent(entity_pt, ore_pt):
        entity.set_resource_count(1 + entity.get_resource_count())
        remove_entity(world, ore)
        return ([ore_pt], True)
    else:
        new_pt = next_position(world, entity_pt, ore_pt)
        return (worldmodel.move_entity(world, entity, new_pt), False)
Example #4
0
def miner_to_ore(world, entity, ore):
   entity_pt = entity.get_position()
   if not ore:
      return ([entity_pt], False)
   ore_pt = ore.get_position()
   if adjacent(entity_pt, ore_pt):
      entity.set_resource_count(1 + entity.get_resource_count())
      remove_entity(world, ore)
      return ([ore_pt], True)
   else:
      new_pt = next_position(world, entity_pt, ore_pt)
      return (worldmodel.move_entity(world, entity, new_pt), False)
Example #5
0
 def miner_to_ore(world, entity, ore):
     entity_pt = get_position(entity)
     if not ore:
         return ([entity_pt], False)
     ore_pt = get_position(ore)
     if actions.adjacent(entity_pt, ore_pt):
         set_resource_count(entity, 1 + get_resource_count(entity))
         actions.remove_entity(world, ore)
         return ([ore_pt], True)
     else:
         new_pt = actions.next_position(world, entity_pt, ore_pt)
         return (worldmodel.move_entity(world, entity, new_pt), False)
Example #6
0
 def miner_to_smith(self, world, smith):
     entity_pt = self.get_position()
     if not smith:
         return ([entity_pt], False)
     smith_pt = smith.get_position()
     if actions.adjacent(entity_pt, smith_pt):
         smith.set_resource_count(smith.get_resource_count() +
                                  self.get_resource_count())
         self.set_resource_count(0)
         return ([], True)
     else:
         new_pt = actions.next_position(world, entity_pt, smith_pt)
         return (worldmodel.move_entity(world, self, new_pt), False)
Example #7
0
def miner_to_smith(world, entity, smith):
   entity_pt = entity.get_position()
   if not smith:
      return ([entity_pt], False)
   smith_pt = smith.get_position()
   if adjacent(entity_pt, smith_pt):
      smith.set_resource_count(smith.get_resource_count() +
         entity.get_resource_count())
      entity.set_resource_count(0)
      return ([], True)
   else:
      new_pt = next_position(world, entity_pt, smith_pt)
      return (worldmodel.move_entity(world, entity, new_pt), False)
Example #8
0
def blob_to_vein(world, entity, vein):
    entity_pt = entity.get_position()
    if not vein:
        return ([entity_pt], False)
    vein_pt = vein.get_position()
    if adjacent(entity_pt, vein_pt):
        remove_entity(world, vein)
        return ([vein_pt], True)
    else:
        new_pt = blob_next_position(world, entity_pt, vein_pt)
        old_entity = worldmodel.get_tile_occupant(world, new_pt)
        if isinstance(old_entity, entities.Ore):
            remove_entity(world, old_entity)
        return (worldmodel.move_entity(world, entity, new_pt), False)
Example #9
0
def blob_to_vein(world, entity, vein):
   entity_pt = entity.get_position()
   if not vein:
      return ([entity_pt], False)
   vein_pt = vein.get_position()
   if adjacent(entity_pt, vein_pt):
      remove_entity(world, vein)
      return ([vein_pt], True)
   else:
      new_pt = blob_next_position(world, entity_pt, vein_pt)
      old_entity = worldmodel.get_tile_occupant(world, new_pt)
      if isinstance(old_entity, entities.Ore):
         remove_entity(world, old_entity)
      return (worldmodel.move_entity(world, entity, new_pt), False)