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)
|
tile.should be_a(Game::BuildingTile)
|
||||||
end
|
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
|
world = Game::World.new create_map_2x2
|
||||||
point = Game::Point.new 1, 0
|
point = Game::Point.new 1, 0
|
||||||
building = Game::Building.new Game::Building::Type::StartPoint, **{
|
building = Game::Building.new Game::Building::Type::StartPoint, **{
|
||||||
@ -24,8 +24,7 @@ describe Game::Command do
|
|||||||
ts: 10,
|
ts: 10,
|
||||||
cost: Game::Resources.new({
|
cost: Game::Resources.new({
|
||||||
Game::Resources::Type::Crystals => 100,
|
Game::Resources::Type::Crystals => 100,
|
||||||
}),
|
})
|
||||||
requirements: [] of Game::Building::Type
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
command = Game::BuildCommand.new point, building
|
command = Game::BuildCommand.new point, building
|
||||||
|
@ -9,17 +9,19 @@ module Game
|
|||||||
end
|
end
|
||||||
|
|
||||||
class Mining
|
class Mining
|
||||||
def initialize(@ts : TimeSpan, @input : Resources, @res : Resources::Type, @cap : Capacity)
|
def initialize(@ts : TimeSpan, @dep : DepositSpan)
|
||||||
end
|
end
|
||||||
|
|
||||||
getter ts
|
getter ts
|
||||||
getter input
|
getter dep
|
||||||
getter res
|
|
||||||
getter cap
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Construction
|
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
|
end
|
||||||
|
|
||||||
getter ts
|
getter ts
|
||||||
@ -27,11 +29,11 @@ module Game
|
|||||||
getter requirements
|
getter requirements
|
||||||
|
|
||||||
def self.immediatly
|
def self.immediatly
|
||||||
Construction.new 0, Resources.new, [] of Building::Type
|
Construction.new 0, Resources.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.free(ts : TimeSpan)
|
def self.free(ts : TimeSpan)
|
||||||
Construction.new ts, Resources.new, [] of Building::Type
|
Construction.new ts, Resources.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user