mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-07-22 15:47:00 +00:00
Update 6.8
This commit is contained in:
@@ -31,7 +31,7 @@ class GameWeather
|
||||
CHANCE_OF_FOG = 30 #/100 Only possible in the morning, otherwise, when rain and sun combine
|
||||
|
||||
MAX_INTENSITY_ON_NEW_WEATHER = 4
|
||||
|
||||
MAX_WEATHER_INTENSITY = 10
|
||||
|
||||
CHANCES_OF_INTENSITY_INCREASE = 30 # /100
|
||||
CHANCES_OF_INTENSITY_DECREASE = 20 # /100
|
||||
@@ -40,13 +40,21 @@ class GameWeather
|
||||
BASE_CHANCES_OF_WEATHER_MOVE = 10
|
||||
DEBUG_PROPAGATION = false
|
||||
|
||||
COLD_MAPS = [444] # Rain is snow on that map (shoal cave)
|
||||
SNOW_LIMITS = [965,951] # Route 121, Pacifidlog - Snow turns to rain if it reaches these maps
|
||||
COLD_MAPS = [MAP_SHOAL_CAVE] # Rain is snow on that map (shoal cave)
|
||||
SNOW_LIMITS = [MAP_ROUTE_121,MAP_PACIFIDLOG] #Snow turns to rain if it reaches these maps
|
||||
SOOT_LIMITS = [MAP_ROUTE_113,MAP_FALLARBOR, MAP_ROUTE_111] #Can't let it propagate too much because then the grass would have to be covered in soot in those maps too....
|
||||
|
||||
SANDSTORM_MAPS = [MAP_DESERT] # Always sandstorm, doesn't spread
|
||||
NO_WIND_MAPS = [MAP_SOOTOPOLIS]
|
||||
NO_RAIN_MAPS = [MAP_MT_CHIMNEY,MAP_DESERT]
|
||||
|
||||
SANDSTORM_MAPS = [555] # Always sandstorm, doesn't spread
|
||||
SOOT_MAPS = [] # Always soot, doesn't spread
|
||||
NO_WIND_MAPS = [989] # Sootopolis, Petalburg Forest
|
||||
FREQUENT_WEATHER = [MAP_ROUTE_113,MAP_ROUTE_120] #More likely to spawn a new weather
|
||||
WINDY_MAPS = [MAP_MT_CHIMNEY,MAP_MT_PYRE] #More likely to be windy
|
||||
RAINY_MAPS = [MAP_ROUTE_113,MAP_ROUTE_119,MAP_ROUTE_120] #More likely to be raining,
|
||||
# 113 is in there because rain turns into soot there
|
||||
|
||||
SOOT_MAPS = [MAP_ROUTE_113]
|
||||
SOOT_CAUSES_MAPS = [MAP_MT_CHIMNEY] # When it's windy on Mt. Chimney, causes soot on soot maps
|
||||
|
||||
def set_weather(map_id, weather_type, intensity)
|
||||
@current_weather[map_id] = [weather_type, intensity]
|
||||
@@ -69,7 +77,7 @@ class GameWeather
|
||||
def initialize_weather
|
||||
weather = {}
|
||||
@neighbors_maps.keys.each { |map_id|
|
||||
weather[map_id] = select_new_weather_spawn
|
||||
weather[map_id] = select_new_weather_spawn(CHANCE_OF_NEW_WEATHER, map_id)
|
||||
}
|
||||
@current_weather = weather
|
||||
end
|
||||
@@ -78,6 +86,11 @@ class GameWeather
|
||||
@current_weather[map_id] = [weather_type,intensity]
|
||||
end
|
||||
|
||||
def get_current_map_weather
|
||||
map_id = $game_map.map_id
|
||||
return @current_weather[map_id]
|
||||
end
|
||||
|
||||
def get_map_weather_type(map_id)
|
||||
if !@current_weather[map_id]
|
||||
@current_weather[map_id] = [:None,0]
|
||||
@@ -109,13 +122,13 @@ class GameWeather
|
||||
new_weather = @current_weather.dup
|
||||
new_weather.each do |map_id, (type, intensity)|
|
||||
try_end_weather(map_id,type, get_map_weather_intensity(map_id))
|
||||
try_spawn_new_weather(map_id,type, intensity)
|
||||
try_spawn_new_weather(map_id,type)
|
||||
try_propagate_weather_to_neighbors(map_id,type, intensity)
|
||||
echoln @current_weather[954] if @debug_you
|
||||
try_move_weather_to_neighbors(map_id,type, intensity)
|
||||
try_weather_intensity_decrease(map_id,type, intensity)
|
||||
try_weather_intensity_increase(map_id,type, intensity)
|
||||
end
|
||||
apply_special_weather_interactions
|
||||
update_overworld_weather($game_map.map_id)
|
||||
@last_update_time = pbGetTimeNow
|
||||
end
|
||||
@@ -139,9 +152,11 @@ class GameWeather
|
||||
end
|
||||
end
|
||||
|
||||
def try_spawn_new_weather(map_id,map_weather_type,weather_intensity)
|
||||
def try_spawn_new_weather(map_id,map_weather_type,spawn_chance=nil)
|
||||
return if map_weather_type != :None
|
||||
new_weather = select_new_weather_spawn
|
||||
spawn_chance = CHANCE_OF_NEW_WEATHER unless spawn_chance
|
||||
spawn_chance*=2 if FREQUENT_WEATHER.include?(map_id)
|
||||
new_weather = select_new_weather_spawn(spawn_chance, map_id)
|
||||
@current_weather[map_id] = adjust_weather_for_map(new_weather,map_id)
|
||||
end
|
||||
|
||||
@@ -162,7 +177,7 @@ class GameWeather
|
||||
result_weather_type = resolve_weather_interaction(map_weather_type, neighbor_weather_type, weather_intensity, neighbor_weather_intensity)
|
||||
result_weather_intensity = weather_intensity
|
||||
new_weather = [result_weather_type,result_weather_intensity]
|
||||
@current_weather[neighbor_id] = adjust_weather_for_map(new_weather,map_id)
|
||||
@current_weather[neighbor_id] = adjust_weather_for_map(new_weather,neighbor_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -178,7 +193,9 @@ class GameWeather
|
||||
return unless can_weather_increase(map_weather_type)
|
||||
should_change_intensity = roll_for_weather_increase(map_weather_type)
|
||||
return if !should_change_intensity
|
||||
new_weather = [map_weather_type,weather_intensity+1]
|
||||
new_intensity = [weather_intensity + 1, MAX_WEATHER_INTENSITY].min
|
||||
new_weather = [map_weather_type, new_intensity]
|
||||
|
||||
@current_weather[map_id] = adjust_weather_for_map(new_weather,map_id)
|
||||
end
|
||||
|
||||
@@ -196,6 +213,18 @@ class GameWeather
|
||||
@current_weather[map_id] = adjust_weather_for_map(new_weather,map_id)
|
||||
end
|
||||
|
||||
def apply_special_weather_interactions
|
||||
# Soot: wind on SOOT_CAUSES_MAPS blows ash onto SOOT_MAPS
|
||||
soot_wind_active = SOOT_CAUSES_MAPS.any? do |map_id|
|
||||
get_map_weather_type(map_id) == :Wind
|
||||
end
|
||||
if soot_wind_active
|
||||
SOOT_MAPS.each do |map_id|
|
||||
intensity = get_map_weather_intensity(map_id)
|
||||
@current_weather[map_id] = [:Ash, [1,intensity].max]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def adjust_weather_for_map(map_current_weather,map_id)
|
||||
type = map_current_weather[0]
|
||||
@@ -204,22 +233,29 @@ class GameWeather
|
||||
end
|
||||
|
||||
def get_updated_weather(type, intensity, map_id)
|
||||
if COLD_MAPS.include?(map_id)
|
||||
if COLD_MAPS.include?(map_id) || Settings::SNOW_DAY
|
||||
type = :Snow if type == :Rain
|
||||
type = :Blizzard if type == :Storm
|
||||
type = :None if type == :Sunny
|
||||
end
|
||||
if SNOW_LIMITS.include?(map_id)
|
||||
type = :Rain if type == :Snow
|
||||
type = :Wind if type == :Ash
|
||||
end
|
||||
|
||||
if SOOT_LIMITS.include?(map_id)
|
||||
type = :Rain if type == :Ash
|
||||
end
|
||||
|
||||
if SOOT_MAPS.include?(map_id)
|
||||
type = :SootRain if type == :Rain
|
||||
type = :Ash if type == :Rain
|
||||
end
|
||||
if NO_WIND_MAPS.include?(map_id)
|
||||
type = :None if type == :Wind
|
||||
end
|
||||
|
||||
if NO_RAIN_MAPS.include?(map_id)
|
||||
type = :None if type == :Rain
|
||||
end
|
||||
|
||||
if SANDSTORM_MAPS.include?(map_id)
|
||||
type = :Sandstorm
|
||||
intensity = 9
|
||||
@@ -228,6 +264,7 @@ class GameWeather
|
||||
type = :None
|
||||
intensity = 0
|
||||
end
|
||||
intensity = [intensity, MAX_WEATHER_INTENSITY].min
|
||||
return [type, intensity]
|
||||
end
|
||||
|
||||
@@ -337,7 +374,7 @@ class GameWeather
|
||||
end
|
||||
|
||||
def roll_for_weather_increase(type)
|
||||
return false if !can_weather_decrease(type)
|
||||
return false if !can_weather_increase(type)
|
||||
return rand(100) <= CHANCES_OF_INTENSITY_INCREASE
|
||||
end
|
||||
|
||||
@@ -346,16 +383,23 @@ class GameWeather
|
||||
return rand(100) <= CHANCES_OF_INTENSITY_DECREASE
|
||||
end
|
||||
|
||||
def select_new_weather_spawn
|
||||
return [:None, 0] if rand(100) >= CHANCE_OF_NEW_WEATHER
|
||||
|
||||
def select_new_weather_spawn(spawn_chance, map_id)
|
||||
return [:None, 0] if rand(100) >= spawn_chance
|
||||
base_intensity = rand(MAX_INTENSITY_ON_NEW_WEATHER) + 1
|
||||
|
||||
rain_chance = CHANCE_OF_RAIN
|
||||
sunny_chance = CHANCE_OF_SUNNY
|
||||
wind_chance = CHANCE_OF_WINDY
|
||||
fog_chance = CHANCE_OF_FOG
|
||||
|
||||
wind_chance*=3 if WINDY_MAPS.include?(map_id)
|
||||
rain_chance*=3 if RAINY_MAPS.include?(map_id)
|
||||
|
||||
weights = []
|
||||
weights << [:Rain, CHANCE_OF_RAIN]
|
||||
weights << [:Sunny, CHANCE_OF_SUNNY]
|
||||
weights << [:Wind, CHANCE_OF_WINDY]
|
||||
weights << [:Fog, CHANCE_OF_FOG] if PBDayNight.isMorning?
|
||||
weights << [:Rain, rain_chance]
|
||||
weights << [:Sunny, sunny_chance]
|
||||
weights << [:Wind, wind_chance]
|
||||
weights << [:Fog, fog_chance] if PBDayNight.isMorning?
|
||||
|
||||
total = weights.sum { |w| w[1] }
|
||||
roll = rand(total)
|
||||
|
||||
Reference in New Issue
Block a user