Moved battle music filenames to Settings, improved PluginManager's version comparer, removed player bump animation, fixed No Guard not applying to OHKO moves, can reuse the same Repel item quicker

This commit is contained in:
Maruno17
2025-01-22 23:02:34 +00:00
parent db2df5c8b4
commit 6f37cb7e33
16 changed files with 130 additions and 73 deletions

View File

@@ -422,6 +422,16 @@ module Settings
# is on the map (for new plant growth mechanics only). # is on the map (for new plant growth mechanics only).
PLANT_SPARKLE_ANIMATION_ID = 7 PLANT_SPARKLE_ANIMATION_ID = 7
#-----------------------------------------------------------------------------
# Files
#-----------------------------------------------------------------------------
DEFAULT_WILD_BATTLE_BGM = "Battle wild"
DEFAULT_WILD_VICTORY_BGM = "Battle victory"
DEFAULT_WILD_CAPTURE_ME = "Battle capture success"
DEFAULT_TRAINER_BATTLE_BGM = "Battle trainer"
DEFAULT_TRAINER_VICTORY_BGM = "Battle victory"
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Languages # Languages
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View File

@@ -340,26 +340,47 @@ module PluginManager
# 0 if v1 is equal to v2 # 0 if v1 is equal to v2
# -1 if v1 is lower than v2 # -1 if v1 is lower than v2
def self.compare_versions(v1, v2) def self.compare_versions(v1, v2)
d1 = v1.chars version_chunks1 = v1.split(".")
d1.insert(0, "0") if d1[0] == "." # Turn ".123" into "0.123" version_chunks1.each_with_index do |val, i|
while d1[-1] == "." # Turn "123." into "123" next if val != ""
d1 = d1[0..-2] version_chunks1[i] = (i == 0) ? "0" : nil
end end
d2 = v2.chars version_chunks1.compact!
d2.insert(0, "0") if d2[0] == "." # Turn ".123" into "0.123" version_chunks2 = v2.split(".")
while d2[-1] == "." # Turn "123." into "123" version_chunks2.each_with_index do |val, i|
d2 = d2[0..-2] next if val != ""
version_chunks2[i] = (i == 0) ? "0" : nil
end end
[d1.size, d2.size].max.times do |i| # Compare each digit in turn version_chunks2.compact!
c1 = d1[i] # Compare each chunk in turn
c2 = d2[i] decision = :equal # Could be :higher or :lower
if c1 [version_chunks1.length, version_chunks2.length].max.times do |i|
return 1 if !c2 chunk1 = version_chunks1[i]
return 1 if c1.to_i(16) > c2.to_i(16) chunk2 = version_chunks2[i]
return -1 if c1.to_i(16) < c2.to_i(16) if !chunk1
elsif c2 decision = :lower if decision == :equal
return -1 break
elsif !chunk2
decision = :higher if decision == :equal
break
end end
# Make both chunks the same left by pre-padding with "0"
chars_count = [chunk1.length, chunk2.length].max
chunk1 = chunk1.rjust(chars_count, "0").chars
chunk2 = chunk2.rjust(chars_count, "0").chars
chunk1.length.times do |j|
c1 = chunk1[j]
c2 = chunk2[j]
next if c1 == c2
decision = (c1.to_i(16) > c2.to_i(16)) ? :higher : :lower
break
end
break if decision != :equal
end
case decision
when :equal then return 0
when :higher then return 1
when :lower then return -1
end end
return 0 return 0
end end

View File

@@ -77,7 +77,6 @@ class Game_Character
@always_on_top = false @always_on_top = false
@anime_count = 0 # Time since pattern was last changed @anime_count = 0 # Time since pattern was last changed
@stop_count = 0 # Time since character last finished moving @stop_count = 0 # Time since character last finished moving
@bumping = false # Used by the player only when walking into something
@jump_peak = 0 # Max height while jumping @jump_peak = 0 # Max height while jumping
@jump_distance = 0 # Total distance of jump @jump_distance = 0 # Total distance of jump
@jump_fraction = 0 # How far through a jump we currently are (0-1) @jump_fraction = 0 # How far through a jump we currently are (0-1)
@@ -996,7 +995,6 @@ class Game_Character
if moving? && @move_timer >= @move_time && if moving? && @move_timer >= @move_time &&
@real_x == @x * Game_Map::REAL_RES_X && @real_y == @y * Game_Map::REAL_RES_Y @real_x == @x * Game_Map::REAL_RES_X && @real_y == @y * Game_Map::REAL_RES_Y
@move_timer = nil @move_timer = nil
@bumping = false
end end
# End of jump # End of jump
if jumping? && @jump_fraction >= 1 if jumping? && @jump_fraction >= 1

View File

@@ -51,7 +51,6 @@ class Game_Player < Game_Character
def can_run? def can_run?
return @move_speed > 3 if @move_route_forcing return @move_speed > 3 if @move_route_forcing
return false if @bumping
return false if $game_temp.in_menu || $game_temp.in_battle || return false if $game_temp.in_menu || $game_temp.in_battle ||
$game_temp.message_window_showing || pbMapInterpreterRunning? $game_temp.message_window_showing || pbMapInterpreterRunning?
return false if !$player.has_running_shoes && !$PokemonGlobal.diving && return false if !$player.has_running_shoes && !$PokemonGlobal.diving &&
@@ -95,7 +94,6 @@ class Game_Player < Game_Character
self.move_speed = 3 if !@move_route_forcing self.move_speed = 3 if !@move_route_forcing
new_charset = pbGetPlayerCharset(meta.walk_charset) new_charset = pbGetPlayerCharset(meta.walk_charset)
end end
self.move_speed = 3 if @bumping
@character_name = new_charset if new_charset @character_name = new_charset if new_charset
end end
@@ -119,12 +117,10 @@ class Game_Player < Game_Character
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
def bump_into_object def bump_into_object
return if @bump_time_start && (System.uptime - @bump_time_start < @move_time)
pbSEPlay("Player bump") if !@move_route_forcing pbSEPlay("Player bump") if !@move_route_forcing
$stats.bump_count += 1 $stats.bump_count += 1
@move_initial_x = @x @bump_time_start = System.uptime
@move_initial_y = @y
@move_timer = 0.0
@bumping = true
end end
def add_move_distance_to_stats(distance = 1) def add_move_distance_to_stats(distance = 1)
@@ -421,7 +417,7 @@ class Game_Player < Game_Character
update_stop if $game_temp.in_menu && @stopped_last_frame update_stop if $game_temp.in_menu && @stopped_last_frame
update_screen_position(last_real_x, last_real_y) update_screen_position(last_real_x, last_real_y)
# Update dependent events # Update dependent events
if (!@moved_last_frame || @stopped_last_frame) && (moving? || jumping?) && !@bumping if (!@moved_last_frame || @stopped_last_frame) && (moving? || jumping?)
$game_temp.followers.move_followers $game_temp.followers.move_followers
end end
$game_temp.followers.update $game_temp.followers.update
@@ -432,28 +428,32 @@ class Game_Player < Game_Character
dir = Input.dir4 dir = Input.dir4
if $PokemonGlobal.forced_movement? if $PokemonGlobal.forced_movement?
move_forward move_forward
elsif !pbMapInterpreterRunning? && !$game_temp.message_window_showing && @last_input_time = nil
!$game_temp.in_mini_update && !$game_temp.in_menu return
# Move player in the direction the directional button is being pressed elsif dir <= 0
if @moved_last_frame || @last_input_time = nil
(dir > 0 && dir == @lastdir && System.uptime - @lastdirframe >= 0.075) return
case dir end
when 2 then move_down return if pbMapInterpreterRunning? || $game_temp.message_window_showing ||
when 4 then move_left $game_temp.in_mini_update || $game_temp.in_menu
when 6 then move_right # Move player in the direction the directional button is being pressed
when 8 then move_up if @moved_last_frame ||
end (dir == direction && (!@last_input_time || System.uptime - @last_input_time >= 0.075))
elsif dir != @lastdir case dir
case dir when 2 then move_down
when 2 then turn_down when 4 then move_left
when 4 then turn_left when 6 then move_right
when 6 then turn_right when 8 then move_up
when 8 then turn_up
end
end end
# Record last direction input @last_input_time = nil
@lastdirframe = System.uptime if dir != @lastdir elsif dir != direction
@lastdir = dir case dir
when 2 then turn_down
when 4 then turn_left
when 6 then turn_right
when 8 then turn_up
end
@last_input_time = System.uptime
end end
end end

View File

@@ -608,6 +608,9 @@ class Battle::Battler
user.effects[PBEffects::LockOnPos] == target.index user.effects[PBEffects::LockOnPos] == target.index
# Toxic # Toxic
return true if move.pbOverrideSuccessCheckPerHit(user, target) return true if move.pbOverrideSuccessCheckPerHit(user, target)
# No Guard
return true if user.hasActiveAbility?(:NOGUARD) ||
target.hasActiveAbility?(:NOGUARD)
# Semi-invulnerable target # Semi-invulnerable target
return false if target.damageState.invulnerable return false if target.damageState.invulnerable
# Called by another move # Called by another move

View File

@@ -448,7 +448,7 @@ class Battle::Scene
return nil if ANIMATION_DEFAULTS.include?(wanted_move) # No need to check for these animations twice return nil if ANIMATION_DEFAULTS.include?(wanted_move) # No need to check for these animations twice
end end
# Use Tackle or Defense Curl's animation # Use Tackle or Defense Curl's animation
if target_data.num_targets == 0 && target.data.id != :None if target_data.num_targets == 0 && target_data.id != :None
return find_move_animation_for_move(ANIMATION_DEFAULTS[1], 0, user_index) return find_move_animation_for_move(ANIMATION_DEFAULTS[1], 0, user_index)
end end
return find_move_animation_for_move(ANIMATION_DEFAULTS[0], 0, user_index) return find_move_animation_for_move(ANIMATION_DEFAULTS[0], 0, user_index)
@@ -593,7 +593,7 @@ class Battle::Scene
def pbCommonAnimation(anim_name, user = nil, target = nil) def pbCommonAnimation(anim_name, user = nil, target = nil)
return if nil_or_empty?(anim_name) return if nil_or_empty?(anim_name)
# Find an animation to play (new format or old format) # Find an animation to play (new format or old format)
anims = try_get_better_common_animation(anim_name, user.index) anims = try_get_better_common_animation(anim_name, user&.index)
return if !anims return if !anims
# Play a new format animation # Play a new format animation
if anims.is_a?(Array) if anims.is_a?(Array)

View File

@@ -144,7 +144,7 @@ class Battle::AI
:STICKYHOLD, :SUPERLUCK, :UNNERVE, :WIMPOUT], :STICKYHOLD, :SUPERLUCK, :UNNERVE, :WIMPOUT],
2 => [:BATTLEARMOR, :COLORCHANGE, :CUTECHARM, :DAMP, :GRASSPELT, 2 => [:BATTLEARMOR, :COLORCHANGE, :CUTECHARM, :DAMP, :GRASSPELT,
:HUNGERSWITCH, :INNERFOCUS, :LEAFGUARD, :LIGHTMETAL, :MIMICRY, :HUNGERSWITCH, :INNERFOCUS, :LEAFGUARD, :LIGHTMETAL, :MIMICRY,
:OBLIVIOUS, :POWERSPOT, :PROPELLORTAIL, :PUNKROCK, :SHELLARMOR, :OBLIVIOUS, :POWERSPOT, :PROPELLERTAIL, :PUNKROCK, :SHELLARMOR,
:STALWART, :STEADFAST, :STEELYSPIRIT, :SUCTIONCUPS, :TANGLEDFEET, :STALWART, :STEADFAST, :STEELYSPIRIT, :SUCTIONCUPS, :TANGLEDFEET,
:WANDERINGSPIRIT, :WEAKARMOR], :WANDERINGSPIRIT, :WEAKARMOR],
1 => [:BIGPECKS, :KEENEYE, :MAGMAARMOR, :PICKUP, :RIVALRY, :STENCH], 1 => [:BIGPECKS, :KEENEYE, :MAGMAARMOR, :PICKUP, :RIVALRY, :STENCH],

View File

@@ -36,7 +36,7 @@ class PokemonGlobalMetadata
attr_accessor :eventvars attr_accessor :eventvars
# Affecting the map # Affecting the map
attr_accessor :bridge attr_accessor :bridge
attr_accessor :repel attr_accessor :repel, :repel_item
attr_accessor :flashUsed attr_accessor :flashUsed
attr_reader :encounter_version attr_reader :encounter_version
# Map transfers # Map transfers

View File

@@ -32,6 +32,7 @@ def pbRepel(item, steps)
$stats.repel_count += 1 $stats.repel_count += 1
pbUseItemMessage(item) pbUseItemMessage(item)
$PokemonGlobal.repel = steps $PokemonGlobal.repel = steps
$PokemonGlobal.repel_item = item
return true return true
end end
@@ -58,17 +59,29 @@ EventHandlers.add(:on_player_step_taken, :repel_counter,
pbMessage(_INTL("The repellent's effect wore off!")) pbMessage(_INTL("The repellent's effect wore off!"))
next next
end end
next if !pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?")) commands = {}
ret = nil if $PokemonGlobal.repel_item && $bag.has?($PokemonGlobal.repel_item)
pbFadeOutIn do commands[:repeat] = _INTL("Use {1}", GameData::Item.get($PokemonGlobal.repel_item).name)
bag_screen = UI::Bag.new($bag, mode: :choose_item) end
bag_screen.set_filter_proc(proc { |item| repels.include?(item) }) commands[:choose_another] = _INTL("Use another repellent")
ret = bag_screen.choose_item commands[:cancel] = _INTL("Cancel")
cmd = pbMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"), commands.values, -1)
next if cmd < 0
new_item = nil
case commands.keys[cmd]
when :repeat
new_item = $PokemonGlobal.repel_item
when :choose_another
pbFadeOutIn do
bag_screen = UI::Bag.new($bag, mode: :choose_item)
bag_screen.set_filter_proc(proc { |item| repels.include?(item) })
new_item = bag_screen.choose_item
end
end end
# TODO: Would be nice if this didn't call pbUseItem, so that pbUseItem would # TODO: Would be nice if this didn't call pbUseItem, so that pbUseItem would
# be exclusively called from the Bag screen and could rely on that # be exclusively called from the Bag screen and could rely on that
# screen existing. # screen existing.
pbUseItem($bag, ret) if ret pbUseItem($bag, new_item) if new_item
} }
) )

View File

@@ -10,6 +10,8 @@
# Graphics/Battlers/eggCracks. # Graphics/Battlers/eggCracks.
#=============================================================================== #===============================================================================
class PokemonEggHatch_Scene class PokemonEggHatch_Scene
EGG_HATCH_BGM = "Evolution"
def pbStartScene(pokemon) def pbStartScene(pokemon)
@sprites = {} @sprites = {}
@pokemon = pokemon @pokemon = pokemon
@@ -50,7 +52,7 @@ class PokemonEggHatch_Scene
end end
def pbMain def pbMain
pbBGMPlay("Evolution") pbBGMPlay(EGG_HATCH_BGM)
# Egg animation # Egg animation
updateScene(1.5) updateScene(1.5)
pbPositionHatchMask(0) pbPositionHatchMask(0)

View File

@@ -2,6 +2,8 @@
# Evolution screen # Evolution screen
#=============================================================================== #===============================================================================
class PokemonEvolutionScene class PokemonEvolutionScene
EVOLUTION_BGM = "Evolution"
def self.pbDuplicatePokemon(pkmn, new_species) def self.pbDuplicatePokemon(pkmn, new_species)
new_pkmn = pkmn.clone new_pkmn = pkmn.clone
new_pkmn.species = new_species new_pkmn.species = new_species
@@ -95,7 +97,7 @@ class PokemonEvolutionScene
break if System.uptime - timer_start >= 1 break if System.uptime - timer_start >= 1
end end
pbMEPlay("Evolution start") pbMEPlay("Evolution start")
pbBGMPlay("Evolution") pbBGMPlay(EVOLUTION_BGM)
canceled = false canceled = false
timer_start = System.uptime timer_start = System.uptime
loop do loop do

View File

@@ -2,6 +2,8 @@
# #
#=============================================================================== #===============================================================================
class PokemonTrade_Scene class PokemonTrade_Scene
TRADE_BGM = "Evolution"
def pbUpdate def pbUpdate
pbUpdateSpriteHash(@sprites) pbUpdateSpriteHash(@sprites)
end end
@@ -181,7 +183,7 @@ class PokemonTrade_Scene
@pokemon.name, @pokemon.owner.public_id, @pokemon.owner.name) + "\\wtnp[0]") { pbUpdate } @pokemon.name, @pokemon.owner.public_id, @pokemon.owner.name) + "\\wtnp[0]") { pbUpdate }
pbMessageWaitForInput(@sprites["msgwindow"], 50, true) { pbUpdate } pbMessageWaitForInput(@sprites["msgwindow"], 50, true) { pbUpdate }
pbPlayDecisionSE pbPlayDecisionSE
pbBGMPlay("Evolution") pbBGMPlay(TRADE_BGM)
pbScene1 pbScene1
pbMessageDisplay(@sprites["msgwindow"], pbMessageDisplay(@sprites["msgwindow"],
_INTL("For {1}'s {2},\n{3} sends {4}.", @trader1, speciesname1, @trader2, speciesname2) + "\1") { pbUpdate } _INTL("For {1}'s {2},\n{3} sends {4}.", @trader1, speciesname1, @trader2, speciesname2) + "\1") { pbUpdate }

View File

@@ -36,7 +36,7 @@
class Scene_Credits class Scene_Credits
# Backgrounds to show in credits. Found in Graphics/Titles/ folder # Backgrounds to show in credits. Found in Graphics/Titles/ folder
BACKGROUNDS_LIST = ["credits1", "credits2", "credits3", "credits4", "credits5"] BACKGROUNDS_LIST = ["credits1", "credits2", "credits3", "credits4", "credits5"]
BGM = "Credits" CREDITS_BGM = "Credits"
SCROLL_SPEED = 40 # Pixels per second SCROLL_SPEED = 40 # Pixels per second
SECONDS_PER_BACKGROUND = 11 SECONDS_PER_BACKGROUND = 11
TEXT_OUTLINE_COLOR = Color.new(0, 0, 128, 255) TEXT_OUTLINE_COLOR = Color.new(0, 0, 128, 255)
@@ -174,7 +174,7 @@ class Scene_Credits
pbBGSStop pbBGSStop
pbSEStop pbSEStop
pbBGMFade(2.0) pbBGMFade(2.0)
pbBGMPlay(BGM) pbBGMPlay(CREDITS_BGM)
Graphics.transition Graphics.transition
loop do loop do
Graphics.update Graphics.update

View File

@@ -58,6 +58,10 @@ end
# #
#=============================================================================== #===============================================================================
class PokemonJukeboxScreen class PokemonJukeboxScreen
HIGHER_ENCOUNTER_RATE_BGM = "Radio - March"
LOWER_ENCOUNTER_RATE_BGM = "Radio - Lullaby"
NORMAL_ENCOUNTER_RATE_BGM = "Radio - Oak"
def initialize(scene) def initialize(scene)
@scene = scene @scene = scene
end end
@@ -83,21 +87,21 @@ class PokemonJukeboxScreen
break break
elsif cmdMarch >= 0 && cmd == cmdMarch elsif cmdMarch >= 0 && cmd == cmdMarch
pbPlayDecisionSE pbPlayDecisionSE
pbBGMPlay("Radio - March", 100, 100) pbBGMPlay(HIGHER_ENCOUNTER_RATE_BGM, 100, 100)
if $PokemonMap if $PokemonMap
$PokemonMap.lower_encounter_rate = false $PokemonMap.lower_encounter_rate = false
$PokemonMap.higher_encounter_rate = true $PokemonMap.higher_encounter_rate = true
end end
elsif cmdLullaby >= 0 && cmd == cmdLullaby elsif cmdLullaby >= 0 && cmd == cmdLullaby
pbPlayDecisionSE pbPlayDecisionSE
pbBGMPlay("Radio - Lullaby", 100, 100) pbBGMPlay(LOWER_ENCOUNTER_RATE_BGM, 100, 100)
if $PokemonMap if $PokemonMap
$PokemonMap.lower_encounter_rate = true $PokemonMap.lower_encounter_rate = true
$PokemonMap.higher_encounter_rate = false $PokemonMap.higher_encounter_rate = false
end end
elsif cmdOak >= 0 && cmd == cmdOak elsif cmdOak >= 0 && cmd == cmdOak
pbPlayDecisionSE pbPlayDecisionSE
pbBGMPlay("Radio - Oak", 100, 100) pbBGMPlay(NORMAL_ENCOUNTER_RATE_BGM, 100, 100)
if $PokemonMap if $PokemonMap
$PokemonMap.lower_encounter_rate = false $PokemonMap.lower_encounter_rate = false
$PokemonMap.higher_encounter_rate = false $PokemonMap.higher_encounter_rate = false

View File

@@ -163,6 +163,8 @@ end
# Scene class for handling appearance of the screen. # Scene class for handling appearance of the screen.
#=============================================================================== #===============================================================================
class TriadScene class TriadScene
TRIPLE_TRIAD_BGM = "Triple Triad"
def pbStartScene(battle) def pbStartScene(battle)
@sprites = {} @sprites = {}
@bitmaps = [] @bitmaps = []
@@ -207,7 +209,7 @@ class TriadScene
@sprites["score"] = Sprite.new(@viewport) @sprites["score"] = Sprite.new(@viewport)
@sprites["score"].bitmap = Bitmap.new(Graphics.width, Graphics.height) @sprites["score"].bitmap = Bitmap.new(Graphics.width, Graphics.height)
pbSetSystemFont(@sprites["score"].bitmap) pbSetSystemFont(@sprites["score"].bitmap)
pbBGMPlay("Triple Triad") pbBGMPlay(TRIPLE_TRIAD_BGM)
# Fade in all sprites # Fade in all sprites
pbFadeInAndShow(@sprites) { pbUpdate } pbFadeInAndShow(@sprites) { pbUpdate }
end end

View File

@@ -15,7 +15,7 @@ def pbGetWildBattleBGM(_wildParty)
music = GameData::Metadata.get.wild_battle_BGM music = GameData::Metadata.get.wild_battle_BGM
ret = pbStringToAudioFile(music) if music && music != "" ret = pbStringToAudioFile(music) if music && music != ""
end end
ret = pbStringToAudioFile("Battle wild") if !ret ret = pbStringToAudioFile(Settings::DEFAULT_WILD_BATTLE_BGM) if !ret
return ret return ret
end end
@@ -32,7 +32,7 @@ def pbGetWildVictoryBGM
music = GameData::Metadata.get.wild_victory_BGM music = GameData::Metadata.get.wild_victory_BGM
ret = pbStringToAudioFile(music) if music && music != "" ret = pbStringToAudioFile(music) if music && music != ""
end end
ret = pbStringToAudioFile("Battle victory") if !ret ret = pbStringToAudioFile(Settings::DEFAULT_WILD_VICTORY_BGM) if !ret
ret.name = "../../Audio/BGM/" + ret.name ret.name = "../../Audio/BGM/" + ret.name
return ret return ret
end end
@@ -52,7 +52,7 @@ def pbGetWildCaptureME
music = GameData::Metadata.get.wild_capture_ME music = GameData::Metadata.get.wild_capture_ME
ret = pbStringToAudioFile(music) if music && music != "" ret = pbStringToAudioFile(music) if music && music != ""
end end
ret = pbStringToAudioFile("Battle capture success") if !ret ret = pbStringToAudioFile(Settings::DEFAULT_WILD_CAPTURE_ME) if !ret
ret.name = "../../Audio/ME/" + ret.name ret.name = "../../Audio/ME/" + ret.name
return ret return ret
end end
@@ -98,7 +98,7 @@ def pbGetTrainerBattleBGM(trainer)
music = GameData::Metadata.get.trainer_battle_BGM music = GameData::Metadata.get.trainer_battle_BGM
ret = pbStringToAudioFile(music) if music && music != "" ret = pbStringToAudioFile(music) if music && music != ""
end end
ret = pbStringToAudioFile("Battle trainer") if !ret ret = pbStringToAudioFile(Settings::DEFAULT_TRAINER_BATTLE_BGM) if !ret
return ret return ret
end end
@@ -116,7 +116,7 @@ def pbGetTrainerBattleBGMFromType(trainertype)
music = GameData::Metadata.get.trainer_battle_BGM music = GameData::Metadata.get.trainer_battle_BGM
ret = pbStringToAudioFile(music) if music && music != "" ret = pbStringToAudioFile(music) if music && music != ""
end end
ret = pbStringToAudioFile("Battle trainer") if !ret ret = pbStringToAudioFile(Settings::DEFAULT_TRAINER_BATTLE_BGM) if !ret
return ret return ret
end end
@@ -143,7 +143,7 @@ def pbGetTrainerVictoryBGM(trainer)
music = GameData::Metadata.get.trainer_victory_BGM music = GameData::Metadata.get.trainer_victory_BGM
ret = pbStringToAudioFile(music) if music && music != "" ret = pbStringToAudioFile(music) if music && music != ""
end end
ret = pbStringToAudioFile("Battle victory") if !ret ret = pbStringToAudioFile(Settings::DEFAULT_TRAINER_VICTORY_BGM) if !ret
ret.name = "../../Audio/BGM/" + ret.name ret.name = "../../Audio/BGM/" + ret.name
return ret return ret
end end