Class: BloodChalice::Peasant

Inherits:
Object
  • Object
show all
Includes:
ArtificialIntelligence, Movable, TileValues
Defined in:
lib/bloodchalice/peasant.rb

Constant Summary collapse

MAX_LIFE =
2
SPEED =
2
ATTACK =
0
VISION =
6
MAXBLOOD =
3

Constants included from Movable

Movable::DIRECTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ArtificialIntelligence

#bited, #die, #hit, #reacts_to, #think

Methods included from TileValues

#chalice?, #empty?, #knight?, #peasant?, #player?, #wall?, #zombie?

Methods included from Movable

#hit, #move, #move!, #moves?, #reactions, #reset_moves

Constructor Details

#initialize(options = {}) ⇒ Peasant

Returns a new instance of Peasant.



15
16
17
18
19
20
21
22
23
# File 'lib/bloodchalice/peasant.rb', line 15

def initialize(options = {})
  @position = options[:position]
  @map = options[:map]
  @game = options[:game]
  @life = MAX_LIFE
  @blood = MAXBLOOD
  @value = 'P'
  @speed = SPEED
end

Instance Attribute Details

#bloodObject

Returns the value of attribute blood.



7
8
9
# File 'lib/bloodchalice/peasant.rb', line 7

def blood
  @blood
end

#gameObject

Returns the value of attribute game.



7
8
9
# File 'lib/bloodchalice/peasant.rb', line 7

def game
  @game
end

#lifeObject

Returns the value of attribute life.



7
8
9
# File 'lib/bloodchalice/peasant.rb', line 7

def life
  @life
end

#mapObject

Returns the value of attribute map.



7
8
9
# File 'lib/bloodchalice/peasant.rb', line 7

def map
  @map
end

#positionObject

Returns the value of attribute position.



7
8
9
# File 'lib/bloodchalice/peasant.rb', line 7

def position
  @position
end

#speedObject

Returns the value of attribute speed.



7
8
9
# File 'lib/bloodchalice/peasant.rb', line 7

def speed
  @speed
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/bloodchalice/peasant.rb', line 7

def value
  @value
end

Instance Method Details

#to_sObject



25
26
27
# File 'lib/bloodchalice/peasant.rb', line 25

def to_s
  @value.to_s
end