Class: Core::Game::Party

Inherits:
Object show all
Defined in:
lib/game/party.rb

Overview

TODO < Array

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParty

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

#locationObject

Returns the value of attribute location.



8
9
10
# File 'lib/game/party.rb', line 8

def location
  @location
end

#player_indexObject

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

#membersObject



23
24
25
# File 'lib/game/party.rb', line 23

def members
  return @members
end

#playerObject



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

#updateObject



26
27
28
29
30
# File 'lib/game/party.rb', line 26

def update
  @members.each { |m|
    m.update
  }
end