Class: GamesAndRpgParadise::Godmode::Gladiator
- Defined in:
- lib/games_and_rpg_paradise/games/godmode/gladiator.rb
Overview
GamesAndRpgParadise::Godmode::Gladiator
Constant Summary
Constants included from Base::Extensions::Colours
Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS
Constants included from CommonExtensions
CommonExtensions::CONTROL_C_CODE, CommonExtensions::N
Instance Attribute Summary collapse
-
#base_cost ⇒ Object
readonly
Returns the value of attribute base_cost.
-
#gladiator_name ⇒ Object
Returns the value of attribute gladiator_name.
-
#hash_attributes ⇒ Object
readonly
Returns the value of attribute hash_attributes.
-
#hash_skills ⇒ Object
readonly
Returns the value of attribute hash_skills.
Class Method Summary collapse
-
.[](i = '') ⇒ Object
# === GamesAndRpgParadise::Godmode::Gladiator[] ========================================================================= #.
Instance Method Summary collapse
-
#all_names ⇒ Object
# === all_names ========================================================================= #.
-
#initialize(gladiator_name = 'Gladric', is_main_gladiator = true, run_already = true) ⇒ Gladiator
constructor
# === initialize.
-
#output_gladiator_name ⇒ Object
# === output_gladiator_name ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#sanitize_data ⇒ Object
# === sanitize_data.
-
#set_name(i) ⇒ Object
# === set_name ========================================================================= #.
Methods included from Base::Extensions::Colours
ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow
Methods included from Base::Extensions::CommandlineArguments
#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments
Methods included from CommonExtensions
#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into
Constructor Details
#initialize(gladiator_name = 'Gladric', is_main_gladiator = true, run_already = true) ⇒ Gladiator
#
initialize
If the second argument, called is_main_gladiator is true, then we have a main gladiator. A merchant may have 1-5 main gladiators and 3-12 workers.
To raise speed from 8 to 9, you must pay 9 training points.
To raise a skill you must invest 2 training points. So you see its much easier to improve skills than attributes. Max attribute is 35 for humans, max skill is 100 although they MAY reach even higher skill.
You get training points either by training, or by doing cool tasks.
#
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 43 def initialize( gladiator_name = 'Gladric', is_main_gladiator = true, run_already = true ) reset set_name(gladiator_name) @is_main_gladiator = is_main_gladiator # der erste is der main gladiator run if run_already end |
Instance Attribute Details
#base_cost ⇒ Object (readonly)
Returns the value of attribute base_cost.
23 24 25 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 23 def base_cost @base_cost end |
#gladiator_name ⇒ Object
Returns the value of attribute gladiator_name.
22 23 24 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 22 def gladiator_name @gladiator_name end |
#hash_attributes ⇒ Object (readonly)
Returns the value of attribute hash_attributes.
24 25 26 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 24 def hash_attributes @hash_attributes end |
#hash_skills ⇒ Object (readonly)
Returns the value of attribute hash_skills.
25 26 27 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 25 def hash_skills @hash_skills end |
Class Method Details
.[](i = '') ⇒ Object
#
GamesAndRpgParadise::Godmode::Gladiator[]
#
153 154 155 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 153 def self.[](i = '') new(i) end |
Instance Method Details
#all_names ⇒ Object
#
all_names
#
117 118 119 120 121 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 117 def all_names @all_names = NameGenerator.new @all_names.sanitize_name_group('west') return @all_names end |
#output_gladiator_name ⇒ Object
#
output_gladiator_name
#
126 127 128 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 126 def output_gladiator_name e 'The name of the Gladiator is: '+@name end |
#reset ⇒ Object
#
reset (reset tag)
#
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 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 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 57 def reset super() infer_the_namespace # ======================================================================= # # === @hash_attributes # ======================================================================= # @hash_attributes = { str: 10+rand(2), dex: 12+rand(2), con: 14+rand(2), speed: 8+rand(2) } # ======================================================================= # # === @hash_attributes_sum # ======================================================================= # @hash_attributes_sum = 0 @hash_attributes.each_pair { | key, value | @hash_attributes_sum += value } @training_points_left = 0 # This percentage tells us how effectively # a gladiator may fight. # If he has 100 % wounded, he is dead. # From 80-100% wounded he cant fight. Else # the percentage affects how efficiently you # can fight. Also, since this effects every # other stat, it can become PERMANENT # if he loses an arm for example. @percentage_wounded = 0 @percentage_wounded_min_value = 0 # ======================================================================= # # === @base_cost # ======================================================================= # @base_cost = 1_000 # in gold coins # ======================================================================= # # === @hash_skills # # puts "DEBUG Summe seiner skills: #{@hash_attributes_sum}" # Skill 100 means perfect skill. 50 is average but trained # 80 means very good. # ======================================================================= # @hash_skills = { sword: 65+rand(16), axe: 65+rand(16), polearm: 65+rand(16), awareness: 20+rand(20), } end |
#run ⇒ Object
#
run (run tag)
#
145 146 147 148 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 145 def run sanitize_data output_gladiator_name end |
#sanitize_data ⇒ Object
#
sanitize_data
ensure that data is correct here. If min value is lower than wounded value, we set it to new value.
#
136 137 138 139 140 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 136 def sanitize_data if @percentage_wounded < @percentage_wounded_min_value @percentage_wounded = @percentage_wounded_min_value end end |
#set_name(i) ⇒ Object
#
set_name
#
109 110 111 112 |
# File 'lib/games_and_rpg_paradise/games/godmode/gladiator.rb', line 109 def set_name(i) @name = i @name = all_names.generate_name_string # hardcore overrule for now. end |