NPC trainers' end of battle text is now read directly from the trainer object rather than extracted to an array

This commit is contained in:
Maruno17
2022-05-17 22:28:29 +01:00
parent cf338b3a6a
commit e12b6fde1d
7 changed files with 26 additions and 33 deletions

View File

@@ -55,8 +55,6 @@ class Battle
attr_reader :opponent # Opponent trainer (or array of trainers)
attr_accessor :items # Items held by opponents
attr_accessor :ally_items # Items held by allies
attr_accessor :endSpeeches
attr_accessor :endSpeechesWin
attr_accessor :party1starts # Array of start indexes for each player-side trainer's party
attr_accessor :party2starts # Array of start indexes for each opponent-side trainer's party
attr_accessor :internalBattle # Internal battle flag
@@ -123,8 +121,6 @@ class Battle
@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.
@endSpeeches = []
@endSpeechesWin = []
@party1 = p1
@party2 = p2
@party1order = Array.new(@party1.length) { |i| i }

View File

@@ -412,9 +412,10 @@ class Battle
pbDisplayPaused(_INTL("You defeated {1}, {2} and {3}!", @opponent[0].full_name,
@opponent[1].full_name, @opponent[2].full_name))
end
@opponent.each_with_index do |_t, i|
@opponent.each_with_index do |trainer, i|
@scene.pbShowOpponent(i)
msg = (@endSpeeches[i] && @endSpeeches[i] != "") ? @endSpeeches[i] : "..."
msg = trainer.lose_text
msg = "..." if !msg || msg.empty?
pbDisplayPaused(msg.gsub(/\\[Pp][Nn]/, pbPlayer.name))
end
end
@@ -444,11 +445,12 @@ class Battle
# Lose money from losing a battle
pbLoseMoney
pbDisplayPaused(_INTL("You blacked out!")) if !@canLose
elsif @decision == 2
elsif @decision == 2 # Lost in a Battle Frontier battle
if @opponent
@opponent.each_with_index do |_t, i|
@opponent.each_with_index do |trainer, i|
@scene.pbShowOpponent(i)
msg = (@endSpeechesWin[i] && @endSpeechesWin[i] != "") ? @endSpeechesWin[i] : "..."
msg = trainer.win_text
msg = "..." if !msg || msg.empty?
pbDisplayPaused(msg.gsub(/\\[Pp][Nn]/, pbPlayer.name))
end
end