Advertisement
FiaPlay

MBD (BES)

Mar 30th, 2024 (edited)
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 31.35 KB | None | 0 0
  1. #-----------------------------------------------------------------------------
  2. # Script creado por FiaPlay para Pokémon Essentials BES. Créditos si se usa.
  3. # Discord de FP Systems: https://discord.gg/ds8DWB5NSW
  4. # Si vas reportar algún bug o preguntar algo recomiendo hacerlo en el hilo del server de PokeLiberty o en FP Systems.
  5. #Changelog:
  6. #3.1: Añadida la posibilidad de poner un texto cuando se cambia el clima.
  7. #     Añadida la posibilidad de poner un texto cuando se cambia el campo activo.
  8. #     Añadida la posibilidad de poner un texto cuando se cambia un Pokémon.
  9. #     Se puede definir un color para los diálogos de un personaje específico.
  10. #     Corrección de errores
  11. #3.0: Añadidos más bufers para diálogos.
  12. #     Si pones //ht en un diálogo no se mostrará el entrenador.
  13. #     Añadida la posibilidad de poner un texto cuando el último Pokémon del jugador tiene pocos PS.
  14. #     Añadida la posibilidad de poner un bgm cuando el jugador saca su último Pokémon.
  15. #     Añadida la posibilidad de poner un texto cuando se usa un movimiento Físico, Especial o de Estado.
  16. #     Optimización, etc.....
  17. #2.3.1: Corregido bug que hacía que lowhp_last se muestre varias veces.
  18. #       Ahora es posible poner un texto cuando el jugador tiene un solo pokémon en su equipo.(Idea por: Papalomond Sempai)
  19. #2.3: Cambio de nombre de las claves por otras más cortas y fáciles de recordar.
  20. #     Añadida la posibilidad de poner un texto cuando comienza y termina un turno.
  21. #     Ahora es posible definir un diálogo desde la llamada a Script.
  22. #     Ahora si pones //PN en un texto se mostrará el nombre del jugador.
  23. #     Corrección de errores y optimización.
  24. #2.2.2: Solucionado bug con la megaevolución salvaje.
  25. #2.2.1: Solucionado bug de los Pokemon Oscuros del jugador.
  26. #2.2: Ahora puedes encadenar varios textos colocándolos en una Array. (Se muestran uno detrás de otro)
  27. #     Añadida la posibilidad de poner un texto cuando se unvía un Pokémon Shiny.
  28. #     Añadida la posibilidad de poner un texto cuando el último Pokémon del rival tiene pocos PS.
  29. #     Corrección de errores y refactorización.
  30. #2.1.1: Solucionado Bug de incompatibilidad con el script de Entrenadores dinámicos.
  31. #2.1: Añadida la posibilidad de poner un texto cuando el jugador saca un Pokémon oscuro.
  32. #     Añadida la posibilidad de poner un texto cuando el jugador saca su último Pokémon.
  33. #     Añadida la posibilidad de poner un texto cuando un Pokémon recibe un golpe Super-Efectivo.
  34. #     Añadida la posibilidad de poner un texto cuando un Pokémon recibe un golpe Poco-Efectivo.
  35. #     Añadida la posibilidad de poner un texto cuando un Pokémon recibe un Golpe Crítico.
  36. #     Solucionada incompatibilidad con mi script de Megaevolución de Pokémon Salvaje (Coloque este script debajo de ese).
  37. #     Compatibilidad con este sistema de Dynamax: https://www.pokecommunity.com/showthread.php?t=426770
  38. #     Corrección de errores.
  39. #2.0: Nueva forma de setear los textos (No pienso volver a cambiarla).
  40. #     Eliminada la necesidad de usar variables de evento.
  41. #     Ahora el rival puede decir algo cuando el jugador usa una de las mecánicas de batalla (Megaevolución,Ultraexplosión,etc...)
  42. #     Ahora el rival puede decir algo cuando este saca un Pokémon en específico.
  43. #     Añadida la posibilidad de reproducir un SE junto con los textos.
  44. #-----------------------------------------------------------------------------
  45. # Demostración https://youtu.be/lHCQdq62Xh8 (2.0)
  46. #-----------------------------------------------------------------------------
  47. # Modo de uso:
  48. #Para que los campos funcionen siga los pasos de: https://pastebin.com/kK8a85DN
  49. #Para activar los textos solo setealos usando el método fpTTS_set()
  50. #Entre paréntesis va un Symbol que es el nombre de la constante con los datos.
  51. =begin Para un ejemplo práctico pegue una de las siguientes 3 líneas en una llamada a script
  52. fpTTS_set(:FIAPLAY)
  53. fpTTS_set(:CHAMPION_BLUE)
  54. fpTTS_set(:LEADER_BROCK)
  55. =end
  56. =begin Si lo que quiere es definirlo desde una llamada a Script (Ni idea de por qué) podría:
  57. dialogue={
  58. "mega" => "¡Voy con todo!",
  59. "super_effective_move(player)" => "Sabes lo que haces muchacho."
  60. }
  61. fpTTS_set(dialogue)
  62. En caso de que quieras solo el del último pokémon:
  63. fpTTS_set("¡Es el momento de darlo todo!")
  64. =end
  65. =begin En caso de que tu proyecto vaya a tener más de un idioma debes poner _INTL antes del diálogo para poder traducirlo. Tal que así:
  66. "last" => [_INTL("Finaly."),_INTL("The Groundon's awakening.")]
  67. =end
  68.  
  69. #-----------------------------------------------------------------------------
  70. # FAQ:
  71. #*¿Para cuando videotutorial?
  72. # Para cuando tenga ganas.
  73. #
  74. #*¿Funciona con combates dobles?
  75. # Sí, pero no recomendable usarlo en combates múltiples.
  76. #
  77. #*¿Cómo puedo añadir nuevos diálogos o modificar como se muestran?
  78. # Los diálogos se muestran con el comando fpShowText, si tienes algnos conocimientos en programación te será facil modificarlo a tu gusto.
  79. #
  80. #*He recibido x error y me parece que es este script.
  81. # Avísame por el Discord. (Solo si de verdad crees que fue este script)
  82. #-----------------------------------------------------------------------------
  83. # Estas son las opciones cámbialas a como necesites.
  84. #-----------------------------------------------------------------------------
  85. TEXTSE = "" #SE que se reproducirá al aparecer el sprite del entrenador
  86. module MBD_Data
  87.  
  88. #Lista con los colores de texto de cada entrenador.
  89. #Por limitaciones de RGSS no funcionan nombres con acentos.
  90. CHARACTERS_COLORS = {"FiaPlay"     => [Color.new(22,245,237),Color.new(1,102,99)],
  91.                      "Flandecson"  => [Color.new(245,22,22),Color.new(102,1,1)],
  92.                      "Mavros"      => [Color.new(204,22,245),Color.new(102,1,95)],
  93.                      "Brock"       => [Color.new(255,77,0),Color.new(77,25,0)]}
  94.  
  95. #-----------------------------------------------------------------------------
  96. # En la siguiente constante están configurados todos los diálogos posibles.
  97. #-----------------------------------------------------------------------------
  98. FIAPLAY={
  99.   "last_bgm" => "Battle! (Gym Leader)",
  100.   "last_bgm(player)" => "Battle! (Champion)",
  101.   "last" => ["Es momento de ponerse serio.","Flandecson: No recuerdo la última vez que vi a Fia tan centrado en un combate//ht"],
  102.   "last(player)" => "Te veo en un buen apuro.",
  103.   "end_turn" => {0  =>  ["¿Qué haces?","Esto solo está empezando."],
  104.                  10 =>  "Este combate se está alargando más de lo que me gustaría."},
  105.   "pre_start_turn" => {0  =>  "No recuerdo la última vez que me enfrenté a alguien tan reconocido."},
  106.   "start_turn" => {0  =>  "Veamos de qué estás hecho... //PN."},
  107.   "one_poke" => ["Jajaja","¿En qué estás pensando //PN?"],
  108.   "lowhp_last" => ["!No puede ser¡","¡Mi //B1N!"],
  109.   "lowhp_last(player)" => "Flandecson: !Estas a punto de caer ante el gran //ON.//ht",
  110.   "shiny" => ["¿Cómo ves mi brillo?","¿Es mucho para tí?"],
  111.   "shiny(player)" => "¿De dónde sacaste eso?",
  112.   "mega" => "¡Qué importa solo debo usar la poderosa energía ancestral!",
  113.   "mega(player)" => ["No podía esperar menos de tí.","Eres digno de retar al gran //ON."],
  114.   "primal" => "El poder primigenio es la clave de mi victoria.",
  115.   "primal(player)" => "Rubíes y Zafiros... Veo que también dominas ese poder.",
  116.   "ultra" => "¡Ilumínanos y muestra el poder del Cosmos!",
  117.   "ultra(player)" => ["Debo admitirlo. Esa ráfaga de luz me ha dejado marvillado.","Mavros: Esa luz...//nAcaso será.//ht"],
  118.   "send" => {PBSpecies::KYOGRE   =>  "Tan solo admira mi Leviatán.",
  119.              PBSpecies::GROUDON  =>  "Un poderoso Reptil Ígneo.",
  120.              PBSpecies::RAYQUAZA =>  "Tardé años en domar el poder de esta leyenda."},
  121.   "item" => "No puedo dejar que esto termine tan rápido.",
  122.   "recall" => "Me pones en un buen aprieto.",
  123.   "recall(player)" => "Mavros: ¿Qué estará tramando //PN?",
  124.   "shadow" => "No es inhumano , solo es un viejo truco.",
  125.   "shadow(player)" => "Me sorprende verte usando un poder como ese.",
  126.   "caught" => "¿Cómo te atreves?",
  127.   "weather" => {PBWeather::SUNNYDAY => "Fire in the hole!",
  128.                 PBWeather::RAINDANCE => ["Mavros: Cae la lluvia...//ht","Flandecson: La naturaleza llora.//ht"]},
  129.   "terrain" => {"Electric" => "Prepárate para una buena descarga.", #Los terrenos son Grassy , Electric , Misty y Psiqui
  130.                 "Misty"    => ["Flandecson: Esto no se ve bien.","Flandecson: ¡De hecho no se ve nada!"]},
  131.   "critical_move" => "Tengo al universo de mi lado.",
  132.   "critical_move(player)" => "Necesitarás más que suerte para vencerme.",
  133.   "low_effective_move" => "Debo pensar mejor lo que hago.",
  134.   "low_effective_move(player)" => ["Creí tenías más experiencia.","No puedes ganarme cometiendo errores."],
  135.   "super_effective_move" => "Mavros: Cometiste un greve error al meterte el jefe//ht.",
  136.   "super_effective_move(player)" => "Nada mal niño.",
  137.   "special_move" => "Te veo y te analizo.",
  138.   "special_move(player)" => "Ven, acércate a //B1N.",
  139.   "physical_move" => "No puedo perder tiempo.",
  140.   "physical_move(player)" => "¿Acaso sabes lo que haces?",
  141.   "status_move" => "No puedo arriesgarme.",
  142.   "status_move(player)" => "¿Qué estás tramando?.",
  143.   "z_move" => "Es momento de un AZ oculto.",
  144.   "z_move(player)" => "Me estás atacando a matar.",
  145.   "tera" => "Ilumínate con mi resplandor.",
  146.   "tera(player)" => "¡Me sorprende que sepas usar este fenómeno!",
  147.   "tera(Ogerpon)" => ["Mavros: ...acaso es...//ht","¿Podrías dejar de burlarte de mi?"]
  148. }
  149.  
  150. #-----------------------------------------------------------------------------
  151. # Esto sería para la batalla contra el campeón por defecto.
  152. #-----------------------------------------------------------------------------
  153. CHAMPION_BLUE={
  154.   "last" => "No puedo dejar que me derrotes ahora.",
  155.   "last(player)" => "Nuestros eternos combates por fin terminarán.",
  156.   "end_turn" => {0  =>  ["Este combate solo está empezando.", "No debes confiarte."]},
  157.   "lowhp_last" => "Mientras tenga uno mi poder es infinito.",
  158.   "send" => {PBSpecies::BLASTOISE  =>  "Espero que sepas nadar.",
  159.              PBSpecies::CHARIZARD  =>  "Prepárate para pasar calor."},
  160.   "item" => "Usaré todo lo que tenga a mano para vencerte.",
  161.   "shadow(player)" => ["Veo que caiste en esa tentación.","No mereces siquiera retarme."],
  162.   "critical_move(player)" => "Solo con eso no me ganarás.",
  163.   "low_effective_move(player)" => "¿En qué estabas pensando?",
  164.   "super_effective_move" => "Aprendí mucho con mi Pokedex."
  165. }
  166. #-----------------------------------------------------------------------------
  167. # Esto sería para la batalla contra Brock.
  168. #-----------------------------------------------------------------------------
  169. LEADER_BROCK={
  170.   "last_bgm" => "Battle! (Champion)",
  171.   "last" => "Bien, pero si quieres la medalla roca tendrás que luchar un poco más.",
  172.   "end_turn" => {0  =>  ["¿Qué haces?","Esto solo está empezando."]},
  173.   "shiny" => "Este Onix dorado representa la perseverancia de los entrenadores.",
  174.   "mega(player)" => "Me parece muy temprano para que uses algo así.",
  175.   "item" => "Mi dura voluntad me mantine en pie..",
  176.   "super_effective_move(player)" => "Jamás podrás romper su dura coraza Rocosa."
  177. }
  178. end
  179.  
  180. #--------------------------------------------------------------------------------
  181. # A patir de aquí no toques nada a no ser que sepas bien lo que estás haciendo
  182. # Método que devuelve el nombre del entrenador rival
  183. #--------------------------------------------------------------------------------
  184. def getSpeeker(text,battle)
  185.   if text.include?(":")
  186.     return text.before(":")
  187.   else
  188.     return battle.opponent.name
  189.   end
  190.   return ""
  191. end
  192.  
  193. class PokeBattle_Battle
  194.   attr_accessor :tts
  195.  
  196. #--------------------------------------------------------------------------------
  197. # Control de Variables
  198. #--------------------------------------------------------------------------------
  199.   alias initialize_fpd initialize
  200.   def initialize(*args)
  201.     @tts=$tts ? $tts : {}
  202.     @mbu=[]
  203.     $tts=nil
  204.     initialize_fpd(*args)
  205.   end
  206.  
  207. #--------------------------------------------------------------------------------
  208. # Método que muestra los textos
  209. #--------------------------------------------------------------------------------
  210.   def fpShowText(key="",mbu="",dtext="")
  211.     return if !@opponent #Revisa si es una batalla contra un entrenador
  212.     return if !@tts[key] #Revisa si el diálogo está definido
  213.     return if !dtext
  214.     text = dtext.length>0 ? dtext : @tts[key] #Revisa si se utilizará el texto directo
  215.     return if @mbu.include?(mbu) #Revisa si se mostró el diálogo antes
  216.     if text.is_a?(Array) #Revisa si es definición simple o en cadena
  217.       it=0
  218.       for i in text
  219.         not_show=false
  220.         not_show=true if i.include?("//ht")
  221.         if not_show #Revisa si debe mostrarse el entrenador
  222.           @scene.set_dialog_color(i)
  223.           pbDisplayPaused(fpBuffer(i)) #Muestra el diálogo
  224.         else
  225.           @scene.set_dialog_color(i)
  226.           @scene.pbShowOpponent(0) #Muestra el entrenador
  227.           pbSEPlay(TEXTSE) if TEXTSE && TEXTSE!="" # Reproduce el SE
  228.           pbDisplayPaused(fpBuffer(i)) #Muestra el diálogo
  229.           @scene.pbHideOpponent() if !text[it+1] || text[it+1].include?("//ht") #Oculta el entrenador
  230.         end
  231.         it+=1
  232.       end
  233.     else
  234.       if text.include?("//ht")#Revisa si debe mostrarse el entrenador
  235.         @scene.set_dialog_color(text)
  236.         pbDisplayPaused(fpBuffer(text)) #Muestra el diálogo
  237.       else
  238.         @scene.set_dialog_color(text)
  239.         @scene.pbShowOpponent(0)
  240.         pbSEPlay(TEXTSE) if TEXTSE && TEXTSE!="" # Reproduce el SE
  241.         pbDisplayPaused(fpBuffer(text)) #Muestra el diálogo
  242.         @scene.pbHideOpponent()
  243.       end
  244.     end
  245.     @scene.set_dialog_color("")
  246.     PBDebug.log("Díalogo Mostrado: #{text}")
  247.     @mbu.push(mbu) if mbu!="" #Añade el diálogo a la lista de los mostrados
  248.   end
  249.  
  250. #--------------------------------------------------------------------------------
  251. # Método que controla los buffers
  252. #--------------------------------------------------------------------------------
  253.  
  254.   def fpBuffer(str)
  255.     str.gsub!("//PN",$Trainer.name);str.gsub!("//pn",$Trainer.name) #Nombre de PLAYER
  256.     str.gsub!("//ON",@opponent.name);str.gsub!("//on",@opponent.name) #Nombre del rival
  257.     str.gsub!("//HT","");str.gsub!("//ht","")
  258.       str.gsub!("//T2","");str.gsub!("//t2","") #Tempralmente sin uso
  259.     for i in 0...4
  260.       str.gsub!("//B#{i}N",@battlers[i].name);str.gsub!("//b#{i}n",@battlers[i].name) #Nombre del Battler X
  261.     end
  262.       return str
  263.   end
  264.  
  265. #--------------------------------------------------------------------------------
  266. #Para el último Pokémon , los Pokémon específicos y los Pokémon Oscuros del jugador.
  267. #--------------------------------------------------------------------------------
  268.   def pbSendOut(index,pokemon)
  269.     pbSetSeen(pokemon)
  270.     @peer.pbOnEnteringBattle(self,pokemon)
  271.     if pbIsOpposing?(index)
  272.       fpShowText("last") if pbPokemonCount(@party2)==1
  273.       pbBGMPlay(@tts["last_bgm"],100,100) if @tts["last_bgm"] && pbPokemonCount(@party2)==1
  274.       @scene.pbTrainerSendOut(index,pokemon)
  275.       if (pbPokemonCount(@party2)>=2 || @tts["last"] == nil) && @tts["send"]
  276.         fpShowText("send","opp#{pokemon.name}",@tts["send"][pokemon.species])
  277.       end
  278.     else
  279.       @scene.pbSendOut(index,pokemon)
  280.       if pbPokemonCount(@party1)==1
  281.         if $Trainer.party.length>1
  282.           fpShowText("last(player)")
  283.         else
  284.           fpShowText("one_poke")
  285.         end
  286.       end
  287.       pbBGMPlay(@tts["last_bgm(player)"],100,100) if @tts["last_bgm(player)"] && pbPokemonCount(@party1)==1
  288.         @battle.fpShowText("shadow(player)","shadow(player)") if pokemon.isShadow?
  289.     end
  290.     @scene.pbResetMoveIndex(index)
  291.   end
  292.  
  293. #--------------------------------------------------------------------------------
  294. #Para la Regresión Primigenia
  295. #--------------------------------------------------------------------------------
  296.   def pbPrimalReversion(index)
  297.     return if !@battlers[index] || !@battlers[index].pokemon
  298.     return if !(@battlers[index].hasPrimal? rescue false)
  299.     return if (@battlers[index].isPrimal? rescue true)
  300.     fpShowText("primal") if pbIsOpposing?(index)
  301.     pbCommonAnimation("Primal#{PBSpecies.getName(@battlers[index].species)}",@battlers[index],nil)
  302.     @battlers[index].pokemon.makePrimal
  303.     @battlers[index].form=@battlers[index].pokemon.form
  304.     @battlers[index].pbUpdate(true)
  305.     @scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
  306.       pbCommonAnimation("Primal#{PBSpecies.getName(@battlers[index].species)}2",@battlers[index],nil)
  307.     pbDisplay(_INTL("¡{1} ha esperimentado una Regresión Primigenia y ha recobrado su apariencia primitiva!",@battlers[index].pbThis))
  308.     fpShowText("primal(player)") if pbBelongsToPlayer?(index)
  309.     PBDebug.log("[Regresión Primigenia] #{@battlers[index].pbThis} ha recobrado su apariencia primitiva")
  310.   end
  311.  
  312. #--------------------------------------------------------------------------------
  313. #Para la Megaevolución
  314. #--------------------------------------------------------------------------------
  315.   def pbMegaEvolve(index)
  316.     return if !@battlers[index] || !@battlers[index].pokemon
  317.     return if !(@battlers[index].hasMega? rescue false)
  318.     return if (@battlers[index].isMega? rescue true)
  319.     fpShowText("mega") if pbIsOpposing?(index)
  320.     if pbGetOwner(index)==nil
  321.       case (@battlers[index].pokemon.megaMessage rescue 0)
  322.       when 1 # Rayquaza
  323.         pbDisplay(_INTL("¡El ruego vehemente alcanza a {1}!",@battlers[index].pbThis))
  324.       else
  325.         pbDisplay(_INTL("¡La {2} de {1} está reaccionando su poder interior!",
  326.            @battlers[index].pbThis,PBItems.getName(@battlers[index].item)))
  327.       end
  328.     else
  329.       ownername=pbGetOwner(index).fullname
  330.       ownername=pbGetOwner(index).name if pbBelongsToPlayer?(index)
  331.       case (@battlers[index].pokemon.megaMessage rescue 0)
  332.       when 1                                                           # Rayquaza
  333.         pbDisplay(_INTL("¡El ruego vehemente de {1} alcanza a {2}!",ownername,@battlers[index].pbThis))
  334.       else
  335.         pbDisplay(_INTL("¡La {2} de {1} está reaccionando al {4} de {3}!",
  336.            @battlers[index].pbThis,PBItems.getName(@battlers[index].item),
  337.            ownername,pbGetMegaRingName(index)))
  338.       end
  339.     end
  340.     pbCommonAnimation("MegaEvolution",@battlers[index],nil)
  341.     @battlers[index].pokemon.makeMega
  342.     @battlers[index].form=@battlers[index].pokemon.form
  343.     @battlers[index].pbUpdate(true)
  344.     @scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
  345.     pbCommonAnimation("MegaEvolution2",@battlers[index],nil)
  346.     meganame=(@battlers[index].pokemon.megaName rescue nil)
  347.     if !meganame || meganame==""
  348.       meganame=_INTL("Mega {1}",PBSpecies.getName(@battlers[index].pokemon.species))
  349.     end
  350.     pbDisplay(_INTL("¡{1} ha Mega Evolucionado en {2}!",@battlers[index].pbThis,meganame))
  351.     PBDebug.log("[Mega Evolución] #{@battlers[index].pbThis} ha Mega Evolucionado")
  352.     fpShowText("mega(player)") if pbBelongsToPlayer?(index)
  353.     side=(pbIsOpposing?(index)) ? 1 : 0
  354.     owner=pbGetOwnerIndex(index)
  355.     @megaEvolution[side][owner]=-2
  356.   end
  357.  
  358. #--------------------------------------------------------------------------------
  359. # Para la Ultraexplosión
  360. #--------------------------------------------------------------------------------
  361.   def pbUltraBurst(index)
  362.     return if !@battlers[index] || !@battlers[index].pokemon
  363.     return if !(@battlers[index].hasUltra? rescue false)
  364.     return if (@battlers[index].isUltra? rescue true)
  365.     @necrozmaVar = [@battlers[index].pokemonIndex,@battlers[index].form] if pbBelongsToPlayer?(index)
  366.     ownername=pbGetOwner(index).fullname
  367.     ownername=pbGetOwner(index).name if pbBelongsToPlayer?(index)
  368.     fpShowText("ultra") if pbIsOpposing?(index)
  369.     pbDisplay(_INTL("¡{1} emite una luz cegadora!",@battlers[index].pbThis))
  370.     pbCommonAnimation("UltraBurst",@battlers[index],nil)
  371.     @battlers[index].pokemon.makeUltra
  372.     @battlers[index].form=@battlers[index].pokemon.form
  373.     @battlers[index].pbUpdate(true)
  374.     @scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
  375.     pbCommonAnimation("UltraBurst2",@battlers[index],nil)
  376.     ultraname=(@battlers[index].pokemon.ultraName rescue nil)
  377.     if !ultraname || ultraname==""
  378.       ultraname=_INTL("Ultra {1}",PBSpecies.getName(@battlers[index].pokemon.species))
  379.     end
  380.     pbDisplay(_INTL("¡{1} ha adoptado una nueva forma gracias a la Ultraexplosión!",@battlers[index].pbThis))
  381.     fpShowText("ultra(player)") if pbIsOpposing?(index)
  382.     PBDebug.log("[Ultra Burst] #{@battlers[index].pbThis} became #{ultraname}")
  383.     side=(pbIsOpposing?(index)) ? 1 : 0
  384.     owner=pbGetOwnerIndex(index)
  385.     @ultraBurst[side][owner]=-2
  386.   end
  387.  
  388. #--------------------------------------------------------------------------------
  389. # Para los Movimientos Z
  390. #--------------------------------------------------------------------------------
  391.   def pbUseZMove(index,move,crystal)
  392.     return if !@battlers[index] || !@battlers[index].pokemon
  393.     return if !(@battlers[index].hasZMove? rescue false)
  394.     ownername=pbGetOwner(index).fullname
  395.     ownername=pbGetOwner(index).name if pbBelongsToPlayer?(index)
  396.     fpShowText("z_move") if pbIsOpposing?(index)
  397.     pbDisplay(_INTL("¡{1} se envuelve en un halo de Poder Z!",@battlers[index].pbThis))
  398.     pbCommonAnimation("ZPower",@battlers[index],nil)
  399.     PokeBattle_ZMoves.new(self,@battlers[index],move,crystal)
  400.     fpShowText("z_move(player)") if pbBelongsToPlayer?(index)
  401.     side=(pbIsOpposing?(index)) ? 1 : 0
  402.     owner=pbGetOwnerIndex(index)
  403.     @zMove[side][owner]=-2
  404.   end
  405.  
  406. #--------------------------------------------------------------------------------
  407. # Para los objetos
  408. #--------------------------------------------------------------------------------
  409.   alias pbEnemyUseItem_fp pbEnemyUseItem
  410.   def pbEnemyUseItem(*args)
  411.     fpShowText("item","item")
  412.     pbEnemyUseItem(args)
  413.   end
  414.  
  415. #--------------------------------------------------------------------------------
  416. # Para los Preinicios de turno
  417. #--------------------------------------------------------------------------------
  418.   alias pbCommandPhase_fp pbCommandPhase
  419.   def pbCommandPhase
  420.     fpShowText("pre_start_turn","pre_start#{@turncount}",@tts["pre_start_turn"][@turncount]) if @tts["pre_start_turn"]
  421.     pbCommandPhase_fp
  422.   end
  423.  
  424. #--------------------------------------------------------------------------------
  425. # Para los inicios de turno
  426. #--------------------------------------------------------------------------------
  427. alias pbAttackPhase_fp pbAttackPhase
  428. def pbAttackPhase
  429.   fpShowText("start_turn","start#{@turncount}",@tts["start_turn"][@turncount]) if @tts["start_turn"]
  430.   pbAttackPhase_fp
  431. end
  432.  
  433. #--------------------------------------------------------------------------------
  434. # Para los finales de turno y pocos PS en el último Pokémon
  435. #--------------------------------------------------------------------------------
  436.   alias pbEndOfRoundPhase_fp pbEndOfRoundPhase
  437.   def pbEndOfRoundPhase
  438.     fpShowText("lowhp_last","lowhp_last") if pbPokemonCount(@party2)==1 && @battlers[1].totalhp/2 >= @battlers[1].hp && !@battlers[1].isFainted?
  439.     fpShowText("lowhp_last(player)","lowhp_last(player)") if pbPokemonCount(@party1)==1 && @battlers[0].totalhp/2 >= @battlers[0].hp && !@battlers[0].isFainted?
  440.     fpShowText("end_turn","end#{@turncount}",@tts["end_turn"][@turncount]) if @tts["end_turn"]
  441.     pbEndOfRoundPhase_fp
  442.   end
  443.  
  444. #--------------------------------------------------------------------------------
  445. # Para los climas
  446. #--------------------------------------------------------------------------------
  447.   def weather=(v)
  448.     @weather=v
  449.     fpShowText("weather","weather#{v}",@tts["weather"][v]) if @tts["weather"]
  450.   end
  451.  
  452. #--------------------------------------------------------------------------------
  453. # Para los cambios
  454. #--------------------------------------------------------------------------------
  455.   def pbRecallAndReplace(index,newpoke,newpokename=-1,batonpass=false,moldbreaker=false)
  456.     @battlers[index].pbResetForm
  457.     if !@battlers[index].isFainted?
  458.       fpShowText("recall","recall") if pbIsOpposing?(index)
  459.       @scene.pbRecall(index)
  460.       fpShowText("recall(player)","recall(player)") if pbBelongsToPlayer?(index)
  461.     end
  462.     pbMessagesOnReplace(index,newpoke,newpokename)
  463.     pbReplace(index,newpoke,batonpass)
  464.     return pbOnActiveOne(@battlers[index],false,moldbreaker)
  465.   end
  466. end
  467.  
  468. #--------------------------------------------------------------------------------
  469. # Para los golpes Super-Efectivos, Poco-Efectivos, Críticos, etc....
  470. #--------------------------------------------------------------------------------
  471. class PokeBattle_Move
  472.   def pbEffectMessages(attacker,opponent,ignoretype=false,alltargets=nil)
  473.     if opponent.damagestate.critical
  474.       if alltargets && alltargets.length>1
  475.         @battle.pbDisplay(_INTL("¡Es un golpe crítico en {1}!",opponent.pbThis(true)))
  476.       else
  477.         @battle.pbDisplay(_INTL("¡Es un golpe crítico!"))
  478.       end
  479.       @battle.fpShowText("critical_move","critical_move") if @battle.pbIsOpposing?(attacker.index)
  480.       @battle.fpShowText("critical_move(player)","critical_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  481.     end
  482.     if !pbIsMultiHit && attacker.effects[PBEffects::ParentalBond]==0
  483.       if opponent.damagestate.typemod>8
  484.         if alltargets && alltargets.length>1
  485.           @battle.pbDisplay(_INTL("¡Es super efectivo en {1}!",opponent.pbThis(true)))
  486.         else
  487.           @battle.pbDisplay(_INTL("¡Es super efectivo!"))
  488.         end
  489.         @battle.fpShowText("super_effective_move","super_effective_move") if @battle.pbIsOpposing?(attacker.index)
  490.         @battle.fpShowText("super_effective_move(player)","super_effective_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  491.       elsif opponent.damagestate.typemod>=1 && opponent.damagestate.typemod<8
  492.         if alltargets && alltargets.length>1
  493.           @battle.pbDisplay(_INTL("No es muy efectivo en {1}...",opponent.pbThis(true)))
  494.         else
  495.           @battle.pbDisplay(_INTL("No es muy efectivo..."))
  496.         end
  497.         @battle.fpShowText("low_effective_move","low_effective_move") if @battle.pbIsOpposing?(attacker.index)
  498.         @battle.fpShowText("low_effective_move(player)","low_effective_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  499.       end
  500.     end
  501.     if pbIsSpecial?(0)
  502.       @battle.fpShowText("special_move","special_move") if @battle.pbIsOpposing?(attacker.index)
  503.       @battle.fpShowText("special_move(player)","special_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  504.     elsif pbIsPhysical?(0)
  505.       @battle.fpShowText("physical_move","physical_move") if @battle.pbIsOpposing?(attacker.index)
  506.       @battle.fpShowText("physical_move(player)","physical_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  507.     else
  508.       @battle.fpShowText("status_move","status_move") if @battle.pbIsOpposing?(attacker.index)
  509.       @battle.fpShowText("status_move(player)","status_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  510.     end
  511.     if opponent.damagestate.endured
  512.       @battle.pbDisplay(_INTL("¡{1} aguantó el golpe!",opponent.pbThis))
  513.     elsif opponent.damagestate.sturdy
  514.       @battle.pbDisplay(_INTL("¡{1} resistió con Robustez!",opponent.pbThis))
  515.     elsif opponent.damagestate.focussash
  516.       @battle.pbDisplay(_INTL("¡{1} resistió usando Banda Focus!",opponent.pbThis))
  517.       opponent.pbConsumeItem
  518.     elsif opponent.damagestate.focusband
  519.       @battle.pbDisplay(_INTL("¡{1} resistió usando Cinta Focus!",opponent.pbThis))
  520.     end
  521.   end
  522.  
  523. #--------------------------------------------------------------------------------
  524. # Para los golpes Ineficaces
  525. #--------------------------------------------------------------------------------
  526.   def pbTypeModMessages(type,attacker,opponent)
  527.     return 8 if type<0
  528.     typemod=pbTypeModifier(type,attacker,opponent)
  529.     if typemod==0
  530.       @battle.pbDisplay(_INTL("No afecta a {1}...",opponent.pbThis(true)))
  531.     else
  532.       typemod = 0 if pbTypeImmunityByAbility(type,attacker,opponent)
  533.     end
  534.     if typemod==0
  535.       @battle.fpShowText("non_effective_move","non_effective_move") if @battle.pbIsOpposing?(attacker.index)
  536.       @battle.fpShowText("non_effective_move(player)","non_effective_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  537.     end
  538.     return typemod
  539.   end
  540. end
  541.  
  542. #--------------------------------------------------------------------------------
  543. # Para los Pokémon Shiny y Oscuros
  544. #--------------------------------------------------------------------------------
  545. class PokeBattle_Scene
  546.   alias pbCommonAnimation_fp pbCommonAnimation
  547.   def pbCommonAnimation(*args)
  548.     pbCommonAnimation_fp(*args)
  549.       name=args[0] ; attacker=args[1]
  550.     case name
  551.     when "Shadow"
  552.       @battle.fpShowText("shadow","shadow")
  553.     when "Shiny"
  554.       @battle.fpShowText("shiny","shiny") if @battle.pbIsOpposing?(attacker.index)
  555.       @battle.fpShowText("shiny(player)","shiny(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  556.     end
  557.   end
  558.  
  559. #--------------------------------------------------------------------------------
  560. #Setea el color de las letras
  561. #--------------------------------------------------------------------------------
  562.   def set_dialog_color(text)
  563.     name=getSpeeker(text,@battle)
  564.     msgwindow=@sprites["messagewindow"]
  565.     if MBD_Data::CHARACTERS_COLORS.include?(name) && text.length>0
  566.       msgwindow.baseColor=MBD_Data::CHARACTERS_COLORS[name][0]
  567.       msgwindow.shadowColor=MBD_Data::CHARACTERS_COLORS[name][1]
  568.     else
  569.       msgwindow.baseColor=PokeBattle_SceneConstants::MESSAGEBASECOLOR
  570.       msgwindow.shadowColor=PokeBattle_SceneConstants::MESSAGESHADOWCOLOR
  571.     end
  572.   end
  573.  
  574. #--------------------------------------------------------------------------------
  575. #Corrección para que el entrenador no se muestre en ciertos casos
  576. #--------------------------------------------------------------------------------
  577.   alias pbShowOpponent_fp pbShowOpponent
  578.   def pbShowOpponent(*args)
  579.     return if @sprites["trainer"] && @sprites["trainer"].x<500
  580.     pbShowOpponent_fp(args)
  581.   end
  582. end
  583.  
  584. #--------------------------------------------------------------------------------
  585. #Para los Pokémon Oscuros capturados
  586. #--------------------------------------------------------------------------------
  587. module PokeBattle_BattleCommon
  588.   alias pbStorePokemon_fp pbStorePokemon
  589.   def pbStorePokemon(poke)
  590.     fpShowText("caught","caught") if poke.isShadow?
  591.     pbStorePokemon_fp(poke)
  592.   end
  593. end
  594.  
  595. #--------------------------------------------------------------------------------
  596. #Métodos Auxiliares.
  597. #--------------------------------------------------------------------------------
  598. class ::String
  599.   def before(t)
  600.     z=0
  601.     r=""
  602.     for i in self.scan(/./)
  603.       break if i==t
  604.       r.insert(z,i)
  605.       z+=1
  606.     end
  607.     return r
  608.   end
  609. end
  610.  
  611. #--------------------------------------------------------------------------------
  612. # Método que setea los textos
  613. #--------------------------------------------------------------------------------
  614. def fpTTS_set(param)
  615.   if param.is_a?(Symbol)
  616.       if hasConst?(MBD_Data,param)
  617.           $tts=getConst(MBD_Data,param)
  618.       else
  619.           raise "Constante de Diálogos no definida."
  620.       end
  621.   elsif param.is_a?(Hash)
  622.       $tts=param
  623.   elsif param.is_a(String)
  624.       $tts={};$tts["last"]=param
  625.   else
  626.       raise "Parámetro incorrecto, se esperaba un Hash, Symbol o String."
  627.   end
  628. end
  629.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement