Module: GamesAndRpgParadise::Mud::Humanoid

Includes:
Living, Skills, Talk
Defined in:
lib/games_and_rpg_paradise/mud/humanoid/humanoid.rb

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

Living::DEFAULT_HP_FOR_HUMANS

Instance Method Summary collapse

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_heightObject

#

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

#initializeObject

#

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_heightObject

#

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_heightObject

#

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_weightObject

#

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

#resetObject

#

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

#runObject

#

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?

#

Returns:

  • (Boolean)


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