Class: GamesAndRpgParadise::ShakesAndFidgets::Stadtwache
Overview
ShakesAndFidgets::Stadtwache
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
Constants included
from Colours
Colours::WHITE
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, convert_colour, #fancy, #normal, #pink, #red, #yel
Constructor Details
#initialize(i = nil, run_already = true) ⇒ Stadtwache
33
34
35
36
37
38
39
40
|
# File 'lib/games_and_rpg_paradise/games/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
109
110
111
|
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/stadtwache/stadtwache.rb', line 109
def count_down(i)
AsciiParadise::AsciiCounter.new(i, PADDING_TO_USE)
end
|
#display_title ⇒ Object
52
53
54
|
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/stadtwache/stadtwache.rb', line 52
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
#
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/stadtwache/stadtwache.rb', line 73
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
55
|
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/stadtwache/stadtwache.rb', line 55
def reset; end
|
#run ⇒ Object
96
97
98
99
100
101
102
103
104
|
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/stadtwache/stadtwache.rb', line 96
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
45
46
47
|
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/stadtwache/stadtwache.rb', line 45
def set_character(i)
@character = i
end
|
#show_when_to_end(i) ⇒ Object
60
61
62
63
64
65
66
67
68
|
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/stadtwache/stadtwache.rb', line 60
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
|