Many more Rubocop-inspired code improvements

This commit is contained in:
Maruno17
2021-12-18 19:06:22 +00:00
parent d17fc40a47
commit 13a238cc6a
107 changed files with 651 additions and 652 deletions

View File

@@ -197,12 +197,8 @@ class BattleChallengeData
end
def setParty(value)
if @inProgress
$player.party = value
@party = value
else
@party = value
end
$player.party = value if @inProgress
@party = value
end
def pbStart(t, numRounds)

View File

@@ -87,7 +87,7 @@ def pbOrganizedBattleEx(opponent, challengedata, endspeech, endspeechwin)
end
# Save the record of the battle
$game_temp.last_battle_record = nil
if decision == 1 || decision == 2 || decision == 5 # if win, loss or draw
if [1, 2, 5].include?(decision) # if win, loss or draw
$game_temp.last_battle_record = battle.pbDumpRecord
end
case decision

View File

@@ -104,9 +104,10 @@ class BattleSwapScene
def pbUpdateChoices(choices)
commands = pbGetCommands(@rentals, choices)
@choices = choices
if choices.length == 0
case choices.length
when 0
@sprites["help"].text = _INTL("Choose the first Pokémon.")
elsif choices.length == 1
when 1
@sprites["help"].text = _INTL("Choose the second Pokémon.")
else
@sprites["help"].text = _INTL("Choose the third Pokémon.")
@@ -162,9 +163,10 @@ class BattleSwapScreen
end
commands.push(_INTL("OTHERS"))
command = @scene.pbShowCommands(commands)
if command == 0
case command
when 0
@scene.pbSummary(rentals, index)
elsif command == 1
when 1
if chosen.include?(index)
chosen.delete(index)
@scene.pbUpdateChoices(chosen.clone)
@@ -194,9 +196,10 @@ class BattleSwapScreen
if pkmn >= 0
commands = [_INTL("SUMMARY"), _INTL("SWAP"), _INTL("RECHOOSE")]
command = @scene.pbShowCommands(commands)
if command == 0
case command
when 0
@scene.pbSummary(currentPokemon, pkmn)
elsif command == 1
when 1
@scene.pbSwapChosen(pkmn)
yourPkmn = pkmn
loop do