mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
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:
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -33,14 +33,14 @@ module RecordedBattleModule
|
||||
if tr.is_a?(Player)
|
||||
ret.push([tr.trainer_type, tr.name.clone, tr.id, tr.badges.clone])
|
||||
else # NPCTrainer
|
||||
ret.push([tr.trainer_type, tr.name.clone, tr.id])
|
||||
ret.push([tr.trainer_type, tr.name.clone, tr.id, tr.lose_text || "...", tr.win_text || "..."])
|
||||
end
|
||||
end
|
||||
return ret
|
||||
elsif trainer[i].is_a?(Player)
|
||||
return [[trainer.trainer_type, trainer.name.clone, trainer.id, trainer.badges.clone]]
|
||||
else
|
||||
return [[trainer.trainer_type, trainer.name.clone, trainer.id]]
|
||||
return [[trainer.trainer_type, trainer.name.clone, trainer.id, trainer.lose_text || "...", trainer.win_text || "..."]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,8 +53,6 @@ module RecordedBattleModule
|
||||
@properties["party2"] = Marshal.dump(@party2)
|
||||
@properties["party1starts"] = Marshal.dump(@party1starts)
|
||||
@properties["party2starts"] = Marshal.dump(@party2starts)
|
||||
@properties["endSpeeches"] = (@endSpeeches) ? @endSpeeches.clone : ""
|
||||
@properties["endSpeechesWin"] = (@endSpeechesWin) ? @endSpeechesWin.clone : ""
|
||||
@properties["weather"] = @field.weather
|
||||
@properties["weatherDuration"] = @field.weatherDuration
|
||||
@properties["canRun"] = @canRun
|
||||
@@ -167,8 +165,6 @@ module RecordedBattlePlaybackModule
|
||||
@party1starts = Marshal.restore(@properties["party1starts"])
|
||||
@party2starts = Marshal.restore(@properties["party2starts"])
|
||||
@internalBattle = @properties["internalBattle"]
|
||||
@endSpeeches = @properties["endSpeeches"]
|
||||
@endSpeechesWin = @properties["endSpeechesWin"]
|
||||
@field.weather = @properties["weather"]
|
||||
@field.weatherDuration = @properties["weatherDuration"]
|
||||
@canRun = @properties["canRun"]
|
||||
@@ -280,6 +276,8 @@ module RecordedBattle::PlaybackHelper
|
||||
t.badges = tr[3]
|
||||
else # NPCTrainer
|
||||
t = NPCTrainer.new(tr[1], tr[0])
|
||||
t.lose_text = tr[3] || "..."
|
||||
t.win_text = tr[4] || "..."
|
||||
end
|
||||
t.id = tr[2]
|
||||
ret.push(t)
|
||||
|
||||
Reference in New Issue
Block a user