Migration - more progress

This commit is contained in:
chardub
2025-04-25 22:06:46 -04:00
parent 7de024dafd
commit b412ad7b39
67 changed files with 3243 additions and 108 deletions

View File

@@ -1,9 +1,9 @@
#===============================================================================
# Results of battle (see module Outcome):
# 0 - Undecided or aborted
# 1 - Player won
# 2 - Player lost
# 3 - Player or wild Pokémon ran from battle, or player forfeited the match
# 1 - Overrides won
# 2 - Overrides lost
# 3 - Overrides or wild Pokémon ran from battle, or player forfeited the match
# 4 - Wild Pokémon was caught
# 5 - Draw
# Possible actions a battler can take in a round:
@@ -43,7 +43,7 @@ class Battle
UNDECIDED = 0
WIN = 1
LOSE = 2 # Also used when player forfeits a trainer battle
FLEE = 3 # Player or wild Pokémon ran away, count as a win
FLEE = 3 # Overrides or wild Pokémon ran away, count as a win
CATCH = 4 # Counts as a win
DRAW = 5
@@ -75,7 +75,7 @@ class Battle
attr_accessor :environment # Battle surroundings (for mechanics purposes)
attr_reader :turnCount
attr_accessor :decision # Outcome of battle
attr_reader :player # Player trainer (or array of trainers)
attr_reader :player # Overrides trainer (or array of trainers)
attr_reader :opponent # Opponent trainer (or array of trainers)
attr_accessor :items # Items held by opponents
attr_accessor :ally_items # Items held by allies
@@ -127,7 +127,7 @@ class Battle
@scene = scene
@peer = Peer.new
@field = ActiveField.new # Whole field (gravity/rooms)
@sides = [ActiveSide.new, # Player's side
@sides = [ActiveSide.new, # Overrides's side
ActiveSide.new] # Foe's side
@positions = [] # Battler positions
@battlers = []
@@ -141,7 +141,7 @@ class Battle
@caughtPokemon = []
player = [player] if !player.nil? && !player.is_a?(Array)
opponent = [opponent] if !opponent.nil? && !opponent.is_a?(Array)
@player = player # Array of Player/NPCTrainer objects, or nil
@player = player # Array of Overrides/NPCTrainer objects, or nil
@opponent = opponent # Array of NPCTrainer objects, or nil
@items = nil
@ally_items = nil # Array of items held by ally. This is just used for Mega Evolution for now.
@@ -288,7 +288,7 @@ class Battle
idxTrainer = pbGetOwnerIndexFromBattlerIndex(idxBattler)
return @opponent[idxTrainer].full_name if opposes?(idxBattler) # Opponent
return @player[idxTrainer].full_name if idxTrainer > 0 # Ally trainer
return @player[idxTrainer].name # Player
return @player[idxTrainer].name # Overrides
end
def pbGetOwnerItems(idxBattler)

View File

@@ -65,7 +65,7 @@ class Battle
if !requireds[i] || requireds[i] == 0
case side
when 0
raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
raise _INTL("Overrides-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
i + 1, @sideSizes[0], @sideSizes[1])
when 1
raise _INTL("Opposing trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
@@ -74,7 +74,7 @@ class Battle
end
next if requireds[i] <= sideCounts[i] # Trainer has enough Pokémon to fill their positions
if requireds[i] == 1
raise _INTL("Player-side trainer {1} has no able Pokémon", i + 1) if side == 0
raise _INTL("Overrides-side trainer {1} has no able Pokémon", i + 1) if side == 0
raise _INTL("Opposing trainer {1} has no able Pokémon", i + 1) if side == 1
end
# Not enough Pokémon, try lowering the number of battler positions
@@ -393,7 +393,7 @@ class Battle
def pbLoseMoney
return if !@internalBattle || !@moneyGain
return if $game_switches[Settings::NO_MONEY_LOSS]
maxLevel = pbMaxLevelInTeam(0, 0) # Player's Pokémon only, not partner's
maxLevel = pbMaxLevelInTeam(0, 0) # Overrides's Pokémon only, not partner's
multiplier = [8, 16, 24, 36, 48, 64, 80, 100, 120]
idxMultiplier = [pbPlayer.badge_count, multiplier.length - 1].min
tMoney = maxLevel * multiplier[idxMultiplier]
@@ -417,7 +417,7 @@ class Battle
case oldDecision
when Outcome::WIN
PBDebug.log("")
PBDebug.log_header("===== Player won =====")
PBDebug.log_header("===== Overrides won =====")
PBDebug.log("")
if trainerBattle?
@scene.pbTrainerBattleSuccess
@@ -445,8 +445,8 @@ class Battle
@scene.pbShowOpponent(@opponent.length) if trainerBattle? && @caughtPokemon.length > 0
when Outcome::LOSE, Outcome::DRAW
PBDebug.log("")
PBDebug.log_header("===== Player lost =====") if @decision == Outcome::LOSE
PBDebug.log_header("===== Player drew with opponent =====") if @decision == Outcome::DRAW
PBDebug.log_header("===== Overrides lost =====") if @decision == Outcome::LOSE
PBDebug.log_header("===== Overrides drew with opponent =====") if @decision == Outcome::DRAW
PBDebug.log("")
if @internalBattle
if pbPlayerBattlerCount == 0

View File

@@ -186,11 +186,11 @@ class Battle
end
pbRecallAndReplace(idxBattler, idxPartyNew)
switched.push(idxBattler)
elsif trainerBattle? # Player switches in in a trainer battle
elsif trainerBattle? # Overrides switches in in a trainer battle
idxPlayerPartyNew = pbGetReplacementPokemonIndex(idxBattler) # Owner chooses
pbRecallAndReplace(idxBattler, idxPlayerPartyNew)
switched.push(idxBattler)
else # Player's Pokémon has fainted in a wild battle
else # Overrides's Pokémon has fainted in a wild battle
switch = false
if pbDisplayConfirm(_INTL("Use next Pokémon?"))
switch = true

View File

@@ -194,7 +194,7 @@ class Battle
end
end
# Choose actions for the round (player first, then AI)
pbCommandPhaseLoop(true) # Player chooses their actions
pbCommandPhaseLoop(true) # Overrides chooses their actions
if decided? # Battle ended, stop choosing actions
@command_phase = false
return
@@ -223,7 +223,7 @@ class Battle
@battleAI.pbDefaultChooseEnemyCommand(idxBattler)
next
end
# Player chooses an action
# Overrides chooses an action
actioned.push(idxBattler)
commandsEnd = false # Whether to cancel choosing all other actions this round
loop do

View File

@@ -55,7 +55,7 @@ class Battle::Scene
partyBar = pbAddSprite("partyBar_#{side}", 0, 0,
"Graphics/UI/Battle/overlay_lineup", @viewport)
partyBar.z = 10120
partyBar.mirror = true if side == 0 # Player's lineup bar only
partyBar.mirror = true if side == 0 # Overrides's lineup bar only
partyBar.visible = false
NUM_BALLS.times do |i|
ball = pbAddSprite("partyBall_#{side}_#{i}", 0, 0, nil, @viewport)
@@ -67,7 +67,7 @@ class Battle::Scene
@sprites["abilityBar_#{side}"] = AbilitySplashBar.new(side, @viewport)
end
end
# Player's and partner trainer's back sprite
# Overrides's and partner trainer's back sprite
@battle.player.each_with_index do |p, i|
pbCreateTrainerBackSprite(i, p.trainer_type, @battle.player.length)
end
@@ -155,7 +155,7 @@ class Battle::Scene
end
def pbCreateTrainerBackSprite(idxTrainer, trainerType, numTrainers = 1)
if idxTrainer == 0 # Player's sprite
if idxTrainer == 0 # Overrides's sprite
trainerFile = GameData::TrainerType.player_back_sprite_filename(trainerType)
else # Partner trainer's sprite
trainerFile = GameData::TrainerType.back_sprite_filename(trainerType)

View File

@@ -17,7 +17,7 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
# Bases
makeSlideSprite("base_0", 1, appearTime, PictureOrigin::BOTTOM)
makeSlideSprite("base_1", -1, appearTime, PictureOrigin::CENTER)
# Player sprite, partner trainer sprite
# Overrides sprite, partner trainer sprite
@battle.player.each_with_index do |_p, i|
makeSlideSprite("player_#{i + 1}", 1, appearTime, PictureOrigin::BOTTOM)
end
@@ -96,7 +96,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
def resetGraphics(sprites)
bar = sprites["partyBar_#{@side}"]
case @side
when 0 # Player's lineup
when 0 # Overrides's lineup
barX = Graphics.width - BAR_DISPLAY_WIDTH
barY = Graphics.height - 142
ballX = barX + 44
@@ -124,7 +124,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
end
def getPartyIndexFromBallIndex(idxBall)
# Player's lineup (just show balls for player's party)
# Overrides's lineup (just show balls for player's party)
if @side == 0
return idxBall if @partyStarts.length < 2
return idxBall if idxBall < @partyStarts[1]

View File

@@ -201,7 +201,7 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation
# Show anger appearing
delay = ball.totalDuration + 5
2.times do
anger.setSE(delay, "Player jump")
anger.setSE(delay, "Overrides jump")
anger.setVisible(delay, true)
anger.moveZoom(delay, 3, 130)
anger.moveZoom(delay + 3, 3, 100)

View File

@@ -271,7 +271,7 @@ module RecordedBattle::PlaybackHelper
return nil if !trainer
ret = []
trainer.each do |tr|
if tr.length == 4 # Player
if tr.length == 4 # Overrides
t = Player.new(tr[1], tr[0])
t.badges = tr[3]
else # NPCTrainer