Class: Rogue

Inherits:
Villager show all
Defined in:
lib/were_wolf/player/rogue.rb

Instance Method Summary collapse

Methods inherited from Villager

#accuse

Constructor Details

#initializeRogue

Returns a new instance of Rogue.



2
3
4
5
# File 'lib/were_wolf/player/rogue.rb', line 2

def initialize
  super
  @killing_power_used = false
end

Instance Method Details

#choose_victim(players) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/were_wolf/player/rogue.rb', line 7

def choose_victim(players)
  return nil if @killing_power_used

  if (rand < (1.0/(players.alive_wolves.count + 1)))
    # Choose a victim
    @killing_power_used = true
    return (players.alive_players - [self]).sample
  else
    # Save the power for a later round
    return nil
  end
end