Added decent spacing to all scripts thanks to Rubocop

This commit is contained in:
Maruno17
2021-12-18 15:25:40 +00:00
parent f7b76ae62e
commit d17fc40a47
207 changed files with 18577 additions and 18587 deletions

View File

@@ -6,16 +6,16 @@ class PokemonTrade_Scene
pbUpdateSpriteHash(@sprites)
end
def pbRunPictures(pictures,sprites)
def pbRunPictures(pictures, sprites)
loop do
for i in 0...pictures.length
pictures[i].update
end
for i in 0...sprites.length
if sprites[i].is_a?(IconSprite)
setPictureIconSprite(sprites[i],pictures[i])
setPictureIconSprite(sprites[i], pictures[i])
else
setPictureSprite(sprites[i],pictures[i])
setPictureSprite(sprites[i], pictures[i])
end
end
Graphics.update
@@ -28,27 +28,27 @@ class PokemonTrade_Scene
end
end
def pbStartScreen(pokemon,pokemon2,trader1,trader2)
def pbStartScreen(pokemon, pokemon2, trader1, trader2)
@sprites = {}
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@pokemon = pokemon
@pokemon2 = pokemon2
@trader1 = trader1
@trader2 = trader2
addBackgroundOrColoredPlane(@sprites,"background","tradebg",
Color.new(248,248,248),@viewport)
addBackgroundOrColoredPlane(@sprites, "background", "tradebg",
Color.new(248, 248, 248), @viewport)
@sprites["rsprite1"] = PokemonSprite.new(@viewport)
@sprites["rsprite1"].setPokemonBitmap(@pokemon,false)
@sprites["rsprite1"].setPokemonBitmap(@pokemon, false)
@sprites["rsprite1"].setOffset(PictureOrigin::Bottom)
@sprites["rsprite1"].x = Graphics.width/2
@sprites["rsprite1"].x = Graphics.width / 2
@sprites["rsprite1"].y = 264
@sprites["rsprite1"].z = 10
@pokemon.species_data.apply_metrics_to_sprite(@sprites["rsprite1"], 1)
@sprites["rsprite2"] = PokemonSprite.new(@viewport)
@sprites["rsprite2"].setPokemonBitmap(@pokemon2,false)
@sprites["rsprite2"].setPokemonBitmap(@pokemon2, false)
@sprites["rsprite2"].setOffset(PictureOrigin::Bottom)
@sprites["rsprite2"].x = Graphics.width/2
@sprites["rsprite2"].x = Graphics.width / 2
@sprites["rsprite2"].y = 264
@sprites["rsprite2"].z = 10
@pokemon2.species_data.apply_metrics_to_sprite(@sprites["rsprite2"], 1)
@@ -58,100 +58,100 @@ class PokemonTrade_Scene
end
def pbScene1
spriteBall = IconSprite.new(0,0,@viewport)
spriteBall = IconSprite.new(0, 0, @viewport)
pictureBall = PictureEx.new(0)
picturePoke = PictureEx.new(0)
ballimage = sprintf("Graphics/Battle animations/ball_%s", @pokemon.poke_ball)
ballopenimage = sprintf("Graphics/Battle animations/ball_%s_open", @pokemon.poke_ball)
# Starting position of ball
pictureBall.setXY(0,Graphics.width/2,48)
pictureBall.setName(0,ballimage)
pictureBall.setSrcSize(0,32,64)
pictureBall.setOrigin(0,PictureOrigin::Center)
pictureBall.setVisible(0,true)
pictureBall.setXY(0, Graphics.width / 2, 48)
pictureBall.setName(0, ballimage)
pictureBall.setSrcSize(0, 32, 64)
pictureBall.setOrigin(0, PictureOrigin::Center)
pictureBall.setVisible(0, true)
# Starting position of sprite
picturePoke.setXY(0,@sprites["rsprite1"].x,@sprites["rsprite1"].y)
picturePoke.setOrigin(0,PictureOrigin::Bottom)
picturePoke.setVisible(0,true)
picturePoke.setXY(0, @sprites["rsprite1"].x, @sprites["rsprite1"].y)
picturePoke.setOrigin(0, PictureOrigin::Bottom)
picturePoke.setVisible(0, true)
# Change Pokémon color
picturePoke.moveColor(2,5,Color.new(31*8,22*8,30*8,255))
picturePoke.moveColor(2, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 255))
# Recall
delay = picturePoke.totalDuration
picturePoke.setSE(delay,"Battle recall")
pictureBall.setName(delay,ballopenimage)
pictureBall.setSrcSize(delay,32,64)
picturePoke.setSE(delay, "Battle recall")
pictureBall.setName(delay, ballopenimage)
pictureBall.setSrcSize(delay, 32, 64)
# Move sprite to ball
picturePoke.moveZoom(delay,8,0)
picturePoke.moveXY(delay,8,Graphics.width/2,48)
picturePoke.setSE(delay+5,"Battle jump to ball")
picturePoke.setVisible(delay+8,false)
delay = picturePoke.totalDuration+1
pictureBall.setName(delay,ballimage)
pictureBall.setSrcSize(delay,32,64)
picturePoke.moveZoom(delay, 8, 0)
picturePoke.moveXY(delay, 8, Graphics.width / 2, 48)
picturePoke.setSE(delay + 5, "Battle jump to ball")
picturePoke.setVisible(delay + 8, false)
delay = picturePoke.totalDuration + 1
pictureBall.setName(delay, ballimage)
pictureBall.setSrcSize(delay, 32, 64)
# Make Poké Ball go off the top of the screen
delay = picturePoke.totalDuration+10
pictureBall.moveXY(delay,6,Graphics.width/2,-32)
delay = picturePoke.totalDuration + 10
pictureBall.moveXY(delay, 6, Graphics.width / 2, -32)
# Play animation
pbRunPictures(
[picturePoke,pictureBall],
[@sprites["rsprite1"],spriteBall]
[picturePoke, pictureBall],
[@sprites["rsprite1"], spriteBall]
)
spriteBall.dispose
end
def pbScene2
spriteBall = IconSprite.new(0,0,@viewport)
spriteBall = IconSprite.new(0, 0, @viewport)
pictureBall = PictureEx.new(0)
picturePoke = PictureEx.new(0)
ballimage = sprintf("Graphics/Battle animations/ball_%s", @pokemon2.poke_ball)
ballopenimage = sprintf("Graphics/Battle animations/ball_%s_open", @pokemon2.poke_ball)
# Starting position of ball
pictureBall.setXY(0,Graphics.width/2,-32)
pictureBall.setName(0,ballimage)
pictureBall.setSrcSize(0,32,64)
pictureBall.setOrigin(0,PictureOrigin::Center)
pictureBall.setVisible(0,true)
pictureBall.setXY(0, Graphics.width / 2, -32)
pictureBall.setName(0, ballimage)
pictureBall.setSrcSize(0, 32, 64)
pictureBall.setOrigin(0, PictureOrigin::Center)
pictureBall.setVisible(0, true)
# Starting position of sprite
picturePoke.setOrigin(0,PictureOrigin::Bottom)
picturePoke.setZoom(0,0)
picturePoke.setColor(0,Color.new(31*8,22*8,30*8,255))
picturePoke.setVisible(0,false)
picturePoke.setOrigin(0, PictureOrigin::Bottom)
picturePoke.setZoom(0, 0)
picturePoke.setColor(0, Color.new(31 * 8, 22 * 8, 30 * 8, 255))
picturePoke.setVisible(0, false)
# Dropping ball
y = Graphics.height-96-16-16 # end point of Poké Ball
delay = picturePoke.totalDuration+2
y = Graphics.height - 96 - 16 - 16 # end point of Poké Ball
delay = picturePoke.totalDuration + 2
for i in 0...4
t = [4,4,3,2][i] # Time taken to rise or fall for each bounce
d = [1,2,4,8][i] # Fraction of the starting height each bounce rises to
delay -= t if i==0
if i>0
pictureBall.setZoomXY(delay,100+5*(5-i),100-5*(5-i)) # Squish
pictureBall.moveZoom(delay,2,100) # Unsquish
pictureBall.moveXY(delay,t,Graphics.width/2,y-100/d)
t = [4, 4, 3, 2][i] # Time taken to rise or fall for each bounce
d = [1, 2, 4, 8][i] # Fraction of the starting height each bounce rises to
delay -= t if i == 0
if i > 0
pictureBall.setZoomXY(delay, 100 + 5 * (5 - i), 100 - 5 * (5 - i)) # Squish
pictureBall.moveZoom(delay, 2, 100) # Unsquish
pictureBall.moveXY(delay, t, Graphics.width / 2, y - 100 / d)
end
pictureBall.moveXY(delay+t,t,Graphics.width/2,y)
pictureBall.setSE(delay+2*t,"Battle ball drop")
pictureBall.moveXY(delay + t, t, Graphics.width / 2, y)
pictureBall.setSE(delay + 2 * t, "Battle ball drop")
delay = pictureBall.totalDuration
end
picturePoke.setXY(delay,Graphics.width/2,y)
picturePoke.setXY(delay, Graphics.width / 2, y)
# Open Poké Ball
delay = pictureBall.totalDuration+15
pictureBall.setSE(delay,"Battle recall")
pictureBall.setName(delay,ballopenimage)
pictureBall.setSrcSize(delay,32,64)
pictureBall.setVisible(delay+5,false)
delay = pictureBall.totalDuration + 15
pictureBall.setSE(delay, "Battle recall")
pictureBall.setName(delay, ballopenimage)
pictureBall.setSrcSize(delay, 32, 64)
pictureBall.setVisible(delay + 5, false)
# Pokémon appears and enlarges
picturePoke.setVisible(delay,true)
picturePoke.moveZoom(delay,8,100)
picturePoke.moveXY(delay,8,Graphics.width/2,@sprites["rsprite2"].y)
picturePoke.setVisible(delay, true)
picturePoke.moveZoom(delay, 8, 100)
picturePoke.moveXY(delay, 8, Graphics.width / 2, @sprites["rsprite2"].y)
# Return Pokémon's color to normal and play cry
delay = picturePoke.totalDuration
picturePoke.moveColor(delay,5,Color.new(31*8,22*8,30*8,0))
picturePoke.moveColor(delay, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 0))
cry = GameData::Species.cry_filename_from_pokemon(@pokemon2)
picturePoke.setSE(delay,cry) if cry
picturePoke.setSE(delay, cry) if cry
# Play animation
pbRunPictures(
[picturePoke,pictureBall],
[@sprites["rsprite2"],spriteBall]
[picturePoke, pictureBall],
[@sprites["rsprite2"], spriteBall]
)
spriteBall.dispose
end
@@ -164,7 +164,7 @@ class PokemonTrade_Scene
newspecies = @pokemon2.check_evolution_on_trade(@pokemon)
if newspecies
evo = PokemonEvolutionScene.new
evo.pbStartScreen(@pokemon2,newspecies)
evo.pbStartScreen(@pokemon2, newspecies)
evo.pbEvolution(false)
evo.pbEndScreen
end
@@ -173,31 +173,31 @@ class PokemonTrade_Scene
def pbTrade
pbBGMStop
@pokemon.play_cry
speciesname1=GameData::Species.get(@pokemon.species).name
speciesname2=GameData::Species.get(@pokemon2.species).name
speciesname1 = GameData::Species.get(@pokemon.species).name
speciesname2 = GameData::Species.get(@pokemon2.species).name
pbMessageDisplay(@sprites["msgwindow"],
_ISPRINTF("{1:s}\r\nID: {2:05d} OT: {3:s}\\wtnp[0]",
@pokemon.name,@pokemon.owner.public_id,@pokemon.owner.name)) { pbUpdate }
pbMessageWaitForInput(@sprites["msgwindow"],50,true) { pbUpdate }
@pokemon.name, @pokemon.owner.public_id, @pokemon.owner.name)) { pbUpdate }
pbMessageWaitForInput(@sprites["msgwindow"], 50, true) { pbUpdate }
pbPlayDecisionSE
pbScene1
pbMessageDisplay(@sprites["msgwindow"],
_INTL("For {1}'s {2},\r\n{3} sends {4}.\1",@trader1,speciesname1,@trader2,speciesname2)) { pbUpdate }
_INTL("For {1}'s {2},\r\n{3} sends {4}.\1", @trader1, speciesname1, @trader2, speciesname2)) { pbUpdate }
pbMessageDisplay(@sprites["msgwindow"],
_INTL("{1} bids farewell to {2}.",@trader2,speciesname2)) { pbUpdate }
_INTL("{1} bids farewell to {2}.", @trader2, speciesname2)) { pbUpdate }
pbScene2
pbMessageDisplay(@sprites["msgwindow"],
_ISPRINTF("{1:s}\r\nID: {2:05d} OT: {3:s}\1",
@pokemon2.name,@pokemon2.owner.public_id,@pokemon2.owner.name)) { pbUpdate }
@pokemon2.name, @pokemon2.owner.public_id, @pokemon2.owner.name)) { pbUpdate }
pbMessageDisplay(@sprites["msgwindow"],
_INTL("Take good care of {1}.",speciesname2)) { pbUpdate }
_INTL("Take good care of {1}.", speciesname2)) { pbUpdate }
end
end
#===============================================================================
#
#===============================================================================
def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender = 0)
def pbStartTrade(pokemonIndex, newpoke, nickname, trainerName, trainerGender = 0)
$stats.trade_count += 1
myPokemon = $player.party[pokemonIndex]
yourPokemon = nil