Class: Core::Game::Party
Overview
TODO < Array
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
-
#player_index ⇒ Object
Returns the value of attribute player_index.
Instance Method Summary collapse
- #add(char) ⇒ Object
-
#initialize ⇒ Party
constructor
A new instance of Party.
- #members ⇒ Object
- #player ⇒ Object
- #remove(char) ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ Party
Returns a new instance of Party.
9 10 11 12 13 14 15 16 |
# File 'lib/game/party.rb', line 9 def initialize @members = [] @members += Core::Game.characters @player_index = 0 @location = "" (Core::Game.items.size * 5).times { @members[0].inventory.add(Core::Game.items.sample) } @members[0].equipment.equip(Core::Game.items[1], :rarm, @members[0].inventory) end |
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
8 9 10 |
# File 'lib/game/party.rb', line 8 def location @location end |
#player_index ⇒ Object
Returns the value of attribute player_index.
8 9 10 |
# File 'lib/game/party.rb', line 8 def player_index @player_index end |
Instance Method Details
#add(char) ⇒ Object
17 18 19 |
# File 'lib/game/party.rb', line 17 def add(char) @members.push(char) end |
#members ⇒ Object
23 24 25 |
# File 'lib/game/party.rb', line 23 def members return @members end |
#player ⇒ Object
31 32 33 |
# File 'lib/game/party.rb', line 31 def player return @members[@player_index] end |
#remove(char) ⇒ Object
20 21 22 |
# File 'lib/game/party.rb', line 20 def remove(char) @members.delete(char) end |
#update ⇒ Object
26 27 28 29 30 |
# File 'lib/game/party.rb', line 26 def update @members.each { |m| m.update } end |