Class: Month

Inherits:
Object
  • Object
show all
Defined in:
lib/month.rb

Instance Method Summary collapse

Constructor Details

#initialize(temp_range = TemperatureRange.new(0, [0, 0], [0, 0]), conditions = SkyConditions.new((0..100), (100..100), (100..100)), precipitation_chance = 0) ⇒ Month

Returns a new instance of Month.



5
6
7
8
9
10
11
# File 'lib/month.rb', line 5

def initialize(temp_range = TemperatureRange.new(0, [0, 0], [0, 0]), 
               conditions = SkyConditions.new((0..100), (100..100), (100..100)), 
               precipitation_chance = 0)
  @temp_range = temp_range
  @sky_condition = conditions
  @precipitation_chance = precipitation_chance
end

Instance Method Details

#has_precipitation(dieroller) ⇒ Object



21
22
23
# File 'lib/month.rb', line 21

def has_precipitation (dieroller)
  @precipitation_chance >= dieroller.roll(100)
end

#sky_conditions(dieroller) ⇒ Object



13
14
15
# File 'lib/month.rb', line 13

def sky_conditions (dieroller)
  @sky_condition.condition(dieroller)
end

#temp_range(dieroller, record_temp = nil) ⇒ Object



17
18
19
# File 'lib/month.rb', line 17

def temp_range (dieroller, record_temp=nil)
  @temp_range.range(dieroller, record_temp)
end