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