diff --git a/Data/Scripts/011_Battle/003_Battle/001_PokeBattle_BattleCommon.rb b/Data/Scripts/011_Battle/003_Battle/001_PokeBattle_BattleCommon.rb index deb2161bb..62cfb3108 100644 --- a/Data/Scripts/011_Battle/003_Battle/001_PokeBattle_BattleCommon.rb +++ b/Data/Scripts/011_Battle/003_Battle/001_PokeBattle_BattleCommon.rb @@ -44,7 +44,7 @@ module PokeBattle_BattleCommon @caughtPokemon.each do |pkmn| pbPlayer.pokedex.register(pkmn) # In case the form changed upon leaving battle # Record the Pokémon's species as owned in the Pokédex - if !pbPlayer.hasOwned?(pkmn.species) + if !pbPlayer.owned?(pkmn.species) pbPlayer.pokedex.set_owned(pkmn.species) if $Trainer.has_pokedex pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pkmn.name)) diff --git a/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb b/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb index 96896e731..1a7d4a38f 100644 --- a/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb +++ b/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb @@ -225,17 +225,19 @@ class PokeBattle_Battle pkmnName = pkmn.name battler = pbFindBattler(idxParty) moveName = GameData::Move.get(newMove).name - # Find a space for the new move in pkmn's moveset and learn it - for i in 0...Pokemon::MAX_MOVES - m = pkmn.moves[i] - return if m && m.id==newMove # Already knows the new move - pkmn.moves[i] = Pokemon::Move.new(newMove) - battler.moves[i] = PokeBattle_Move.from_pokemon_move(self, pkmn.moves[i]) if battler + # Pokémon already knows the move + return if pkmn.moves.any? { |m| m && m.id == newMove } + # Pokémon has space for the new move; just learn it + if pkmn.moves.length < Pokemon::MAX_MOVES + pkmn.moves.push(Pokemon::Move.new(newMove)) pbDisplay(_INTL("{1} learned {2}!",pkmnName,moveName)) { pbSEPlay("Pkmn move learnt") } - battler.pbCheckFormOnMovesetChange if battler + if battler + battler.moves.push(PokeBattle_Move.from_pokemon_move(self, pkmn.moves.last)) + battler.pbCheckFormOnMovesetChange + end return end - # pkmn already knows four moves, need to forget one to learn newMove + # Pokémon already knows the maximum number of moves; try to forget one to learn the new move loop do pbDisplayPaused(_INTL("{1} wants to learn {2}, but it already knows four moves.",pkmnName,moveName)) if pbDisplayConfirm(_INTL("Forget a move to learn {1}?",moveName))