Class: GamesParadise::ShakesAndFidgets::Stadtwache
Overview
Constant Summary
collapse
- DEFAULT_HOURS =
10
ARMOURS, AVAILABLE_ATTRIBUTES, BASE_DIR, BASE_STATS_FOR_THE_CLASSES, ENCODING_ISO, FILE_XP_LEVELS, FORMEL_VERTEIDIGUNG, INVERTED_XP_LEVELS, KRITISCHE_TREFFER, LEBEN, MAIN_EDITOR, N, NAMESPACE, ONE_GOLD, PADDING_TO_USE, PROJECT_BASE_DIR, PROJECT_BASE_DIRECTORY, PROJECT_YAML_DIR, PROMPT, R, SAVED_CHARACTERS, SCHADEN, STORE_WHERE, WIDERSTAND, XP_LEVELS, XP_LEVELS_AS_ARRAY, YAML_DIR
Instance Method Summary
collapse
Methods included from Shared
#calculate_cost_for_n_increase_of_attribute, #fetch_user_input, #load_yaml, #report_name, #save_character, #user_input
ensure_that_the_saved_characters_directory_exists, #is_an_attribute?, project_base_dir?, #show_directory_content
Methods included from Colours
#brown, #cfile, #convert_colour, #fancy, #normal, #pink, #red, #yel
Constructor Details
#initialize(i = nil, run_already = true) ⇒ Stadtwache
33
34
35
36
37
38
39
|
# File 'lib/games_paradise/shakes_and_fidgets/stadtwache/stadtwache.rb', line 33
def initialize(
i = nil, run_already = true
)
reset
set_character(i)
run if run_already
end
|
Instance Method Details
#count_down(i) ⇒ Object
108
109
110
|
# File 'lib/games_paradise/shakes_and_fidgets/stadtwache/stadtwache.rb', line 108
def count_down(i)
AsciiParadise::AsciiCounter.new(i, PADDING_TO_USE)
end
|
#display_title ⇒ Object
51
52
53
|
# File 'lib/games_paradise/shakes_and_fidgets/stadtwache/stadtwache.rb', line 51
def display_title
e sfancy('=== Work')
end
|
#find_out_how_long_the_character_wants_to_work_now ⇒ Object
#
find_out_how_long_the_character_wants_to_work_now
#
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/games_paradise/shakes_and_fidgets/stadtwache/stadtwache.rb', line 72
def find_out_how_long_the_character_wants_to_work_now
fetch_user_input('') n_hours = @user_input
n_hours = n_hours.first if n_hours.is_a? Array
n_hours = DEFAULT_HOURS if n_hours.empty?
n_hours = n_hours.to_i
n_hours = DEFAULT_HOURS if n_hours > DEFAULT_HOURS
if n_hours > 0
e 'You will work for '+sfancy(n_hours.to_s)+' hours.'+
show_when_to_end(n_hours)
count_down(n_hours * 3600)
n_silver_coins = n_hours * 10
e 'You earned '+n_silver_coins.to_s+' Silver coins.'
@character.add_money(n_silver_coins)
else
e 'You do not want to work? Then you should'
e 'try to find another activity.'
end
end
|
#reset ⇒ Object
54
|
# File 'lib/games_paradise/shakes_and_fidgets/stadtwache/stadtwache.rb', line 54
def reset; end
|
#run ⇒ Object
95
96
97
98
99
100
101
102
103
|
# File 'lib/games_paradise/shakes_and_fidgets/stadtwache/stadtwache.rb', line 95
def run display_title
e 'He who knows work and searches for it without fear, is crazy.'
e
e 'Input now for how many hours you wish to work '+
'(maximum: 10 hours, 10 Silver coins per'
e 'hour yield; hitting enter defaults to '+sfancy('10')+').'
find_out_how_long_the_character_wants_to_work_now
end
|
#set_character(i) ⇒ Object
44
45
46
|
# File 'lib/games_paradise/shakes_and_fidgets/stadtwache/stadtwache.rb', line 44
def set_character(i)
@character = i
end
|
#show_when_to_end(i) ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'lib/games_paradise/shakes_and_fidgets/stadtwache/stadtwache.rb', line 59
def show_when_to_end(i)
future_time = Time.now + (i.to_i * 60 * 60)
result = ' (We will end at time '+sfancy(
future_time.hour.to_s+':'+
future_time.min.to_s+':'+
future_time.sec.to_s)+
')'
return result
end
|