Guest User

Untitled

a guest
Jan 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.88 KB | None | 0 0
  1. def date_roll
  2.   month = $game_variables[101]
  3.   date = $game_variables[102]
  4.   day = $game_variables[103]
  5.   moon = $game_variables[105]
  6.   total = $game_variables[106]
  7.  
  8.   date += 1 # Push date +1
  9.   mon_length = month % 2 # Mod month; even = 0, odd = 1
  10.   if mon_length == 0
  11.     if date > 30 or (month == 2 and date > 28) # February
  12.       date = 1
  13.       month += 1
  14.     end
  15.   else
  16.     if date > 31
  17.       date = 1
  18.       month += 1
  19.     end
  20.   end
  21.  
  22.   month = 1 if month > 12 # if January, make it January
  23.   day += 1              # Advance day of week
  24.   day = 1 if day > 7    # If Sunday, make it Sunday
  25.   total += 1            # Total number of days ever passed
  26. #~   moon += 1             # Advance moon phase
  27. #~   moon = 1 if moon > 27 # Constant loop of lunacy
  28.  
  29.   $game_variables[101] = month
  30.   $game_variables[102] = date
  31.   $game_variables[103] = day
  32.   $game_variables[106] = total
  33.  
  34. case ((total % 28) + 1)
  35.  when 1
  36.  $game_variables[105] = 1
  37. #~ phase = "Full"
  38.  when (2..5)
  39.  $game_variables[105] = 2
  40. #~ phase = "Waning Gibbous"
  41.  when (6..11)
  42.  $game_variables[105] = 3
  43. #~ phase = "Last Quarter"
  44.  when (12..15)
  45.  $game_variables[105] = 4
  46. #~ phase = "Waning Crescent"
  47.  when (16)
  48.  $game_variables[105] = 5
  49. #~ phase = "New"
  50.  when (17..20)
  51.  $game_variables[105] = 6
  52. #~ phase = "Waxing Crescent"
  53.  when (21..25)
  54.  $game_variables[105] = 7
  55. #~ phase = "First Quarter"
  56.  when (26..28)
  57.  $game_variables[105] = 8
  58. #~ phase = "Waxing Gibbous"
  59. end
  60.  
  61. case $game_variables[105]
  62.   when 1
  63.   physphase = 100
  64.   magiphase = 100
  65.   when 2
  66.   physphase = 90
  67.   magiphase = 110
  68.   when 3
  69.   physphase = 80
  70.   magiphase = 120
  71.   when 4
  72.   physphase = 90
  73.   magiphase = 110
  74.   when 5
  75.   physphase = 100
  76.   magiphase = 100
  77.   when 6
  78.   physphase = 110
  79.   magiphase = 90
  80.   when 7
  81.   physphase = 120
  82.   magiphase = 80
  83.   when 8
  84.   physphase = 110
  85.   magiphase = 90
  86. end
  87.  
  88. end
Add Comment
Please, Sign In to add comment