Add smelter
This commit is contained in:
parent
7802836fe7
commit
5a0cc4cb10
16
src/app.cr
16
src/app.cr
@ -88,10 +88,12 @@ class App
|
|||||||
|
|
||||||
def render_building_letter(building_type : Game::Building::Type)
|
def render_building_letter(building_type : Game::Building::Type)
|
||||||
case building_type
|
case building_type
|
||||||
when Game::Building::Type::StartPoint then 'S'.colorize(:yellow)
|
when Game::Building::Type::StartPoint then 'S'.colorize(:yellow).underline
|
||||||
when Game::Building::Type::CrystalMiner then 'M'.colorize(:yellow)
|
when Game::Building::Type::CrystalMiner then 'M'.colorize(:yellow)
|
||||||
when Game::Building::Type::CrystalRestorer then 'R'.colorize(:yellow)
|
when Game::Building::Type::CrystalRestorer then 'R'.colorize(:green)
|
||||||
when Game::Building::Type::Terraformer then 'T'.colorize(:yellow)
|
when Game::Building::Type::OxygenCollector then 'O'.colorize(:yellow)
|
||||||
|
when Game::Building::Type::Smelter then 'E'.colorize(:magenta)
|
||||||
|
when Game::Building::Type::Terraformer then 'T'.colorize(:cyan)
|
||||||
else
|
else
|
||||||
' '
|
' '
|
||||||
end
|
end
|
||||||
@ -131,10 +133,10 @@ class App
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_resources(world)
|
def render_resources(world)
|
||||||
printf "Resources:\n Crystals: %5d\n Oxygen: %5d\n Terraformation: %5d\n",
|
printf "Resources:\n"
|
||||||
world.resources[Game::Resource::Type::Crystals],
|
Game::Resource::Type.each do |t|
|
||||||
world.resources[Game::Resource::Type::Oxygen],
|
printf " %-15s %5d\n", t.to_s + ':', world.resources[t]
|
||||||
world.resources[Game::Resource::Type::Terraformation]
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_world(world)
|
def render_world(world)
|
||||||
|
@ -49,6 +49,7 @@ module Game
|
|||||||
CrystalMiner
|
CrystalMiner
|
||||||
CrystalRestorer
|
CrystalRestorer
|
||||||
OxygenCollector
|
OxygenCollector
|
||||||
|
Smelter
|
||||||
Terraformer
|
Terraformer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,11 +62,32 @@ module Game
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add(
|
||||||
|
Building.new Building::Type::Smelter, **{
|
||||||
|
shortcut: "iron",
|
||||||
|
construction: Construction.new(
|
||||||
|
ts: 120,
|
||||||
|
cost: ResourceBag.new({Resource::Type::Crystals => 300}),
|
||||||
|
requirements: [] of Game::Building::Type
|
||||||
|
),
|
||||||
|
production: Production.new(
|
||||||
|
ts: 60,
|
||||||
|
input: ResourceBag.new({
|
||||||
|
Resource::Type::Crystals => 20,
|
||||||
|
Resource::Type::Oxygen => 10,
|
||||||
|
}),
|
||||||
|
output: ResourceBag.new({
|
||||||
|
Resource::Type::Iron => 10,
|
||||||
|
})
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
add(
|
add(
|
||||||
Building.new Building::Type::Terraformer, **{
|
Building.new Building::Type::Terraformer, **{
|
||||||
shortcut: "terr",
|
shortcut: "terr",
|
||||||
construction: Construction.new(
|
construction: Construction.new(
|
||||||
ts: 120,
|
ts: 180,
|
||||||
cost: ResourceBag.new({
|
cost: ResourceBag.new({
|
||||||
Resource::Type::Crystals => 300,
|
Resource::Type::Crystals => 300,
|
||||||
}),
|
}),
|
||||||
@ -77,6 +98,7 @@ module Game
|
|||||||
input: ResourceBag.new({
|
input: ResourceBag.new({
|
||||||
Resource::Type::Crystals => 50,
|
Resource::Type::Crystals => 50,
|
||||||
Resource::Type::Oxygen => 20,
|
Resource::Type::Oxygen => 20,
|
||||||
|
Resource::Type::Iron => 5,
|
||||||
}),
|
}),
|
||||||
output: ResourceBag.new({
|
output: ResourceBag.new({
|
||||||
Resource::Type::Terraformation => 5,
|
Resource::Type::Terraformation => 5,
|
||||||
|
@ -4,6 +4,7 @@ struct Game::Resource
|
|||||||
enum Type
|
enum Type
|
||||||
Crystals
|
Crystals
|
||||||
Oxygen
|
Oxygen
|
||||||
|
Iron
|
||||||
Terraformation
|
Terraformation
|
||||||
|
|
||||||
def to_res(amount : Capacity)
|
def to_res(amount : Capacity)
|
||||||
|
Loading…
Reference in New Issue
Block a user