Sujet n°12997
Posté par FinalArt le 26 Juil - 10:02 (2013)
Titre : Evolution d'un pokémon
Plop,

Aujourd'hui, j'ai un soucis concernant l'évolution d'un pokemon : Evoli (grâce à une pierre). Dès que je lui fais tenir une pierre, genre la pierre feu, le script Pokemon_Evolve se lance, mais fait planter le jeu. Je suis sous PSP 5G.

Log
Code:
---------- Erreur de script : Pokemon_Evolve* ----------
----- Type
TypeError

----- Message
cannot convert Range into Integer

----- Position dans Pokemon_Evolve*
Ligne 268

----- Backtrace
Script : Pokemon_Evolve* | Ligne : 268 | Méthode : in `sprintf'
Script : Pokemon_Evolve* | Ligne : 268 | Méthode : in `evolved_sprite_generation'
Script : Pokemon_Evolve* | Ligne : 74 | Méthode : in `initialize'
Script : Pokemon_Item / Data | Ligne : 623 | Méthode : in `new'
Script : Pokemon_Item / Data | Ligne : 623 | Méthode : in `effect_on_pokemon'
Script : Pokemon_Party_Menu* | Ligne : 556 | Méthode : in `update'
Script : Pokemon_Party_Menu* | Ligne : 158 | Méthode : in `main'
Script : Pokemon_Party_Menu* | Ligne : 146 | Méthode : in `loop'
Script : Pokemon_Party_Menu* | Ligne : 163 | Méthode : in `main'
Script : Pokemon_Item_Bag* | Ligne : 444 | Méthode : in `update_command'
Script : Pokemon_Item_Bag* | Ligne : 145 | Méthode : in `main'
Script : Pokemon_Item_Bag* | Ligne : 134 | Méthode : in `loop'
Script : Pokemon_Item_Bag* | Ligne : 153 | Méthode : in `main'
Script : Main | Ligne : 58


Pokemon_Evolve
Code:
#==============================================================================
# ■ Pokemon_Evolve
# Pokemon Script Project - Krosk
# 01/08/07
# 27/08/08 - révision pour les oeufs
#-----------------------------------------------------------------------------
# Scène à ne pas modifier de préférence
#-----------------------------------------------------------------------------
# Scène appelée en cas de evolve
#-----------------------------------------------------------------------------

module POKEMON_S
  class Pokemon_Evolve
    def initialize(pokemon, evolve_id, z_level = 400, forcing = false)
      Graphics.freeze
      @z_level = z_level
      @forcing = forcing
      @cancel = false
      @pokemon = pokemon
     
      cry_pokemon(@pokemon.id)     
      $game_temp.map_bgm = $game_system.playing_bgm       
      Audio.bgm_play("Audio/BGM/PkmRS-Evolving.mid")
     
      @evolve_id = evolve_id
      @background = Sprite.new
      @background.x = 13
      @background.y = 13
      @background.bitmap = RPG::Cache.battleback("HatchBack.png")     
     
      @background.z = @z_level
      @background.color = Color.new(0, 0, 0, 0)     
     
      @text_window = Window_Base.new(0, 132, 250, 400)
      @text_window.opacity = 0
      @text_window.z = @z_level + 2
      @text_window.contents = Bitmap.new(608, 412)
      @text_window.contents.font.name = "Pokemon Emerald"
      @text_window.contents.font.size = $fontsize
     
      @message_background = Sprite.new
      @message_background.x = 15
      @message_background.y = 158
      @message_background.z = @z_level + 1
      @message_background.bitmap = RPG::Cache.picture($MSG)
     
      @pokemon_sprite = Sprite.new
      @pokemon_sprite.bitmap = RPG::Cache.battler(@pokemon.battler_face, 0)
      @pokemon_sprite.ox = @pokemon_sprite.bitmap.width / 2
      @pokemon_sprite.oy = @pokemon_sprite.bitmap.height / 2
      @pokemon_sprite.x = 140
      @pokemon_sprite.y = 95
      @pokemon_sprite.z = @z_level + 5
      @pokemon_sprite.color = Color.new(255,255,255,0)
      #@pokemon_sprite.zoom_x = 0.5
      #@pokemon_sprite.zoom_y = 0.5
     
      if @pokemon.egg
        @egg_sprite = Sprite.new
        @egg_sprite.bitmap = RPG::Cache.battler("BreakEgg0", 0)
        @egg_sprite.ox = @egg_sprite.bitmap.width / 2
        @egg_sprite.oy = @egg_sprite.bitmap.height / 2
        @egg_sprite.x = 140
        @egg_sprite.y = 95
        @egg_sprite.z = @z_level + 10
        @egg_sprite.visible = false
        @egg_sprite.zoom_x = 0.5
        @egg_sprite.zoom_y = 0.5
      end
     
      @evolved_sprite = Sprite.new
      @evolved_sprite.x = 140
      @evolved_sprite.y = 95
      @evolved_sprite.bitmap = RPG::Cache.battler(evolved_sprite_generation, 0)
      @evolved_sprite.ox = @evolved_sprite.bitmap.width / 2
      @evolved_sprite.oy = @evolved_sprite.bitmap.height / 2
      @evolved_sprite.z = @z_level + 6
      @evolved_sprite.zoom_x = 0
      @evolved_sprite.zoom_y = 0
      @evolved_sprite.color = Color.new(255,255,255,255)     
      Graphics.transition(20)
    end
   
   
    def main
      if not @pokemon.egg
        draw_text("Quoi ?", @pokemon.given_name + " évolue !")
        wait(40)
     
        # Blanchissement
        until @pokemon_sprite.color.alpha >= 255
          @pokemon_sprite.color.alpha += 20
          @background.color.alpha += 10
          Graphics.update
        end
       
        # Oscillement
        t = 0
        loop do
          t += 1
          if t > 100
            t +=1
          end
          if t > 250
            t += 1
          end
          if t > 450
            t += 1
          end
          pi = 3.14159265
          @pokemon_sprite.zoom_x = (Math.cos(t*2*pi/50)+1)/2
          @pokemon_sprite.zoom_y = (Math.cos(t*2*pi/50)+1)/2
          @evolved_sprite.zoom_x = (Math.cos(t*2*pi/50+pi)+1)/2
          @evolved_sprite.zoom_y = (Math.cos(t*2*pi/50+pi)+1)/2
          Input.update
          Graphics.update
          if t >= 650
            break
          end
          if Input.trigger?(Input::B) and not @forcing
            @cancel = true
            break
          end
        end
      else       
        wait(40)
        t = 0
        loop do
          t += 1
          if ( t >= 0 and t < 20 ) or ( t >= 60 and t < 80) or
            ( t >= 130 and t < 170 ) or ( t >= 220 and t < 260 )
            @pokemon_sprite.x += 3 * (2*(t%2) - 1)
            @egg_sprite.x += 3 * (2*(t%2) - 1)
          end
          Graphics.update
          if t == 20
            @egg_sprite.visible = true
            @egg_sprite.bitmap = RPG::Cache.battler("BreakEgg0", 0)
            @egg_sprite.update
          end
          if t == 80
            @egg_sprite.bitmap = RPG::Cache.battler("BreakEgg1", 0)
            @egg_sprite.update
          end
          if t == 170
            @egg_sprite.visible = true
            @egg_sprite.bitmap = RPG::Cache.battler("BreakEgg2", 0)
            @egg_sprite.update
          end
          if t > 260
            @evolved_sprite.zoom_x = 0.3
            @evolved_sprite.zoom_y = 0.3
            @egg_sprite.color = Color.new(255,255,255,0)
            break
          end
        end
      end
     
      if @cancel and not @forcing
        until @pokemon_sprite.zoom_x >= 1
          @evolved_sprite.zoom_x -= 0.1
          @evolved_sprite.zoom_y -= 0.1
          @pokemon_sprite.zoom_x += 0.1
          @pokemon_sprite.zoom_y += 0.1
          Graphics.update
        end
        @pokemon_sprite.zoom_y = 1
        @pokemon_sprite.zoom_x = 1
        @evolved_sprite.zoom_x = 0
        @evolved_sprite.zoom_y = 0
        Graphics.update
        until @pokemon_sprite.color.alpha <= 0
          @pokemon_sprite.color.alpha -= 20
          @background.color.alpha -= 10
          Graphics.update
        end
        Graphics.update
        draw_text("Que... ! "+@pokemon.given_name, "n'a pas évolué !")
        wait(40)
        wait_hit
        draw_text("", "")
      else
        # Rétablissement
        until @evolved_sprite.zoom_x >= 1
          @evolved_sprite.zoom_x += 0.1
          @evolved_sprite.zoom_y += 0.1
          @pokemon_sprite.zoom_x -= 0.1
          @pokemon_sprite.zoom_y -= 0.1
          if @pokemon.egg
            @evolved_sprite.zoom_x += 0.1
            @evolved_sprite.zoom_y += 0.1
            @pokemon_sprite.zoom_x += 0.40
            @pokemon_sprite.zoom_y += 0.40
            @pokemon_sprite.color.alpha += 40
            @pokemon_sprite.opacity -= 40
            @egg_sprite.zoom_x += 0.15
            @egg_sprite.zoom_y += 0.15
            @egg_sprite.opacity -= 40
            @egg_sprite.color.alpha += 40
          end
          Graphics.update
        end
       
        @evolved_sprite.zoom_x = 1
        @evolved_sprite.zoom_y = 1
        @pokemon_sprite.zoom_x = 0
        @pokemon_sprite.zoom_y = 0
        Graphics.update
       
        # Colorisation
        until @evolved_sprite.color.alpha == 0
          @evolved_sprite.color.alpha -= 20
          @background.color.alpha -= 10
          Graphics.update
        end
       
        loop do
          if @pokemon_sprite.color.alpha == 255 and @pokemon_sprite.zoom_x > 0
            @pokemon_sprite.zoom_x -= 0.1
            @pokemon_sprite.zoom_y -= 0.1
            @evolved_sprite.zoom_x += 0.1
            @evolved_sprite.zoom_y += 0.1
          end
          if @evolved_sprite.zoom_x >= 1
            @evolved_sprite.color.alpha -= 20
            @background.color.alpha -= 10
          end
          Graphics.update
          if @evolved_sprite.color.alpha == 0
            break
          end
        end       
        cry_pokemon(@evolve_id)
        wait(20)
        Audio.me_play("Audio/ME/PkmRS-Caught.mid")
        if not @pokemon.egg
          draw_text("Félicitations ! "+@pokemon.given_name,
          "a évolué en "+Pokemon_Info.name(@evolve_id)+" !")
        else
          draw_text(Pokemon_Info.name(@evolve_id),"vient de sortir de l'OEUF !")
          end
        wait(40)
        wait_hit
        draw_text("", "")
        if @forcing
          @pokemon.evolve(@evolve_id)
        else
          @pokemon.evolve
        end
        $data_pokedex[@pokemon.id] = [ true, true ]
      end
     
      Graphics.freeze
      $game_system.bgm_play($game_temp.map_bgm)
      Audio.me_stop
      @text_window.dispose
      @message_background.dispose
      @background.dispose
      @pokemon_sprite.dispose
      @evolved_sprite.dispose
      if @pokemon.egg
        @egg_sprite.dispose
      end
      @text_window = nil
    end
   
    def evolved_sprite_generation
      ida = sprintf("%03d", @evolve_id)
      if @pokemon.gender == 1 or @pokemon.gender == 0
        string = "Front_Male/" + ida + ".png"
      elsif @pokemon.gender == 2
        string = "Front_Female/" + ida + ".png"
        #if not(FileTest.exist?("Graphics/Battlers/" + string))
        if not($picture_data["Graphics/Battlers/" + string])
          string = "Front_Male/" + ida + ".png"
        end
      end
     
      if @pokemon.shiny
        string2 = "Shiny_" + string
        #if FileTest.exist?("Graphics/Battlers/" + string2)
        if $picture_data["Graphics/Battlers/" + string2]
          string = string2
        end
      end
     
      return string
    end
   
    def draw_text(line1 = "", line2 = "")
      Graphics.freeze
      @text_window.contents.clear
      @text_window.draw_text(13, 8, 212, 32, line1)
      @text_window.draw_text(13, 24, 212, 32, line2)     
      Graphics.transition(5)
    end
   
    def cry_pokemon(id_data)
    if id_data.type == String
      id = id_conversion(id_data)
    elsif id_data.type == Fixnum
      id = id_data
    end
    ida = sprintf("%03d", id)
    filename = "Audio/SE/Cries/" + ida + "Cry.wav"
    if FileTest.exist?(filename)
      Audio.se_play(filename)
    end
    return true
  end
 
    def wait_hit
      loop do
        Graphics.update
        Input.update
        if Input.trigger?(Input::C)
          $game_system.se_play($data_system.decision_se)
          break
        end
      end
    end
     
    def wait(frame)
      i = 0
      loop do
        i += 1
        Graphics.update
        if i >= frame
          break
        end
      end
    end
  end
end


Pokemon_Item / Data
Code:
#==============================================================================
# ■ Item
# Pokemon Script Project - Krosk
# 25/08/07
#-----------------------------------------------------------------------------
# Scène à ne pas modifier de préférence
#-----------------------------------------------------------------------------
# Données du Sac
#-----------------------------------------------------------------------------

module POKEMON_S
  #-------------------------------------------------------------
  # $data_ball
  #   [Nom, Catch_rate, sprite fermé, sprite ouvert, Couleur]
  #-------------------------------------------------------------

 
  $data_ball = []
  if FileTest.exist?("Data/data_ball.txt")
    begin
      file = File.open("Data/data_ball.txt", "rb")
      file.readchar
      file.readchar
      file.readchar
      file.each {|line| eval(line) }
      file.close
    rescue Exception => exception
      EXC::error_handler(exception, file)
    end
  else
    $data_ball = load_data("Data/data_ball.rxdata")
  end
 
  #-------------------------------------------------------------
  # $data_item
  #   [Nom, Icone, Type, Description, Prix, Profil, Texte à l'utilisation, data, log_data_A, log_data_B, log_data_C]
  #   Type: "ITEM"
  #         "BALL"
  #         "TECH"
  #         "BERRY"
  #         "KEY"
  #
  #   [ tenable/jetable, usage limité, usage en map, usage en combat, usage sur pokémon, apte/non apte]
  #
  #   data paramètre général: common_event_id, effect
  #
  #   log_data_A paramètre de soin: [recover_hp_rate, recover_hp, recover_pp_rate, recover_pp]
  #   log_data_B paramètre de statut: [minus_state]
  #-------------------------------------------------------------
  #-----------------------------------------------------------------------------
  # 0: Normal, 1: Poison, 2: Paralysé, 3: Brulé, 4:Sommeil, 5:Gelé, 8: Toxic
  # @confuse (6), @flinch (7)
  #-----------------------------------------------------------------------------
 
  $data_item = []
  if ITEM_CONVERSION
    $data_item[ 0 ]=["erreur","return.png","ITEM","erreur", 0 ,"" ,"" , {} ]
    if FileTest.exist?("Data/data_item.txt")
      begin
        file = File.open("Data/data_item.txt", "rb")
        file.readchar
        file.readchar
        file.readchar
        file.each {|line| eval(line) }
        file.close
      rescue Exception => exception
        EXC::error_handler(exception, file)
      end
    end
  end
 
  #-------------------------------------------------------------
  # La suite ne concerne qui si vous ne passez par pas la
  # base de données pour configurer les objets
  #-------------------------------------------------------------
  # Cette liste n'est pas mise à jour, elle est à abandonner
  #-------------------------------------------------------------
 
  if false
    $data_item[ 0 ]=["erreur","return.png","ITEM","erreur", 0 ,"" ,"" , ["" , ] ]
    $data_item[ 1 ]=["MASTER BALL","masterball.png","BALL","Assurément la ball la plus performante. Elle permet de capturer à coup sûr un Pokémon sauvage", 0 ,"BALL","" , ["ball", $data_ball[3] ] ]
    $data_item[ 2 ]=["HYPER BALL","hyperball.png","BALL","BALL au taux de réussite supérieur à la SUPER BALL.", 1200 ,"BALL","" , ["ball", $data_ball[2] ] ]
    $data_item[ 3 ]=["SUPER BALL","superball.png","BALL","BALL au taux de réussite supérieur à la POKé BALL.", 600 ,"BALL","" , ["ball", $data_ball[1] ] ]
    $data_item[ 4 ]=["POKé BALL","pokeball.png","BALL","Un objet qui permet d'attraper les POKéMON sauvages.", 200 ,"BALL","" , ["ball", $data_ball[0] ] ]
    $data_item[ 5 ]=["FILET BALL","filetball.png","BALL","Une BALL qui marche bien sur un POKéMON EAU ou INSECTE.", 0 ,"BALL","" , ["ball", $data_ball[4] ] ]
    $data_item[ 6 ]=["FAIBLO BALL","faibloball.png","BALL","Une BALL qui marche mieux avec les POKéMON faibles.", 0 ,"BALL","" , ["ball", $data_ball[5] ] ]
    $data_item[ 7 ]=[ ]
    $data_item[ 8 ]=[ ]
    $data_item[ 9 ]=["CHRONO BALL","chronoball.png","BALL","Plus efficace pendant les combats longs.", 0 ,"BALL","" , ["ball", $data_ball[8] ] ]
    $data_item[ 10 ]=["HONOR BALL","honorball.png","BALL","Une BALL rare créée à l'occasion d'un grand événement.", 0 ,"BALL","" , ["ball", $data_ball[9] ] ]
    $data_item[ 11 ]=["LUXE BALL","luxuryball.png","BALL","Une BALL confortable qui rend les POKéMON amicaux.", 0 ,"BALL","" , ["ball", $data_ball[10] ] ]
    $data_item[ 12 ]=[ ]
    $data_item[ 13 ]=["POTION","potion.png","ITEM","Un spray qui soigne les blessures. Restaure 20 PV à un Pokémon.", 350 ,"ITEM","Les PV sont restaurés de %d points.", nil , [0,20,0,0] ]
    $data_item[ 14 ]=["SUPER POTION","superpotion.png","ITEM","Restaure les PV d'un POKéMON de 50 points.", 700 ,"ITEM","Les PV sont restaurés de %d points.", nil , [0,50,0,0] ]
    $data_item[ 15 ]=["HYPER POTION","hyperpotion.png","ITEM","Restaure les PV d'un POKéMON de 200 points.", 1200 ,"ITEM","Les PV sont restaurés de %d points.", nil , [0,200,0,0] ]
    $data_item[ 16 ]=["POTION MAX","potionmax.png","ITEM","Restaure tous les PV d'un POKéMON.", 2500 ,"ITEM","Les PV sont restaurés de %d points.", nil , [100,0,0,0] ]
    $data_item[ 17 ]=["ANTIDOTE","antidote.png","ITEM","Soigne les POKéMON empoisonnés.", 100 ,"ITEM","Le statut est restauré.", nil , nil , [1] ]
    $data_item[ 18 ]=["ANTI-BRULE","antibrule.png","ITEM","Soigne les POKéMON de leurs brûlures.", 250 ,"ITEM","Le statut est restauré.", nil , nil , [3] ]
    $data_item[ 19 ]=["ANTIGEL","antigel.png","ITEM","Décongèle les POKéMON gelés.", 250 ,"ITEM","Le statut est restauré.", nil , nil , [5] ]
    $data_item[ 20 ]=["REVEIL","reveil.png","ITEM","Réveille les POKéMON endormis.", 250 ,"ITEM","Le statut est restauré.", nil , nil , [4] ]
    $data_item[ 21 ]=["ANTI-PARA","antipara.png","ITEM","Soigne les POKéMON paralysés.", 200 ,"ITEM","Le statut est restauré.", nil , nil , [2] ]
    $data_item[ 22 ]=["TOTAL SOIN","totalsoin.png","ITEM","Soigne les changements de statut d'un POKéMON.", 600 ,"ITEM","Le statut est restauré.", nil , nil , [1,2,3,4,5,6,7,8] ]
    $data_item[ 23 ]=["GUERISON","guerison.png","ITEM","Restaure tous les PV et le statut d'un POKéMON.", 3000 ,"ITEM","Les PV sont restaurés de %d points.", nil , [100,0,0,0] , [1,2,3,4,5,6,7,8] ]
    $data_item[ 24 ]=["RAPPEL","rappel.png","ITEM","Réanime un POKéMON K.O. et restaure la moitié de ses PV.", 1500 ,"ITEM","%s récupère son énergie.", nil , [50,0,0,0] , [9] ]
    $data_item[ 25 ]=["RAPPEL MAX","rappelmax.png","ITEM","Réanime un POKéMON K.O. et restaure tous ses PV.", 4000 ,"ITEM","%s récupère son énergie.", nil , [100,0,0,0] , [9] ]
    $data_item[ 26 ]=["HUILE","huile.png","ITEM","Restaure 10 PP d'une attaque sélectionnée.", 1200 ,"ITEM","Les PP sont restaurés.", nil , [0,0,0,10] ]
    $data_item[ 27 ]=["HUILE MAX","huilemax.png","ITEM","Restaure tous les PP d'une attaque sélectionnée.", 2000 ,"ITEM","Les PP sont restaurés.", nil , [0,0,0,99] ]
    $data_item[ 28 ]=["ELIXIR","elixir.png","ITEM","Restaure 10 PP de toutes les attaques.", 3000 ,"ITEM","Les PP sont restaurés.", nil , [0,0,1,10] ]
    $data_item[ 29 ]=["MAX ELIXIR","maxelixir.png","ITEM","Restaure tous les PP de toutes les attaques.", 4500 ,"ITEM","Les PP sont restaurés.", nil , [0,0,1,99] ]
    $data_item[ 30 ]=[ ]
    $data_item[ 31 ]=[ ]
    $data_item[ 32 ]=[ ]
    $data_item[ 33 ]=[ ]
    $data_item[ 34 ]=[ ]
    $data_item[ 35 ]=[ ]
    $data_item[ 36 ]=[ ]
    $data_item[ 37 ]=[ ]
    $data_item[ 38 ]=[ ]
    $data_item[ 39 ]=[ ]
    $data_item[ 40 ]=[ ]
    $data_item[ 41 ]=["SUPER BONBON","superbonbon.png","ITEM","Fait progresser un POKéMON d'un niveau.", 4800 ,"PKMN","" , ["level_up", 1 ] ]
    $data_item[ 42 ]=["PV PLUS","pvplus.png","ITEM","Monte les PV d'un POKéMON.", 9800 ,"PKMN","" , ["boost", 0 ] ]
    $data_item[ 43 ]=["PROTEINE","proteine.png","ITEM","Monte l'ATTAQUE d'un POKéMON.", 9800 ,"PKMN","" , ["boost", 1 ] ]
    $data_item[ 44 ]=["FER","fer.png","ITEM","Monte la DEFENSE d'un POKéMON.", 9800 ,"PKMN","" , ["boost", 2 ] ]
    $data_item[ 45 ]=["CARBONE","carbone.png","ITEM","Monte la VITESSE d'un POKéMON.", 9800 ,"PKMN","" , ["boost", 3 ] ]
    $data_item[ 46 ]=["CALCIUM","calcium.png","ITEM","Monte l'ATQ. SPE. d'un POKéMON.", 9800 ,"PKMN","" , ["boost", 4 ] ]
    $data_item[ 47 ]=["ZINC","zinc.png","ITEM","Monte la DEF. SPE. d'un POKéMON.", 9800 ,"PKMN","" , ["boost", 5 ] ]
    $data_item[ 48 ]=[ ]
    $data_item[ 49 ]=[ ]
    $data_item[ 50 ]=["ATTAQUE +","attaque+.png","ITEM","Monte l'ATTAQUE pendant un combat.", 500 ,"BATTLE","ATTAQUE de %s augmentée.", ["battle_boost", 0 ] ]
    $data_item[ 51 ]=["DEFENSE +","defense+.png","ITEM","Monte la DEFENSE pendant un combat.", 550 ,"BATTLE","DEFENSE de %s augmentée.", ["battle_boost", 1 ] ]
    $data_item[ 52 ]=["VITESSE +","vitesse+.png","ITEM","Monte la VITESSE pendant un combat.", 350 ,"BATTLE","VITESSE de %s augmentée.", ["battle_boost", 2 ] ]
    $data_item[ 53 ]=["SPECIAL +","special+.png","ITEM","Monte l'ATQ. SPE. pendant un combat.", 350 ,"BATTLE","ATQ.SPE. de %s augmentée.", ["battle_boost", 3 ] ]
    $data_item[ 54 ]=["PRECISION +","precision+.png","ITEM","Monte la précision des attaques pendant un combat.", 950 ,"BATTLE","PRECISION de %s augmentée.", ["battle_boost", 6 ] ]
    $data_item[ 55 ]=[ ]
    $data_item[ 56 ]=[ ]
    $data_item[ 57 ]=["POKéPOUPEE","pokepoupee.png","ITEM","Pour s'enfuir d'un combat contre un POKéMON sauvage.", 1000 ,"BATTLE","" , ["flee"] ]
    $data_item[ 58 ]=["QUEUE SKITTY","queueskitty.png","ITEM","Pour s'enfuir d'un combat contre un POKéMON sauvage.", 1000 ,"BATTLE","" , ["flee"] ]
    $data_item[ 59 ]=[ ]
    $data_item[ 60 ]=[ ]
    $data_item[ 61 ]=[ ]
    $data_item[ 62 ]=[ ]
    $data_item[ 63 ]=[ ]
    $data_item[ 64 ]=[ ]
    $data_item[ 65 ]=[ ]
    $data_item[ 66 ]=[ ]
    $data_item[ 67 ]=[ ]
    $data_item[ 68 ]=[ ]
    $data_item[ 69 ]=[ ]
    $data_item[ 70 ]=["REPOUSSE","repousse.png","ITEM","Repousse les PKMN sauvages faibles durant 100 pas.", 350 ,"MAP","Ca va repousser les Pokémons sauvages.", ["repel", 100 ] ]
    $data_item[ 71 ]=["SUPEREPOUSSE","superrepousse.png","ITEM","Repousse les PKMN sauvages faibles durant 200 pas.", 500 ,"MAP","Ca va repousser les Pokémons sauvages.", ["repel", 200 ] ]
    $data_item[ 72 ]=["MAX REPOUSSE","maxrepousse.png","ITEM","Repousse les PKMN sauvages faibles durant 250 pas.", 700 ,"MAP","Ca va repousser les Pokémons sauvages.", ["repel", 250 ] ]
    $data_item[ 73 ]=[ ]
    $data_item[ 74 ]=["MOUCH.SOIE","mouchsoie.png","ITEM","Objet tenu montant la puissance des attaques NORMAL.", 9800 ,"HOLD","" ]
    $data_item[ 75 ]=["CHARBON","charbon.png","ITEM","Objet tenu montant la puissance des attaques FEU.", 9800 ,"HOLD","" ]
    $data_item[ 76 ]=["EAU MYSTIQUE","eaumystique.png","ITEM","Objet tenu montant la puissance des attaques EAU.", 9800 ,"HOLD","" ]
    $data_item[ 77 ]=["AIMANT","aimant.png","ITEM","Objet tenu montant la puissance des attaques ELECTRIK.", 9800 ,"HOLD","" ]
    $data_item[ 78 ]=["GRAIN MIRACL","grainmiracl.png","ITEM","Objet tenu montant la puissance des attaques PLANTE.", 9800 ,"HOLD","" ]
    $data_item[ 79 ]=["GLACETERNEL","glaceternel.png","ITEM","Objet tenu montant la puissance des attaques GLACE.", 9800 ,"HOLD","" ]
    $data_item[ 80 ]=["CEINT.NOIRE","ceintnoire.png","ITEM","Objet tenu montant la puissance des attaques COMBAT.", 9800 ,"HOLD","" ] 
    $data_item[ 81 ]=["PIC VENIN","picvenin.png","ITEM","Objet tenu montant la puissance des attaques POISON.", 9800 ,"HOLD","" ]
    $data_item[ 82 ]=["SABLE DOUX","sabledoux.png","ITEM","Objet tenu montant la puissance des attaques SOL.", 9800 ,"HOLD","" ]
    $data_item[ 83 ]=["BEC POINTU","becpointu.png","ITEM","Objet tenu montant la puissance des attaques VOL.", 9800 ,"HOLD","" ]
    $data_item[ 84 ]=["CUILLERTORDU","cuillertordu.png","ITEM","Objet tenu montant la puissance des attaques PSY.", 9800 ,"HOLD","" ]
    $data_item[ 85 ]=["POUDRE ARG.","poudrearg.png","ITEM","Objet tenu montant la puissance des attaques INSECTE.", 9800 ,"HOLD","" ]
    $data_item[ 86 ]=["PIERRE DURE","pierredure.png","ITEM","Objet tenu montant la puissance des attaques ROCHE.", 9800 ,"HOLD","" ]
    $data_item[ 87 ]=["RUNE SORT","runesort.png","ITEM","Objet tenu montant la puissance des attaques SPECTRE.", 9800 ,"HOLD","" ]
    $data_item[ 88 ]=["CROC DRAGON","crocdragon.png","ITEM","Objet tenu montant la puissance des attaques DRAGON.", 9800 ,"HOLD","" ]
    $data_item[ 89 ]=["PEAU METAL","peaumetal.png","ITEM","Objet tenu montant la puissance des attaques ACIER.", 9800 ,"HOLD","" ]
    $data_item[ 90 ]=["LUNET.NOIRES","lunetnoires.png","ITEM","Objet tenu montant la puissance des attaques TENEBRES.", 9800 ,"HOLD","" ]
    $data_item[ 91 ]=[ ]
    $data_item[ 92 ]=[ ]
    $data_item[ 93 ]=[ ]
    $data_item[ 94 ]=[ ]
    $data_item[ 95 ]=[ ]
    $data_item[ 96 ]=[ ]
    $data_item[ 97 ]=[ ]
    $data_item[ 98 ]=[ ]
    $data_item[ 99 ]=[ ]
    $data_item[ 100 ]=[ ]
    $data_item[ 101 ]=[ ]
    $data_item[ 102 ]=["RESTES","restes.png","ITEM","Objet tenu permettant de restaurer les PV au combat.", 200 ,"HOLD","" ]
    $data_item[ 103 ]=[ ]
    $data_item[ 104 ]=[ ]
    $data_item[ 105 ]=["MULTI EXP","multiexp.png","ITEM","Objet tenu pour partager l'EXP après un combat.", 3000 ,"HOLD","" ]
    $data_item[ 106 ]=[ ]
    $data_item[ 107 ]=["PIECE RUNE","piecerune.png","ITEM","Double l'argent gagné si le porteur se bat aussi.", 100 ,"HOLD","" ]
    $data_item[ 108 ]=[ ]
    $data_item[ 109 ]=[ ]
    $data_item[ 110 ]=[ ]
    $data_item[ 111 ]=[ ]
    $data_item[ 112 ]=[ ]
    $data_item[ 113 ]=[ ]
    $data_item[ 114 ]=[ ]
    $data_item[ 115 ]=[ ]
    $data_item[ 116 ]=[ ]
    $data_item[ 117 ]=[ ]
    $data_item[ 118 ]=["CT01-"+ Skill_Info.name(Skill_Info.id("MITRA-POING")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("MITRA-POING")) , 3000 ,"ABLE","" , [ "ct", 1 , Skill_Info.id("MITRA-POING")] ]
    $data_item[ 119 ]=["CT02-"+ Skill_Info.name(Skill_Info.id("DRACOGRIFFE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("DRACOGRIFFE")) , 3000 ,"ABLE","" , [ "ct", 2 , Skill_Info.id("DRACOGRIFFE")] ]
    $data_item[ 120 ]=["CT03-"+ Skill_Info.name(Skill_Info.id("VIBRAQUA")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("VIBRAQUA")) , 3000 ,"ABLE","" , [ "ct", 3 , Skill_Info.id("VIBRAQUA")] ]
    $data_item[ 121 ]=["CT04-"+ Skill_Info.name(Skill_Info.id("PLENITUDE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("PLENITUDE")) , 3000 ,"ABLE","" , [ "ct", 4 , Skill_Info.id("PLENITUDE")] ]
    $data_item[ 122 ]=["CT05-"+ Skill_Info.name(Skill_Info.id("HURLEMENT")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("HURLEMENT")) , 1000 ,"ABLE","" , [ "ct", 5 , Skill_Info.id("HURLEMENT")] ]
    $data_item[ 123 ]=["CT06-"+ Skill_Info.name(Skill_Info.id("TOXIK")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("TOXIK")) , 3000 ,"ABLE","" , [ "ct", 6 , Skill_Info.id("TOXIK")] ]
    $data_item[ 124 ]=["CT07-"+ Skill_Info.name(Skill_Info.id("GRELE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("GRELE")) , 3000 ,"ABLE","" , [ "ct", 7 , Skill_Info.id("GRELE")] ]
    $data_item[ 125 ]=["CT08-"+ Skill_Info.name(Skill_Info.id("GONFLETTE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("GONFLETTE")) , 3000 ,"ABLE","" , [ "ct", 8 , Skill_Info.id("GONFLETTE")] ]
    $data_item[ 126 ]=["CT09-"+ Skill_Info.name(Skill_Info.id("BALLE GRAINE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("BALLE GRAINE")) , 3000 ,"ABLE","" , [ "ct", 9 , Skill_Info.id("BALLE GRAINE")] ]
    $data_item[ 127 ]=["CT10-"+ Skill_Info.name(Skill_Info.id("PUIS. CACHEE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("PUIS. CACHEE")) , 3000 ,"ABLE","" , [ "ct", 10 , Skill_Info.id("PUIS. CACHEE")] ]
    $data_item[ 128 ]=["CT11-"+ Skill_Info.name(Skill_Info.id("ZENITH")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("ZENITH")) , 2000 ,"ABLE","" , [ "ct", 11 , Skill_Info.id("ZENITH")] ]
    $data_item[ 129 ]=["CT12-"+ Skill_Info.name(Skill_Info.id("PROVOC")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("PROVOC")) , 3000 ,"ABLE","" , [ "ct", 12 , Skill_Info.id("PROVOC")] ]
    $data_item[ 130 ]=["CT13-"+ Skill_Info.name(Skill_Info.id("LASER GLACE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("LASER GLACE")) , 3000 ,"ABLE","" , [ "ct", 13 , Skill_Info.id("LASER GLACE")] ]
    $data_item[ 131 ]=["CT14-"+ Skill_Info.name(Skill_Info.id("BLIZZARD")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("BLIZZARD")) , 5500 ,"ABLE","" , [ "ct", 14 , Skill_Info.id("BLIZZARD")] ]
    $data_item[ 132 ]=["CT15-"+ Skill_Info.name(Skill_Info.id("ULTRALASER")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("ULTRALASER")) , 7500 ,"ABLE","" , [ "ct", 15 , Skill_Info.id("ULTRALASER")] ]
    $data_item[ 133 ]=["CT16-"+ Skill_Info.name(Skill_Info.id("MUR LUMIERE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("MUR LUMIERE")) , 3000 ,"ABLE","" , [ "ct", 16 , Skill_Info.id("MUR LUMIERE")] ]
    $data_item[ 134 ]=["CT17-"+ Skill_Info.name(Skill_Info.id("ABRI")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("ABRI")) , 3000 ,"ABLE","" , [ "ct", 17 , Skill_Info.id("ABRI")] ]
    $data_item[ 135 ]=["CT18-"+ Skill_Info.name(Skill_Info.id("DANSE PLUIE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("DANSE PLUIE")) , 2000 ,"ABLE","" , [ "ct", 18 , Skill_Info.id("DANSE PLUIE")] ]
    $data_item[ 136 ]=["CT19-"+ Skill_Info.name(Skill_Info.id("GIGA-SANGSUE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("GIGA-SANGSUE")) , 3000 ,"ABLE","" , [ "ct", 19 , Skill_Info.id("GIGA-SANGSUE")] ]
    $data_item[ 137 ]=["CT20-"+ Skill_Info.name(Skill_Info.id("RUNE PROTECT")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("RUNE PROTECT")) , 3000 ,"ABLE","" , [ "ct", 20 , Skill_Info.id("RUNE PROTECT")] ]
    $data_item[ 138 ]=["CT21-"+ Skill_Info.name(Skill_Info.id("FRUSTRATION")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("FRUSTRATION")) , 1000 ,"ABLE","" , [ "ct", 21 , Skill_Info.id("FRUSTRATION")] ]
    $data_item[ 139 ]=["CT22-"+ Skill_Info.name(Skill_Info.id("LANCE-SOLEIL")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("LANCE-SOLEIL")) , 3000 ,"ABLE","" , [ "ct", 22 , Skill_Info.id("LANCE-SOLEIL")] ]
    $data_item[ 140 ]=["CT23-"+ Skill_Info.name(Skill_Info.id("QUEUE DE FER")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("QUEUE DE FER")) , 3000 ,"ABLE","" , [ "ct", 23 , Skill_Info.id("QUEUE DE FER")] ]
    $data_item[ 141 ]=["CT24-"+ Skill_Info.name(Skill_Info.id("TONNERRE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("TONNERRE")) , 3000 ,"ABLE","" , [ "ct", 24 , Skill_Info.id("TONNERRE")] ]
    $data_item[ 142 ]=["CT25-"+ Skill_Info.name(Skill_Info.id("FATAL-FOUDRE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("FATAL-FOUDRE")) , 5500 ,"ABLE","" , [ "ct", 25 , Skill_Info.id("FATAL-FOUDRE")] ]
    $data_item[ 143 ]=["CT26-"+ Skill_Info.name(Skill_Info.id("SEISME")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("SEISME")) , 3000 ,"ABLE","" , [ "ct", 26 , Skill_Info.id("SEISME")] ]
    $data_item[ 144 ]=["CT27-"+ Skill_Info.name(Skill_Info.id("RETOUR")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("RETOUR")) , 1000 ,"ABLE","" , [ "ct", 27 , Skill_Info.id("RETOUR")] ]
    $data_item[ 145 ]=["CT28-"+ Skill_Info.name(Skill_Info.id("TUNNEL")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("TUNNEL")) , 2000 ,"ABLE","" , [ "ct", 28 , Skill_Info.id("TUNNEL")] ]
    $data_item[ 146 ]=["CT29-"+ Skill_Info.name(Skill_Info.id("PSYKO")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("PSYKO")) , 2000 ,"ABLE","" , [ "ct", 29 , Skill_Info.id("PSYKO")] ]
    $data_item[ 147 ]=["CT30-"+ Skill_Info.name(Skill_Info.id("BALL'OMBRE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("BALL'OMBRE")) , 3000 ,"ABLE","" , [ "ct", 30 , Skill_Info.id("BALL'OMBRE")] ]
    $data_item[ 148 ]=["CT31-"+ Skill_Info.name(Skill_Info.id("CASSE-BRIQUE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("CASSE-BRIQUE")) , 3000 ,"ABLE","" , [ "ct", 31 , Skill_Info.id("CASSE-BRIQUE")] ]
    $data_item[ 149 ]=["CT32-"+ Skill_Info.name(Skill_Info.id("REFLET")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("REFLET")) , 2000 ,"ABLE","" , [ "ct", 32 , Skill_Info.id("REFLET")] ]
    $data_item[ 150 ]=["CT33-"+ Skill_Info.name(Skill_Info.id("PROTECTION")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("PROTECTION")) , 3000 ,"ABLE","" , [ "ct", 33 , Skill_Info.id("PROTECTION")] ]
    $data_item[ 151 ]=["CT34-"+ Skill_Info.name(Skill_Info.id("ONDE DE CHOC")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("ONDE DE CHOC")) , 3000 ,"ABLE","" , [ "ct", 34 , Skill_Info.id("ONDE DE CHOC")] ]
    $data_item[ 152 ]=["CT35-"+ Skill_Info.name(Skill_Info.id("LANCE-FLAMME")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("LANCE-FLAMME")) , 3000 ,"ABLE","" , [ "ct", 35 , Skill_Info.id("LANCE-FLAMME")] ]
    $data_item[ 153 ]=["CT36-"+ Skill_Info.name(Skill_Info.id("BOMB-BEURK")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("BOMB-BEURK")) , 1000 ,"ABLE","" , [ "ct", 36 , Skill_Info.id("BOMB-BEURK")] ]
    $data_item[ 154 ]=["CT37-"+ Skill_Info.name(Skill_Info.id("TEMPETESABLE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("TEMPETESABLE")) , 2000 ,"ABLE","" , [ "ct", 37 , Skill_Info.id("TEMPETESABLE")] ]
    $data_item[ 155 ]=["CT38-"+ Skill_Info.name(Skill_Info.id("DEFLAGRATION")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("DEFLAGRATION")) , 5500 ,"ABLE","" , [ "ct", 38 , Skill_Info.id("DEFLAGRATION")] ]
    $data_item[ 156 ]=["CT39-"+ Skill_Info.name(Skill_Info.id("TOMBEROCHE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("TOMBEROCHE")) , 3000 ,"ABLE","" , [ "ct", 39 , Skill_Info.id("TOMBEROCHE")] ]
    $data_item[ 157 ]=["CT40-"+ Skill_Info.name(Skill_Info.id("AEROPIQUE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("AEROPIQUE")) , 3000 ,"ABLE","" , [ "ct", 40 , Skill_Info.id("AEROPIQUE")] ]
    $data_item[ 158 ]=["CT41-"+ Skill_Info.name(Skill_Info.id("TOURMENTE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("TOURMENTE")) , 3000 ,"ABLE","" , [ "ct", 41 , Skill_Info.id("TOURMENTE")] ]
    $data_item[ 159 ]=["CT42-"+ Skill_Info.name(Skill_Info.id("FACADE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("FACADE")) , 3000 ,"ABLE","" , [ "ct", 42 , Skill_Info.id("FACADE")] ]
    $data_item[ 160 ]=["CT43-"+ Skill_Info.name(Skill_Info.id("FORCE CACHEE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("FORCE CACHEE")) , 3000 ,"ABLE","" , [ "ct", 43 , Skill_Info.id("FORCE CACHEE")] ]
    $data_item[ 161 ]=["CT44-"+ Skill_Info.name(Skill_Info.id("REPOS")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("REPOS")) , 3000 ,"ABLE","" , [ "ct", 44 , Skill_Info.id("REPOS")] ]
    $data_item[ 162 ]=["CT45-"+ Skill_Info.name(Skill_Info.id("ATTRACTION")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("ATTRACTION")) , 3000 ,"ABLE","" , [ "ct", 45 , Skill_Info.id("ATTRACTION")] ]
    $data_item[ 163 ]=["CT46-"+ Skill_Info.name(Skill_Info.id("LARCIN")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("LARCIN")) , 3000 ,"ABLE","" , [ "ct", 46 , Skill_Info.id("LARCIN")] ]
    $data_item[ 164 ]=["CT47-"+ Skill_Info.name(Skill_Info.id("AILE D'ACIER")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("AILE D'ACIER")) , 3000 ,"ABLE","" , [ "ct", 47 , Skill_Info.id("AILE D'ACIER")] ]
    $data_item[ 165 ]=["CT48-"+ Skill_Info.name(Skill_Info.id("ECHANGE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("ECHANGE")) , 3000 ,"ABLE","" , [ "ct", 48 , Skill_Info.id("ECHANGE")] ]
    $data_item[ 166 ]=["CT49-"+ Skill_Info.name(Skill_Info.id("SAISIE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("SAISIE")) , 3000 ,"ABLE","" , [ "ct", 49 , Skill_Info.id("SAISIE")] ]
    $data_item[ 167 ]=["CT50-"+ Skill_Info.name(Skill_Info.id("SURCHAUFFE")) , "ct.png","TECH", Skill_Info.description(Skill_Info.id("SURCHAUFFE")) , 3000 ,"ABLE","" , [ "ct", 50 , Skill_Info.id("SURCHAUFFE")] ]
    $data_item[ 168 ]=["CS01-"+ Skill_Info.name(Skill_Info.id("COUPE")) , "cs.png","TECH", Skill_Info.description(Skill_Info.id("COUPE")) , 8000 ,"CS","" , [ "cs", 1 , Skill_Info.id("COUPE")] ]
    $data_item[ 169 ]=["CS02-"+ Skill_Info.name(Skill_Info.id("VOL")) , "cs.png","TECH", Skill_Info.description(Skill_Info.id("VOL")) , 8000 ,"CS","" , [ "cs", 2 , Skill_Info.id("VOL")] ]
    $data_item[ 170 ]=["CS03-"+ Skill_Info.name(Skill_Info.id("SURF")) , "cs.png","TECH", Skill_Info.description(Skill_Info.id("SURF")) , 58000 ,"CS","" , [ "cs", 3 , Skill_Info.id("SURF")] ]
    $data_item[ 171 ]=["CS04-"+ Skill_Info.name(Skill_Info.id("FORCE")) , "cs.png","TECH", Skill_Info.description(Skill_Info.id("FORCE")) , 8000 ,"CS","" , [ "cs", 4 , Skill_Info.id("FORCE")] ]
    $data_item[ 172 ]=["CS05-"+ Skill_Info.name(Skill_Info.id("ANTI-BRUME")) , "cs.png","TECH", Skill_Info.description(Skill_Info.id("ANTI-BRUME")) , 8000 ,"CS","" , [ "cs", 5 , Skill_Info.id("ANTI-BRUME")] ]
    $data_item[ 173 ]=["Eclate-roc", "cs.png","TECH", Skill_Info.description(Skill_Info.id("ECLATE-ROC")) , 8000 ,"CS","" , [ "cs", 6 , Skill_Info.id("ECLATE-ROC")] ]
    $data_item[ 174 ]=["CS07-"+ Skill_Info.name(Skill_Info.id("CASCADE")) , "cs.png","TECH", Skill_Info.description(Skill_Info.id("CASCADE")) , 8000 ,"CS","" , [ "cs", 7 , Skill_Info.id("CASCADE")] ]
    $data_item[ 175 ]=["CS08-"+ Skill_Info.name(Skill_Info.id("ESCALADE")) , "cs.png","TECH", Skill_Info.description(Skill_Info.id("ESCALADE")) , 8000 ,"CS","" , [ "cs", 8 , Skill_Info.id("ESCALADE")] ]
    $data_item[ 176 ]=["CS09-"+ Skill_Info.name(Skill_Info.id("ECLATE-ROC")) , "cs.png","TECH", Skill_Info.description(Skill_Info.id("ECLATE-ROC")) , 8000 ,"CS","" , [ "cs", 9 , Skill_Info.id("ECLATE-ROC")] ]
    $data_item[ 177 ]=["PASS ZONE 1","cartemagnetique.png","KEY","Pass pour la Zone 1.", 0 ,"KEYITEM",""]
    $data_item[ 178 ]=["PASS ZONE 2","cartemagnetique.png","KEY","Pass pour la Zone 2.", 0 ,"KEYITEM",""]
    $data_item[ 179 ]=["PASS ZONE 3","cartemagnetique.png","KEY","Pass pour la Zone 3.", 0 ,"KEYITEM",""]
    $data_item[ 180 ]=["PASS ZONE 4","cartemagnetique.png","KEY","Pass pour la Zone 4.", 0 ,"KEYITEM",""]   
    $data_item[ 259 ]=["VELO COURSE", "velocourse.png", "KEY", "Un vélo pliable pour aller 2 fois plus vite qu'à pied.", 0, "KEYITEM", "", [ "event", 31 ] ]
  end
 
  if ITEM_CONVERSION
    if FileTest.exist?("Data/data_item.txt")
      $data_items       = load_data("Data/Items.rxdata")
      for i in 1..$data_items.length-1
        item = $data_items[i]
       
        if $data_item[i] == nil
          $data_item[i] = []
        end
       
        string = item.description.split('//')
       
        # Description après usage
        if string[1] != nil
          $data_item[i].unshift(string[1])
        else
          $data_item[i].unshift("")
        end
       
        # Profil perso         
        custom_list = [false, false, false, false, false, false]
        for element in item.element_set
          case element
          when 34
            custom_list[0] = true
          when 35
            custom_list[1] = true
          when 36
            custom_list[2] = true
          when 37
            custom_list[3] = true
          when 38
            custom_list[4] = true
          when 39
            custom_list[5] = true
          end
        end
        $data_item[i].unshift(custom_list)
       
        # Prix
        $data_item[i].unshift(item.price)
       
        # Description
        if string[0] != nil
          $data_item[i].unshift(string[0])
        else
          $data_item[i].unshift("")
        end
       
        # Poche
        case item.element_set[0]
        when 25
          $data_item[i].unshift("ITEM")
        when 26
          $data_item[i].unshift("DRUG") # Médicament
        when 27
          $data_item[i].unshift("BALL")
        when 28
          $data_item[i].unshift("TECH") # CT & CS
        when 29
          $data_item[i].unshift("BERRY") # BAIES
        when 30
          $data_item[i].unshift("LETTER")
        when 31
          $data_item[i].unshift("COMBAT") # Objet Combat
        when 32
          $data_item[i].unshift("KEY")
        else
          $data_item[i].unshift("NOIGRUME")
        end
       
        $data_item[i].unshift(item.icon_name)
       
        $data_item[i].unshift(item.name)
       
        $data_item[i][8] = [item.recover_hp_rate, item.recover_hp, item.recover_sp_rate, item.recover_sp]
        $data_item[i][9] = item.minus_state_set
       
        if $data_item[i][7] == nil
          $data_item[i][7] = {}
        end
       
        $data_item[i][7]["recover_hp_rate"] = item.recover_hp_rate
        $data_item[i][7]["recover_hp"] = item.recover_hp
        $data_item[i][7]["recover_pp_all"] = item.recover_sp_rate
        $data_item[i][7]["recover_pp"] = item.recover_sp
        $data_item[i][7]["recover_state"] = item.minus_state_set
       
        if item.common_event_id != 0
          $data_item[i][7]["event"] = item.common_event_id
        end
       
      end
    else
      $data_item = load_data("Data/data_item.rxdata")
    end
  end
 
 
  #============================================================================= 
  # Item
  #============================================================================= 
  # Inspection de $data_item
  #   renvoie les infos nécessaires sur un objet
  #   par la connaissance de son id
  #   marche en parallèle à Pokemon_Party_Menu
  #
  # (Ex: $item.methode(id))
  #============================================================================= 
  class Item
    def self.name(id)
      if id == 0
        return "Aucun"
      end
      return $data_item[id][0]
    end
   
    def self.icon(id)
      if id == 0
        return "return.png"
      end
      return $data_item[id][1]
    end
   
    def self.descr(id)
      if id == 0
        return "Aucune."
      end
      return $data_item[id][3]
    end
   
    def self.price(id)
      if id == 0
        return 0
      end
      return $data_item[id][4]
    end
   
    def self.socket(id)
      socket = $data_item[id][2]
      case socket
      when "ITEM"
        return 1
      when "DRUG"
        return 2         
      when "BALL"
        return 3
      when "TECH"
        return 4
      when "BERRY"
        return 5
      when "LETTER"
        return 6
      when "COMBAT"
        return 7
      when "KEY"
        return 8     
      when "NOIGRUME"
        return 9
      end     
      return 1
    end
   
    # [ tenable/jetable, usage limité, usage en map, usage en combat, usage sur pokémon, apte/non apte]
    def self.profile(id)
      return $data_item[id][5]
    end
   
    def self.battle_usable?(id)
      return profile(id)[3]
    end
   
    def self.map_usable?(id)
      return profile(id)[2]
    end
   
    def self.limited_use?(id)
      return profile(id)[1]
    end
   
    def self.holdable?(id)
      return profile(id)[0]
    end
   
    def self.soldable?(id)
      return profile(id)[0]
    end
   
    def self.use_on_pokemon?(id)
      return profile(id)[4]
    end
   
    def self.item_able_mode?(id)
      return profile(id)[5]
    end
   
    def self.use_string(id)
      return $data_item[id][6]
    end   
   
    def self.data(id) # Renvoie Hash
      return $data_item[id][7]
    end
   
    def self.log_data_A(id)
      return $data_item[id][8]
    end
   
    def self.log_data_B(id)
      return $data_item[id][9]
    end
   
    def self.log_data_C(id)
      return $data_item[id][9]
    end
   
    def self.id(string)
      for item in $data_item
        if item != nil
          if string == item[0]
            return $data_item.index(item)
          end
        end
      end
      return 0
    end
   
   
    def self.able?(id, pokemon)
      # Analyse data
      if data(id) != nil
        if data(id)["stone"]
          if pokemon.evolve_check("stone", name(id))
            return true
          end
          #list = pokemon.evolve_list
          #for i in 1..list.length-1
          #  for j in 1..list[i].length-1
          #    if list[i][j][0] == "stone" # Paramètre évolution
          #      if list[i][j][1] == name(id) # Nom de la pierre si le param est bon
          #        return true
          #      end
          #    end
          #  end
          #end
        end
        if data(id)["ct"] != nil
          list = pokemon.skills_allow
          if list.include?(data(id)["ct"][0]) # ID de la CT
            return true
          end
        end
        if data(id)["cs"] != nil
          list = pokemon.skills_allow
          if list != nil
            if list.include?([data(id)["cs"][0]]) # [ID de la CS]
              return true
            end
          end
        end
      end
      return false
    end
   
   
    def self.effect(id)
      has_effect = false
      return_map = false
     
      if use_on_pokemon?(id)
        return [false, "Erreur."]
      end
     
      if data(id) != nil
        if data(id)["repel"] != nil
          has_effect = true
          $pokemon_party.repel_count += data(id)["repel"]
        end
        if data(id)["ball"] != nil
          has_effect = true
        end
        if data(id)["event"] != nil
          has_effect = true
          return_map = true
          $game_temp.common_event_id = data(id)["event"]
          $scene = Scene_Map.new
        end
      end
     
      if not(has_effect)
        return [false, "Ce n'est pas le moment d'utiliser ça.", false]
      end
     
      return [true, sprintf(use_string(id), Player.name), return_map]
    end
   
     
   
    def self.effect_on_pokemon(id, pokemon, scene) # renvoie [utilisé, texte]
      _name = pokemon.given_name
      _amount = 0
      # Vérification de cible
      if not(use_on_pokemon?(id))
        return [false, "Erreur."]
      end
     
      # ---------------------------------------------------
      # Cycle des effets
      has_effect = false
      heal_status = false
      heal_state = false
      heal = false
      # ---------------------------------------------------
      if data(id) != nil
        if data(id)["level_up"] != nil
          has_effect = true
          for i in 1..data(id)["level_up"]
            if pokemon.level >= MAX_LEVEL
              has_effect = false
              break
            end
            pokemon.level_up(scene)
            if pokemon.evolve_check != false
              scenebis = POKEMON_S::Pokemon_Evolve.new(pokemon, pokemon.evolve_check, scene.z_level + 300)
              scenebis.main
            end
          end
        end
        if data(id)["boost"] != nil
          list = [0,0,0,0,0,0]
          list[data(id)["boost"]] = 10
          has_effect = pokemon.add_bonus(list)
        end
        if data(id)["battle_boost"] != nil
          case data(id)["battle_boost"]
          when 0 #Atk
            amount = pokemon.change_atk(1)
          when 1 # Dfe
            amount = pokemon.change_dfe(1)
          when 2
            amount = pokemon.change_spd(1)
          when 3
            amount = pokemon.change_ats(1)
          when 4
            amount = pokemon.change_dfs(1)
          when 5
            amount = pokemon.change_eva(1)
          when 6
            amount = pokemon.change_acc(1)
          end
          if amount > 0
            has_effect = true
            pokemon.raise_loyalty
          end
        end
       
        if data(id)["stone"] != nil
          has_effect = true
          evolve_id = pokemon.evolve_check("stone", name(id))
          scenebis = POKEMON_S::Pokemon_Evolve.new(pokemon, evolve_id, scene.z_level + 300, true)
          scenebis.main
        end
       
        if data(id)["ct"]
          has_effect = true
          skill_id = data(id)["ct"][1]
          if not(pokemon.skill_learnt?(skill_id))
            scenebis = POKEMON_S::Pokemon_Skill_Learn.new(pokemon, skill_id, scene)
            scenebis.main
            return [scenebis.return_data, ""]
          else
            return [false, pokemon.name + " connaît déjà " + Skill_Info.name(skill_id) + '.' ]
          end
        end
       
        if data(id)["cs"]
          has_effect = true
          skill_id = data(id)["cs"][1]
          if not(pokemon.skill_learnt?(skill_id))
            scenebis = POKEMON_S::Pokemon_Skill_Learn.new(pokemon, skill_id, scene)
            scenebis.main
            return [scenebis.return_data, ""]
          else
            return [false, pokemon.name + " connaît déjà " + Skill_Info.name(skill_id) + '.' ]
          end
        end
     
        # ---------------------------------------------------
        # Cycle de soin des PP
        # Soin chiffré de toutes les attaques
        if data(id)["recover_pp_all"] == 1
          value = 0
          for i in 0..pokemon.skills_set.length-1
            value += pokemon.refill_skill(i, data(id)["recover_pp"])
          end
          if value > 0
            has_effect = true
          end
        # Soin d'une attaque == appel de skill
        elsif data(id)["recover_pp_all"] == 0 and data(id)["recover_pp"] > 0
          index = pokemon.skill_selection
          # N'a pas utilisé, retour au Sac
          if index == -1
            return [false, ""]
          end
          _amount = pokemon.refill_skill(index, data(id)["recover_pp"])
          # Si le skill visé n'est pas plein
          if _amount > 0
            has_effect = true
          end
        end
     
        # ---------------------------------------------------
        # Cycle de soin
        # Soin par pourcentage
        _amount += pokemon.max_hp * data(id)["recover_hp_rate"] / 100
        # Soin par points
        _amount += data(id)["recover_hp"]
        _amount = [pokemon.max_hp - pokemon.hp, _amount].min
       
        if data(id)["recover_hp_rate"] + data(id)["recover_hp"] > 0
          heal = true
        end
       
        if _amount == 0
          heal = false
        end
        # En cas de Pokémon mort: Ne fonctionne pas, excepté si passage dans
        #   cycle de rappel
        if pokemon.dead?
          heal = false
        end
        # ---------------------------------------------------
     
        # ---------------------------------------------------
        # Cycle de rappel
        if data(id)["recover_state"].include?(9)
          if pokemon.dead?
            heal = true
          else
            heal = false
          end
        end
     
     
        # ---------------------------------------------------
        # Cycle de soin de statut
        # Statuts
        if data(id)["recover_state"].include?(pokemon.status)
          heal_status = true
        end
        # Confusion
        if data(id)["recover_state"].include?(6) and pokemon.confused?
          heal_state = true
        end
       
        # ---------------------------------------------------
        # Effets discrets
        if data(id)["loyalty"] != nil
          loyalty_pts = data(id)["loyalty"]
          if loyalty_pts < 0
            if pokemon.loyalty >= 200
              pokemon.loyalty += loyalty_pts - 5
            else
              pokemon.loyalty += loyalty_pts
            end
          else
            if pokemon.loyalty < 100
              pokemon.loyalty += loyalty_pts
            elsif pokemon.loyalty < 200 and loyalty_pts > 1
              pokemon.loyalty += loyalty_pts - 2
            elsif loyalty_pts > 2
              pokemon.loyalty += loyalty_pts - 3
            end
          end
        end
       
       
       
      end
      # ---------------------------------------------------
     
      # ---------------------------------------------------
      # Si il n'y a aucun effet
      # ---------------------------------------------------
      if not(heal_status or heal_state or heal or has_effect)
        return [false, "Ca n'aura aucun effet."]
      end       
     
      # ---------------------------------------------------
      # Effets nécessitant le rafraichissement de la fenêtre
      # ---------------------------------------------------
      scene.item_refresh
      Graphics.update
     
      if heal_state
        pokemon.cure_state
      end
     
      if heal_status
        pokemon.cure
      end
     
      # Animation de soin (pas de condition pour que Rappel fonctionne)
      if heal
        for i in 1.._amount
          pokemon.hp += 1
          scene.hp_refresh
          if pokemon.hp == 1 # Vient de sortir du K.O.
            scene.refresh
          end
          Graphics.update
        end
      end
     
      return [true, sprintf(use_string(id), _name, _amount) ]
    end
   
  end
 
end


Pokemon_Party_Menu
Code:
#==============================================================================
# ■ Pokemon_Party_Menu
# Pokemon Script Project - Krosk
# 18/07/07
# 25/02/10 - Palbolsky
#-----------------------------------------------------------------------------
# Scène modifiable mais complexe
#-----------------------------------------------------------------------------
# Menu de gestion d'équipe
#-----------------------------------------------------------------------------

module POKEMON_S
  #-----------------------------------------------------------------------------
  # Pokemon_Party_Menu
  #-----------------------------------------------------------------------------
  # Scene
  #   mode: "map", "battle", "give_item"
  #-----------------------------------------------------------------------------
 
 
  class Pokemon_Party_Menu
    attr_accessor :z_level
    attr_accessor :mode
    def initialize(menu_index = 0, z_level = 100, mode = "map", data = nil)
      @menu_index = menu_index     
      @z_level = z_level
      @data = data
      @mode = mode # "map", "battle", "hold", "item_use", "item_able", "selection"
      # battle_data: informations diverses du combat en cours
      if $battle_var.in_battle
        @order = $battle_var.battle_order
      else
        @order = [0,1,2,3,4,5]
      end
    end
   
    def wait_hit
      loop do
        Graphics.update
        Input.update
        if Input.trigger?(Input::C)
          $game_system.se_play($data_system.decision_se)
          break
        end
      end
    end
    #-----------------------------------------------------------------------------
    # Déroulement de la scène
    #-----------------------------------------------------------------------------
    def main
      Graphics.freeze         
     
      # Background       
     
      @background = Sprite.new
      @background.bitmap = RPG::Cache.picture("Partyfond.png")
      @background.x = 136 - 123
      @background.y = 227
      @background.z = 25
     
      @background_sup = Sprite.new
      @background_sup.bitmap = RPG::Cache.picture("Partyfond_sup.png")
      @background_sup.x = 13
      @background_sup.y = 13
      @background_sup.z = 25#5
     
      if $pokemon_party.size > 0
        @cache1 = Sprite.new
        @cache1.bitmap = RPG::Cache.picture("CachePokemon.png")
        @cache1.x = 13
        @cache1.y = 234
        @cache1.z = 30 #10
        if $pokemon_party.size > 1
          @cache2 = Sprite.new
          @cache2.bitmap = RPG::Cache.picture("CachePokemon.png")
          @cache2.x = 141
          @cache2.y = 242
          @cache2.z = 30
          if $pokemon_party.size > 2
            @cache3 = Sprite.new
            @cache3.bitmap = RPG::Cache.picture("CachePokemon.png")
            @cache3.x = 13
            @cache3.y = 281
            @cache3.z = 30
            if $pokemon_party.size > 3
              @cache4 = Sprite.new
              @cache4.bitmap = RPG::Cache.picture("CachePokemon.png")
              @cache4.x = 141
              @cache4.y = 290
              @cache4.z = 30
              if $pokemon_party.size > 4
                @cache5 = Sprite.new
                @cache5.bitmap = RPG::Cache.picture("CachePokemon.png")
                @cache5.x = 13
                @cache5.y = 329
                @cache5.z = 30
                if $pokemon_party.size > 5
                  @cache6 = Sprite.new
                  @cache6.bitmap = RPG::Cache.picture("CachePokemon.png")
                  @cache6.x = 141
                  @cache6.y = 338
                  @cache6.z = 30
                end
              end
            end
          end
        end
      end
           
      # Ensemble de fenêtres individuelles pour chaque Pokémon
      @party_window = []
      for i in 0..($pokemon_party.size-1)
        pokemon = $pokemon_party.actors[@order[i]]
        @party_window.push(Pokemon_Party_Window.new(pokemon, i, @z_level, @mode, @data))
      end
     
      # @on_switch: indicateur d'ordre de permutation
      #   -1: pas d'ordre
      #   sinon: désigne le pokémon à permuter
      @on_switch = -1
     
      @action_window = Window_Command.new(74, ["Annuler"])
      @action_window.z = @z_level + 10
      @action_window.x = 316 - 123
      @action_window.visible = false
      @action_window.active = false
     
      @item_window = Window_Command.new(74, ["Donner", "Prendre", "Annuler"])
      @item_window.z = @z_level + 102
      @item_window.x = 316 - 123
      @item_window.y = 232 - 3 - @item_window.height - 20 + 214 - 7
      @item_window.visible = false
      @item_window.active = false
     
      @text_window = Window_Base.new(246, 413, 391, 64)
      @text_window.contents = Bitmap.new(602, 64)
      @text_window.z = @z_level + 2000
      @text_window.contents.font.name = $fontface
      @text_window.contents.font.size = $fontsize
      @text_window.contents.font.color = @text_window.normal_color
      @text_window.opacity = 0
     
      refresh
     
      Graphics.transition
      loop do
        Graphics.update
        Input.update
        if @action_window.active and @on_switch == -1
          if $battle_var.in_battle
            update_action_battle
          else
            update_action
          end
        elsif @item_window.active
          update_item
        else
          update
        end
        if @done
          break
        end
      end
      Graphics.freeze
      @text_window.visible = false
      @background.dispose
      @background_sup.dispose
      if $pokemon_party.size > 0
              @cache1.dispose
        if $pokemon_party.size > 1
                @cache2.dispose
          if $pokemon_party.size > 2
                  @cache3.dispose
            if $pokemon_party.size > 3
                    @cache4.dispose
              if $pokemon_party.size > 4
                      @cache5.dispose
                if $pokemon_party.size > 5
                        @cache6.dispose
                      end
                    end
                  end
                end
              end
            end
           
      for window in @party_window
        window.dispose
      end
      if @action_window != nil
        @action_window.dispose
      end
      @text_window.dispose
      @item_window.dispose
      @party_window = nil         
     
    end
   
    def update     
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        if @mode == "selection"
          @done = true
          @return_data = -1
          return
        end
       
        if @mode == "hold"
          @done = true
          @return_data = [0, false, 0, false]
          return
        end
       
        if @mode == "item_use" or @mode == "item_able"
          @done = true
          @return_data = [0, false]
          return
        end
       
        if @on_switch == -1 and not($battle_var.in_battle)
          $game_system.se_play($data_system.cancel_se)                   
          $scene = Pokemon_Menu.new(1)         
          @done = true
          return
        elsif @on_switch == -1 and $battle_var.in_battle
          if $pokemon_party.actors[@order[0]].dead?
            $game_system.se_play($data_system.buzzer_se)
            return
          else           
            $game_system.se_play($data_system.cancel_se)
            $battle_var.action_id = 0
            # Pas d'action
            @return_data = [0]
            @done = true
            return
          end
        else
          # Annulation de la commande en cours ie @on_switch =/ 1
          $game_system.se_play($data_system.cancel_se)
          @action_window.active = true
          @action_window.visible = true
          @on_switch = -1
          refresh
          return
        end
      end

#------------------------------------------------------------------------
# Navigation Menu - Palbolsky
# A ne pas modifier de préférence.
#-------------------------------------------------------------------------
# Rappel des dispositions des fenêtres :
#  -------    -------
# |   0   |  |   1   |
#  =======    =======
# |   2   |  |   3   |
#  =======    =======
# |   4   |  |   5   |
#  -------    -------
#------------------------------------------------------------------------
     

      if @menu_index == 0 # POKéMON en tête de liste         
         if Input.repeat?(Input::LEFT) and $pokemon_party.size > 5                     
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 5
           refresh
           return
         elsif Input.repeat?(Input::LEFT) and $pokemon_party.size > 4
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 4
           refresh
           return
         elsif Input.repeat?(Input::LEFT) and $pokemon_party.size > 3
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 3
           refresh
           return
         elsif Input.repeat?(Input::LEFT) and $pokemon_party.size > 2
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 2
           refresh
           return
         elsif Input.repeat?(Input::LEFT) and $pokemon_party.size > 1
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 1
           refresh
           return
         end         
         if Input.repeat?(Input::UP) and $pokemon_party.size > 4                     
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 4
           refresh
           return
         elsif Input.repeat?(Input::UP) and $pokemon_party.size > 2
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 2
           refresh
           return
         end                   
         if Input.repeat?(Input::RIGHT) and $pokemon_party.size > 1                   
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 1
           refresh
           return       
         end             
         if Input.repeat?(Input::DOWN) and $pokemon_party.size > 2                     
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 2
           refresh
           return         
         end       
       end
     
               
# --------------------------------------------------------------------------------------       

      if @menu_index == 1 # POKéMON en haut à droite
         if Input.repeat?(Input::LEFT) 
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return
         end
         if Input.repeat?(Input::UP) and $pokemon_party.size > 5
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 5
           refresh
           return
         elsif Input.repeat?(Input::UP) and $pokemon_party.size > 3
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 3
           refresh
           return
         end
         if Input.repeat?(Input::RIGHT) and $pokemon_party.size > 2
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 2
           refresh
           return
         elsif Input.repeat?(Input::RIGHT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return
         end
         if Input.repeat?(Input::DOWN) and $pokemon_party.size > 3
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 3
           refresh
           return
         end
       end
# --------------------------------------------------------------------------------------

      if @menu_index == 2 # POKéMON au milieu à gauche
         if Input.repeat?(Input::LEFT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 1
           refresh
           return
         end
         if Input.repeat?(Input::UP)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return
         end
         if Input.repeat?(Input::RIGHT) and $pokemon_party.size > 3
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 3
           refresh
           return
         elsif Input.repeat?(Input::RIGHT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return
         end
         if Input.repeat?(Input::DOWN) and $pokemon_party.size > 4
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 4
           refresh
           return
         elsif Input.repeat?(Input::DOWN)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return
         end
       end
# --------------------------------------------------------------------------------------

      if @menu_index == 3 # POKéMON au milieu à droite
         if Input.repeat?(Input::LEFT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 2
           refresh
           return
         end
         if Input.repeat?(Input::UP)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 1
           refresh
           return
         end
         if Input.repeat?(Input::RIGHT) and $pokemon_party.size > 4
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 4
           refresh
           return
         elsif Input.repeat?(Input::RIGHT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return         
         end
         if Input.repeat?(Input::DOWN) and $pokemon_party.size > 5
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 5
           refresh
           return
         elsif Input.repeat?(Input::DOWN)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 1
           refresh
           return
         elsif Input.repeat?(Input::RIGHT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 1
           refresh
           return         
         end
       end
# --------------------------------------------------------------------------------------

      if @menu_index == 4 # POKéMON en bas à gauche
         if Input.repeat?(Input::LEFT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 3
           refresh
           return
         end
         if Input.repeat?(Input::UP)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 2
           refresh
           return
         end
         if Input.repeat?(Input::RIGHT) and $pokemon_party.size > 5
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 5
           refresh
           return
         elsif Input.repeat?(Input::RIGHT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return
         end
         if Input.repeat?(Input::DOWN)           
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return
         end
       end
# --------------------------------------------------------------------------------------

      if @menu_index == 5 # POKéMON en bas à droite
         if Input.repeat?(Input::LEFT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 4
           refresh
           return
         end
         if Input.repeat?(Input::UP)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 3
           refresh
           return
         end
         if Input.repeat?(Input::RIGHT)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 0
           refresh
           return
         end
         if Input.repeat?(Input::DOWN)
           $game_system.se_play($data_system.cursor_se)
           @menu_index = 1
           refresh
           return
         end
       end
# --------------------------------------------------------------------------------------

       if Input.trigger?(Input::C)
        if @mode == "selection"
          $game_system.se_play($data_system.decision_se)
          @done = true
          @return_data = @menu_index         
        return
        end
     
       
        if @mode == "hold"
          $game_system.se_play($data_system.decision_se)
          pokemon = $pokemon_party.actors[@menu_index]
          # Ne porte pas d'item
          if pokemon.item_hold == 0
            pokemon.item_hold = @data
            @return_data = [@data, true, 0, false]
            refresh
            draw_text(pokemon.given_name + " tient " + Item.name(@data) + ".")
            Input.update
            until Input.trigger?(Input::C)
              Input.update
              Graphics.update
            end
          # Porte un item 
          elsif pokemon.item_hold != 0
            replaced_item = pokemon.item_hold
            pokemon.item_hold = @data
            @return_data = [@data, true, replaced_item, true]
            refresh
            if @data == replaced_item
              draw_text(pokemon.given_name + " tient déjà " + Item.name(@data) + "!")
            else
              draw_text(Item.name(replaced_item) + " est remplacé par")
              wait_hit
              draw_text(Item.name(@data) + ".")
            end
            Input.update
            until Input.trigger?(Input::C)
              Input.update
              Graphics.update
            end
          end
          @done = true
          return
        end
       
        if @mode == "item_use" or @mode == "item_able"
          if $battle_var.in_battle
            pokemon = $pokemon_party.actors[$battle_var.battle_order[@menu_index]]
          else
            pokemon = $pokemon_party.actors[@menu_index]
          end
          if @mode == "item_able" and not(Item.able?(@data, pokemon))
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          #Audio.se_play("Audio/SE/Soin Objet")
          result = Item.effect_on_pokemon(@data, pokemon, self)
          # result[0] = item utilisé ou non
          # result[1] text
          @return_data = [@data, result[0]]
          refresh
          if result[1] != ""
            draw_text(result[1])
            Input.update
            until Input.trigger?(Input::C)
              Input.update
              Graphics.update
            end
          end
          @done = true
          return
        end
       
        $game_system.se_play($data_system.decision_se)
        if @on_switch == -1
          # Selection d'un Pokémon
          if $battle_var.in_battle
            set_action_battle_window
            refresh
          else
            set_action_window
            refresh
          end
          refresh
        else
          # Permutation
          if not($battle_var.in_battle)
            $pokemon_party.switch_party(@on_switch, @menu_index)
          end
          @action_window.active = false
          @action_window.visible = false
          @on_switch = -1
          reset_party_window
          refresh
        end
        return
      end
    end
   
    def update_action
      @action_window.update
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        @action_window.visible = false
        @action_window.active = false
        text_refresh
      end
     
      if Input.trigger?(Input::C)       
        case @action_window.commands[@action_window.index]
        when "RESUME"
          pokemon = $pokemon_party.actors[@menu_index]
          @action_window.visible = false
          @text_window.visible = false
          scene = Pokemon_Status.new(pokemon, @menu_index, @z_level + 100)
          scene.main
          @menu_index = scene.return_data
          refresh
          Graphics.transition
        when "ORDRE"
          $game_system.se_play($data_system.decision_se)
          # Permutation active
          @on_switch = @menu_index
          @action_window.visible = false
          @action_window.active = false
          refresh
        when "OBJET"
          $game_system.se_play($data_system.decision_se)
          @action_window.visible = false
          @action_window.active = false
          @item_window.active = true
          @item_window.visible = true
          text_refresh
        when "ANNULER"
          $game_system.se_play($data_system.decision_se)
          @action_window.visible = false
          @action_window.active = false
          text_refresh
        else # Attaque         
          $game_system.se_play($data_system.decision_se)
          @action_window.visible = false
          @action_window.active = false
          name = @action_window.commands[@action_window.index]
          $game_temp.common_event_id = Skill_Info.map_use(Skill_Info.id(name))
          $on_map_call = true
          $scene = Scene_Map.new
          @done = true
        end
        return
      end
    end
   
    def update_item
      @item_window.update
      if Input.trigger?(Input::C)
        case @item_window.index
        # Donner
        when 0
          pokemon = $pokemon_party.actors[@menu_index]
          $game_system.se_play($data_system.decision_se)
          @action_window.visible = false
          @text_window.visible = false
          @item_window.visible = false
          scene = Pokemon_Item_Bag.new($pokemon_party.bag_index, @z_level + 100, "hold")
          scene.main
          return_data = scene.return_data
          item = return_data[0]
          hold = return_data[1]
          former_item = pokemon.item_hold
          @item_window.visible = false
          @item_window.active = false
          refresh
          if hold
            $pokemon_party.drop_item(item)
            if former_item == 0
              draw_text(pokemon.given_name + " est équippé de " + Item.name(item) + ".")
            else
              $pokemon_party.add_item(former_item)
              draw_text(Item.name(former_item) + " est remplacé par " + Item.name(item) + ".")
            end
            pokemon.item_hold = item
            Input.update
            Graphics.transition
            until Input.trigger?(Input::C)
              Input.update
              Graphics.update
            end
          else
            Graphics.transition
          end
          refresh
          return
        # Prendre
        when 1
          @item_window.visible = false
          @item_window.active = false
          pokemon = $pokemon_party.actors[@menu_index]
          # Pas d'item
          if pokemon.item_hold == 0
            $game_system.se_play($data_system.buzzer_se)
            draw_text(pokemon.given_name + " ne tient rien.")
          else
            $game_system.se_play($data_system.decision_se)
            $pokemon_party.add_item(pokemon.item_hold)
            former_item = pokemon.item_hold
            pokemon.item_hold = 0
            refresh
            draw_text(Item.name(former_item) + " récupéré de " + pokemon.given_name + ".")
          end
          Input.update
          until Input.trigger?(Input::C)
            Input.update
            Graphics.update
          end
          refresh
          $game_system.se_play($data_system.decision_se)
        # Annuler
        when 2
          $game_system.se_play($data_system.decision_se)
          @item_window.active = false
          @item_window.visible = false
          @action_window.active = true
          @action_window.visible = true
          text_refresh
        end
      end
     
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        @item_window.active = false
        @item_window.visible = false
        @action_window.active = true
        @action_window.visible = true
        text_refresh
      end
    end
   
    def skill_selection(pokemon)
      # Rafraihcisemment fenetre de texte
      @skill_selection == true
      text_refresh
      @skill_selection == false
      # Création liste skill
      list = []
      for skill in pokemon.skills_set
        list.push(skill.name)
      end
      @skill_window = Window_Command.new(74, list)
      @skill_window.y = 232 - @skill_window.height - 3 + 214 - 7
      @skill_window.x = 316
      @skill_window.z = @z_level + 12
      # Selection
      loop do
        Input.update
        Graphics.update
        @skill_window.update
        if Input.trigger?(Input::C)
          @skill_index = @skill_window.index         
          break
        end
        if Input.trigger?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          @skill_window.dispose
          return false
          break
        end
      end
      @skill_window.dispose
      return @skill_index
    end
   
    def refresh
      for window in @party_window
        window.refresh_index(@menu_index)
        window.switch(@on_switch)
        window.refresh
      end
      text_refresh
    end
   
    def text_refresh
      pokemon = $pokemon_party.actors[@menu_index]
      @text_window.contents.clear     
      @text_window.width = 178
      @text_window.height = 45
      @text_window.x = 11
      @text_window.y = 424 - @text_window.height
      width = @text_window.width - 32
      height = @text_window.height - 32
      if @on_switch != -1
        @text_window.visible = true
        @text_window.contents.draw_text(0,0,width,height, "Le mettre où ?")
      elsif @action_window.active

        @text_window.visible = true
        @action_window.visible = true
        @text_window.contents.draw_text(0,0,width,height, "Que faire avec " +  pokemon.given_name + " ?")
      elsif @item_window.active

        @text_window.visible = true
        @text_window.contents.draw_text(0,0,width,height, "Que faire avec un objet ?")
      elsif @mode == "hold"

        @text_window.visible = true
        @text_window.contents.draw_text(0,0,width,height, "Donner à quel Pokémon ?")
      elsif @skill_selection == true
        @text_window.visible = true
        @text_window.contents.draw_text(0,0,width,height, "Laquelle restaurer ?")
      elsif @mode == "item_use" or @mode == "item_able"
        @text_window.visible = true
        @text_window.contents.draw_text(0,0,width,height, "Utiliser sur quel Pokémon ?")
      else
        @text_window.visible = true
        @text_window.contents.draw_text(0,0,width,height, "Choisissez un Pokémon.")
      end
    end
   
    def draw_text(string = "", string2 = "")
      @text_window.width = 210
      @text_window.x = 11
      @text_window.contents.clear
      if string2 == ""
        @text_window.height = 45
        @text_window.y = 424 - @text_window.height
        width = @text_window.width#-32
        height = @text_window.height - 32
        @text_window.contents.draw_text(0,0,width,height,string)
      else
        @text_window.height = 45
        @text_window.y = 424 - @text_window.height
        width = @text_window.width
        height = @text_window.height - 32
        @text_window.contents.draw_text(0,0,width,height,string)
        @text_window.contents.draw_text(0,height,width,height,string2)
      end
    end


    def located_refresh
      for window in @party_window
        window.refresh_index(@menu_index)
        window.switch(@on_switch)
      end
     
      for i in @menu_index-1..@menu_index+1
        if @party_window[i] != nil
          @party_window[i].refresh
        end
      end
    end
   
    def hp_refresh
      @party_window[@menu_index].hp_refresh
    end
   
    def item_refresh
      @party_window[@menu_index].refresh
    end
   
    def update_action_battle
      @action_window.update
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        @action_window.visible = false
        @action_window.active = false
        text_refresh
      end
      if Input.trigger?(Input::C)
        case @action_window.index
        when 0 # Rappel au combat du Poké sélectionné
          if @menu_index == 0 or $pokemon_party.actors[@order[@menu_index]].dead?
            # Le pokémon du premier rang et les morts ne peuvent etre envoyés
            $game_system.se_play($data_system.buzzer_se)
          else #NOTA
            if $battle_var.action_id == 0
              $battle_var.action_id = 2
            end
            # Changement
            @return_data = @menu_index
            @done = true
          end
        when 1 # Résumé
          pokemon = $pokemon_party.actors[@order[@menu_index]]
          @action_window.visible = false
          scene = Pokemon_Status.new(pokemon, @menu_index)
          scene.main
          @menu_index = scene.return_data
          refresh
          Graphics.transition
        when 2 # Annulation
          $game_system.se_play($data_system.cancel_se)
          @action_window.visible = false
          @action_window.active = false
          text_refresh
        end
        return
      end
    end
   
    def return_data
      return @return_data
    end
     
    def set_action_window
      list = []
      for skill in $pokemon_party.actors[@order[@menu_index]].skills_set
        if skill.map_use != 0
          list.push(Skill_Info.name(skill.id))
        end
      end
      list += ["RESUME", "ORDRE", "OBJET", "ANNULER"]
      if $pokemon_party.actors[@order[@menu_index]].egg
        list.delete("OBJET")
      end
      @action_window = Window_Command.new(93, list)
      @action_window.y = 232 - 20 - @action_window.height - 3 + 214 - 7
      @action_window.x = 297 - 123
      @action_window.z = @z_level + 103
    end
   
    def set_action_battle_window
      list = ["ECHANGER", "RESUME", "ANNULER"]
      @action_window = Window_Command.new(74, list)
      @action_window.y = 232 - 20 - @action_window.height - 3 + 214 - 7
      @action_window.x = 316 - 123
      @action_window.z = @z_level + 103
      if @menu_index == 0 or $pokemon_party.actors[@order[@menu_index]].dead?
        @action_window.disable_item(0)
      end
    end
   
    def reset_party_window # En permutation
      for window in @party_window
        window.dispose
      end
      @party_window = []
      for i in 0..($pokemon_party.size-1)
        pokemon = $pokemon_party.actors[@order[i]]
        @party_window.push(Pokemon_Party_Window.new(pokemon, i, @z_level, @mode, @data))
      end
      refresh
    end   
  end
   
 
  #-----------------------------------------------------------------------------
  # Pokemon_Party_Window
  #-----------------------------------------------------------------------------
  # Window_Base
  #-----------------------------------------------------------------------------
  # Fenetre individuelle de statut dans la gestion d'équipe
  # Modify by Palbolsky
  #-----------------------------------------------------------------------------
  class Pokemon_Party_Window < Window_Base
    def initialize(pokemon, index, z_level = 100, mode = nil, data = nil, menu = -1)
     
        @pokemon = pokemon
        @z_level = z_level       
       
        @icon = Sprite.new
        @icon.bitmap = RPG::Cache.battler(@pokemon.icon, 0)       
        @icon.z = @z_level + 100
        @icon.zoom_x = 0.5
        @icon.zoom_y = 0.5
       
        x = -123
        y = 194
       
      if index == 0 #Pokémon en tête de rang
        super(120+x, 24+y, 171, 82)
         @icon.x = 143+x
         @icon.y = 41+y
      end       
      if index == 1
        super(248+x, 32+y, 171, 82)
        @icon.x = 271+x
        @icon.y = 49+y
      end
      if index == 2                 
        super(120+x, 71+y, 171, 82)
        @icon.x = 143+x
        @icon.y = 88+y
      end
      if index == 3
        super(248+x, 80+y, 171, 82)
        @icon.x = 271+x
        @icon.y = 97+y
      end
      if index == 4
        super(120+x, 119+y, 171, 82)
        @icon.x = 143+x
        @icon.y = 136+y
      end
      if index == 5
        super(248+x, 128+y, 171, 82)
        @icon.x = 271+x
        @icon.y = 145+y
      end         
      self.contents = Bitmap.new(width - 32, height - 32)     
      self.opacity = 0
      self.z = z_level + 8
     
      @index = index #position de la fenêtre
      @menu_index = menu
      @on_switch = -1
      @mode = mode
      @data = data     
      refresh     
    end
   
    def main
      Graphics.transition     
      loop do       
        Graphics.update
        Input.update
        update
        if $scene != self
          break
        end
      end
      Graphics.freeze
      @icon.dispose
    end   
   
    #fonction qui sert à importer l'information de la position du curseur
    def refresh_index(index)
      @menu_index = index
    end
   
    def switch(value)
      @on_switch = value
    end
   
    def hp_refresh
      if @pokemon.egg
        return
      end
      if @index == 0
        level = @pokemon.hp / @pokemon.maxhp_basis.to_f
        draw_hp_bar(21, 84, level)
        src_rect = Rect.new(93, 105, 350, 152)
        if @index == @on_switch or (@on_switch != -1 and @menu_index == @index)
          # Cadre vert sélectionné
          bitmap = RPG::Cache.picture("cadretetem.png")       
        elsif @menu_index == @index
          # Cadre bleu hover
          bitmap = @pokemon.dead? ? RPG::Cache.picture("cadretetedl.png") : RPG::Cache.picture("cadretetel.png")
        else       
          # Cadre bleu
          bitmap = @pokemon.dead? ? RPG::Cache.picture("cadreteted.png") : RPG::Cache.picture("cadretete.png")
        end
        self.contents.font.name = "Pokemon Platine Special" 
        self.contents.font.size = 6
        self.contents.blt(93, 105, bitmap, src_rect, 192)
        draw_text_bis(0, 99-2, 215, $fs, @pokemon.hp.to_s + "/" + @pokemon.maxhp_basis.to_s, 2)     
      else
        level = @pokemon.hp / @pokemon.maxhp_basis.to_f
        draw_hp_bar(160, 9, level, true)
        src_rect = Rect.new(211, 30, 350, 152)
        if @on_switch == @index or (@on_switch != -1 and @menu_index == @index)
          # Cadre vert sélectionné
          bitmap = RPG::Cache.picture("cadrepartym.png")         
        elsif @menu_index == @index
          # Cadre bleu hover
          bitmap = (@pokemon.dead? and not @pokemon.egg) ? RPG::Cache.picture("cadrepartydl.png") : RPG::Cache.picture("cadrepartyl.png")         
        else
          # Cadre bleu
          bitmap = @pokemon.dead? ? RPG::Cache.picture("cadrepartyd.png") : RPG::Cache.picture("cadreparty.png")
        end
        self.contents.blt(211, 30, bitmap, src_rect, 192)
        self.contents.font.name = "Pokemon Platine Special" 
        self.contents.font.size = 6
        draw_text_bis(0, 24-2, 330, $fs, @pokemon.hp.to_s + "/" + @pokemon.maxhp_basis.to_s, 2)
      end     
    end   
    def refresh     
      if @pokemon.given_name == @pokemon.name
          @pokemon_nom = @pokemon.given_name
        else
          @pokemon_nom = @pokemon.given_name
        end
      self.contents.clear
      if @index == 0
        # fond
        src_rect = Rect.new(0, 0, 350, 152)
        if @index == @on_switch or (@on_switch != -1 and @menu_index == @index)
          # Cadre vert sélectionné
          bitmap = RPG::Cache.picture("cadretetem.png")
        elsif @menu_index == @index
          # Cadre bleu hover
          bitmap = (@pokemon.dead? and not @pokemon.egg) ? RPG::Cache.picture("cadretetedl.png") : RPG::Cache.picture("cadretetel.png")             
        else
          # Cadre bleu
          bitmap = (@pokemon.dead? and not @pokemon.egg) ? RPG::Cache.picture("cadreteted.png") : RPG::Cache.picture("cadretete.png")
        end
        self.contents.blt(0, 0, bitmap, src_rect, 192)   
   
        # Objet
        if @pokemon.item_hold != 0
          src_rect = Rect.new(-18, -5, 31, 21)
          bitmap = RPG::Cache.picture("item_hold.png")
          self.contents.blt(50, 50, bitmap, src_rect, 255)
        end
       
        # Nom, niveau, genre
        self.contents.font.name = "Pokemon DP" 
        self.contents.font.size = 15
        draw_text_bis(44, 9, 170, $fs, @pokemon_nom)
        if @pokemon.egg
          return
        end       
        draw_gender(105, 11, @pokemon.gender)
        if (@pokemon.status > 0 and @pokemon.status < 6) or @pokemon.dead?
          string = "stat_team" + @pokemon.status.to_s + ".png"
          src_rect = Rect.new(0, 0, 60, 24)
          bitmap = RPG::Cache.picture(string)
          self.contents.blt(20, 36, bitmap, src_rect, 255)
        else
           self.contents.font.name = "Pokemon Platine Special" 
           self.contents.font.size = 6
          draw_text_bis(11, 33-2, 100, $fs, "N." + @pokemon.level.to_s)
        end
        # HP
        if @mode == "item_able" or ( @mode == "selection" and @data != nil )
          self.contents.font.name = "Pokemon DP" 
          self.contents.font.size = 15
          if Item.able?(@data, @pokemon)
            string = "APTE"
            draw_text(13, 31, 100, $fs, string, 2)
          else
            string = "INAPTE"
            draw_text(13, 31, 100, $fs, string, 2)
          end         
        else
          level = @pokemon.hp / @pokemon.maxhp_basis.to_f
          self.contents.font.name = "Pokemon Platine Special" 
          self.contents.font.size = 6
          draw_hp_bar(45, 25, level) # HP barre pkmn en tête de liste
          draw_text_bis(7, 33-2, 100, $fs, @pokemon.hp.to_s + "/" + @pokemon.maxhp_basis.to_s, 2)
        end     
       
      else # A partir d'ici tout s'applique au 5 autres fenêtres
       
        src_rect = Rect.new(0, 0, 350, 152)
        if @on_switch == @index or (@on_switch != -1 and @menu_index == @index)
          # Cadre vert sélectionné
          bitmap = RPG::Cache.picture("cadrepartym.png")       
        elsif @menu_index == @index
          # Cadre bleu hover
          bitmap = (@pokemon.dead? and not @pokemon.egg) ? RPG::Cache.picture("cadrepartydl.png") : RPG::Cache.picture("cadrepartyl.png")         
        else
          # Cadre bleu
          bitmap = (@pokemon.dead? and not @pokemon.egg) ? RPG::Cache.picture("cadrepartyd.png") : RPG::Cache.picture("cadreparty.png")
        end
        self.contents.blt(0, 0, bitmap, src_rect, 192)
       
        if @pokemon.item_hold != 0
          src_rect = Rect.new(-18, -5, 31, 21)
          bitmap = RPG::Cache.picture("item_hold.png")
          self.contents.blt(50, 50, bitmap, src_rect, 255)
        end
        self.contents.font.name = "Pokemon DP" 
        self.contents.font.size = 15
        draw_text_bis(44, 9, 170, $fs, @pokemon_nom)
        if @pokemon.egg
          return
        end       
       
        draw_gender(105, 11, @pokemon.gender)
        if (@pokemon.status > 0 and @pokemon.status < 6) or @pokemon.dead?
          string = "stat_team" + @pokemon.status.to_s + ".png"
          src_rect = Rect.new(0, 0, 60, 24)
          bitmap = RPG::Cache.picture(string)
          self.contents.blt(20, 36, bitmap, src_rect, 255)
        else
           self.contents.font.name = "Pokemon Platine Special" 
           self.contents.font.size = 6
          draw_text_bis(11, 33-2, 100, $fs, "N." + @pokemon.level.to_s)
        end
       
        if @mode == "item_able" or ( @mode == "selection" and @data != nil )
          self.contents.font.name = "Pokemon DP" 
          self.contents.font.size = 15
          if Item.able?(@data, @pokemon)
            string = "APTE"
            draw_text(13, 31, 100, $fs, string, 2)
          else
            string = "INAPTE"
            draw_text(13, 31, 100, $fs, string, 2)
          end         
        else
          level = @pokemon.hp / @pokemon.maxhp_basis.to_f
          draw_hp_bar(45, 25, level)
          draw_text_bis(7, 33-2, 100, $fs, @pokemon.hp.to_s + "/" + @pokemon.maxhp_basis.to_s, 2)
         
        end     
      end
    end
   
    def dispose
      @icon.dispose
      @icon = nil
      super       
    end
   
    def draw_hp_bar(x, y, level, small = false)
      src_rect = Rect.new(0, 0, 254, 39)
      bitmap = RPG::Cache.picture("hpbar_team.png")
      if small
        bitmap = RPG::Cache.picture("hpbar_team.png")
      end
      self.contents.blt(x, y, bitmap, src_rect, 255)   
      rect1 = Rect.new(x + 16, y + 3, level*48.to_i, 1)
      rect2 = Rect.new(x + 16, y + 4, level*48.to_i, 1)   
    if small
      rect1 = Rect.new(x + 117, y + 6, level*119.to_i, 3)
      rect2 = Rect.new(x + 117, y + 9, level*119.to_i, 5) 
      rect3 = Rect.new(x + 117, y + 13, level*119.to_i, 3)
      end
     
      if level < 0.1
        color1 = Color.new(248, 72, 56, 255)
        color2 = Color.new(248, 152, 152, 255)       
      elsif level >= 0.1 and level < 0.5
        color1 = Color.new(232, 168, 0, 255)
        color2 = Color.new(248, 216, 0, 255)       
      else
        color1 = Color.new(24, 192, 32, 255)
        color2 = Color.new(96, 248, 96, 255)       
      end
      self.contents.fill_rect(rect1, color2)
      self.contents.fill_rect(rect2, color1)
    end
   
    def draw_gender(x, y, gender)
      if gender == 1
        rect = Rect.new(0, 0, 18, 33)
        bitmap = RPG::Cache.picture("Maleb_equipe.png")
        self.contents.blt(x, y, bitmap, rect, 255)
      end
      if gender == 2
        rect = Rect.new(0, 0, 18, 33)
        bitmap = RPG::Cache.picture("Femaleb_equipe.png")
        self.contents.blt(x, y, bitmap, rect, 255)       
      end
    end   
  end
end


Pokemon_Item_Bag
Code:
#==============================================================================
# ■ Pokemon_Item_Bag
# Pokemon Script Project - Krosk
# 23/08/07
# 25/02/10 - Palbolsky
#-----------------------------------------------------------------------------
# Scène à ne pas modifier de préférence
#-----------------------------------------------------------------------------
# Interface du Sac
#-----------------------------------------------------------------------------
  #-------------------------------------------------------------
  # $data_item
  #   [Nom, Icone, Type, Description, Prix, Profil]
  #   Profil:  "BALL": usable en combat uniquement, tenable, jetable, limité
  #            "BATTLE" : usable en combat uniquement sur les Pokémons, tenable, jetable, limité (boosts stats en combat)
  #            "ITEM": usable en combat sur les Pokémons, en map, tenable, jetable, limité (Consommables tels Potions, etc)
  #            "HOLD": non usable, tenable, jetable, illimité (objets boostants les types)
  #            "PKMN": usable hors combat uniquement, sur les Pokémons, tenable, jetable, limité (super bonbon, boosts stats)
  #            "KEYITEM": non usable en combat, usable en map en interaction, non tenable, non jetable, usage illimité (Objets rares)
  #            "MAP" : usage en interaction, tenable, jetable, limité (repousse, flute repousse)
  #            "CS" / "HM" : non usable en combat, usable en map sur les Pokémons, non tenable, non jetable, usage illimité
  #-------------------------------------------------------------
  #------------------------------------------------------------ 
  #  @bag = [ paramètre, [], [], [], [], [], [], [], [] ]
  #  id: id objet, nombre: -1 pour objet utilisable à l'infini.
  #  paramètre : optionnel
  #  @bag[1] : Items, objets simples, sous la forme [id, nombre]
  #  @bag[2] : Médicaments, objets de soin, sous la forme [id, nombre]
  #  @bag[3] : Balles sous la forme [id, nombre]
  #  @bag[4] : CT/CS sous la forme [id, nombre]
  #  @bag[5] : Baies [id, nombre]
  #  @bag[6] : Lettes [id, nombre]
  #  @bag[7] : Objets combats [id, nombre]
  #  @bag[8] : Objets clés
  #------------------------------------------------------------

module POKEMON_S
    class Pokemon_Item_Bag
      # -------------------------------------------
      # Initialisation
      #    socket: cf rubrique @bag, indique la poche
      #    item_index: index du curseur
      #    mode =
      # -------------------------------------------
      def initialize(socket_index = $pokemon_party.bag_index, z_level = 300, mode = 0)#z_level=100
        @bag_index = socket_index[0]
        @item_index = socket_index[1]
        @z_level = z_level
        @mode = mode
      end
     
      def main       
        Graphics.freeze
        @background = Sprite.new 
        @background.bitmap = RPG::Cache.picture("bagfond_inf"+@bag_index.to_s+".png")
        @background.z = @z_level
        @background.x = 13
        @background.y = 227
       
        @fond = Sprite.new 
        @fond.bitmap = RPG::Cache.picture("bagfond.png")
        @fond.x = 13
        @fond.y = 227
        @fond.z = @z_level + 1
       
        @bag_sprite = Sprite.new
        @bag_sprite.z = @z_level + 1
        @bag_sprite.x = 13
        @bag_sprite.y = 13         
       
        if $game_variables[11] == 1       
        @bag_sprite.bitmap = RPG::Cache.picture("bag_garçon"+@bag_index.to_s+".png")     
        elsif $game_variables[11] == 2     
        @bag_sprite.bitmap = RPG::Cache.picture("bag_fille"+@bag_index.to_s+".png")       
        else       
        @bag_sprite.bitmap = RPG::Cache.picture("bag_garçon"+@bag_index.to_s+".png")         
        end               
       
        @socket_name = Window_Base.new(51-16, 27-16, 228+32, 45+32)
        @socket_name.contents = Bitmap.new(228, 45)
        @socket_name.opacity = 0
        @socket_name.z = @z_level + 1
        @socket_name.contents.font.name = $fontface
        @socket_name.contents.font.size = $fontsizebig
        @socket_name.contents.font.color = @socket_name.normal_color
       
        @item_list = POKEMON_S::Pokemon_Item_List.new(@bag_index, @item_index)
        @item_list.opacity = 0
        @item_list.z = @z_level + 1
        @item_list.active = true
        @item_list.visible = true     
       

        @text_window = Window_Base.new(88-123+9, 103-20+214+1+4+4, 645, 220) #273 #220
        @text_window.opacity = 0
        @text_window.contents = Bitmap.new(645, 200)
        @text_window.contents.font.name = $fontface
        @text_window.contents.font.size = $fontsizebig
        @text_window.contents.font.color = Color.new(140,140,140,255)
        @text_window.z = @z_level + 1

     
        @item_icon = Sprite.new
        @item_icon.z = @z_level + 2
        @item_icon.x = 24
        @item_icon.y = 382   
        @item_icon.bitmap = RPG::Cache.icon(item_icon)
       
        @drop_counter = Window_Base.new(0, 0, 60, 44) #60, 40
        @drop_counter.contents = Bitmap.new(60, 40)
        @drop_counter.x = 207
        @drop_counter.y = 373
        @drop_counter.z = @z_level + 4
        @drop_counter.contents.font.name = $fontface
        @drop_counter.contents.font.size = $fontsize
        @drop_counter.contents.font.color = @drop_counter.normal_color
        @drop_counter.visible = false
        @drop_counter_number = 1
       
        list = ["Utiliser", "Donner", "Jeter", "Ordre", "Annuler"]
        if $battle_var.in_battle
          list = ["Utiliser", "Annuler"]
        end
        @command_window = Window_Command.new(80, list)
        @command_window.active = false
        @command_window.visible = false
        @command_window.x = 187
        @command_window.y = 417 - @command_window.height
        @command_window.z = @z_level + 10             
       
        refresh_all
       
        Graphics.transition
        loop do
          Graphics.update
          if @done == true
            break
          end
          Input.update
          if @drop_counter.visible == true
            update_drop
            next
          end
          if @command_window.active == true
            update_command
            next
          end
          if @command_window.active == false
            @item_list.update
            update
            next
          end
        end
       
        $pokemon_party.bag_index[0] = @bag_index
        $pokemon_party.bag_index[1] = @item_list.index
       
        Graphics.freeze
        @item_list.dispose
        @text_window.dispose
        @item_icon.dispose
        @background.dispose
        @socket_name.dispose
        @drop_counter.dispose
        @bag_sprite.dispose
        @fond.dispose
      end
     
      def update
        if Input.repeat?(Input::DOWN) or Input.repeat?(Input::UP)
          refresh
          return
        end
       
        if Input.repeat?(Input::RIGHT) and @item_list.on_switch == -1 and @mode != "planter"
          $game_system.se_play($data_system.cursor_se)
          @bag_index += @bag_index == 8 ? -7 : 1
          @item_list.refresh(@bag_index)
          refresh_all
          return
        end
       
        if Input.repeat?(Input::LEFT) and @item_list.on_switch == -1 and @mode != "planter"
          $game_system.se_play($data_system.cursor_se)
          @bag_index += @bag_index == 1 ? 7 : -1
          @item_list.refresh(@bag_index)
          refresh_all
          return
        end
       
        if Input.trigger?(Input::C)
          if @mode == "sell"
            if @item_list.index == @item_list.size
              @done = true
              return
            end
            # item invendable
            if not(Item.soldable?(item_id))
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # $scene = Pokemon_Item_Shop.new
            $scene.call_item_amount([item_id, item_amount], "sell", @z_level + 100)
            refresh_all
            return
          end
         
          # Echange d'objet
          if @item_list.on_switch != -1
            if @item_list.index != @item_list.size
              $game_system.se_play($data_system.decision_se)
              $pokemon_party.item_switch(@bag_index, @item_list.index, @item_list.on_switch)
              @item_list.on_switch = -1
              refresh_all
            else
              $game_system.se_play($data_system.cancel_se)
              @item_list.on_switch = -1
              refresh_all
            end
            return
          end
         
          # Mode sélection objet à donner
          if @mode == "hold"
            # Fermer le sac
            if @item_list.index == @item_list.size
              $game_system.se_play($data_system.decision_se)
              @done = true
              @return_data = [0, false]
            # Fermer le sac
            elsif Item.holdable?(item_id)
              $game_system.se_play($data_system.decision_se)
              @done = true
              @return_data = [item_id, true]
            else
              $game_system.se_play($data_system.buzzer_se)
            end
            return 
          end
         
          # Mode sélection baie à planter
          if @mode == "planter"
            # Fermer le sac
            if @item_list.index == @item_list.size
              $game_system.se_play($data_system.decision_se)
              @done = true
              @return_data = 0
            # Fermer le sac
            elsif Item.socket(item_id) == 5
              $game_system.se_play($data_system.decision_se)
              @done = true
              @return_data = item_id
            else
              $game_system.se_play($data_system.buzzer_se)
            end
            return 
          end
         
          # Retour
          if @item_list.index == @item_list.size
            @done = true
            # Retour au combat
            if $battle_var.in_battle
              return
            end
            $scene = POKEMON_S::Pokemon_Menu.new(2)
            return
          # Sélection item
          else
            @command_window.active = true
            refresh
            @command_window.visible = true
            return
          end
        end
       
        if Input.trigger?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          if @mode == "hold"
            @done = true
            @return_data = [0, false]
            return
          end
         
          if @mode == "sell"
            @done = true
            return
          end
         
          if @mode == "planter"
            @done = true
            @return_data = 0
            return
          end
         
          if @item_list.on_switch != -1
            @item_list.on_switch = -1
            refresh_all
            return
          end
         
          if $battle_var.in_battle
            $game_system.se_play($data_system.cancel_se)
            @return_data = 0
            @done = true
            return
          end
         
          $game_system.se_play($data_system.cancel_se)
          $scene = POKEMON_S::Pokemon_Menu.new(2)
          @done = true
          return
        end
      end
     
      def return_data
        return @return_data
      end
     
      # ----------------------------------
      # Appel en cas de changement d'item
      # ----------------------------------
      def refresh 
       
        @background.bitmap = RPG::Cache.picture("bagfond_inf"+@bag_index.to_s+".png")
       
        # Sprite sac
        if $game_variables[11] == 1       
        @bag_sprite.bitmap = RPG::Cache.picture("bag_garçon"+@bag_index.to_s+".png")     
        elsif $game_variables[11] == 2     
        @bag_sprite.bitmap = RPG::Cache.picture("bag_fille"+@bag_index.to_s+".png")       
        else       
        @bag_sprite.bitmap = RPG::Cache.picture("bag_garçon"+@bag_index.to_s+".png")         
        end 
       
        # Nom de la poche
        #@socket_name.contents.clear
        #@socket_name.contents.draw_text(0,0, 228, 48, socket_name, 1)
       
        # Tracage de l'icone objet
        @item_icon.bitmap = RPG::Cache.icon(item_icon)       
       
        # Texte de description
        if @command_window.active
          string = []
          string[0] = Item.name(item_id) + " est"
          string[1] = "sélectionné."         
        elsif @drop_counter.visible == true
          string = []
          string[0] = "En jeter combien?"
          string[1] = ""
        elsif @item_list.on_switch != -1
          string = []
          string[0] = "Echanger avec lequel?"
          string[1] = ""
        else
          string = string_builder(item_descr, 42)
        end
       
        text_window_draw(string)
       
        refresh_command_list
      end
     
      def draw_text(string = "", string2 = "")       
      if string == ""
        @text_window_text.contents.clear
        @dummy.visible = false
        @text_window_text.visible = false       
      else
        @text_window_text.contents.clear
        @text_window_text.visible = true
        @dummy.visible = true
        @text_window.contents.draw_text(0,0,597-32,32, string)
        @text_window.contents.draw_text(0,32,597-32,32, string2)
      end
    end
   
    def wait_hit
      Graphics.update
      Input.update
      until Input.trigger?(Input::C)
        Input.update
        Graphics.update
      end
    end
     
      # ------------------------------------
      # Appel en cas de changement de poche
      # ------------------------------------
      def refresh_all
        refresh_list
        refresh
      end
     
      # ------------------------------------
      # Rafraichissement de liste (même poche)
      # ------------------------------------
      def refresh_list
        @item_list.refresh_list
      end
     
      # ----------------------------------
      # Liste d'actions associé à l'item
      # ----------------------------------
      def update_command
        @command_window.update
       
        if Input.trigger?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          @command_window.active = false
          @command_window.visible = false
          refresh
          return
        end
       
        if Input.trigger?(Input::C)
          case @command_window.index
          # Utiliser
          when 0
            if $pokemon_party.size > 0
            if $battle_var.in_battle and not(Item.battle_usable?(item_id))
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            if not($battle_var.in_battle) and not(Item.map_usable?(item_id))
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            $game_system.se_play($data_system.decision_se)
            @command_window.active = false
            @command_window.visible = false
            if Item.use_on_pokemon?(item_id)
              item_mode = "item_use"
              if Item.item_able_mode?(item_id)
                item_mode = "item_able"
              end
              @fondX = Sprite.new 
              @fondX.bitmap = RPG::Cache.picture("Battle_pokemon_choice.png")
              @fondX.z = @z_level+100
              @fondX.x = 13
              @fondX.y = 227
              scene = POKEMON_S::Pokemon_Party_Menu.new(0, @z_level + 101, item_mode, item_id)
              scene.main
              # return_data = [id item_utilisé, item utilisé oui/non, ]
              data = scene.return_data
              used = data[1]
              item_used = 0
              @fondX.dispose
            else
              # Utilisé
              data = Item.effect(item_id)
              used = data[0]
              item_used = item_id
              string = data[1]
              return_map = data[2]
              if string.type == String and string != ""
                window = Pokemon_Window_Help.new
                window.draw_text(string)
                Input.update
                until Input.trigger?(Input::C)
                  Graphics.update
                  Input.update
                end
                window.dispose
               
              end
            end           
            if used
              $pokemon_party.use_item(item_id)
            end
            # En combat, retour à l'écran après utilisation de l'objet
            if $battle_var.in_battle and used
              $battle_var.action_id = 1
              @done = true
              @return_data = item_used
              return
            end
            if used and return_map
              @done = true
              return
            end
            refresh_all
            @item_list.refresh
            Graphics.transition
            return
            else           
            $game_system.se_play($data_system.buzzer_se)           
            Graphics.transition
            return
          end                     
          # Retour (dernière option)
          when @command_window.item_max-1
            $game_system.se_play($data_system.cancel_se)
            @command_window.active = false
            @command_window.visible = false
            refresh
            return
          # Donner
          when 1
            if $pokemon_party.size > 0
            if not(Item.holdable?(item_id))
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            $game_system.se_play($data_system.decision_se)
            @command_window.active = false
            @command_window.visible = false
            scene = POKEMON_S::Pokemon_Party_Menu.new(0, @z_level + 100, "hold", item_id)
            scene.main
            return_data = scene.return_data
            # return_data = [item tenu true/false, id item_tenu, item remplacé true/false, id item remplacé]
            item_id2 = return_data[2]
            replaced = return_data[3]
            if replaced
              $pokemon_party.add_item(item_id2)
            end
            item_id1 = return_data[0]
            hold = return_data[1]
            if hold
              $pokemon_party.drop_item(item_id1)
            end                       
            @item_list.refresh
            refresh_all
            Graphics.transition
            return
          else
            $game_system.se_play($data_system.buzzer_se)
            refresh_all
            Graphics.transition
          end
         
          # Jeter
          when 2
            if not(Item.holdable?(item_id))
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            $game_system.se_play($data_system.decision_se)
            @command_window.active = false
            @command_window.visible = false
            @drop_counter.visible = true
            refresh
            refresh_drop_counter
            return
          # Ordre
          when 3
            @item_list.on_switch = @item_list.index
            @command_window.active = false
            @command_window.visible = false
            refresh_all
            return
          end
        end
       
      end
     
      def refresh_command_list
        # Fermer le sac
        if @item_list.index == @item_list.size
          return
        end 
        # En combat
        if $battle_var.in_battle
          if Item.battle_usable?(item_id)
            @command_window.enable_item(0)
          else
            @command_window.disable_item(0)
          end
        # En map
        else
          if Item.map_usable?(item_id)
            @command_window.enable_item(0)
          else
            @command_window.disable_item(0)
          end
          if Item.holdable?(item_id)
            @command_window.enable_item(1)
            @command_window.enable_item(2)
          else
            @command_window.disable_item(1)
            @command_window.disable_item(2)
          end
          if $pokemon_party.size > 0
            @command_window.enable_item(0)
            @command_window.enable_item(1)
          else
            @command_window.disable_item(0)
            @command_window.disable_item(1)
          end         
        end
      end
     
      def update_drop
        if Input.repeat?(Input::UP)
          if @drop_counter_number < item_amount
            @drop_counter_number += 1
            refresh_drop_counter
          end
          return
        end
       
        if Input.repeat?(Input::DOWN)
          if @drop_counter_number > 1
            @drop_counter_number -= 1
            refresh_drop_counter
          end
          return
        end
       
        if Input.repeat?(Input::LEFT)
          if @drop_counter_number > 1
            @drop_counter_number -= 10
            if @drop_counter_number < 1
              @drop_counter_number = 1
            end
            refresh_drop_counter
          end
          return
        end
       
        if Input.repeat?(Input::RIGHT)
          if @drop_counter_number < item_amount
            @drop_counter_number += 10
            if @drop_counter_number > item_amount
              @drop_counter_number = item_amount
            end
            refresh_drop_counter
          end
          return
        end
       
        if Input.repeat?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          @drop_counter_number = 1
          @drop_counter.visible = false
          @command_window.active = true
          @command_window.visible= true
          refresh
          return
        end
       
        if Input.repeat?(Input::C)
          $game_system.se_play($data_system.decision_se)
          if decision
            $game_system.se_play($data_system.decision_se)
            id_ = item_id
            $pokemon_party.drop_item(id_, @drop_counter_number)
            @drop_counter.visible = false
            refresh_list
            text_window_draw(["Jeté " + @drop_counter_number.to_s, Item.name(id_) + "."])
            @drop_counter_number = 1
            @command_window.active = false
            @command_window.visible = false
            Input.update
            until Input.trigger?(Input::C)
              Graphics.update
              Input.update
            end
            refresh_all
            return
          else
            $game_system.se_play($data_system.cancel_se)
            @drop_counter_number = 1
            @drop_counter.visible = false
            @command_window.active = false
            @command_window.visible = false
            refresh
            return
          end
        end
      end
     
      def refresh_drop_counter
        @drop_counter.contents.clear
        @drop_counter.contents.draw_text(-35, -11, 62, 32, " x " + @drop_counter_number.to_s, 2)
      end
     
      # ----------------------------------
      # Identification de l'item !!!!!!! Utilise l'index de la poche
      # ----------------------------------
      def item_id
        return $pokemon_party.bag[@bag_index][@item_list.index][0]
      end
     
      def item_icon
        if @item_list.index == @item_list.size
          return "return.png"
        else
          return Item.icon(item_id)
        end
      end
     
      def item_descr
        if @item_list.index == @item_list.size
          if $battle_var.in_battle
            return "Fermer le Sac."
          end
          if @mode == "sell"
            return "Fermer le Sac."
          end
          return "Fermer le Sac."
        else
          return Item.descr(item_id)
        end
      end
     
      def item_amount
        return $pokemon_party.bag[@bag_index][@item_list.index][1]
      end
     
      # ----------------------------------
      # Decision
      # ----------------------------------
      def decision
        @command = Window_Command.new(120, ["OUI", "NON"], $fontsize)
        @command.x = 517
        @command.y = 480 - 6 - @drop_counter.height - @command.height + 207
        @command.z = @z_level + 15
        loop do
          Graphics.update
          Input.update
          @command.update
          if Input.trigger?(Input::C) and @command.index == 0
            @command.dispose
            @command = nil
            return true
          end
          if (Input.trigger?(Input::C) and @command.index == 1) or Input.trigger?(Input::B)
            @command.dispose
            @command = nil
            return false
          end
        end
      end
     
      def text_window_draw(list)
        @text_window.contents.clear
        for i in 0..list.length-1         
          @text_window.contents.font.color = Color.new(50,50,50,255)
          @text_window.contents.draw_text(72, 16*i+58, 241, $fhb, list[i]) #38*i, 241
        end
      end
     
      def dialog_window_draw(string)
      end
     
      def string_builder(text, limit)
        length = text.length
        full1 = false
        full2 = false
        full3 = false
        #full4 = false
        string1 = ""
        string2 = ""
        string3 = ""
        #string4 = ""
        word = ""
        for i in 0..length
          letter = text[i..i]
          if letter != " " and i != length
            word += letter.to_s
          else
            word = word + " "
            if (string1 + word).length < limit and not(full1)
              string1 += word
              word = ""
            else
              full1 = true
            end
           
            if (string2 + word).length < limit and not(full2)
              string2 += word
              word = ""
            else
              full2 = true
            end
           
            if (string3 + word).length < limit and not(full3)
              string3 += word
              word = ""
            else
              full3 = true
            end
           
            #if (string4 + word).length < limit and not(full4)
              #string4 += word
              #word = ""
            #else
            #  full4 = true
            #end
          end
        end
        if string3.length > 1
          string3 = string3[0..string3.length-2]
        end
        return [string1, string2, string3] #, string4]
      end
    end
   
   
   
   
    # ----------------------------------
    # class liste des objets dans une poche (socket)
    # ----------------------------------
    class Pokemon_Item_List < Window_Selectable
      attr_accessor :on_switch
     
      def initialize(socket = 1, index = 1)
        super(272-155-52, 17+214+6, 356, 125, $fn) #416
        self.contents = Bitmap.new(324, 384)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsizebig
        self.contents.font.color = platine
        @bag_index = socket
        @item_max = size + 1
        @on_switch = -1
        self.index = index
      end
     
      def refresh(socket = @bag_index)
        self.index = 0
        @bag_index = socket
        @item_max = size + 1       
        refresh_list
      end
     
      def refresh_list
        color_sac = Color.new(100,100,100,255)
        ombre_sac = Color.new(168,184,184,255)
        self.contents.clear
        self.contents = Bitmap.new(356, $fhb*(size+1)+2)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsizebig     
        hl = $fn
        i = 0
        for item in $pokemon_party.bag[@bag_index]
          id = item[0]
          amount = item[1]
          if @on_switch == i
            self.contents.font.color = text_color(2) # Rouge
          end         
          self.contents.font.color = color_sac
          self.contents.draw_text(5, hl*i, 304, hl, Item.name(id))
          if Item.holdable?(id) 
            self.contents.font.color = color_sac
            self.contents.draw_text(-180, hl*i, 304, hl, "x" + amount.to_s, 2)         
          end       
          if @on_switch == i
            self.contents.font.color = color_sac
          end
          i += 1               
        end
        self.contents.font.color = color_sac
        self.contents.draw_text(5, hl*i, 310, hl, "FERMER")
      end
     
      def item_id(index = @bag_index)
        return $pokemon_party.bag[index][self.index]
      end
     
      def size
        return $pokemon_party.bag_list(@bag_index).length
      end     
    end
  end


Main
Code:
#==============================================================================
# ■ Main
#------------------------------------------------------------------------------
#  各クラスの定義が終わった後、ここから実際の処理が始まります。
#==============================================================================

begin 
  # file = File.open("data.txt", "w")
   # for i in 1..493
    #  file.write("$data_pokemon[#{i}] = #{$data_pokemon[i].inspect}\n")
   # end
    #file.close
  $style = "DP"
  # Change the $fontface variable to change the font style
  $fontface = ["Pokémon Platine", "Pokemon FRLG", "Pokemon RS", "Trebuchet MS"]
  $fontfacebis = ["Pokemon RS", "Pokemon Platine Regular"]
  $fontsizebis = 15
  # Change the $fontsize variable to change the font size
  if $style == "DP"
    # DP # Tailles étalon: 15 (1px) 31 (2px) et 47 (3px)
    $fontface = ["Pokemon DP", "Trebuchet MS"]
    $fontsizesmall = 15 # // hauteur min 14
    $fhs = 15
    $fontsize = 15 # // hauteur min 28
    $fh = 15
    $fontsizebig = 15
    $fhb = 15
  end
  if $style == "FRLG"
    # FRLG # Tailles étalon: 21 (1px)  38 (2px) 57 (3px)
    $fontface = ["Pokémon Platine", "Trebuchet MS"]
    $fontsizesmall = 15 # // hauteur min 13
    $fhs = 15
    $fontsize = 15 # // hauteur min 26
    $fh = 15
    $fontsizebig = 15 # // hauteur min 39
    $fhb = 15
  end
  $fontsmall =  ["Pokemon Emerald Small", "Pokémon Platine", "Trebuchet MS"]
  # Pokemon Emerald Small 2px: 25 , 3px: 37
  $fontsmallsize = 15
  $fs = 15
 
  $fontnarrow = ["Pokemon Emerald Narrow", "Pokémon Platine", "Trebuchet MS"]
  # Pokemon Emerald Narrow 3px: 47
  $fontnarrowsize = 15
  $fn = 15
 
  # トランジション準備
  splash.dispose
  splash1.dispose
  Graphics.transition(5)
  Graphics.freeze
  # シーンオブジェクト (タイトル画面) を作成
  $scene = Scene_Title.new
  # $scene が有効な限り main メソッドを呼び出す
  while $scene != nil
    $scene.main
  end
  # フェードアウト
  Graphics.transition(20)
rescue Exception => exception
  EXC::error_handler(exception)
rescue Errno::ENOENT
  # 例外 Errno::ENOENT を補足
  # ファイルがオープンできなかった場合、メッセージを表示して終了する
  filename = $!.message.sub("Ne trouve pas le fichier ou le répertoire - ", "")
  print("Le ficher #{filename} n'a pas été trouvé.")
end


D'avance, merci !

Posté par FlorianG82 le 26 Juil - 11:06 (2013)
Oh my god!
Je cromprends quedal à tout ce truc Bouche extensible

Posté par Girakoth le 26 Juil - 12:17 (2013)
Dans ce cas, pas la peine de poster ici Résignation man

Posté par FinalArt le 26 Juil - 12:22 (2013)
Par contre, je viens de tester en évolution naturelle, il y a pas de soucis, cela marche parfaitement.
J'ai également testé sur la dernière version de PSP 5G (la 0.9 je crois) sans aucune modif, exactement le même soucis.

Posté par Ku'rei le 26 Juil - 13:56 (2013)
As-tu essayé avec d'autres Pokémons évoluant par pierre ?
Vérifie la ligne des évolutions d'EVOLI dans le fichier data_pokemon.txt.
Si tu ne trouve pas d'erreur envoie le script Pokemon, il se pourrait bien que la fonction evolve_check ne renvoi pas la bonne valeur.

Posté par FinalArt le 26 Juil - 15:05 (2013)
Avec d'autres Pokémons, l'évolution par pierre marche niquel.
La ligne d'évolution d'évoli dans data_pokemon.txt est conforme. J'ai même testé avec une seule pierre en paramètre, mais toujours le problème.

Pokemon
Code:
#==============================================================================
# ■ Pokemon
# Pokemon Script Project - Krosk
# 20/07/07
# 26/08/08 - révision, support des oeufs
# Modifié par Palbolsky
#-----------------------------------------------------------------------------
# Gestion individuelle
#-----------------------------------------------------------------------------

module POKEMON_S
  #------------------------------------------------------------ 
  # class Pokemon : génère l'information sur un Pokémon.
  #------------------------------------------------------------
  class Pokemon
    #Archetype
    attr_reader :id             # ID du Pokémon
    attr_reader :id_bis         # ID secondaire du Pokémon
    attr_reader :name           # Nom générique de l'espèce
    attr_reader :battler_face   # Généré automatiquement
    attr_reader :battler_back   # Généré automatiquement
    attr_reader :cry            # Généré automatiquement
    attr_reader :icon           # Généré automatiquement
    attr_reader :base_hp        # Stats de base
    attr_reader :base_atk
    attr_reader :base_dfe
    attr_reader :base_spd
    attr_reader :base_ats
    attr_reader :base_dfs
    attr_reader :skills_table   # Table de skills naturels
    attr_reader :skills_allow   # Table de skills permissibles (CT, CS)
    attr_reader :description    # Liste
    attr_reader :exp_type       # Expérience: Courbe d'évolution, définie la table
    attr_reader :type1
    attr_reader :type2
    #attr_reader :exp_list       # Expérience: Table d'expérience
    attr_reader :evolve_list
    attr_reader :battle_list    # Table des EV
    attr_reader :ability        # Capacité propre du Pokémon
    attr_reader :rareness       # Rareté
    # Caractéristiques
    attr_reader :code           # Code indentification propre au Pokémon
    attr_reader :dv_hp
    attr_reader :dv_atk
    attr_reader :dv_dfe
    attr_reader :dv_spd
    attr_reader :dv_ats
    attr_reader :dv_dfs
    attr_reader :nature         # Code "caractère" du Pokémon
    attr_reader :shiny          # Caractère Shiny
    attr_reader :gender         # 0 sans genre 1 male 2 femelle
    attr_reader :egg           # état oeuf
    attr_accessor :trainer_id
    attr_accessor :trainer_name
    attr_accessor :given_name   # Nom donné au Pokémon
    attr_accessor :level
    attr_accessor :exp
    attr_accessor :skills_set   # Class Skill
    attr_accessor :atk_plus     # Effort Value
    attr_accessor :dfe_plus
    attr_accessor :spd_plus
    attr_accessor :ats_plus
    attr_accessor :dfs_plus
    attr_accessor :hp_plus
    # Statut_Variable
    attr_accessor :hp
    attr_accessor :atk
    attr_accessor :dfe
    attr_accessor :spd
    attr_accessor :ats
    attr_accessor :dfs
    attr_accessor :status
    attr_accessor :status_count
    attr_accessor :confused
    attr_accessor :state_count  # pour confusion
    attr_accessor :flinch
    attr_accessor :effect       # Liste des effets au combat
    attr_accessor :ability_active # true/false
    attr_accessor :ability_token
    attr_accessor :item_hold      # ID objet tenu
    attr_accessor :loyalty
    attr_accessor :battle_stage   # [atk, dfe, spd, ats, dfs, eva, acc]
    attr_accessor :atk_stage      # Stats de combat
    attr_accessor :dfe_stage
    attr_accessor :spd_stage
    attr_accessor :ats_stage
    attr_accessor :dfs_stage
    attr_accessor :eva_stage
    attr_accessor :acc_stage
    attr_accessor :ball_data           # Sprite de la ball utilisée
    attr_accessor :step_remaining      # pas restants avant éclosion
    attr_accessor :form                # Le numéro de la forme alt   
    attr_accessor :origine
    attr_accessor :envie
    #------------------------------------------------------------ 
    # Créer un Pokémon:
    #         @pokemon = Pokemon.new(id, level, shiny)
    # Appel d'une commande attr_accessor:
    #         @pokemon.accessor
    # Assignation:
    #         @pokemon.accessor = value
    # Commandes_d'appel du type poke = Pokemon.new(id), poke.commande
    # poke.maxhp_basis, poke.sta_basis
    #------------------------------------------------------------
   
    #------------------------------------------------------------
    # Création d'un Pokémon
    #------------------------------------------------------------
    #------------------------------------------------------------
    # Modèle invariant / Archetype
    #------------------------------------------------------------
    def archetype(id)
      @base_hp = Pokemon_Info.base_hp(id)
      @base_atk = Pokemon_Info.base_atk(id)
      @base_dfe = Pokemon_Info.base_dfe(id)
      @base_spd = Pokemon_Info.base_spd(id)
      @base_ats = Pokemon_Info.base_ats(id)
      @base_dfs = Pokemon_Info.base_dfs(id)
      @skills_table = skill_table_building
      @skills_allow = Pokemon_Info.skills_tech(id)
      @exp_type = Pokemon_Info.exp_type(id)
      @type1 = Pokemon_Info.type1(id)
      @type2 = Pokemon_Info.type2(id)
      @rareness = Pokemon_Info.rareness(id)
      @male_rate = 100 - Pokemon_Info.female_rate(id)
      @female_rate = Pokemon_Info.female_rate(id)
      @battle_list = Pokemon_Info.battle_list(id)
      @battler_id = id
      @ability = ability_conversion
    end
   
    def wait_hit
      loop do
        Graphics.update
        Input.update
        if Input.trigger?(Input::C)
          $game_system.se_play($data_system.decision_se)
          break
        end
      end
    end
   
    def name
      if @egg
        return "Oeuf"
      end
      return Pokemon_Info.name(id)
    end
   
    def evolve_list
      if @egg
        return []
      end
      return Pokemon_Info.evolve_table(id)
    end
   
    def description
      return Pokemon_Info.descr(id)
    end
   
    def icon
      if @egg
        return "Icon/Egg000.png"
      end
      ida = sprintf("%03d", id)
      string = "Icon/#{ida}#{battler_form}.png"
      if not( $picture_data["Graphics/Battlers/" + string] )
        string.sub!(battler_form, "")
      end
      return string
    end
       
    def cry
      if @egg
        return ""
      end
      ida = sprintf("%03d", id)
      cry = "Audio/SE/Cries/#{ida}Cry.wav"
      return cry
    end
   
    def battler_form
      if @form == nil
        @form = 0
      end
      if @form > 0
        return sprintf("_%02d", @form)
      end
      return ""
    end
   
    def battler_face
      ida = sprintf("%03d", id)
     
      if @egg
        string = "Eggs/#{ida}.png"
        if not( $picture_data["Graphics/Battlers/#{string}"] )
          string = "Eggs/Egg000.png"
        end
        return string
      end
     
      if @gender == 1 or @gender == 0
        string = "Front_Male/#{ida}#{battler_form}.png"
      elsif @gender == 2
        string = "Front_Female/#{ida}#{battler_form}.png"
        #if not(FileTest.exist?("Graphics/Battlers/" + string))
        if not( $picture_data["Graphics/Battlers/" + string] )
          string = "Front_Male/#{ida}#{battler_form}.png"
        end
      end
           
      if @shiny
        string2 = "Shiny_" + string
        #if FileTest.exist?("Graphics/Battlers/" + string2)
        if $picture_data["Graphics/Battlers/" + string2]
          string = string2
        end
      end
     
      if not( $picture_data["Graphics/Battlers/" + string] )
        string.sub!(battler_form, "")
      end
     
      return string
    end
   
    def battler_back
      ida = sprintf("%03d", id)
      if @gender == 1 or @gender == 0
        string = "Back_Male/#{ida}#{battler_form}.png"
      elsif @gender == 2
        string = "Back_Female/#{ida}#{battler_form}.png"
        #if not(FileTest.exist?("Graphics/Battlers/" + string))
        if not($picture_data["Graphics/Battlers/" + string])
          string = "Back_Male/#{ida}#{battler_form}.png"
        end
      end
     
      if @shiny
        string2 = "Shiny_" + string
        #if FileTest.exist?("Graphics/Battlers/" + string2)
        if $picture_data["Graphics/Battlers/" + string2]
          string = string2
        end
      end
     
      if not( $picture_data["Graphics/Battlers/" + string] )
        string.sub!(battler_form, "")
      end
     
      return string
    end 
   
    def skills_allow
      return Pokemon_Info.skills_tech(id)
    end
   
    def hatch_step
      return Pokemon_Info.hatch_step(id)
    end
   
    def breed_move
      return Pokemon_Info.breed_move(id)
    end
   
    def breed_group
      return Pokemon_Info.breed_group(id)
    end
 
    def initialize(id_data = 1, level = 1, shiny = false)
      if id_data.type == Fixnum
        id = id_data
      elsif id_data.type == String
        id = id_conversion(id_data)
      end
      @id = id
      @id_bis = Pokemon_Info.id_bis(id)
      @trainer_id = Player.id
      @trainer_name = Player.name
      @code = code_generation
      @male_rate = 100 - Pokemon_Info.female_rate(id)
      @female_rate = Pokemon_Info.female_rate(id)
      @gender = gender_generation
      if shiny # Shiny forcé
        @shiny = true
      else
        a = @code ^ Player.code
        b = a & 0xFFFF
        c = (a >> 16) & 0xFFFF
        d = b ^ c
        @shiny = d < 8
      end
      archetype(id)           
      @dv_hp = rand(32)
      @dv_atk = rand(32)
      @dv_dfe = rand(32)
      @dv_spd = rand(32)
      @dv_ats = rand(32)
      @dv_dfs = rand(32)     
      if @shiny
        @dv_hp = @dv_hp>16 ? 31 : @dv_hp += 15
        @dv_atk = @dv_atk>16 ? 31 : @dv_atk += 15
        @dv_dfe = @dv_dfe>16 ? 31 : @dv_dfe += 15
        @dv_spd = @dv_spd>16 ? 31 : @dv_spd += 15
        @dv_ats = @dv_ats>16 ? 31 : @dv_ats += 15
        @dv_dfs = @dv_dfs>16 ? 31 : @dv_dfs += 15
      end
      @hp_plus = 0
      @atk_plus = 0
      @dfe_plus = 0
      @ats_plus = 0
      @dfs_plus = 0
      @spd_plus = 0
      @given_name = name.clone
      @level = level == 0 ? 1 : level
      @exp = exp_list[@level]
      @skills_set = []
      @status = 0
      @status_count = 0
      @item_hold = 0 #id item
      @loyalty = Pokemon_Info.base_loyalty(id)
      @loyalty += 100
      @nature = nature_generation
      @ability = ability_conversion
      initialize_skill
      reset_stat_stage
      statistic_refresh
      @hp = maxhp_basis
      @ball_data = $data_ball[1]
      @effect = []
      @effect_count = []
      @ability_active = false
      @ability_token = nil
      @egg = false
      @step_remaining = 0
      @form = 0     
      @origine = ["Rencontré au N. " + @level.to_s + ".", $data_mapzone[$game_map.map_id][1].to_s, Time.now.day.to_s + " " +
      $game_variables[36].to_s + " " + Time.now.year.to_s]
     
      # Charactère du Pokémon. Différent de la nature.
      # En fonction des IVs du Pokémon
     
      if @dv_hp > @dv_atk and @dv_hp > @dv_dfe and @dv_hp > @dv_spd and @dv_hp > @dv_ats and @dv_hp > @dv_dfs
         if @dv_hp == 0 or @dv_hp == 5 or @dv_hp == 10 or @dv_hp == 15 or @dv_hp == 20 or @dv_hp == 25 or @dv_hp == 30      
           envi = "Adore manger."       
         end
         if @dv_hp == 1 or @dv_hp == 6 or @dv_hp == 11 or @dv_hp == 16 or @dv_hp == 21 or @dv_hp == 26 or @dv_hp == 31
           envi = "S'assoupit souvent."         
         end
         if @dv_hp == 2 or @dv_hp == 7 or @dv_hp == 12 or @dv_hp == 17 or @dv_hp == 22 or @dv_hp == 27
           envi = "Dort beaucoup."         
         end
         if @dv_hp == 3 or @dv_hp == 8 or @dv_hp == 13 or @dv_hp == 18 or @dv_hp == 23 or @dv_hp == 28
           envi = "Eparpille les choses."       
         end
         if @dv_hp == 4 or @dv_hp == 9 or @dv_hp == 14 or @dv_hp == 19 or @dv_hp == 24 or @dv_hp == 29
           envi = "Aime se détendre."         
         end           
      elsif @dv_atk > @dv_hp and @dv_atk > @dv_dfe and @dv_atk > @dv_spd and @dv_atk > @dv_ats and @dv_atk > @dv_dfs
         if @dv_atk == 0 or @dv_atk == 5 or @dv_atk == 10 or @dv_atk == 15 or @dv_atk == 20 or @dv_atk == 25 or @dv_atk == 30
           envi = "Fière de sa puissance."           
         end
         if @dv_atk == 1 or @dv_atk == 6 or @dv_atk == 11 or @dv_atk == 16 or @dv_atk == 21 or @dv_atk == 26 or @dv_atk == 31
           envi = "Aime se démener."
         end
         if @dv_atk == 2 or @dv_atk == 7 or @dv_atk == 12 or @dv_atk == 17 or @dv_atk == 22 or @dv_atk == 27
           envi = "Un peu coléreux."
         end
         if @dv_atk == 3 or @dv_atk == 8 or @dv_atk == 13 or @dv_atk == 18 or @dv_atk == 23 or @dv_atk == 28
           envi = "Aime combattre."
         end
         if @dv_atk == 4 or @dv_atk == 9 or @dv_atk == 14 or @dv_atk == 19 or @dv_atk == 24 or @dv_atk == 29
           envi = "S'emporte facilement."
         end
      elsif @dv_dfe > @dv_hp and @dv_dfe > @dv_atk and @dv_dfe > @dv_spd and @dv_dfe > @dv_ats and @dv_dfe > @dv_dfs
         if @dv_dfe == 0 or @dv_dfe == 5 or @dv_dfe == 10 or @dv_dfe == 15 or @dv_dfe == 20 or @dv_dfe == 25 or @dv_dfe == 30
           envi = "Corps robuste."
         end
         if @dv_dfe == 1 or @dv_dfe == 6 or @dv_dfe == 11 or @dv_dfe == 16 or @dv_dfe == 21 or @dv_dfe == 26 or @dv_dfe == 31
           envi = "Sait encaisser les coups."
         end
         if @dv_dfe == 2 or @dv_dfe == 7 or @dv_dfe == 12 or @dv_dfe == 17 or @dv_dfe == 22 or @dv_dfe == 27
           envi = "Très asctucieux."
         end
         if @dv_dfe == 3 or @dv_dfe == 8 or @dv_dfe == 13 or @dv_dfe == 18 or @dv_dfe == 23 or @dv_dfe == 28
           envi = "Bonne endurance."
         end         
         if @dv_dfe == 4 or @dv_dfe == 9 or @dv_dfe == 14 or @dv_dfe == 19 or @dv_dfe == 24 or @dv_dfe == 29
           envi = "Persévérent."
         end
      elsif @dv_spd > @dv_hp and @dv_spd > @dv_atk and @dv_spd > @dv_dfe and @dv_spd > @dv_ats and @dv_spd > @dv_dfs
         if @dv_spd == 0 or @dv_spd == 5 or @dv_spd == 10 or @dv_spd == 15 or @dv_spd == 20 or @dv_spd == 25 or @dv_spd == 30
           envi = "Aime courir."
         end
         if @dv_spd == 1 or @dv_spd == 6 or @dv_spd == 11 or @dv_spd == 16 or @dv_spd == 21 or @dv_spd == 26 or @dv_spd == 31
           envi = "Attentif aux sons."
         end
         if @dv_spd == 2 or @dv_spd == 7 or @dv_spd == 12 or @dv_spd == 17 or @dv_spd == 22 or @dv_spd == 27
           envi = "Bête et impulsif."
         end
         if @dv_spd == 3 or @dv_spd == 8 or @dv_spd == 13 or @dv_spd == 18 or @dv_spd == 23 or @dv_spd == 28
           envi = "Aime faire le pitre."
         end         
         if @dv_spd == 4 or @dv_spd == 9 or @dv_spd == 14 or @dv_spd == 19 or @dv_spd == 24 or @dv_spd == 29
           envi = "Fuit rapidement."
         end
      elsif @dv_ats > @dv_hp and @dv_ats > @dv_atk and @dv_ats > @dv_dfe and @dv_ats > @dv_spd and @dv_ats > @dv_dfs
         if @dv_ats == 0 or @dv_ats == 5 or @dv_ats == 10 or @dv_ats == 15 or @dv_ats == 20 or @dv_ats == 25 or @dv_ats == 30
           envi = "Extrêmement curieux."
         end
         if @dv_ats == 1 or @dv_ats == 6 or @dv_ats == 11 or @dv_ats == 16 or @dv_ats == 21 or @dv_ats == 26 or @dv_ats == 31
           envi = "Coquin."
         end
         if @dv_ats == 2 or @dv_ats == 7 or @dv_ats == 12 or @dv_ats == 17 or @dv_ats == 22 or @dv_ats == 27
           envi = "Très obstiné."
         end
         if @dv_ats == 3 or @dv_ats == 8 or @dv_ats == 13 or @dv_ats == 18 or @dv_ats == 23 or @dv_ats == 28
           envi = "Souvent dans la Lune."
         end         
         if @dv_ats == 4 or @dv_ats == 9 or @dv_ats == 14 or @dv_ats == 19 or @dv_ats == 24 or @dv_ats == 29
           envi = "Très particulier."
         end
       elsif @dv_dfs > @dv_hp and @dv_dfs > @dv_atk and @dv_dfs > @dv_dfe and @dv_dfs > @dv_spd and @dv_dfs > @dv_ats
         if @dv_dfs == 0 or @dv_dfs == 5 or @dv_dfs == 10 or @dv_dfs == 15 or @dv_dfs == 20 or @dv_dfs == 25 or @dv_dfs == 30
           envi = "Très volontaire."
         end
         if @dv_dfs == 1 or @dv_dfs == 6 or @dv_dfs == 11 or @dv_dfs == 16 or @dv_dfs == 21 or @dv_dfs == 26 or @dv_dfs == 31
           envi = "Un peu vaniteux."
         end
         if @dv_dfs == 2 or @dv_dfs == 7 or @dv_dfs == 12 or @dv_dfs == 17 or @dv_dfs == 22 or @dv_dfs == 27
           envi = "Esprit rebelle."
         end
         if @dv_dfs == 3 or @dv_dfs == 8 or @dv_dfs == 13 or @dv_dfs == 18 or @dv_dfs == 23 or @dv_dfs == 28
           envi = "A horreur de perdre."
         end         
         if @dv_dfs == 4 or @dv_dfs == 9 or @dv_dfs == 14 or @dv_dfs == 19 or @dv_dfs == 24 or @dv_dfs == 29
           envi = "Assez entêté."
         end           
       else #Exception
        envi = "Compliqué."     
      end               
      @envie = [envi]   
    end

    #------------------------------------------------------------
    # Création de la table d'expérience / table des skills
    #------------------------------------------------------------   
    def exp_list
      return EXP_TABLE[@exp_type]
    end
       
    def skill_table_building
      list = []
      if Pokemon_Info.skills_list(id).length != 0
        for i in 0..(Pokemon_Info.skills_list(id).length/2-1)
          # [id skill, level skill], ...
          list.push([Pokemon_Info.skills_list(id)[2*i+1], Pokemon_Info.skills_list(id)[2*i]])
        end
      end
      return list
    end
   
    #------------------------------------------------------------
    # Création du code d'identification du Pokémon
    #  code 32 bits
    #------------------------------------------------------------
    def code_generation
      return rand(2**32)
    end
   
    #------------------------------------------------------------
    # Conversion "nom" - > id
    #------------------------------------------------------------
    def id_conversion(name)
      for id in 1..$data_pokemon.length-1
        if name == Pokemon_Info.name(id)
          return id
        end
      end
    end

    #------------------------------------------------------------
    # Désignation du sexe
    #------------------------------------------------------------
    def gender_generation
      if @male_rate == 101
        return 0 #0 = genderless
      else
        low = @code % 256
        if low < (256 * @female_rate / 100)
          return 2
        else
          return 1
        end
      end
    end
   
    def set_gender(gender)
      if gender == "F" or gender == 2
        return @gender = 2
      end
      if gender == "M" or gender == 1
        return @gender = 1
      end
      if gender == "I" or gender == 0
        return @gender = 0
      end
    end
   
    def male?
      return @gender == 1
    end
   
    def female?
      return @gender == 2
    end
    alias femelle? female?
   
    def genderless?
      return @gender == 0
    end
    alias sans_genre? genderless?

    #------------------------------------------------------------
    # Désignation du caractère
    #------------------------------------------------------------
    def nature_generation
      nature_code = @code % 25
      case nature_code #atk, dfe, vit, ats, dfs
      when 0
        return ["Hardi", 100,100,100,100,100, "", "Mange tout de bon coeur"]     
      when 1
        return ["Solo", 110,90,100,100,100, "épicés", "Aime les aliments "]
      when 2
        return ["Brave", 110,100,90,100,100, "épicés", "Aime les aliments "]       
      when 3
        return ["Rigide", 110,100,100,90,100, "épicés", "Aime les aliments "]
      when 4
        return ["Mauvais", 110,100,100,100,90, "épicés", "Aime les aliments "]
      when 5
        return ["Assuré", 90,110,100,100,100, "acides", "Aime les aliments "]
      when 6
        return ["Docile", 100,100,100,100,100, "", "Mange tout de bon coeur"]
      when 7
        return ["Relax", 100,110,90,100,100, "acides", "Aime les aliments "] 
      when 8
        return ["Malin", 100,110,100,90,100, "acides", "Aime les aliments "] 
      when 9
        return ["Laxiste", 100,110,100,100,90, "acides", "Aime les aliments "] 
      when 10
        return ["Timide", 90,100,110,100,100, "sucrés", "Aime les aliments "]         
      when 11                             
        return ["Pressé", 100,90,110,100,100, "sucrés", "Aime les aliments "] 
      when 12
        return ["Sérieux", 100,100,100,100,100, "", "Mange tout de bon coeur"] 
      when 13
        return ["Jovial", 100,100,110,90,100, "sucrés", "Aime les aliments "]         
      when 14
        return ["Naif", 100,100,110,100,90, "sucrés", "Aime les aliments "]         
      when 15
        return ["Modeste", 90,100,100,110,100, "secs", "Aime les aliments "] 
      when 16
        return ["Doux", 100,90,100,110,100, "secs", "Aime les aliments "] 
      when 17
        return ["Discret", 100,100,90,110,100, "secs", "Aime les aliments "] 
      when 18
        return ["Bizarre", 100,100,100,100,100, "", "Mange tout de bon coeur"] 
      when 19
        return ["Foufou", 100,100,100,110,90, "secs", "Aime les aliments "] 
      when 20
        return ["Calme", 90,100,100,100,110, "amers", "Aime les aliments "] 
      when 21
        return ["Gentil", 100,90,100,100,110, "amers", "Aime les aliments "] 
      when 22
        return ["Malpoli", 100,100,90,100,110, "amers", "Aime les aliments "] 
      when 23
        return ["Prudent", 100,100,100,90,110, "amers", "Aime les aliments "] 
      when 24
        return ["Pudique", 100,100,100,100,100, "", "Mange tout de bon coeur"]       
      end     
    end
   
    #------------------------------------------------------------
    # Désignation de la Capacité spéciale
    #------------------------------------------------------------
    def ability_conversion
      # Une seule capa. spéciale  ou code paire
      if Pokemon_Info.ability_list(id)[1] == nil or @code.even?
        ability_string = Pokemon_Info.ability_list(id)[0]
      elsif @code.odd? and Pokemon_Info.ability_list(id)[1] != nil
        ability_string = Pokemon_Info.ability_list(id)[1]
      end
      list = []
      for i in 1..$data_ability.length-1
        list.push($data_ability[i][0]) # Noms
      end
      id = list.index(ability_string)
      if id == nil
        ###print ability_string
      end
      return id + 1
    end
   
    def ability_name
      return $data_ability[@ability][0]
    end
   
    def ability_descr
      return $data_ability[@ability][1]
    end
   
    def change_name(name)
      @given_name = name
    end
   
    def ball_sprite
      return @ball_data[2]
    end
   
    def ball_open_sprite
      return @ball_data[3]
    end
   
    def ball_color
      return @ball_data[4]
    end
   
    def item_name
      return Item.name(@item_hold)
    end
   
    def skills # équivalent de skills_set, mais avec les id seulement
      list = []
      if @egg
        return list
      end
      for skill in @skills_set
        list.push(skill.id)
      end
      return list
    end
   
    def ss(index)
      return @skills_set[index]
    end
   
  #------------------------------------------------------------
  # Gestion des skills
  #------------------------------------------------------------
    #------------------------------------------------
    # $data_skills_pokemon[id] = [
    #   "Nom",
    #   dommages de base,
    #   type,
    #   précision %,   
    #   pp,max
    #   special %,
    # ]
    #------------------------------------------------
    #------------------------------------------------------------
    # Apprendre une compétence
    #------------------------------------------------------------
    def learn_skill(id_data)
      if id_data.type == Fixnum
        id = id_data
      elsif id_data.type == String
        id = Skill_Info.id(id_data)
      end
      if not(skills.include?(id)) and @skills_set.length < 4
        @skills_set.push(Skill.new(id))
        return true
      end
      return false
    end
   
    #------------------------------------------------------------
    # Oublier une compétence par son numéro de place
    #------------------------------------------------------------
    def forget_skill_index(index) # De 0 à 3
      if skills[index] != nil
        @skills_set.delete_at(index)
      end
    end
   
    def forget_skill(id_data)
      if id_data.type == Fixnum
        id = id_data
      elsif id_data.type == String
        id = Skill_Info.id(id_data)
      end
      index = skills.index(id)
      if index != nil
        forget_skill_index(index)
      end
    end   
   
    #------------------------------------------------------------
    # convert_skill(learnt, learning)
    #------------------------------------------------------------
    def convert_skill(learnt, learning)
      if learnt.type == String
        learnt_id = Skill_Info.id(learnt)
      elsif learnt.type == Fixnum
        learnt_id = learnt
      end
      if learning.type == String
        learning_id = Skill_Info.id(learning)
      elsif learning.type == Fixnum
        learning_id = learning
      end
      index = skills.index(learnt_id)
      @skills_set[index] = Script.new(learning_id)
    end
   
    #------------------------------------------------------------
    # replace_skill_index(index, id_data)
    #   index = index du skill dans les attaques
    #   id_data = nom/ID du skill à mettre
    #------------------------------------------------------------
    def replace_skill_index(index, id_data)
      if id_data.type == String
        id = Skill_Info.id(id_data)
      elsif id_data.type == Fixnum
        id = id_data
      end
      @skills_set[index] = Skill.new(id)
    end
   
    #------------------------------------------------------------
    # Commandes supplémentaires:
    # @pokemon.skill_learn?(id)
    #       renvoie true/false
    # @pokemon.initialize_skill
    #       Crèe les compétences naturelles
    #       Ecrase les compétences de bas niveau!
    #------------------------------------------------------------     
    def skill_learnt?(id_data)
      if id_data.type == Fixnum
        id = id_data
      elsif id_data.type == String
        id = Skill_Info.id(id_data)
      end
      return skills.include?(id)
    end
   
    def initialize_skill
      for skill in @skills_table
        if skill[1] <= @level and @skills_set.length < 4
          learn_skill(skill[0])
        elsif skill[1] <= @level and @skills_set.length == 4
          forget_skill_index(0)
          learn_skill(skill[0])
        end
      end
    end
   
    def refresh_skill(backscene = nil)
      for skill in @skills_table
        if skill[1] == @level and not(skill_learnt?(skill[0]))
          scene = Pokemon_Skill_Learn.new(self, skill[0], backscene)
          scene.main
        end
      end
    end
   
    def force_skill(list)
      @skills_set = []
      for id in list
        if id.type == Fixnum
          skill = Skill.new(id)
          @skills_set.push(skill)
        end
        if id.type == String
          skill = Skill.new(Skill_Info.id(id))
          @skills_set.push(skill)
        end
      end
    end
   
    # ------------------------------------------------------
    # skill_selection
    #   Permet d'ouvrir une fenêtre de sélection d'un skill.
    #   Renvoie -1, ou l'index du de l'attaque (0 pour le premier,
    #   1 pour le suivant, 2 pour le suisuivant...
    # ------------------------------------------------------
    def skill_selection
      scene = Pokemon_Skill_Selection.new(self)
      scene.main
      data = scene.return_data
      scene = nil
      $game_variables[5] = data
      return data
    end
   
  #------------------------------------------------------------
  # Gestion d'évolution
  #------------------------------------------------------------   
    #------------------------------------------------------------   
    # Génère l'expérience.
    #   battle_list : battle_list de l'adversaire vaincu battle_list[6]: base_exp
    #   level : niveau du vaincu
    #   number : nombre de participants
    #   type : de combat: sauvage ou dresseur, et autres multiplicateurs
    #   exp_share : multi_exp
    #------------------------------------------------------------   
    def exp_calculation(battle_list, level, number = 1, type = 1, exp_share_number = 0, out_battle = 1)
      # Formule de base
      exp_sup = Integer(battle_list[6] * level * type / 7) / number
      # Formule multi_exp
      if exp_share_number > 0
        exp_share_hold = Item.data(item_hold)["expshare"] ? 1 : 0
        value = level*battle_list[6]/14
        exp_sup = (Integer(value/number)*out_battle + Integer(value/exp_share_number)*exp_share_hold)*type
      end
      return exp_sup
    end
   
    def add_exp_battle(amount)
      @exp = (@exp + amount > exp_list[MAX_LEVEL])? exp_list[MAX_LEVEL] : @exp + amount
    end
   
    # Bonus EV pour celui qui a mis KO le pokémon adverse
    def add_bonus(battle_list)
      points = 0
      for i in battle_list
        points += i
      end
      if total_ev + points <= 510
        if @hp_plus + battle_list[0] <= 255
          @hp_plus += battle_list[0]
        end
        if @atk_plus + battle_list[1] <= 255
          @atk_plus += battle_list[1]
        end
        if @dfe_plus + battle_list[2] <= 255
          @dfe_plus += battle_list[2]
        end
        if @spd_plus + battle_list[3] <= 255
          @spd_plus += battle_list[3]
        end
        if @ats_plus + battle_list[4] <= 255
          @ats_plus += battle_list[4]
        end
        if @dfs_plus + battle_list[5] <= 255
          @dfs_plus += battle_list[5]
        end
        return true
      else
        return false
      end
    end
   
    def total_ev
      return @hp_plus + @atk_plus + @dfe_plus + @spd_plus + @ats_plus + @dfs_plus
    end
   
    def drop_loyalty(amount = 1)
      @loyalty -= amount
      if @loyalty < 0
        @loyalty = 0
      end
    end
   
    def raise_loyalty(amount = 0)
      if amount == 0
        if @loyalty < 100
          @loyalty += 5
        elsif @loyalty < 200
          @loyalty += 3
        elsif @loyalty < 255
          @loyalty += 2
        end
        if @loyalty > 255
          @loyalty = 255
        end
      else
        @loyalty += amount
      end
    end   
   
    #------------------------------------------------------------   
    # Vérification du niveau
    # Augmente le niveau
    #------------------------------------------------------------   
    def level_check
      if @level >= MAX_LEVEL
        return false
      end
      return @exp >= exp_list[@level+1]
    end
   
    def level_up(scene = nil)
      list = level_up_stat_refresh
      list0 = list[0]
      list1 = list[1]
     
      # Loyauté
      raise_loyalty
     
      Audio.me_play("Audio/ME/PkmRS-LevelUp.mid")
      if scene != nil
        if $battle_var.in_battle
          if self == scene.actor
            scene.actor_status.refresh
            scene.actor_sprite.animation($data_animations[497], true)
          end
        elsif not($battle_var.in_battle)
          scene.item_refresh
        end
        scene.draw_text(@given_name + " monte au", "N. " + @level.to_s + " !")
        wait_hit
        Graphics.update
        Input.update
        if $battle_var.in_battle
          until Input.trigger?(Input::C) and not(scene.actor_sprite.effect?)
            scene.actor_sprite.update
            Graphics.update
            Input.update
          end
        end
        level_up_window_call(list0, list1, scene.z_level + 100)
        scene.draw_text("", "")
        refresh_skill(scene)
      else
        new_scene = Pokemon_Window_Help.new       
        new_scene.draw_text(@given_name + " monte au", "N. " + @level.to_s + " !")       
        wait_hit           
        new_scene.update
        Input.update
        until Input.trigger?(Input::C)
          Graphics.update
          Input.update
        end
        new_scene.dispose
        Graphics.update
        level_up_window_call(list0, list1, new_scene.z_level + 1000)
        refresh_skill
      end
      if level_check
        level_up(scene)
      end
    end
   
    def level_up_stat_refresh
      if @exp < exp_list[@level+1]
        @exp = exp_list[@level+1]
      end
      hp_minus = maxhp_basis - @hp
      list0 = [maxhp_basis, atk_basis, dfe_basis, ats_basis, dfs_basis, spd_basis]
      @level += 1
      statistic_refresh
      list1 = [maxhp_basis, atk_basis, dfe_basis, ats_basis, dfs_basis, spd_basis]
      @hp = maxhp_basis - hp_minus
      return [list0, list1]
    end
   
    def silent_level_up
      # Calculs
      level_up_stat_refresh
      # Skills
      for skill in @skills_table
        if skill[1] == @level and not(skill_learnt?(skill[0]))
          @skills_set.push(Skill.new(skill[0]))
          if @skills_set.length  > 4
            @skills_set = @skills_set[-4..-1]
          end
        end
      end
    end
   
    #------------------------------------------------------------   
    # Modification/Evolution du Pokémon
    #------------------------------------------------------------   
    def evolve(id = 0)
      if @egg
        @egg = false
        @trainer_id = Player.id
        @trainer_name = Player.name
        @given_name = name
        scenebis = Pokemon_Name.new(self)
        scenebis.main
        Graphics.transition
        return
      end
      if evolve_list[1] == [] or evolve_list[1] == nil or evolve_list[1][0] == ""
        return
      end
      hp_lost = max_hp - @hp
      if id == 0
        id = evolve_check
        if id == false
          return
        end
        if @given_name == name
          @id = id
          @given_name = name
        else
          @id = id
        end
        archetype(@id)
        @hp = max_hp - hp_lost
        refresh_skill
      else # Force l'évolution (par l'usage de pierres ou de transfert)
        if @given_name == name
          @id = id
          @given_name = name
        else
          @id = id
        end
        @id = id
        archetype(@id)
        @hp = max_hp - hp_lost
        refresh_skill
      end
    end
   
    def evolve_check(mode = "", param = "")
      # Pas d'évolution
      if evolve_list[1] == [] or evolve_list[1] == nil or evolve_list[1][0] == ""
        return false
      end     
     
      for i in 1..evolve_list.length-1
        check = true
       
        for j in 1..evolve_list[i].length-1
          # V0.7 : PSP teste chaque critère.
          #   Si le critère est bon, il passe au critère suivant (next), sinon,
          #   si aucun des critères na été respecté, l'évolution est rendue
          #   invalide (check = false)
          #   et on inspecte l'évolution possible suivante (break).
          #     A la fin, l'évolution est lancée car tous
          #     les critères ont été validés.
         
          # Evolution par niveau
          if evolve_list[i][j].type == Fixnum and @level >= evolve_list[i][j]
            next
          end
         
          # Evolution par loyauté
          if evolve_list[i][j] == "loyal" and @loyalty > 220
            next
          end
       
          # Evolution par lieu
          if evolve_list[i][j].is_a?(Array) and
              evolve_list[i][j][0] == "place" and
              evolve_list[i][j][1].include?($game_map.map_id)
            next
          end
         
          # Evolution par apprentissage d'attaques
          if evolve_list[i][j].is_a?(Array) and
              evolve_list[i][j][0] == "attaque" and
              skills.include?(Skill_Info.id(evolve_list[i][j][1]))
            next
          end
         
          # Evolution par objet tenu
          if evolve_list[i][j].is_a?(Array) and
              evolve_list[i][j][0] == "item" and
              @item_hold == Item.id(evolve_list[i][j][1])
            next
          end
         
          # Evolution par genre
          if evolve_list[i][j].is_a?(Array) and evolve_list[i][j][0] == "genre"
            if male? and evolve_list[i][j][1] == "male"
              next
            end
            if female? and evolve_list[i][j][1] == "femelle"
              next
            end
          end
         
          # Evolution par periode
          if evolve_list[i][j].is_a?(Array) and evolve_list[i][j][0] == "periode"
            if POKEMON_S.jour? and evolve_list[i][j][1] == "jour"
              next
            end
            if POKEMON_S.nuit? and evolve_list[i][j][1] == "nuit"
              next
            end
          end
         
          # Evolution aléatoire
          if evolve_list[i][j].is_a?(Array) and evolve_list[i][j][0] == "aleatoire"
            if rate == nil
              rate = rand(100)
            end
            if chance == nil
              chance = 0
            end
            if rate <= evolve_list[i][j][1] + chance
              next
            else
              chance += evolve_list[i][j][1]
            end
          end
         
          # Echange
          if evolve_list[i][j] == "trade" and mode == "trade"
            next
          end
         
          # Par pierre
          if evolve_list[i][j].is_a?(Array) and
              evolve_list[i][j][0] == "stone" and
              mode == "stone" and
              evolve_list[i][j][1] == param
            next
          end
         
          check = false
          break
        end
       
        if check
          name = evolve_list[i][0]
          id = id_conversion(name)
          return id
        end
       
      end
     
      return false
    end
   
    def next_exp
      if @level >= MAX_LEVEL
        return 0
      end
      return (exp_list[@level+1]-@exp)
    end
   
  #------------------------------------------------------------
  # Gestion des stats
  #------------------------------------------------------------   
    def base_hp
      return @base_hp
    end
    def base_atk
      return @base_atk
    end
    def base_dfe
      return @base_dfe
    end
    def base_spd
      return @base_spd
    end
    def base_ats
      return @base_ats
    end
    def base_dfs
      return @base_dfs
    end
 
    #------------------------------------------------------------   
    # Planchers
    #------------------------------------------------------------   
    def maxhp_basis
      n = Integer((base_hp*2+@dv_hp+@hp_plus/4.0)*@level/100)+@level+10
      return n
    end
   
    alias max_hp maxhp_basis
   
    def atk_basis
      n = Integer((base_atk*2+@dv_atk+@atk_plus/4.0)*@level/100)+5
      n = Integer(n * @nature[1] / 100.0)
      return n
    end
   
    def dfe_basis
      n = Integer((base_dfe*2+@dv_dfe+@dfe_plus/4.0)*@level/100)+5
      n = Integer(n * @nature[2] / 100.0)
      return n
    end
   
    def spd_basis
      n = Integer((base_spd*2+@dv_spd+@spd_plus/4.0)*@level/100)+5
      n = Integer(n * @nature[3] / 100.0)
      return n
    end
   
    def ats_basis
      n = Integer((base_ats*2+@dv_ats+@ats_plus/4.0)*@level/100)+5
      n = Integer(n * @nature[4] / 100.0)
      return n
    end   
   
    def dfs_basis
      n = Integer((base_dfs*2+@dv_dfs+@dfs_plus/4.0)*@level/100)+5
      n = Integer(n * @nature[5] / 100.0)
      return n
    end
   
    #------------------------------------------------------------
    # Modificateurs et valeurs finales - Stat Stage - Combat
    # Fonctions complémentaires
    #------------------------------------------------------------   
    def statistic_refresh
      @atk = Integer(atk_basis * atk_modifier)
      @dfe = Integer(dfe_basis * dfe_modifier)
      @spd = Integer(spd_basis * spd_modifier)
      @ats = Integer(ats_basis * ats_modifier)
      @dfs = Integer(dfs_basis * dfs_modifier)
    end
   
    def reset_stat_stage
      @battle_stage = [0, 0, 0, 0, 0, 0, 0]
      statistic_refresh
    end
   
    def atk_stage
      return @battle_stage[0]
    end
   
    def dfe_stage
      return @battle_stage[1]
    end
   
    def spd_stage
      return @battle_stage[2]
    end
   
    def ats_stage
      return @battle_stage[3]
    end
   
    def dfs_stage
      return @battle_stage[4]
    end
   
    def eva_stage
      return @battle_stage[5]
    end
   
    def acc_stage
      return @battle_stage[6]
    end
   
    def change_stat(stat_id, amount = 0)
      if amount > 0 and @battle_stage[stat_id] == 6
        return 0
      end
      if amount < 0 and @battle_stage[stat_id] == -6
        return 0
      end
     
      @battle_stage[stat_id] += amount
      if @battle_stage[stat_id].abs > 6
        @battle_stage[stat_id] = 6*@battle_stage[stat_id].sgn
      end
      return amount
    end
   
    def change_atk(amount = 0)
      return change_stat(0, amount)
    end
   
    def change_dfe(amount = 0)
      return change_stat(1, amount)
    end
   
    def change_spd(amount = 0)
      return change_stat(2, amount)
    end
   
    def change_ats(amount = 0)
      return change_stat(3, amount)
    end
   
    def change_dfs(amount = 0)
      return change_stat(4, amount)
    end
   
    def change_eva(amount = 0)
      return change_stat(5, amount)
    end
   
    def change_acc(amount = 0)
      return change_stat(6, amount)
    end
   
    # Renvoi du multiplicateur selon le stage
    def modifier_stage(stage)
      if stage >= 0
        return (2+stage)/2.0
      elsif stage < 0
        return 2.0/(2-stage)
      end
    end
   
    def atk_modifier
      n = 1 * modifier_stage(atk_stage)
      # Etat burn
      if burn?
        n *= 0.5
      end
      return n
    end
   
    def dfe_modifier
      n = 1 * modifier_stage(dfe_stage)
      return n
    end   
   
    def spd_modifier
      n = 1 * modifier_stage(spd_stage)
      # Etat paralyze
      if paralyzed?
        n *= 0.25
      end
      return n
    end   

    def ats_modifier
      n = 1 * modifier_stage(ats_stage)
      return n
    end   

    def dfs_modifier
      n = 1 * modifier_stage(dfs_stage)
      return n
    end
   
    # Modification des DV
    def dv_modifier(list)
      @dv_hp = list[0]
      @dv_atk = list[1]
      @dv_dfe = list[2]
      @dv_spd = list[3]
      @dv_ats = list[4]
      @dv_dfs = list[5]
      statistic_refresh
      @hp = max_hp
    end
   
  #------------------------------------------------------------
  # Gestion combat/status
  #------------------------------------------------------------       
    #------------------------------------------------------------   
    # Effets spéciaux des attaques
    #------------------------------------------------------------
    # @effect: liste des effets
    def skill_effect(id, duration = -1, data = nil)
      # [ effet, compteur de tours] -1 si temps indéfini
      @effect.push([id, duration, data])
    end
   
    def effect_list
      list = []
      for effect in @effect
        list.push(effect[0])
      end
      return list
    end
   
    # Réduction des compteurs à effets
    def skill_effect_end_turn
      for i in 0..@effect.length-1
        @effect[i][1] -= 1
      end
    end
   
    def skill_effect_clean
      for i in 0..@effect.length-1
        if @effect[i] != nil         
          if @effect[i][1] == 0
            @effect.delete_at(i)
          end
        else
          @effect.delete_at(i)
        end
      end
    end
   
    def skill_effect_reset
      @effect = []
      for skill in @skills_set
        skill.enable
      end
    end
   

   
    def confuse_damage
      power = 40
      base_damage = Integer(((@level*2/5.0+2)*power*@atk/@dfe)/50)
      return base_damage
    end
   
    def remove_hp(amount)
      @hp -= amount
      if @hp < 0
        @hp = 0
      elsif @hp > max_hp
        @hp = max_hp
      end
    end
   
    def add_hp(amount)
      @hp += amount
      if @hp < 0
        @hp = 0
      elsif @hp > max_hp
        @hp = max_hp
      end
    end

    def dead?
      if @hp <= 0
        @hp = 0
        skill_effect_reset
        cure
        cure_state
        @ability_active = false
        @ability_token = nil
        return true
      else
        return (false or @egg)
      end
    end
   
    def party_index
      return $pokemon_party.actors.index(self)
    end
   
  #------------------------------------------------------------
  # Gestion de statut
  #------------------------------------------------------------           
  # @status:
  # 0: Normal, 1: Poison, 2: Paralysé, 3: Brulé, 4:Sommeil, 5:Gelé, 8: Toxic
  # @confuse (6), @flinch (7)
    # Cure
    def cure
      @status = 0
      @status_count = 0
    end
 
    # Poison
    def poisoned?
      if @status == 1
        return true
      else
        return false
      end
    end
   
    def status_poison(forcing = false)
      if @status == 0 or forcing
        @status = 1
        return true # status imposé
      else
        return false # autre statut
      end
    end
   
    def poison_effect
      if @status == 1
        return Integer(maxhp_basis / 8.0)
      end
    end
   
    # Paralysis
    def paralysis_check
      if rand(100) < 25
        return true #lose attack chance
      else
        return false
      end
    end
   
    def status_paralyze(forcing = false)
      if @status == 0 or forcing
        @status = 2
        return true # status imposé
      else
        return false # autre statut
      end
    end
   
    def paralyzed?
      if @status == 2
        return true
      else
        return false
      end
    end
   
    # Burn
    def burn?
      if @status == 3
        return true
      else
        return false
      end
    end
   
    def burn_effect
      if @status == 3
        return @hp - Integer(@hp * 0.875)
      end
    end
   
    def status_burn(forcing = false)
      if @status == 0 or forcing
        @status = 3
        return true # status imposé
      else
        return false # autre statut
      end
    end
   
    # Sleep
    def asleep?
      if @status == 4
        return true
      else
        return false
      end
    end
   
    def status_sleep(forcing = false)
      if @status == 0 or forcing
        @status = 4
        @status_count = rand(7) + 1
        return true
      else
        return false
      end
    end
   
    def sleep_check
      @status_count -= 1
      if @status_count > 0
        return true #Dort
      else
        @status = 0
        return false #réveillé
      end
    end
   
    # Frozen
    def frozen?
      if @status == 5
        return true
      else
        return false
      end
    end
   
    def status_frozen(forcing = false)
      if @status == 0 or (forcing)
        @status = 5
        return true
      else
        return false
      end
    end
   
    def froze_check
      i = rand(100)
      if @status == 5 and i < 10
        @status = 0
        return false #defrosted
      elsif @status == 5 and i >= 10
        return true #still frozen
      end
    end
       
    # Confuse
    def confused?
      return @confused
    end
   
    def status_confuse
      if not(@confused)
        @confused = true
        @state_count = rand(4) + 2
        return true
      end
      return false
    end
   
    def confuse_check
      if @confused and @state_count > 0
        if rand(2) > 0
          return true # Auto damage
        end
      elsif @confused and @state_count == 0
        cure_state
        return "cured"
      end
      return false
    end
   
    def confuse_decrement
      if @confused
        @state_count -= 1
      end
    end
   
    def cure_state
      @confused = false
      @state_count = 0
    end
   
    # Flinch (peur?)
    def flinch?
      return @flinch
    end
   
    def status_flinch
      return @flinch = true
    end
   
    def flinch_check
      @flinch = false
    end
   
    # Toxic
    def toxic?
      if @status == 8
        return true
      end
      return false
    end
   
    def status_toxic(forcing = false)
      if @status == 0 or forcing
        @status = 8
        @status_count = 0
        return true
      end
      return false
    end
   
    def toxic_effect
      if @status == 8
        @status_count += 1
        return Integer(maxhp_basis / 16.0 * @status_count)
      end
    end
   
    def reset_toxic_count
      if @status == 8
        @status_count = 0
      end
    end
   
  #------------------------------------------------------------
  # Gestion de soin
  #------------------------------------------------------------       
    def refill_skill
      for skill in @skills_set
        skill.refill
      end
    end
   
    def refill_skill(id, amount = 99)
      if @skills_set[id] != nil
        amount = [amount, @skills_set[id].ppmax-@skills_set[id].pp].min
        @skills_set[id].pp += amount
        return amount
      end
    end
   
    def refill_hp
      @hp = maxhp_basis
    end
   
    def refill
      refill_hp
      for skill in @skills_set
        skill.refill
      end
      cure
      cure_state
    end   
   
    def kill
      @hp = 0
    end
   
  #------------------------------------------------------------
  # Fenêtres externes
  #------------------------------------------------------------
    def level_up_window_call(list0, list1, z_level)
      @window = Window_Base.new(145, 43, 122, 127)
      @window.z = z_level
      @window.contents = Bitmap.new(250, 276)
      @window.contents.font.name = $fontface
      @window.contents.font.size = $fontsizebig
      @window.contents.font.color = @window.normal_color
      @window.draw_text(0,0,189,$fhb, "PV MAX.")
      @window.draw_text(0,16,189,$fhb, "Attaque")
      @window.draw_text(0,32,189,$fhb, "Défense")
      @window.draw_text(0,48,189,$fhb, "Attaque.Spé.")
      @window.draw_text(0,64,189,$fhb, "Défense.Spé.")
      @window.draw_text(0,80,189,$fhb, "Vitesse")
      for i in 0..5
        string = (list1[i] - list0[i]).to_s
        if string.length == 1
          string = "+ " + string
        elsif string.length == 2
          string = "+" + string
        end
        @window.draw_text(-160, 16*i, 250, $fhb, string, 2)
      end
      loop do
        Graphics.update
        Input.update
        if Input.trigger?(Input::C)
          $game_system.se_play($data_system.decision_se)
          break
        end
      end
      @window.contents.clear
      @window.draw_text(0,0,189,$fhb, "PV MAX.")
      @window.draw_text(0,16,189,$fhb, "Attaque")
      @window.draw_text(0,32,189,$fhb, "Défense")
      @window.draw_text(0,48,189,$fhb, "Attaque.Spé.")
      @window.draw_text(0,64,189,$fhb, "Défense.Spé.")
      @window.draw_text(0,80,189,$fhb, "Vitesse")
      for i in 0..5
        string = (list1[i]).to_s
        @window.draw_text(-160, 16*i, 250, $fhb, string, 2)
      end
      loop do
        Graphics.update
        Input.update
        if Input.trigger?(Input::C)
          $game_system.se_play($data_system.decision_se)
          break
        end
      end
      @window.dispose
      @window = nil
    end
   
    def type_normal?
      if [@type1, @type2].include?(1)
        return true
      end
      return false
    end
   
    def type_fire?
      if [@type1, @type2].include?(2)
        return true
      end
      return false
    end
    alias type_feu? type_fire?
   
    def type_water?
      if [@type1, @type2].include?(3)
        return true
      end
      return false
    end
    alias type_eau? type_water?
   
    def type_electric?
      if [@type1, @type2].include?(4)
        return true
      end
      return false
    end
   
    def type_grass?
      if [@type1, @type2].include?(5)
        return true
      end
      return false
    end
    alias type_plante? type_grass?
   
    def type_ice?
      if [@type1, @type2].include?(6)
        return true
      end
      return false
    end
    alias type_glace? type_ice?
   
    def type_fighting?
      if [@type1, @type2].include?(7)
        return true
      end
      return false
    end
    alias type_combat? type_fighting?
   
    def type_poison?
      if [@type1, @type2].include?(8)
        return true
      end
      return false
    end
   
    def type_ground?
      if [@type1, @type2].include?(9)
        return true
      end
      return false
    end
    alias type_sol? type_ground?
   
    def type_fly?
      if [@type1, @type2].include?(10)
        return true
      end
      return false
    end
    alias type_vol? type_fly?
   
    def type_psy?
      if [@type1, @type2].include?(11)
        return true
      end
      return false
    end
   
    def type_insect?
      if [@type1, @type2].include?(12)
        return true
      end
      return false
    end
   
    def type_rock?
      if [@type1, @type2].include?(13)
        return true
      end
      return false
    end
    alias type_roche? type_rock?
   
    def type_ghost?
      if [@type1, @type2].include?(14)
        return true
      end
      return false
    end
    alias type_spectre? type_ghost?
   
    def type_dragon?
      if [@type1, @type2].include?(15)
        return true
      end
      return false
    end
   
    def type_steel?
      if [@type1, @type2].include?(16)
        return true
      end
      return false
    end
    alias type_acier? type_steel?
   
    def type_dark?
      if [@type1, @type2].include?(17)
        return true
      end
      return false
    end
    alias type_tenebres? type_dark?
   
    def type_custom?(number)
      if [@type1, @type2].include?(number)
        return true
      end
      return false
    end
   
   
    #--------------------------------------------------------------------------
    # Gestion des Oeufs
    #--------------------------------------------------------------------------
   
    # Initialisation
    def new_egg(mother = 1, father = nil)
      if mother.type == Fixnum or mother.type == String
        initialize(mother, 1)
      elsif mother.is_a?(Pokemon) and father.is_a?(Pokemon)
        # Règles spéciales pour l'ID du bébé
        # ( Voir script DAYCARE )
       
        # ID = Base mère
        baby_id = base_id(mother.id)
       
        # Cf Pokemon_Custom
        baby_id = breeding_custom_rules(baby_id, mother, father)
       
        initialize(baby_id, 1)
       
        # Réglage capa spé
        common_ability = (Pokemon_Info.ability_list(mother.id) & Pokemon_Info.ability_list(father.id))
        if common_ability.include?(mother.ability_name)
          @ability = mother.ability
        end
       
        # Réglages skills : skill connus en commun
        common_skills = mother.skills & father.skills
        for skill in common_skills
          if @skills_table.assoc(skill) != nil
            @skills_set.push(Skill.new(skill))
          end
        end
       
        # Réglages skills : skill en ct/cs connus par le père
        for skill in father.skills
          if @skills_allow.include?(skill)
            @skills_set.push(Skill.new(skill))
          end
        end
       
        # Réglages skills : skill par accouplement connus par le père
        common_breed_skills = breed_move & father.skills
        for skill in common_breed_skills
          @skills_set.push(Skill.new(skill))
        end
       
        # On garde les 4 derniers
        if @skills_set.length > 4
          @skills_set = @skills_set[-4..-1]
        end
       
        # Heritage des DV
        dv_list = []
        while dv_list.length < 3
          dv_list.push(rand(6))
          dv_list.uniq!
        end
        for dv in dv_list
          parent = rand(2) == 0 ? mother : father
          case dv
          when 0
            @dv_hp = parent.dv_hp
          when 1
            @dv_atk = parent.dv_atk
          when 2
            @dv_dfe = parent.dv_dfe
          when 3
            @dv_spd = parent.dv_spd
          when 4
            @dv_ats = parent.dv_ats
          when 5
            @dv_dfs = parent.dv_dfs
          end
        end
      else
        return self
      end
      @egg = true
      @given_name = name
      @step_remaining = hatch_step
      return self
    end
   
    #--------------------------------------------------------------------------
    # retourne la forme basique d'un Pokémon
    #--------------------------------------------------------------------------
    def base_id(mother_id)
      finish = false
      current_id = mother_id
      while not finish
        back = false
        for i in 1...$data_pokemon.length
          list = Pokemon_Info.evolve_table(i).flatten
          if list.include?(Pokemon_Info.name(current_id))
            current_id = i
            back = true
            break
          end
        end
        if not back
          finish = true
        end
      end
      return current_id
    end
   
    #--------------------------------------------------------------------------
    # réduit les pas avant éclosion
    #--------------------------------------------------------------------------
    def decrease_step
      if not @egg
        return
      end
      @step_remaining -= 1
      if @step_remaining <= 0
        scenebis = Pokemon_Evolve.new(self, @id)
        scenebis.main
        Graphics.transition
      end
    end
   
   
  end
 
end