Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bumped minor version. bank options now available. fixed agent battle bug

  • Loading branch information...
commit 5cb0bbda51ca7b980ff3441506b7c2b432641e0b 1 parent e995e59
@jwoertink authored
View
5 README.rdoc
@@ -37,9 +37,10 @@ Options are normally numbers 1 through 5 or so.
* Current Location is updated before flying away
* All drugs are always available
-* No way to pay back loans in the bank
-* No way to pull money from savings
* Not tested on windows
+* Battles with DEA agents are skewed and you're most likely to lose :(
+* Need some text updates to help you figure out what choices to make
+* No way to exit game mid way
== Upgrades
View
4 bin/dopewars
@@ -3,10 +3,8 @@
require 'rubygems'
require 'bundler'
-$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
Bundler.require
-require 'highline/import'
-#Dir.glob(File.expand_path(File.join('lib', '*.rb'), File.dirname(__FILE__))).reverse.each { |f| require f }
+$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require 'application'
Application.run!
View
1  lib/application.rb
@@ -1,3 +1,4 @@
+require 'highline/import'
require 'utilities'
require 'game'
require 'player'
View
27 lib/game.rb
@@ -127,13 +127,23 @@ def bank_menu
menu_option = ask("Select your option:")
loop do
case menu_option
- when "1" #loan
+ when "1" # Take out a loan
amount = ask("How much?")
@player.wallet += amount.to_i
@player.bank_account.increase_loan(amount.to_i)
echo("You now have $#{@player.wallet}", :cyan)
break
- when "2" #savings
+ when "2" # Pay onto a loan
+ puts "Your current loan amount is #{@player.bank_account.loan_amount}"
+ amount = ask("How much would you like to pay?")
+ if amount.to_i > @player.wallet
+ echo("Sorry, you don't have that much money.", :red)
+ else
+ @player.wallet -= amount.to_i
+ @player.bank_account.decrease_loan(amount.to_i)
+ break
+ end
+ when "3" # Put money into savings
amount = ask("How much?")
if amount.to_i > @player.wallet
echo("Sorry, you don't have that much money.", :red)
@@ -142,11 +152,20 @@ def bank_menu
@player.bank_account.increase_savings(amount.to_i)
break
end
- when "3" #leave
+ when "4" # Take money from savings
+ amount = ask("How much?")
+ if amount.to_i > @player.wallet
+ echo("Sorry, you don't have that much money.", :red)
+ else
+ @player.wallet += amount.to_i
+ @player.bank_account.decrease_savings(amount.to_i)
+ break
+ end
+ when "5" #leave
echo("Goodbye.", :blue)
break
else
- menu_option = ask("Please select options 1,2, or 3:")
+ menu_option = ask("Please select an available option:")
end
end
end
View
2  lib/player.rb
@@ -1,4 +1,6 @@
class Player
+ include Utilities
+
attr_accessor :name, :drugs, :wallet, :days_remaining, :bank_account, :end_of_turn, :speed, :accuracy, :evasion, :endurance
def initialize(defaults = {})
View
17 lib/term.rb
@@ -1,4 +1,5 @@
-
+require 'rubygems'
+require 'termios'
# get the original settings and save a backup
term = Termios::getattr($stdin)
@@ -12,11 +13,17 @@
Termios.setattr($stdin, Termios::TCSANOW, term)
+threads = []
-while c = STDIN.getc
- puts "Read: #{c.inspect}"
+threads << Thread.new("root") do
+ while c = STDIN.getc
+ puts "Read: #{c.inspect}"
+ end
end
+threads << Thread.new("side") do
+ puts "doing stuff here?"
+end
+threads.map(&:join)
-
-Termios.setattr($stdin, Termios::TCSANOW, origin_term)
+Termios.setattr($stdin, Termios::TCSANOW, original_term)
Please sign in to comment.
Something went wrong with that request. Please try again.