shiny fusion fixes + custom starters option (events)

This commit is contained in:
infinitefusion
2022-10-08 13:52:17 -04:00
parent b3addeb867
commit 749cdff356
13 changed files with 87 additions and 22 deletions

View File

@@ -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

View File

@@ -140,7 +140,6 @@ end
class BitmapWrapper < Bitmap
attr_reader :refcount
attr_accessor :never_dispose
def dispose
return if self.disposed?
@refcount -= 1

View File

@@ -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

View File

@@ -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

View File

@@ -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
#=============================================================================

View File

@@ -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)

View File

@@ -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

View File

@@ -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)