* Bugfixes

Fixed pbLearnMove not asking you to replace a move if you have the max amount of moves
Removed instance of hasOwned

Co-authored-by: Maruno17 <serialcolour@hotmail.com>
This commit is contained in:
Golisopod-User
2021-05-01 22:10:05 +05:30
committed by GitHub
parent 748ea472ba
commit 90c18ecc79
2 changed files with 11 additions and 9 deletions

View File

@@ -44,7 +44,7 @@ module PokeBattle_BattleCommon
@caughtPokemon.each do |pkmn| @caughtPokemon.each do |pkmn|
pbPlayer.pokedex.register(pkmn) # In case the form changed upon leaving battle pbPlayer.pokedex.register(pkmn) # In case the form changed upon leaving battle
# Record the Pokémon's species as owned in the Pokédex # 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) pbPlayer.pokedex.set_owned(pkmn.species)
if $Trainer.has_pokedex if $Trainer.has_pokedex
pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pkmn.name)) pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pkmn.name))

View File

@@ -225,17 +225,19 @@ class PokeBattle_Battle
pkmnName = pkmn.name pkmnName = pkmn.name
battler = pbFindBattler(idxParty) battler = pbFindBattler(idxParty)
moveName = GameData::Move.get(newMove).name moveName = GameData::Move.get(newMove).name
# Find a space for the new move in pkmn's moveset and learn it # Pokémon already knows the move
for i in 0...Pokemon::MAX_MOVES return if pkmn.moves.any? { |m| m && m.id == newMove }
m = pkmn.moves[i] # Pokémon has space for the new move; just learn it
return if m && m.id==newMove # Already knows the new move if pkmn.moves.length < Pokemon::MAX_MOVES
pkmn.moves[i] = Pokemon::Move.new(newMove) pkmn.moves.push(Pokemon::Move.new(newMove))
battler.moves[i] = PokeBattle_Move.from_pokemon_move(self, pkmn.moves[i]) if battler
pbDisplay(_INTL("{1} learned {2}!",pkmnName,moveName)) { pbSEPlay("Pkmn move learnt") } 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 return
end 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 loop do
pbDisplayPaused(_INTL("{1} wants to learn {2}, but it already knows four moves.",pkmnName,moveName)) 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)) if pbDisplayConfirm(_INTL("Forget a move to learn {1}?",moveName))