#============================================================================== # ■ Pokemon_Modifier # Pokemon Script Project - Crystal # 7/11/08 #----------------------------------------------------------------------------- # Scène à ne pas modifier #----------------------------------------------------------------------------- # MAJ de différents scripts de PSP
module POKEMON_S $data_trainer = [] $data_trainer[0] = ["", "", "", [], [], 0, ["",""], ["",""]] #$data_trainer[id] = [ #"battler.png", #"TYPE", #"Nom" #[ # [Pokémon 1, niveau, //objet, //[stats avancées], //[skill 1, 2, 3, 4]], # [Pokémon 2, niveau, //objet, //[stats avancées], //[skill 1, 2, 3, 4]], # [Pokémon 3, niveau, //objet, //[stats avancées], //[skill 1, 2, 3, 4]], # [Pokémon 4, niveau, //objet, //[stats avancées], //[skill 1, 2, 3, 4]], # [Pokémon 5, niveau, //objet, //[stats avancées], //[skill 1, 2, 3, 4]], # [Pokémon 6, niveau, //objet, //[stats avancées], //[skill 1, 2, 3, 4]], #], #[ "Objets" ] #Argent, #["String Victoire Ligne 1", "String Victoire Ligne 2"] (Joueur gagnant) #["String Défaite Ligne 1", "String Défaite Ligne 2"] (Joueur perdant) #] $data_troops = load_data("Data/Troops.rxdata") for i in 1..$data_troops.length-1 $data_trainer[i] = [] name = $data_troops[i].name # Vérification Tag tag = (name.split('/'))[0] if tag != "T" $data_trainer[i] = $data_trainer[0] next end # Nom et Type data_name = (name.split('/'))[1] data_name = data_name.split('_') if data_name[1] != nil $data_trainer[i][1] = data_name[0].to_s $data_trainer[i][2] = data_name[1].to_s else $data_trainer[i][1] = "" $data_trainer[i][2] = data_name[0].to_s end # Pokémons list = [] for member in $data_troops[i].members list.push([member.enemy_id, 1, nil, nil, nil]) end # Vérification page event if $data_troops[i].pages == [] # Effacage car invalide $data_trainer[i] = $data_trainer[0] next end # Event Page1 event_list = $data_troops[i].pages[0].list # Effacage si aucun event if event_list == [] $data_trainer[i] = $data_trainer[0] next end for event in event_list case event.code when 322 # Changer Apparence => Définition battler battler = event.parameters[3] $data_trainer[i][0] = battler when 332 # Ajout de MP => Définition Level target = event.parameters[0] operation = event.parameters[1] operand_type = event.parameters[2] operand = event.parameters[3] if operand_type == 0 value = operand else if $game_variables == nil or $game_variables[operand] == nil value = 5 else value = $game_variables[operand] end end value = value.abs case target when -1 # Tous les ennemis => ecart // Rien for element in list element[1] = value end else # Ennemi défini if list[target+1] != nil list[target+1][1] = value end end when 355 # Script index_script = 0 script = event.parameters[0] if script == "Pokemon" pokemon_tag = true else pokemon_tag = false end if script == "Dresseur" trainer_tag = true else trainer_tag = false end when 655 # Script suite if pokemon_tag script = event.parameters[0] # type Hash personnalisé if eval(script).type == Hash and list[index_script] != nil # Niveau list[index_script][1] = eval(script)["NV"] # Objet list[index_script][2] = eval(script)["OBJ"] # Stats avancées list[index_script][3] = eval(script)["STAT"] # Moveset list[index_script][4] = eval(script)["MOVE"] # Genre list[index_script][5] = eval(script)["GR"] # Forme list[index_script][6] = eval(script)["FORM"] # shiny list[index_script][7] = eval(script)["SHINY"] # EV list[index_script][8] = eval(script)["EV"] # Nature list[index_script][9] = eval(script)["NATURE"] end # type Fixnum réglage de niveau seulement if eval(script).type == Fixnum and list[index_script] != nil list[index_script][1] = eval(script) end index_script += 1 end if trainer_tag index_script += 1 script = event.parameters[0] case index_script when 1 # Argent $data_trainer[i][5] = script.to_i when 2 # String Victoire / Défaite $data_trainer[i][6] = [] $data_trainer[i][6][0] = script != nil ? script : "" when 3 $data_trainer[i][6][1] = script != nil ? script : "" when 4 $data_trainer[i][7] = [] $data_trainer[i][7][0] = script != nil ? script : "" when 5 $data_trainer[i][7][1] = script != nil ? script : "" end end end end # Vérification: expulsion des Pokémons sans niveau for pokemon in list if pokemon[1] == nil or pokemon[0] == nil index = list.index(pokemon) list[index] = nil end end list.compact! $data_trainer[i][3] = list end class Pokemon def nature_modifier(nature) case nature when 0, "HARDI" @nature = ["Hardi", 100,100,100,100,100] when 1, "SOLO" @nature = ["Solo", 110,90,100,100,100] when 2, "BRAVE" @nature = ["Brave", 110,100,90,100,100] when 3, "RIGIDE" @nature = ["Rigide", 110,100,100,90,100] when 4, "MAUVAIS" @nature = ["Mauvais", 110,100,100,100,90] when 5, "ASSURE" @nature = ["Assuré", 90,110,100,100,100] when 6, "DOCILE" @nature = ["Docile", 100,100,100,100,100] when 7, "RELAX" @nature = ["Relax", 100,110,90,100,100] when 8, "MALIN" @nature = ["Malin", 100,110,100,90,100] when 9, "LACHE" @nature = ["Lâche", 100,110,100,100,90] when 10, "TIMIDE" @nature = ["Timide", 90,100,110,100,100] when 11, "PRESSE" @nature = ["Pressé", 100,90,110,100,100] when 12, "SERIEUX" @nature = ["Sérieux", 100,100,100,100,100] when 13, "JOVIAL" @nature = ["Jovial", 100,100,110,90,100] when 14, "NAIF" @nature = ["Naif", 100,100,110,100,90] when 15, "MODESTE" @nature = ["Modeste", 90,100,100,110,100] when 16, "DOUX" @nature = ["Doux", 100,90,100,110,100] when 17, "DISCRET" @nature = ["Discret", 100,100,90,110,100] when 18, "BIZARRE" @nature = ["Bizarre", 100,100,100,100,100] when 19, "FOUFOU" @nature = ["Foufou", 100,100,100,110,90] when 20, "CALME" @nature = ["Calme", 90,100,100,100,110] when 21, "GENTIL" @nature = ["Gentil", 100,90,100,100,110] when 22, "MALPOLI" @nature = ["Malpoli", 100,100,90,100,110] when 23, "PRUDENT" @nature = ["Prudent", 100,100,100,90,110] when 24, "PUDIQUE" @nature = ["Pudique", 100,100,100,100,100] end end def ev_modifier(list) for i in 0...list.size list[i] = 255 if list[i] > 255 end if (list[0] + list[1] + list[2] + list[3] + list[4] + list[5]) > 510 p "Erreur de EV" return else @hp_plus = list[0] @atk_plus = list[1] @dfe_plus = list[2] @spd_plus = list[3] @ats_plus = list[4] @dfs_plus = list[5] statistic_refresh @hp = max_hp end end end class Pokemon_Battle_Trainer def initialize(party, trainer_id, ia = false, run_able = false, lose_able = false, capturable = false) @z_level = 0 @ia = ia @trainer_id = trainer_id @run = run_able @lose = lose_able @capture = capturable $battle_var.reset # Création données des Pokémons adverses #$battle_var.enemy_party = Pokemon_Party.new for pokemon_data in Trainer_Info.pokemon_list(@trainer_id) id = pokemon_data[0] level = pokemon_data[1] # Shiny if pokemon_data[6] != nil shiny = pokemon_data[6] else shiny = false end pokemon = Pokemon.new(id, level, shiny) pokemon.given_name += " ennemi" # Paramètres optionnels # Objet if pokemon_data[2] != nil pokemon.item_hold = Item.id(pokemon_data[2]) end # Moveset if pokemon_data[4] != nil i = 0 for skill in pokemon_data[4] if skill != nil and skill != "AUCUN" pokemon.skills_set[i] = Skill.new(Skill_Info.id(skill)) end if skill == "AUCUN" pokemon.skills_set[i] = nil end i += 1 end pokemon.skills_set.compact! end # Stats avancées if pokemon_data[3] != nil and pokemon_data[3].length == 6 pokemon.dv_modifier(pokemon_data[3]) end # Genre if pokemon_data[5] != nil pokemon.set_gender(pokemon_data[5]) end # Forme if pokemon_data[6] != nil pokemon.form = pokemon_data[6] end # EV if pokemon_data[8] != nil and pokemon_data[8].length == 6 pokemon.ev_modifier(pokemon_data[8]) end # Nature if pokemon_data[9] != nil pokemon.nature_modifier(pokemon_data[9]) end $battle_var.enemy_party.actors.push(pokemon) end @enemy = $battle_var.enemy_party.actors[0] $battle_var.enemy_battle_order = [0,1,2,3,4,5] @party = party # Mise à jour Pokedex: Pokémon vu $data_pokedex[@enemy.id][0] = true # Génération ordre de combat @battle_order = Array.new(@party.size) @battle_order.fill {|i| i} # Désignation 1er Pokémon au combat # @actor désigne le (class) Pokémon actor_index = 0 @actor = @party.actors[actor_index] if @actor == nil print("Attention, vous n'avez pas de Pokémon dans votre équipe! Réglez ce bug.") end while @actor.dead? actor_index += 1 @actor = @party.actors[actor_index] end # Correction ordre combat (Pokémon vivant en premier) @battle_order = switch(@battle_order, 0, actor_index) # Remise à zéro résultat $battle_var.result_flee = false $battle_var.result_win = false $battle_var.result_defeat = false # Initialisation des variables de combat @phase = 0 # 0 Non décidé, 1 Attaque, 2 Switch, 3 Item, 4 Fuite @actor_action = 0 @enemy_action = 0 @start_actor_battler = Player.battler #$trainer_battler @start_enemy_battler = Trainer_Info.battler(@trainer_id) $battle_var.have_fought.push(@actor.party_index) $battle_var.battle_order = @battle_order $battle_var.in_battle = true @actor.reset_stat_stage @enemy.reset_stat_stage @actor.skill_effect_reset @enemy.skill_effect_reset @actor_skill = nil @enemy_skill = nil @actor.ability_active = false @enemy.ability_active = false @item_id = 0 # item utilisé end end end class Interpreter def call_battle_wild_parameter(hash, ia = false) if hash["ID"] == nil or hash["NV"] == nil return end pokemon = Pokemon.new(hash["ID"], hash["NV"], hash["SHINY"]) if hash["GR"] != nil and [0, 1, 2, "F", "G", "I"].include?(hash["GR"]) pokemon.set_gender(hash["GR"]) end if hash["FORM"] != nil pokemon.form = hash["FORM"] end if hash["MOVE"] != nil and hash["MOVE"].type == Array i = 0 for skill in hash["MOVE"] if skill != nil and skill != "AUCUN" pokemon.skills_set[i] = Skill.new(Skill_Info.id(skill)) end if skill == "AUCUN" pokemon.skills_set[i] = nil end i += 1 end pokemon.skills_set.compact! end if hash["OBJ"] != nil if hash["OBJ"].type == Fixnum pokemon.item_hold = hash["OBJ"] elsif hash["OBJ"].type == String pokemon.item_hold = Item.id(hash["OBJ"]) end end if hash["STAT"] != nil and hash["STAT"].type == Array and hash["STAT"].length == 6 pokemon.dv_modifier(hash["STAT"]) end if hash["EV"] != nil and hash["EV"].type == Array and hash["EV"].length == 6 pokemon.ev_modifier(hash["EV"]) end if hash["NATURE"] != nil pokemon.nature_modifier(hash["NATURE"]) end $scene = Pokemon_Battle_Wild.new($pokemon_party, pokemon, ia) @wait_count = 2 return true end alias demarrer_combat_param call_battle_wild_parameter def add_pokemon_parameter(hash) if hash["ID"] == nil or hash["NV"] == nil return end pokemon = Pokemon.new(hash["ID"], hash["NV"], hash["SHINY"]) if hash["GR"] != nil and [0, 1, 2, "F", "G", "I"].include?(hash["GR"]) pokemon.set_gender(hash["GR"]) end if hash["FORM"] != nil pokemon.form = hash["FORM"] end if hash["MOVE"] != nil and hash["MOVE"].type == Array i = 0 for skill in hash["MOVE"] if skill != nil and skill != "AUCUN" pokemon.skills_set[i] = Skill.new(Skill_Info.id(skill)) end if skill == "AUCUN" pokemon.skills_set[i] = nil end i += 1 end pokemon.skills_set.compact! end if hash["OBJ"] != nil if hash["OBJ"].type == Fixnum pokemon.item_hold = hash["OBJ"] elsif hash["OBJ"].type == String pokemon.item_hold = Item.id(hash["OBJ"]) end end if hash["STAT"] != nil and hash["STAT"].type == Array and hash["STAT"].length == 6 pokemon.dv_modifier(hash["STAT"]) end if hash["EV"] != nil and hash["EV"].type == Array and hash["EV"].length == 6 pokemon.ev_modifier(hash["EV"]) end if hash["NATURE"] != nil pokemon.nature_modifier(hash["NATURE"]) end ajouter_pokemon_cree(pokemon) end alias ajouter_pokemon_param add_pokemon_parameter end
|