Added methods Pokemon.play_cry and pkkmn.play_cry

This commit is contained in:
Maruno17
2021-05-09 17:53:05 +01:00
parent 852c924ed6
commit e03e258f6a
11 changed files with 30 additions and 23 deletions

View File

@@ -302,14 +302,14 @@ end
# @deprecated This alias is slated to be removed in v20. # @deprecated This alias is slated to be removed in v20.
def pbPlayCrySpecies(species, form = 0, volume = 90, pitch = nil) def pbPlayCrySpecies(species, form = 0, volume = 90, pitch = nil)
Deprecation.warn_method('pbPlayCrySpecies', 'v20', 'GameData::Species.play_cry_from_species(species, form)') Deprecation.warn_method('pbPlayCrySpecies', 'v20', 'Pokemon.play_cry(species, form)')
GameData::Species.play_cry_from_species(species, form, volume, pitch) Pokemon.play_cry(species, form, volume, pitch)
end end
# @deprecated This alias is slated to be removed in v20. # @deprecated This alias is slated to be removed in v20.
def pbPlayCryPokemon(pkmn, volume = 90, pitch = nil) def pbPlayCryPokemon(pkmn, volume = 90, pitch = nil)
Deprecation.warn_method('pbPlayCryPokemon', 'v20', 'GameData::Species.play_cry_from_pokemon(pkmn)') Deprecation.warn_method('pbPlayCryPokemon', 'v20', 'pkmn.play_cry')
GameData::Species.play_cry_from_pokemon(pkmn, volume, pitch) pkmn.play_cry(volume, pitch)
end end
# @deprecated This alias is slated to be removed in v20. # @deprecated This alias is slated to be removed in v20.

View File

@@ -559,8 +559,7 @@ class PokemonBattlerSprite < RPG::Sprite
# recommendation is to create a PictureEx animation and push it into # recommendation is to create a PictureEx animation and push it into
# the @battleAnimations array. # the @battleAnimations array.
def pbPlayIntroAnimation(pictureEx=nil) def pbPlayIntroAnimation(pictureEx=nil)
return if !@pkmn @pkmn.play_cry if @pkmn
GameData::Species.play_cry_from_pokemon(@pkmn)
end end
QUARTER_ANIM_PERIOD = Graphics.frame_rate*3/20 QUARTER_ANIM_PERIOD = Graphics.frame_rate*3/20

View File

@@ -119,7 +119,7 @@ def pbHiddenMoveAnimation(pokemon)
sprite.visible=true sprite.visible=true
if ptinterp.done? if ptinterp.done?
phase=3 phase=3
GameData::Species.play_cry_from_pokemon(pokemon) pokemon.play_cry
frames=0 frames=0
end end
when 3 # Wait when 3 # Wait

View File

@@ -92,6 +92,14 @@ class Pokemon
# Maximum number of moves a Pokémon can know at once # Maximum number of moves a Pokémon can know at once
MAX_MOVES = 4 MAX_MOVES = 4
def self.play_cry(species, form = 0, volume = 90, pitch = 100)
GameData::Species.play_cry_from_species(species, form, volume, pitch)
end
def play_cry(volume = 90, pitch = nil)
GameData::Species.play_cry_from_pokemon(self, volume, pitch)
end
def inspect def inspect
str = super.chop str = super.chop
str << format(' %s Lv.%s>', @species, @level.to_s || '???') str << format(' %s Lv.%s>', @species, @level.to_s || '???')

View File

@@ -70,7 +70,7 @@ class IntroEventScene < EventScene
# Play random cry # Play random cry
species_keys = GameData::Species::DATA.keys species_keys = GameData::Species::DATA.keys
species_data = GameData::Species.get(species_keys[rand(species_keys.length)]) species_data = GameData::Species.get(species_keys[rand(species_keys.length)])
GameData::Species.play_cry_from_species(species_data.species, species_data.form) Pokemon.play_cry(species_data.species, species_data.form)
@pic.moveXY(0, 20, 0, 0) # Adds 20 ticks (1 second) pause @pic.moveXY(0, 20, 0, 0) # Adds 20 ticks (1 second) pause
pictureWait pictureWait
# Fade out # Fade out

View File

@@ -97,7 +97,7 @@ class PokemonEggHatch_Scene
@sprites["overlay"].opacity=0 @sprites["overlay"].opacity=0
# Finish scene # Finish scene
frames = GameData::Species.cry_length(@pokemon) frames = GameData::Species.cry_length(@pokemon)
GameData::Species.play_cry_from_pokemon(@pokemon) @pokemon.play_cry
updateScene(frames) updateScene(frames)
pbBGMStop() pbBGMStop()
pbMEPlay("Evolution success") pbMEPlay("Evolution success")

View File

@@ -532,7 +532,7 @@ class PokemonEvolutionScene
metaplayer1.play metaplayer1.play
metaplayer2.play metaplayer2.play
pbBGMStop pbBGMStop
GameData::Species.play_cry_from_pokemon(@pokemon) @pokemon.play_cry
pbMessageDisplay(@sprites["msgwindow"], pbMessageDisplay(@sprites["msgwindow"],
_INTL("\\se[]What? {1} is evolving!\\^",@pokemon.name)) { pbUpdate } _INTL("\\se[]What? {1} is evolving!\\^",@pokemon.name)) { pbUpdate }
pbMessageWaitForInput(@sprites["msgwindow"],50,true) { pbUpdate } pbMessageWaitForInput(@sprites["msgwindow"],50,true) { pbUpdate }
@@ -569,7 +569,7 @@ class PokemonEvolutionScene
# Play cry of evolved species # Play cry of evolved species
frames = GameData::Species.cry_length(@newspecies, @pokemon.form) frames = GameData::Species.cry_length(@newspecies, @pokemon.form)
pbBGMStop pbBGMStop
GameData::Species.play_cry_from_species(@newspecies, @pokemon.form) Pokemon.play_cry(@newspecies, @pokemon.form)
frames.times do frames.times do
Graphics.update Graphics.update
pbUpdate pbUpdate

View File

@@ -184,7 +184,7 @@ class PokemonTrade_Scene
def pbTrade def pbTrade
pbBGMStop pbBGMStop
GameData::Species.play_cry_from_pokemon(@pokemon) @pokemon.play_cry
speciesname1=GameData::Species.get(@pokemon.species).name speciesname1=GameData::Species.get(@pokemon.species).name
speciesname2=GameData::Species.get(@pokemon2.species).name speciesname2=GameData::Species.get(@pokemon2.species).name
pbMessageDisplay(@sprites["msgwindow"], pbMessageDisplay(@sprites["msgwindow"],

View File

@@ -377,7 +377,7 @@ class HallOfFame_Scene
if @battlerIndex<=@hallEntry.size if @battlerIndex<=@hallEntry.size
# If it is a pokémon, write the pokémon text, wait the # If it is a pokémon, write the pokémon text, wait the
# ENTRYWAITTIME and goes to the next battler # ENTRYWAITTIME and goes to the next battler
GameData::Species.play_cry_from_pokemon(@hallEntry[@battlerIndex - 1]) @hallEntry[@battlerIndex - 1].play_cry
writePokemonData(@hallEntry[@battlerIndex-1]) writePokemonData(@hallEntry[@battlerIndex-1])
(ENTRYWAITTIME*Graphics.frame_rate/20).times do (ENTRYWAITTIME*Graphics.frame_rate/20).times do
Graphics.update Graphics.update
@@ -432,7 +432,7 @@ class HallOfFame_Scene
createBattlers(false) createBattlers(false)
end end
# Change the pokemon # Change the pokemon
GameData::Species.play_cry_from_pokemon(@hallEntry[@battlerIndex]) @hallEntry[@battlerIndex].play_cry
setPokemonSpritesOpacity(@battlerIndex,OPACITY) setPokemonSpritesOpacity(@battlerIndex,OPACITY)
hallNumber=$PokemonGlobal.hallOfFameLastNumber + @hallIndex - hallNumber=$PokemonGlobal.hallOfFameLastNumber + @hallIndex -
$PokemonGlobal.hallOfFame.size + 1 $PokemonGlobal.hallOfFame.size + 1

View File

@@ -442,7 +442,7 @@ class PokemonPokedexInfo_Scene
end end
def pbScene def pbScene
GameData::Species.play_cry_from_species(@species, @form) Pokemon.play_cry(@species, @form)
loop do loop do
Graphics.update Graphics.update
Input.update Input.update
@@ -450,7 +450,7 @@ class PokemonPokedexInfo_Scene
dorefresh = false dorefresh = false
if Input.trigger?(Input::ACTION) if Input.trigger?(Input::ACTION)
pbSEStop pbSEStop
GameData::Species.play_cry_from_species(@species, @form) if @page == 1 Pokemon.play_cry(@species, @form) if @page == 1
elsif Input.trigger?(Input::BACK) elsif Input.trigger?(Input::BACK)
pbPlayCloseMenuSE pbPlayCloseMenuSE
break break
@@ -471,7 +471,7 @@ class PokemonPokedexInfo_Scene
pbUpdateDummyPokemon pbUpdateDummyPokemon
@available = pbGetAvailableForms @available = pbGetAvailableForms
pbSEStop pbSEStop
(@page==1) ? GameData::Species.play_cry_from_species(@species, @form) : pbPlayCursorSE (@page==1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
dorefresh = true dorefresh = true
end end
elsif Input.trigger?(Input::DOWN) elsif Input.trigger?(Input::DOWN)
@@ -481,7 +481,7 @@ class PokemonPokedexInfo_Scene
pbUpdateDummyPokemon pbUpdateDummyPokemon
@available = pbGetAvailableForms @available = pbGetAvailableForms
pbSEStop pbSEStop
(@page==1) ? GameData::Species.play_cry_from_species(@species, @form) : pbPlayCursorSE (@page==1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
dorefresh = true dorefresh = true
end end
elsif Input.trigger?(Input::LEFT) elsif Input.trigger?(Input::LEFT)
@@ -511,14 +511,14 @@ class PokemonPokedexInfo_Scene
end end
def pbSceneBrief def pbSceneBrief
GameData::Species.play_cry_from_species(@species, @form) Pokemon.play_cry(@species, @form)
loop do loop do
Graphics.update Graphics.update
Input.update Input.update
pbUpdate pbUpdate
if Input.trigger?(Input::ACTION) if Input.trigger?(Input::ACTION)
pbSEStop pbSEStop
GameData::Species.play_cry_from_species(@species, @form) Pokemon.play_cry(@species, @form)
elsif Input.trigger?(Input::BACK) elsif Input.trigger?(Input::BACK)
pbPlayCloseMenuSE pbPlayCloseMenuSE
break break

View File

@@ -913,7 +913,7 @@ class PokemonSummary_Scene
@sprites["pokemon"].setPokemonBitmap(@pokemon) @sprites["pokemon"].setPokemonBitmap(@pokemon)
@sprites["itemicon"].item = @pokemon.item_id @sprites["itemicon"].item = @pokemon.item_id
pbSEStop pbSEStop
GameData::Species.play_cry_from_pokemon(@pokemon) @pokemon.play_cry
end end
def pbMoveSelection def pbMoveSelection
@@ -1250,7 +1250,7 @@ class PokemonSummary_Scene
end end
def pbScene def pbScene
GameData::Species.play_cry_from_pokemon(@pokemon) @pokemon.play_cry
loop do loop do
Graphics.update Graphics.update
Input.update Input.update
@@ -1258,7 +1258,7 @@ class PokemonSummary_Scene
dorefresh = false dorefresh = false
if Input.trigger?(Input::ACTION) if Input.trigger?(Input::ACTION)
pbSEStop pbSEStop
GameData::Species.play_cry_from_pokemon(@pokemon) @pokemon.play_cry
elsif Input.trigger?(Input::BACK) elsif Input.trigger?(Input::BACK)
pbPlayCloseMenuSE pbPlayCloseMenuSE
break break