SCENE 25 bank, SCENE,	"Savings",	0,	0
	THEME	0
	MUSIC	saving.mid
	ACTOR	1, "Bank Teller", misc,	1,	25,	90
	SELECT	1
	POSE	1
; we don't want more than one person in the scene at a time.
	COMPARE #<num.peopleInScene>, "1"
	IF>, @too_many_people
; if you already have an account at the bank
	IF T700, @use_bank
; if your account is frozen, then you cant use the bank
	IF T701, @cannot_use_bank
; this is the first time you come to the bank
	1: I see you're a newcomer here, you don't yet have an account with us.
	SET bankMoney, "0"
	1: Alright, you now have a bank account here.
	1: Should you visit the Loan Association and take out a loan, your account will be frozen.
	1: You cannot withdraw more money than you can hold, nor can you deposit more than you have.
	1: Also, you cannot hold more than 100000000 Gold in your account.
	GIVE T700
	GOTO @use_bank
END

@use_bank
	1: Your current balance is #<bankMoney>.
	1: Would you like to deposit, withdraw, or invest? Type "deposit", "withdraw", or "invest".
	ASK 9999
	IF Qdeposit, @deposit
	IF Qwithdraw, @withdraw
	IF Qinvest, @invest
	GOTO @use_bank
END

@invest
	GAME 7
END

@deposit
	1: How much would you like to deposit?
	ASK 9999
	SET depositMoney, #<lastAsk>
	COMPARE #<depositMoney>, #<num.hostGP>
	IF>, @too_much_money
	SET possibleDeposit, #<depositMoney>
	SET possibleBank, #<bankMoney>
	ADD possibleBank, #<possibleDeposit>
	COMPARE #<possibleBank>, "100000000"
	IF>, @too_much_money
	ADD bankMoney, #<depositMoney>
	TAKE G#<depositMoney>
	1: Your deposit of #<depositMoney>G has been completed.
	GOTO @use_bank
END


@too_much_money
	1: I'm sorry, but you cannot deposit that much.
	SUB possibleBank, "100000000"
	1: I'll give you the rest back.
	GIVE G#<possibleBank>
	GOTO @use_bank
END

@withdraw
	1: How much would you like to withdraw?
	ASK 9999
	SET withdrawMoney, #<lastAsk>
	GOTO @confirm_withdrawal
END

@confirm_withdrawal
	1: You would like to withdraw #<withdrawMoney>?
	ASK 9999
	IF NO, @withdraw


	COMPARE #<withdrawMoney>, #<bankMoney>
	IF>, @cannot_withdraw
	SET maximumGold, <num.hostLevel>
	MUL maximumGold, "10000"
	ADD maximumGold, "10000"
	SUB maximumGold, <num.hostGP>
	COMPARE #<withdrawMoney>, #<maximumGold>
	IF>, @cannot_withdraw
	GIVE G#<withdrawMoney>
	SUB bankMoney, #<withdrawMoney>
	1: Your withdrawal has been completed.
	GOTO @use_bank
END

@cannot_withdraw
	1: Sorry, you cannot withdraw that much money.
	1: Please enter another number.
	GOTO @withdraw
END

@too_many_people
	1: Sorry, there are too many of you for me to provide efficient service.
END

@cannot_use_bank
	1: Sorry, your account is currently frozen.
	1: Pay back your loan before you come back here.
END

;--------------------------------------------
SCENE	26	bank,	SCENE,	"Loans",	0,	0
	THEME	0
	MUSIC	loaning.mid
	ACTOR	1, "Loan Shark", misc, 1, 25, 90
; When they have a loan, they must pay it back
	IF T701, @pay_back_loan
; Otherwise, they can get a new loan.
	1: Well, hello there. Are you interested in recieving a loan?
	ASK 9999
	IF YES, @get_a_loan
	1: Alright then, come back another time.
END

@get_a_loan
	1: Excellent! Now, the way my new, super-cool system works is this:
	1: I give you a loan for however much gold you want.
	1: If you can't hold it all, that's not my problem.
	1: Then, I tack on an extra 5%% interest for you to pay back.
	1: You can pay back any time you want.
	1: And you can even pay it back in installments.
	1: But, while you have a loan out, you won't be able to use your bank account.
	1: Do you still want a loan?
	ASK 9999
	IF YES, @want_a_loan
	1: Alright. Come back another time, then.
END

@want_a_loan
	1: Wonderful! Now, how much money would you like a loan for?
	ASK 9999
	SET loanMoney, #<lastAsk>
	1: You want #<loanMoney>?
	ASK 9999
	IF NO, @want_a_loan
	1: Alright!
	GIVE G#<loanMoney>
	GIVE T701
	SET loanedMoney, #<loanMoney>
	SET startLoan, #<num.hostAge>
	SET tempBank, #<bankMoney>
	SET bankMoney, "0"
	1: Don't spend it all in one place!
END

@pay_back_loan
	SET loanRepay, #<num.hostAge>
	SUB loanRepay, #<startLoan>
	MUL loanRepay, 1.6
	SET startLoan, #<loanRepay>
	ADD loanedMoney, #<loanRepay>
	1: You have a loan to repay me, I see.
	1: You owe me #<loanedMoney>.
	1: To pay me back, simply select your gold, and give it to me.
END

@eventActorGive1
	COMPARE #<item.goldGiven>, #<loanedMoney>
	IF>, @too_much_paid
	IF=, @paid_off_loan
	SUB loanedMoney, #<item.goldGiven>
	1: You now owe me #<loanedMoney>.
	1: You may pay it back any time.
END

@too_much_paid
	1: You gave me too much!
	1: I'll give you the extra gold back.
	SET loanedMoney, #<item.goldGiven>
	SUB loanedMoney, #<loanMoney>
	GIVE G#<loanedMoney>
	GOTO @paid_off_loan
END

@paid_off_loan
	1: Alright, you've paid back your loan!
	TAKE T701
	SET bankMoney, #<tempBank>
	1: Your bank account is now unfrozen!
END


	