More aligning of code

This commit is contained in:
Maruno17
2021-12-19 12:19:08 +00:00
parent 13a238cc6a
commit 33781493f4
121 changed files with 977 additions and 838 deletions

View File

@@ -28,11 +28,12 @@ class Battle::Scene
pbCreateBackdropSprites
# Create message box graphic
messageBox = pbAddSprite("messageBox", 0, Graphics.height - 96,
"Graphics/Pictures/Battle/overlay_message", @viewport)
"Graphics/Pictures/Battle/overlay_message", @viewport)
messageBox.z = 195
# Create message window (displays the message)
msgWindow = Window_AdvancedTextPokemon.newWithSize("",
16, Graphics.height - 96 + 2, Graphics.width - 32, 96, @viewport)
msgWindow = Window_AdvancedTextPokemon.newWithSize(
"", 16, Graphics.height - 96 + 2, Graphics.width - 32, 96, @viewport
)
msgWindow.z = 200
msgWindow.opacity = 0
msgWindow.baseColor = MESSAGE_BASE_COLOR
@@ -49,7 +50,7 @@ class Battle::Scene
# The party lineup graphics (bar and balls) for both sides
for side in 0...2
partyBar = pbAddSprite("partyBar_#{side}", 0, 0,
"Graphics/Pictures/Battle/overlay_lineup", @viewport)
"Graphics/Pictures/Battle/overlay_lineup", @viewport)
partyBar.z = 120
partyBar.mirror = true if side == 0 # Player's lineup bar only
partyBar.visible = false
@@ -139,7 +140,7 @@ class Battle::Scene
for side in 0...2
baseX, baseY = Battle::Scene.pbBattlerPosition(side)
base = pbAddSprite("base_#{side}", baseX, baseY,
(side == 0) ? playerBase : enemyBase, @viewport)
(side == 0) ? playerBase : enemyBase, @viewport)
base.z = 1
if base.bitmap
base.ox = base.bitmap.width / 2

View File

@@ -200,10 +200,10 @@ class Battle::Scene
# Start Bag screen
itemScene = PokemonBag_Scene.new
itemScene.pbStartScene($bag, true,
proc { |item|
useType = GameData::Item.get(item).battle_use
next useType && useType > 0
}, false)
proc { |item|
useType = GameData::Item.get(item).battle_use
next useType && useType > 0
}, false)
# Loop while in Bag screen
wasTargeting = false
loop do

View File

@@ -58,8 +58,9 @@ class Battle::Scene
# Animates a party lineup appearing for the given side
#=============================================================================
def pbShowPartyLineup(side, fullAnim = false)
@animations.push(Animation::LineupAppear.new(@sprites, @viewport,
side, @battle.pbParty(side), @battle.pbPartyStarts(side), fullAnim))
@animations.push(Animation::LineupAppear.new(
@sprites, @viewport, side, @battle.pbParty(side), @battle.pbPartyStarts(side), fullAnim
))
if !fullAnim
while inPartyAnimation?
pbUpdate
@@ -112,13 +113,15 @@ class Battle::Scene
pbChangePokemon(b[0], pkmn)
pbRefresh
if @battle.opposes?(b[0])
sendOutAnim = Animation::PokeballTrainerSendOut.new(@sprites, @viewport,
@battle.pbGetOwnerIndexFromBattlerIndex(b[0]) + 1,
@battle.battlers[b[0]], startBattle, i)
sendOutAnim = Animation::PokeballTrainerSendOut.new(
@sprites, @viewport, @battle.pbGetOwnerIndexFromBattlerIndex(b[0]) + 1,
@battle.battlers[b[0]], startBattle, i
)
else
sendOutAnim = Animation::PokeballPlayerSendOut.new(@sprites, @viewport,
@battle.pbGetOwnerIndexFromBattlerIndex(b[0]) + 1,
@battle.battlers[b[0]], startBattle, i)
sendOutAnim = Animation::PokeballPlayerSendOut.new(
@sprites, @viewport, @battle.pbGetOwnerIndexFromBattlerIndex(b[0]) + 1,
@battle.battlers[b[0]], startBattle, i
)
end
dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, b[0])
sendOutAnims.push([sendOutAnim, dataBoxAnim, false])
@@ -296,11 +299,13 @@ class Battle::Scene
def pbLevelUp(pkmn, _battler, oldTotalHP, oldAttack, oldDefense, oldSpAtk, oldSpDef, oldSpeed)
pbTopRightWindow(
_INTL("Max. HP<r>+{1}\r\nAttack<r>+{2}\r\nDefense<r>+{3}\r\nSp. Atk<r>+{4}\r\nSp. Def<r>+{5}\r\nSpeed<r>+{6}",
pkmn.totalhp - oldTotalHP, pkmn.attack - oldAttack, pkmn.defense - oldDefense,
pkmn.spatk - oldSpAtk, pkmn.spdef - oldSpDef, pkmn.speed - oldSpeed))
pkmn.totalhp - oldTotalHP, pkmn.attack - oldAttack, pkmn.defense - oldDefense,
pkmn.spatk - oldSpAtk, pkmn.spdef - oldSpDef, pkmn.speed - oldSpeed)
)
pbTopRightWindow(
_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed))
pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed)
)
end
#=============================================================================
@@ -326,8 +331,9 @@ class Battle::Scene
#=============================================================================
def pbThrow(ball, shakes, critical, targetBattler, showPlayer = false)
@briefMessage = false
captureAnim = Animation::PokeballThrowCapture.new(@sprites, @viewport,
ball, shakes, critical, @battle.battlers[targetBattler], showPlayer)
captureAnim = Animation::PokeballThrowCapture.new(
@sprites, @viewport, ball, shakes, critical, @battle.battlers[targetBattler], showPlayer
)
loop do
captureAnim.update
pbUpdate
@@ -367,8 +373,9 @@ class Battle::Scene
def pbThrowAndDeflect(ball, idxBattler)
@briefMessage = false
throwAnim = Animation::PokeballThrowDeflect.new(@sprites, @viewport,
ball, @battle.battlers[idxBattler])
throwAnim = Animation::PokeballThrowDeflect.new(
@sprites, @viewport, ball, @battle.battlers[idxBattler]
)
loop do
throwAnim.update
pbUpdate
@@ -533,8 +540,9 @@ class Battle::Scene
targetHeight = userHeight
end
animPlayer.setLineTransform(
FOCUSUSER_X, FOCUSUSER_Y, FOCUSTARGET_X, FOCUSTARGET_Y,
oldUserX, oldUserY - userHeight / 2, oldTargetX, oldTargetY - targetHeight / 2)
FOCUSUSER_X, FOCUSUSER_Y, FOCUSTARGET_X, FOCUSTARGET_Y,
oldUserX, oldUserY - userHeight / 2, oldTargetX, oldTargetY - targetHeight / 2
)
# Play the animation
animPlayer.start
loop do

View File

@@ -118,8 +118,9 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
self.x = 0
self.y = Graphics.height - 96
# Create message box (shows "What will X do?")
@msgBox = Window_UnformattedTextPokemon.newWithSize("",
self.x + 16, self.y + 2, 220, Graphics.height - self.y, viewport)
@msgBox = Window_UnformattedTextPokemon.newWithSize(
"", self.x + 16, self.y + 2, 220, Graphics.height - self.y, viewport
)
@msgBox.baseColor = TEXT_BASE_COLOR
@msgBox.shadowColor = TEXT_SHADOW_COLOR
@msgBox.windowskin = nil
@@ -146,8 +147,9 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
end
else
# Create command window (shows Fight/Bag/Pokémon/Run)
@cmdWindow = Window_CommandPokemon.newWithSize([],
self.x + Graphics.width - 240, self.y, 240, Graphics.height - self.y, viewport)
@cmdWindow = Window_CommandPokemon.newWithSize(
[], self.x + Graphics.width - 240, self.y, 240, Graphics.height - self.y, viewport
)
@cmdWindow.columns = 2
@cmdWindow.columnSpacing = 4
@cmdWindow.ignore_input = true
@@ -287,15 +289,17 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
addSprite("shiftButton", @shiftButton)
else
# Create message box (shows type and PP of selected move)
@msgBox = Window_AdvancedTextPokemon.newWithSize("",
self.x + 320, self.y, Graphics.width - 320, Graphics.height - self.y, viewport)
@msgBox = Window_AdvancedTextPokemon.newWithSize(
"", self.x + 320, self.y, Graphics.width - 320, Graphics.height - self.y, viewport
)
@msgBox.baseColor = TEXT_BASE_COLOR
@msgBox.shadowColor = TEXT_SHADOW_COLOR
pbSetNarrowFont(@msgBox.contents)
addSprite("msgBox", @msgBox)
# Create command window (shows moves)
@cmdWindow = Window_CommandPokemon.newWithSize([],
self.x, self.y, 320, Graphics.height - self.y, viewport)
@cmdWindow = Window_CommandPokemon.newWithSize(
[], self.x, self.y, 320, Graphics.height - self.y, viewport
)
@cmdWindow.columns = 2
@cmdWindow.columnSpacing = 4
@cmdWindow.ignore_input = true
@@ -392,7 +396,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}", moveType)
else
@msgBox.text = _ISPRINTF("PP: {1: 2d}/{2: 2d}<br>TYPE/{3:s}",
move.pp, move.total_pp, moveType)
move.pp, move.total_pp, moveType)
end
return
end

View File

@@ -42,7 +42,7 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
blackScreen.moveOpacity(0, 8, 0)
# Fading blackness over command bar
blackBar = addNewSprite(@sprites["cmdBar_bg"].x, @sprites["cmdBar_bg"].y,
"Graphics/Battle animations/black_bar")
"Graphics/Battle animations/black_bar")
blackBar.setZ(0, 998)
blackBar.moveOpacity(appearTime * 3 / 4, appearTime / 4, 0)
end
@@ -448,7 +448,7 @@ class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation
delay = ball.totalDuration # 0 or 7
# Poké Ball trajectory animation
createBallTrajectory(ball, delay, 12,
ballStartX, ballStartY, ballMidX, ballMidY, battlerStartX, battlerStartY - 18)
ballStartX, ballStartY, ballMidX, ballMidY, battlerStartX, battlerStartY - 18)
ball.setZ(9, batSprite.z - 1)
delay = ball.totalDuration + 4
delay += 10 * @idxOrder # Stagger appearances if multiple Pokémon are sent out at once
@@ -651,8 +651,7 @@ class Battle::Scene::Animation::BattlerFaint < Battle::Scene::Animation
shadow = addSprite(shaSprite, PictureOrigin::Center)
# Get approx duration depending on sprite's position/size. Min 20 frames.
battlerTop = batSprite.y - batSprite.height
cropY = Battle::Scene.pbBattlerPosition(@idxBattler,
@battle.pbSideSize(@idxBattler))[1]
cropY = Battle::Scene.pbBattlerPosition(@idxBattler, @battle.pbSideSize(@idxBattler))[1]
cropY += 8
duration = (cropY - battlerTop) / 8
duration = 10 if duration < 10 # Min 0.5 seconds
@@ -734,7 +733,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
# Poké Ball arc animation
ball.setSE(delay, "Battle throw")
createBallTrajectory(ball, delay, 16,
ballStartX, ballStartY, ballMidX, ballMidY, ballEndX, ballEndY)
ballStartX, ballStartY, ballMidX, ballMidY, ballEndX, ballEndY)
ball.setZ(9, batSprite.z + 1)
ball.setSE(delay + 16, "Battle ball hit")
# Poké Ball opens up
@@ -867,7 +866,7 @@ class Battle::Scene::Animation::PokeballThrowDeflect < Battle::Scene::Animation
# Poké Ball arc animation
ball.setSE(0, "Battle throw")
createBallTrajectory(ball, 0, 16,
ballStartX, ballStartY, ballMidX, ballMidY, ballEndX, ballEndY)
ballStartX, ballStartY, ballMidX, ballMidY, ballEndX, ballEndY)
# Poké Ball knocked back
delay = ball.totalDuration
ball.setSE(delay, "Battle ball drop")