def testMoveAroundEnemy(self): m = Map(3, 10) m.generate_from_ascii("models/maps/corridor.txt") g = GreaserUnit(1, 2, m, CONST.jets) b1 = BruiserUnit(2, 3, m, CONST.sharks) ##blocked by teammate b2 = BruiserUnit(1, 3, m, CONST.sharks) ##blocked by teammate assert (g.move(1, 4))
def test_bruiser_special_collide(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10.txt") s = GreaserUnit(8, 3, m, CONST.sharks) g = GreaserUnit(8, 4, m, CONST.sharks) b = BruiserUnit(8, 5, m, CONST.jets) assert (b.special_attack(8, 4)) assert (m.unit_at(8, 3) is s)
def quick_board_32_18(self): unit4 = GreaserUnit(12, 6, self, CONST.jets) unit5 = SquabblerUnit(14, 4, self, CONST.jets) unit6 = GreaserUnit(13, 5, self, CONST.jets) unit7 = SquabblerUnit(17,6, self, CONST.jets) unit8 = BruiserUnit(18,6,self,CONST.jets) unit1 = GreaserUnit(12, 15, self, CONST.sharks) unit2 = BruiserUnit(13, 16, self, CONST.sharks) unit3 = SquabblerUnit(16, 16, self, CONST.sharks) unit9 = BruiserUnit(17, 14,self,CONST.sharks) uni10 = GreaserUnit(14, 14, self, CONST.sharks)
def testInvalidAttack(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10.txt") s = SquabblerUnit(8, 4, m, CONST.jets) b = BruiserUnit(8, 5, m, CONST.jets) ##blocked by teammate assert (not s.attack(7, 4)) assert (not s.attack(8, 5))
def testAttackComplex(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10.txt") s = SquabblerUnit(8, 3, m, CONST.jets) b = BruiserUnit(8, 5, m, CONST.sharks) ##blocked by teammate h = b.hp assert (s.attack(8, 5)) assert (b.hp < h)
def testAttackSimple(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10.txt") g = GreaserUnit(8, 3, m, CONST.jets) b = BruiserUnit(8, 4, m, CONST.sharks) ##blocked by teammate s = b.hp assert (g.attack(8, 4)) assert (b.hp < s)
def testMoveThroughFriendly(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10funnel.txt") g = GreaserUnit(4, 3, m, CONST.jets) b = BruiserUnit(4, 4, m, CONST.jets) ##blocked by teammate assert (g.move(4, 6)) assert (g.x == 4 and g.y == 6) assert (m.unit_at(4, 6) is g)
def test_recreate_astar_no_path_bug(self): m = Map(32, 18) m.generate_from_ascii("models/maps/TheBlock.txt") g1 = GreaserUnit(12, 11, m, CONST.jets) g3 = GreaserUnit(15, 11, m, CONST.sharks) g4 = GreaserUnit(14, 12, m, CONST.sharks) b1 = BruiserUnit(16, 12, m, CONST.sharks) s3 = SquabblerUnit(15, 13, m, CONST.sharks) g1.valid_moves()
def test_bruiser(self): n = Map(6, 4) n.generate_from_ascii("models/maps/6by4.txt") b = BruiserUnit(0, 0, n, CONST.jets) assert (b.max_hp >= CONST.bruiser_min_hp and b.max_hp <= CONST.bruiser_max_hp) assert (b.map == n) assert (b.finesse >= CONST.bruiser_min_finesse and b.finesse <= CONST.bruiser_max_finesse) assert (b.x == 0 & b.y == 0)
def test_greaser_special(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10.txt") s = SquabblerUnit(8, 3, m, CONST.jets) g = GreaserUnit(8, 4, m, CONST.sharks) b = BruiserUnit(8, 5, m, CONST.jets) bh = b.hp sh = s.hp assert (g.special_attack(8, 5)) assert (bh > b.hp and sh > s.hp)
def test_add_remove_unit(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10.txt") g = GreaserUnit(2, 2, m, CONST.jets) assert (m.tile_matrix[2][2].is_occupied) assert (not m.tile_matrix[3][3].is_occupied) b = BruiserUnit(3, 3, m, CONST.jets) assert (m.tile_matrix[3][3].is_occupied) s = SquabblerUnit(4, 4, m, CONST.jets) assert (m.tile_matrix[4][4].is_occupied) m.delete_unit(g) assert (not m.tile_matrix[2][2].is_occupied) m.delete_unit(b) assert (not m.tile_matrix[3][3].is_occupied) m.delete_unit(s) assert (not m.tile_matrix[4][4].is_occupied)
def testMoveThroughEnemy(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10funnel.txt") g = GreaserUnit(8, 3, m, CONST.jets) b = BruiserUnit(8, 4, m, CONST.sharks) ##blocked by teammate assert (not g.move(8, 5))