Code: |
---------- Erreur de script : Pokemon_Battle_Wild ---------- ----- Type ArgumentError ----- Message wrong number of arguments(5 for 3) ----- Position dans Pokemon_Battle_Wild Ligne 643 ----- Backtrace Script : Pokemon_Battle_Wild | Ligne : 643 | Méthode : in `initialize' Script : Pokemon_Battle_Wild | Ligne : 643 | Méthode : in `new' Script : Pokemon_Battle_Wild | Ligne : 643 | Méthode : in `qu_catch_pokemon' Script : Fonctions quêtes | Ligne : 47 | Méthode : in `catch_pokemon' Script : Pokemon_Battle_Wild | Ligne : 369 | Méthode : in `actor_item_use' Script : Pokemon_Battle_Core 1 | Ligne : 512 | Méthode : in `phase2' Script : Pokemon_Battle_Core 1 | Ligne : 416 | Méthode : in `update' Script : Pokemon_Battle_Core 1 | Ligne : 156 | Méthode : in `main' Script : Pokemon_Battle_Core 1 | Ligne : 153 | Méthode : in `loop' Script : Pokemon_Battle_Core 1 | Ligne : 160 | Méthode : in `main' Script : Main | Ligne : 49 |
Code: |
#============================================================================== # ■ Pokemon_Battle_Wild # Pokemon Script Project - Krosk # 20/07/07 #----------------------------------------------------------------------------- # Scène à ne pas modifier de préférence #----------------------------------------------------------------------------- # Système de Combat - Pokémon Sauvage #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # 0: Normal, 1: Poison, 2: Paralysé, 3: Brulé, 4:Sommeil, 5:Gelé, 8: Toxic # @confuse (6), @flinch (7) #----------------------------------------------------------------------------- # 1 Normal 2 Feu 3 Eau 4 Electrique 5 Plante 6 Glace 7 Combat 8 Poison 9 Sol # 10 Vol 11 Psy 12 Insecte 13 Roche 14 Spectre 15 Dragon 16 Acier 17 Tenebres #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # $battle_var.action_id # 0 : Phase de Sélection # 1 : Sélection Item # 2 : Switch Pokémon # 4 : Switch Fin de Tour #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Ordre de déroulement du combat (update) # # #----------------------------------------------------------------------------- module POKEMON_S #------------------------------------------------------------ # Pokemon_Battle_Wild # scene #------------------------------------------------------------ class Pokemon_Battle_Wild < Pokemon_Battle_Core attr_accessor :z_level attr_accessor :actor_status attr_accessor :actor #------------------------------------------------------------ # Fonction d'initialisation # Appel: $scene = POKEMON_S::Pokemon_Battle_Wild.new( # party, pokemon, ia) # party: $pokemon_party (classe Pokemon_Party) # pokemon: class Pokemon # ia: Fausse AI #------------------------------------------------------------ def initialize(party, pokemon, ia = false, lose_able = false) @z_level = 100 @ia = ia @lose = lose_able $sauvage = true $battle_var.reset # Assignations données des Pokémons @enemy = pokemon @enemy.statistic_refresh @enemy.hp = @enemy.max_hp ###@enemy = $pokemon_party.actors[0].clone if not(@enemy.given_name.include?("sauvage")) @enemy.given_name += " sauvage" end $battle_var.enemy_party.actors[0] = @enemy @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_flee_enemy = 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 = @enemy.battler_face $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 #------------------------------------------------------------ # Animations pré-combat #------------------------------------------------------------ def pre_battle_transition # Jingle et BGM $game_system.bgm_play($game_system.battle_bgm) Audio.me_play("Audio/ME/battle_jingle.mid") Graphics.freeze # Sélection transition s = (rand(BATTLE_TRANS)+1).to_s @background.bitmap = RPG::Cache.picture("black.png") Graphics.transition(100, "Graphics/Transitions/battle"+ s +".png") Audio.me_stop # Dessin Graphics.freeze @background.bitmap = RPG::Cache.battleback(@battleback_name) @message_background.bitmap = $game_variables[5000]["menu_dp"] ? RPG::Cache.battleback("dummy_" + $game_map.battleback_name + ".png") : RPG::Cache.battleback(BATTLE_MSG) @enemy_sprite.bitmap = RPG::Cache.battler(@start_enemy_battler, 0) ###@enemy_sprite.bitmap = RPG::Cache.battler("ENEMY.png", 0) @enemy_sprite.ox = @enemy_sprite.bitmap.width / 2 @enemy_sprite.oy = @enemy_sprite.bitmap.height / 2 @enemy_sprite.x -= 782 @enemy_sprite.color = Color.new(60,60,60,128) @enemy_ground.bitmap = RPG::Cache.battleback(@ground_name) @enemy_ground.ox = @enemy_ground.bitmap.width / 2 @enemy_ground.oy = @enemy_ground.bitmap.height / 2 @enemy_ground.zoom_x = @enemy_ground.zoom_y = 2.0/3 @enemy_ground.x -= 782 @actor_ground.bitmap = RPG::Cache.battleback(@ground_name) @actor_ground.ox = @actor_ground.bitmap.width / 2 @actor_ground.oy = @actor_ground.bitmap.height @actor_ground.x += 782 @actor_sprite.bitmap = RPG::Cache.battler(@start_actor_battler, 0) @actor_sprite.ox = @actor_sprite.bitmap.width / 2 @actor_sprite.oy = @actor_sprite.bitmap.height @actor_sprite.x += 782 Graphics.transition(50, "Graphics/Transitions/battle0.png") end def pre_battle_animation # Glissement des sprites loop do @enemy_sprite.x += 17 @enemy_ground.x += 17 @actor_sprite.x -= 17 @actor_ground.x -= 17 Graphics.update if @enemy_sprite.x == 464 until @enemy_sprite.color.alpha <= 0 @enemy_sprite.color.alpha -= 20 Graphics.update end break end end # Texte draw_text("Un " + @enemy.given_name, "apparait!") if FileTest.exist?(@enemy.cry) Audio.se_play(@enemy.cry) end # Arrivé du panel de l'adversaire @enemy_status.x -= 300 @enemy_status.visible = true if @enemy.shiny animation = $data_animations[496] @enemy_sprite.animation(animation, true) end loop do @enemy_sprite.x -= 3*(-1)**(@enemy_sprite.x) @enemy_status.x += 20 @enemy_sprite.update Graphics.update if @enemy_status.x == 23 until not(@enemy_sprite.effect?) @enemy_sprite.update Graphics.update end @enemy_sprite.x = 464 break end end # Attente appui de touche loop do Graphics.update Input.update if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) break end end # Dégagement du sprite dresseur loop do @actor_sprite.x -= 20 Graphics.update if @actor_sprite.x <= -200 @actor_sprite.bitmap = RPG::Cache.battler(@actor.battler_back, 0) ###@actor_sprite.bitmap = RPG::Cache.battler("ACTOR.png", 0) break end end # Envoi du pokémon (animation) launch_pokemon @text_window.contents.clear Graphics.update end #------------------------------------------------------------ # Déroulement #------------------------------------------------------------ def enemy_skill_decision action = true # ------- ---------- --------- -------- # Saut de phase de sélection (ennemi) # action = false : saut # action = true : pas de saut # ------- ---------- --------- -------- action = phase_jump(true) @enemy_action = 1 # Décision skill ennemi if not(@actor.dead?) and action list = [] for i in 0.. @enemy.skills_set.size - 1 list.push(i) end list.shuffle! # Skill sans PP // Lutte @enemy_skill = Skill.new(165) # ---------- for i in list if @enemy.skills_set[i].usable? @enemy_skill = @enemy.skills_set[i] end end end if @ia and not(@actor.dead?) and action # Skill sans PP // Lutte @enemy_skill = Skill.new(165) rate_list = {} i = 0 for skill in @enemy.skills_set if skill.usable? rate_list[i] = ia_rate_calculation(skill, @enemy, @actor) else rate_list[i] = 0 end i += 1 end # Tri dans l'ordre decroissant de valeur sorted_list = rate_list.sort {|a,b| b[1]<=a[1]} #for element in sorted_list # print(@enemy.skills_set[element[0]].name) # print(element[1]) #end # Decision prioritaire: max dégat ou soin # Valeur seuil: 200 # si une attaque/défense dépasse ce seuil, il est choisi if sorted_list[0][1] > 200 @enemy_skill = @enemy.skills_set[sorted_list[0][0]] else # Decision par pallier i = rand(100) # Taux de decision taux = [100, 25, 5, 0] for a in 0..3 if i <= taux[a] and sorted_list[a] != nil and sorted_list[a][1] != 0 @enemy_skill = @enemy.skills_set[sorted_list[a][0]] end end end end if not(action) # Reprise du skill précédent @enemy_skill = $battle_var.enemy_last_used end end #------------------------------------------------------------ # Rounds #------------------------------------------------------------ def end_battle_check @actor_status.refresh @enemy_status.refresh if @enemy.dead? and not(@party.dead?) end_battle_victory elsif @actor.dead? if @party.dead? end_battle_defeat else draw_text("Voulez-vous appeler", "un autre Pokémon?") if draw_choice $battle_var.window_index = @action_window.index scene = POKEMON_S::Pokemon_Party_Menu.new(0) scene.main return_data = scene.return_data # Switch de Pokémon if $battle_var.action_id == 4 or $battle_var.action_id == 6 @switch_id = return_data actor_pokemon_switch end elsif run_able?(@actor, @enemy) run else fail_flee $battle_var.window_index = @action_window.index scene = POKEMON_S::Pokemon_Party_Menu.new(0) scene.main return_data = scene.return_data # Switch de Pokémon if $battle_var.action_id == 4 or $battle_var.action_id == 6 @switch_id = return_data actor_pokemon_switch end end end end end #------------------------------------------------------------ # Items #------------------------------------------------------------ def actor_item_use # items à utiliser # Item déjà utilisé ie remplacé par 0 if @item_id == 0 return end if Item.data(@item_id)["flee"] end_battle_flee return end if Item.data(@item_id)["ball"] ball_data = Item.data(@item_id)["ball"] if catch_pokemon(ball_data) @enemy.given_name = @enemy.name @enemy.ball_data = ball_data # Changement de surnom string1 = "Voulez-vous changer le" string2 = "surnom de " + @enemy.given_name + "?" draw_text(string1, string2) if draw_choice draw_text("") scene = POKEMON_S::Pokemon_Name.new(@enemy, @z_level + 50) scene.main end # Intégration au PC if $pokemon_party.size < 6 $pokemon_party.add(@enemy) else $pokemon_party.store_captured(@enemy) string1 = @enemy.given_name string2 = "est envoyé au PC." draw_text(string1, string2) wait(40) end $battle_var.result_win = true end_battle end end end #------------------------------------------------------------ # Lancer de pokéball #------------------------------------------------------------ def catch_pokemon(ball_data) # Initialisation des données ball_name = ball_data[0] ball_rate = ball_data[1] ball_sprite = ball_data[2] ball_open_sprite = ball_data[3] ball_color = ball_data[4] if @enemy.asleep? or @enemy.frozen? status_multiplier = 2 elsif @enemy.burn? or @enemy.paralyzed? or @enemy.poisoned? or @enemy.toxic? status_multiplier = 1.5 else status_multiplier = 1 end if ball_rate.type == Array case ball_rate[0] when "type" if ball_rate[1].include?(@enemy.type1) ball_rate = ball_rate[2] elsif ball_rate[1].include?(@enemy.type2) ball_rate = ball_rate[2] elsif ball_rate[3] != nil ball_rate = ball_rate[3] else ball_rate = 1 end when "id" if ball_rate[1].include?(@enemy.id) ball_rate = ball_rate[2] elsif ball_rate[3] != nil ball_rate = ball_rate[3] else ball_rate = 1 end when "level" max = 99 if ball_rate[2] != nil max = ball_rate[2] end ball_rate = eval( sprintf( ball_rate[1], @enemy.level ) ) if ball_rate <= 1 ball_rate = 1 end if ball_rate >= max ball_rate = max end when "time" max = 99 if ball_rate[2] != nil max = ball_rate[2] end ball_rate = eval( sprintf( ball_rate[1], $battle_var.round ) ) if ball_rate <= 1 ball_rate = 1 end if ball_rate >= max ball_rate = max end when "vol" if ball_rate[2] != nil ball_rate = ball_rate[2] else ball_rate = 1 end when "genre" if ball_rate[1][@actor.gender] != nil ball_rate = eval(sprintf(ball_rate[1][@actor.gender], @actor_gender)) else if ball_rate[1][0] != nil ball_rate = eval(sprintf(ball_rate[1][0], 0)) else ball_rate = 1 end end when "taille" height = Pokemon_Info.height(@enemy.id).split(' ')[0].to_i ball_rate = eval(sprintf(ball_rate[1], height)) if ball_rate == nil or ball_rate < 1 ball_rate = 1 end when "poids" weight = Pokemon_Info.weight(@enemy.id).split(' ')[0].to_i ball_rate = eval(sprintf(ball_rate[1], weight)) if ball_rate == nil or ball_rate < 1 ball_rate = 1 end when "infos" ball_rate = eval(ball_rate[2].gsub(/%([0-9]+)d/) { ball_rate[1][$1.to_i - 1] }) when "formule" ball_rate = eval(ball_rate[1]) ball_rate = 1 if ball_rate.type != Integer else ball_rate = 1 end end multiplier = @enemy.rareness * (ball_rate) maxhp = @enemy.maxhp_basis hp = @enemy.hp catch_rate = Integer((((maxhp * 3 - hp * 2)*multiplier).to_f/(maxhp*3).to_f)*status_multiplier) catch_value = Integer(1048560 / (Math.sqrt(Math.sqrt(16711680/catch_rate.to_f)))) list = [rand(65536), rand(65536), rand(65536), rand(65536)] j = 4 # nombre de fois que la balle oscille for i in list j -= i > catch_value ? 1 : 0 end # Procédure / Animation # Lancer draw_text(Player.name + " utilise", ball_name + "!") @ball_sprite = Sprite.new @ball_sprite.bitmap = RPG::Cache.picture(ball_sprite) @ball_sprite.x = -25 @ball_sprite.y = 270 @ball_sprite.z = @z_level + 16 t = 0.0 pi = Math::PI loop do t += 16 @ball_sprite.y = (270.0 - 230.0 * Math.sin(2 * pi / 3.0 * t / 445.0)).to_i @ball_sprite.x = -15 + t Graphics.update if @ball_sprite.x >= 445 @ball_sprite.bitmap = RPG::Cache.picture(ball_open_sprite) break end end count = j # "Aspiration" @enemy_sprite.color = ball_color @enemy_sprite.color.alpha = 0 @ball_sprite.z -= 2 until @enemy_sprite.color.alpha >= 255 @flash_sprite.opacity += 50 @enemy_sprite.color.alpha += 50 Graphics.update end Audio.se_play("Audio/SE/Pokeopen.wav") loop do @enemy_sprite.zoom_x -= 0.1 @enemy_sprite.zoom_y -= 0.1 @enemy_sprite.opacity -= 25 @flash_sprite.opacity -= 25 Graphics.update if @enemy_sprite.zoom_x <= 0.1 @flash_sprite.opacity = 0 @enemy_sprite.opacity = 0 break end end @ball_sprite.bitmap = RPG::Cache.picture(ball_sprite) # Oscillement t = 0 r = 0 loop do t += 1 @ball_sprite.y = 81 + 50*(1-Math.exp(-t/20.0)*(Math.cos(t*2*pi/30.0)).abs) if @ball_sprite.y >= 81+45 and r < 6 r += 1 Audio.se_play("Audio/SE/Pokerebond.wav") end Graphics.update if t >= 60 break end end while count > 0 count -= 1 t = 0 Audio.se_play("Audio/SE/Pokemove.wav") loop do t += 4 @ball_sprite.angle = 40*Math.sin(2*pi*t/100.0) @ball_sprite.x = 449 - 12*Math.sin(2*pi*t/100.0) @ball_sprite.y = 131 + 12*Math.sin(2*pi*t/100.0) Graphics.update if t == 100 @ball_sprite.angle = 0 break end end end if j != 4 # Echappé @ball_sprite.bitmap = RPG::Cache.picture(ball_open_sprite) @ball_sprite.z -= 1 Audio.se_stop Audio.se_play("Audio/SE/Pokeopenbreak.wav") @enemy_sprite.oy = @enemy_sprite.bitmap.height @enemy_sprite.y += @enemy_sprite.bitmap.height / 2 + 34 loop do @enemy_sprite.opacity += 25 @enemy_sprite.zoom_x += 0.1 @enemy_sprite.zoom_y += 0.1 @ball_sprite.opacity -= 25 @flash_sprite.opacity += 25 Graphics.update if @enemy_sprite.zoom_x >= 1 @enemy_sprite.oy = @enemy_sprite.bitmap.height / 2 @enemy_sprite.y -= @enemy_sprite.bitmap.height / 2 + 34 Graphics.update @ball_sprite.dispose break end end until @enemy_sprite.color.alpha <= 0 @enemy_sprite.color.alpha -= 25 @flash_sprite.opacity -= 25 Graphics.update end @enemy_sprite.color.alpha = 0 @enemy_sprite.opacity = 255 @flash_sprite.opacity = 0 Graphics.update string1 = j == 3 ? "Mince!" : j == 2 ? "Aaaah!" : j == 1 ? "Raah!" : "Oh non!" string2 = j == 3 ? "Ca y était presque!" : j == 2 ? "Presque!" : j == 1 ? "Ca y était presque!" : "Le POKéMON s'est libéré!" draw_text(string1, string2) wait(40) else # Attrapé Audio.me_play("Audio/ME/PkmRS-Caught.mid") @enemy_caught = true draw_text("Et hop! " + @enemy.given_name , "est attrapé!") wait(50) wait_hit if not($data_pokedex[@enemy.id][1]) draw_text(@enemy.name + " est ajouté", "au pokédex.") wait(50) wait_hit $data_pokedex[@enemy.id][0] = true $data_pokedex[@enemy.id][1] = true [color=#990000] scene = POKEMON_S::Pokemon_Detail.new(@enemy.id, false, 0, "combat", 9999)[/color] scene.main wait_hit wait(40) end until @ball_sprite.opacity <= 0 @ball_sprite.opacity -= 25 Graphics.update end $pokemon_party.incr_nb_matchs for actor in $pokemon_party.actors if $battle_var.have_fought.include?(actor.party_index) actor.fight[0] += 1 if actor.dead? and not(actor.vaudou) actor.vaudou = (actor.medaille == nil ? false : $data_medaille[actor.medaille][4]) if actor.vaudou draw_text(actor.name + " subit la","malédiction !") wait(40) wait_hit end else actor.fight[1] += 1 end end end end if j != 4 return false elsif j == 4 return true end end #------------------------------------------------------------ # Fin de combat #------------------------------------------------------------ def end_battle_victory $pokemon_party.incr_nb_matchs for actor in $pokemon_party.actors if $battle_var.have_fought.include?(actor.party_index) actor.fight[0] += 1 if actor.dead? and not(actor.vaudou) actor.vaudou = actor.medaille == nil ? false : $data_medaille[actor.medaille][4] if actor.vaudou draw_text(actor.name + " subit la","malédiction !") wait(40) wait_hit end else actor.fight[1] += 1 end end end #Audio.bgm_fade(800) $battle_var.result_win = true @actor_status.z = @z_level + 15 #$game_system.me_play($game_system.battle_end_me) Audio.me_play("Audio/ME/fainted_jingle.mid") Audio.bgm_play("Audio/BGM/PkmRS-Victory.mid") # Réduction du nombre de participants $battle_var.have_fought.uniq! for index in $battle_var.have_fought actor = $pokemon_party.actors[index] if actor.dead? $battle_var.have_fought.delete(index) end end number = $battle_var.have_fought.length @enemy.skill_effect_reset @enemy.reset_stat_stage evolve_checklist = [] type = 1 # PIECE RUNE/AMULET COIN money_rate = 1 # EXP SHARE/MULTI EXP exp_share_number = 0 for pokemon in $pokemon_party.actors if not(pokemon.dead?) and Item.data(pokemon.item_hold)["expshare"] exp_share_number += 1 end end # Exp de bataille for actor in $pokemon_party.actors if actor.dead? next end amount = nil if $battle_var.have_fought.include?(actor.party_index) amount = actor.exp_calculation(@enemy.battle_list, @enemy.level, number, type, exp_share_number) # Tag objet if Item.data(actor.item_hold)["amuletcoin"] money_rate = 2 end end if Item.data(actor.item_hold)["expshare"] and not($battle_var.have_fought.include?(actor.party_index)) and not(actor.dead?) amount = actor.exp_calculation(@enemy.battle_list, @enemy.level, number, type, exp_share_number, 0) end if amount != nil actor.skill_effect_reset actor.reset_stat_stage actor.add_bonus(@enemy.battle_list) draw_text(actor.given_name + " a gagné", amount.to_s + " points d'expérience!") Graphics.update wait_hit for i in 1..amount actor.add_exp_battle(1) if actor.level_check actor.level_up(self) evolve_checklist.push(actor) end if actor == @actor if @actor.exp_list[@actor.level+1] != nil and @actor.level < MAX_LEVEL divide = (@actor.exp_list[@actor.level+1]-@actor.exp_list[@actor.level])/192 if divide == 0 divide = 1 end if (@actor.exp - @actor.exp_list[@actor.level])%divide == 0 @actor_status.exp_refresh Graphics.update end end end end end end @actor_status.refresh Graphics.update if $battle_var.money > 0 $battle_var.money *= money_rate draw_text(Player.name + " gagne " + ($battle_var.money).to_s + "$!") $pokemon_party.add_money($battle_var.money) wait(40) end wait(30) $game_system.bgm_play($game_temp.map_bgm) for actor in evolve_checklist info = actor.evolve_check if info != false scene = POKEMON_S::Pokemon_Evolve.new(actor, info, @z_level + 200) scene.main end end end_battle end end end |
Code: |
class Pokemon_Detail |
Code: |
def initialize(id, show, mode = 0) @id = id @show = show @mode = mode @table = [] # Regional if POKEMON_S._DEXREG for id in 1..$data_pokedex.length-1 @table[Pokemon_Info.id_bis(id)] = id end @table.shift # débarasser l'élément 0 @table.compact! else # National for id in 1..$data_pokedex.length-1 @table.push(id) end end end def main # Fenêtre détail @background = Sprite.new @background.bitmap = RPG::Cache.picture("PokedexShfond1.png") @background.z = 0 # Sprite @pokemon_sprite = Sprite.new @pokemon_sprite.x = 26 @pokemon_sprite.y = 71 @pokemon_sprite.z = 10 @pokemon_sprite.visible = false # Identité @data_window = Window_Base.new(233-16, 76-16, 370+32, 196+32) @data_window.contents = Bitmap.new(370, 196) color = Color.new(60,60,60) @data_window.contents.font.name = $fontface @data_window.contents.font.size = $fontsizebig @data_window.contents.font.color = color @data_window.opacity = 0 @data_window.z = 10 @data_window.visible = false # Descr @text_window = Window_Base.new(60 - 16, 252 - 16 + 51, 550 + 32, 160 + 32) @text_window.contents = Bitmap.new(550 , 160) @text_window.contents.font.name = $fontface @text_window.contents.font.size = $fontsize @text_window.contents.font.color = color @text_window.opacity = 0 @text_window.z = 10 @text_window.visible = false @list = [] for i in 0.. @table.length-1 if $data_pokedex[@table[i]][0] @list.push(@table[i]) end end if @mode == 0 filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav" if FileTest.exist?(filename) Audio.se_play(filename) end end data_refresh @background.visible = false @pokemon_sprite.visible = false @data_window.visible = false @text_window.visible = false case @mode when 0 @background.visible = true @pokemon_sprite.visible = true @data_window.visible = true @text_window.visible = true when 1 refresh_zone when 2 refresh_cri when 3 refresh_tail end Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @background.dispose @data_window.dispose @pokemon_sprite.dispose @text_window.dispose end def update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) Graphics.freeze hide if @show == true index = @table.index(@id) $scene = POKEMON_S::Pokemon_Pokedex_List.new(@table,@list, @show, index) else index = @list.index(@id) $scene = POKEMON_S::Pokemon_Pokedex_List.new(@list,@table, @show, index) end return end if Input.trigger?(Input::C) and @mode == 1 Graphics.freeze hide $game_system.se_play($data_system.decision_se) $game_temp.map_temp = ["PKDX", false, $game_map.map_id, $game_player.x, $game_player.y, $game_player.direction, $game_player.character_name, $game_player.character_hue, $game_player.step_anime, $game_system.menu_disabled, POKEMON_S::_MAPLINK, @id, @show] $game_temp.transition_processing = true $game_temp.transition_name = "" POKEMON_S::_MAPLINK = false $scene = Scene_Map.new $game_map.setup(POKEMON_S::_WMAPID) $game_player.moveto(9, 7) $game_map.autoplay $game_map.update return end if Input.trigger?(Input::C) and @mode == 2 filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav" if FileTest.exist?(filename) Audio.se_play(filename) end end if Input.trigger?(Input::DOWN) Graphics.freeze index = @list.index(@id) if @id == @list.last @id = @list.first else @id = @list[index+1] end hide Graphics.transition(5) Graphics.freeze @mode = 0 data_refresh Graphics.transition filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav" if FileTest.exist?(filename) Audio.se_play(filename) end end if Input.trigger?(Input::UP) Graphics.freeze index = @list.index(@id) if @id == @list.first @id = @list.last else @id = @list[index-1] end hide Graphics.transition(5) Graphics.freeze @mode = 0 data_refresh Graphics.transition filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav" if FileTest.exist?(filename) Audio.se_play(filename) end end if Input.trigger?(Input::LEFT) if @mode > 0 Graphics.freeze hide #Graphics.transition(1) @mode -= 1 #Graphics.freeze case @mode when 0 data_refresh when 1 refresh_zone when 2 refresh_cri when 3 refresh_tail end Graphics.transition(1) end end if Input.trigger?(Input::RIGHT) if @mode < 3 Graphics.freeze hide #Graphics.transition(1) @mode += 1 #Graphics.freeze case @mode when 0 data_refresh when 1 refresh_zone when 2 refresh_cri when 3 refresh_tail end Graphics.transition(1) end end end def hide @background.visible = false @pokemon_sprite.visible = false case @mode when 0 @data_window.visible = false @text_window.visible = false when 1 @text.dispose when 2 @data_window.visible = false @text_window.visible = false when 3 @trainer.dispose @pokemon_new_sprite.dispose @text.dispose end end def data_refresh @background.bitmap = RPG::Cache.picture("PokedexShfond1.png") @pokemon_sprite.x = 26 @pokemon_sprite.y = 71 @data_window.x = 233-16 @data_window.y = 76-16 @pokemon_sprite.visible = true @background.visible = true @data_window.visible = true @text_window.visible = true @pokemon = $data_pokemon[@id] show = $data_pokedex[@id][1] ida = sprintf("%03d", @id) @pokemon_sprite.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0) if POKEMON_S._DEXREG name = "N." + sprintf("%03d", Pokemon_Info.id_bis(@id)) + " " + @pokemon[0] else name = "N." + ida + " " + @pokemon[0] end if show # Descr accessible species = @pokemon[9][1] height_data = @pokemon[9][2] weight = @pokemon[9][3] else species = "???" height_data = "???" weight = "??? " end @data_window.contents.clear @data_window.contents.draw_text(15, 0, 370, 47, name) @data_window.contents.draw_text(15, 41, 370, 47, "Pokémon " + species) @data_window.contents.draw_text(41, 95, 230, 47, "Taille: ") @data_window.contents.draw_text(41, 95, 212, 47, height_data, 2) @data_window.contents.draw_text(41, 148, 230, 47, "Poids: ") @data_window.contents.draw_text(41, 148, 230, 47, weight, 2) @text_window.contents.clear if show text = @pokemon[9][0] string = string_builder(text, 51) string1 = string[0] string2 = string[1] string3 = string[2] string4 = string[3] @text_window.contents.draw_text(0, 0, 550, 40, string1) @text_window.contents.draw_text(0, 40, 550, 40, string2) @text_window.contents.draw_text(0, 80, 550, 40, string3) @text_window.contents.draw_text(0, 120, 550, 40, string4) end end def refresh_zone @background.bitmap = RPG::Cache.picture("PokedexShfond2.png") @background.visible = true @text = Window_Base.new(32-16, 223-16, 576+32, 47+32) @text.contents = Bitmap.new(576, 47) @text.contents.font.name = $fontface @text.contents.font.size = $fontsizebig @text.contents.font.color = Color.new(60,60,60) @text.contents.draw_text(0, 0, 576, 47, "OUVRIR LA CARTE", 1) @text.opacity = 0 end def refresh_cri @background.bitmap = RPG::Cache.picture("PokedexShfond3.png") @pokemon_sprite.visible = true @background.visible = true @data_window.visible = true @pokemon_sprite.x = 26 @pokemon_sprite.y = 75 @data_window.x = 211 - 16 @data_window.y = 75 - 5 @data_window.contents.clear @data_window.contents.draw_text(50, 27, 339, 47, "CRI DE") @data_window.contents.draw_text(50, 68, 339, 47, @pokemon[0]) end def refresh_tail @background.bitmap = RPG::Cache.picture("PokedexShfond4.png") @background.visible = true @pokemon_new_sprite = Sprite.new ida = sprintf("%03d", @id) @pokemon_new_sprite.bitmap = RPG::Cache.battler("Front_Male/" + ida + ".png", 0) @pokemon_new_sprite.color = Color.new(0, 0, 0, 255) @trainer = Sprite.new @trainer.bitmap = RPG::Cache.battler("trainer000.png", 0) @trainer.color = Color.new(0, 0, 0, 255) sizes = [] for sprite in [@trainer, @pokemon_new_sprite] i = j = 0 while sprite.bitmap.get_pixel(i,j).alpha == 0 i += 1 if i > sprite.bitmap.width i = 0 j += 1 end end up_pix = j i = 0 j = sprite.bitmap.height while sprite.bitmap.get_pixel(i,j).alpha == 0 i += 1 if i > sprite.bitmap.width i = 0 j -= 1 end end down_pix = j sizes.push( down_pix-up_pix + 0.0 ) sizes.push( down_pix ) end if $data_pokemon[@id][9][2].to_f > 1.50 zoom_pok = 1.00 zoom_dre = 1.50 / $data_pokemon[@id][9][2].to_f * sizes[2] / sizes[0] else zoom_pok = $data_pokemon[@id][9][2].to_f/1.50 * sizes[0] / sizes[2] zoom_dre = 1.00 end @pokemon_new_sprite.ox = @pokemon_new_sprite.bitmap.width/2 @pokemon_new_sprite.oy = sizes[3]#@pokemon_new_sprite.bitmap.height @pokemon_new_sprite.x = 141 + @pokemon_new_sprite.ox @pokemon_new_sprite.y = 92 + 160#@pokemon_new_sprite.oy @trainer.ox = @trainer.bitmap.width/2 @trainer.oy = sizes[1]#@trainer.bitmap.height @trainer.x = 339 + @trainer.ox @trainer.y = 92 + 160 #@trainer.oy @pokemon_new_sprite.zoom_x = @pokemon_new_sprite.zoom_y = zoom_pok @trainer.zoom_x = @trainer.zoom_y = zoom_dre @text = Window_Base.new(32-16, 367-16, 576+32, 47+32) @text.contents = Bitmap.new(576, 47) @text.contents.font.name = $fontface @text.contents.font.size = $fontsizebig @text.contents.font.color = Color.new(60,60,60) @text.contents.draw_text(0, 0, 576, 47, "TAILLE COMPARE A #{Player.name}", 1) @text.opacity = 0 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 return [string1, string2, string3, string4] end end end |
Code: |
class Pokemon_Detail |
Code: |
def hide |
Code: |
def initialize(id, show, mode = 0, appel = "pkdx", z_level = 100) @id = id @show = show @mode = mode @appel = appel @z_level = z_level @table = [] # Regional if POKEMON_S._DEXREG for id in 1..$data_pokedex.length-1 @table[Pokemon_Info.id_bis(id)] = id end @table.shift # débarasser l'élément 0 @table.compact! else # National for id in 1..$data_pokedex.length-1 @table.push(id) end end end def main # Fenêtre détail @background = Sprite.new @background.bitmap = RPG::Cache.picture("PokedexShfond1.png") @background.z = @z_level # Sprite @pokemon_sprite = Sprite.new @pokemon_sprite.x = 26 @pokemon_sprite.y = 71 @pokemon_sprite.z = 10 + @z_level @pokemon_sprite.visible = false # Identité @data_window = Window_Base.new(233-16, 76-16, 370+32, 196+32) @data_window.contents = Bitmap.new(370, 196) color = Color.new(60,60,60) @data_window.contents.font.name = $fontface @data_window.contents.font.size = $fontsizebig @data_window.contents.font.color = color @data_window.opacity = 0 @data_window.z = 10 + @z_level @data_window.visible = false # Descr @text_window = Window_Base.new(60 - 16, 252 - 16 + 51, 550 + 32, 160 + 32) @text_window.contents = Bitmap.new(550 , 160) @text_window.contents.font.name = $fontface @text_window.contents.font.size = $fontsize @text_window.contents.font.color = color @text_window.opacity = 0 @text_window.z = 10 + @z_level @text_window.visible = false @list = [] for i in 0.. @table.length-1 if $data_pokedex[@table[i]][0] @list.push(@table[i]) end end if @mode == 0 filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav" if FileTest.exist?(filename) Audio.se_play(filename) end end data_refresh @background.visible = false @pokemon_sprite.visible = false @data_window.visible = false @text_window.visible = false case @mode when 0 @background.visible = true @pokemon_sprite.visible = true @data_window.visible = true @text_window.visible = true when 1 refresh_zone when 2 refresh_cri when 3 refresh_tail end Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @background.dispose @data_window.dispose @pokemon_sprite.dispose @text_window.dispose end def update case @appel when "pkdx" if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) Graphics.freeze hide if @show index = @table.index(@id) else index = @list.index(@id) end $scene = Pokemon_Pokedex.new(index, @show) return end if Input.trigger?(Input::C) and @mode == 1 Graphics.freeze hide $game_system.se_play($data_system.decision_se) $game_temp.map_temp = ["PKDX", false, $game_map.map_id, $game_player.x, $game_player.y, $game_player.direction, $game_player.character_name, $game_player.character_hue, $game_player.step_anime, $game_system.menu_disabled, POKEMON_S::_MAPLINK, @id, @show] $game_temp.transition_processing = true $game_temp.transition_name = "" POKEMON_S::_MAPLINK = false $scene = Scene_Map.new $game_map.setup(POKEMON_S::_WMAPID) $game_player.moveto(9, 7) $game_map.autoplay $game_map.update return end if Input.trigger?(Input::C) and @mode == 2 filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav" if FileTest.exist?(filename) Audio.se_play(filename) end end if Input.trigger?(Input::DOWN) Graphics.freeze index = @list.index(@id) if @id == @list.last @id = @list.first else @id = @list[index+1] end hide Graphics.transition(5) Graphics.freeze @mode = 0 data_refresh Graphics.transition filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav" if FileTest.exist?(filename) Audio.se_play(filename) end end if Input.trigger?(Input::UP) Graphics.freeze index = @list.index(@id) if @id == @list.first @id = @list.last else @id = @list[index-1] end hide Graphics.transition(5) Graphics.freeze @mode = 0 data_refresh Graphics.transition filename = "Audio/SE/Cries/" + sprintf("%03d", @id) + "Cry.wav" if FileTest.exist?(filename) Audio.se_play(filename) end end if Input.trigger?(Input::A) and @pokemon_sprite.visible == false @show = @show ? false : true @index = 0 @pokemon_list.dispose @pokemon_list = POKEMON_S::Pokemon_List.new(@list, @index, @show) @pokemon_list.active = true @pokemon_list.update @pokemon_list.refresh end if Input.trigger?(Input::LEFT) if @mode > 0 Graphics.freeze hide #Graphics.transition(1) @mode -= 1 #Graphics.freeze case @mode when 0 data_refresh when 1 refresh_zone when 2 refresh_cri when 3 refresh_tail end Graphics.transition(1) end end if Input.trigger?(Input::RIGHT) if @mode < 3 Graphics.freeze hide #Graphics.transition(1) @mode += 1 #Graphics.freeze case @mode when 0 data_refresh when 1 refresh_zone when 2 refresh_cri when 3 refresh_tail end Graphics.transition(1) end end when "map" if Input.trigger?(Input::B) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::C) $game_system.se_play($data_system.cancel_se) Graphics.freeze $scene = Scene_Map.new return end if Input.trigger?(Input::DOWN) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::UP) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::A) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::LEFT) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::RIGHT) $game_system.se_play($data_system.buzzer_se) end when "combat" if Input.trigger?(Input::B) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::C) $game_system.se_play($data_system.cancel_se) Graphics.freeze self.dispose Graphics.transition return end if Input.trigger?(Input::DOWN) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::UP) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::A) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::LEFT) $game_system.se_play($data_system.buzzer_se) end if Input.trigger?(Input::RIGHT) $game_system.se_play($data_system.buzzer_se) end end end |
Code: |
for i in <a href="mailto:0.. @table.length">0..@table.length</a>-1 |