Add forester command
This commit is contained in:
parent
60d5b60153
commit
09ec46dd82
@ -37,6 +37,18 @@ class BuildMillCommand < Command
|
||||
end
|
||||
end
|
||||
|
||||
class BuildForesterHouseCommand < Command
|
||||
def supports?(world : World) : Bool
|
||||
return true
|
||||
end
|
||||
|
||||
def run(world : World)
|
||||
puts "build forester house"
|
||||
c = GrowWoodCommand.new(@ts + 10)
|
||||
world.push(c)
|
||||
end
|
||||
end
|
||||
|
||||
class GetWoodCommand < Command
|
||||
def supports?(world : World) : Bool
|
||||
return true
|
||||
@ -51,6 +63,19 @@ class GetWoodCommand < Command
|
||||
end
|
||||
end
|
||||
|
||||
class GrowWoodCommand < Command
|
||||
def supports?(world : World) : Bool
|
||||
return true
|
||||
end
|
||||
|
||||
def run(world : World)
|
||||
res = world.resources
|
||||
puts "grow wood"
|
||||
c = GetWoodCommand.new(@ts + 5)
|
||||
world.push(c)
|
||||
end
|
||||
end
|
||||
|
||||
abstract class Tile
|
||||
abstract def letter : Char
|
||||
end
|
||||
@ -159,5 +184,6 @@ end
|
||||
|
||||
w = World.new
|
||||
w.map.print
|
||||
w.push(BuildMillCommand.new(2))
|
||||
w.run(10)
|
||||
w.push(BuildMillCommand.new(0))
|
||||
w.push(BuildForesterHouseCommand.new(0))
|
||||
w.run(100)
|
||||
|
Loading…
Reference in New Issue
Block a user