Example #1
0
 def __init__(self, who):
     Goal.__init__(self, "stay with someone",
                   self.am_i_with, 
                   [spot_something(who),
                    self.follow])
     self.who=who
     self.vars=["who"]
Example #2
0
 def __init__(self, what, location, speed=0):
     Goal.__init__(self, "move this to certain place", self.is_it_at_loc, [self.move_it_to_loc])
     self.what = what
     self.speed = speed
     self.location = location
     self.wait = 0
     self.vars = ["what", "location", "speed", "wait"]
Example #3
0
 def __init__(self, what, cost, who, desc="buy livestock from someone"):
     Goal.__init__(self, desc, false, [self.check])
     self.what = what
     self.cost = cost
     self.who = who
     self.last_valued = None
     self.vars = ["what", "cost", "who", "last_valued"]
Example #4
0
 def __init__(self, what="", range=30):
     Goal.__init__(self,
                   desc="Fight something.",
                   sub_goals=[
                       Condition(condition_fn=self.has_enemy_in_range,
                                 goals_true=[
                                     Condition(
                                         condition_fn=self.should_use_melee,
                                         goals_true=[
                                             self.equip_melee_weapon,
                                             self.equip_shield,
                                             self.attack_melee,
                                             MoveMe(location=self.get_enemy,
                                                    radius=0,
                                                    speed=0.5)
                                         ],
                                         goals_false=[
                                             self.equip_ranged_weapon,
                                             self.stop_moving,
                                             self.attack_ranged,
                                         ])
                                 ],
                                 goals_false=[self.stop_attack_task])
                   ])
     self.what = what
     self.filter = entity_filter.Filter(what)
     self.range = range
     self.square_range = range * range
     self.vars = ["what", "range"]
     self.weapon_usage = None
     self.use_ranged = False
     self.closest_enemy = None
     self.distance_to_enemy = None
Example #5
0
 def __init__(self, location, range=30):
     Goal.__init__(self, "move me to certain area", self.am_I_in_area, [move_me(location), self.latch_loc])
     self.location = location
     self.range = range
     self.square_range = range * range
     self.arrived = 0
     self.vars = ["location", "range", "arrived"]
Example #6
0
 def __init__(self, what="", range=30):
     Goal.__init__(
         self,
         "fight something",
         self.none_in_range,
         [
             SpotSomething(what=what, range=range),
             Condition(self.should_use_melee, [
                 self.equip_melee_weapon, self.equip_shield,
                 self.attack_melee,
                 MoveMeToFocus(what=what, radius=0, speed=0.5)
             ], [
                 self.equip_ranged_weapon,
                 self.stop_moving,
                 self.attack_ranged,
             ])
             #                       hunt_for(what=what, range=range, proximity=3),
         ])
     self.what = what
     self.filter = entity_filter.Filter(what)
     self.range = range
     self.square_range = range * range
     self.vars = ["what", "range"]
     self.weapon_usage = None
     self.use_ranged = False
Example #7
0
 def __init__(self, what, where):
     Goal.__init__(self, "Keep " + what + " in " + where + ".",
                   self.are_they_there,
                   [self.keep_it])
     self.what = what
     self.where = where
     self.vars = ["what", "where"]
Example #8
0
 def __init__(self, what, amount, what_desc="some thing", place=None):
     Goal.__init__(self, "make certain amount of things", self.are_all_done,
                   [move_me(place), self.do_all])
     self.what = what
     self.amount = amount
     self.what_desc = what_desc
     self.vars = ["what", "amount"]
Example #9
0
 def __init__(self, what):
     Goal.__init__(self, "acquire thing by name",
                   self.is_it_in_my_inventory,
                   [get_knowledge(what),
                    acquire_known_thing(what)])
     self.what = what
     self.vars = ["what"]
Example #10
0
 def __init__(self, what):
     Goal.__init__(self,"move this thing to my inventory (class)",
                   self.is_it_with_me,
                   [move_me_to_possession(what),
                    self.pick_it_up])
     self.what=what
     self.vars=["what"]
Example #11
0
 def __init__(self):
     Goal.__init__(self, "forage for food by name and eat randomly",
                   self.am_i_full,
                   [self.do_peck])
     self.what = "world"
     self.full = 0.2
     self.vars = ["full"]
Example #12
0
 def __init__(self, what):
     Goal.__init__(self, "acquire thing by name",
                   self.is_it_in_my_inventory,
                   [get_knowledge(what),
                    acquire_known_thing(what)])
     self.what = what
     self.vars = ["what"]
Example #13
0
 def __init__(self, what):
     Goal.__init__(self, "clear focus", self.clear_focus, [])
     if isinstance(what, list):
         self.what = what
     else:
         self.what = [what]
     self.vars = ["what"]
Example #14
0
 def __init__(self, what):
     Goal.__init__(self, "acquire known thing by name",
                   self.is_it_in_my_inventory,
                   [buy_thing(what),
                    pick_up_possession(what)])
     self.what = what
     self.vars = ["what"]
Example #15
0
 def __init__(self, who):
     Goal.__init__(self, "stay with someone",
                   self.am_i_with, 
                   [spot_something(who),
                    self.follow])
     self.who=who
     self.vars=["who"]
Example #16
0
 def __init__(self, location, speed=1):
     Goal.__init__(self,"move me to certain place",
                   self.am_I_at_loc,
                   [self.move_to_loc])
     self.location=location
     self.speed=speed
     self.vars=["location", "speed"]
Example #17
0
 def __init__(self, what):
     #CHEAT!: doesn't work for static goals ;-(
     #goal systems needs redesign
     Goal.__init__(self, "buy thing by name (I am at shop)",
                   self.do_I_have_it, [move_me_place(what), self.buy_it])
     self.what = what
     self.vars = ["what"]
Example #18
0
 def __init__(self, shop, updown, time):
     Goal.__init__(self, "run a shop", self.is_it,
                   [spot_something(shop), self.set_it], time)
     # FIXME This probably does not work, but I'll fix it when we need it
     self.shop = shop
     self.state = updown
     self.vars = ["shop"]
Example #19
0
 def __init__(self, what, src, dest):
     Goal.__init__(self, "move thing to place",
                   false,
                   [fetch_something(what, src),
                    move_me(dest),
                    move_it_outof_me(what)])
     self.what = what
     self.vars = ["what"]
Example #20
0
 def __init__(self, what, where):
     Goal.__init__(self, "fetch a thing",
                   self.is_it_in_my_inventory,
                   [move_me_area(where, 20),
                    spot_something(what),
                    pick_up_focus(what)])
     self.what = what
     self.vars = ["what"]
Example #21
0
 def __init__(self, what, range):
     Goal.__init__(
         self, "defend against something", self.none_in_sight,
         [spot_something(what),
          hunt_for(what, range), self.fight])
     self.what = what
     self.range = range
     self.vars = ["what", "range"]
Example #22
0
 def __init__(self, what, cost, who, desc="buy livestock from someone"):
     Goal.__init__(self, desc, false,
                   [self.check])
     self.what=what
     self.cost=cost
     self.who=who
     self.last_valued=None
     self.vars=["what","cost","who","last_valued"]
Example #23
0
 def __init__(self, what, src, dest):
     Goal.__init__(
         self, "move thing to place", false,
         [FetchSomething(what, src),
          MoveMe(dest),
          MoveItOutOfMe(what)])
     self.what = what
     self.vars = ["what"]
Example #24
0
 def __init__(self, what="", range=0, proximity=5):
     Goal.__init__(self, "hunt for something", self.in_range,
                   [pursuit(what=what, range=range)])
     self.what = what
     self.range = range
     self.proximity = proximity
     self.square_proximity = proximity * proximity
     self.vars = ["what", "range", "proximity"]
Example #25
0
 def __init__(self, what, amount, what_desc="some thing", place=None):
     Goal.__init__(self, "make certain amount of things",
                   self.are_all_done,
                   [move_me(place), self.do_all])
     self.what = what
     self.amount = amount
     self.what_desc = what_desc
     self.vars = ["what", "amount"]
Example #26
0
 def __init__(self, what, where):
     Goal.__init__(
         self, "fetch a thing", self.is_it_in_my_inventory,
         [MoveMeArea(where, 20),
          SpotSomething(what),
          PickUpFocus(what)])
     self.what = what
     self.vars = ["what"]
Example #27
0
 def __init__(self, what, range, proximity=5):
     Goal.__init__(self, "hunt for something", self.in_range, [self.run])
     self.what = what
     self.range = range
     self.proximity = proximity
     self.square_proximity = proximity * proximity
     self.direction = 1
     self.vars = ["what", "range", "direction"]
Example #28
0
 def __init__(self, messages, responses, target):
     Goal.__init__(self, "help", self.message_complete, [self.give_help])
     self.iter = 0
     self.count = len(messages)
     self.messages = messages
     self.responses = responses
     self.target = target
     self.vars = ["iter", "count", "messages", "responses", "target"]
Example #29
0
 def __init__(self, what, range, proximity=5):
     Goal.__init__(self, "hunt for something", self.in_range, [self.run])
     self.what = what
     self.range = range
     self.proximity = proximity
     self.square_proximity = proximity * proximity
     self.direction = 1
     self.vars = ["what", "range", "direction"]
Example #30
0
 def __init__(self, what, who, cost):
     Goal.__init__(self, "conduct transaction", self.transaction_inactive,
                   [self.transact])
     self.what = what
     self.who = who
     self.cost = int(cost)
     self.payed = 0
     self.vars = ["what", "who", "cost", "payed"]
Example #31
0
 def __init__(self, locations, extragoal=None):
     Goal.__init__(self, "patrol an area", false,
                   [move_me(locations[0]), extragoal, self.increment],
                   self.check_move_valid)
     self.list = locations
     self.stage = 0
     self.count = len(locations)
     self.vars = ["stage", "list"]
Example #32
0
 def __init__(self, what, src, dest):
     Goal.__init__(self, "move thing to place", false, [
         fetch_something(what, src),
         move_me(dest),
         move_it_outof_me(what)
     ])
     self.what = what
     self.vars = ["what"]
Example #33
0
 def __init__(self, messages, responses, target):
     Goal.__init__(self, "help", self.message_complete, [self.give_help])
     self.iter = 0
     self.count = len(messages)
     self.messages = messages
     self.responses = responses
     self.target = target
     self.vars = ["iter", "count", "messages", "responses", "target"]
Example #34
0
 def __init__(self, what, where):
     Goal.__init__(self, "fetch a thing", self.is_it_in_my_inventory, [
         move_me_area(where, 20),
         spot_something(what),
         pick_up_focus(what)
     ])
     self.what = what
     self.vars = ["what"]
Example #35
0
 def __init__(self, what):
     Goal.__init__(self, "search for a thing",
                   self.do_I_have,
                   [wander(false),
                    spot_something(what, 30)])
     # Long range for testing only
     self.what=what
     self.vars=["what"]
Example #36
0
 def __init__(self, location, radius=0.5, speed=0.2):
     Goal.__init__(self, "move me to certain place", self.am_I_at_loc,
                   [self.move_to_loc], self.is_reachable)
     self.location = location
     self.speed = speed
     self.radius = radius
     self.vars = ["location", "speed", "radius"]
     self.squared_radius = radius * radius
Example #37
0
 def __init__(self, what, location, speed=0):
     Goal.__init__(self, "move this to certain place", self.is_it_at_loc,
                   [self.move_it_to_loc])
     self.what = what
     self.speed = speed
     self.location = location
     self.wait = 0
     self.vars = ["what", "location", "speed", "wait"]
Example #38
0
 def __init__(self, radius, locations):
     Goal.__init__(self,"roam randomly",false,
                   [move_me(None),
                    self.do_roaming])
     self.list = locations
     self.radius = radius
     self.count = len(locations)
     self.vars = ["radius", "list"]
Example #39
0
 def __init__(self, what, location, range=30, condition=lambda a: 1, seconds_until_forgotten=30):
     Goal.__init__(self, "spot a thing in area",
                   self.do_I_have,
                   [self.do])
     self.range = range
     self.sqr_range = range * range
     self.area_location_name = location
     self.condition = condition
     self.inner_spot_goal = spot_something(what, range=range, seconds_until_forgotten=seconds_until_forgotten, condition=self.is_thing_in_area)
Example #40
0
 def __init__(self, shop, updown, time):
     Goal.__init__(self, "run a shop",
                   self.is_it,
                   [spot_something(shop),
                    self.set_it], time)
     # FIXME This probably does not work, but I'll fix it when we need it
     self.shop = shop
     self.state = updown
     self.vars = ["shop"]
Example #41
0
 def __init__(self, what):
     Goal.__init__(self,"move me to this thing",
                   self.am_i_at_it,
                   [self.move_me_to_it])
     if type(what) == types.ListType:
         self.what = what
     else:
         self.what = [ what ]
     self.vars=["what"]
Example #42
0
 def __init__(self, what):
     # CHEAT!: doesn't work for static goals ;-(
     # goal systems needs redesign
     Goal.__init__(self, "buy thing by name (I am at shop)",
                   self.do_I_have_it,
                   [move_me_place(what),
                    self.buy_it])
     self.what = what
     self.vars = ["what"]
Example #43
0
 def __init__(self, locations):
     Goal.__init__(self, "patrol an area",
                   false,
                   [move_me(locations[0]),
                    self.increment])
     self.list = locations
     self.stage = 0
     self.count = len(locations)
     self.vars = ["stage", "list"]
Example #44
0
 def __init__(self, what):
     Goal.__init__(self, "clear focus",
                   self.clear_focus,
                   [])
     if isinstance(what, list):
         self.what = what
     else:
         self.what = [what]
     self.vars = ["what"]
Example #45
0
 def __init__(self, what="", range=0, proximity=5):
     Goal.__init__(self, "hunt for something",
                   self.in_range,
                   [pursuit(what=what, range=range)])
     self.what = what
     self.range = range
     self.proximity = proximity
     self.square_proximity = proximity * proximity
     self.vars = ["what", "range", "proximity"]
Example #46
0
 def __init__(self, what, who, cost):
     Goal.__init__(self, "conduct transaction",
                   self.transaction_inactive,
                   [self.transact])
     self.what = what
     self.who = who
     self.cost = int(cost)
     self.payed = 0
     self.vars = ["what", "who", "cost", "payed"]
Example #47
0
 def __init__(self, what, range):
     Goal.__init__(self, "defend against something",
                   self.none_in_sight,
                   [spot_something(what),
                    hunt_for(what, range),
                    self.fight])
     self.what=what
     self.range=range
     self.vars=["what", "range"]
Example #48
0
 def __init__(self, what, where, when=None):
     Goal.__init__(self, "Sell to the public",
                   self.dont_I_have_it,
                   [move_me(where),
                    self.announce_trade],
                   when)
     self.what = what
     self.ticks = 0
     self.vars = ["what"]
Example #49
0
 def __init__(self, location, range=30):
     Goal.__init__(self, "move me to certain area",
                   self.am_I_in_area,
                   [move_me(location),self.latch_loc])
     self.location=location
     self.range=range
     self.square_range=range*range
     self.arrived=0
     self.vars=["location","range","arrived"]
Example #50
0
 def __init__(self, whlist):
     Goal.__init__(self, "patrol an area",
                   false,
                   [move_me(whlist[0]),
                    self.increment])
     self.list = whlist
     self.stage = 0
     self.count = len(whlist)
     self.vars = ["stage", "list"]
Example #51
0
 def __init__(self, what, distance=2):
     Goal.__init__(self, "move me to this thing", self.am_i_at_it, [self.move_me_to_it])
     if type(what) == types.ListType:
         self.what = what
     else:
         self.what = [what]
     # How close we need to get to the thing.
     self.distance = distance
     self.vars = ["what", "distance"]
Example #52
0
 def __init__(self, what):
     Goal.__init__(self,"move this thing to my inventory (class)",
                   self.is_it_with_me,
                   [move_me_to_focus(what),
                    self.pick_it_up])
     if type(what) == types.ListType:
         self.what = what
     else:
         self.what = [ what ]
     self.vars=["what"]