Class: StudioGame::DarksideCharacter

Inherits:
Character
  • Object
show all
Defined in:
lib/studio_game/darkside_character.rb

Instance Attribute Summary

Attributes inherited from Character

#hp, #name

Instance Method Summary collapse

Methods inherited from Character

#<=>, #each_pet_adopted, from_csv, #pet_collection, #points, #to_s

Methods included from Playable

#strong?, #take_damage

Constructor Details

#initialize(name, hp = 80, ds_points = 1) ⇒ DarksideCharacter

Returns a new instance of DarksideCharacter.



6
7
8
9
# File 'lib/studio_game/darkside_character.rb', line 6

def initialize(name, hp=80, ds_points=1)
  super(name, hp)
  @ds_points = ds_points
end

Instance Method Details

#adopt_pet(pet) ⇒ Object



21
22
23
24
# File 'lib/studio_game/darkside_character.rb', line 21

def adopt_pet(pet)
  darkside_pet = Pets.new(pet.name, (pet.points / 2).to_i)
  super(darkside_pet)
end

#heal_damage(points) ⇒ Object



15
16
17
18
19
# File 'lib/studio_game/darkside_character.rb', line 15

def heal_damage(points)
  ds_heal = points * @ds_points
  super(ds_heal)
  @ds_points += 1 unless sith?
end

#sith?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/studio_game/darkside_character.rb', line 11

def sith?
  @ds_points > 5
end