コード例 #1
0
ファイル: move.py プロジェクト: cneira/cyphesis
 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"]
コード例 #2
0
ファイル: move.py プロジェクト: Arsakes/cyphesis
 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"]
コード例 #3
0
ファイル: transaction.py プロジェクト: cneira/cyphesis
 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"]
コード例 #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
コード例 #5
0
ファイル: move.py プロジェクト: Arsakes/cyphesis
 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"]
コード例 #6
0
ファイル: combat.py プロジェクト: zkactivity-dev/cyphesis
 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
コード例 #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"]
コード例 #8
0
ファイル: misc_goal.py プロジェクト: MrBigDog/cyphesis
 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"]
コード例 #9
0
ファイル: misc_goal.py プロジェクト: MrBigDog/cyphesis
 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"]
コード例 #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"]
コード例 #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"]
コード例 #12
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #13
0
ファイル: misc_goal.py プロジェクト: MrBigDog/cyphesis
 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"]
コード例 #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"]
コード例 #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"]
コード例 #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"]
コード例 #17
0
ファイル: misc_goal.py プロジェクト: MrBigDog/cyphesis
 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"]
コード例 #18
0
ファイル: misc_goal.py プロジェクト: MrBigDog/cyphesis
 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"]
コード例 #19
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #20
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #21
0
ファイル: misc_goal.py プロジェクト: demarii/cyphesis
 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"]
コード例 #22
0
ファイル: transaction.py プロジェクト: 9cat/cyphesis
 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"]
コード例 #23
0
ファイル: misc_goal.py プロジェクト: zkactivity-dev/cyphesis
 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"]
コード例 #24
0
ファイル: move.py プロジェクト: digimax20/cyphesis
 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"]
コード例 #25
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #26
0
ファイル: misc_goal.py プロジェクト: zkactivity-dev/cyphesis
 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"]
コード例 #27
0
ファイル: move.py プロジェクト: Arsakes/cyphesis
 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"]
コード例 #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"]
コード例 #29
0
ファイル: move.py プロジェクト: MasterMann/cyphesis
 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"]
コード例 #30
0
ファイル: misc_goal.py プロジェクト: MrBigDog/cyphesis
 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"]
コード例 #31
0
ファイル: move.py プロジェクト: MasterMann/cyphesis
 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"]
コード例 #32
0
ファイル: misc_goal.py プロジェクト: MrBigDog/cyphesis
 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"]
コード例 #33
0
ファイル: mason.py プロジェクト: alriddoch/cyphesis
 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"]
コード例 #34
0
ファイル: misc_goal.py プロジェクト: MrBigDog/cyphesis
 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"]
コード例 #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"]
コード例 #36
0
ファイル: move.py プロジェクト: MasterMann/cyphesis
 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
コード例 #37
0
ファイル: move.py プロジェクト: MasterMann/cyphesis
 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"]
コード例 #38
0
ファイル: move.py プロジェクト: demarii/cyphesis
 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"]
コード例 #39
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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)
コード例 #40
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #41
0
ファイル: move.py プロジェクト: alriddoch/cyphesis
 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"]
コード例 #42
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #43
0
ファイル: move.py プロジェクト: cyclefusion/cyphesis
 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"]
コード例 #44
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #45
0
ファイル: move.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #46
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #47
0
ファイル: misc_goal.py プロジェクト: 9cat/cyphesis
 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"]
コード例 #48
0
ファイル: misc_goal.py プロジェクト: worldforge/cyphesis
 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"]
コード例 #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"]
コード例 #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"]
コード例 #51
0
ファイル: move.py プロジェクト: Arsakes/cyphesis
 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"]
コード例 #52
0
ファイル: move.py プロジェクト: alriddoch/cyphesis
 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"]