Module: Gamefic::Plot::Host
- Defined in:
- lib/gamefic/plot/host.rb
Instance Method Summary collapse
-
#branch(subplot_class = Gamefic::Subplot, introduce: nil) ⇒ Subplot
Start a new subplot based on the provided class.
-
#subbed?(player) ⇒ Boolean
Determine whether the player is involved in a subplot.
-
#subplot_for(player) ⇒ Subplot
Get the player’s current subplot or nil if none exists.
-
#subplots ⇒ Array<Subplot>
Get an array of all the current subplots.
Instance Method Details
#branch(subplot_class = Gamefic::Subplot, introduce: nil) ⇒ Subplot
Start a new subplot based on the provided class.
17 18 19 20 21 |
# File 'lib/gamefic/plot/host.rb', line 17 def branch subplot_class = Gamefic::Subplot, introduce: nil subplot = subplot_class.new(self, introduce: introduce) p_subplots.push subplot subplot end |
#subbed?(player) ⇒ Boolean
Determine whether the player is involved in a subplot.
36 37 38 |
# File 'lib/gamefic/plot/host.rb', line 36 def subbed? player !subplot_for(player).nil? end |
#subplot_for(player) ⇒ Subplot
Get the player’s current subplot or nil if none exists.
26 27 28 29 30 31 |
# File 'lib/gamefic/plot/host.rb', line 26 def subplot_for player subplots.each { |s| return s if s.players.include?(player) } nil end |