Advertisement
Guest User

Pokemon_Battle_Trainer

a guest
Jan 8th, 2016
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 23.30 KB | None | 0 0
  1. #==============================================================================
  2. # ■ Pokemon_Battle_Trainer
  3. # Pokemon Script Project - Krosk
  4. # 29/09/07
  5. #-----------------------------------------------------------------------------
  6. # Corrigé par RhenaudTheLukark
  7. #-----------------------------------------------------------------------------
  8. # Scène à ne pas modifier de préférence
  9. #-----------------------------------------------------------------------------
  10. # Système de Combat - Pokémon Dresseur
  11. #-----------------------------------------------------------------------------
  12.  
  13. #-----------------------------------------------------------------------------
  14. # 0: Normal, 1: Poison, 2: Paralysé, 3: Brulé, 4:Sommeil, 5:Gelé, 8: Toxic
  15. # @confuse (6), @flinch (7)
  16. #-----------------------------------------------------------------------------
  17. # 1 Normal  2 Feu  3 Eau 4 Electrique 5 Plante 6 Glace 7 Combat 8 Poison 9 Sol
  18. # 10 Vol 11 Psy 12 Insecte 13 Roche 14 Spectre 15 Dragon 16 Acier 17 Tenebres
  19. #-----------------------------------------------------------------------------
  20.  
  21. #-----------------------------------------------------------------------------
  22. # $battle_var.action_id
  23. #   0 : Phase de Sélection
  24. #   1 : Sélection Item
  25. #   2 : Switch Pokémon
  26. #   4 : Switch Fin de Tour
  27. #-----------------------------------------------------------------------------
  28.  
  29. module POKEMON_S
  30.   #------------------------------------------------------------  
  31.   # Pokemon_Battle_Trainer
  32.   #   scene
  33.   #------------------------------------------------------------  
  34.   class Pokemon_Battle_Trainer < Pokemon_Battle_Core
  35.     attr_accessor :z_level
  36.     attr_accessor :actor_status
  37.     attr_accessor :actor
  38.     #------------------------------------------------------------  
  39.     # Fonction d'initialisation
  40.     # Appel: $scene = Pokemon_Battle_Trainer.new(
  41.     #           party, trainer_id, ia)
  42.     #     party: $pokemon_party (classe Pokemon_Party)
  43.     #     trainer_id: L'ID du dresseur dans $data_trainer (groupe de monstres)
  44.     #     ia: Fausse AI
  45.     #     run_able: possible de fuir
  46.     #------------------------------------------------------------
  47.     def initialize(party, trainer_id, ia = false, run_able = false, lose_able = false, capturable = false)
  48.       @z_level = 0
  49.       @ia = ia
  50.       @trainer_id = trainer_id
  51.       @run = run_able
  52.       @lose = lose_able
  53.       @capture = capturable
  54.      
  55.       $battle_var.reset
  56.      
  57.       # Création données des Pokémons adverses
  58.       #$battle_var.enemy_party = Pokemon_Party.new
  59.       for pokemon_data in Trainer_Info.pokemon_list(@trainer_id)
  60.         id = pokemon_data[0]
  61.         level = pokemon_data[1]
  62.         # Shiny
  63.         if pokemon_data[6] != nil
  64.           shiny = pokemon_data[6]
  65.         else
  66.           shiny = false
  67.         end
  68.         pokemon = Pokemon.new(id, level, shiny)
  69.         pokemon.given_name += " ennemi"
  70.         # Paramètres optionnels
  71.         # Objet
  72.         if pokemon_data[2] != nil
  73.           pokemon.item_hold = Item.id(pokemon_data[2])
  74.         end
  75.         # Moveset
  76.         if pokemon_data[4] != nil
  77.           i = 0
  78.           for skill in pokemon_data[4]
  79.             if skill != nil and skill != "AUCUN"
  80.               pokemon.skills_set[i] = Skill.new(Skill_Info.id(skill))
  81.             end
  82.             if skill == "AUCUN"
  83.               pokemon.skills_set[i] = nil
  84.             end
  85.             i += 1
  86.           end
  87.           pokemon.skills_set.compact!
  88.         end
  89.         # Stats avancées
  90.         if pokemon_data[3] != nil and pokemon_data[3].length == 6
  91.           pokemon.dv_modifier(pokemon_data[3])
  92.         end
  93.         # Genre
  94.         if pokemon_data[5] != nil
  95.           pokemon.set_gender(pokemon_data[5])
  96.         end
  97.         # Forme
  98.         if pokemon_data[6] != nil
  99.           pokemon.form = pokemon_data[6]
  100.         end
  101.         $battle_var.enemy_party.actors.push(pokemon)
  102.       end
  103.       @enemy = $battle_var.enemy_party.actors[0]
  104.       $battle_var.enemy_battle_order = [0,1,2,3,4,5]
  105.      
  106.       @party = party
  107.      
  108.       # Mise à jour Pokedex: Pokémon vu
  109.       $data_pokedex[@enemy.id][0] = true
  110.      
  111.       # Génération ordre de combat
  112.       @battle_order = Array.new(@party.size)
  113.       @battle_order.fill {|i| i}
  114.      
  115.       # Désignation 1er Pokémon au combat
  116.       # @actor désigne le (class) Pokémon
  117.       actor_index = 0
  118.       @actor = @party.actors[actor_index]
  119.       if @actor == nil
  120.         print("Attention, vous n'avez pas de Pokémon dans votre équipe! Réglez ce bug.")
  121.       end
  122.       while @actor.dead?
  123.         actor_index += 1
  124.         @actor = @party.actors[actor_index]
  125.       end
  126.      
  127.       # Correction ordre combat (Pokémon vivant en premier)
  128.       @battle_order = switch(@battle_order, 0, actor_index)
  129.      
  130.       # Remise à zéro résultat
  131.       $battle_var.result_flee = false
  132.       $battle_var.result_win = false
  133.       $battle_var.result_defeat = false
  134.      
  135.       # Initialisation des variables de combat
  136.       @phase = 0
  137.       # 0 Non décidé, 1 Attaque, 2 Switch, 3 Item, 4 Fuite
  138.       @actor_action = 0
  139.       @enemy_action = 0
  140.      
  141.       @start_actor_battler = Player.battler #$trainer_battler
  142.       @start_enemy_battler = Trainer_Info.battler(@trainer_id)
  143.      
  144.       $battle_var.have_fought.push(@actor.party_index)
  145.       $battle_var.battle_order = @battle_order
  146.       $battle_var.in_battle = true
  147.      
  148.       @actor.reset_stat_stage
  149.       @enemy.reset_stat_stage
  150.       @actor.skill_effect_reset
  151.       @enemy.skill_effect_reset
  152.       @actor_skill = nil
  153.       @enemy_skill = nil
  154.       @actor.ability_active = false
  155.       @enemy.ability_active = false
  156.       @item_id = 0   # item utilisé
  157.     end
  158.  
  159.        
  160.     #------------------------------------------------------------  
  161.     # Animations pré-combat
  162.     #------------------------------------------------------------  
  163.     def pre_battle_transition
  164.       # Jingle et BGM
  165.       #Audio.bgm_play("Audio/BGM/PkmRS-Battle3.mid")
  166.       $game_system.bgm_play($game_system.battle_bgm, 80)
  167.       Audio.me_play("Audio/ME/battle_jingle.mid", 80)
  168.       Graphics.freeze
  169.      
  170.       # Sélection transition
  171.       s = (rand(BATTLE_TRANS)+1).to_s
  172.       @background.bitmap = RPG::Cache.picture("black.png")
  173.       Graphics.transition(100, "Graphics/Transitions/battle"+ s +".png")
  174.       Audio.me_stop
  175.      
  176.       # Dessin
  177.       Graphics.freeze
  178.       @background.bitmap = RPG::Cache.battleback(@battleback_name)
  179.       @message_background.bitmap = RPG::Cache.battleback(BATTLE_MSG)
  180.       @enemy_sprite.bitmap = RPG::Cache.battler(@start_enemy_battler, 0)
  181.       @enemy_sprite.ox = @enemy_sprite.bitmap.width / 2
  182.       @enemy_sprite.oy = @enemy_sprite.bitmap.height * 2 / 3
  183.       @enemy_sprite.x -= 782
  184.       @enemy_ground.bitmap = RPG::Cache.battleback(@ground_name)
  185.       @enemy_ground.ox = @enemy_ground.bitmap.width / 2
  186.       @enemy_ground.oy = @enemy_ground.bitmap.height / 2
  187.       @enemy_ground.zoom_x = @enemy_ground.zoom_y = 2.0/3
  188.       @enemy_ground.x -= 782
  189.       @actor_ground.bitmap = RPG::Cache.battleback(@ground_name)
  190.       @actor_ground.ox = @actor_ground.bitmap.width / 2
  191.       @actor_ground.oy = @actor_ground.bitmap.height
  192.       @actor_ground.x += 782
  193.       @actor_sprite.bitmap = RPG::Cache.battler(@start_actor_battler, 0)
  194.       @actor_sprite.ox = @actor_sprite.bitmap.width / 2
  195.       @actor_sprite.oy = @actor_sprite.bitmap.height
  196.       @actor_sprite.x += 782
  197.       Graphics.transition(50, "Graphics/Transitions/battle0.png")
  198.     end
  199.    
  200.     def pre_battle_animation
  201.       # Glissement des sprites
  202.       loop do
  203.         @enemy_sprite.x += 17
  204.         @enemy_ground.x += 17
  205.         @actor_sprite.x -= 17
  206.         @actor_ground.x -= 17
  207.         Graphics.update
  208.         if @enemy_sprite.x == 464
  209.           break
  210.         end
  211.       end
  212.      
  213.       # Confrontation des joueurs avec affichage des balls
  214.       draw_text("Un combat est lancé", "par "+ Trainer_Info.string(@trainer_id) + "!")
  215.       @actor_party_status.reset_position
  216.       @enemy_party_status.reset_position
  217.       @actor_party_status.visible = true
  218.       @enemy_party_status.visible = true
  219.       @actor_party_status.active = true
  220.       @enemy_party_status.active = true
  221.       @actor_party_status.x += 400
  222.       @enemy_party_status.x -= 400
  223.       Graphics.update
  224.      
  225.       loop do
  226.         @actor_party_status.x -= 20
  227.         @enemy_party_status.x += 20
  228.         Graphics.update
  229.         if @actor_party_status.x <= 309
  230.           @actor_party_status.reset_position
  231.           @enemy_party_status.reset_position
  232.           break
  233.         end
  234.       end
  235.       wait_hit
  236.      
  237.       # Dégagement sprite dresseur
  238.       loop do
  239.         @enemy_sprite.x += 10
  240.         @enemy_party_status.x -= 20
  241.         Graphics.update
  242.         if @enemy_sprite.x >= 723
  243.           @enemy_party_status.visible = false
  244.           @enemy_party_status.reset_position
  245.           @enemy_sprite.oy = @enemy_sprite.bitmap.height / 2
  246.           break
  247.         end
  248.       end
  249.      
  250.       @enemy_sprite.bitmap = RPG::Cache.battler(@enemy.battler_face, 0)
  251.  
  252.       # Envoi sprite
  253.       launch_enemy_pokemon
  254.      
  255.       # Attente appui de touche
  256.       wait(40)
  257.      
  258.       # Dégagement du sprite dresseur
  259.       @actor_party_status.reset_position
  260.       loop do
  261.         @actor_sprite.x -= 10
  262.         @actor_party_status.x += 20
  263.         Graphics.update
  264.         if @actor_sprite.x <= -200
  265.           @actor_sprite.bitmap = RPG::Cache.battler(@actor.battler_back, 0)
  266.           @actor_party_status.reset_position
  267.           @actor_party_status.visible = false
  268.           break
  269.         end
  270.       end
  271.      
  272.       # Envoi du pokémon (animation)
  273.       launch_pokemon
  274.      
  275.       @text_window.contents.clear
  276.       Graphics.update
  277.     end
  278.    
  279.     #------------------------------------------------------------  
  280.     # Déroulement
  281.     #------------------------------------------------------------
  282.     def enemy_skill_decision
  283.       action = true
  284.       # ------- ---------- --------- --------
  285.       #    Saut de phase de sélection (ennemi)
  286.       #   action = false  : saut
  287.       #   action = true   : pas de saut
  288.       # ------- ---------- --------- --------
  289.       action = phase_jump(true)
  290.      
  291.       @enemy_action = 1
  292.      
  293.       # Décision skill ennemi
  294.       if not(@actor.dead?) and action
  295.         list = []
  296.         for i in 0..@enemy.skills_set.size - 1
  297.           list.push(i)
  298.         end
  299.         list.shuffle!
  300.         # Skill sans PP // Lutte
  301.         @enemy_skill = Skill.new(165)
  302.         # ----------
  303.         for i in list
  304.           if @enemy.skills_set[i].usable?
  305.             @enemy_skill = @enemy.skills_set[i]
  306.           end
  307.         end
  308.       end
  309.      
  310.      
  311.       # Trainer IA
  312.       if @ia and not(@actor.dead?) and action
  313.         # Skill sans PP // Lutte
  314.         @enemy_skill = Skill.new(165)
  315.        
  316.         rate_list = {}
  317.         i = 0
  318.         for skill in @enemy.skills_set
  319.           if skill.usable?
  320.             rate_list[i] = ia_rate_calculation(skill, @enemy, @actor)
  321.           else
  322.             rate_list[i] = 0
  323.           end
  324.           i += 1
  325.         end
  326.        
  327.         # Tri dans l'ordre decroissant de valeur
  328.         sorted_list = rate_list.sort {|a,b| b[1]<=>a[1]}
  329.        
  330.         #for element in sorted_list
  331.         #  print(@enemy.skills_set[element[0]].name)
  332.         #  print(element[1])
  333.         #end
  334.        
  335.         # Decision prioritaire: max dégat ou soin
  336.         # Valeur seuil: 200
  337.         # si une attaque/défense dépasse ce seuil, il est choisi
  338.         if sorted_list[0][1] > 200
  339.           @enemy_skill = @enemy.skills_set[sorted_list[0][0]]
  340.         else
  341.           # Decision par pallier
  342.           i = rand(100)
  343.           # Taux de decision
  344.           taux = [100, 25, 5, 0]
  345.           for a in 0..3
  346.             if i <= taux[a] and sorted_list[a] != nil and sorted_list[a][1] != 0
  347.               @enemy_skill = @enemy.skills_set[sorted_list[a][0]]
  348.             end
  349.           end
  350.         end
  351.       end
  352.      
  353.       if not(action) # Reprise du skill précédent
  354.         @enemy_skill = $battle_var.enemy_last_used
  355.       end
  356.     end
  357.     #------------------------------------------------------------  
  358.     # Rounds
  359.     #------------------------------------------------------------                
  360.     def end_battle_check
  361.       @actor_status.refresh
  362.       @enemy_status.refresh
  363.       if $battle_var.enemy_party.dead? and not(@party.dead?)
  364.         end_battle_victory
  365.       elsif @enemy.dead? and not($battle_var.enemy_party.dead?)
  366.         exp_battle
  367.        
  368.         dead_counter = 0
  369.         $battle_var.enemy_party.actors.each do |e|
  370.           dead_counter += 1 if e.dead?
  371.         end
  372.        
  373.         index = $battle_var.enemy_party.actors.index(@enemy)
  374.         @enemy_switch_id = index+1
  375.         name = $battle_var.enemy_party.actors[index+1].name
  376.         draw_text(name + " va être envoyé", "par " + Trainer_Info.string(@trainer_id) + ".")
  377.        
  378.         if @enemy_party_status.active
  379.           @enemy_party_status.reset_position
  380.           @enemy_party_status.visible = true
  381.           @enemy_party_status.x -= 400
  382.           until @enemy_party_status.x == -16
  383.             @enemy_party_status.x += 20
  384.             Graphics.update
  385.           end
  386.         end
  387.        
  388.         alive = 0
  389.         for pokemon in @party.actors
  390.           if not pokemon.dead?
  391.             alive += 1
  392.           end
  393.         end
  394.        
  395.         wait_hit
  396.         if alive > 1
  397.           draw_text("Voulez-vous appeler", "un autre Pokémon?")
  398.           decision = false
  399.           if draw_choice
  400.             $battle_var.window_index = @action_window.index
  401.             scene = Pokemon_Party_Menu.new(0)
  402.             scene.main
  403.             return_data = scene.return_data
  404.             decision = true
  405.             Graphics.transition
  406.           end
  407.        
  408.           # Switch de Pokémon
  409.           if ($battle_var.action_id == 4 or $battle_var.action_id == 6) and decision
  410.             @switch_id = return_data
  411.             actor_pokemon_switch
  412.           end
  413.         end
  414.        
  415.         if @enemy_party_status.active
  416.           until @enemy_party_status.x == -416
  417.             @enemy_party_status.x -= 20
  418.             Graphics.update
  419.           end
  420.           @enemy_party_status.visible = false
  421.           @enemy_party_status.reset_position
  422.         end
  423.        
  424.         # Switch enemy
  425.         enemy_pokemon_switch
  426.       end
  427.       if @actor.dead?
  428.         if @party.dead?
  429.           end_battle_defeat
  430.         else
  431.           # Switch forcé
  432.           $battle_var.window_index = @action_window.index
  433.           scene = Pokemon_Party_Menu.new(0)
  434.           scene.main
  435.           return_data = scene.return_data
  436.           # Switch de Pokémon
  437.           if $battle_var.action_id == 4 or $battle_var.action_id == 6
  438.             @switch_id = return_data
  439.             actor_pokemon_switch
  440.           end
  441.         end
  442.       end
  443.     end
  444.    
  445.    
  446.     #------------------------------------------------------------  
  447.     # Items
  448.     #------------------------------------------------------------    
  449.     def actor_item_use # items à utiliser
  450.       # Item déjà utilisé ie remplacé par 0
  451.       if @item_id == 0
  452.         return
  453.       end
  454.       if Item.data(@item_id)["flee"] != nil
  455.         end_battle_flee
  456.         return
  457.       end
  458.       if Item.data(@item_id)["ball"] != nil
  459.         ball_data = Item.data(@item_id)["ball"]
  460.         catch_pokemon(ball_data)
  461.       end
  462.     end
  463.    
  464.  
  465.     #------------------------------------------------------------  
  466.     # Lancer de pokéball
  467.     #------------------------------------------------------------        
  468.     def catch_pokemon(ball_data)
  469.       # Initialisation des données
  470.       ball_name = ball_data[0]
  471.       ball_rate = ball_data[1]
  472.       ball_sprite = ball_data[2]
  473.       ball_open_sprite = ball_data[3]
  474.       ball_color = ball_data[4]
  475.      
  476.       # Procédure / Animation
  477.       # Lancer
  478.       draw_text(Player.name + " utilise", ball_name + "!")
  479.       @ball_sprite = Sprite.new
  480.       @ball_sprite.bitmap = RPG::Cache.picture(ball_sprite)
  481.       @ball_sprite.x = -25
  482.       @ball_sprite.y = 270
  483.       @ball_sprite.z = @z_level + 16
  484.       t = 0.0
  485.       pi = Math::PI
  486.       loop do
  487.         t += 16
  488.         @ball_sprite.y = (270.0 - 230.0 * Math.sin(2 * pi / 3.0 * t / 445.0)).to_i
  489.         @ball_sprite.x = -15 + t
  490.         Graphics.update
  491.         if @ball_sprite.x >= 445
  492.           break
  493.         end
  494.       end
  495.      
  496.       Graphics.update
  497.       # Rejet
  498.       draw_text(Trainer_Info.string(@trainer_id) + " dévie", "la " + ball_name + "!")
  499.       Audio.se_stop
  500.       Audio.se_play("Audio/SE/Pokeopenbreak.wav")
  501.      
  502.       t = 0
  503.       loop do
  504.         t += 1
  505.         @ball_sprite.x -= -20
  506.         @ball_sprite.y += t
  507.         Graphics.update
  508.         if t == 10
  509.           @ball_sprite.dispose
  510.           break
  511.         end
  512.       end
  513.      
  514.       wait(40)
  515.      
  516.       return false
  517.     end
  518.    
  519.     #------------------------------------------------------------  
  520.     # Fuite
  521.     #------------------------------------------------------------          
  522.     def run_able?(runner, opponent)
  523.       if @run
  524.         return super
  525.       end
  526.       return false
  527.     end
  528.    
  529.     def flee_able(actor, enemy)
  530.       if @run
  531.         return super
  532.       end
  533.       @action_window.visible = true
  534.       return false
  535.     end
  536.    
  537.     def end_battle_flee(expulsion = false)
  538.       if @run
  539.         return super
  540.       end
  541.       draw_text("On ne s'enfuit pas", "d'un combat de dresseurs!")
  542.       wait_hit
  543.     end
  544.    
  545.     def end_battle_flee_enemy(expulsion = false)
  546.       if @run
  547.         return super
  548.       end
  549.       draw_text("On ne s'enfuit pas", "d'un combat de dresseurs!")
  550.       wait_hit
  551.     end
  552.    
  553.     #------------------------------------------------------------  
  554.     # Exp en cours de combat
  555.     #------------------------------------------------------------      
  556.     def exp_battle
  557.       @actor_status.z = @z_level + 15
  558.      
  559.       # Réduction de liste
  560.       $battle_var.have_fought.uniq!
  561.       for index in $battle_var.have_fought
  562.         actor = $pokemon_party.actors[index]
  563.         if actor.dead?
  564.           $battle_var.have_fought.delete(index)
  565.         end
  566.       end
  567.       number = $battle_var.have_fought.length
  568.      
  569.       @enemy.skill_effect_reset
  570.       @enemy.reset_stat_stage
  571.       if @evolve_checklist == nil
  572.         @evolve_checklist = []
  573.       end
  574.       if @money_rate == nil
  575.         @money_rate = 1
  576.       end
  577.      
  578.       # Recherche de paramètres
  579.       type = 1.3
  580.       exp_share_number = 0
  581.       for pokemon in $pokemon_party.actors
  582.         if not(pokemon.dead?) and Item.data(pokemon.item_hold)["expshare"]
  583.           exp_share_number += 1
  584.         end
  585.       end
  586.      
  587.       for actor in $pokemon_party.actors
  588.         if actor.dead?
  589.           next
  590.         end
  591.        
  592.         amount = nil
  593.         if $battle_var.have_fought.include?(actor.party_index)
  594.           amount = actor.exp_calculation(@enemy.battle_list, @enemy.level, number, type, exp_share_number)
  595.           # Tag objet
  596.           if Item.data(actor.item_hold)["amuletcoin"]
  597.             @money_rate = 2
  598.           end
  599.         end
  600.        
  601.         if Item.data(actor.item_hold)["expshare"] and
  602.             not($battle_var.have_fought.include?(actor.party_index)) and not(actor.dead?)
  603.           amount = actor.exp_calculation(@enemy.battle_list, @enemy.level, number, type, exp_share_number, 0)
  604.         end
  605.        
  606.         if amount != nil
  607.           actor.skill_effect_reset
  608.           actor.reset_stat_stage
  609.           actor.add_bonus(@enemy.battle_list)
  610.           draw_text(actor.given_name + " a gagné", amount.to_s + " points d'expérience!")
  611.           Graphics.update
  612.           wait_hit
  613.        
  614.           for i in 1..amount
  615.             actor.add_exp_battle(1)
  616.             if actor.level_check
  617.               actor.level_up(self)
  618.               if not(@evolve_checklist.include?(actor))
  619.                 @evolve_checklist.push(actor)
  620.               end
  621.             end
  622.             if actor == @actor
  623.               if @actor.exp_list[@actor.level+1] != nil and @actor.level < MAX_LEVEL
  624.                 divide = (@actor.exp_list[@actor.level+1]-@actor.exp_list[@actor.level])/192
  625.                 if divide == 0
  626.                   divide = 1
  627.                 end
  628.                 if (@actor.exp - @actor.exp_list[@actor.level])%divide == 0
  629.                   @actor_status.exp_refresh
  630.                   Graphics.update
  631.                 end
  632.               end
  633.             end
  634.           end
  635.         end
  636.       end
  637.      
  638.       @actor_status.refresh
  639.       Graphics.update
  640.      
  641.       # Reset have_fought
  642.       $battle_var.have_fought = [@actor.party_index]
  643.      
  644.     end
  645.    
  646.     #------------------------------------------------------------  
  647.     # Fin de combat
  648.     #------------------------------------------------------------      
  649.     def end_battle_victory
  650.       #Audio.bgm_fade(800)
  651.       exp_battle
  652.      
  653.       $battle_var.result_win = true
  654.       Audio.me_play("Audio/ME/fainted_jingle.mid")
  655.       #Audio.me_play("Audio/ME/trainer_jingle.mid")
  656.       Audio.bgm_play("Audio/BGM/PkmRS_Victory2.mid")
  657.      
  658.      
  659.       draw_text("Vous avez battu", Trainer_Info.string(@trainer_id) + "!")
  660.      
  661.       @enemy_sprite.opacity = 255
  662.       @enemy_sprite.zoom_x = 1
  663.       @enemy_sprite.zoom_y = 1
  664.       @enemy_sprite.visible = true
  665.       @enemy_sprite.bitmap = RPG::Cache.battler(@start_enemy_battler, 0)
  666.       @enemy_sprite.ox = @enemy_sprite.bitmap.width / 2
  667.       @enemy_sprite.oy = @enemy_sprite.bitmap.height / 2 - 25
  668.       @enemy_sprite.x = 723
  669.       @enemy_sprite.y -= @enemy_sprite.bitmap.height / 2 + 25
  670.       loop do
  671.         @enemy_sprite.x -= 10
  672.         Graphics.update
  673.         if @enemy_sprite.x <= 464
  674.           break
  675.         end
  676.       end
  677.       wait_hit
  678.      
  679.      
  680.       list_string = Trainer_Info.string_victory(@trainer_id)
  681.       draw_text(list_string)
  682.       wait_hit
  683.      
  684.      
  685.       $battle_var.money = Trainer_Info.money(@trainer_id)
  686.       draw_text(Player.name + " remporte " + ($battle_var.money).to_s + "$!")
  687.       $pokemon_party.add_money($battle_var.money)
  688.       wait(40)
  689.      
  690.       if $battle_var.money_payday > 0
  691.         draw_text(Player.name + " gagne " + ($battle_var.money_payday).to_s + "$",  "grâce à Jackpot!")
  692.         $pokemon_party.add_money($battle_var.money_payday)
  693.         wait(40)
  694.       end
  695.      
  696.       wait(30)
  697.       $game_system.bgm_play($game_temp.map_bgm)
  698.       for actor in @evolve_checklist
  699.         info = actor.evolve_check
  700.         if info != false
  701.           scene = Pokemon_Evolve.new(actor, info, @z_level + 200)
  702.           scene.main
  703.         end
  704.       end
  705.      
  706.       end_battle
  707.     end
  708.    
  709.     def end_battle_defeat
  710.       $battle_var.result_defeat = true
  711.       list_string = Trainer_Info.string_defeat(@trainer_id)
  712.       draw_text(list_string)
  713.       wait_hit
  714.      
  715.       wait(40)
  716.       $pokemon_party.money /= 2
  717.       if not(@lose)
  718.         if $game_variables[1] == 0
  719.           print("Réglez votre point de retour!")
  720.         else
  721.           $game_map.setup($game_variables[1])
  722.           $game_map.display_x = $game_variables[2]
  723.           $game_map.display_y = $game_variables[3]
  724.           $game_player.moveto($game_variables[2], $game_variables[3])
  725.         end
  726.         $game_temp.common_event_id = 2
  727.       end
  728.       $game_temp.map_bgm = $game_map.bgm
  729.       end_battle(2)
  730.     end
  731.    
  732.   end
  733.  
  734. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement