Class: GamesAndRpgParadise::Sarlem::Tai::RandomNpc
- Inherits:
-
Object
- Object
- GamesAndRpgParadise::Sarlem::Tai::RandomNpc
- Defined in:
- lib/games_and_rpg_paradise/sarlem/the_eastern_realm/tai/tai_random_npc.rb
Class Method Summary collapse
-
.generate(_ = rand(100)) ⇒ Object
# === GamesAndRpgParadise::Sarlem::Tai::RandomNpc.generate ========================================================================= #.
-
.generate_string_for_a_random_NPC(_ = rand(100)) ⇒ Object
# === GamesAndRpgParadise::Sarlem::Tai::RandomNpc.generate_string_for_a_random_NPC ========================================================================= #.
-
.return_random_age(max = 100) ⇒ Object
# === GamesAndRpgParadise::Sarlem::Tai::RandomNpc.return_random_age.
Class Method Details
.generate(_ = rand(100)) ⇒ Object
#
GamesAndRpgParadise::Sarlem::Tai::RandomNpc.generate
#
36 37 38 39 40 |
# File 'lib/games_and_rpg_paradise/sarlem/the_eastern_realm/tai/tai_random_npc.rb', line 36 def self.generate( _ = rand(100) ) puts GamesAndRpgParadise::Sarlem::Tai::RandomNpc.generate_string_for_a_random_NPC(_) end |
.generate_string_for_a_random_NPC(_ = rand(100)) ⇒ Object
#
GamesAndRpgParadise::Sarlem::Tai::RandomNpc.generate_string_for_a_random_NPC
#
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/games_and_rpg_paradise/sarlem/the_eastern_realm/tai/tai_random_npc.rb', line 45 def self.generate_string_for_a_random_NPC( _ = rand(100) ) if _.is_a? Symbol case _ when :random _ = rand(100) end end result = ''.dup case _ when 0..50 gender = :male result << GamesAndRpgParadise::Sarlem::Tai.random_male_tai_name+' '+ GamesAndRpgParadise::Sarlem::Tai.random_tai_surname+', ' else gender = :female result << GamesAndRpgParadise::Sarlem::Tai.random_female_tai_name+' '+ GamesAndRpgParadise::Sarlem::Tai.random_tai_surname+', ' end # ======================================================================= # # Height: # # 148+2W20 (150-188). Weiblich -4 (148-184) # # ======================================================================= # height = 148 # Base height. height += (rand(36)+1) # This means +36 effectively. height +=4 if gender == :male result << GamesAndRpgParadise::Sarlem::Tai::RandomNpc.return_random_age.to_s+ ' years old, '+gender.to_s+', height: <b>'+height.to_s+' cm</b>.' return result end |
.return_random_age(max = 100) ⇒ Object
#
GamesAndRpgParadise::Sarlem::Tai::RandomNpc.return_random_age
Returns age between 15-104. Alternatively we could also use something such as “2x20+2W4+12”, for a different range.
#
27 28 29 30 31 |
# File 'lib/games_and_rpg_paradise/sarlem/the_eastern_realm/tai/tai_random_npc.rb', line 27 def self.return_random_age( max = 100 ) return ( 15 + rand(max) ).to_i end |