Advertisement
RhenaudTheLukark

Pokemon_Battle_Wild

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