Class: Witch

Inherits:
Doctor show all
Defined in:
lib/were_wolf/player/witch.rb

Instance Method Summary collapse

Methods inherited from Doctor

#accuse, #forget_all!, #remember_innocent

Methods inherited from Villager

#accuse

Constructor Details

#initializeWitch

Returns a new instance of Witch.



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

def initialize
  super
  @save_power_used = false
  @kill_power_used = false
end

Instance Method Details

#choose_a_player_to_kill(players) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/were_wolf/player/witch.rb', line 21

def choose_a_player_to_kill(players)
  return if @kill_power_used

  if choose_to_use_power?(players)
    @kill_power_used = true
    return (players.alive_players - [self]).sample
  else
    return
  end
end

#choose_a_player_to_save(players) ⇒ Object



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

def choose_a_player_to_save(players)
  return if @save_power_used

  if choose_to_use_power?(players)
    # Choose a person to save
    @save_power_used = true
    return super(players)
  else
    # Save the save power for a later round
    return nil
  end
end