Advertisement
FiaPlay

MBD

Apr 10th, 2023 (edited)
1,382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 30.07 KB | None | 0 0
  1. #-----------------------------------------------------------------------------
  2. # Script creado por FiaPlay para Pokémon Essentials 16.3. Créditos si se usa
  3. # Discord de FP Systems: https://discord.gg/ds8DWB5NSW
  4. # Versión para Essentials BW: https://pastebin.com/ky8nkSeK
  5. # Si vas reportar algún bug o preguntar algo recomiendo hacerlo en el hilo del server de PokeLiberty o en FP Systems.
  6. #Changelog:
  7. #2.3.1: Corregido bug que hacía que lowhp_last se muestre varias veces.
  8. #       Ahora es posible poner un texto cuando el jugador tiene un solo pokémon en su equipo.(Idea por: Papalomond Sempai)
  9. #2.3: Cambio de nombre de las claves por otras más cortas y fáciles de recordar.
  10. #     Añadida la posibilidad de poner un texto cuando se acaba un turno.
  11. #     Añadida la posibilidad de poner un texto cuando comienza un turno.
  12. #     Ahora es posible definir un diálogo desde la llamada a Script.
  13. #     Ahora si pones \PN en un texto se mostrará el nombre del jugador.
  14. #     Corrección de errores y optimización.
  15. #2.2.2: Solucionado bug con la megaevolución salvaje.
  16. #2.2.1: Solucionado bug de los Pokemon Oscuros del jugador.
  17. #2.2: Ahora puedes encadenar varios textos colocándolos en una Array. (Se muestran uno detrás de otro)
  18. #     Añadida la posibilidad de poner un texto cuando se unvía un Pokémon Shiny.
  19. #     Añadida la posibilidad de poner un texto cuando el último Pokémon del rival tiene pocos PS.
  20. #     Corrección de errores y refactorización.
  21. #2.1.1: Solucionado Bug de incompatibilidad con el script de Entrenadores dinámicos.
  22. #2.1: Añadida la posibilidad de poner un texto cuando el jugador saca un Pokémon oscuro.
  23. #     Añadida la posibilidad de poner un texto cuando el jugador saca su último Pokémon.
  24. #     Añadida la posibilidad de poner un texto cuando un Pokémon recibe un golpe Super-Efectivo.
  25. #     Añadida la posibilidad de poner un texto cuando un Pokémon recibe un golpe Poco-Efectivo.
  26. #     Añadida la posibilidad de poner un texto cuando un Pokémon recibe un Golpe Crítico.
  27. #     Solucionada incompatibilidad con mi script de Megaevolución de Pokémon Salvaje (Coloque este script debajo de ese).
  28. #     Compatibilidad con este sistema de Dynamax: https://www.pokecommunity.com/showthread.php?t=426770
  29. #     Corrección de errores.
  30. #2.0: Nueva forma de setear los textos (No pienso volver a cambiarla).
  31. #     Eliminada la necesidad de usar variables de evento.
  32. #     Ahora el rival puede decir algo cuando el jugador usa una de las mecánicas de batalla (Megaevolución,Ultraexplosión,etc...)
  33. #     Ahora el rival puede decir algo cuando este saca un Pokémon en específico.
  34. #     Añadida la posibilidad de reproducir un SE junto con los textos.
  35. #1.4: Eliminados los buffers de texto (Para ser sincero son innecesarios e incompatibles con los cambios de esta versión)
  36. #     Ahora si un diálogo no está definido se omite. (En anteriores versiones se mostraba un texto en blanco.)
  37. #     Ahora los textos se activan desde el mismo método que se setean. Se desactivan automáticamente al terminar la batalla.
  38. #     Compatibilidad con el script de Movimientos Z.
  39. #1.3: Añadida la posiblidad de usar buffers de texto.
  40. #     Añadido un método para revisar si hay una versión actualizada del script.
  41. #1.2: Añadida la posiblidad de usar varias músicas de último Pokémon.
  42. #     Añadida la posibilidad de poner un texto cuando el rival usa un objeto.
  43. #     Añadida la posibilidad de poner un texto cuando el rival saca un pokémon oscuro.
  44. #     Añadida la posibilidad de poner un texto cuando capturas pokémon oscuro del rival.
  45. #     Correción de errores (Incluido uno que viene por defecto en essentials).
  46. #1.1: Añadido un par de métodos para setear textos más facilmente.
  47. #1.0: Versión inicial.
  48. #-----------------------------------------------------------------------------
  49. # Demostración https://youtu.be/lHCQdq62Xh8 (2.0)
  50. #-----------------------------------------------------------------------------
  51. # Modo de uso:
  52. #Para activar los textos solo setealos usando el método fpTTS_set()
  53. #Entre paréntesis va un Symbol que es el nombre de la constante con los datos.
  54. =begin Para un ejemplo práctico pegue una de las siguientes 3 líneas en una llamada a script
  55. fpTTS_set(:TEST2_3)
  56. fpTTS_set(:CHAMPION_BLUE)
  57. fpTTS_set(:LEADER_BROCK)
  58. =end
  59. =begin Si lo que quiere es definirlo desde una llamada a Script (Ni idea de por qué) podría:
  60. dialogue={
  61. "mega" => "¡Voy con todo!",
  62. "super_effective_move(player)" => "Sabes lo que haces muchacho."
  63. }
  64. fpTTS_set(dialogue)
  65. =end
  66. =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í:
  67. "last" => [_INTL("Finaly."),_INTL("The Groundon's awakening.")]
  68. =end
  69.  
  70. #-----------------------------------------------------------------------------
  71. # FAQ:
  72. #*¿Para cuando videotutorial?
  73. # Para cuando tenga ganas.
  74. #
  75. #*¿Es compatible con EBS?
  76. # No deberías recibir mensajes de error, pero algunos textos no se mostrarán.
  77. #
  78. #*¿Funciona con combates dobles?
  79. # No deberías recibir mensajes de error, pero no prometo nada.
  80. #
  81. #*He recibido x error y me parece que es este script.
  82. # Avísame por el Discord. (Solo si de verdad crees que fue este script)
  83. #
  84. #*¿Piensas portearlo a Essentials 21.1?
  85. # Puedo , pero solo es cuestión de tiempo para que Essentials Deluxe se actualice.
  86. #-----------------------------------------------------------------------------
  87. # Estas son las opciones cámbialas a como necesites.
  88. #-----------------------------------------------------------------------------
  89. TEXTSE = "" #SE que se reproducirá al aparecer el sprite del entrenador
  90. module MBD_Data
  91.  
  92. #-----------------------------------------------------------------------------
  93. # En la siguiente constante están configurados todos los diálogos posibles.
  94. #-----------------------------------------------------------------------------
  95. TEST2_3={
  96.   "last_bgm" => "Boss02",
  97.   "last" => ["¡Ho, no. Es mi último Pokémon!","Pero todavía puedo luchar."],
  98.   "last(player)" => "Te veo en un buen apuro.",
  99.   "end_turn" => [0,["¿Qué haces?","Esto solo está empezando."]],
  100.   "start_turn" => [0,"Veamos de qué estás hecho... \PN."],
  101.   "one_poke" => ["Jajaja","¿En qué estás pensando \PN?"],
  102.   "lowhp_last" => ["!No puede ser¡","¡ESTOY AL LÍMITE!"],
  103.   "shiny" => ["¿Cómo ves mi brillo?","¿Es mucho para tí?"],
  104.   "shiny(player)" => "¿De donde sacaste eso?",
  105.   "mega" => "¡Qué importa solo debo usar la poderosa energía ancestral!",
  106.   "mega(player)" => "No podía esperar menos de tí.",
  107.   "primal" => "El poder primigenio es la clave de mi victoria.",
  108.   "primal(player)" => "Rubíes y Zafiros... Veo que también dominas ese poder.",
  109.   "ultra" => "¡Necrozma Muestra tu verdadera forma!",
  110.   "ultra(player)" => "Debo admitirlo. Esa ráfaga de luz me ha dejado marvillado.",
  111.   "send" => [:KYOGRE,"Tan solo admira mi Leviatán.",:GROUDON,"Un poderoso Reptil Ígneo."],
  112.   "item" => "No puedo dejar que esto termine tan rápido.",
  113.   "shadow" => "No es inhumano , solo es un viejo truco.",
  114.   "shadow(player)" => "Me sorprende verte usando un poder como ese.",
  115.   "caught" => "¡Cómo te atreves!",
  116.   "critical_move" => "Tengo al universo de mi lado.",
  117.   "critical_move(player)" => "Necesitarás más que suerte para vencerme.",
  118.   "low_effective_move" => "Debo pensar mejor lo que hago.",
  119.   "low_effective_move(player)" => ["Creí tenías más experiencia.","No puedes ganarme cometiendo errores."],
  120.   "super_effective_move" => "Cometiste un greve error al meterte conmigo.",
  121.   "super_effective_move(player)" => "Nada mal niño.",
  122.   "z_move" => "Es momento de un AZ oculto.",
  123.   "z_move(player)" => "Me estás atacando a matar.",
  124.   "tera" => "Ilumínate con mi resplandor.",
  125.   "tera(player)" => "¡Me sorprende que sepas usar este fenómeno!",
  126.   "dynamax" => "Un gran tamaño conlleva un gran poder.",
  127.   "dynamax(player)" => "Eres toda una caja de sorpresas."
  128. }
  129.  
  130. #-----------------------------------------------------------------------------
  131. # Esto sería para la batalla contra el campeón por defecto.
  132. #-----------------------------------------------------------------------------
  133. CHAMPION_BLUE={
  134.   "last" => "No puedo dejar que me derrotes ahora.",
  135.   "last(player)" => "Luego de tantos combtes por fin podré derotaré.",
  136.   "end_turn" => [0,["Este combate solo está empezando.", "Todavía no te confies."]],
  137.   "lowhp_last" => "Mientras tenga uno mi poder es infinito.",
  138.   "send" => [:BLASTOISE,"Espero que sepas nadar.",:CHARIZARD,"Prepárate para pasar calor."],
  139.   "item" => "Usaré todo lo que tenga a mano para vencerte.",
  140.   "shadow(player)" => ["Veo que caiste en esa tentación.","No mereces nisiquiera retarme."],
  141.   "critical_move(player)" => "Solo con eso no me ganarás.",
  142.   "low_effective_move(player)" => "¿En qué estabas pensando?",
  143.   "super_effective_move" => "Aprendí mucho con mi Pokedex."
  144. }
  145. #-----------------------------------------------------------------------------
  146. # Esto sería para la batalla contra Brock.
  147. #-----------------------------------------------------------------------------
  148. LEADER_BROCK={
  149.   "last_bgm" => "elite",
  150.   "last" => "Bien, pero si quieres la medalla roca tendrás que luchar un poco más.",
  151.   "end_turn" => [0,["¿Qué haces?","Esto solo está empezando."]],
  152.   "shiny" => "Este Onix dorado representa la perseverancia de los entrenadores.",
  153.   "mega(player)" => "Me parece muy temprano para que uses algo así.",
  154.   "item" => "No puedo rendirme tan rápido.",
  155.   "super_effective_move(player)" => "Jamás podrás romper su dura coraza Rocosa."
  156. }
  157. end
  158.  
  159. #--------------------------------------------------------------------------------
  160. # A patir de aquí no toques nada a no ser que sepas bien lo que estás haciendo.
  161. #--------------------------------------------------------------------------------
  162.  
  163. class PokeBattle_Battle
  164.  
  165. #--------------------------------------------------------------------------------
  166. # Control de Variables
  167. #--------------------------------------------------------------------------------
  168.   alias initialize_fpd initialize
  169.   def initialize(*args)
  170.     @tts=$tts ? $tts : {}
  171.     @mbu=[]
  172.     $tts=nil
  173.     initialize_fpd(*args)
  174.   end
  175.  
  176. #--------------------------------------------------------------------------------
  177. # Método que muestra los textos
  178. #--------------------------------------------------------------------------------
  179.   def fpShowText(key="",mbu="",dtext=nil)
  180.     return if $fpr && $fpr["no_dialogue"]
  181.     return if !@opponent # Revisa si es una batalla contra un entrenador
  182.     return if !@tts[key] #Revisa si el diálogo está definido
  183.     text = dtext ? dtext : @tts[key]
  184.     return if @mbu.include?(mbu) #Revisa si se mostró el diálogo antes
  185.     if defined?(EBUISTYLE);@scene.pbShowOpponent(0,true);else;@scene.pbShowOpponent(0);end #Muestra el entrenador
  186.     pbSEPlay(TEXTSE) if TEXTSE && TEXTSE!="" # Reproduce el SE
  187.     if text.is_a?(Array)
  188.         for i in text; pbDisplayPaused(fpBuffer(i)); end #Muestra el diálogo
  189.     else
  190.       pbDisplayPaused(fpBuffer(text)) #Muestra el diálogo
  191.     end
  192.     if defined?(EBUISTYLE);@scene.pbHideOpponent(true);else;@scene.pbHideOpponent();end #Oculta el entrenador
  193.     PBDebug.log("Díalogo Mostrado: #{text}")
  194.     @mbu.push(mbu) if mbu!="" #Añade el diálogo a la lista de los mostrados
  195.   end
  196.  
  197. #--------------------------------------------------------------------------------
  198. # Método que controla los buffers
  199. #--------------------------------------------------------------------------------
  200.  
  201.   def fpBuffer(str)
  202.     str.gsub!("\PN",$Trainer.name)
  203.     return str
  204.   end
  205.    
  206. #--------------------------------------------------------------------------------
  207. #Para el último Pokémon , los Pokémon específicos y los Pokémon Oscuros del jugador.
  208. #--------------------------------------------------------------------------------
  209.   def pbSendOut(index,pokemon)
  210.     pbSetSeen(pokemon)
  211.     @peer.pbOnEnteringBattle(self,pokemon)
  212.     if pbIsOpposing?(index)
  213.       @scene.pbTrainerSendOut(index,pokemon)
  214.       if (pbPokemonCount(@party2)>=2 || @tts["last"] == nil) && @tts["send"]
  215.         for i in 0...@tts["send"].length/2
  216.           name=pokemon.name
  217.           if isConst?(pokemon.species,PBSpecies,@tts["send"][i*2])
  218.             fpShowText("send","opp#{name}",@tts["send"][i*2+1])
  219.           end
  220.         end
  221.       end
  222.       pbBGMPlay(@tts["last_bgm"],100,100) if @tts["last_bgm"] && pbPokemonCount(@party2)==1
  223.       fpShowText("last") if pbPokemonCount(@party2)==1
  224.     else
  225.       @scene.pbSendOut(index,pokemon)
  226.       if pbPokemonCount(@party1)==1
  227.         if $Trainer.party.length>1
  228.           fpShowText("last(player)")
  229.         else
  230.           fpShowText("one_poke")
  231.         end
  232.       end
  233.         @battle.fpShowText("shadow(player)","shadow(player)") if pokemon.isShadow?
  234.     end
  235.     @scene.pbResetMoveIndex(index)
  236.   end
  237.  
  238. #--------------------------------------------------------------------------------
  239. #Para la Regresión Primigenia
  240. #--------------------------------------------------------------------------------
  241.   def pbPrimalReversion(index)
  242.     return if !@battlers[index] || !@battlers[index].pokemon
  243.     return if !(@battlers[index].hasPrimal? rescue false)
  244.     return if (@battlers[index].isPrimal? rescue true)
  245.     fpShowText("primal") if pbIsOpposing?(index)
  246.     if isConst?(@battlers[index].pokemon.species,PBSpecies,:KYOGRE)
  247.       pbCommonAnimation("PrimalKyogre",@battlers[index],nil)
  248.     elsif isConst?(@battlers[index].pokemon.species,PBSpecies,:GROUDON)
  249.       pbCommonAnimation("PrimalGroudon",@battlers[index],nil)
  250.     else
  251.       pbCommonAnimation("MegaEvolution",@battlers[index],nil)
  252.     end
  253.     @battlers[index].pokemon.makePrimal
  254.     @battlers[index].form=@battlers[index].pokemon.form
  255.     @battlers[index].pbUpdate(true)
  256.     @scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
  257.     if isConst?(@battlers[index].pokemon.species,PBSpecies,:KYOGRE)
  258.       pbCommonAnimation("PrimalKyogre2",@battlers[index],nil)
  259.     elsif isConst?(@battlers[index].pokemon.species,PBSpecies,:GROUDON)
  260.       pbCommonAnimation("PrimalGroudon2",@battlers[index],nil)
  261.     else
  262.       pbCommonAnimation("MegaEvolution2",@battlers[index],nil)
  263.     end
  264.     pbDisplay(_INTL("¡{1} ha esperimentado una Regresión Primigenia y ha recobrado su apariencia primitiva!",@battlers[index].pbThis))
  265.     fpShowText("primal(player)") if pbBelongsToPlayer?(index)
  266.     PBDebug.log("[Regresión Primigenia] #{@battlers[index].pbThis} ha recobrado su apariencia primitiva")
  267.   end
  268.  
  269. #--------------------------------------------------------------------------------
  270. #Para la Megaevolución
  271. #Código relacionado a la compatibilidad con la Megaevolución salvaje
  272. #--------------------------------------------------------------------------------
  273.   def pbMegaEvolve(index)
  274.     return if !@battlers[index] || !@battlers[index].pokemon
  275.     return if !(@battlers[index].hasMega? rescue false)
  276.     return if (@battlers[index].isMega? rescue true)
  277.     ownername=pbGetOwner(index).fullname if @opponent
  278.     ownername=pbGetOwner(index).name if pbBelongsToPlayer?(index)
  279.     if @opponent || !pbIsOpposing(index)
  280.       fpShowText("mega") if pbIsOpposing?(index)
  281.       case (@battlers[index].pokemon.megaMessage rescue 0)
  282.       when 1                                                           # Rayquaza
  283.         pbDisplay(_INTL("¡El ruego vehemente de {1} alcanza a {2}!",ownername,@battlers[index].pbThis))
  284.       else
  285.         pbDisplay(_INTL("¡La {2} de {1} está reaccionando al {4} de {3}!",
  286.            @battlers[index].pbThis,PBItems.getName(@battlers[index].item),
  287.            ownername,pbGetMegaRingName(index)))
  288.       end
  289.     else                                                            # Salvaje
  290.       pbDisplay(_INTL("¡{1} reacciona con una energía desconocida!",@battlers[index].pbThis))
  291.     end
  292.     pbCommonAnimation("MegaEvolution",@battlers[index],nil)
  293.     @battlers[index].pokemon.makeMega
  294.     @battlers[index].form=@battlers[index].pokemon.form
  295.     @battlers[index].pbUpdate(true)
  296.     @scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
  297.     pbCommonAnimation("MegaEvolution2",@battlers[index],nil)
  298.     meganame=(@battlers[index].pokemon.megaName rescue nil)
  299.     if !meganame || meganame==""
  300.       meganame=_INTL("Mega {1}",PBSpecies.getName(@battlers[index].pokemon.species))
  301.     end
  302.     pbDisplay(_INTL("¡{1} ha Mega Evolucionado en {2}!",@battlers[index].pbThis,meganame))
  303.     fpShowText("mega(player)") if pbBelongsToPlayer?(index)
  304.     PBDebug.log("[Mega Evolución] #{@battlers[index].pbThis} ha Mega Evolucionado")
  305.     side=(pbIsOpposing?(index)) ? 1 : 0
  306.     owner=pbGetOwnerIndex(index)
  307.     @megaEvolution[side][owner]=-2
  308.   end
  309.  
  310. #--------------------------------------------------------------------------------
  311. #Para la Ultraexplosión
  312. #--------------------------------------------------------------------------------
  313.   def pbUltraBurst(index)
  314.     return if !@battlers[index] || !@battlers[index].pokemon
  315.     return if !(@battlers[index].hasUltra? rescue false)
  316.     return if (@battlers[index].isUltra? rescue true)
  317.     @necrozmaVar = [@battlers[index].pokemonIndex,@battlers[index].form] if !pbBelongsToPlayer?(index)
  318.     fpShowText("ultra") if pbIsOpposing?(index)
  319.     pbDisplay(_INTL("¡{1} emite una luz cegadora!",@battlers[index].pbThis))    
  320.     pbCommonAnimation("UltraBurst",@battlers[index],nil)
  321.     @battlers[index].pokemon.makeUltra
  322.     @battlers[index].form=@battlers[index].pokemon.form
  323.     @battlers[index].pbUpdate(true)
  324.     @scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
  325.     pbCommonAnimation("UltraBurst2",@battlers[index],nil)
  326.     ultraname=(@battlers[index].pokemon.ultraName rescue nil)
  327.     if !ultraname || ultraname==""
  328.       ultraname=_INTL("Ultra {1}",PBSpecies.getName(@battlers[index].pokemon.species))
  329.     end
  330.     pbDisplay(_INTL("¡{1} ha adoptado una nueva forma gracias a la Ultraexplosión!",@battlers[index].pbThis))
  331.     fpShowText("ultra(player)") if pbBelongsToPlayer?(index)
  332.     PBDebug.log("[Ultra Burst] #{@battlers[index].pbThis} became #{ultraname}")
  333.     side=(pbIsOpposing?(index)) ? 1 : 0
  334.     owner=pbGetOwnerIndex(index)
  335.     @ultraBurst[side][owner]=-2
  336.   end
  337.    
  338. #--------------------------------------------------------------------------------
  339. #Para los movimientos Z
  340. #--------------------------------------------------------------------------------
  341.   def pbUseZMove(index,move,crystal)
  342.     return if !@battlers[index] || !@battlers[index].pokemon
  343.     return if !(@battlers[index].hasZMove? rescue false)
  344.     fpShowText("z_move") if pbIsOpposing?(index)
  345.     pbDisplay(_INTL("¡{1} se está cubriendo de Poder-Z!",@battlers[index].pbThis))
  346.     pbCommonAnimation("ZPower",@battlers[index],nil)
  347.     PokeBattle_ZMoves.new(self,@battlers[index],move,crystal)
  348.     fpShowText("z_move(player)") if pbBelongsToPlayer?(index)
  349.     side=(pbIsOpposing?(index)) ? 1 : 0
  350.     owner=pbGetOwnerIndex(index)
  351.     @zMove[side][owner]=-2
  352.   end
  353.  
  354. #--------------------------------------------------------------------------------
  355. # Para la Teracristalización
  356. #--------------------------------------------------------------------------------
  357.   def fpTeracristal(index)
  358.     teratype=@battlers[index].pokemon.teratype
  359.     return if !@battlers[index] || !@battlers[index].pokemon
  360.     pbDisplay(_INTL("¡{1} se está cubriendo de cristal!",@battlers[index].pbThis))
  361.     pbCommonAnimation("MegaEvolution",@battlers[index],nil)
  362.     fpShowText("tera") if pbIsOpposing?(index) && defined?(MBD_Data)
  363.     @battlers[index].effects[PBEffects::Type3]=-1
  364.     @battlers[index].pokemon.makeTera
  365.     @battlers[index].type1=teratype
  366.     @battlers[index].type2=teratype
  367.     fpShowText("tera(player)") if pbBelongsToPlayer?(index) && defined?(MBD_Data)
  368.     pbCommonAnimation("MegaEvolution2",@battlers[index],nil)
  369.     typename=PBTypes.getName(teratype)
  370.     pbDisplay(_INTL("¡{1} ha cambiado al tipo {2}!",@battlers[index].pbThis,typename))
  371.     PBDebug.log("[Teracristalización] #{@battlers[index].pbThis} ha Teracristalizado (#{typename})")
  372.     side=(pbIsOpposing?(index)) ? 1 : 0
  373.     owner=pbGetOwnerIndex(index)
  374.     @teraCristal[side][owner]=-2
  375.   end
  376.    
  377. #--------------------------------------------------------------------------------
  378. #Para el Dynamax
  379. #--------------------------------------------------------------------------------
  380.   def pbDynamax(index)
  381.     return if !@battlers[index] || !@battlers[index].pokemon
  382.     return if !(@battlers[index].hasDynamax? rescue false)
  383.     return if (@battlers[index].isDynamax? rescue true)
  384.     @battlers[index].effects[PBEffects::Dynamax]=3
  385.     @battlers[index].effects[PBEffects::DBoost]=true
  386.     fpShowText("dynamax") if pbIsOpposing?(index)
  387.     @scene.pbRecall(index)
  388.     # Checking Gigantamax
  389.     if @battlers[index].hasGigantamax?
  390.       @battlers[index].pokemon.makeGigantamax
  391.       @battlers[index].effects[PBEffects::Gigantamax]=3
  392.       @battlers[index].form=@battlers[index].pokemon.form
  393.       @scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
  394.     end
  395.     if pbBelongsToPlayer?(index) || @battlers[index].pbPartner && !pbIsOpposing?(index)
  396.       @scene.pbSendOut(index,@battlers[index].pokemon)
  397.     elsif pbIsOpposing?(index)
  398.       @scene.pbTrainerSendOut(index,@battlers[index].pokemon)
  399.     end
  400.     @battlers[index].pokemon.makeDynamax
  401.     @battlers[index].pbUpdate(true)
  402.     maxname=(@battlers[index].pokemon.maxName rescue nil)
  403.     if !maxname || maxname ==""
  404.       maxname = _INTL("{1}",PBSpecies.getName(@battlers[index].pokemon.species))
  405.     end
  406.     pbDisplay(_INTL("{1}'s ball surges with Dynamax energy!",@battlers[index].pbThis,text))
  407.     fpShowText("dynamax(player)") if pbBelongsToPlayer?(index)
  408.     PBDebug.log("[Dynamax] #{@battlers[index].pbThis} became Max #{maxname}")
  409.     side = (pbIsOpposing?(index)) ? 1 : 0
  410.     owner = pbGetOwnerIndex(index)
  411.     @dynaMax[side][owner]=-2
  412.     pbPlayCry(@battlers[index])
  413.   end
  414.  
  415. #--------------------------------------------------------------------------------
  416. # Para los objetos
  417. #--------------------------------------------------------------------------------
  418.   def pbEnemyUseItem(item,battler)
  419.     return 0 if !@internalbattle
  420.     items=pbGetOwnerItems(battler.index)
  421.     return if !items
  422.     opponent=pbGetOwner(battler.index)
  423.     for i in 0...items.length
  424.       if items[i]==item
  425.         items.delete_at(i)
  426.         break
  427.       end
  428.     end
  429.     fpShowText("item","item")
  430.     itemname=PBItems.getName(item)
  431.     pbDisplayBrief(_INTL("¡{1} ha usado\r\n{2}!",opponent.fullname,itemname))
  432.     PBDebug.log("[Objeto usado] El rival ha usado #{itemname} en #{battler.pbThis(true)}")
  433.     if isConst?(item,PBItems,:POTION)
  434.       battler.pbRecoverHP(20,true)
  435.       pbDisplay(_INTL("Los PS de {1} fueron restaurados.",battler.pbThis))
  436.     elsif isConst?(item,PBItems,:SUPERPOTION)
  437.       battler.pbRecoverHP(50,true)
  438.       pbDisplay(_INTL("Los PS de {1} fueron restaurados.",battler.pbThis))
  439.     elsif isConst?(item,PBItems,:HYPERPOTION)
  440.       battler.pbRecoverHP(200,true)
  441.       pbDisplay(_INTL("Los PS de {1} fueron restaurados.",battler.pbThis))
  442.     elsif isConst?(item,PBItems,:MAXPOTION)
  443.       battler.pbRecoverHP(battler.totalhp-battler.hp,true)
  444.       pbDisplay(_INTL("Los PS de {1} fueron restaurados.",battler.pbThis))
  445.     elsif isConst?(item,PBItems,:FULLRESTORE)
  446.       fullhp=(battler.hp==battler.totalhp)
  447.       battler.pbRecoverHP(battler.totalhp-battler.hp,true)
  448.       battler.status=0; battler.statusCount=0
  449.       battler.effects[PBEffects::Confusion]=0
  450.       if fullhp
  451.         pbDisplay(_INTL("¡{1} se puso saludable!",battler.pbThis))
  452.       else
  453.         pbDisplay(_INTL("Los PS de {1} fueron restaurados.",battler.pbThis))
  454.       end
  455.     elsif isConst?(item,PBItems,:FULLHEAL)
  456.       battler.status=0; battler.statusCount=0
  457.       battler.effects[PBEffects::Confusion]=0
  458.       pbDisplay(_INTL("¡{1} se puso saludable!",battler.pbThis))
  459.     elsif isConst?(item,PBItems,:XATTACK)
  460.       if battler.pbCanIncreaseStatStage?(PBStats::ATTACK,battler)
  461.         battler.pbIncreaseStat(PBStats::ATTACK,1,battler,true)
  462.       end
  463.     elsif isConst?(item,PBItems,:XDEFEND)
  464.       if battler.pbCanIncreaseStatStage?(PBStats::DEFENSE,battler)
  465.         battler.pbIncreaseStat(PBStats::DEFENSE,1,battler,true)
  466.       end
  467.     elsif isConst?(item,PBItems,:XSPEED)
  468.       if battler.pbCanIncreaseStatStage?(PBStats::SPEED,battler)
  469.         battler.pbIncreaseStat(PBStats::SPEED,1,battler,true)
  470.       end
  471.     elsif isConst?(item,PBItems,:XSPECIAL)
  472.       if battler.pbCanIncreaseStatStage?(PBStats::SPATK,battler)
  473.         battler.pbIncreaseStat(PBStats::SPATK,1,battler,true)
  474.       end
  475.     elsif isConst?(item,PBItems,:XSPDEF)
  476.       if battler.pbCanIncreaseStatStage?(PBStats::SPDEF,battler)
  477.         battler.pbIncreaseStat(PBStats::SPDEF,1,battler,true)
  478.       end
  479.     elsif isConst?(item,PBItems,:XACCURACY)
  480.       if battler.pbCanIncreaseStatStage?(PBStats::ACCURACY,battler)
  481.         battler.pbIncreaseStat(PBStats::ACCURACY,1,battler,true)
  482.       end
  483.     end
  484.   end
  485.  
  486. #--------------------------------------------------------------------------------
  487. # Para los finales de turno y pocos PS en el último Pokémon
  488. #--------------------------------------------------------------------------------
  489.   alias pbEndOfRoundPhase_fp pbEndOfRoundPhase
  490.   def pbEndOfRoundPhase
  491.       fpShowText("lowhp_last","lowhp_last") if pbPokemonCount(@party2)==1 && @battlers[1].totalhp/2 >= @battlers[1].hp && !@battlers[1].isFainted?
  492.       if @tts["end_turn"]
  493.         for i in 0...@tts["end_turn"].length/2
  494.           if @turncount==@tts["end_turn"][i*2]
  495.             fpShowText("end_turn","end#{@turncount}",@tts["end_turn"][i*2+1])
  496.           end
  497.         end
  498.       end
  499.     pbEndOfRoundPhase_fp
  500.   end
  501.  
  502. #--------------------------------------------------------------------------------
  503. # Para los inicios de turno
  504. #--------------------------------------------------------------------------------
  505.   alias pbAttackPhase_fp pbAttackPhase
  506.   def pbAttackPhase
  507.       if @tts["start_turn"]
  508.         for i in 0...@tts["start_turn"].length/2
  509.           if @turncount==@tts["start_turn"][i*2]
  510.             fpShowText("start_turn","start#{@turncount}",@tts["start_turn"][i*2+1])
  511.           end
  512.         end
  513.       end
  514.     pbAttackPhase_fp
  515.   end
  516. end
  517.  
  518. #--------------------------------------------------------------------------------
  519. # Para los golpes Super-Efectivos, Poco-Efectivos y Críticos
  520. #--------------------------------------------------------------------------------
  521. class PokeBattle_Move
  522.   def pbEffectMessages(attacker,opponent,ignoretype=false,alltargets=nil)
  523.     if opponent.damagestate.critical
  524.       if alltargets && alltargets.length>1
  525.         @battle.pbDisplay(_INTL("¡Es un golpe crítico en {1}!",opponent.pbThis(true)))
  526.       else
  527.         @battle.pbDisplay(_INTL("¡Es un golpe crítico!"))
  528.       end
  529.       @battle.fpShowText("critical_move","critical_move") if @battle.pbIsOpposing?(attacker.index)
  530.       @battle.fpShowText("critical_move(player)","critical_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  531.     end
  532.     if !pbIsMultiHit && attacker.effects[PBEffects::ParentalBond]==0
  533.       if opponent.damagestate.typemod>8
  534.         if alltargets && alltargets.length>1
  535.           @battle.pbDisplay(_INTL("¡Es super efectivo en {1}!",opponent.pbThis(true)))
  536.         else
  537.           @battle.pbDisplay(_INTL("¡Es super efectivo!"))
  538.         end
  539.         @battle.fpShowText("super_effective_move","super_effective_move") if @battle.pbIsOpposing?(attacker.index)
  540.         @battle.fpShowText("super_effective_move(player)","super_effective_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  541.       elsif opponent.damagestate.typemod>=1 && opponent.damagestate.typemod<8
  542.         if alltargets && alltargets.length>1
  543.           @battle.pbDisplay(_INTL("No es muy efectivo en {1}...",opponent.pbThis(true)))
  544.         else
  545.           @battle.pbDisplay(_INTL("No es muy efectivo..."))
  546.         end
  547.         @battle.fpShowText("low_effective_move","low_effective_move") if @battle.pbIsOpposing?(attacker.index)
  548.         @battle.fpShowText("low_effective_move(player)","low_effective_move(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  549.       end
  550.     end
  551.     if opponent.damagestate.endured
  552.       @battle.pbDisplay(_INTL("¡{1} aguantó el golpe!",opponent.pbThis))
  553.     elsif opponent.damagestate.sturdy
  554.       @battle.pbDisplay(_INTL("¡{1} resistió con Robustez!",opponent.pbThis))
  555.     elsif opponent.damagestate.focussash
  556.       @battle.pbDisplay(_INTL("¡{1} resistió usando Banda Focus!",opponent.pbThis))
  557.       opponent.pbConsumeItem
  558.     elsif opponent.damagestate.focusband
  559.       @battle.pbDisplay(_INTL("¡{1} resistió usando Cinta Focus!",opponent.pbThis))
  560.     end
  561.   end
  562. end
  563.  
  564. #--------------------------------------------------------------------------------
  565. # Para los Pokémon Shiny y Oscuros
  566. #--------------------------------------------------------------------------------
  567. class PokeBattle_Scene
  568.   alias pbCommonAnimation_fp pbCommonAnimation
  569.   def pbCommonAnimation(*args)
  570.     pbCommonAnimation_fp(*args)
  571.     name=args[0] ; attacker=args[1]
  572.     case name
  573.     when "Shadow"
  574.       @battle.fpShowText("shadow","shadow")
  575.     when "Shiny"
  576.       @battle.fpShowText("shiny","shiny") if @battle.pbIsOpposing?(attacker.index)
  577.       @battle.fpShowText("shiny(player)","shiny(player)") if @battle.pbBelongsToPlayer?(attacker.index)
  578.     end
  579.   end
  580. end
  581.  
  582. #--------------------------------------------------------------------------------
  583. #Para los Pokémon Oscuros capturados
  584. #--------------------------------------------------------------------------------
  585. module PokeBattle_BattleCommon
  586.   alias pbStorePokemon_fp pbStorePokemon
  587.   def pbStorePokemon(poke)
  588.     fpShowText("caught","shadowcaught") if poke.isShadow?
  589.     pbStorePokemon_fp(poke)
  590.   end
  591. end
  592.  
  593. #--------------------------------------------------------------------------------
  594. # Método que setea los textos
  595. #--------------------------------------------------------------------------------
  596. def fpTTS_set(param)
  597.     if param.is_a?(Symbol)
  598.         if hasConst?(MBD_Data,param)
  599.             $tts=getConst(MBD_Data,param)
  600.         else
  601.             raise "Constante de Diálogos no definida."
  602.         end
  603.     elsif param.is_a?(Hash)
  604.         $tts=param
  605.     else
  606.         raise "Parámetro incorrecto, se esperaba un Hash o Symbol."
  607.     end
  608. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement