def walls_dungeon(pirate_basetype, steel_wall_type): unit_locations = {} wall_x = 4 for wall_y in range(0, 6): unit_locations[Unit(steel_wall_type)] = Cell(wall_x, wall_y) unit_locations[Unit(pirate_basetype)] = Cell(7, 0) _walls_dungeon = Dungeon(unit_locations, 8, 8, hero_entrance=Cell(0, 0)) yield _walls_dungeon
def test_attack_cell(pirate_basetype, no_chances): bf = Battlefield(3,3) DreamGame(bf) unit1 = Unit(pirate_basetype) unit2 = Unit(pirate_basetype) loc1 = Cell(1, 1) loc2 = Cell(1, 2) bf.place(unit1, loc1) bf.place(unit2, loc2) hp_before = unit2.health unit1.give_active(attack_cell_active) target_cell = CellTargeting(loc2) unit1.activate(attack_cell_active, target_cell) assert unit2.health < hp_before
def test_attack_unit(pirate_basetype, no_chances): bf = Battlefield(3,3) game = DreamGame(bf) # monkeypatch.setattr(game, 'unit_died', lambda x: None) unit1 = Unit(pirate_basetype) unit2 = Unit(pirate_basetype) loc1 = Cell(1, 1) loc2 = Cell(1, 2) bf.place(unit1, loc1) bf.place(unit2, loc2) hp_before = unit2.health unit1.give_active(attack_unit_active) target_unit = SingleUnitTargeting(unit2) unit1.activate(attack_unit_active, target_unit) assert unit2.health < hp_before
def unit(self) -> Unit: return Unit(self.base_type_prelim)
def pirate_band(pirate_basetype): _pirate_band = [Unit(pirate_basetype) for i in range(3)] yield _pirate_band
def pirate(pirate_basetype): yield Unit(pirate_basetype)
def hero(demohero_basetype): yield Unit(demohero_basetype)