mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 22:24:58 +00:00
More tweaks from the Rubocop overlord
This commit is contained in:
@@ -182,8 +182,8 @@ def pbGetEnvironment
|
||||
tile_environment = terrainTag.battle_environment
|
||||
if ret == :Forest && [:Grass, :TallGrass].include?(tile_environment)
|
||||
ret = :ForestGrass
|
||||
else
|
||||
ret = tile_environment if tile_environment
|
||||
elsif tile_environment
|
||||
ret = tile_environment
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -383,13 +383,14 @@ def pbTrainerBattleCore(*args)
|
||||
foeParty = []
|
||||
foePartyStarts = []
|
||||
for arg in args
|
||||
if arg.is_a?(NPCTrainer)
|
||||
case arg
|
||||
when NPCTrainer
|
||||
foeTrainers.push(arg)
|
||||
foePartyStarts.push(foeParty.length)
|
||||
arg.party.each { |pkmn| foeParty.push(pkmn) }
|
||||
foeEndSpeeches.push(arg.lose_text)
|
||||
foeItems.push(arg.items)
|
||||
elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)]
|
||||
when Array # [trainer type, trainer name, ID, speech (optional)]
|
||||
trainer = pbLoadTrainer(arg[0], arg[1], arg[2])
|
||||
pbMissingTrainer(arg[0], arg[1], arg[2]) if !trainer
|
||||
return 0 if !trainer
|
||||
@@ -530,8 +531,8 @@ def pbDoubleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
||||
setBattleRule("double")
|
||||
# Perform the battle
|
||||
decision = pbTrainerBattleCore(
|
||||
[trainerID1, trainerName1, trainerPartyID1, endSpeech1],
|
||||
[trainerID2, trainerName2, trainerPartyID2, endSpeech2]
|
||||
[trainerID1, trainerName1, trainerPartyID1, endSpeech1],
|
||||
[trainerID2, trainerName2, trainerPartyID2, endSpeech2]
|
||||
)
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return (decision == 1)
|
||||
@@ -547,9 +548,9 @@ def pbTripleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1,
|
||||
setBattleRule("triple")
|
||||
# Perform the battle
|
||||
decision = pbTrainerBattleCore(
|
||||
[trainerID1, trainerName1, trainerPartyID1, endSpeech1],
|
||||
[trainerID2, trainerName2, trainerPartyID2, endSpeech2],
|
||||
[trainerID3, trainerName3, trainerPartyID3, endSpeech3]
|
||||
[trainerID1, trainerName1, trainerPartyID1, endSpeech1],
|
||||
[trainerID2, trainerName2, trainerPartyID2, endSpeech2],
|
||||
[trainerID3, trainerName3, trainerPartyID3, endSpeech3]
|
||||
)
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return (decision == 1)
|
||||
@@ -644,38 +645,38 @@ def pbPickup(pkmn)
|
||||
return unless rand(100) < 10 # 10% chance
|
||||
# Common items to find (9 items from this list are added to the pool)
|
||||
pickupList = pbDynamicItemList(
|
||||
:POTION,
|
||||
:ANTIDOTE,
|
||||
:SUPERPOTION,
|
||||
:GREATBALL,
|
||||
:REPEL,
|
||||
:ESCAPEROPE,
|
||||
:FULLHEAL,
|
||||
:HYPERPOTION,
|
||||
:ULTRABALL,
|
||||
:REVIVE,
|
||||
:RARECANDY,
|
||||
:SUNSTONE,
|
||||
:MOONSTONE,
|
||||
:HEARTSCALE,
|
||||
:FULLRESTORE,
|
||||
:MAXREVIVE,
|
||||
:PPUP,
|
||||
:MAXELIXIR
|
||||
:POTION,
|
||||
:ANTIDOTE,
|
||||
:SUPERPOTION,
|
||||
:GREATBALL,
|
||||
:REPEL,
|
||||
:ESCAPEROPE,
|
||||
:FULLHEAL,
|
||||
:HYPERPOTION,
|
||||
:ULTRABALL,
|
||||
:REVIVE,
|
||||
:RARECANDY,
|
||||
:SUNSTONE,
|
||||
:MOONSTONE,
|
||||
:HEARTSCALE,
|
||||
:FULLRESTORE,
|
||||
:MAXREVIVE,
|
||||
:PPUP,
|
||||
:MAXELIXIR
|
||||
)
|
||||
# Rare items to find (2 items from this list are added to the pool)
|
||||
pickupListRare = pbDynamicItemList(
|
||||
:HYPERPOTION,
|
||||
:NUGGET,
|
||||
:KINGSROCK,
|
||||
:FULLRESTORE,
|
||||
:ETHER,
|
||||
:IRONBALL,
|
||||
:DESTINYKNOT,
|
||||
:ELIXIR,
|
||||
:DESTINYKNOT,
|
||||
:LEFTOVERS,
|
||||
:DESTINYKNOT
|
||||
:HYPERPOTION,
|
||||
:NUGGET,
|
||||
:KINGSROCK,
|
||||
:FULLRESTORE,
|
||||
:ETHER,
|
||||
:IRONBALL,
|
||||
:DESTINYKNOT,
|
||||
:ELIXIR,
|
||||
:DESTINYKNOT,
|
||||
:LEFTOVERS,
|
||||
:DESTINYKNOT
|
||||
)
|
||||
return if pickupList.length < 18
|
||||
return if pickupListRare.length < 11
|
||||
@@ -709,7 +710,7 @@ end
|
||||
def pbHoneyGather(pkmn)
|
||||
return if !GameData::Item.exists?(:HONEY)
|
||||
return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER) || pkmn.hasItem?
|
||||
chance = 5 + ((pkmn.level - 1) / 10) * 5
|
||||
chance = 5 + (((pkmn.level - 1) / 10) * 5)
|
||||
return unless rand(100) < chance
|
||||
pkmn.item = :HONEY
|
||||
end
|
||||
|
||||
@@ -155,7 +155,7 @@ def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil)
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
timer += Graphics.delta_s
|
||||
viewport.color.alpha = 255 * (1 - timer / 0.4)
|
||||
viewport.color.alpha = 255 * (1 - (timer / 0.4))
|
||||
break if viewport.color.alpha <= 0
|
||||
end
|
||||
viewport.dispose
|
||||
@@ -267,9 +267,9 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
|
||||
flash.opacity -= 52 * 20 / Graphics.frame_rate if flash.opacity > 0
|
||||
bar1.ox -= 32 * 20 / Graphics.frame_rate
|
||||
bar2.ox += 32 * 20 / Graphics.frame_rate
|
||||
if i >= animTime / 2 && i < slideInTime + animTime / 2
|
||||
player.x = xoffset * (i + 1 - slideInTime - animTime / 2) / slideInTime
|
||||
trainer.x = xoffset * (slideInTime - i - 1 + animTime / 2) / slideInTime
|
||||
if i >= animTime / 2 && i < slideInTime + (animTime / 2)
|
||||
player.x = xoffset * (i + 1 - slideInTime - (animTime / 2)) / slideInTime
|
||||
trainer.x = xoffset * (slideInTime - i - 1 + (animTime / 2)) / slideInTime
|
||||
end
|
||||
pbWait(1)
|
||||
end
|
||||
@@ -283,10 +283,10 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
|
||||
trainer.tone = Tone.new(0, 0, 0)
|
||||
trainername = foe[0].name
|
||||
textpos = [
|
||||
[$player.name, Graphics.width / 4, (Graphics.height / 1.5) + 4, 2,
|
||||
Color.new(248, 248, 248), Color.new(72, 72, 72)],
|
||||
[trainername, (Graphics.width / 4) + (Graphics.width / 2), (Graphics.height / 1.5) + 4, 2,
|
||||
Color.new(248, 248, 248), Color.new(72, 72, 72)]
|
||||
[$player.name, Graphics.width / 4, (Graphics.height / 1.5) + 4, 2,
|
||||
Color.new(248, 248, 248), Color.new(72, 72, 72)],
|
||||
[trainername, (Graphics.width / 4) + (Graphics.width / 2), (Graphics.height / 1.5) + 4, 2,
|
||||
Color.new(248, 248, 248), Color.new(72, 72, 72)]
|
||||
]
|
||||
pbDrawTextPositions(overlay.bitmap, textpos)
|
||||
# Fade out flash, shudder Vs logo and expand it, and then fade to black
|
||||
|
||||
@@ -114,7 +114,7 @@ class PokemonEncounters
|
||||
return true if pbPokeRadarOnShakingGrass
|
||||
# Get base encounter chance and minimum steps grace period
|
||||
encounter_chance = @step_chances[enc_type].to_f
|
||||
min_steps_needed = (8 - encounter_chance / 10).clamp(0, 8).to_f
|
||||
min_steps_needed = (8 - (encounter_chance / 10)).clamp(0, 8).to_f
|
||||
# Apply modifiers to the encounter chance and the minimum steps amount
|
||||
if triggered_by_step
|
||||
encounter_chance += @chance_accumulator / 200
|
||||
@@ -168,7 +168,7 @@ class PokemonEncounters
|
||||
# after a previous wild encounter
|
||||
if triggered_by_step && @step_count < min_steps_needed
|
||||
@step_count += 1
|
||||
return false if rand(100) >= encounter_chance * 5 / (@step_chances[enc_type] + @chance_accumulator / 200)
|
||||
return false if rand(100) >= encounter_chance * 5 / (@step_chances[enc_type] + (@chance_accumulator / 200))
|
||||
end
|
||||
# Decide whether the wild encounter should actually happen
|
||||
return true if rand(100) < encounter_chance
|
||||
@@ -429,7 +429,7 @@ def pbGenerateWildPokemon(species, level, isRoamer = false)
|
||||
shiny_retries.times do
|
||||
break if genwildpoke.shiny?
|
||||
genwildpoke.shiny = nil # Make it recalculate shininess
|
||||
genwildpoke.personalID = rand(2**16) | rand(2**16) << 16
|
||||
genwildpoke.personalID = rand(2**16) | (rand(2**16) << 16)
|
||||
end
|
||||
end
|
||||
# Give Pokérus
|
||||
|
||||
Reference in New Issue
Block a user