diff --git a/lib/vimcity/atmogen.rb b/lib/vimcity/atmogen.rb new file mode 100644 index 0000000..d46eefe --- /dev/null +++ b/lib/vimcity/atmogen.rb @@ -0,0 +1,20 @@ +class AtmoGen < Building + + def initialize + @symbol = ['o|o', + '|o|'] + @height = 2 + @width = 3 + @cost = 1000 + @capacity = 0 + @workers_required = 30 + @description = "Produces oxygen" + @bonuses = "Permits to expand your city on the planet, can store 2000 Oxygen units" + end + + def add_to_city(city) + city.atmogen+=1 + super(city) + end + +end diff --git a/lib/vimcity/city.rb b/lib/vimcity/city.rb index adebacb..b245fbe 100644 --- a/lib/vimcity/city.rb +++ b/lib/vimcity/city.rb @@ -7,7 +7,7 @@ def initialize(coins=10000, population=0) @coins = coins @population = population @population_cap = 0 - @free_workers = 0 + @free_workers = population @money_per_second = 0 @people_per_second = 0 @oxygen = 1000 @@ -23,11 +23,11 @@ def update @free_workers+=@people_per_second/12.5*@happiness end - @oxygen -= @population + @oxygen -= @population/5 - @coins -= @atmogen*10/12.5 if @oxygen < @atmogen.round*2000 + @coins -= @atmogen*5/12.5 if @oxygen < @atmogen.round*2000 - @oxygen += @atmogen*30/12.5 if @oxygen < @atmogen * 2000 + @oxygen += @atmogen*100/12.5 if @oxygen < @atmogen * 2000 @oxygen=0 if @oxygen < 0 #@happiness-=0.001 diff --git a/lib/vimcity/farm_a.rb b/lib/vimcity/farm_a.rb index 7f26c71..4b80893 100644 --- a/lib/vimcity/farm_a.rb +++ b/lib/vimcity/farm_a.rb @@ -8,7 +8,7 @@ def initialize @width = 6 @cost = 1000 @capacity = 0 - @workers_required = 20 + @workers_required = 10 @description = "Produces purple grass, a desirable commodity" @bonuses = "Goods sell for 2c a worker, maximum of 20" end diff --git a/lib/vimcity/starport.rb b/lib/vimcity/starport.rb index 77c67eb..4f7ff2a 100644 --- a/lib/vimcity/starport.rb +++ b/lib/vimcity/starport.rb @@ -8,7 +8,7 @@ def initialize @width = 3 @cost = 2000 @capacity = 0 - @workers_required = 40 + @workers_required = 20 @description = "Allows for interstellar travel" @bonuses = "Boosts your city's population" end diff --git a/lib/vimcity/vim_city_game.rb b/lib/vimcity/vim_city_game.rb index 7aa4fd5..d95a64e 100644 --- a/lib/vimcity/vim_city_game.rb +++ b/lib/vimcity/vim_city_game.rb @@ -103,7 +103,7 @@ def display_menu def init_city #load city stuff here when we get to it - @city = City.new() + @city = City.new(5000, 100) house1 = Seitch.new() house1.add_to_city(@city) @@ -111,8 +111,25 @@ def init_city print_area_to_buffer(@main_buffer, 34, 24, house1.symbol) house2 = Seitch.new() house2.add_to_city(@city) - @map.add_building(house1,34, 24) + @map.add_building(house2,34, 24) print_area_to_buffer(@main_buffer, 35, 24, house2.symbol) + house3 = Seitch.new() + house3.add_to_city(@city) + @map.add_building(house3,34, 24) + print_area_to_buffer(@main_buffer, 34, 25, house3.symbol) + starport = Starport.new() + starport .add_to_city(@city) + @map.add_building(starport,30, 30) + print_area_to_buffer(@main_buffer, 30, 30, starport.symbol) + farm = FarmA.new() + farm .add_to_city(@city) + @map.add_building(farm ,37, 24) + print_area_to_buffer(@main_buffer, 37, 24, farm.symbol) + atmo = AtmoGen.new() + atmo .add_to_city(@city) + @map.add_building(atmo ,38, 26) + print_area_to_buffer(@main_buffer, 34, 30, atmo .symbol) + end def init_cursor @@ -127,8 +144,8 @@ def update_status_bar @status_buffer[1] = " "*@width print_to_buffer(@status_buffer, 1, 0, "Money: #{@city.coins.round}") print_to_buffer(@status_buffer, 1, 18, "Population: #{@city.population.round} / #{@city.population_cap}") - #print_to_buffer(@status_buffer, 1, 36, "Population Cap: #{@city.population_cap}") - print_to_buffer(@status_buffer, 1, 40, "Oxygen: #{@city.oxygen.round}") + print_to_buffer(@status_buffer, 1, 40, "Free Workers: #{@city.free_workers.round}") + print_to_buffer(@status_buffer, 1, 87, "Oxygen: #{@city.oxygen.round}") VIM::evaluate("genutils#MoveCursorToWindow(2)") end