Class: Hlockey::Game::Weather::Incline
- Inherits:
-
Object
- Object
- Hlockey::Game::Weather::Incline
show all
- Includes:
- Weatherable
- Defined in:
- lib/hlockey/game/weather/incline.rb
Overview
Incline weather Adds a random amount of score to a favored team’s goals
Instance Method Summary
collapse
#initialize, #on_game_end, #on_period_end
#to_s
Instance Method Details
#on_action ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/hlockey/game/weather/incline.rb', line 24
def on_action
return unless @incline_changed
@game.stream << Message.new(:weather_incline_event,
team: @game.send(@favored_team))
@incline_changed = false
end
|
#on_game_start ⇒ Object
13
14
15
|
# File 'lib/hlockey/game/weather/incline.rb', line 13
def on_game_start
make_incline
end
|
#on_goal(scoring_team) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/hlockey/game/weather/incline.rb', line 17
def on_goal(scoring_team)
return unless scoring_team == @favored_team
@game.score[scoring_team] += @prng.rand(0.1..0.5)
make_incline
end
|