Class: Rogue
Instance Method Summary collapse
- #choose_victim(players) ⇒ Object
-
#initialize ⇒ Rogue
constructor
A new instance of Rogue.
Methods inherited from Villager
Constructor Details
#initialize ⇒ Rogue
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 |