More tweaks from the Rubocop overlord

This commit is contained in:
Maruno17
2021-12-19 17:28:59 +00:00
parent 33781493f4
commit 65b1a8d6c3
161 changed files with 2839 additions and 2967 deletions

View File

@@ -319,7 +319,7 @@ def pbGainExpFromExpCandy(pkmn, base_amt, qty, scene)
if qty > 1
(qty - 1).times { pkmn.changeHappiness("vitamin") }
end
pbChangeExp(pkmn, pkmn.exp + base_amt * qty, scene)
pbChangeExp(pkmn, pkmn.exp + (base_amt * qty), scene)
scene.pbHardRefresh
return true
end
@@ -351,10 +351,8 @@ def pbBattleHPItem(pkmn, battler, restoreHP, scene)
if battler.pbRecoverHP(restoreHP) > 0
scene.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
end
else
if pbItemRestoreHP(pkmn, restoreHP) > 0
scene.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name))
end
elsif pbItemRestoreHP(pkmn, restoreHP) > 0
scene.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name))
end
return true
end
@@ -814,35 +812,27 @@ def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0)
if scene.pbConfirm(_INTL("Would you like to switch the two items?"))
$bag.remove(item)
if !$bag.add(pkmn.item)
if !$bag.add(item)
raise _INTL("Could't re-store deleted item in Bag somehow")
end
raise _INTL("Couldn't re-store deleted item in Bag somehow") if !$bag.add(item)
scene.pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed."))
else
if GameData::Item.get(item).is_mail?
if pbWriteMail(item, pkmn, pkmnid, scene)
pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname))
return true
else
if !$bag.add(item)
raise _INTL("Couldn't re-store deleted item in Bag somehow")
end
end
else
elsif GameData::Item.get(item).is_mail?
if pbWriteMail(item, pkmn, pkmnid, scene)
pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname))
return true
elsif !$bag.add(item)
raise _INTL("Couldn't re-store deleted item in Bag somehow")
end
else
pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname))
return true
end
end
else
if !GameData::Item.get(item).is_mail? || pbWriteMail(item, pkmn, pkmnid, scene)
$bag.remove(item)
pkmn.item = item
scene.pbDisplay(_INTL("{1} is now holding the {2}.", pkmn.name, newitemname))
return true
end
elsif !GameData::Item.get(item).is_mail? || pbWriteMail(item, pkmn, pkmnid, scene)
$bag.remove(item)
pkmn.item = item
scene.pbDisplay(_INTL("{1} is now holding the {2}.", pkmn.name, newitemname))
return true
end
return false
end

View File

@@ -943,11 +943,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:POMEGBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:POMEGBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :HP, qty, [
_INTL("{1} adores you! Its base HP fell!", pkmn.name),
_INTL("{1} became more friendly. Its base HP can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base HP fell!", pkmn.name)
])
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :HP, qty, [
_INTL("{1} adores you! Its base HP fell!", pkmn.name),
_INTL("{1} became more friendly. Its base HP can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base HP fell!", pkmn.name)
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:KELPSYBERRY, proc { |item, pkmn|
@@ -955,11 +957,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:KELPSYBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:KELPSYBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :ATTACK, qty, [
_INTL("{1} adores you! Its base Attack fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Attack can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Attack fell!", pkmn.name)
])
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :ATTACK, qty, [
_INTL("{1} adores you! Its base Attack fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Attack can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Attack fell!", pkmn.name)
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:QUALOTBERRY, proc { |item, pkmn|
@@ -967,11 +971,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:QUALOTBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:QUALOTBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :DEFENSE, qty, [
_INTL("{1} adores you! Its base Defense fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Defense can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Defense fell!", pkmn.name)
])
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :DEFENSE, qty, [
_INTL("{1} adores you! Its base Defense fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Defense can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Defense fell!", pkmn.name)
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:HONDEWBERRY, proc { |item, pkmn|
@@ -979,11 +985,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:HONDEWBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:HONDEWBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPECIAL_ATTACK, qty, [
_INTL("{1} adores you! Its base Special Attack fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Special Attack can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Special Attack fell!", pkmn.name)
])
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :SPECIAL_ATTACK, qty, [
_INTL("{1} adores you! Its base Special Attack fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Special Attack can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Special Attack fell!", pkmn.name)
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:GREPABERRY, proc { |item, pkmn|
@@ -991,11 +999,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:GREPABERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:GREPABERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPECIAL_DEFENSE, qty, [
_INTL("{1} adores you! Its base Special Defense fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Special Defense can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Special Defense fell!", pkmn.name)
])
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :SPECIAL_DEFENSE, qty, [
_INTL("{1} adores you! Its base Special Defense fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Special Defense can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Special Defense fell!", pkmn.name)
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:TAMATOBERRY, proc { |item, pkmn|
@@ -1003,11 +1013,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:TAMATOBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:TAMATOBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPEED, qty, [
_INTL("{1} adores you! Its base Speed fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Speed can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Speed fell!", pkmn.name)
])
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :SPEED, qty, [
_INTL("{1} adores you! Its base Speed fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Speed can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Speed fell!", pkmn.name)
]
)
})
ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE, proc { |item, qty, pkmn, scene|

View File

@@ -49,8 +49,8 @@ ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_pok
if battle.pbOpposingBattlerCount > 1 && !(GameData::Item.get(item).is_snag_ball? && battle.trainerBattle?)
if battle.pbOpposingBattlerCount == 2
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are two Pokémon!")) if showMessages
else
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are more than one Pokémon!")) if showMessages
elsif showMessages
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are more than one Pokémon!"))
end
next false
end

View File

@@ -150,7 +150,7 @@ Events.onMapUpdate += proc { |_sender, _e|
next if !num[0] || num.length != 8 # if not visible or not a trainer
# Reset time to next can-battle if necessary
if num[4] == 0
num[3] = 20 * 60 + rand(20 * 60) # 20-40 minutes
num[3] = rand(20...40) * 60 # 20-40 minutes
num[4] = 1
end
# Count down time to next can-battle

View File

@@ -66,11 +66,11 @@ def pbPokeRadarHighlightGrass(showmessage = true)
if r <= (i + 1) * 2
x = $game_player.x - i - 1 + r
y = $game_player.y - i - 1
elsif r <= (i + 1) * 6 - 2
elsif r <= ((i + 1) * 6) - 2
x = [$game_player.x + i + 1, $game_player.x - i - 1][r % 2]
y = $game_player.y - i + ((r - 1 - (i + 1) * 2) / 2).floor
y = $game_player.y - i + ((r - 1 - ((i + 1) * 2)) / 2).floor
else
x = $game_player.x - i + r - (i + 1) * 6
x = $game_player.x - i + r - ((i + 1) * 6)
y = $game_player.y + i + 1
end
# Add tile to grasses array if it's a valid grass tile
@@ -81,7 +81,7 @@ def pbPokeRadarHighlightGrass(showmessage = true)
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
s = (rand(100) < 25) ? 1 : 0
if $game_temp.poke_radar_data && $game_temp.poke_radar_data[2] > 0
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - [$game_temp.poke_radar_data[2], 40].min * 200, 200].max
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - ([$game_temp.poke_radar_data[2], 40].min * 200), 200].max
v = (65536 / v.to_f).ceil
s = 2 if rand(65536) < v
end
@@ -164,7 +164,7 @@ EncounterModifier.register(proc { |encounter|
$game_temp.poke_radar_data[3].each { |g| rarity = g[3] if g[2] == ring }
if $game_temp.poke_radar_data[2] > 0 # Chain count, i.e. is chaining
if rarity == 2 ||
rand(100) < 58 + ring * 10 + ([$game_temp.poke_radar_data[2], 40].min / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0)
rand(100) < 58 + (ring * 10) + ([$game_temp.poke_radar_data[2], 40].min / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0)
# Continue the chain
encounter = [$game_temp.poke_radar_data[0], $game_temp.poke_radar_data[1]]
$game_temp.force_single_battle = true
@@ -186,8 +186,8 @@ EncounterModifier.register(proc { |encounter|
encounter = pbPokeRadarGetEncounter(rarity)
$game_temp.force_single_battle = true
end
else # Encounter triggered by stepping in non-rustling grass
pbPokeRadarCancel if encounter
elsif encounter # Encounter triggered by stepping in non-rustling grass
pbPokeRadarCancel
end
next encounter
})