Add build command

This commit is contained in:
Anton Vakhrushev
2019-10-11 18:36:36 +03:00
parent 94caa93d7c
commit dacecf2aa8
4 changed files with 37 additions and 6 deletions

View File

@ -15,4 +15,22 @@ describe Game::Command do
tile = world.map.get point
tile.should be_a(Game::BuildingTile)
end
it "should restrict build if not enought resources" do
world = Game::World.new create_map_2x2
point = Game::Point.new 1, 0
building = Game::Building.new Game::Building::Type::StartPoint, "Dummy", **{
construction: Game::Construction.new(
ts: 10,
cost: Game::Resources.new({
Game::Resources::Type::Crystals => 100,
}),
requirements: [] of Game::Building::Type
),
}
command = Game::BuildCommand.new point, building
expect_raises(Game::NotEnoughtResources) do
world.push(command)
end
end
end