mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Added class GameData::Weather
This commit is contained in:
@@ -81,7 +81,7 @@ class Game_Screen
|
|||||||
# duration : time
|
# duration : time
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def weather(type, power, duration)
|
def weather(type, power, duration)
|
||||||
@weather_type = type
|
@weather_type = GameData::Weather.get(type).id
|
||||||
@weather_max = (power + 1) * RPG::Weather::MAX_SPRITES / 10
|
@weather_max = (power + 1) * RPG::Weather::MAX_SPRITES / 10
|
||||||
@weather_duration = duration # In 1/20ths of a seconds
|
@weather_duration = duration # In 1/20ths of a seconds
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class Spriteset_Map
|
|||||||
sprite.update
|
sprite.update
|
||||||
end
|
end
|
||||||
if self.map!=$game_map
|
if self.map!=$game_map
|
||||||
@weather.fade_in(PBFieldWeather::None, 0, 20)
|
@weather.fade_in(:None, 0, 20)
|
||||||
else
|
else
|
||||||
@weather.fade_in($game_screen.weather_type, $game_screen.weather_max, $game_screen.weather_duration)
|
@weather.fade_in($game_screen.weather_type, $game_screen.weather_max, $game_screen.weather_duration)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module GameData
|
|||||||
"Bicycle" => [3, "b"],
|
"Bicycle" => [3, "b"],
|
||||||
"BicycleAlways" => [4, "b"],
|
"BicycleAlways" => [4, "b"],
|
||||||
"HealingSpot" => [5, "vuu"],
|
"HealingSpot" => [5, "vuu"],
|
||||||
"Weather" => [6, "eu", :PBFieldWeather],
|
"Weather" => [6, "eu", :Weather],
|
||||||
"MapPosition" => [7, "uuu"],
|
"MapPosition" => [7, "uuu"],
|
||||||
"DiveMap" => [8, "v"],
|
"DiveMap" => [8, "v"],
|
||||||
"DarkMap" => [9, "b"],
|
"DarkMap" => [9, "b"],
|
||||||
|
|||||||
@@ -1,20 +1,163 @@
|
|||||||
begin
|
# Category has the following effects:
|
||||||
module PBFieldWeather
|
# - Determines the in-battle weather.
|
||||||
None = 0 # None must be 0 (preset RMXP weather)
|
# - Some abilities reduce the encounter rate in certain categories of weather.
|
||||||
Rain = 1 # Rain must be 1 (preset RMXP weather)
|
# - Some evolution methods check the current weather's category.
|
||||||
Storm = 2 # Storm must be 2 (preset RMXP weather)
|
# - The :Rain category treats the last listed particle graphic as a water splash rather
|
||||||
Snow = 3 # Snow must be 3 (preset RMXP weather)
|
# than a raindrop, which behaves differently.
|
||||||
Blizzard = 4
|
# - :Rain auto-waters berry plants.
|
||||||
Sandstorm = 5
|
# Delta values are per second.
|
||||||
HeavyRain = 6
|
# For the tone_proc, strength goes from 0 to RPG::Weather::MAX_SPRITES (60) and
|
||||||
Sun = Sunny = 7
|
# will typically be the maximum.
|
||||||
Fog = 8
|
module GameData
|
||||||
|
class Weather
|
||||||
|
attr_reader :id
|
||||||
|
attr_reader :id_number
|
||||||
|
attr_reader :real_name
|
||||||
|
attr_reader :category # :None, :Rain, :Hail, :Sandstorm, :Sun, :Fog
|
||||||
|
attr_reader :graphics # [[particle file names], [tile file names]]
|
||||||
|
attr_reader :particle_delta_x
|
||||||
|
attr_reader :particle_delta_y
|
||||||
|
attr_reader :particle_delta_opacity
|
||||||
|
attr_reader :tile_delta_x
|
||||||
|
attr_reader :tile_delta_y
|
||||||
|
attr_reader :tone_proc
|
||||||
|
|
||||||
def PBFieldWeather.maxValue; return 8; end
|
DATA = {}
|
||||||
|
|
||||||
|
extend ClassMethods
|
||||||
|
include InstanceMethods
|
||||||
|
|
||||||
|
def self.load; end
|
||||||
|
def self.save; end
|
||||||
|
|
||||||
|
def initialize(hash)
|
||||||
|
@id = hash[:id]
|
||||||
|
@id_number = hash[:id_number]
|
||||||
|
@real_name = hash[:id].to_s || "Unnamed"
|
||||||
|
@category = hash[:category] || :None
|
||||||
|
@particle_delta_x = hash[:particle_delta_x] || 0
|
||||||
|
@particle_delta_y = hash[:particle_delta_y] || 0
|
||||||
|
@particle_delta_opacity = hash[:particle_delta_opacity] || 0
|
||||||
|
@tile_delta_x = hash[:tile_delta_x] || 0
|
||||||
|
@tile_delta_y = hash[:tile_delta_y] || 0
|
||||||
|
@graphics = hash[:graphics] || []
|
||||||
|
@tone_proc = hash[:tone_proc]
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue Exception
|
def has_particles?
|
||||||
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
|
return @graphics[0] && @graphics[0].length > 0
|
||||||
raise $!
|
end
|
||||||
|
|
||||||
|
def has_tiles?
|
||||||
|
return @graphics[1] && @graphics[1].length > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def tone(strength)
|
||||||
|
return (@tone_proc) ? @tone_proc.call(strength) : Tone.new(0, 0, 0, 0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :None,
|
||||||
|
:id_number => 0 # Must be 0 (preset RMXP weather)
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :Rain,
|
||||||
|
:id_number => 1, # Must be 1 (preset RMXP weather)
|
||||||
|
:category => :Rain,
|
||||||
|
:graphics => [["rain_1", "rain_2", "rain_3", "rain_4"]], # Last is splash
|
||||||
|
:particle_delta_x => -1200,
|
||||||
|
:particle_delta_y => 4800,
|
||||||
|
:tone_proc => proc { |strength|
|
||||||
|
next Tone.new(-strength * 3 / 4, -strength * 3 / 4, -strength * 3 / 4, 10)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
# NOTE: This randomly flashes the screen in RPG::Weather#update.
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :Storm,
|
||||||
|
:id_number => 2, # Must be 2 (preset RMXP weather)
|
||||||
|
:category => :Rain,
|
||||||
|
:graphics => [["storm_1", "storm_2", "storm_3", "storm_4"]], # Last is splash
|
||||||
|
:particle_delta_x => -4800,
|
||||||
|
:particle_delta_y => 4800,
|
||||||
|
:tone_proc => proc { |strength|
|
||||||
|
next Tone.new(-strength * 3 / 2, -strength * 3 / 2, -strength * 3 / 2, 20)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
# NOTE: This alters the movement of snow particles in RPG::Weather#update_sprite_position.
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :Snow,
|
||||||
|
:id_number => 3, # Must be 3 (preset RMXP weather)
|
||||||
|
:category => :Hail,
|
||||||
|
:graphics => [["hail_1", "hail_2", "hail_3"]],
|
||||||
|
:particle_delta_x => -240,
|
||||||
|
:particle_delta_y => 240,
|
||||||
|
:tone_proc => proc { |strength|
|
||||||
|
next Tone.new(strength / 2, strength / 2, strength / 2, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :Blizzard,
|
||||||
|
:id_number => 4,
|
||||||
|
:category => :Hail,
|
||||||
|
:graphics => [["blizzard_1", "blizzard_2", "blizzard_3", "blizzard_4"], ["blizzard_tile"]],
|
||||||
|
:particle_delta_x => -960,
|
||||||
|
:particle_delta_y => 240,
|
||||||
|
:tile_delta_x => -1440,
|
||||||
|
:tile_delta_y => 720,
|
||||||
|
:tone_proc => proc { |strength|
|
||||||
|
next Tone.new(strength * 3 / 4, strength * 3 / 4, strength * 3 / 4, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :Sandstorm,
|
||||||
|
:id_number => 5,
|
||||||
|
:category => :Sandstorm,
|
||||||
|
:graphics => [["sandstorm_1", "sandstorm_2", "sandstorm_3", "sandstorm_4"], ["sandstorm_tile"]],
|
||||||
|
:particle_delta_x => -1200,
|
||||||
|
:particle_delta_y => 640,
|
||||||
|
:tile_delta_x => -720,
|
||||||
|
:tile_delta_y => 360,
|
||||||
|
:tone_proc => proc { |strength|
|
||||||
|
next Tone.new(strength / 2, 0, -strength / 2, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :HeavyRain,
|
||||||
|
:id_number => 6,
|
||||||
|
:category => :Rain,
|
||||||
|
:graphics => [["storm_1", "storm_2", "storm_3", "storm_4"]], # Last is splash
|
||||||
|
:particle_delta_x => -4800,
|
||||||
|
:particle_delta_y => 4800,
|
||||||
|
:tone_proc => proc { |strength|
|
||||||
|
next Tone.new(-strength * 3 / 2, -strength * 3 / 2, -strength * 3 / 2, 20)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
# NOTE: This alters the screen tone in RPG::Weather#update_screen_tone.
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :Sun,
|
||||||
|
:id_number => 7,
|
||||||
|
:category => :Sun,
|
||||||
|
:tone_proc => proc { |strength|
|
||||||
|
next Tone.new(64, 64, 32, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
GameData::Weather.register({
|
||||||
|
:id => :Fog,
|
||||||
|
:category => :Fog,
|
||||||
|
:id_number => 8,
|
||||||
|
:tile_delta_x => -32,
|
||||||
|
:tile_delta_y => 0,
|
||||||
|
:graphics => [nil, ["fog_tile"]]
|
||||||
|
})
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ GameData::Evolution.register({
|
|||||||
:parameter => Integer,
|
:parameter => Integer,
|
||||||
:level_up_proc => proc { |pkmn, parameter|
|
:level_up_proc => proc { |pkmn, parameter|
|
||||||
if pkmn.level >= parameter && $game_screen
|
if pkmn.level >= parameter && $game_screen
|
||||||
next $game_screen.weather_type == PBFieldWeather::None
|
next $game_screen.weather_type == :None
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -131,7 +131,7 @@ GameData::Evolution.register({
|
|||||||
:parameter => Integer,
|
:parameter => Integer,
|
||||||
:level_up_proc => proc { |pkmn, parameter|
|
:level_up_proc => proc { |pkmn, parameter|
|
||||||
if pkmn.level >= parameter && $game_screen
|
if pkmn.level >= parameter && $game_screen
|
||||||
next $game_screen.weather_type == PBFieldWeather::Sun
|
next GameData::Weather.get($game_screen.weather_type).category == :Sun
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -141,8 +141,7 @@ GameData::Evolution.register({
|
|||||||
:parameter => Integer,
|
:parameter => Integer,
|
||||||
:level_up_proc => proc { |pkmn, parameter|
|
:level_up_proc => proc { |pkmn, parameter|
|
||||||
if pkmn.level >= parameter && $game_screen
|
if pkmn.level >= parameter && $game_screen
|
||||||
next [PBFieldWeather::Rain, PBFieldWeather::HeavyRain,
|
next [:Rain, :Fog].include?(GameData::Weather.get($game_screen.weather_type).category)
|
||||||
PBFieldWeather::Storm, PBFieldWeather::Fog].include?($game_screen.weather_type)
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -152,7 +151,7 @@ GameData::Evolution.register({
|
|||||||
:parameter => Integer,
|
:parameter => Integer,
|
||||||
:level_up_proc => proc { |pkmn, parameter|
|
:level_up_proc => proc { |pkmn, parameter|
|
||||||
if pkmn.level >= parameter && $game_screen
|
if pkmn.level >= parameter && $game_screen
|
||||||
next [PBFieldWeather::Snow, PBFieldWeather::Blizzard].include?($game_screen.weather_type)
|
next GameData::Weather.get($game_screen.weather_type).category == :Hail
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -162,7 +161,7 @@ GameData::Evolution.register({
|
|||||||
:parameter => Integer,
|
:parameter => Integer,
|
||||||
:level_up_proc => proc { |pkmn, parameter|
|
:level_up_proc => proc { |pkmn, parameter|
|
||||||
if pkmn.level >= parameter && $game_screen
|
if pkmn.level >= parameter && $game_screen
|
||||||
next $game_screen.weather_type == PBFieldWeather::Sandstorm
|
next GameData::Weather.get($game_screen.weather_type).category == :Sandstorm
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ Events.onMapChanging += proc { |_sender, e|
|
|||||||
new_map_metadata = GameData::MapMetadata.try_get(new_map_ID)
|
new_map_metadata = GameData::MapMetadata.try_get(new_map_ID)
|
||||||
next if new_map_metadata && new_map_metadata.weather
|
next if new_map_metadata && new_map_metadata.weather
|
||||||
end
|
end
|
||||||
$game_screen.weather(PBFieldWeather::None, 0, 0)
|
$game_screen.weather(:None, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set up various data related to the new map
|
# Set up various data related to the new map
|
||||||
|
|||||||
@@ -28,17 +28,8 @@ module RPG
|
|||||||
# [array of particle bitmaps, array of tile bitmaps,
|
# [array of particle bitmaps, array of tile bitmaps,
|
||||||
# +x per second (particle), +y per second (particle), +opacity per second (particle),
|
# +x per second (particle), +y per second (particle), +opacity per second (particle),
|
||||||
# +x per second (tile), +y per second (tile)]
|
# +x per second (tile), +y per second (tile)]
|
||||||
@weatherTypes = []
|
@weatherTypes = {}
|
||||||
@weatherTypes[PBFieldWeather::None] = nil
|
@type = :None
|
||||||
@weatherTypes[PBFieldWeather::Rain] = [[], nil, -1200, 4800, 0]
|
|
||||||
@weatherTypes[PBFieldWeather::HeavyRain] = [[], nil, -4800, 4800, 0]
|
|
||||||
@weatherTypes[PBFieldWeather::Storm] = [[], nil, -4800, 4800, 0]
|
|
||||||
@weatherTypes[PBFieldWeather::Snow] = [[], nil, -240, 240, 0]
|
|
||||||
@weatherTypes[PBFieldWeather::Blizzard] = [[], [], -960, 256, 0, -1440, 720]
|
|
||||||
@weatherTypes[PBFieldWeather::Sandstorm] = [[], [], -1200, 640, 0, -720, 360]
|
|
||||||
@weatherTypes[PBFieldWeather::Sun] = nil
|
|
||||||
@weatherTypes[PBFieldWeather::Fog] = [[], [], 0, 0, 0, -32, 0]
|
|
||||||
@type = 0
|
|
||||||
@max = 0
|
@max = 0
|
||||||
@ox = 0
|
@ox = 0
|
||||||
@oy = 0
|
@oy = 0
|
||||||
@@ -62,16 +53,17 @@ module RPG
|
|||||||
@new_sprites.each { |sprite| sprite.dispose if sprite }
|
@new_sprites.each { |sprite| sprite.dispose if sprite }
|
||||||
@tiles.each { |sprite| sprite.dispose if sprite }
|
@tiles.each { |sprite| sprite.dispose if sprite }
|
||||||
@viewport.dispose
|
@viewport.dispose
|
||||||
@weatherTypes.each do |weather|
|
@weatherTypes.each_value do |weather|
|
||||||
next if !weather
|
next if !weather
|
||||||
weather[0].each { |bitmap| bitmap.dispose if bitmap }
|
weather[1].each { |bitmap| bitmap.dispose if bitmap }
|
||||||
weather[1].each { |bitmap| bitmap.dispose if bitmap } if weather[1]
|
weather[2].each { |bitmap| bitmap.dispose if bitmap }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fade_in(new_type, new_max, duration = 1)
|
def fade_in(new_type, new_max, duration = 1)
|
||||||
return if @fading
|
return if @fading
|
||||||
new_max = 0 if new_type == PBFieldWeather::None
|
new_type = GameData::Weather.get(new_type).id
|
||||||
|
new_max = 0 if new_type == :None
|
||||||
return if @type == new_type && @max == new_max
|
return if @type == new_type && @max == new_max
|
||||||
if duration > 0
|
if duration > 0
|
||||||
@target_type = new_type
|
@target_type = new_type
|
||||||
@@ -84,9 +76,9 @@ module RPG
|
|||||||
@target_tone = get_weather_tone(@target_type, @target_max)
|
@target_tone = get_weather_tone(@target_type, @target_max)
|
||||||
@fade_time = 0.0
|
@fade_time = 0.0
|
||||||
@time_shift = 0
|
@time_shift = 0
|
||||||
if @type == PBFieldWeather::None
|
if @type == :None
|
||||||
@time_shift += 2 # No previous weather to fade out first
|
@time_shift += 2 # No previous weather to fade out first
|
||||||
elsif !@weatherTypes[@type] || !@weatherTypes[@type][1] || @weatherTypes[@type][1].length == 0
|
elsif !GameData::Weather.get(@type).has_tiles?
|
||||||
@time_shift += 1 # No previous tiles to fade out first
|
@time_shift += 1 # No previous tiles to fade out first
|
||||||
end
|
end
|
||||||
@fading = true
|
@fading = true
|
||||||
@@ -101,6 +93,7 @@ module RPG
|
|||||||
end
|
end
|
||||||
|
|
||||||
def type=(type)
|
def type=(type)
|
||||||
|
type = GameData::Weather.get(type).id
|
||||||
return if @type == type
|
return if @type == type
|
||||||
if @fading
|
if @fading
|
||||||
@max = @target_max
|
@max = @target_max
|
||||||
@@ -108,9 +101,9 @@ module RPG
|
|||||||
end
|
end
|
||||||
@type = type
|
@type = type
|
||||||
prepare_bitmaps(@type)
|
prepare_bitmaps(@type)
|
||||||
if @weatherTypes[@type] && @weatherTypes[@type][1] && @weatherTypes[@type][1].length > 0
|
if GameData::Weather.get(@type).has_tiles?
|
||||||
w = @weatherTypes[@type][1][0].width
|
w = @weatherTypes[@type][2][0].width
|
||||||
h = @weatherTypes[@type][1][0].height
|
h = @weatherTypes[@type][2][0].height
|
||||||
@tiles_wide = (Graphics.width.to_f / w).ceil + 1
|
@tiles_wide = (Graphics.width.to_f / w).ceil + 1
|
||||||
@tiles_tall = (Graphics.height.to_f / h).ceil + 1
|
@tiles_tall = (Graphics.height.to_f / h).ceil + 1
|
||||||
else
|
else
|
||||||
@@ -148,88 +141,24 @@ module RPG
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_weather_tone(weather_type, maximum)
|
def get_weather_tone(weather_type, maximum)
|
||||||
case weather_type
|
return GameData::Weather.get(weather_type).tone(maximum)
|
||||||
when PBFieldWeather::Rain
|
|
||||||
return Tone.new(-maximum * 3 / 4, -maximum * 3 / 4, -maximum * 3 / 4, 10)
|
|
||||||
when PBFieldWeather::HeavyRain
|
|
||||||
return Tone.new(-maximum * 6 / 4, -maximum * 6 / 4, -maximum * 6 / 4, 20)
|
|
||||||
when PBFieldWeather::Storm
|
|
||||||
return Tone.new(-maximum * 6 / 4, -maximum * 6 / 4, -maximum * 6 / 4, 20)
|
|
||||||
when PBFieldWeather::Snow
|
|
||||||
return Tone.new( maximum / 2, maximum / 2, maximum / 2, 0)
|
|
||||||
when PBFieldWeather::Blizzard
|
|
||||||
return Tone.new( maximum * 3 / 4, maximum * 3 / 4, maximum * 3 / 4, 0)
|
|
||||||
when PBFieldWeather::Sandstorm
|
|
||||||
return Tone.new( maximum / 2, 0, -maximum / 2, 0)
|
|
||||||
when PBFieldWeather::Sun
|
|
||||||
return Tone.new(64, 64, 32, 0)
|
|
||||||
end
|
|
||||||
return Tone.new(0, 0, 0, 0)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_bitmaps(new_type)
|
def prepare_bitmaps(new_type)
|
||||||
case new_type
|
weather_data = GameData::Weather.get(new_type)
|
||||||
when PBFieldWeather::Rain then prepareRainBitmaps
|
bitmap_names = weather_data.graphics
|
||||||
when PBFieldWeather::HeavyRain, PBFieldWeather::Storm then prepareStormBitmaps
|
@weatherTypes[new_type] = [weather_data, [], []]
|
||||||
when PBFieldWeather::Snow then prepareSnowBitmaps
|
for i in 0...2 # 0=particles, 1=tiles
|
||||||
when PBFieldWeather::Blizzard then prepareBlizzardBitmaps
|
next if !bitmap_names[i]
|
||||||
when PBFieldWeather::Sandstorm then prepareSandstormBitmaps
|
bitmap_names[i].each do |name|
|
||||||
when PBFieldWeather::Fog then prepareFogBitmaps
|
bitmap = RPG::Cache.load_bitmap("Graphics/Weather/", name)
|
||||||
|
@weatherTypes[new_type][i + 1].push(bitmap)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepareRainBitmaps
|
|
||||||
rain1 = RPG::Cache.load_bitmap("Graphics/Weather/", "rain_1")
|
|
||||||
rain2 = RPG::Cache.load_bitmap("Graphics/Weather/", "rain_2")
|
|
||||||
rain3 = RPG::Cache.load_bitmap("Graphics/Weather/", "rain_3")
|
|
||||||
rain4 = RPG::Cache.load_bitmap("Graphics/Weather/", "rain_4") # Splash
|
|
||||||
@weatherTypes[PBFieldWeather::Rain][0] = [rain1, rain2, rain3, rain4]
|
|
||||||
end
|
|
||||||
|
|
||||||
def prepareStormBitmaps
|
|
||||||
storm1 = RPG::Cache.load_bitmap("Graphics/Weather/", "storm_1")
|
|
||||||
storm2 = RPG::Cache.load_bitmap("Graphics/Weather/", "storm_2")
|
|
||||||
storm3 = RPG::Cache.load_bitmap("Graphics/Weather/", "storm_3")
|
|
||||||
storm4 = RPG::Cache.load_bitmap("Graphics/Weather/", "storm_4") # Splash
|
|
||||||
@weatherTypes[PBFieldWeather::HeavyRain][0] = [storm1, storm2, storm3, storm4]
|
|
||||||
@weatherTypes[PBFieldWeather::Storm][0] = [storm1, storm2, storm3, storm4]
|
|
||||||
end
|
|
||||||
|
|
||||||
def prepareSnowBitmaps
|
|
||||||
hail1 = RPG::Cache.load_bitmap("Graphics/Weather/", "hail_1")
|
|
||||||
hail2 = RPG::Cache.load_bitmap("Graphics/Weather/", "hail_2")
|
|
||||||
hail3 = RPG::Cache.load_bitmap("Graphics/Weather/", "hail_3")
|
|
||||||
@weatherTypes[PBFieldWeather::Snow][0] = [hail1, hail2, hail3]
|
|
||||||
end
|
|
||||||
|
|
||||||
def prepareBlizzardBitmaps
|
|
||||||
blizzard1 = RPG::Cache.load_bitmap("Graphics/Weather/", "blizzard_1")
|
|
||||||
blizzard2 = RPG::Cache.load_bitmap("Graphics/Weather/", "blizzard_2")
|
|
||||||
blizzard3 = RPG::Cache.load_bitmap("Graphics/Weather/", "blizzard_3")
|
|
||||||
blizzard4 = RPG::Cache.load_bitmap("Graphics/Weather/", "blizzard_4")
|
|
||||||
@weatherTypes[PBFieldWeather::Blizzard][0] = [blizzard1, blizzard2, blizzard3, blizzard4]
|
|
||||||
blizzard_tile = RPG::Cache.load_bitmap("Graphics/Weather/", "blizzard_tile")
|
|
||||||
@weatherTypes[PBFieldWeather::Blizzard][1] = [blizzard_tile]
|
|
||||||
end
|
|
||||||
|
|
||||||
def prepareSandstormBitmaps
|
|
||||||
sandstorm1 = RPG::Cache.load_bitmap("Graphics/Weather/", "sandstorm_1")
|
|
||||||
sandstorm2 = RPG::Cache.load_bitmap("Graphics/Weather/", "sandstorm_2")
|
|
||||||
sandstorm3 = RPG::Cache.load_bitmap("Graphics/Weather/", "sandstorm_3")
|
|
||||||
sandstorm4 = RPG::Cache.load_bitmap("Graphics/Weather/", "sandstorm_4")
|
|
||||||
@weatherTypes[PBFieldWeather::Sandstorm][0] = [sandstorm1, sandstorm2, sandstorm3, sandstorm4]
|
|
||||||
sandstorm_tile = RPG::Cache.load_bitmap("Graphics/Weather/", "sandstorm_tile")
|
|
||||||
@weatherTypes[PBFieldWeather::Sandstorm][1] = [sandstorm_tile]
|
|
||||||
end
|
|
||||||
|
|
||||||
def prepareFogBitmaps
|
|
||||||
fog_tile = RPG::Cache.load_bitmap("Graphics/Weather/", "fog_tile")
|
|
||||||
@weatherTypes[PBFieldWeather::Fog][1] = [fog_tile]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensureSprites
|
def ensureSprites
|
||||||
if @sprites.length < MAX_SPRITES && @weatherTypes[@type] &&
|
if @sprites.length < MAX_SPRITES && @weatherTypes[@type] && @weatherTypes[@type][1].length > 0
|
||||||
@weatherTypes[@type][0] && @weatherTypes[@type][0].length > 0
|
|
||||||
for i in 0...MAX_SPRITES
|
for i in 0...MAX_SPRITES
|
||||||
if !@sprites[i]
|
if !@sprites[i]
|
||||||
sprite = Sprite.new(@origViewport)
|
sprite = Sprite.new(@origViewport)
|
||||||
@@ -244,7 +173,7 @@ module RPG
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if @fading && @new_sprites.length < MAX_SPRITES && @weatherTypes[@target_type] &&
|
if @fading && @new_sprites.length < MAX_SPRITES && @weatherTypes[@target_type] &&
|
||||||
@weatherTypes[@target_type][0] && @weatherTypes[@target_type][0].length > 0
|
@weatherTypes[@target_type][1].length > 0
|
||||||
for i in 0...MAX_SPRITES
|
for i in 0...MAX_SPRITES
|
||||||
if !@new_sprites[i]
|
if !@new_sprites[i]
|
||||||
sprite = Sprite.new(@origViewport)
|
sprite = Sprite.new(@origViewport)
|
||||||
@@ -277,14 +206,13 @@ module RPG
|
|||||||
|
|
||||||
def set_sprite_bitmap(sprite, index, weather_type)
|
def set_sprite_bitmap(sprite, index, weather_type)
|
||||||
return if !sprite
|
return if !sprite
|
||||||
weatherBitmaps = (@weatherTypes[weather_type]) ? @weatherTypes[weather_type][0] : nil
|
weatherBitmaps = (@weatherTypes[weather_type]) ? @weatherTypes[weather_type][1] : nil
|
||||||
if !weatherBitmaps || weatherBitmaps.length == 0
|
if !weatherBitmaps || weatherBitmaps.length == 0
|
||||||
sprite.bitmap = nil
|
sprite.bitmap = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
case weather_type
|
if @weatherTypes[weather_type][0].category == :Rain
|
||||||
when PBFieldWeather::Rain, PBFieldWeather::HeavyRain, PBFieldWeather::Storm
|
last_index = weatherBitmaps.length - 1 # Last sprite is a splash
|
||||||
last_index = weatherBitmaps.length - 1 # Last sprite is splash
|
|
||||||
if (index % 2) == 0
|
if (index % 2) == 0
|
||||||
sprite.bitmap = weatherBitmaps[index % last_index]
|
sprite.bitmap = weatherBitmaps[index % last_index]
|
||||||
else
|
else
|
||||||
@@ -297,7 +225,7 @@ module RPG
|
|||||||
|
|
||||||
def set_tile_bitmap(sprite, index, weather_type)
|
def set_tile_bitmap(sprite, index, weather_type)
|
||||||
return if !sprite || !weather_type
|
return if !sprite || !weather_type
|
||||||
weatherBitmaps = (@weatherTypes[weather_type]) ? @weatherTypes[weather_type][1] : nil
|
weatherBitmaps = (@weatherTypes[weather_type]) ? @weatherTypes[weather_type][2] : nil
|
||||||
if weatherBitmaps && weatherBitmaps.length > 0
|
if weatherBitmaps && weatherBitmaps.length > 0
|
||||||
sprite.bitmap = weatherBitmaps[index % weatherBitmaps.length]
|
sprite.bitmap = weatherBitmaps[index % weatherBitmaps.length]
|
||||||
else
|
else
|
||||||
@@ -315,25 +243,26 @@ module RPG
|
|||||||
lifetimes[index] = 0
|
lifetimes[index] = 0
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if [PBFieldWeather::Rain, PBFieldWeather::HeavyRain,
|
if @weatherTypes[weather_type][0].category == :Rain && (index % 2) != 0 # Splash
|
||||||
PBFieldWeather::Storm].include?(weather_type) && (index % 2) != 0 # Splash
|
|
||||||
sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width * 2)
|
sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width * 2)
|
||||||
sprite.y = @oy - sprite.bitmap.height + rand(Graphics.height + sprite.bitmap.height * 2)
|
sprite.y = @oy - sprite.bitmap.height + rand(Graphics.height + sprite.bitmap.height * 2)
|
||||||
lifetimes[index] = (30 + rand(20)) * 0.01 # 0.3-0.5 seconds
|
lifetimes[index] = (30 + rand(20)) * 0.01 # 0.3-0.5 seconds
|
||||||
else
|
else
|
||||||
gradient = @weatherTypes[weather_type][2].to_f / @weatherTypes[weather_type][3]
|
x_speed = @weatherTypes[weather_type][0].particle_delta_x
|
||||||
|
y_speed = @weatherTypes[weather_type][0].particle_delta_y
|
||||||
|
gradient = x_speed.to_f / y_speed
|
||||||
if gradient.abs >= 1
|
if gradient.abs >= 1
|
||||||
# Position sprite to the right of the screen
|
# Position sprite to the right of the screen
|
||||||
sprite.x = @ox + Graphics.width + rand(Graphics.width)
|
sprite.x = @ox + Graphics.width + rand(Graphics.width)
|
||||||
sprite.y = @oy + Graphics.height - rand(Graphics.height + sprite.bitmap.height - Graphics.width / gradient)
|
sprite.y = @oy + Graphics.height - rand(Graphics.height + sprite.bitmap.height - Graphics.width / gradient)
|
||||||
distance_to_cover = sprite.x - @ox - Graphics.width / 2 + sprite.bitmap.width + rand(Graphics.width * 8 / 5)
|
distance_to_cover = sprite.x - @ox - Graphics.width / 2 + sprite.bitmap.width + rand(Graphics.width * 8 / 5)
|
||||||
lifetimes[index] = (distance_to_cover.to_f / @weatherTypes[weather_type][2]).abs
|
lifetimes[index] = (distance_to_cover.to_f / x_speed).abs
|
||||||
else
|
else
|
||||||
# Position sprite to the top of the screen
|
# Position sprite to the top of the screen
|
||||||
sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width - gradient * Graphics.height)
|
sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width - gradient * Graphics.height)
|
||||||
sprite.y = @oy - sprite.bitmap.height - rand(Graphics.height)
|
sprite.y = @oy - sprite.bitmap.height - rand(Graphics.height)
|
||||||
distance_to_cover = @oy - sprite.y + Graphics.height / 2 + rand(Graphics.height * 8 / 5)
|
distance_to_cover = @oy - sprite.y + Graphics.height / 2 + rand(Graphics.height * 8 / 5)
|
||||||
lifetimes[index] = (distance_to_cover.to_f / @weatherTypes[weather_type][3]).abs
|
lifetimes[index] = (distance_to_cover.to_f / y_speed).abs
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
sprite.opacity = 255
|
sprite.opacity = 255
|
||||||
@@ -353,20 +282,19 @@ module RPG
|
|||||||
# Determine which weather type this sprite is representing
|
# Determine which weather type this sprite is representing
|
||||||
weather_type = (is_new_sprite) ? @target_type : @type
|
weather_type = (is_new_sprite) ? @target_type : @type
|
||||||
# Update visibility/position/opacity of sprite
|
# Update visibility/position/opacity of sprite
|
||||||
if [PBFieldWeather::Rain, PBFieldWeather::HeavyRain,
|
if @weatherTypes[weather_type][0].category == :Rain && (index % 2) != 0 # Splash
|
||||||
PBFieldWeather::Storm].include?(weather_type) && (index % 2) != 0 # Splash
|
|
||||||
sprite.opacity = (lifetimes[index] < 0.2) ? 255 : 0 # 0.2 seconds
|
sprite.opacity = (lifetimes[index] < 0.2) ? 255 : 0 # 0.2 seconds
|
||||||
else
|
else
|
||||||
dist_x = @weatherTypes[weather_type][2] * delta_t
|
dist_x = @weatherTypes[weather_type][0].particle_delta_x * delta_t
|
||||||
dist_y = @weatherTypes[weather_type][3] * delta_t
|
dist_y = @weatherTypes[weather_type][0].particle_delta_y * delta_t
|
||||||
sprite.x += dist_x
|
sprite.x += dist_x
|
||||||
sprite.y += dist_y
|
sprite.y += dist_y
|
||||||
if weather_type == PBFieldWeather::Snow
|
if weather_type == :Snow
|
||||||
sprite.x += dist_x * (sprite.y - @oy) / (Graphics.height * 3) # Faster when further down screen
|
sprite.x += dist_x * (sprite.y - @oy) / (Graphics.height * 3) # Faster when further down screen
|
||||||
sprite.x += [2, 1, 0, -1][rand(4)] * dist_x / 8 # Random movement
|
sprite.x += [2, 1, 0, -1][rand(4)] * dist_x / 8 # Random movement
|
||||||
sprite.y += [2, 1, 1, 0, 0, -1][index % 6] * dist_y / 10 # Variety
|
sprite.y += [2, 1, 1, 0, 0, -1][index % 6] * dist_y / 10 # Variety
|
||||||
end
|
end
|
||||||
sprite.opacity += @weatherTypes[weather_type][4] * delta_t
|
sprite.opacity += @weatherTypes[weather_type][0].particle_delta_opacity * delta_t
|
||||||
x = sprite.x - @ox
|
x = sprite.x - @ox
|
||||||
y = sprite.y - @oy
|
y = sprite.y - @oy
|
||||||
# Check if sprite is off-screen; if so, reset it
|
# Check if sprite is off-screen; if so, reset it
|
||||||
@@ -382,13 +310,13 @@ module RPG
|
|||||||
if @fading && @fade_time >= [FADE_OLD_TONE_END - @time_shift, 0].max
|
if @fading && @fade_time >= [FADE_OLD_TONE_END - @time_shift, 0].max
|
||||||
weather_type = @target_type
|
weather_type = @target_type
|
||||||
end
|
end
|
||||||
@tile_x += @weatherTypes[weather_type][5] * delta_t
|
@tile_x += @weatherTypes[weather_type][0].tile_delta_x * delta_t
|
||||||
@tile_y += @weatherTypes[weather_type][6] * delta_t
|
@tile_y += @weatherTypes[weather_type][0].tile_delta_y * delta_t
|
||||||
if @tile_x < -@tiles_wide * @weatherTypes[weather_type][1][0].width
|
if @tile_x < -@tiles_wide * @weatherTypes[weather_type][2][0].width
|
||||||
@tile_x += @tiles_wide * @weatherTypes[weather_type][1][0].width
|
@tile_x += @tiles_wide * @weatherTypes[weather_type][2][0].width
|
||||||
end
|
end
|
||||||
if @tile_y > @tiles_tall * @weatherTypes[weather_type][1][0].height
|
if @tile_y > @tiles_tall * @weatherTypes[weather_type][2][0].height
|
||||||
@tile_y -= @tiles_tall * @weatherTypes[weather_type][1][0].height
|
@tile_y -= @tiles_tall * @weatherTypes[weather_type][2][0].height
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -472,11 +400,11 @@ module RPG
|
|||||||
tone_gray = base_tone.gray
|
tone_gray = base_tone.gray
|
||||||
end
|
end
|
||||||
# Modify base tone
|
# Modify base tone
|
||||||
if weather_type == PBFieldWeather::Sun
|
if weather_type == :Sun
|
||||||
@sun_magnitude = weather_max if @sun_magnitude != weather_max && @sun_magnitude != -weather_max
|
@sun_magnitude = weather_max if @sun_magnitude != weather_max && @sun_magnitude != -weather_max
|
||||||
@sun_magnitude *= -1 if (@sun_magnitude > 0 && @sun_strength > @sun_magnitude) ||
|
@sun_magnitude *= -1 if (@sun_magnitude > 0 && @sun_strength > @sun_magnitude) ||
|
||||||
(@sun_magnitude < 0 && @sun_strength < 0)
|
(@sun_magnitude < 0 && @sun_strength < 0)
|
||||||
@sun_strength += @sun_magnitude.to_f * Graphics.delta_s * 0.4 # 0.4 seconds
|
@sun_strength += @sun_magnitude.to_f * Graphics.delta_s / 0.4 # 0.4 seconds per half flash
|
||||||
tone_red += @sun_strength
|
tone_red += @sun_strength
|
||||||
tone_green += @sun_strength
|
tone_green += @sun_strength
|
||||||
tone_blue += @sun_strength / 2
|
tone_blue += @sun_strength / 2
|
||||||
@@ -495,9 +423,9 @@ module RPG
|
|||||||
tile_change_threshold = [FADE_OLD_TONE_END - @time_shift, 0].max
|
tile_change_threshold = [FADE_OLD_TONE_END - @time_shift, 0].max
|
||||||
if old_fade_time <= tile_change_threshold && @fade_time > tile_change_threshold
|
if old_fade_time <= tile_change_threshold && @fade_time > tile_change_threshold
|
||||||
@tile_x = @tile_y = 0.0
|
@tile_x = @tile_y = 0.0
|
||||||
if @weatherTypes[@target_type] && @weatherTypes[@target_type][1] && @weatherTypes[@target_type][1].length > 0
|
if @weatherTypes[@target_type] && @weatherTypes[@target_type][2].length > 0
|
||||||
w = @weatherTypes[@target_type][1][0].width
|
w = @weatherTypes[@target_type][2][0].width
|
||||||
h = @weatherTypes[@target_type][1][0].height
|
h = @weatherTypes[@target_type][2][0].height
|
||||||
@tiles_wide = (Graphics.width.to_f / w).ceil + 1
|
@tiles_wide = (Graphics.width.to_f / w).ceil + 1
|
||||||
@tiles_tall = (Graphics.height.to_f / h).ceil + 1
|
@tiles_tall = (Graphics.height.to_f / h).ceil + 1
|
||||||
ensureTiles
|
ensureTiles
|
||||||
@@ -521,7 +449,7 @@ module RPG
|
|||||||
@new_sprites.each_with_index { |sprite, i| sprite.visible = (i < @new_max) if sprite }
|
@new_sprites.each_with_index { |sprite, i| sprite.visible = (i < @new_max) if sprite }
|
||||||
end
|
end
|
||||||
# End fading
|
# End fading
|
||||||
if @fade_time >= ((@target_type == PBFieldWeather::None) ? FADE_OLD_PARTICLES_END : FADE_NEW_TILES_END) - @time_shift
|
if @fade_time >= ((@target_type == :None) ? FADE_OLD_PARTICLES_END : FADE_NEW_TILES_END) - @time_shift
|
||||||
if !@sprites.any? { |sprite| sprite.visible }
|
if !@sprites.any? { |sprite| sprite.visible }
|
||||||
@type = @target_type
|
@type = @target_type
|
||||||
@max = @target_max
|
@max = @target_max
|
||||||
@@ -547,7 +475,7 @@ module RPG
|
|||||||
update_fading
|
update_fading
|
||||||
update_screen_tone
|
update_screen_tone
|
||||||
# Storm flashes
|
# Storm flashes
|
||||||
if @type == PBFieldWeather::Storm && !@fading
|
if @type == :Storm && !@fading
|
||||||
if @time_until_flash > 0
|
if @time_until_flash > 0
|
||||||
@time_until_flash -= Graphics.delta_s
|
@time_until_flash -= Graphics.delta_s
|
||||||
if @time_until_flash <= 0
|
if @time_until_flash <= 0
|
||||||
@@ -560,7 +488,7 @@ module RPG
|
|||||||
end
|
end
|
||||||
@viewport.update
|
@viewport.update
|
||||||
# Update weather particles (raindrops, snowflakes, etc.)
|
# Update weather particles (raindrops, snowflakes, etc.)
|
||||||
if @weatherTypes[@type] && @weatherTypes[@type][0] && @weatherTypes[@type][0].length > 0
|
if @weatherTypes[@type] && @weatherTypes[@type][1].length > 0
|
||||||
ensureSprites
|
ensureSprites
|
||||||
for i in 0...MAX_SPRITES
|
for i in 0...MAX_SPRITES
|
||||||
update_sprite_position(@sprites[i], i, false)
|
update_sprite_position(@sprites[i], i, false)
|
||||||
@@ -570,7 +498,7 @@ module RPG
|
|||||||
@sprites.clear
|
@sprites.clear
|
||||||
end
|
end
|
||||||
# Update new weather particles (while fading in only)
|
# Update new weather particles (while fading in only)
|
||||||
if @fading && @weatherTypes[@target_type] && @weatherTypes[@target_type][0] && @weatherTypes[@target_type][0].length > 0
|
if @fading && @weatherTypes[@target_type] && @weatherTypes[@target_type][1].length > 0
|
||||||
ensureSprites
|
ensureSprites
|
||||||
for i in 0...MAX_SPRITES
|
for i in 0...MAX_SPRITES
|
||||||
update_sprite_position(@new_sprites[i], i, true)
|
update_sprite_position(@new_sprites[i], i, true)
|
||||||
|
|||||||
@@ -110,14 +110,14 @@ def pbPrepareBattle(battle)
|
|||||||
battle.defaultTerrain = battleRules["defaultTerrain"] if !battleRules["defaultTerrain"].nil?
|
battle.defaultTerrain = battleRules["defaultTerrain"] if !battleRules["defaultTerrain"].nil?
|
||||||
# Weather
|
# Weather
|
||||||
if battleRules["defaultWeather"].nil?
|
if battleRules["defaultWeather"].nil?
|
||||||
case $game_screen.weather_type
|
case GameData::Weather.get($game_screen.weather_type).category
|
||||||
when PBFieldWeather::Rain, PBFieldWeather::HeavyRain, PBFieldWeather::Storm
|
when :Rain
|
||||||
battle.defaultWeather = :Rain
|
battle.defaultWeather = :Rain
|
||||||
when PBFieldWeather::Snow, PBFieldWeather::Blizzard
|
when :Hail
|
||||||
battle.defaultWeather = :Hail
|
battle.defaultWeather = :Hail
|
||||||
when PBFieldWeather::Sandstorm
|
when :Sandstorm
|
||||||
battle.defaultWeather = :Sandstorm
|
battle.defaultWeather = :Sandstorm
|
||||||
when PBFieldWeather::Sun
|
when :Sun
|
||||||
battle.defaultWeather = :Sun
|
battle.defaultWeather = :Sun
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -138,13 +138,12 @@ class PokemonEncounters
|
|||||||
encounter_chance /= 2
|
encounter_chance /= 2
|
||||||
min_steps_needed *= 2
|
min_steps_needed *= 2
|
||||||
when :SNOWCLOAK
|
when :SNOWCLOAK
|
||||||
if $game_screen.weather_type == PBFieldWeather::Snow ||
|
if GameData::Weather.get($game_screen.weather_type).category == :Hail
|
||||||
$game_screen.weather_type == PBFieldWeather::Blizzard
|
|
||||||
encounter_chance /= 2
|
encounter_chance /= 2
|
||||||
min_steps_needed *= 2
|
min_steps_needed *= 2
|
||||||
end
|
end
|
||||||
when :SANDVEIL
|
when :SANDVEIL
|
||||||
if $game_screen.weather_type == PBFieldWeather::Sandstorm
|
if GameData::Weather.get($game_screen.weather_type).category == :Sandstorm
|
||||||
encounter_chance /= 2
|
encounter_chance /= 2
|
||||||
min_steps_needed *= 2
|
min_steps_needed *= 2
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -805,7 +805,7 @@ HiddenMoveHandlers::UseMove.add(:SURF,proc { |move,pokemon|
|
|||||||
# Sweet Scent
|
# Sweet Scent
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbSweetScent
|
def pbSweetScent
|
||||||
if $game_screen.weather_type!=PBFieldWeather::None
|
if $game_screen.weather_type != :None
|
||||||
pbMessage(_INTL("The sweet scent faded for some reason..."))
|
pbMessage(_INTL("The sweet scent faded for some reason..."))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -223,18 +223,12 @@ class BerryPlantSprite
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Check auto-watering
|
# If raining, automatically water the plant
|
||||||
if berryData[0]>0 && berryData[0]<5
|
if berryData[0] > 0 && berryData[0] < 5 && $game_screen &&
|
||||||
# Reset watering
|
GameData::Weather.get($game_screen.weather_type).category == :Rain
|
||||||
if $game_screen &&
|
if berryData[2] == false
|
||||||
($game_screen.weather_type==PBFieldWeather::Rain ||
|
berryData[2] = true
|
||||||
$game_screen.weather_type==PBFieldWeather::HeavyRain ||
|
berryData[4] += 1
|
||||||
$game_screen.weather_type==PBFieldWeather::Storm)
|
|
||||||
# If raining, plant is already watered
|
|
||||||
if berryData[2]==false
|
|
||||||
berryData[2]=true
|
|
||||||
berryData[4]+=1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -747,24 +747,26 @@ end
|
|||||||
|
|
||||||
module WeatherEffectProperty
|
module WeatherEffectProperty
|
||||||
def self.set(_settingname,oldsetting)
|
def self.set(_settingname,oldsetting)
|
||||||
|
oldsetting = [:None, 100] if !oldsetting
|
||||||
options = []
|
options = []
|
||||||
for i in 0..PBFieldWeather.maxValue
|
ids = []
|
||||||
options.push(getConstantName(PBFieldWeather,i) || "ERROR")
|
default = 0
|
||||||
|
GameData::Weather.each do |w|
|
||||||
|
default = ids.length if w.id == oldsetting[0]
|
||||||
|
options.push(w.real_name)
|
||||||
|
ids.push(w.id)
|
||||||
end
|
end
|
||||||
cmd = pbMessage(_INTL("Choose a weather effect."),options,1)
|
cmd = pbMessage(_INTL("Choose a weather effect."), options, -1, default)
|
||||||
if cmd==0
|
return nil if cmd < 0 || ids[cmd] == :None
|
||||||
return nil
|
|
||||||
else
|
|
||||||
params = ChooseNumberParams.new
|
params = ChooseNumberParams.new
|
||||||
params.setRange(0,100)
|
params.setRange(0, 100)
|
||||||
params.setDefaultValue((oldsetting) ? oldsetting[1] : 100)
|
params.setDefaultValue(oldsetting[1])
|
||||||
number = pbMessageChooseNumber(_INTL("Set the probability of the weather."),params)
|
number = pbMessageChooseNumber(_INTL("Set the probability of the weather."), params)
|
||||||
return [cmd,number]
|
return [ids[cmd], number]
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.format(value)
|
def self.format(value)
|
||||||
return (value) ? (getConstantName(PBFieldWeather,value[0]) || "ERROR")+",#{value[1]}" : "-"
|
return (value) ? GameData::Weather.get(value[0]).real_name + ",#{value[1]}" : "-"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user