Class: Radventure::Player
- Inherits:
-
Object
- Object
- Radventure::Player
- Defined in:
- lib/radventure/player.rb
Overview
Represents the ingame player
Instance Attribute Summary collapse
-
#age ⇒ Object
readonly
Returns the value of attribute age.
-
#class ⇒ Object
readonly
Returns the value of attribute class.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#gender ⇒ Object
readonly
Returns the value of attribute gender.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#nickname ⇒ Object
readonly
Returns the value of attribute nickname.
-
#race ⇒ Object
readonly
Returns the value of attribute race.
Instance Method Summary collapse
-
#full_name ⇒ String
Returns the full name of the player character.
-
#greeting_card ⇒ String
Returns a full (albeit short) description of the player character.
-
#initialize(level) ⇒ Player
constructor
Constructor method.
Constructor Details
#initialize(level) ⇒ Player
Constructor method
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/radventure/player.rb', line 15 def initialize(level) start_creation @first_name = create_first_name @last_name = create_last_name @nickname = create_nickname @age = create_age @gender = create_gender @race = create_race @class = create_class @level = level.to_i end_creation end |
Instance Attribute Details
#age ⇒ Object (readonly)
Returns the value of attribute age.
9 10 11 |
# File 'lib/radventure/player.rb', line 9 def age @age end |
#class ⇒ Object (readonly)
Returns the value of attribute class.
9 10 11 |
# File 'lib/radventure/player.rb', line 9 def class @class end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
9 10 11 |
# File 'lib/radventure/player.rb', line 9 def first_name @first_name end |
#gender ⇒ Object (readonly)
Returns the value of attribute gender.
9 10 11 |
# File 'lib/radventure/player.rb', line 9 def gender @gender end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
9 10 11 |
# File 'lib/radventure/player.rb', line 9 def last_name @last_name end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
9 10 11 |
# File 'lib/radventure/player.rb', line 9 def level @level end |
#nickname ⇒ Object (readonly)
Returns the value of attribute nickname.
9 10 11 |
# File 'lib/radventure/player.rb', line 9 def nickname @nickname end |
#race ⇒ Object (readonly)
Returns the value of attribute race.
9 10 11 |
# File 'lib/radventure/player.rb', line 9 def race @race end |
Instance Method Details
#full_name ⇒ String
Returns the full name of the player character
31 32 33 34 35 36 |
# File 'lib/radventure/player.rb', line 31 def full_name r = @first_name r += " (#{@nickname})" unless @nickname.empty? r += " #{@last_name}" unless @last_name.empty? r end |
#greeting_card ⇒ String
Returns a full (albeit short) description of the player character
41 42 43 |
# File 'lib/radventure/player.rb', line 41 def greeting_card "#{full_name}, #{age}yo #{gender} #{race}, #{@class} #{level}" end |