Class: Core::Game::Character
Instance Attribute Summary collapse
-
#age ⇒ Object
readonly
Returns the value of attribute age.
-
#agility ⇒ Object
readonly
Returns the value of attribute agility.
-
#charset ⇒ Object
readonly
Returns the value of attribute charset.
-
#const ⇒ Object
readonly
Returns the value of attribute const.
-
#endurance ⇒ Object
readonly
Returns the value of attribute endurance.
-
#equipment ⇒ Object
readonly
Returns the value of attribute equipment.
-
#gender ⇒ Object
readonly
Returns the value of attribute gender.
-
#health ⇒ Object
Returns the value of attribute health.
-
#influences ⇒ Object
readonly
Returns the value of attribute influences.
-
#inventory ⇒ Object
readonly
Returns the value of attribute inventory.
-
#magic ⇒ Object
readonly
Returns the value of attribute magic.
-
#mind ⇒ Object
readonly
Returns the value of attribute mind.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#race ⇒ Object
readonly
Returns the value of attribute race.
-
#skills ⇒ Object
readonly
Returns the value of attribute skills.
-
#spells ⇒ Object
readonly
Returns the value of attribute spells.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#strength ⇒ Object
readonly
Returns the value of attribute strength.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #calc_status ⇒ Object
- #consume(item) ⇒ Object
- #rest(amount) ⇒ Object
-
#setup ⇒ Object
health is only used as a percentage for easier displaying, the real stuff is in @const.
- #update ⇒ Object
- #validate ⇒ Object
- #wake ⇒ Object
- #weaken(amount) ⇒ Object
Instance Attribute Details
#age ⇒ Object (readonly)
Returns the value of attribute age.
18 19 20 |
# File 'lib/game/character.rb', line 18 def age @age end |
#agility ⇒ Object (readonly)
Returns the value of attribute agility.
20 21 22 |
# File 'lib/game/character.rb', line 20 def agility @agility end |
#charset ⇒ Object (readonly)
Returns the value of attribute charset.
18 19 20 |
# File 'lib/game/character.rb', line 18 def charset @charset end |
#const ⇒ Object (readonly)
Returns the value of attribute const.
19 20 21 |
# File 'lib/game/character.rb', line 19 def const @const end |
#endurance ⇒ Object (readonly)
Returns the value of attribute endurance.
20 21 22 |
# File 'lib/game/character.rb', line 20 def endurance @endurance end |
#equipment ⇒ Object (readonly)
Returns the value of attribute equipment.
19 20 21 |
# File 'lib/game/character.rb', line 19 def equipment @equipment end |
#gender ⇒ Object (readonly)
Returns the value of attribute gender.
18 19 20 |
# File 'lib/game/character.rb', line 18 def gender @gender end |
#health ⇒ Object
Returns the value of attribute health.
21 22 23 |
# File 'lib/game/character.rb', line 21 def health @health end |
#influences ⇒ Object (readonly)
Returns the value of attribute influences.
20 21 22 |
# File 'lib/game/character.rb', line 20 def influences @influences end |
#inventory ⇒ Object (readonly)
Returns the value of attribute inventory.
19 20 21 |
# File 'lib/game/character.rb', line 19 def inventory @inventory end |
#magic ⇒ Object (readonly)
Returns the value of attribute magic.
19 20 21 |
# File 'lib/game/character.rb', line 19 def magic @magic end |
#mind ⇒ Object (readonly)
Returns the value of attribute mind.
19 20 21 |
# File 'lib/game/character.rb', line 19 def mind @mind end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/game/character.rb', line 18 def name @name end |
#race ⇒ Object (readonly)
Returns the value of attribute race.
19 20 21 |
# File 'lib/game/character.rb', line 19 def race @race end |
#skills ⇒ Object (readonly)
Returns the value of attribute skills.
19 20 21 |
# File 'lib/game/character.rb', line 19 def skills @skills end |
#spells ⇒ Object (readonly)
Returns the value of attribute spells.
20 21 22 |
# File 'lib/game/character.rb', line 20 def spells @spells end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
20 21 22 |
# File 'lib/game/character.rb', line 20 def state @state end |
#strength ⇒ Object (readonly)
Returns the value of attribute strength.
18 19 20 |
# File 'lib/game/character.rb', line 18 def strength @strength end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
18 19 20 |
# File 'lib/game/character.rb', line 18 def weight @weight end |
Instance Method Details
#calc_status ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/game/character.rb', line 60 def calc_status if @endurance <= 25 @state = Core::Game::UNCONSCIOUS elsif @endurance <= 0 @state = Core::Game::DEAD end end |
#consume(item) ⇒ Object
57 58 |
# File 'lib/game/character.rb', line 57 def consume(item) end |
#rest(amount) ⇒ Object
75 76 77 78 79 |
# File 'lib/game/character.rb', line 75 def rest(amount) if @state != Core::Game::DEAD @endurance -= amount end end |
#setup ⇒ Object
health is only used as a percentage for easier displaying, the real stuff is in @const
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/game/character.rb', line 24 def setup @health = @endurance = 100 @inventory = Core::Game::Inventory.new(20, @strength) @skills = Core::Game::Skills.new @const = Core::Game::Constitution.new @mind = Core::Game::Mind.new @equipment = Core::Game::Equipment.new @magic = Core::Game::Magic.new(self) @state = Core::Game::NORMAL @spells = {} Core::Game.spells.each { |spell| @spells.store(spell, 0) } @charset = @file @file = Core.sprite(@file) @influences = [] setup_skills end |
#update ⇒ Object
51 52 53 54 55 |
# File 'lib/game/character.rb', line 51 def update @influences.each { |inf| inf.update(self) } end |
#validate ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/game/character.rb', line 43 def validate if @agility > 100 @agility = 0 elsif @agility < 0 @agility = 0 end end |