class Arkham::Player

Attributes

health[R]

Public Class Methods

new(game, health) click to toggle source
# File lib/arkham/player.rb, line 8
def initialize(game, health)
  @deck = Deck.new
  @discard = Discard.new
  @hand = []
  @game = game
  @shield = 0
  @health = health
end

Public Instance Methods

add_shield(amount) click to toggle source
# File lib/arkham/player.rb, line 38
def add_shield(amount)
  @shield += amount
end
damage(amount) click to toggle source
# File lib/arkham/player.rb, line 46
def damage(amount)
  @health -= amount
end
display_cards() click to toggle source
# File lib/arkham/player.rb, line 25
def display_cards
  @hand.each_with_index do |card, index|
    puts "#{index + 1}: #{card.display}"
  end
end
heal(amount) click to toggle source
# File lib/arkham/player.rb, line 42
def heal(amount)
  @health += amount
end
play_card() click to toggle source
# File lib/arkham/player.rb, line 31
def play_card
  puts "\nWhich card would you like to play?"
  index_to_play = gets.chomp.to_i - 1
  card_played = @hand.delete_at(index_to_play)
  card_played.play(@game)
end
print_summary() click to toggle source
take_turn() click to toggle source
# File lib/arkham/player.rb, line 17
def take_turn
  @hand = @deck.draw_five
  3.times do
    display_cards
    play_card
  end
end