Use deposit span in building configuration
This commit is contained in:
parent
a13969ce43
commit
454ecc60f6
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user