Bug fixes: Shadow Pokémon still knowing some original moves when they shouldn't, Interpreter not resetting if saved in the middle of an event and then starting a new game, priority 1 tiles appearing below the player at larger screen sizes, ability inheritance when breeding

This commit is contained in:
Maruno17
2022-10-08 17:46:29 +01:00
parent fa2758edaa
commit 882f4c96f8
5 changed files with 19 additions and 22 deletions

View File

@@ -42,6 +42,8 @@ module Game
end end
$game_temp.common_event_id = 0 if $game_temp $game_temp.common_event_id = 0 if $game_temp
$game_temp.begun_new_game = true $game_temp.begun_new_game = true
pbMapInterpreter&.clear
pbMapInterpreter&.setup(nil, 0, 0)
$scene = Scene_Map.new $scene = Scene_Map.new
SaveData.load_new_game_values SaveData.load_new_game_values
$stats.play_sessions += 1 $stats.play_sessions += 1

View File

@@ -428,7 +428,7 @@ class TilemapRenderer
tile.z = 0 tile.z = 0
else else
priority = tile.priority priority = tile.priority
tile.z = (priority == 0) ? 0 : (y * SOURCE_TILE_HEIGHT) + (priority * SOURCE_TILE_HEIGHT) + SOURCE_TILE_HEIGHT tile.z = (priority == 0) ? 0 : (y * SOURCE_TILE_HEIGHT) + (priority * SOURCE_TILE_HEIGHT) + SOURCE_TILE_HEIGHT + 1
end end
end end

View File

@@ -156,7 +156,6 @@ module GameData
pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty? pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty?
if pkmn_data[:shadowness] if pkmn_data[:shadowness]
pkmn.makeShadow pkmn.makeShadow
pkmn.update_shadow_moves(true)
pkmn.shiny = false pkmn.shiny = false
end end
pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball] pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]

View File

@@ -150,9 +150,8 @@ class DayCare
egg.nature = new_natures.sample egg.nature = new_natures.sample
end end
# If a Pokémon is bred with a Ditto, that Pokémon can pass down its Hidden # The female parent (or the non-Ditto parent) can pass down its Hidden
# Ability (60% chance). If neither Pokémon are Ditto, then the mother can # Ability (60% chance) or its regular ability (80% chance).
# pass down its ability (60% chance if Hidden, 80% chance if not).
# NOTE: This is how ability inheritance works in Gen 6+. Gen 5 is more # NOTE: This is how ability inheritance works in Gen 6+. Gen 5 is more
# restrictive, and even works differently between BW and B2W2, and I # restrictive, and even works differently between BW and B2W2, and I
# don't think that is worth adding in. Gen 4 and lower don't have # don't think that is worth adding in. Gen 4 and lower don't have
@@ -164,12 +163,10 @@ class DayCare
parent = (mother[1]) ? father[0] : mother[0] # The female or non-Ditto parent parent = (mother[1]) ? father[0] : mother[0] # The female or non-Ditto parent
if parent.hasHiddenAbility? if parent.hasHiddenAbility?
egg.ability_index = parent.ability_index if rand(100) < 60 egg.ability_index = parent.ability_index if rand(100) < 60
elsif !mother[1] && !father[1] # If neither parent is a Ditto elsif rand(100) < 80
if rand(100) < 80 egg.ability_index = parent.ability_index
egg.ability_index = mother[0].ability_index
else else
egg.ability_index = (mother[0].ability_index + 1) % 2 egg.ability_index = (parent.ability_index + 1) % 2
end
end end
end end

View File

@@ -141,7 +141,7 @@ class Pokemon
end end
end end
def update_shadow_moves(relearn_all_moves = false) def update_shadow_moves
return if !@shadow_moves || @shadow_moves.empty? return if !@shadow_moves || @shadow_moves.empty?
# Not a Shadow Pokémon (any more); relearn all its original moves # Not a Shadow Pokémon (any more); relearn all its original moves
if !shadowPokemon? if !shadowPokemon?
@@ -159,7 +159,7 @@ class Pokemon
@shadow_moves.each_with_index { |m, i| new_moves.push(m) if m && i < MAX_MOVES } @shadow_moves.each_with_index { |m, i| new_moves.push(m) if m && i < MAX_MOVES }
num_shadow_moves = new_moves.length num_shadow_moves = new_moves.length
# Add some original moves (skipping ones in the same slot as a Shadow Move) # Add some original moves (skipping ones in the same slot as a Shadow Move)
num_original_moves = (relearn_all_moves) ? 3 : [3, 3, 2, 1, 1, 0][self.heartStage] num_original_moves = [3, 3, 2, 1, 1, 0][self.heartStage]
if num_original_moves > 0 if num_original_moves > 0
relearned_count = 0 relearned_count = 0
@shadow_moves.each_with_index do |m, i| @shadow_moves.each_with_index do |m, i|
@@ -174,17 +174,16 @@ class Pokemon
end end
def replace_moves(new_moves) def replace_moves(new_moves)
# Forget any known moves that aren't in new_moves
@moves.each_with_index do |m, i|
@moves[i] = nil if !new_moves.include?(m.id)
end
@moves.compact!
# Learn any moves in new_moves that aren't known
new_moves.each do |move| new_moves.each do |move|
next if !move || !GameData::Move.exists?(move) || hasMove?(move) next if !move || !GameData::Move.exists?(move) || hasMove?(move)
if numMoves < Pokemon::MAX_MOVES # Has an empty slot; just learn move break if numMoves >= Pokemon::MAX_MOVES
learn_move(move) learn_move(move)
next
end
@moves.each do |m|
next if new_moves.include?(m.id)
m.id = GameData::Move.get(move).id
break
end
end end
end end