mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-07-22 07:37:00 +00:00
Update 6.8
This commit is contained in:
@@ -81,7 +81,7 @@ module RPG
|
||||
new_type = GameData::Weather.get(new_type).id
|
||||
new_max = 0 if new_type == :None
|
||||
return if @type == new_type && @max == new_max
|
||||
set_fog(new_type)
|
||||
#set_fog(new_type)
|
||||
if duration > 0
|
||||
@target_type = new_type
|
||||
@target_max = new_max
|
||||
@@ -117,7 +117,7 @@ module RPG
|
||||
@fading = false
|
||||
end
|
||||
@type = type
|
||||
set_fog(type)
|
||||
#set_fog(type)
|
||||
prepare_bitmaps(@type)
|
||||
if GameData::Weather.get(@type).has_tiles?
|
||||
w = @weatherTypes[@type][2][0].width
|
||||
@@ -134,6 +134,7 @@ module RPG
|
||||
end
|
||||
|
||||
def set_fog(weather_type)
|
||||
# return #handled elsewhere
|
||||
weather = GameData::Weather.get(weather_type)
|
||||
return if weather.fog_name.nil?
|
||||
$game_map.fog_name = weather.fog_name
|
||||
@@ -144,6 +145,7 @@ module RPG
|
||||
|
||||
def set_max(value,weather_type)
|
||||
return if @max == value
|
||||
return if get_max_sprites(value,weather_type) <= 0
|
||||
value = value.clamp(0, get_max_sprites(value,weather_type))
|
||||
#echoln "[Weather] Setting max particles to #{value} for type #{@type}" if @max != value
|
||||
@max = value
|
||||
@@ -202,7 +204,7 @@ module RPG
|
||||
end
|
||||
end
|
||||
if @fading && @new_sprites.length < MAX_SPRITES && @weatherTypes[@target_type] &&
|
||||
@weatherTypes[@target_type][1].length > 0
|
||||
@weatherTypes[@target_type][1].length > 0
|
||||
for i in 0...MAX_SPRITES
|
||||
if !@new_sprites[i]
|
||||
sprite = Sprite.new(@origViewport)
|
||||
@@ -369,7 +371,7 @@ module RPG
|
||||
sprite.opacity = 255 * (1 - fraction)
|
||||
end
|
||||
elsif @fade_time >= [FADE_NEW_TILES_START - @time_shift, 0].max &&
|
||||
@fade_time < [FADE_NEW_TILES_END - @time_shift, 0].max
|
||||
@fade_time < [FADE_NEW_TILES_END - @time_shift, 0].max
|
||||
fraction = (@fade_time - [FADE_NEW_TILES_START - @time_shift, 0].max) / (FADE_NEW_TILES_END - FADE_NEW_TILES_START)
|
||||
sprite.opacity = 255 * fraction
|
||||
else
|
||||
@@ -393,7 +395,7 @@ module RPG
|
||||
if @fading
|
||||
if @type == @target_type # Just changing max
|
||||
if @fade_time >= [FADE_NEW_TONE_START - @time_shift, 0].max &&
|
||||
@fade_time < [FADE_NEW_TONE_END - @time_shift, 0].max
|
||||
@fade_time < [FADE_NEW_TONE_END - @time_shift, 0].max
|
||||
weather_max = @target_max
|
||||
fract = (@fade_time - [FADE_NEW_TONE_START - @time_shift, 0].max) / (FADE_NEW_TONE_END - FADE_NEW_TONE_START)
|
||||
tone_red = @target_tone.red + (1 - fract) * (@old_tone.red - @target_tone.red)
|
||||
@@ -434,7 +436,7 @@ module RPG
|
||||
if weather_type == :Sun
|
||||
@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 < 0 && @sun_strength < 0)
|
||||
(@sun_magnitude < 0 && @sun_strength < 0)
|
||||
@sun_strength += @sun_magnitude.to_f * Graphics.delta_s / 0.4 # 0.4 seconds per half flash
|
||||
tone_red += @sun_strength
|
||||
tone_green += @sun_strength
|
||||
@@ -510,7 +512,7 @@ module RPG
|
||||
if @time_until_flash > 0
|
||||
@time_until_flash -= Graphics.delta_s
|
||||
if @time_until_flash <= 0
|
||||
@viewport.flash(Color.new(255, 255, 255, 230), (2 + rand(3)) * 20)
|
||||
@viewport.flash(Color.new(255, 255, 255, 80), (2 + rand(3)) * 20)
|
||||
if rand < 0.1
|
||||
@lightning_overlay.opacity = 255
|
||||
@lightning_overlay_duration = 20 # Lasts ~10 frames
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#===============================================================================
|
||||
class LocationWindow
|
||||
def initialize(name)
|
||||
name = format_location_name(name)
|
||||
@window = Window_AdvancedTextPokemon.new(name)
|
||||
@window.resizeToFit(name,Graphics.width)
|
||||
@window.x = 0
|
||||
@@ -11,8 +12,25 @@ class LocationWindow
|
||||
@window.viewport.z = 99999
|
||||
@currentmap = $game_map.map_id
|
||||
@frames = 0
|
||||
@close_automatically = true
|
||||
end
|
||||
|
||||
#Everything between parentheses gets ignored
|
||||
def format_location_name(name)
|
||||
name = _INTL(name.to_s)
|
||||
formatted = name.split(" (")
|
||||
return formatted[0]
|
||||
end
|
||||
|
||||
def set_close_automatically(value)
|
||||
@close_automatically = value
|
||||
end
|
||||
def text=(text)
|
||||
@window.text = text
|
||||
end
|
||||
def text
|
||||
return @window.text
|
||||
end
|
||||
def disposed?
|
||||
@window.disposed?
|
||||
end
|
||||
@@ -28,7 +46,7 @@ class LocationWindow
|
||||
@window.dispose
|
||||
return
|
||||
end
|
||||
if @frames > Graphics.frame_rate * 2
|
||||
if @frames > Graphics.frame_rate * 2 && @close_automatically
|
||||
@window.y -= 4
|
||||
@window.dispose if @window.y+@window.height<0
|
||||
else
|
||||
|
||||
+73
-45
@@ -3,14 +3,14 @@
|
||||
#===============================================================================
|
||||
def pbCaveEntranceEx(exiting)
|
||||
# Create bitmap
|
||||
sprite = BitmapSprite.new(Graphics.width,Graphics.height)
|
||||
sprite = BitmapSprite.new(Graphics.width, Graphics.height)
|
||||
sprite.z = 100000
|
||||
# Define values used for the animation
|
||||
totalFrames = (Graphics.frame_rate*0.4).floor
|
||||
increment = (255.0/totalFrames).ceil
|
||||
totalFrames = (Graphics.frame_rate * 0.4).floor
|
||||
increment = (255.0 / totalFrames).ceil
|
||||
totalBands = 15
|
||||
bandheight = ((Graphics.height/2.0)-10)/totalBands
|
||||
bandwidth = ((Graphics.width/2.0)-12)/totalBands
|
||||
bandheight = ((Graphics.height / 2.0) - 10) / totalBands
|
||||
bandwidth = ((Graphics.width / 2.0) - 12) / totalBands
|
||||
# Create initial array of band colors (black if exiting, white if entering)
|
||||
grays = Array.new(totalBands) { |i| (exiting) ? 0 : 255 }
|
||||
# Animate bands changing color
|
||||
@@ -19,47 +19,47 @@ def pbCaveEntranceEx(exiting)
|
||||
y = 0
|
||||
# Calculate color of each band
|
||||
for k in 0...totalBands
|
||||
next if k>=totalBands*j/totalFrames
|
||||
next if k >= totalBands * j / totalFrames
|
||||
inc = increment
|
||||
inc *= -1 if exiting
|
||||
grays[k] -= inc
|
||||
grays[k] = 0 if grays[k]<0
|
||||
grays[k] = 0 if grays[k] < 0
|
||||
end
|
||||
# Draw gray rectangles
|
||||
rectwidth = Graphics.width
|
||||
rectwidth = Graphics.width
|
||||
rectheight = Graphics.height
|
||||
for i in 0...totalBands
|
||||
currentGray = grays[i]
|
||||
sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),
|
||||
Color.new(currentGray,currentGray,currentGray))
|
||||
sprite.bitmap.fill_rect(Rect.new(x, y, rectwidth, rectheight),
|
||||
Color.new(currentGray, currentGray, currentGray))
|
||||
x += bandwidth
|
||||
y += bandheight
|
||||
rectwidth -= bandwidth*2
|
||||
rectheight -= bandheight*2
|
||||
rectwidth -= bandwidth * 2
|
||||
rectheight -= bandheight * 2
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
# Set the tone at end of band animation
|
||||
if exiting
|
||||
pbToneChangeAll(Tone.new(255,255,255),0)
|
||||
pbToneChangeAll(Tone.new(255, 255, 255), 0)
|
||||
else
|
||||
pbToneChangeAll(Tone.new(-255,-255,-255),0)
|
||||
pbToneChangeAll(Tone.new(-255, -255, -255), 0)
|
||||
end
|
||||
# Animate fade to white (if exiting) or black (if entering)
|
||||
for j in 0...totalFrames
|
||||
if exiting
|
||||
sprite.color = Color.new(255,255,255,j*increment)
|
||||
sprite.color = Color.new(255, 255, 255, j * increment)
|
||||
else
|
||||
sprite.color = Color.new(0,0,0,j*increment)
|
||||
sprite.color = Color.new(0, 0, 0, j * increment)
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
# Set the tone at end of fading animation
|
||||
pbToneChangeAll(Tone.new(0,0,0),8)
|
||||
pbToneChangeAll(Tone.new(0, 0, 0), 8)
|
||||
# Pause briefly
|
||||
(Graphics.frame_rate/10).times do
|
||||
(Graphics.frame_rate / 10).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
end
|
||||
@@ -76,25 +76,41 @@ def pbCaveExit
|
||||
pbCaveEntranceEx(true)
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Blacking out animation
|
||||
#===============================================================================
|
||||
def pbStartOver(gameover=false)
|
||||
$game_variables[VAR_CURRENT_GYM_TYPE]=-1
|
||||
$game_switches[SWITCH_LOCK_PLAYER_MOVEMENT]=false
|
||||
$game_switches[SWITCH_TEAMED_WITH_ERIKA_SEWERS]=false
|
||||
$PokemonTemp.enteredSecretBaseController=nil
|
||||
def handle_no_reviving_defeat
|
||||
pbMessage(_INTL("Your challenge options prevent you from reviving Pokémon, but you need to have at least one Pokémon in your party."))
|
||||
pbMessage(_INTL("The first Pokémon in your party will revived at 1 HP."))
|
||||
pokemon = $Trainer.party[0]
|
||||
$PokemonSystem.no_reviving = false
|
||||
pokemon.hp = 1
|
||||
$PokemonSystem.no_reviving = true
|
||||
end
|
||||
|
||||
def pbStartOver(gameover = false)
|
||||
$game_variables[VAR_CURRENT_GYM_TYPE] = -1
|
||||
$game_switches[SWITCH_LOCK_PLAYER_MOVEMENT] = false
|
||||
$game_switches[SWITCH_TEAMED_WITH_ERIKA_SEWERS] = false
|
||||
if $game_switches[SWITCH_WALLY_CATCHING_POKEMON] || $game_switches[SWITCH_WALLY_GAVE_POKEMON]
|
||||
$game_switches[SWITCH_DIED_WITH_WALLY] = true
|
||||
end
|
||||
pbBridgeOff
|
||||
$PokemonTemp.enteredSecretBaseController = nil
|
||||
clear_all_images()
|
||||
$game_player.set_opacity(255)
|
||||
$game_system.menu_disabled=false
|
||||
$game_system.menu_disabled = false
|
||||
|
||||
if pbInBugContest?
|
||||
pbBugContestStartOver
|
||||
return
|
||||
end
|
||||
$Trainer.heal_party
|
||||
|
||||
if $PokemonSystem.no_reviving
|
||||
handle_no_reviving_defeat
|
||||
else
|
||||
$Trainer.heal_party
|
||||
end
|
||||
if isOnPinkanIsland()
|
||||
if $game_switches[SWITCH_PINKAN_SIDE_POLICE]
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]Hey, are you okay over there? Let me take you back to the dock."))
|
||||
@@ -104,7 +120,7 @@ def pbStartOver(gameover=false)
|
||||
pinkanIslandWarpToStart()
|
||||
return
|
||||
end
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId >= 0
|
||||
if gameover
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back to a Pokémon Center."))
|
||||
else
|
||||
@@ -113,33 +129,45 @@ def pbStartOver(gameover=false)
|
||||
pbCancelVehicles
|
||||
pbRemoveDependencies
|
||||
$game_switches[Settings::STARTING_OVER_SWITCH] = true
|
||||
$game_temp.player_new_map_id = $PokemonGlobal.pokecenterMapId
|
||||
$game_temp.player_new_x = $PokemonGlobal.pokecenterX
|
||||
$game_temp.player_new_y = $PokemonGlobal.pokecenterY
|
||||
$game_temp.player_new_map_id = $PokemonGlobal.pokecenterMapId
|
||||
$game_temp.player_new_x = $PokemonGlobal.pokecenterX
|
||||
$game_temp.player_new_y = $PokemonGlobal.pokecenterY
|
||||
$game_temp.player_new_direction = $PokemonGlobal.pokecenterDirection
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
if $scene.is_a?(Scene_Map)
|
||||
$scene.transfer_player
|
||||
$scene.reset_map(false)
|
||||
end
|
||||
$game_map.refresh
|
||||
else
|
||||
homedata = GameData::Metadata.get.home
|
||||
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata",homedata[0]))
|
||||
if $DEBUG
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
|
||||
if Settings::HOENN
|
||||
if isPlayerMale
|
||||
homedata = [9, 12, 14, DIRECTION_DOWN]
|
||||
else
|
||||
homedata = [9, 22, 14, DIRECTION_DOWN]
|
||||
end
|
||||
$Trainer.heal_party
|
||||
return
|
||||
end
|
||||
if gameover
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back home."))
|
||||
else
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back home, protecting your exhausted Pokémon from any further harm..."))
|
||||
homedata = GameData::Metadata.get.home
|
||||
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata", homedata[0]))
|
||||
if $DEBUG
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.", homedata[0]))
|
||||
end
|
||||
$Trainer.heal_party
|
||||
return
|
||||
end
|
||||
if gameover
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back home."))
|
||||
else
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back home, protecting your exhausted Pokémon from any further harm..."))
|
||||
end
|
||||
end
|
||||
|
||||
if homedata
|
||||
pbCancelVehicles
|
||||
pbRemoveDependencies
|
||||
$game_switches[Settings::STARTING_OVER_SWITCH] = true
|
||||
$game_temp.player_new_map_id = homedata[0]
|
||||
$game_temp.player_new_x = homedata[1]
|
||||
$game_temp.player_new_y = homedata[2]
|
||||
$game_temp.player_new_map_id = homedata[0]
|
||||
$game_temp.player_new_x = homedata[1]
|
||||
$game_temp.player_new_y = homedata[2]
|
||||
$game_temp.player_new_direction = homedata[3]
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
$game_map.refresh
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
Events.onSpritesetCreate += proc { |_sender, e|
|
||||
next unless $game_weather
|
||||
spriteset = e[0]
|
||||
new_map_id = spriteset.map.map_id
|
||||
old_map_id = $Trainer.last_visited_map
|
||||
next unless isOutdoor(new_map_id)
|
||||
|
||||
old_w = old_map_id ? $game_weather.get_map_weather_type(old_map_id) : :None
|
||||
new_w = $game_weather.get_map_weather_type(new_map_id)
|
||||
|
||||
old_int = (old_w == :Fog) ? $game_weather.get_map_weather_intensity(old_map_id) : 0
|
||||
new_int = (new_w == :Fog) ? $game_weather.get_map_weather_intensity(new_map_id) : 0
|
||||
|
||||
if old_int > 0 || new_int > 0
|
||||
spriteset.fade_in_fog(old_int, new_int)
|
||||
end
|
||||
}
|
||||
|
||||
class Spriteset_Map
|
||||
alias fog_fade_init initialize
|
||||
def initialize(*args)
|
||||
@current_fog_opacity = 0 # Track locally to avoid connection stutter
|
||||
@fog_target_opacity = nil
|
||||
@fog_fade_speed = 0
|
||||
fog_fade_init(*args)
|
||||
end
|
||||
|
||||
def fade_in_fog(old_intensity, new_intensity)
|
||||
@fog_target_opacity = (new_intensity * 20).clamp(0, 255)
|
||||
@current_fog_opacity = (old_intensity * 20).clamp(0, 255)
|
||||
fog_weather = GameData::Weather.get(:Fog)
|
||||
@map.fog_name =fog_weather&.fog_name if @map.fog_name == "" && (new_intensity > 0 || old_intensity > 0)
|
||||
@map.fog_sx = fog_weather&.tile_delta_x
|
||||
@map.fog_sy = fog_weather&.tile_delta_y
|
||||
@fog_fade_speed = (@fog_target_opacity > @current_fog_opacity) ? 2 : -5
|
||||
@fog_target_opacity = nil if @current_fog_opacity == @fog_target_opacity
|
||||
end
|
||||
|
||||
alias fog_fade_update update
|
||||
def update
|
||||
update_fog_fade
|
||||
fog_fade_update
|
||||
|
||||
if @fog && (@fog_target_opacity != nil || @current_fog_opacity > 0)
|
||||
@fog.opacity = @current_fog_opacity
|
||||
end
|
||||
end
|
||||
|
||||
def update_fog_fade
|
||||
return if @fog_target_opacity.nil?
|
||||
if @current_fog_opacity < @fog_target_opacity
|
||||
@current_fog_opacity = [@current_fog_opacity + @fog_fade_speed, @fog_target_opacity].min
|
||||
elsif @current_fog_opacity > @fog_target_opacity
|
||||
@current_fog_opacity = [@current_fog_opacity + @fog_fade_speed, @fog_target_opacity].max
|
||||
end
|
||||
|
||||
if @current_fog_opacity == @fog_target_opacity
|
||||
if @current_fog_opacity == 0
|
||||
@map.fog_name = ""
|
||||
end
|
||||
@fog_target_opacity = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -150,7 +150,7 @@ Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||
if $scene.is_a?(Scene_Map)
|
||||
event.each_occupied_tile do |x, y|
|
||||
if $MapFactory.getTerrainTag(event.map.map_id, x, y, true).shows_grass_rustle
|
||||
$scene.spriteset.addUserAnimation(Settings::GRASS_ANIMATION_ID, x, y, true, 1)
|
||||
$scene.spriteset.addUserAnimation(Settings::GRASS_ANIMATION_ID, x, y, true, 1) unless event.floating
|
||||
end
|
||||
end
|
||||
if event == $game_player
|
||||
@@ -166,13 +166,23 @@ Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||
end
|
||||
}
|
||||
|
||||
# Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||
# event = e[0] # Get the event affected by field movement
|
||||
# return unless event == $game_player
|
||||
# currentTag = $game_player.pbTerrainTag
|
||||
# if currentTag.stairs
|
||||
# $PokemonSystem.runstyle=0
|
||||
# end
|
||||
# }
|
||||
|
||||
def isTerrainWaterfall(currentTag)
|
||||
return currentTag.waterfall_crest || currentTag.waterfall
|
||||
end
|
||||
|
||||
def isRepelActive()
|
||||
return false if $game_switches[SWITCH_USED_AN_INCENSE]
|
||||
return ($PokemonGlobal.repel > 0) || $PokemonTemp.pokeradar
|
||||
classic_pokeradar = $PokemonTemp.pokeradar && ! $PokemonSystem.overworld_encounters
|
||||
return ($PokemonGlobal.repel > 0) || classic_pokeradar
|
||||
end
|
||||
|
||||
def pbOnStepTaken(eventTriggered)
|
||||
@@ -206,18 +216,36 @@ def isFusionForced?
|
||||
end
|
||||
|
||||
def isFusedEncounter
|
||||
#return false if !$game_switches[SWITCH_FUSED_WILD_POKEMON]
|
||||
# return false if !$game_switches[SWITCH_FUSED_WILD_POKEMON]
|
||||
return false if $game_switches[SWITCH_RANDOM_WILD_TO_FUSION]
|
||||
return true if isFusionForced?()
|
||||
chance = pbGet(VAR_WILD_FUSION_RATE) == 0 ? 5 : pbGet(VAR_WILD_FUSION_RATE)
|
||||
return (rand(chance) == 0)
|
||||
end
|
||||
|
||||
def getEncounter(encounter_type)
|
||||
def generateWildEncounter(encounter_type)
|
||||
encounter = getRegularEncounter(encounter_type)
|
||||
return unless encounter
|
||||
if isFusedEncounter()
|
||||
encounter_fusedWith = getRegularEncounter(encounter_type)
|
||||
if encounter_fusedWith && (encounter[0] != encounter_fusedWith[0])
|
||||
encounter[0] = getFusionSpeciesSymbol(encounter[0], encounter_fusedWith[0])
|
||||
end
|
||||
end
|
||||
|
||||
if encounter[0].is_a?(Integer)
|
||||
encounter[0] = getSpecies(encounter[0])
|
||||
end
|
||||
$game_switches[SWITCH_FORCE_FUSE_NEXT_POKEMON] = false
|
||||
return encounter
|
||||
end
|
||||
|
||||
def getRegularEncounter(encounter_type)
|
||||
encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type)
|
||||
if $game_switches[SWITCH_RANDOM_WILD] #wild poke random activated
|
||||
if $game_switches[SWITCH_RANDOM_WILD] # wild poke random activated
|
||||
if $game_switches[SWITCH_WILD_RANDOM_GLOBAL] && encounter != nil
|
||||
encounter[0] = getRandomizedTo(encounter[0])
|
||||
dex_num = getRandomizedTo(encounter[0])
|
||||
encounter[0] = GameData::Species.get(dex_num).species
|
||||
end
|
||||
end
|
||||
return encounter
|
||||
@@ -230,22 +258,16 @@ def pbBattleOnStepTaken(repel_active)
|
||||
encounter_type = $PokemonEncounters.encounter_type
|
||||
return if !encounter_type
|
||||
return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active)
|
||||
return if $game_player.floating
|
||||
$PokemonTemp.encounterType = encounter_type
|
||||
encounter = generateWildEncounter(encounter_type)
|
||||
|
||||
encounter = getEncounter(encounter_type)
|
||||
if isFusedEncounter()
|
||||
encounter_fusedWith = getEncounter(encounter_type)
|
||||
if encounter[0] != encounter_fusedWith[0]
|
||||
encounter[0] = getFusionSpeciesSymbol(encounter[0], encounter_fusedWith[0])
|
||||
end
|
||||
if $PokemonSystem.overworld_encounters
|
||||
# single pokemon that spawns near player
|
||||
spawn_random_overworld_pokemon_group(encounter, 2, 1)
|
||||
return
|
||||
end
|
||||
|
||||
if encounter[0].is_a?(Integer)
|
||||
encounter[0] = getSpecies(encounter[0])
|
||||
end
|
||||
|
||||
$game_switches[SWITCH_FORCE_FUSE_NEXT_POKEMON] = false
|
||||
|
||||
encounter = EncounterModifier.trigger(encounter)
|
||||
if $PokemonEncounters.allow_encounter?(encounter, repel_active)
|
||||
if $PokemonEncounters.have_double_wild_battle?
|
||||
@@ -391,7 +413,9 @@ Events.onMapSceneChange += proc { |_sender, e|
|
||||
oldmapname = mapinfos[$PokemonGlobal.mapTrail[1]].name
|
||||
nosignpost = true if $game_map.name == oldmapname
|
||||
end
|
||||
scene.spriteset.addUserSprite(LocationWindow.new($game_map.name)) if !nosignpost
|
||||
nosignpost = true if $game_switches[SWITCH_AQUA_CAMP] #Camp is split between 2 maps. Don't want the window when in.
|
||||
scene.spriteset.addUserSprite(LocationWindow.new(pbGetMapNameFromId($game_map.map_id))) if !nosignpost
|
||||
scene.spriteset.addUserSprite(WeatherIcon.new) if !nosignpost
|
||||
end
|
||||
# Force cycling/walking
|
||||
if map_metadata && map_metadata.always_bicycle
|
||||
@@ -422,22 +446,21 @@ def pbFacingTileRegular(direction = nil, event = nil)
|
||||
return [$game_map.map_id, x + x_offset, y + y_offset]
|
||||
end
|
||||
|
||||
def pbEventNextToPlayer?(event,player)
|
||||
def pbEventNextToPlayer?(event, player)
|
||||
return false if !event || !player
|
||||
return false if $PokemonGlobal.sliding
|
||||
if event.x == player.x
|
||||
return event.y == player.y+1 || event.y == player.y-1
|
||||
return event.y == player.y + 1 || event.y == player.y - 1
|
||||
elsif event.y == player.y
|
||||
return event.x == player.x-1 || event.x == player.x+1
|
||||
return event.x == player.x - 1 || event.x == player.x + 1
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
# Returns whether event is in line with the player, is
|
||||
# within distance tiles of the player.
|
||||
def pbEventFacesPlayer?(event, player, distance)
|
||||
return pbEventNextToPlayer?(event,player) if distance == 0
|
||||
return pbEventNextToPlayer?(event, player) if distance == 0
|
||||
return false if !event || !player || distance < 0
|
||||
x_min = x_max = y_min = y_max = -1
|
||||
case event.direction
|
||||
@@ -471,6 +494,7 @@ end
|
||||
# Returns whether event is able to walk up to the player.
|
||||
def pbEventCanReachPlayer?(event, player, distance)
|
||||
return false if !pbEventFacesPlayer?(event, player, distance)
|
||||
return false if event.on_bridge && $PokemonGlobal.bridge <= 0
|
||||
delta_x = (event.direction == 6) ? 1 : (event.direction == 4) ? -1 : 0
|
||||
delta_y = (event.direction == 2) ? 1 : (event.direction == 8) ? -1 : 0
|
||||
case event.direction
|
||||
@@ -491,13 +515,54 @@ def pbEventCanReachPlayer?(event, player, distance)
|
||||
return true
|
||||
end
|
||||
|
||||
# Checks if an event is within a cone-shaped area in front of the player.
|
||||
# distance = max forward tiles to check.
|
||||
# spread = how wide the cone expands per tile (1 = triangle shape).
|
||||
# Checks if player is inside a cone-shaped area in front of the event.
|
||||
# distance = how far ahead the event can see
|
||||
# spread = how wide the cone opens per tile of distance (1 = narrow triangle)
|
||||
def pbPlayerInEventCone?(event, player, distance, spread = 1)
|
||||
return false if !event || !player || distance <= 0
|
||||
|
||||
ex = event.x; ey = event.y
|
||||
px = player.x; py = player.y
|
||||
|
||||
case event.direction
|
||||
when 2 # Event facing Down
|
||||
dy = py - ey
|
||||
return false if dy <= 0 || dy > distance
|
||||
side = (px - ex).abs
|
||||
return side <= dy * spread
|
||||
|
||||
when 8 # Facing Up
|
||||
dy = ey - py
|
||||
return false if dy <= 0 || dy > distance
|
||||
side = (px - ex).abs
|
||||
return side <= dy * spread
|
||||
|
||||
when 6 # Facing Right
|
||||
dx = px - ex
|
||||
return false if dx <= 0 || dx > distance
|
||||
side = (py - ey).abs
|
||||
return side <= dx * spread
|
||||
|
||||
when 4 # Facing Left
|
||||
dx = ex - px
|
||||
return false if dx <= 0 || dx > distance
|
||||
side = (py - ey).abs
|
||||
return side <= dx * spread
|
||||
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
# Returns whether the two events are standing next to each other and facing each
|
||||
# other.
|
||||
def pbFacingEachOther(event1, event2)
|
||||
return pbEventFacesPlayer?(event1, event2, 1) && pbEventFacesPlayer?(event2, event1, 1)
|
||||
end
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Audio playing
|
||||
#===============================================================================
|
||||
@@ -518,8 +583,11 @@ end
|
||||
|
||||
def pbAutoplayOnTransition
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
|
||||
if $PokemonGlobal.surfing && surfbgm
|
||||
pbBGMPlay(surfbgm)
|
||||
elsif $PokemonGlobal.boat
|
||||
pbBGMPlay("ship")
|
||||
else
|
||||
$game_map.autoplayAsCue
|
||||
end
|
||||
@@ -538,6 +606,7 @@ end
|
||||
# Event movement
|
||||
#===============================================================================
|
||||
module PBMoveRoute
|
||||
End = 0
|
||||
Down = 1
|
||||
Left = 2
|
||||
Right = 3
|
||||
@@ -583,6 +652,11 @@ module PBMoveRoute
|
||||
Blending = 43 # 1 param
|
||||
PlaySE = 44 # 1 param
|
||||
Script = 45 # 1 param
|
||||
PlayAnimation = 46 # 1 param
|
||||
FlyForward = 47 # 1 param
|
||||
SetFloatingOn = 48
|
||||
SetFloatingOff = 49
|
||||
|
||||
ScriptAsync = 101 # 1 param
|
||||
end
|
||||
|
||||
@@ -625,7 +699,7 @@ def pbMoveRoute(event, commands, waitComplete = false)
|
||||
end
|
||||
|
||||
def
|
||||
pbWait(numFrames)
|
||||
pbWait(numFrames)
|
||||
numFrames.times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -648,6 +722,48 @@ def pbLedge(_xOffset, _yOffset)
|
||||
return false
|
||||
end
|
||||
|
||||
def sitOnChair()
|
||||
|
||||
if $game_player.pbFacingTerrainTag.chair
|
||||
if $PokemonGlobal.bicycle
|
||||
bump_into_object
|
||||
else
|
||||
sit_on_chair()
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
def bikeOnFence()
|
||||
return unless $PokemonGlobal.bicycle
|
||||
return unless $game_player.pbFacingTerrainTag.acroBike
|
||||
if $game_player.pbFacingTerrainTag.acroBike
|
||||
pbSEPlay("Player jump")
|
||||
$game_player.through = true
|
||||
$game_player.jump_forward
|
||||
$game_player.through = false
|
||||
$PokemonGlobal.acroBike = true
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def hopOffFence
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
if $game_map.terrain_tag(x, y).acroBike && !$game_player.pbFacingTerrainTag.acroBike
|
||||
$PokemonTemp.surfJump = [x, y]
|
||||
if pbJumpToward(1, true)
|
||||
$game_map.autoplayAsCue
|
||||
$game_player.increase_steps
|
||||
result = $game_player.check_event_trigger_here([1, 2])
|
||||
pbOnStepTaken(result)
|
||||
$PokemonGlobal.acroBike = false
|
||||
end
|
||||
$PokemonTemp.surfJump = nil
|
||||
end
|
||||
end
|
||||
|
||||
def pbSlideOnIce
|
||||
return if !$game_player.pbTerrainTag.ice
|
||||
$PokemonGlobal.sliding = true
|
||||
@@ -835,7 +951,7 @@ end
|
||||
def pbItemBall(item, quantity = 1, item_name = "", canRandom = true)
|
||||
canRandom = false if !$game_switches[SWITCH_RANDOM_ITEMS_GENERAL]
|
||||
if canRandom && ($game_switches[SWITCH_RANDOM_FOUND_ITEMS] || $game_switches[SWITCH_RANDOM_FOUND_TMS])
|
||||
item = pbGetRandomItem(item) if canRandom #fait rien si pas activé
|
||||
item = pbGetRandomItem(item) if canRandom # fait rien si pas activé
|
||||
else
|
||||
item = GameData::Item.get(item)
|
||||
end
|
||||
@@ -844,7 +960,7 @@ def pbItemBall(item, quantity = 1, item_name = "", canRandom = true)
|
||||
pocket = item.pocket
|
||||
move = item.move
|
||||
if $PokemonBag.pbStoreItem(item, quantity) # If item can be picked up
|
||||
meName = (item.is_key_item?) ? _INTL("Key item get") : _INTL("Item get")
|
||||
meName = (item.is_key_item?) ? "Key item get" : "Item get"
|
||||
text_color = item.is_key_item? ? "\\c[3]" : "\\c[1]"
|
||||
|
||||
if item == :LEFTOVERS
|
||||
@@ -886,11 +1002,11 @@ end
|
||||
#===============================================================================
|
||||
|
||||
def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom = true)
|
||||
#item_name -> pour donner un autre nom à l'item. Pas encore réimplémenté et surtout là pour éviter que ça plante quand des events essaient de le faire
|
||||
# item_name -> pour donner un autre nom à l'item. Pas encore réimplémenté et surtout là pour éviter que ça plante quand des events essaient de le faire
|
||||
canRandom = false if !$game_switches[SWITCH_RANDOM_ITEMS_GENERAL]
|
||||
original_item = GameData::Item.get(item)
|
||||
if canRandom && ((!original_item.is_TM? && $game_switches[SWITCH_RANDOM_GIVEN_ITEMS]) || (original_item.is_TM? && $game_switches[SWITCH_RANDOM_GIVEN_TMS]))
|
||||
item = pbGetRandomItem(item) if canRandom #fait rien si pas activé
|
||||
item = pbGetRandomItem(item) if canRandom # fait rien si pas activé
|
||||
else
|
||||
item = GameData::Item.get(item)
|
||||
end
|
||||
@@ -907,7 +1023,7 @@ def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom = t
|
||||
itemname = (quantity > 1) ? item.name_plural : item.name
|
||||
pocket = item.pocket
|
||||
move = item.move
|
||||
meName = (item.is_key_item?) ? _INTL("Key item get") : _INTL("Item get")
|
||||
meName = (item.is_key_item?) ? "Key item get" : "Item get"
|
||||
text_color = item.is_key_item? ? "\\c[3]" : "\\c[1]"
|
||||
if item == :LEFTOVERS || item == :MUSHROOMSPORES
|
||||
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
@@ -934,7 +1050,7 @@ end
|
||||
|
||||
def promptRegisterItem(item)
|
||||
if item.is_key_item? && pbCanRegisterItem?(item)
|
||||
if pbConfirmMessage(_INTL("Would you like to register the \\c[3]{1}\\c[0] in the quick actions menu?",item.name))
|
||||
if pbConfirmMessage(_INTL("Would you like to register the \\c[3]{1}\\c[0] in the quick actions menu?", item.name))
|
||||
$PokemonBag.pbRegisterItem(item)
|
||||
pbMessage(_INTL("\\se[{1}]The \\c[3]{2}\\c[0] was registered!", "GUI trainer card open", item.name))
|
||||
end
|
||||
|
||||
+440
-236
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,10 @@
|
||||
#===============================================================================
|
||||
# Battle intro animation
|
||||
#===============================================================================
|
||||
|
||||
TRANSITION_TIME = 0.5
|
||||
TRANSITION_PAUSE_TIME = 20
|
||||
|
||||
def pbSceneStandby
|
||||
$scene.disposeSpritesets if $scene.is_a?(Scene_Map)
|
||||
if RPG::Cache.need_clearing
|
||||
@@ -78,7 +82,7 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
||||
end
|
||||
halfFlashTime = Graphics.frame_rate*2/10 # 0.2 seconds, 8 frames
|
||||
alphaDiff = (255.0/halfFlashTime).ceil
|
||||
2.times do
|
||||
1.times do
|
||||
viewport.color.alpha = 0
|
||||
for i in 0...halfFlashTime*2
|
||||
if i<halfFlashTime; viewport.color.alpha += alphaDiff
|
||||
@@ -90,14 +94,15 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
||||
end
|
||||
# Play main animation
|
||||
Graphics.freeze
|
||||
Graphics.transition(Graphics.frame_rate*1.25,sprintf("Graphics/Transitions/%s",anim))
|
||||
Graphics.transition(Graphics.frame_rate*TRANSITION_TIME,sprintf("Graphics/Transitions/%s",anim))
|
||||
viewport.color = Color.new(0,0,0,255) # Ensure screen is black
|
||||
# Slight pause after animation before starting up the battle scene
|
||||
(Graphics.frame_rate/10).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
# (Graphics.frame_rate/TRANSITION_PAUSE_TIME).times do
|
||||
# Graphics.update
|
||||
# Input.update
|
||||
# pbUpdateSceneMap
|
||||
# end
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
pbPushFade
|
||||
# Yield to the battle scene
|
||||
@@ -142,10 +147,11 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
if tr_type
|
||||
tbargraphic = sprintf("vsBar_%s", tr_type.to_s) rescue nil
|
||||
#tgraphic = sprintf("vsTrainer_%s", tr_type.to_s) rescue nil
|
||||
tgraphic = sprintf("trainer%03d", tr_number) rescue nil
|
||||
#tgraphic = sprintf("trainer%03d", tr_number) rescue nil
|
||||
tgraphic = tr_type.to_s rescue nil
|
||||
|
||||
echoln tgraphic
|
||||
if pbResolveBitmap("Graphics/Transitions/" + tbargraphic) && pbResolveBitmap("Graphics/Characters/" + tgraphic)
|
||||
echoln tbargraphic
|
||||
if pbResolveBitmap("Graphics/Transitions/" + tbargraphic)# && pbResolveBitmap("Graphics/Characters/" + tgraphic)
|
||||
player_tr_type = $Trainer.trainer_type
|
||||
outfit = $Trainer.outfit
|
||||
# Set up
|
||||
@@ -164,6 +170,8 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
pbSetSystemFont(overlay.bitmap)
|
||||
#pbargraphic = sprintf("vsBar_%s_%d", player_tr_type.to_s, outfit) rescue nil
|
||||
pbargraphic = sprintf("vsBar_%s", player_tr_type.to_s) rescue nil
|
||||
|
||||
echoln pbargraphic
|
||||
if !pbResolveBitmap("Graphics/Transitions/" + pbargraphic)
|
||||
pbargraphic = sprintf("vsBar_%s", player_tr_type.to_s) rescue nil
|
||||
end
|
||||
@@ -230,7 +238,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
|
||||
trainer = Sprite.new(viewopp)
|
||||
#trainer.bitmap = RPG::Cache.transition(tgraphic)
|
||||
trainer.bitmap =RPG::Cache.load_bitmap("Graphics/Characters/", tgraphic) #RPG::Cache.transition(pgraphic)
|
||||
trainer.bitmap =RPG::Cache.load_bitmap("Graphics/Trainers/", tgraphic) #RPG::Cache.transition(pgraphic)
|
||||
trainer.x = xoffset+150
|
||||
trainer.tone = Tone.new(-255,-255,-255)
|
||||
trainer.zoom_x = 2
|
||||
|
||||
@@ -123,7 +123,7 @@ class PokemonEncounters
|
||||
return false if !@step_chances[enc_type] || @step_chances[enc_type] == 0
|
||||
return false if !has_encounter_type?(enc_type)
|
||||
#Always check encounter if pokeradar is active
|
||||
return true if $PokemonTemp.pokeradar != nil
|
||||
return true if $PokemonTemp.pokeradar != nil && !$PokemonSystem.overworld_encounters
|
||||
|
||||
# Get base encounter chance and minimum steps grace period
|
||||
encounter_chance = @step_chances[enc_type].to_f
|
||||
@@ -192,6 +192,10 @@ class PokemonEncounters
|
||||
# taking into account Repels and ability effects.
|
||||
def allow_encounter?(enc_data, repel_active = false)
|
||||
return false if !enc_data
|
||||
if $PokemonTemp.pokeradar
|
||||
return pbPokeRadarOnShakingGrass
|
||||
end
|
||||
|
||||
# Repel
|
||||
if repel_active && !pbPokeRadarOnShakingGrass
|
||||
first_pkmn = (Settings::REPEL_COUNTS_FAINTED_POKEMON) ? $Trainer.first_pokemon : $Trainer.first_able_pokemon
|
||||
@@ -265,6 +269,7 @@ class PokemonEncounters
|
||||
baseType = :Land1 if terrain_tag == :Grass_alt1
|
||||
baseType = :Land2 if terrain_tag == :Grass_alt2
|
||||
baseType = :Land3 if terrain_tag == :Grass_alt3
|
||||
baseType = :TallGrass if terrain_tag == :TallGrass
|
||||
ret = find_valid_encounter_type_for_time(baseType, time) if !ret
|
||||
end
|
||||
if !ret && has_cave_encounters?
|
||||
@@ -283,6 +288,9 @@ class PokemonEncounters
|
||||
if !enc_type || !GameData::EncounterType.exists?(enc_type)
|
||||
raise ArgumentError.new(_INTL("Encounter type {1} does not exist", enc_type))
|
||||
end
|
||||
if map_is_altering_cave?
|
||||
return select_altering_cave_encounter
|
||||
end
|
||||
enc_list = @encounter_tables[enc_type]
|
||||
return nil if !enc_list || enc_list.length == 0
|
||||
# Static/Magnet Pull prefer wild encounters of certain types, if possible.
|
||||
@@ -325,6 +333,7 @@ class PokemonEncounters
|
||||
encounter = enc
|
||||
break
|
||||
end
|
||||
|
||||
# Get the chosen species and level
|
||||
level = rand(encounter[2]..encounter[3])
|
||||
# Some abilities alter the level of the wild Pokémon
|
||||
@@ -382,13 +391,35 @@ class PokemonEncounters
|
||||
|
||||
|
||||
|
||||
def listPossibleEncounters(enctype)
|
||||
def listPossibleEncounters(enctype,include_weather=false)
|
||||
if !enctype
|
||||
raise ArgumentError.new(_INTL("Encounter type out of range"))
|
||||
end
|
||||
return @encounter_tables[enctype]
|
||||
list= @encounter_tables[enctype]
|
||||
if include_weather && $game_weather
|
||||
list += $PokemonEncounters.list_weather_encounters(enctype)
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
def list_weather_encounters(enctype)
|
||||
list = []
|
||||
return [] unless $game_weather.current_weather[$game_map.map_id]
|
||||
current_weather = $game_weather.current_weather[$game_map.map_id][0]
|
||||
weather_encounter_type = get_weather_encounter_type(enctype, current_weather)
|
||||
weather_encounters = @encounter_tables[weather_encounter_type]
|
||||
list += weather_encounters if weather_encounters
|
||||
return list
|
||||
end
|
||||
|
||||
def list_weather_encounters_species(enctype)
|
||||
species_list = []
|
||||
weather_encounters= list_weather_encounters(enctype)
|
||||
weather_encounters.each do |encounter|
|
||||
species_list.push(encounter[1])
|
||||
end
|
||||
return species_list
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -415,13 +446,8 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||
elsif itemrnd<(chances[0]+chances[1]+chances[2])
|
||||
genwildpoke.item = items[2]
|
||||
end
|
||||
# Shiny Charm makes shiny Pokémon more likely to generate
|
||||
if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
|
||||
2.times do # 3 times as likely
|
||||
break if genwildpoke.shiny?
|
||||
genwildpoke.personalID = rand(2**16) | rand(2**16) << 16
|
||||
end
|
||||
end
|
||||
apply_shiny_rerolls(genwildpoke)
|
||||
|
||||
# Give Pokérus
|
||||
genwildpoke.givePokerus if rand(65536) < Settings::POKERUS_CHANCE
|
||||
# Change wild Pokémon's gender/nature depending on the lead party Pokémon's
|
||||
@@ -442,6 +468,31 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||
return genwildpoke
|
||||
end
|
||||
|
||||
def apply_shiny_rerolls(pokemon)
|
||||
# Shiny Charm: 2 extra rerolls (3× as likely)
|
||||
if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
|
||||
2.times do
|
||||
break if pokemon.shiny?
|
||||
pokemon.personalID = rand(2**16) | rand(2**16) << 16
|
||||
end
|
||||
end
|
||||
|
||||
# NPC friends: 0–2 extra rerolls scaling with friend count (3× at 100 friends)
|
||||
if $Trainer.nb_npc_friends && $Trainer.nb_npc_friends > 0
|
||||
extra_rerolls = ([[$Trainer.nb_npc_friends, 0].max, 100].min / 100.0) * 2.0
|
||||
full_rerolls = extra_rerolls.floor
|
||||
partial_chance = extra_rerolls - full_rerolls
|
||||
|
||||
full_rerolls.times do
|
||||
break if pokemon.shiny?
|
||||
pokemon.personalID = rand(2**16) | rand(2**16) << 16
|
||||
end
|
||||
if !pokemon.shiny? && rand < partial_chance
|
||||
pokemon.personalID = rand(2**16) | rand(2**16) << 16
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Used by fishing rods and Headbutt/Rock Smash/Sweet Scent to generate a wild
|
||||
# Pokémon (or two) for a triggered wild encounter.
|
||||
def pbEncounter(enc_type)
|
||||
|
||||
@@ -173,7 +173,7 @@ EncounterModifier.register(proc { |encounter|
|
||||
# Give the regular encounter if encountering a roaming Pokémon isn't possible
|
||||
next encounter if $PokemonGlobal.roamedAlready
|
||||
next encounter if $PokemonGlobal.partner
|
||||
next encounter if $PokemonTemp.pokeradar
|
||||
next encounter if $PokemonTemp.pokeradar && !$PokemonSystem.overworld_encounters
|
||||
#next encounter if rand(100) < 75 # 25% chance of encountering a roaming Pokémon
|
||||
# Look at each roaming Pokémon in turn and decide whether it's possible to
|
||||
# encounter it
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
class PokemonGlobalMetadata
|
||||
# Movement
|
||||
attr_accessor :bicycle
|
||||
attr_accessor :bike_trick
|
||||
|
||||
attr_accessor :surfing
|
||||
attr_accessor :diving
|
||||
attr_accessor :sliding
|
||||
@@ -59,9 +61,13 @@ class PokemonGlobalMetadata
|
||||
attr_accessor :rematchedTrainers
|
||||
attr_accessor :questRewardsObtained
|
||||
|
||||
attr_accessor :boat
|
||||
attr_accessor :acroBike
|
||||
|
||||
def initialize
|
||||
# Movement
|
||||
@bicycle = false
|
||||
@bike_trick = false
|
||||
@surfing = false
|
||||
@diving = false
|
||||
@sliding = false
|
||||
@@ -279,6 +285,7 @@ class PokemonTemp
|
||||
attr_accessor :surfJump
|
||||
attr_accessor :endSurf
|
||||
attr_accessor :forceSingleBattle
|
||||
attr_accessor :pokeradar_pokemon
|
||||
|
||||
def initialize
|
||||
@menuLastChoice = 0
|
||||
@@ -287,5 +294,6 @@ class PokemonTemp
|
||||
@begunNewGame = false
|
||||
@miniupdate = false
|
||||
@forceSingleBattle = false
|
||||
@pokeradar_pokemon = nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -197,6 +197,9 @@ def pbCut
|
||||
return false
|
||||
end
|
||||
end
|
||||
if $PokemonSystem.quickHM == 1
|
||||
return true
|
||||
end
|
||||
pbMessage(_INTL("This tree looks like it can be cut down!\1"))
|
||||
if pbConfirmMessage(_INTL("Would you like to cut it?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
@@ -336,36 +339,45 @@ def pbDive
|
||||
return false
|
||||
end
|
||||
end
|
||||
if $PokemonSystem.quickHM == 1
|
||||
diveTransfer(map_metadata)
|
||||
return true
|
||||
end
|
||||
|
||||
if pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
if movefinder
|
||||
$Trainer.surfing_pokemon= getSpecies(movefinder.species)
|
||||
$Trainer.surfing_pokemon = getSpecies(movefinder.species)
|
||||
|
||||
echoln movefinder.species
|
||||
echoln getSpecies(movefinder.species)
|
||||
else
|
||||
$Trainer.surfing_pokemon=nil
|
||||
$Trainer.surfing_pokemon = nil
|
||||
end
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = map_metadata.dive_map_id
|
||||
$game_temp.player_new_x = $game_player.x
|
||||
$game_temp.player_new_y = $game_player.y
|
||||
$game_temp.player_new_direction = $game_player.direction
|
||||
$PokemonGlobal.surfing = false
|
||||
$PokemonGlobal.diving = true
|
||||
pbUpdateVehicle
|
||||
$scene.transfer_player(false)
|
||||
addWaterCausticsEffect()
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
}
|
||||
diveTransfer(map_metadata)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def diveTransfer(map_metadata)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = map_metadata.dive_map_id
|
||||
$game_temp.player_new_x = $game_player.x
|
||||
$game_temp.player_new_y = $game_player.y
|
||||
$game_temp.player_new_direction = $game_player.direction
|
||||
$PokemonGlobal.surfing = false
|
||||
$PokemonGlobal.diving = true
|
||||
pbUpdateVehicle
|
||||
$scene.transfer_player(false)
|
||||
addWaterCausticsEffect()
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
}
|
||||
end
|
||||
|
||||
def pbSurfacing
|
||||
return if !$PokemonGlobal.diving
|
||||
return false if $game_player.pbFacingEvent
|
||||
@@ -413,7 +425,7 @@ def pbTransferUnderwater(mapid, x, y, direction = $game_player.direction)
|
||||
$PokemonGlobal.diving = true
|
||||
$PokemonGlobal.surfing = false
|
||||
pbUpdateVehicle
|
||||
$scene.transfer_player(false )
|
||||
$scene.transfer_player(false)
|
||||
addWaterCausticsEffect()
|
||||
|
||||
$game_map.autoplay
|
||||
@@ -587,8 +599,6 @@ def pbFly(move, pokemon)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
terrain = $game_player.pbFacingTerrainTag
|
||||
if terrain.can_secret_base
|
||||
@@ -609,11 +619,10 @@ def pbSecretPower(terrain)
|
||||
if biomeType && baseLayoutType
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbSecretBase(biomeType,baseLayoutType)
|
||||
pbSecretBase(biomeType, baseLayoutType)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Headbutt
|
||||
#===============================================================================
|
||||
@@ -657,22 +666,22 @@ def pbHeadbutt(event = nil)
|
||||
return false
|
||||
end
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:HEADBUTT, proc { |move, pkmn, showmsg|
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
if !facingEvent || !facingEvent.name[/headbutttree/i]
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:HEADBUTT, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
facingEvent = $game_player.pbFacingEvent
|
||||
pbHeadbuttEffect(facingEvent)
|
||||
})
|
||||
# HiddenMoveHandlers::CanUseMove.add(:HEADBUTT, proc { |move, pkmn, showmsg|
|
||||
# facingEvent = $game_player.pbFacingEvent
|
||||
# if !facingEvent || !facingEvent.name[/headbutttree/i]
|
||||
# pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
# next false
|
||||
# end
|
||||
# next true
|
||||
# })
|
||||
#
|
||||
# HiddenMoveHandlers::UseMove.add(:HEADBUTT, proc { |move, pokemon|
|
||||
# if !pbHiddenMoveAnimation(pokemon)
|
||||
# pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
# end
|
||||
# facingEvent = $game_player.pbFacingEvent
|
||||
# pbHeadbuttEffect(facingEvent)
|
||||
# })
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:SECRETPOWER, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
@@ -680,9 +689,8 @@ HiddenMoveHandlers::UseMove.add(:SECRETPOWER, proc { |move, pokemon|
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:RELICSONG, proc { |move, pokemon, showmsg|
|
||||
if !(pokemon.isFusionOf(:MELOETTA_A) || pokemon.isFusionOf(:MELOETTA_P))
|
||||
if !(pokemon.isFusionOf(:MELOETTA_A) || pokemon.isFusionOf(:MELOETTA_P))
|
||||
pbMessage(_INTL("It won't have any effect")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -721,8 +729,8 @@ def changeMeloettaForm(pokemon)
|
||||
pbMessage(_INTL("{1} changed form!", pokemon.name))
|
||||
else
|
||||
if is_meloetta_P
|
||||
replaceFusionSpecies(pokemon, :MELOETTA_P, :MELOETTA_A)
|
||||
pbMessage(_INTL("{1} changed to the Aria form!", pokemon.name))
|
||||
replaceFusionSpecies(pokemon, :MELOETTA_P, :MELOETTA_A)
|
||||
pbMessage(_INTL("{1} changed to the Aria form!", pokemon.name))
|
||||
end
|
||||
if is_meloetta_A
|
||||
replaceFusionSpecies(pokemon, :MELOETTA_A, :MELOETTA_P)
|
||||
@@ -749,6 +757,12 @@ def pbRockSmash
|
||||
return false
|
||||
end
|
||||
end
|
||||
if $PokemonSystem.quickHM == 1
|
||||
facingEvent = $game_player.pbFacingEvent(true)
|
||||
pbSEPlay("Rock Smash", 80)
|
||||
$scene.spriteset.addUserAnimation(Settings::ROCK_SMASH_ANIMATION_ID, facingEvent.x, facingEvent.y, false)
|
||||
return true
|
||||
end
|
||||
if pbConfirmMessage(_INTL("This rock appears to be breakable. Would you like to use Rock Smash?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
@@ -788,7 +802,7 @@ HiddenMoveHandlers::UseMove.add(:ROCKSMASH, proc { |move, pokemon|
|
||||
#===============================================================================
|
||||
def pbStrength
|
||||
if $PokemonMap.strengthUsed
|
||||
#pbMessage("Strength made it possible to move boulders around.")
|
||||
# pbMessage("Strength made it possible to move boulders around.")
|
||||
return false
|
||||
end
|
||||
move = :STRENGTH
|
||||
@@ -799,6 +813,11 @@ def pbStrength
|
||||
return false
|
||||
end
|
||||
end
|
||||
if $PokemonSystem.quickHM == 1
|
||||
$PokemonMap.strengthUsed = true
|
||||
return true
|
||||
end
|
||||
|
||||
pbMessage(_INTL("It looks heavy, but a Pokémon may be able to push it aside.\1"))
|
||||
if pbConfirmMessage(_INTL("Would you like to use Strength?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
@@ -841,6 +860,7 @@ def pbSurf
|
||||
return false if $game_player.pbFacingEvent
|
||||
return false if $game_player.pbHasDependentEvents?
|
||||
return false if $PokemonGlobal.diving || $PokemonGlobal.surfing
|
||||
return false if $PokemonGlobal.acroBike
|
||||
move = :SURF
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, false) || (!$DEBUG && !movefinder)
|
||||
@@ -848,7 +868,7 @@ def pbSurf
|
||||
return false
|
||||
end
|
||||
end
|
||||
if $PokemonSystem.quicksurf == 1
|
||||
if $PokemonSystem.quickHM == 1
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm, 0.5) if surfbgm
|
||||
surfingPoke = movefinder.species if movefinder
|
||||
@@ -870,12 +890,12 @@ def pbSurf
|
||||
return false
|
||||
end
|
||||
|
||||
def pbStartSurfing(speciesID=nil)
|
||||
def pbStartSurfing(speciesID = nil)
|
||||
pbCancelVehicles
|
||||
if speciesID
|
||||
$Trainer.surfing_pokemon=getSpecies(speciesID)
|
||||
$Trainer.surfing_pokemon = getSpecies(speciesID)
|
||||
else
|
||||
$Trainer.surfing_pokemon=nil
|
||||
$Trainer.surfing_pokemon = nil
|
||||
end
|
||||
$PokemonEncounters.reset_step_count
|
||||
$PokemonGlobal.surfing = true
|
||||
@@ -901,7 +921,7 @@ def pbEndSurf(_xOffset, _yOffset)
|
||||
pbOnStepTaken(result)
|
||||
end
|
||||
$PokemonTemp.surfJump = nil
|
||||
$game_temp.clearSurfSplashPatches
|
||||
#$game_temp.clearSurfSplashPatches
|
||||
return true
|
||||
|
||||
end
|
||||
@@ -931,7 +951,7 @@ Events.onAction += proc { |_sender, _e|
|
||||
pbSurf
|
||||
}
|
||||
|
||||
#Flowers
|
||||
# Flowers
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
next if !$game_player.pbFacingTerrainTag.flower
|
||||
if $game_player.pbFacingTerrainTag.flowerRed
|
||||
@@ -964,7 +984,14 @@ Events.onAction += proc { |_sender, _e|
|
||||
end
|
||||
}
|
||||
|
||||
#Trashcan
|
||||
# Acro Bike
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
next unless $PokemonGlobal.bicycle
|
||||
next unless $game_player.pbFacingTerrainTag.acroBike
|
||||
bikeOnFence()
|
||||
}
|
||||
|
||||
# Trashcan
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
next if !$game_player.pbFacingTerrainTag.trashcan
|
||||
if $PokemonGlobal.stepcount % 25 == 0
|
||||
@@ -1072,12 +1099,15 @@ HiddenMoveHandlers::CanUseMove.add(:RAINDANCE, proc { |move, pkmn, showmsg|
|
||||
next true if Settings::GAME_ID == :IF_HOENN
|
||||
})
|
||||
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:RAINDANCE, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
changeCurrentWeather(:Rain,1)
|
||||
if isWeatherWind?()
|
||||
changeCurrentWeather(:Storm, 1)
|
||||
else
|
||||
changeCurrentWeather(:Rain, 1)
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
@@ -1088,7 +1118,7 @@ HiddenMoveHandlers::UseMove.add(:SUNNYDAY, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
changeCurrentWeather(:Sunny,1)
|
||||
changeCurrentWeather(:Sunny, 1)
|
||||
next true
|
||||
})
|
||||
|
||||
@@ -1099,10 +1129,71 @@ HiddenMoveHandlers::UseMove.add(:WHIRLWIND, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
changeCurrentWeather(:Wind,1)
|
||||
if isWeatherRain?()
|
||||
changeCurrentWeather(:Storm, 1)
|
||||
else
|
||||
changeCurrentWeather(:Wind, 1)
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:THUNDER, proc { |move, pkmn, showmsg|
|
||||
next true if Settings::GAME_ID == :IF_HOENN
|
||||
})
|
||||
HiddenMoveHandlers::UseMove.add(:THUNDER, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
changeCurrentWeather(:Storm, 1)
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:MAGNETRISE, proc { |move, pkmn, showmsg|
|
||||
next true unless $PokemonGlobal.surfing
|
||||
})
|
||||
HiddenMoveHandlers::UseMove.add(:MAGNETRISE, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
if $game_player.floating
|
||||
$game_player.floating = false
|
||||
$game_player.walk_anime = true
|
||||
else
|
||||
$game_player.walk_anime = false
|
||||
$game_player.floating = true
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:MIST, proc { |move, pkmn, showmsg|
|
||||
next true if Settings::GAME_ID == :IF_HOENN
|
||||
})
|
||||
HiddenMoveHandlers::UseMove.add(:MIST, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
changeCurrentWeather(:Fog, 4)
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:DEFOG, proc { |move, pkmn, showmsg|
|
||||
next true if Settings::GAME_ID == :IF_HOENN
|
||||
})
|
||||
HiddenMoveHandlers::UseMove.add(:DEFOG, proc { |move, pokemon|
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
|
||||
end
|
||||
current_weather = $game_weather.map_current_weather_type($game_map.map_id)
|
||||
if current_weather == :Fog
|
||||
changeCurrentWeather(:None, 1)
|
||||
pbMessage(_INTL("The fog cleared out!"))
|
||||
next true
|
||||
else
|
||||
pbMessage(_INTL("There's no fog to clear."))
|
||||
next false
|
||||
end
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
# Teleport
|
||||
#===============================================================================
|
||||
@@ -1199,6 +1290,11 @@ def pbWaterfall
|
||||
return false
|
||||
end
|
||||
end
|
||||
if $PokemonSystem.quickHM == 1
|
||||
pbAscendWaterfall
|
||||
return true
|
||||
end
|
||||
|
||||
if pbConfirmMessage(_INTL("It's a large waterfall. Would you like to use Waterfall?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
@@ -1209,14 +1305,14 @@ def pbWaterfall
|
||||
return false
|
||||
end
|
||||
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
terrain = $game_player.pbFacingTerrainTag
|
||||
if terrain.waterfall || isFacingTempWaterfall()
|
||||
pbWaterfall
|
||||
elsif terrain.waterfall_crest
|
||||
pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
||||
end
|
||||
}
|
||||
# Events.onAction += proc { |_sender, _e|
|
||||
# terrain = $game_player.pbFacingTerrainTag
|
||||
# if terrain.waterfall || isFacingTempWaterfall()
|
||||
# pbWaterfall
|
||||
# elsif terrain.waterfall_crest
|
||||
# pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
||||
# end
|
||||
# }
|
||||
|
||||
def isFacingTempWaterfall()
|
||||
return if !$game_temp.temp_waterfall
|
||||
|
||||
@@ -41,10 +41,34 @@ def pbFishingEnd
|
||||
$PokemonGlobal.fishing = false
|
||||
end
|
||||
|
||||
|
||||
def getFishingItems(terrain=nil)
|
||||
if Settings::KANTO
|
||||
return [
|
||||
:OLDBOOT,
|
||||
:OLDBOOT,
|
||||
:OLDBOOT,
|
||||
:OLDBOOT,
|
||||
:WATERGEM,
|
||||
:WATERGEM
|
||||
]
|
||||
elsif Settings::HOENN
|
||||
items = [:SEAWEED, :SEAWEED, :SEAWEED]
|
||||
if terrain.id == :StillWater #Freshwater
|
||||
items << :WATERGEM
|
||||
else #Ocean
|
||||
items << :DEEPSEATOOTH
|
||||
items << :DEEPSEASCALE
|
||||
end
|
||||
echoln items
|
||||
return items
|
||||
end
|
||||
return []
|
||||
end
|
||||
def pbFishing(hasEncounter,rodType=1)
|
||||
autohook= Settings::FISHING_AUTO_HOOK || $game_switches[SWITCH_FISHING_AUTOHOOK]
|
||||
speedup = ($Trainer.first_pokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($Trainer.first_pokemon.ability_id))
|
||||
biteChance = 20+(25*rodType) # 45, 70, 95
|
||||
biteChance = 30+(25*rodType) # 55, 70, 100
|
||||
biteChance *= 1.5 if speedup # 67.5, 100, 100
|
||||
hookChance = 100
|
||||
oldpattern = $game_player.fullPattern
|
||||
@@ -73,17 +97,11 @@ def pbFishing(hasEncounter,rodType=1)
|
||||
end
|
||||
|
||||
itemChance = rand((rodType)*5)
|
||||
if itemChance<=1
|
||||
if itemChance<=0
|
||||
#ITEM
|
||||
items = [:PEARL,
|
||||
:OLDBOOT,
|
||||
:OLDBOOT,
|
||||
:OLDBOOT,
|
||||
:OLDBOOT,
|
||||
:WATERGEM,
|
||||
:PEARL,
|
||||
:WATERGEM
|
||||
]
|
||||
# todo: detect if fishing in ocean or stillwater
|
||||
terrain = $game_player.pbFacingTerrainTag
|
||||
items = getFishingItems(terrain)
|
||||
hats = [
|
||||
HAT_SLOWKING_SHELL,HAT_TENTACRUEL
|
||||
]
|
||||
|
||||
@@ -118,38 +118,57 @@ class BerryPlantSprite
|
||||
maxreplants = GameData::BerryPlant::NUMBER_OF_REPLANTS
|
||||
ripestages = 4
|
||||
case berryData[7]
|
||||
when :GROWTHMULCH
|
||||
when :STABLEMULCH #berries grow faster
|
||||
timeperstage = (timeperstage * 0.75).to_i
|
||||
dryingrate = (dryingrate * 1.5).ceil
|
||||
when :DAMPMULCH
|
||||
when :GROWTHMULCH #berries grow much faster
|
||||
timeperstage = (timeperstage * 0.50).to_i
|
||||
dryingrate = (dryingrate * 1.5).ceil
|
||||
when :DAMPMULCH #drying rate is slower
|
||||
timeperstage = (timeperstage * 1.25).to_i
|
||||
dryingrate = (dryingrate * 0.5).floor
|
||||
when :GOOEYMULCH
|
||||
maxreplants = (maxreplants * 1.5).ceil
|
||||
when :STABLEMULCH
|
||||
ripestages = 6
|
||||
when :GOOEYMULCH #drying rate is much slower
|
||||
timeperstage = (timeperstage * 1.25).to_i
|
||||
dryingrate = (dryingrate * 0.25).floor
|
||||
#when :RICHMULCH #Increases yield - implemented in pbBerryPlant
|
||||
|
||||
end
|
||||
|
||||
#Auto replant mechanics - Disabled
|
||||
# Cycle through all replants since last check
|
||||
loop do
|
||||
secondsalive = berryData[2]
|
||||
growinglife = (berryData[5] > 0) ? 3 : 4 # number of growing stages
|
||||
numlifestages = growinglife + ripestages # number of growing + ripe stages
|
||||
# Should replant itself?
|
||||
if secondsalive + timeDiff >= timeperstage * numlifestages
|
||||
# Should replant
|
||||
if berryData[5] >= maxreplants # Too many replants
|
||||
return [0, 0, 0, 0, 0, 0, 0, 0]
|
||||
end
|
||||
# Replant
|
||||
berryData[0] = 2 # replants start in sprouting stage
|
||||
berryData[2] = 0 # seconds alive
|
||||
berryData[5] += 1 # add to replant count
|
||||
berryData[6] = 0 # yield penalty
|
||||
timeDiff -= (timeperstage * numlifestages - secondsalive)
|
||||
else
|
||||
break
|
||||
end
|
||||
# loop do
|
||||
# secondsalive = berryData[2]
|
||||
# growinglife = (berryData[5] > 0) ? 3 : 4 # number of growing stages
|
||||
# numlifestages = growinglife + ripestages # number of growing + ripe stages
|
||||
# # Should replant itself?
|
||||
# if secondsalive + timeDiff >= timeperstage * numlifestages
|
||||
# # Should replant
|
||||
# # if berryData[5] >= maxreplants # Too many replants
|
||||
# # return [0, 0, 0, 0, 0, 0, 0, 0]
|
||||
# # end
|
||||
# # Replant
|
||||
# berryData[0] = 2 # replants start in sprouting stage
|
||||
# berryData[2] = 0 # seconds alive
|
||||
# berryData[5] += 1 # add to replant count
|
||||
# berryData[6] = 0 # yield penalty
|
||||
# timeDiff -= (timeperstage * numlifestages - secondsalive)
|
||||
# else
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
|
||||
secondsalive = berryData[2]
|
||||
growinglife = (berryData[5] > 0) ? 3 : 4
|
||||
numlifestages = growinglife + ripestages
|
||||
maxlife = timeperstage * numlifestages
|
||||
|
||||
if secondsalive + timeDiff >= maxlife
|
||||
berryData[2] = maxlife
|
||||
timeDiff = 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
# Update current stage and dampness
|
||||
if berryData[0] > 0
|
||||
# Advance growth stage
|
||||
@@ -255,9 +274,9 @@ class BerryPlantSprite
|
||||
else
|
||||
@event.character_name = "Object ball"
|
||||
end
|
||||
if @oldstage != berryData[0] && berryData.length > 6 # Gen 4 growth mechanisms
|
||||
$scene.spriteset.addUserAnimation(Settings::PLANT_SPARKLE_ANIMATION_ID, @event.x, @event.y, false, 1) if $scene.spriteset
|
||||
end
|
||||
# if @oldstage != berryData[0] && berryData.length > 6 # Gen 4 growth mechanisms
|
||||
# $scene.spriteset.addUserAnimation(Settings::PLANT_SPARKLE_ANIMATION_ID, @event.x, @event.y, false, 1) if $scene.spriteset
|
||||
# end
|
||||
end
|
||||
@oldstage = berryData[0]
|
||||
end
|
||||
@@ -265,7 +284,11 @@ end
|
||||
|
||||
# todo: return whether the player has any mulch items
|
||||
def canFertilize?
|
||||
return true
|
||||
return $PokemonBag.pbHasItem?(:GROWTHMULCH) ||
|
||||
$PokemonBag.pbHasItem?(:DAMPMULCH) ||
|
||||
$PokemonBag.pbHasItem?(:GOOEYMULCH) ||
|
||||
$PokemonBag.pbHasItem?(:STABLEMULCH) ||
|
||||
$PokemonBag.pbHasItem?(:RICHMULCH)
|
||||
end
|
||||
|
||||
def pbBerryPlant
|
||||
@@ -315,6 +338,8 @@ def pbBerryPlant
|
||||
if GameData::Item.get(ret).is_mulch?
|
||||
berryData[7] = ret
|
||||
pbMessage(_INTL("The {1} was scattered on the soil.\1", GameData::Item.get(ret).name))
|
||||
$PokemonBag.pbDeleteItem(ret)
|
||||
|
||||
if pbConfirmMessage(_INTL("Want to plant a Berry?"))
|
||||
pbFadeOutIn {
|
||||
scene = PokemonBag_Scene.new
|
||||
@@ -333,6 +358,8 @@ def pbBerryPlant
|
||||
$PokemonBag.pbDeleteItem(berry, 1)
|
||||
pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
|
||||
GameData::Item.get(berry).name))
|
||||
$Trainer.stats.berries_planted = 0 unless $Trainer.stats.berries_planted
|
||||
$Trainer.stats.berries_planted +=1
|
||||
end
|
||||
end
|
||||
interp.setVariable(berryData)
|
||||
@@ -359,6 +386,8 @@ def pbBerryPlant
|
||||
$PokemonBag.pbDeleteItem(berry, 1)
|
||||
pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
|
||||
GameData::Item.get(berry).name))
|
||||
$Trainer.stats.berries_planted = 0 unless $Trainer.stats.berries_planted
|
||||
$Trainer.stats.berries_planted +=1
|
||||
interp.setVariable(berryData)
|
||||
end
|
||||
return
|
||||
@@ -383,40 +412,48 @@ def pbBerryPlant
|
||||
$PokemonBag.pbDeleteItem(berry, 1)
|
||||
pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
|
||||
GameData::Item.get(berry).name))
|
||||
$Trainer.stats.berries_planted = 0 unless $Trainer.stats.berries_planted
|
||||
$Trainer.stats.berries_planted +=1
|
||||
interp.setVariable(berryData)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
# Gen 3 planting mechanics
|
||||
if pbConfirmMessage(_INTL("It's soft, loamy soil.\nPlant a berry?"))
|
||||
pbFadeOutIn {
|
||||
scene = PokemonBag_Scene.new
|
||||
screen = PokemonBagScreen.new(scene, $PokemonBag)
|
||||
berry = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_berry? })
|
||||
}
|
||||
if berry
|
||||
timenow = pbGetTimeNow
|
||||
berryData[0] = 1 # growth stage (1-5)
|
||||
berryData[1] = berry # item ID of planted berry
|
||||
berryData[2] = false # watered in this stage?
|
||||
berryData[3] = timenow.to_i # time planted
|
||||
berryData[4] = 0 # total waterings
|
||||
berryData[5] = 0 # number of replants
|
||||
berryData[6] = nil; berryData[7] = nil; berryData.compact! # for compatibility
|
||||
$PokemonBag.pbDeleteItem(berry, 1)
|
||||
pbMessage(_INTL("{1} planted a {2} in the soft loamy soil.",
|
||||
$Trainer.name, GameData::Item.get(berry).name))
|
||||
interp.setVariable(berryData)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
# else
|
||||
# # Gen 3 planting mechanics
|
||||
# if pbConfirmMessage(_INTL("It's soft, loamy soil.\nPlant a berry?"))
|
||||
# pbFadeOutIn {
|
||||
# scene = PokemonBag_Scene.new
|
||||
# screen = PokemonBagScreen.new(scene, $PokemonBag)
|
||||
# berry = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_berry? })
|
||||
# }
|
||||
# if berry
|
||||
# timenow = pbGetTimeNow
|
||||
# berryData[0] = 1 # growth stage (1-5)
|
||||
# berryData[1] = berry # item ID of planted berry
|
||||
# berryData[2] = false # watered in this stage?
|
||||
# berryData[3] = timenow.to_i # time planted
|
||||
# berryData[4] = 0 # total waterings
|
||||
# berryData[5] = 0 # number of replants
|
||||
# berryData[6] = nil; berryData[7] = nil; berryData.compact! # for compatibility
|
||||
# $PokemonBag.pbDeleteItem(berry, 1)
|
||||
# pbMessage(_INTL("{1} planted a {2} in the soft loamy soil.",
|
||||
# $Trainer.name, GameData::Item.get(berry).name))
|
||||
# interp.setVariable(berryData)
|
||||
# end
|
||||
# return
|
||||
# end
|
||||
# end
|
||||
when 1 # X planted
|
||||
pbMessage(_INTL("A {1} was planted here.", GameData::Item.get(berry).name))
|
||||
berry_name = GameData::Item.get(berry).name
|
||||
preposition = ["A","E","I","O","U"].include?(berry_name[0]) ? "An" : "A"
|
||||
pbMessage(_INTL("{1} {2} was planted here.", preposition, berry_name))
|
||||
when 2 # X sprouted
|
||||
pbMessage(_INTL("The {1} has sprouted.", GameData::Item.get(berry).name))
|
||||
unless hasHat?(HAT_SPROUT)
|
||||
obtainHat(HAT_SPROUT) if rand(10) == 0
|
||||
end
|
||||
when 3 # X taller
|
||||
pbMessage(_INTL("The {1} plant is growing bigger.", GameData::Item.get(berry).name))
|
||||
when 4 # X flowering
|
||||
@@ -443,6 +480,7 @@ def pbBerryPlant
|
||||
if berryData.length > 6
|
||||
# Gen 4 berry yield calculation
|
||||
berrycount = [berryvalues.maximum_yield - berryData[6], berryvalues.minimum_yield].max
|
||||
berrycount = (berrycount * 1.5).ceil if berryData[7] == :RICHMULCH
|
||||
else
|
||||
# Gen 3 berry yield calculation
|
||||
if berryData[4] > 0
|
||||
@@ -549,5 +587,9 @@ def pbPickBerry(berry, qty = 1)
|
||||
end
|
||||
interp.setVariable(berryData)
|
||||
pbSetSelfSwitch(thisEvent.id, "A", true)
|
||||
|
||||
if berry == :ORANBERRY && !hasHat?(HAT_ORAN)
|
||||
obtainHat(HAT_ORAN)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,39 +11,48 @@ def pbDayCareDeposited
|
||||
end
|
||||
|
||||
# Get name/cost info of a particular Pokémon in the Day Care.
|
||||
def pbDayCareGetDeposited(index,nameVariable,costVariable)
|
||||
def pbDayCareGetDeposited(index, nameVariable, costVariable)
|
||||
pkmn = $PokemonGlobal.daycare[index][0]
|
||||
return false if !pkmn
|
||||
cost = pbDayCareGetCost(index)
|
||||
$game_variables[nameVariable] = pkmn.name if nameVariable>=0
|
||||
$game_variables[costVariable] = cost if costVariable>=0
|
||||
$game_variables[nameVariable] = pkmn.name if nameVariable >= 0
|
||||
$game_variables[costVariable] = cost if costVariable >= 0
|
||||
end
|
||||
|
||||
# Get name/levels gained info of a particular Pokémon in the Day Care.
|
||||
def pbDayCareGetLevelGain(index,nameVariable,levelVariable)
|
||||
def pbDayCareGetLevelGain(index, nameVariable, levelVariable)
|
||||
pkmn = $PokemonGlobal.daycare[index][0]
|
||||
return false if !pkmn
|
||||
$game_variables[nameVariable] = pkmn.name
|
||||
$game_variables[levelVariable] = pkmn.level-$PokemonGlobal.daycare[index][1]
|
||||
$game_variables[nameVariable] = pkmn.name
|
||||
$game_variables[levelVariable] = pkmn.level - $PokemonGlobal.daycare[index][1]
|
||||
return true
|
||||
end
|
||||
|
||||
def getDayCarePokemonNames(nameVariable1, nameVariable2)
|
||||
pokemon1 = $PokemonGlobal.daycare[0][0]
|
||||
pokemon2 = $PokemonGlobal.daycare[1][0]
|
||||
deposited = []
|
||||
deposited << pokemon1 if pokemon1
|
||||
deposited << pokemon2 if pokemon2
|
||||
|
||||
pbSet(nameVariable1,deposited[0].name) if deposited[0]
|
||||
pbSet(nameVariable2,deposited[1].name) if deposited[1]
|
||||
end
|
||||
|
||||
def pbDayCareGetCost(index)
|
||||
pkmn = $PokemonGlobal.daycare[index][0]
|
||||
return 0 if !pkmn
|
||||
cost = pkmn.level-$PokemonGlobal.daycare[index][1]+1
|
||||
cost = pkmn.level - $PokemonGlobal.daycare[index][1] + 1
|
||||
cost *= 100
|
||||
return cost
|
||||
end
|
||||
|
||||
# Returns whether an egg is waiting to be collected.
|
||||
def pbEggGenerated?
|
||||
return false if pbDayCareDeposited!=2
|
||||
return $PokemonGlobal.daycareEgg==1
|
||||
return false if pbDayCareDeposited != 2
|
||||
return $PokemonGlobal.daycareEgg == 1
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Manipulate Pokémon in the Day Care.
|
||||
#===============================================================================
|
||||
@@ -55,7 +64,7 @@ def pbDayCareDeposit(index)
|
||||
$PokemonGlobal.daycare[i][0].heal
|
||||
$Trainer.party[index] = nil
|
||||
$Trainer.party.compact!
|
||||
$PokemonGlobal.daycareEgg = 0
|
||||
$PokemonGlobal.daycareEgg = 0
|
||||
$PokemonGlobal.daycareEggSteps = 0
|
||||
return
|
||||
end
|
||||
@@ -65,42 +74,42 @@ end
|
||||
def pbDayCareWithdraw(index)
|
||||
if !$PokemonGlobal.daycare[index][0]
|
||||
raise _INTL("There's no Pokémon here...")
|
||||
elsif $Trainer.party_full?
|
||||
raise _INTL("Can't store the Pokémon...")
|
||||
else
|
||||
$Trainer.party[$Trainer.party.length] = $PokemonGlobal.daycare[index][0]
|
||||
pokemon = $PokemonGlobal.daycare[index][0]
|
||||
if $Trainer.party_full?
|
||||
pbMessage(_INTL("{1} was sent to the PC.",pokemon.name))
|
||||
end
|
||||
pbAddPokemonSilent(pokemon)
|
||||
$PokemonGlobal.daycare[index][0] = nil
|
||||
$PokemonGlobal.daycare[index][1] = 0
|
||||
$PokemonGlobal.daycareEgg = 0
|
||||
end
|
||||
end
|
||||
|
||||
def pbDayCareChoose(text,variable)
|
||||
def pbDayCareChoose(text, variable)
|
||||
count = pbDayCareDeposited
|
||||
if count==0
|
||||
if count == 0
|
||||
raise _INTL("There's no Pokémon here...")
|
||||
elsif count==1
|
||||
elsif count == 1
|
||||
$game_variables[variable] = ($PokemonGlobal.daycare[0][0]) ? 0 : 1
|
||||
else
|
||||
choices = []
|
||||
for i in 0...2
|
||||
pokemon = $PokemonGlobal.daycare[i][0]
|
||||
if pokemon.male?
|
||||
choices.push(_ISPRINTF("{1:s} (♂, Lv.{2:d})",pokemon.name,pokemon.level))
|
||||
choices.push(_ISPRINTF("{1:s} (♂, Lv.{2:d})", pokemon.name, pokemon.level))
|
||||
elsif pokemon.female?
|
||||
choices.push(_ISPRINTF("{1:s} (♀, Lv.{2:d})",pokemon.name,pokemon.level))
|
||||
choices.push(_ISPRINTF("{1:s} (♀, Lv.{2:d})", pokemon.name, pokemon.level))
|
||||
else
|
||||
choices.push(_ISPRINTF("{1:s} (Lv.{2:d})",pokemon.name,pokemon.level))
|
||||
choices.push(_ISPRINTF("{1:s} (Lv.{2:d})", pokemon.name, pokemon.level))
|
||||
end
|
||||
end
|
||||
choices.push(_INTL("CANCEL"))
|
||||
command = pbMessage(text,choices,choices.length)
|
||||
$game_variables[variable] = (command==2) ? -1 : command
|
||||
command = pbMessage(text, choices, choices.length)
|
||||
$game_variables[variable] = (command == 2) ? -1 : command
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Check compatibility of Pokémon in the Day Care.
|
||||
#===============================================================================
|
||||
@@ -127,13 +136,16 @@ def pbDayCareGetCompat
|
||||
# Pokémon in the Undiscovered egg group cannot breed
|
||||
egg_groups1 = pkmn1.species_data.egg_groups
|
||||
egg_groups2 = pkmn2.species_data.egg_groups
|
||||
egg_groups1 = [egg_groups1] unless egg_groups1.is_a?(Array)
|
||||
egg_groups2 = [egg_groups2] unless egg_groups2.is_a?(Array)
|
||||
|
||||
return 0 if egg_groups1.include?(:Undiscovered) ||
|
||||
egg_groups2.include?(:Undiscovered)
|
||||
egg_groups2.include?(:Undiscovered)
|
||||
# Pokémon that don't share an egg group (and neither is in the Ditto group)
|
||||
# cannot breed
|
||||
return 0 if !egg_groups1.include?(:Ditto) &&
|
||||
!egg_groups2.include?(:Ditto) &&
|
||||
(egg_groups1 & egg_groups2).length == 0
|
||||
!egg_groups2.include?(:Ditto) &&
|
||||
(egg_groups1 & egg_groups2).length == 0
|
||||
# Pokémon with incompatible genders cannot breed
|
||||
return 0 if !pbDayCareCompatibleGender(pkmn1, pkmn2)
|
||||
# Pokémon can breed; calculate a compatibility factor
|
||||
@@ -147,14 +159,64 @@ def pbDayCareGetCompatibility(variable)
|
||||
$game_variables[variable] = pbDayCareGetCompat
|
||||
end
|
||||
|
||||
# Todo: make this based on some stats or smt
|
||||
def get_fusion_egg_chance(maleParent, femaleParent)
|
||||
# in %
|
||||
base_chance = 30
|
||||
chance = base_chance
|
||||
chance += 20 if maleParent.isFusion?
|
||||
chance += 20 if femaleParent.isFusion?
|
||||
return chance
|
||||
end
|
||||
|
||||
def determineDayCareEggSpecies(maleParent, femaleParent)
|
||||
fusion_egg_chance = get_fusion_egg_chance(maleParent, femaleParent)
|
||||
male_species = maleParent.species_data
|
||||
female_species = femaleParent.species_data
|
||||
male_species = female_species if male_species.species == :DITTO && female_species.species != :DITTO
|
||||
female_species = male_species if female_species.species == :DITTO && male_species.species != :DITTO
|
||||
|
||||
maleParentSpecies = []
|
||||
if maleParent.isFusion? || (maleParent.species == :DITTO && femaleParent.isFusion?)
|
||||
maleParentSpecies << male_species.body_pokemon.species
|
||||
maleParentSpecies << male_species.head_pokemon.species
|
||||
else
|
||||
maleParentSpecies << male_species.species
|
||||
end
|
||||
|
||||
femaleParentSpecies = []
|
||||
|
||||
if femaleParent.isFusion? || (femaleParent.species == :DITTO && maleParent.isFusion?)
|
||||
femaleParentSpecies << female_species.body_pokemon.species
|
||||
femaleParentSpecies << female_species.head_pokemon.species
|
||||
else
|
||||
femaleParentSpecies << female_species.species
|
||||
end
|
||||
|
||||
baby_father_species = maleParentSpecies.sample
|
||||
baby_mother_species = femaleParentSpecies.sample
|
||||
|
||||
if baby_father_species == baby_mother_species
|
||||
baby_species = baby_mother_species
|
||||
else
|
||||
if rand(100) <= fusion_egg_chance
|
||||
if rand(2) == 0
|
||||
baby_species = fusionOf(baby_father_species, baby_mother_species)
|
||||
else
|
||||
baby_species = fusionOf(baby_mother_species, baby_father_species)
|
||||
end
|
||||
else
|
||||
baby_species = baby_mother_species
|
||||
end
|
||||
end
|
||||
return baby_species
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Generate an Egg based on Pokémon in the Day Care.
|
||||
#===============================================================================
|
||||
def pbDayCareGenerateEgg
|
||||
return if pbDayCareDeposited != 2
|
||||
raise _INTL("Can't store the egg.") if $Trainer.party_full?
|
||||
pkmn0 = $PokemonGlobal.daycare[0][0]
|
||||
pkmn1 = $PokemonGlobal.daycare[1][0]
|
||||
mother = nil
|
||||
@@ -171,6 +233,9 @@ def pbDayCareGenerateEgg
|
||||
father = pkmn0
|
||||
babyspecies = (ditto1) ? father.species : mother.species
|
||||
end
|
||||
|
||||
babyspecies = determineDayCareEggSpecies(father,mother)
|
||||
|
||||
# Determine the egg's species
|
||||
babyspecies = GameData::Species.get(babyspecies).get_baby_species(true, mother.item_id, father.item_id)
|
||||
case babyspecies
|
||||
@@ -189,7 +254,7 @@ def pbDayCareGenerateEgg
|
||||
egg = Pokemon.new(babyspecies, Settings::EGG_LEVEL)
|
||||
# Randomise personal ID
|
||||
pid = rand(65536)
|
||||
pid |= (rand(65536)<<16)
|
||||
pid |= (rand(65536) << 16)
|
||||
egg.personalID = pid
|
||||
# Inheriting form
|
||||
if [:BURMY, :SHELLOS, :BASCULIN, :FLABEBE, :PUMPKABOO, :ORICORIO, :ROCKRUFF, :MINIOR].include?(babyspecies)
|
||||
@@ -199,10 +264,10 @@ def pbDayCareGenerateEgg
|
||||
end
|
||||
# Inheriting Alolan form
|
||||
if [:RATTATA, :SANDSHREW, :VULPIX, :DIGLETT, :MEOWTH, :GEODUDE, :GRIMER].include?(babyspecies)
|
||||
if mother.form==1
|
||||
if mother.form == 1
|
||||
egg.form = 1 if mother.hasItem?(:EVERSTONE)
|
||||
elsif father.species_data.get_baby_species(true, mother.item_id, father.item_id) == babyspecies
|
||||
egg.form = 1 if father.form==1 && father.hasItem?(:EVERSTONE)
|
||||
egg.form = 1 if father.form == 1 && father.hasItem?(:EVERSTONE)
|
||||
end
|
||||
end
|
||||
# Inheriting Moves
|
||||
@@ -248,18 +313,18 @@ def pbDayCareGenerateEgg
|
||||
# Volt Tackle
|
||||
lightball = false
|
||||
if (father.isSpecies?(:PIKACHU) || father.isSpecies?(:RAICHU)) &&
|
||||
father.hasItem?(:LIGHTBALL)
|
||||
father.hasItem?(:LIGHTBALL)
|
||||
lightball = true
|
||||
end
|
||||
if (mother.isSpecies?(:PIKACHU) || mother.isSpecies?(:RAICHU)) &&
|
||||
mother.hasItem?(:LIGHTBALL)
|
||||
mother.hasItem?(:LIGHTBALL)
|
||||
lightball = true
|
||||
end
|
||||
if lightball && babyspecies == :PICHU && GameData::Move.exists?(:VOLTTACKLE)
|
||||
moves.push(:VOLTTACKLE)
|
||||
end
|
||||
moves = moves.reverse
|
||||
moves |= [] # remove duplicates
|
||||
moves |= [] # remove duplicates
|
||||
moves = moves.reverse
|
||||
# Assembling move list
|
||||
first_move_index = moves.length - Pokemon::MAX_MOVES
|
||||
@@ -273,7 +338,7 @@ def pbDayCareGenerateEgg
|
||||
GameData::Stat.each_main { |s| ivs[s.id] = rand(Pokemon::IV_STAT_LIMIT + 1) }
|
||||
ivinherit = []
|
||||
for i in 0...2
|
||||
parent = [mother,father][i]
|
||||
parent = [mother, father][i]
|
||||
ivinherit[i] = :HP if parent.hasItem?(:POWERWEIGHT)
|
||||
ivinherit[i] = :ATTACK if parent.hasItem?(:POWERBRACER)
|
||||
ivinherit[i] = :DEFENSE if parent.hasItem?(:POWERBELT)
|
||||
@@ -284,25 +349,25 @@ def pbDayCareGenerateEgg
|
||||
num = 0
|
||||
r = rand(2)
|
||||
2.times do
|
||||
if ivinherit[r]!=nil
|
||||
parent = [mother,father][r]
|
||||
if ivinherit[r] != nil
|
||||
parent = [mother, father][r]
|
||||
ivs[ivinherit[r]] = parent.iv[ivinherit[r]]
|
||||
num += 1
|
||||
break
|
||||
end
|
||||
r = (r+1)%2
|
||||
r = (r + 1) % 2
|
||||
end
|
||||
limit = (mother.hasItem?(:DESTINYKNOT) || father.hasItem?(:DESTINYKNOT)) ? 5 : 3
|
||||
loop do
|
||||
freestats = []
|
||||
GameData::Stat.each_main { |s| freestats.push(s.id) if !ivinherit.include?(s.id) }
|
||||
break if freestats.length==0
|
||||
break if freestats.length == 0
|
||||
r = freestats[rand(freestats.length)]
|
||||
parent = [mother,father][rand(2)]
|
||||
parent = [mother, father][rand(2)]
|
||||
ivs[r] = parent.iv[r]
|
||||
ivinherit.push(r)
|
||||
num += 1
|
||||
break if num>=limit
|
||||
break if num >= limit
|
||||
end
|
||||
# Inheriting nature
|
||||
new_natures = []
|
||||
@@ -316,15 +381,15 @@ def pbDayCareGenerateEgg
|
||||
shinyretries = 0
|
||||
shinyretries += 5 if father.owner.language != mother.owner.language
|
||||
shinyretries += 2 if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
|
||||
if shinyretries>0
|
||||
if shinyretries > 0
|
||||
shinyretries.times do
|
||||
break if egg.shiny?
|
||||
egg.personalID = rand(2**16) | rand(2**16) << 16
|
||||
egg.personalID = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
end
|
||||
end
|
||||
# Inheriting ability from the mother
|
||||
if !ditto0 || !ditto1
|
||||
parent = (ditto0) ? father : mother # The non-Ditto
|
||||
parent = (ditto0) ? father : mother # The non-Ditto
|
||||
if parent.hasHiddenAbility?
|
||||
egg.ability_index = parent.ability_index if rand(100) < 60
|
||||
elsif !ditto0 && !ditto1
|
||||
@@ -345,8 +410,8 @@ def pbDayCareGenerateEgg
|
||||
possible_balls.push(pkmn0.poke_ball) if pkmn0.female? || ditto1
|
||||
possible_balls.push(pkmn1.poke_ball) if pkmn1.female? || ditto0
|
||||
end
|
||||
possible_balls.delete(:MASTERBALL) # Can't inherit this Ball
|
||||
possible_balls.delete(:CHERISHBALL) # Can't inherit this Ball
|
||||
possible_balls.delete(:MASTERBALL) # Can't inherit this Ball
|
||||
possible_balls.delete(:CHERISHBALL) # Can't inherit this Ball
|
||||
if possible_balls.length > 0
|
||||
egg.poke_ball = possible_balls[0]
|
||||
egg.poke_ball = possible_balls[rand(possible_balls.length)] if possible_balls.length > 1
|
||||
@@ -362,27 +427,31 @@ def pbDayCareGenerateEgg
|
||||
egg.steps_to_hatch = egg.species_data.hatch_steps
|
||||
egg.givePokerus if rand(65536) < Settings::POKERUS_CHANCE
|
||||
# Add egg to party
|
||||
$Trainer.party[$Trainer.party.length] = egg
|
||||
#
|
||||
if $Trainer.party.length<6
|
||||
$Trainer.party[$Trainer.party.length] = egg
|
||||
else
|
||||
$PokemonStorage.pbStoreCaught(egg)
|
||||
Kernel.pbMessage(_INTL("The egg was transferred to the PC."))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Code that happens every step the player takes.
|
||||
#===============================================================================
|
||||
Events.onStepTaken += proc { |_sender,_e|
|
||||
Events.onStepTaken += proc { |_sender, _e|
|
||||
# Make an egg available at the Day Care
|
||||
deposited = pbDayCareDeposited
|
||||
if deposited==2 && $PokemonGlobal.daycareEgg==0
|
||||
if deposited == 2 && $PokemonGlobal.daycareEgg == 0
|
||||
$PokemonGlobal.daycareEggSteps = 0 if !$PokemonGlobal.daycareEggSteps
|
||||
$PokemonGlobal.daycareEggSteps += 1
|
||||
if $PokemonGlobal.daycareEggSteps==256
|
||||
if $PokemonGlobal.daycareEggSteps == 256
|
||||
$PokemonGlobal.daycareEggSteps = 0
|
||||
compatval = [0,20,50,70][pbDayCareGetCompat]
|
||||
compatval = [0, 20, 50, 70][pbDayCareGetCompat]
|
||||
if GameData::Item.exists?(:OVALCHARM) && $PokemonBag.pbHasItem?(:OVALCHARM)
|
||||
compatval = [0,40,80,88][pbDayCareGetCompat]
|
||||
compatval = [0, 40, 80, 88][pbDayCareGetCompat]
|
||||
end
|
||||
$PokemonGlobal.daycareEgg = 1 if rand(100)<compatval # Egg is generated
|
||||
$PokemonGlobal.daycareEgg = 1 if rand(100) < compatval # Egg is generated
|
||||
end
|
||||
end
|
||||
# Day Care Pokémon gain Exp/moves
|
||||
@@ -390,14 +459,14 @@ Events.onStepTaken += proc { |_sender,_e|
|
||||
pkmn = $PokemonGlobal.daycare[i][0]
|
||||
next if !pkmn
|
||||
maxexp = pkmn.growth_rate.maximum_exp
|
||||
next if pkmn.exp>=maxexp
|
||||
next if pkmn.exp >= maxexp
|
||||
oldlevel = pkmn.level
|
||||
pkmn.exp += 1 # Gain Exp
|
||||
next if pkmn.level==oldlevel
|
||||
pkmn.exp += 1 # Gain Exp
|
||||
next if pkmn.level == oldlevel
|
||||
pkmn.calc_stats
|
||||
movelist = pkmn.getMoveList
|
||||
for i in movelist
|
||||
pkmn.learn_move(i[1]) if i[0]==pkmn.level # Learned a new move
|
||||
pkmn.learn_move(i[1]) if i[0] == pkmn.level # Learned a new move
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user