Module: GamesAndRpgParadise::Mud::Humanoid
Overview
RpgParadise::Mud::Humanoid
Constant Summary
Constants included from Skills
Skills::SKILL_LIST, Skills::SKILL_LIST_YAML_FILE
Constants included from Adverbs
Adverbs::ADVERBS_ABBREVIATED, Adverbs::ARRAY_ADVERBS
Constants included from Living
Instance Method Summary collapse
-
#determine_weight_based_on_height ⇒ Object
# === determine_weight_based_on_height.
-
#initialize ⇒ Object
# === initialize =========================================================================== #.
-
#obtain_random_height ⇒ Object
# === obtain_random_height =========================================================================== #.
-
#report_height ⇒ Object
# === report_height =========================================================================== #.
-
#report_weight ⇒ Object
# === report_weight =========================================================================== #.
-
#reset ⇒ Object
# === reset =========================================================================== #.
-
#run ⇒ Object
# === run =========================================================================== #.
-
#skills? ⇒ Boolean
# === skills? =========================================================================== #.
Methods included from Talk
#can_speak?, included, #say, #set_how
Methods included from Adverbs
all?, file?, find_adverb_for, keys, n_adverbs?, original_adverbs
Methods included from Living
#can_breathe?, #can_talk?, #do_die, #do_resurrect, #is_alive?, #is_dead?, #is_poisoned?, #my_race?, #race?, #report_race, #return_default_hp, #return_race, #set_stats_packages
Methods included from Hitpoints
#deduct_hp, #hp?, #max_hp?, #modify_health, #sync_hp
Methods included from Gender
#female?, #gender?, #has_gender?, #male?, #neuter?, #set_female, #set_male, #set_neuter, #subjective_case?
Instance Method Details
#determine_weight_based_on_height ⇒ Object
#
determine_weight_based_on_height
This method will define the weight of our humanoid object.
The weight will depend on the height.
We will use BMI to calculate the weight. The problem is that people with a lot of muscles are somewhat heavy as well, so we need to find a good measurement to get their weight.
Otherwise, they would be considered as “fat”. Thus, we need a way to assess how muscled ANYONE is, and i.e. how heavy his bones are.
For now, TESTING stuff, we will assume that weight is:
(height? - 120.0) + rand(30))
#
110 111 112 113 |
# File 'lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb', line 110 def determine_weight_based_on_height new_weight = (height? - 120.0) + rand(30) set_weight(new_weight) end |
#initialize ⇒ Object
#
initialize
#
35 36 37 38 39 |
# File 'lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb', line 35 def initialize reset enable_talk run end |
#obtain_random_height ⇒ Object
#
obtain_random_height
#
64 65 66 |
# File 'lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb', line 64 def obtain_random_height set_height 160+rand(40) end |
#report_height ⇒ Object
#
report_height
#
71 72 73 |
# File 'lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb', line 71 def report_height e "Your height is #{height?} cm." end |
#report_weight ⇒ Object
#
report_weight
#
78 79 80 |
# File 'lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb', line 78 def report_weight e "Your weight is #{weight?} kg." end |
#reset ⇒ Object
#
reset
#
44 45 46 47 48 |
# File 'lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb', line 44 def reset super if defined? super @hp = DEFAULT_HP_FOR_HUMANS # Default for a human being. sync_hp end |
#run ⇒ Object
#
run
#
85 86 87 88 |
# File 'lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb', line 85 def run obtain_random_height determine_weight_based_on_height end |
#skills? ⇒ Boolean
#
skills?
#
53 54 55 56 57 58 59 |
# File 'lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb', line 53 def skills? if has_skilllist? SKILLS else false end end |