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

@@ -573,7 +573,7 @@ def pbAfterBattle(decision, canLose)
pkmn.makeUnprimal
end
end
if decision == 2 || decision == 5 # if loss or draw
if [2, 5].include?(decision) # if loss or draw
if canLose
$player.party.each { |pkmn| pkmn.heal }
(Graphics.frame_rate / 4).times { Graphics.update }

View File

@@ -180,7 +180,7 @@ end
##### VS. animation, by Luka S.J. #####
##### Tweaked by Maruno #####
SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
Proc.new { |battle_type, foe| # Condition
proc { |battle_type, foe| # Condition
next false unless [1, 3].include?(battle_type) && foe.length == 1 # Only if a single trainer
tr_type = foe[0].trainer_type
next false if !tr_type
@@ -189,7 +189,7 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
next pbResolveBitmap("Graphics/Transitions/" + trainer_bar_graphic) &&
pbResolveBitmap("Graphics/Transitions/" + trainer_graphic)
},
Proc.new { |viewport, battle_type, foe| # Animation
proc { |viewport, battle_type, foe| # Animation
# Determine filenames of graphics to be used
tr_type = foe[0].trainer_type
trainer_bar_graphic = sprintf("vsBar_%s", tr_type.to_s) rescue nil

View File

@@ -208,7 +208,7 @@ def pbRoamingPokemonBattle(species, level)
# Perform the battle
decision = pbWildBattleCore($PokemonGlobal.roamPokemon[idxRoamer])
# Update Roaming Pokémon data based on result of battle
if decision == 1 || decision == 4 # Defeated or caught
if [1, 4].include?(decision) # Defeated or caught
$PokemonGlobal.roamPokemon[idxRoamer] = true
$PokemonGlobal.roamPokemonCaught[idxRoamer] = (decision == 4)
end