Class: Hlockey::Game::Weather::Stars

Inherits:
Object
  • Object
show all
Includes:
Weatherable
Defined in:
lib/hlockey/game/weather/stars.rb

Overview

Stars weather Gives the losing team +0.5 score at the end of each period

Instance Method Summary collapse

Methods included from Weatherable

#initialize, #on_action, #on_game_end, #on_game_start, #on_goal

Methods included from SelfDescribable

#to_s

Instance Method Details

#on_period_endObject



13
14
15
16
17
18
19
# File 'lib/hlockey/game/weather/stars.rb', line 13

def on_period_end
  return if @game.score[:home] == @game.score[:away]

  team = @game.score.min_by { |_, v| v }.first
  @game.score[team] += 0.5
  @game.stream << Message.new(:weather_stars_event, team: @game.send(team))
end