diff --git a/Data/CommonEvents.rxdata b/Data/CommonEvents.rxdata index e0088e81a..df28a8585 100644 Binary files a/Data/CommonEvents.rxdata and b/Data/CommonEvents.rxdata differ diff --git a/Data/Map531.rxdata b/Data/Map531.rxdata index 633805275..0ec7e72a7 100644 Binary files a/Data/Map531.rxdata and b/Data/Map531.rxdata differ diff --git a/Data/Map659.rxdata b/Data/Map659.rxdata index 0f9ff9ec3..6fb8139dd 100644 Binary files a/Data/Map659.rxdata and b/Data/Map659.rxdata differ diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index 6573333cb..d6871a7c7 100644 Binary files a/Data/MapInfos.rxdata and b/Data/MapInfos.rxdata differ diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb index 01336190b..209607dd3 100644 --- a/Data/Scripts/001_Settings.rb +++ b/Data/Scripts/001_Settings.rb @@ -6,7 +6,7 @@ module Settings # The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format. GAME_VERSION = '5.0.0' - GAME_VERSION_NUMBER = "5.0.34 - beta" + GAME_VERSION_NUMBER = "5.0.35" POKERADAR_LIGHT_ANIMATION_RED_ID = 17 POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18 @@ -29,7 +29,7 @@ module Settings EGGSPRITE_SCALE = 1 BACKSPRITE_POSITION_OFFSET = 20 FRONTSPRITE_POSITION = 200 - SHINY_HUE_OFFSET = 60 + SHINY_HUE_OFFSET = 75 RIVAL_STARTER_PLACEHOLDER_SPECIES = :MEW #(MEW) VAR_1_PLACEHOLDER_SPECIES = :DIALGA diff --git a/Data/Scripts/007_Objects and windows/001_RPG_Cache.rb b/Data/Scripts/007_Objects and windows/001_RPG_Cache.rb index 1d49e8f72..9983699a4 100644 --- a/Data/Scripts/007_Objects and windows/001_RPG_Cache.rb +++ b/Data/Scripts/007_Objects and windows/001_RPG_Cache.rb @@ -140,7 +140,6 @@ end class BitmapWrapper < Bitmap attr_reader :refcount attr_accessor :never_dispose - def dispose return if self.disposed? @refcount -= 1 diff --git a/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb b/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb index db3ecaf9c..2c5db123d 100644 --- a/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb +++ b/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb @@ -2,6 +2,10 @@ # #=============================================================================== class AnimatedBitmap + attr_reader :path + attr_reader :filename + + def initialize(file, hue = 0) raise "Filename is nil (missing graphic)." if file.nil? path = file @@ -11,6 +15,8 @@ class AnimatedBitmap filename = split_file.pop path = split_file.join('/') + '/' end + @filename= filename + @path= path if filename[/^\[\d+(?:,\d+)?\]/] # Starts with 1 or 2 numbers in square brackets @bitmap = PngAnimatedBitmap.new(path, filename, hue) else @@ -30,9 +36,13 @@ class AnimatedBitmap end def shiftColors(offset=0) - offset/=350 if offset >350 + + offset/=360 if offset >360 offset=30 if offset <30 #this method is only used for shinies. shinies that barely shift are boring - @bitmap.bitmap.hue_change(offset) + + @bitmap = GifBitmap.new(@path, @filename, offset) + + #@bitmap.bitmap.hue_change(offset) end def [](index) @@ -243,14 +253,16 @@ end #=============================================================================== class GifBitmap attr_accessor :bitmap - + attr_reader :loaded_from_cache # Creates a bitmap from a GIF file. Can also load non-animated bitmaps. def initialize(dir, filename, hue = 0) @bitmap = nil @disposed = false + @loaded_from_cache=false filename = "" if !filename begin @bitmap = RPG::Cache.load_bitmap(dir, filename, hue) + @loaded_from_cache=true rescue @bitmap = nil end diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb index de46a0875..243575ae3 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb @@ -54,9 +54,9 @@ class PokemonSprite < SpriteWrapper changeOrigin end - def setPokemonBitmapFromId(id, back = false) + def setPokemonBitmapFromId(id, back = false, shiny=false, bodyShiny=false, headShiny=false) @_iconbitmap.dispose if @_iconbitmap - @_iconbitmap = GameData::Species.sprite_bitmap_from_pokemon_id(id, back) + @_iconbitmap = GameData::Species.sprite_bitmap_from_pokemon_id(id, back,shiny, bodyShiny,headShiny) self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil self.color = Color.new(0, 0, 0, 0) changeOrigin diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index 72b3ce556..55314e1f5 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -31,6 +31,8 @@ class Pokemon # This Pokémon's shininess (true, false, nil). Is recalculated if made nil. # @param value [Boolean, nil] whether this Pokémon is shiny attr_writer :shiny + attr_accessor :head_shiny + attr_accessor :body_shiny # The index of this Pokémon's ability (0, 1 are natural abilities, 2+ are # hidden abilities)as defined for its species/form. An ability may not be # defined at this index. Is recalculated (as 0 or 1) if made nil. @@ -162,6 +164,13 @@ class Pokemon return headSpecies == checkSpeciesId end + def bodyShiny? + return @body_shiny + end + + def headShiny? + return @head_shiny + end def isFusionOf(check_species) return hasBodyOf?(check_species) || hasHeadOf?(check_species) @@ -444,6 +453,8 @@ class Pokemon return [:AlwaysMale, :AlwaysFemale, :Genderless].include?(gender_ratio) end + + #============================================================================= # Shininess #============================================================================= diff --git a/Data/Scripts/048_Fusion/PokemonFusion.rb b/Data/Scripts/048_Fusion/PokemonFusion.rb index 171fa6b28..72ef2c50a 100644 --- a/Data/Scripts/048_Fusion/PokemonFusion.rb +++ b/Data/Scripts/048_Fusion/PokemonFusion.rb @@ -535,10 +535,12 @@ class PokemonFusionScene @sprites["rsprite2"] = PokemonSprite.new(@viewport) @sprites["rsprite3"] = PokemonSprite.new(@viewport) - @sprites["rsprite1"].setPokemonBitmapFromId(poke1_number, false) - @sprites["rsprite3"].setPokemonBitmapFromId(poke2_number, false) + @sprites["rsprite1"].setPokemonBitmapFromId(poke1_number, false,pokemon1.shiny?) + @sprites["rsprite3"].setPokemonBitmapFromId(poke2_number, false,pokemon2.shiny?) - @sprites["rsprite2"].setPokemonBitmapFromId(@newspecies, false) + + + @sprites["rsprite2"].setPokemonBitmapFromId(@newspecies, false, pokemon1.shiny? || pokemon2.shiny?,pokemon1.shiny?,pokemon2.shiny?) @sprites["rsprite1"].ox = @sprites["rsprite1"].bitmap.width / 2 @sprites["rsprite1"].oy = @sprites["rsprite1"].bitmap.height / 2 @@ -707,10 +709,16 @@ class PokemonFusionScene _INTL("\\se[]Congratulations! Your Pokémon were fused into {2}!\\wt[80]", @pokemon1.name, newspeciesname)) #exp - @pokemon1.exp_when_fused_head = @pokemon2.exp #peut-être l'inverse - @pokemon1.exp_when_fused_body = @pokemon1.exp #peut-être l'inverse + @pokemon1.exp_when_fused_head = @pokemon2.exp + @pokemon1.exp_when_fused_body = @pokemon1.exp @pokemon1.exp_gained_since_fused = 0 + if @pokemon2.shiny? + @pokemon1.head_shiny=true + end + if @pokemon1.shiny? + @pokemon1.body_shiny=true + end setFusionIVs(superSplicer) #add to pokedex if !$Trainer.pokedex.owned?(newSpecies) diff --git a/Data/Scripts/050_AddOns/FusionSprites.rb b/Data/Scripts/050_AddOns/FusionSprites.rb index 7dc4c7a84..17424c797 100644 --- a/Data/Scripts/050_AddOns/FusionSprites.rb +++ b/Data/Scripts/050_AddOns/FusionSprites.rb @@ -5,23 +5,35 @@ module GameData species = GameData::Species.get(species).id_number # Just to be sure it's a number return self.egg_sprite_bitmap(species, pkmn.form) if pkmn.egg? if back - ret = self.back_sprite_bitmap(species,nil,nil,pkmn.shiny?) + ret = self.back_sprite_bitmap(species, nil, nil, pkmn.shiny?,pkmn.bodyShiny?,pkmn.headShiny?) else - ret = self.front_sprite_bitmap(species,nil,nil,pkmn.shiny?) + ret = self.front_sprite_bitmap(species, nil, nil, pkmn.shiny?,pkmn.bodyShiny?,pkmn.headShiny?) end return ret end - def self.sprite_bitmap_from_pokemon_id(id, back = false) + def self.sprite_bitmap_from_pokemon_id(id, back = false, shiny=false, bodyShiny=false,headShiny=false) if back - ret = self.back_sprite_bitmap(id) + ret = self.back_sprite_bitmap(id,nil,nil,shiny,bodyShiny,headShiny) else - ret = self.front_sprite_bitmap(id) + ret = self.front_sprite_bitmap(id,nil,nil,shiny,bodyShiny,headShiny) end return ret end - def self.front_sprite_bitmap(dex_number, a=0, b = 0, isShiny = false, d = 0) + def self.calculateShinyHueOffset(dex_number, isBodyShiny = false, isHeadShiny = false) + dex_offset = dex_number + if isBodyShiny && isHeadShiny + dex_offset = dex_number + elsif isHeadShiny + dex_offset = getHeadID(dex_number) + elsif isBodyShiny + dex_offset = getBodyID(dex_number) + end + return pbGet(VAR_SHINY_HUE_OFFSET) + dex_offset + Settings::SHINY_HUE_OFFSET + end + + def self.front_sprite_bitmap(dex_number, a = 0, b = 0, isShiny = false, bodyShiny = false, headShiny = false) #la méthode est utilisé ailleurs avec d'autres arguments (gender, form, etc.) mais on les veut pas if dex_number.is_a?(Symbol) dex_number = GameData::Species.get(dex_number).id_number @@ -29,16 +41,16 @@ module GameData filename = self.sprite_filename(dex_number) sprite = (filename) ? AnimatedBitmap.new(filename) : nil if isShiny - sprite.shiftColors(pbGet(VAR_SHINY_HUE_OFFSET)+dex_number) + sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny)) end return sprite end - def self.back_sprite_bitmap(dex_number, b=0, form = 0, isShiny=false, c = false, shadow = false) + def self.back_sprite_bitmap(dex_number, b = 0, form = 0, isShiny = false, bodyShiny = false, headShiny = false) filename = self.sprite_filename(dex_number) sprite = (filename) ? AnimatedBitmap.new(filename) : nil if isShiny - sprite.shiftColors(pbGet(VAR_SHINY_HUE_OFFSET)+dex_number) + sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny)) end return sprite end diff --git a/Data/Scripts/050_AddOns/New Items effects.rb b/Data/Scripts/050_AddOns/New Items effects.rb index 9d7d2e64b..e2430a28e 100644 --- a/Data/Scripts/050_AddOns/New Items effects.rb +++ b/Data/Scripts/050_AddOns/New Items effects.rb @@ -476,6 +476,7 @@ def reverseFusion(pokemon) pokemon.exp_when_fused_body = head_exp pokemon.exp_when_fused_head = body_exp + pokemon.head_shiny,pokemon.body_shiny = pokemon.body_shiny,pokemon.head_shiny #play animation pbFadeOutInWithMusic(99999) { fus = PokemonEvolutionScene.new @@ -1401,6 +1402,28 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil) pokemon.exp_when_fused_head = nil pokemon.exp_when_fused_body = nil + + if pokemon.shiny? + pokemon.shiny = false + if pokemon.bodyShiny? && pokemon.headShiny? + pokemon.shiny = true + poke2.shiny = true + elsif pokemon.bodyShiny? + pokemon.shiny = true + elsif pokemon.headShiny? + poke2.shiny = true + else #shiny was obtained already fused + if rand(2) == 0 + pokemon.shiny = true + else + poke2.shiny = true + end + end + end + pokemon.body_shiny=false + pokemon.head_shiny=false + + if $Trainer.party.length >= 6 if (keepInParty == 0) $PokemonStorage.pbStoreCaught(poke2) diff --git a/Data/System.rxdata b/Data/System.rxdata index 94efc4c76..5ddc7e862 100644 Binary files a/Data/System.rxdata and b/Data/System.rxdata differ