class _PlayerBaseTestCase(unittest.TestCase): def set_up(self, alliance=(1, 2), cloak=False, map_name="jl1_extended", ai=("easy", "easy")): self.w = World([]) self.w.load_and_build_map(Map("soundrts/tests/%s.txt" % map_name)) if cloak: self.w.unit_class("new_flyingmachine").dct["is_a_cloaker"] = True cp = DummyClient(ai[0]) cp2 = DummyClient(ai[1]) cp.alliance, cp2.alliance = alliance self.w.populate_map([cp, cp2], random_starts=False) self.cp, self.cp2 = self.w.players self.cp.is_perceiving = is_perceiving_method(self.cp) self.cp2.is_perceiving = is_perceiving_method(self.cp2) self.w._update_buckets() def find_player_unit(self, p, cls_name, index=0): for u in p.units: if u.type_name == cls_name: if index: index -= 1 else: return u
def set_up(self, alliance=(1, 2), cloak=False): w = World([]) w.introduction = [] w.load_and_build_map(Map("soundrts/tests/jl1.txt")) w.players_starts[1][1].append(("b4", w.unit_class("lumbermill"))) cl = DummyClient() cl2 = DummyClient() w.populate_map([cl, cl2], alliance) cp, self.cp2 = w.players return w, cl, cp
def set_up(self, alliance=(1, 2), cloak=False, map_name="jl1_extended"): w = World([]) w.introduction = [] w.load_and_build_map(Map("soundrts/tests/%s.txt" % map_name)) if cloak: w.unit_class("new_flyingmachine").dct["is_a_cloaker"] = True cl = DummyClient() cl2 = DummyClient() w.populate_map([cl, cl2], alliance) cp, self.cp2 = w.players return w, cl, cp
class _PlayerBaseTestCase(unittest.TestCase): def set_up(self, alliance=(1, 2), cloak=False, map_name="jl1_extended"): self.w = World([]) self.w.introduction = [] self.w.load_and_build_map(Map("soundrts/tests/%s.txt" % map_name)) if cloak: self.w.unit_class("new_flyingmachine").dct["is_a_cloaker"] = True self.w.populate_map([DummyClient(), DummyClient()], alliance) self.cp, self.cp2 = self.w.players def find_player_unit(self, p, cls_name, index=0): for u in p.units: if u.type_name == cls_name: if index: index -= 1 else: return u
def set_up(self, alliance=(1, 2), cloak=False): w = World([]) w.introduction = [] w.load_and_build_map(Map("soundrts/tests/jl1.txt")) w.players_starts[0][1].append(("b1", w.unit_class("new_flyingmachine"))) w.players_starts[0][1].append(("b1", w.unit_class("flyingmachine"))) w.players_starts[0][1].append(("b1", w.unit_class("dragon"))) w.players_starts[0][1].append(("b1", w.unit_class("castle"))) w.players_starts[1][1].append(("b4", w.unit_class("new_flyingmachine"))) w.players_starts[1][1].append(("b4", w.unit_class("flyingmachine"))) w.players_starts[1][1].append(("b4", w.unit_class("dragon"))) w.players_starts[1][1].append(("b4", w.unit_class("castle"))) if cloak: w.unit_class("new_flyingmachine").dct["is_a_cloaker"] = True cl = DummyClient() cl2 = DummyClient() w.populate_map([cl, cl2], alliance) cp, self.cp2 = w.players return w, cl, cp