Exemple #1
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
Exemple #2
0
 def __init__(self, what, amount, what_desc="some thing", place=None):
     Goal.__init__(self, "make certain amount of things", self.are_all_done,
                   [MoveMe(place), self.do_all])
     self.what = what
     self.amount = amount
     self.what_desc = what_desc
     self.vars = ["what", "amount"]
Exemple #3
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"]
Exemple #4
0
 def __init__(self, what, where, when=None):
     Goal.__init__(self, "Sell to the public",
                   self.dont_I_have_it,
                   [MoveMe(where),
                    self.announce_trade],
                   when)
     self.what = what
     self.ticks = 0
     self.vars = ["what"]
Exemple #5
0
 def __init__(self, desc, place):
     Goal.__init__(self, desc, false, [MoveMe(place), self.imaginary])
     self.vars = ["desc"]
Exemple #6
0
 def __init__(self, what):
     Goal.__init__(self, "extinguish fire",
                   self.fire_extinguished,
                   [MoveMe(what.location), self.extinguish])
     self.what = what
     self.vars = ["what"]