diff --git a/spec/command_spec.cr b/spec/command_spec.cr index 82b2004..5937af4 100644 --- a/spec/command_spec.cr +++ b/spec/command_spec.cr @@ -16,7 +16,7 @@ describe Game::Command do tile.should be_a(Game::BuildingTile) end - it "should restrict build if not enought resources" do + it "should restrict building 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, **{ @@ -24,8 +24,7 @@ describe Game::Command do ts: 10, cost: Game::Resources.new({ Game::Resources::Type::Crystals => 100, - }), - requirements: [] of Game::Building::Type + }) ), } command = Game::BuildCommand.new point, building diff --git a/src/game/building.cr b/src/game/building.cr index 7d8fb10..75dd3a0 100644 --- a/src/game/building.cr +++ b/src/game/building.cr @@ -9,17 +9,19 @@ module Game end class Mining - def initialize(@ts : TimeSpan, @input : Resources, @res : Resources::Type, @cap : Capacity) + def initialize(@ts : TimeSpan, @dep : DepositSpan) end getter ts - getter input - getter res - getter cap + getter dep end class Construction - def initialize(@ts : TimeSpan, @cost : Resources, @requirements : Array(Building::Type)) + def initialize( + @ts : TimeSpan, + @cost : Resources, + @requirements : Array(Building::Type) = [] of Building::Type + ) end getter ts @@ -27,11 +29,11 @@ module Game getter requirements def self.immediatly - Construction.new 0, Resources.new, [] of Building::Type + Construction.new 0, Resources.new end def self.free(ts : TimeSpan) - Construction.new ts, Resources.new, [] of Building::Type + Construction.new ts, Resources.new end end