Class: GamesParadise::ShakesAndFidgets::Zauberladen
- Inherits:
-
Base
- Object
- Base
- GamesParadise::ShakesAndFidgets::Zauberladen
show all
- Defined in:
- lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb
Constant Summary
Constants inherited
from Base
Base::CONTROL_C_CODE, Base::N
Instance Method Summary
collapse
Methods inherited from Base
#cat, #commandline_arguments?, #efancy, #eparse, #first_argument?, #forestgreen, #gold, #lightblue, #lightgreen, #mediumorchid, #mediumslateblue, #opnn, #peru, #register_sigint, #rev, #royalblue, #set_commandline_arguments, #sfile, #steelblue, #teal, #tomato, #yellow
Methods included from BaseModule
#cliner, #commandline_arguments?, #first_argument?, #infer_the_namespace, #namespace?, #rename_file, #reset_the_internal_hash, #return_pwd, #set_commandline_arguments
Constructor Details
#initialize(char, run_already = true) ⇒ Zauberladen
#
initialize
You must supply the character.
#
25
26
27
28
29
30
31
|
# File 'lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb', line 25
def initialize(
char,
run_already = true
)
@character = char
run if run_already
end
|
Instance Method Details
#ask_user_what_to_do_next ⇒ Object
#
ask_user_what_to_do_next
#
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb', line 80
def ask_user_what_to_do_next
e 'Your current stats have these values:'
ee ' '
pp available_stats?
e 'Which stat do you want to raise? '
_ = available_stats?
array = []
the_keys = _.keys
the_keys.each_with_index {|this_stat, index|
index += 1
e ' - '+sfancy(index)+' '+simp(this_stat.capitalize)
array << this_stat
}
improve_this_attribute = $stdin.gets.chomp
if improve_this_attribute =~ /^\d+$/ improve_this_attribute = array[improve_this_attribute.to_i - 1]
end
e 'You want to improve on:'
e ' '+sfancy(improve_this_attribute.capitalize)
e improve_this_attribute+': '+_[improve_this_attribute].to_s
e 'You have n money:'
e char?.money?
n_times_improved_already = char?.attributes?[improve_this_attribute] -
char?.original_attributes?[improve_this_attribute]
cost = calculate_cost_for_n_increase_of_attribute(
n_times_improved_already
)
if cost > char?.n_money?
e 'You can not do this upgrade (Cost: '+simp(cost.to_s)+
') because you lack the necessary coins.'
else e 'This will cost you:'
e simp(cost)
e simp(char?.deduct_money(cost))
e 'You have n money:'
e simp(char?.money?)
char?.increase(improve_this_attribute, 1) end
end
|
#available_stats? ⇒ Boolean
73
74
75
|
# File 'lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb', line 73
def available_stats?
char?.available_stats?
end
|
#character? ⇒ Boolean
Also known as:
char?
42
43
44
|
# File 'lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb', line 42
def character?
@character
end
|
#enter_shop ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb', line 49
def enter_shop
e 'You enter the shop for magical items and glance at the various '\
'offered items.'
e 'TODO: 6 slots are available'
e
e 'You can also raise your stats.'
e
reset_the_inventory
ask_user_what_to_do_next
end
|
#reset ⇒ Object
36
37
|
# File 'lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb', line 36
def reset
end
|
#reset_the_inventory ⇒ Object
63
64
65
66
67
68
|
# File 'lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb', line 63
def reset_the_inventory
@inventory = []
end
|
#run ⇒ Object
123
124
125
|
# File 'lib/games_paradise/shakes_and_fidgets/zauberladen/zauberladen.rb', line 123
def run
enter_shop
end
|