#============================================================================== # ■ Pokemon_Evolve # Pokemon Script Project - Krosk # 01/08/07 #----------------------------------------------------------------------------- # Scène à ne pas modifier de préférence #----------------------------------------------------------------------------- # Scène appelée en cas de evolve #-----------------------------------------------------------------------------
Swi_Evo_Forcee = 2000 # Reglez ici le numero de l'interrupteur qui servira # a forcer l'evolution du pokemon reçu. Attention ! Ce doit etre le même # interrupteur que precedemment !
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 #$game_system.bgm_play($game_temp.map_bgm) $game_temp.map_bgm = $game_system.playing_bgm Audio.bgm_play("Audio/BGM/PkmRS-Evolving.mid") @pokemon = pokemon @evolve_id = evolve_id @background = Sprite.new @background.bitmap = RPG::Cache.battleback($game_map.battleback_name + ".png") @background.z = @z_level @background.color = Color.new(0, 0, 0, 0) @text_window = Window_Base.new(4, 340, 632, 136) @text_window.opacity = 0 @text_window.z = @z_level + 2 @text_window.contents = Bitmap.new(600 + 32, 104 + 32) @text_window.contents.font.name = $fontface @text_window.contents.font.size = $fontsizebig @message_background = Sprite.new @message_background.y = 336 @message_background.z = @z_level + 1 @message_background.bitmap = RPG::Cache.battleback("dummy1.png") @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 = 320 @pokemon_sprite.y = 240 @pokemon_sprite.z = @z_level + 5 @pokemon_sprite.color = Color.new(255,255,255,0) @evolved_sprite = Sprite.new @evolved_sprite.x = 320 @evolved_sprite.y = 240 @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 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 $game_switches[Swi_Evo_Forcee] == false @cancel = true break end end if @cancel until @pokemon_sprite.zoom_x >= 1 @evolved_sprite.zoom_x -= 0.05 @evolved_sprite.zoom_y -= 0.05 @pokemon_sprite.zoom_x += 0.05 @pokemon_sprite.zoom_y += 0.05 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.05 @evolved_sprite.zoom_y += 0.05 @pokemon_sprite.zoom_x -= 0.05 @pokemon_sprite.zoom_y -= 0.05 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.05 @pokemon_sprite.zoom_y -= 0.05 @evolved_sprite.zoom_x += 0.05 @evolved_sprite.zoom_y += 0.05 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 Audio.me_play("Audio/ME/PkmRS-Caught.mid") draw_text("Félicitations! "+@pokemon.given_name, "a évolué en "+$pokemon_info.name(@evolve_id)+"!") wait(40) wait_hit draw_text("", "") $game_switches[Swi_Evo_Forcee] = false 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 @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(12, 0, 460, 50, line1) @text_window.draw_text(12, 55, 460, 50, line2) Graphics.transition(5) 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 |