Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
758 changes: 425 additions & 333 deletions Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,11 @@ def pbNameEntry(helpText,pkmn)
#=============================================================================
# Shows the Pokédex entry screen for a newly caught Pokémon
#=============================================================================
def pbShowPokedex(species)
def pbShowPokedex(species, headShiny = false, bodyShiny = false)
pbFadeOutIn {
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbDexEntry(species)
screen.pbDexEntry(species, headShiny, bodyShiny)
}
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def setPokemonBitmap(pokemon, back = false)
end


def setPokemonBitmapFromId(id, back = false, shiny = false, bodyShiny = false, headShiny = false,spriteform_body=nil,spriteform_head=nil)
def setPokemonBitmapFromId(id, back = false, shiny = false, bodyShiny = false, headShiny = false, spriteform_body=nil, spriteform_head=nil)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap = GameData::Species.sprite_bitmap_from_pokemon_id(id, back, shiny, bodyShiny, headShiny)
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
Expand Down
72 changes: 70 additions & 2 deletions Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def set_seen_triple(species)
return if species_id.nil?
@seen_triple[species_id] = true
end

def set_seen(species, should_refresh_dexes = true)
def set_seen(species, should_refresh_dexes = true)
try_resync_pokedex()
dexNum = getDexNumberForSpecies(species)
if isTripleFusion(dexNum)
Expand All @@ -153,6 +153,43 @@ def set_seen(species, should_refresh_dexes = true)
end
self.refresh_accessible_dexes if should_refresh_dexes
end

def set_unseen_fusion(species)
bodyId = getBodyID(species)
headId = getHeadID(species, bodyId)
@seen_fusion[headId][bodyId] = false
end

def set_unseen_normalDex(species)
dex_num = getDexNumberForSpecies(species)
@seen_standard[dex_num] = false
end

def set_unseen_triple(species)
if species.is_a?(Pokemon)
species_id = species.species
else
species_id = GameData::Species.try_get(species)&.species
end
return if species_id.nil?
@seen_triple[species_id] = false
end


def set_unseen(species, should_refresh_dexes = true)
try_resync_pokedex()
dexNum = getDexNumberForSpecies(species)
if isTripleFusion(dexNum)
set_unseen_triple(species)
elsif isFusion(dexNum)
set_unseen_fusion(species)
else
set_unseen_normalDex(species)
end
self.refresh_accessible_dexes if should_refresh_dexes
end



# @param species [Symbol, GameData::Species] species to check
# @return [Boolean] whether the species is seen
Expand Down Expand Up @@ -271,6 +308,37 @@ def set_owned(species, should_refresh_dexes = true)
end
self.refresh_accessible_dexes if should_refresh_dexes
end


def set_unowned_fusion(species)
try_resync_pokedex()
bodyId = getBodyID(species)
headId = getHeadID(species, bodyId)
@owned_fusion[headId][bodyId] = false
end

def set_unowned_triple(species)
species_id = GameData::Species.try_get(species)&.species
return if species_id.nil?
@owned_triple[species_id] = false
end

def set_unowned_normalDex(species)
try_resync_pokedex()
@owned_standard[getDexNumberForSpecies(species)] = false
end

def set_unowned(species, should_refresh_dexes = true)
dexNum = getDexNumberForSpecies(species)
if isTripleFusion(dexNum)
set_unowned_triple(species)
elsif isFusion(dexNum)
set_unowned_fusion(species)
else
set_unowned_normalDex(species)
end
self.refresh_accessible_dexes if should_refresh_dexes
end

# Sets the given species as owned in the Pokédex.
# @param species [Symbol, GameData::Species] species to set as owned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def pbEvolutionSuccess(reversing=false)
$Trainer.pokedex.set_owned(@newspecies)
Kernel.pbMessageDisplay(@sprites["msgwindow"],
_INTL("{1}'s data was added to the Pokédex", newspeciesname))
@scene.pbShowPokedex(@newspecies)
@scene.pbShowPokedex(@newspecies, @pokemon.headShiny?, @pokemon.bodyShiny?)
end


Expand Down
48 changes: 38 additions & 10 deletions Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
#
#===============================================================================
class PokemonPokedexInfo_Scene
def pbStartScene(dexlist, index, region)
def pbStartScene(dexlist, index, region, pokemon = nil)
@endscene = false
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@dexlist = dexlist
@index = index
@pokemon = pokemon
@region = region
@page = 1
@entry_page = 0
Expand All @@ -18,6 +19,7 @@ def pbStartScene(dexlist, index, region)
@sprites["infosprite"].setOffset(PictureOrigin::Center)
@sprites["infosprite"].x = 104
@sprites["infosprite"].y = 136
@sprites["infosprite"].setPokemonBitmap(@pokemon)
@sprites["infosprite"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE
@spritesLoader = BattleSpriteLoader.new
Expand Down Expand Up @@ -95,9 +97,13 @@ def initializeSpritesPageGraphics()
@sprites["downarrow"].visible = false
end

def pbStartSpritesSelectSceneBrief(species, alts_list)
def pbStartSpritesSelectSceneBrief(species, alts_list, headShiny = false, bodyShiny = false)
@available = alts_list
@species = species
@isHead_Shiny = headShiny
@isBody_Shiny = bodyShiny
@isShiny = bodyShiny || headShiny
@idSpecies = getDexNumberForSpecies(species)
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@index = 0
Expand All @@ -107,6 +113,8 @@ def pbStartSpritesSelectSceneBrief(species, alts_list)
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["infosprite"] = PokemonSprite.new(@viewport)
@sprites["infosprite"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE
@spritesLoader = BattleSpriteLoader.new
@page = 3
initializeSpritesPageGraphics
Expand All @@ -116,10 +124,14 @@ def pbStartSpritesSelectSceneBrief(species, alts_list)
pbFadeInAndShow(@sprites) { pbUpdate }
end

def pbStartSceneBrief(species)
def pbStartSceneBrief(species, headShiny = false, bodyShiny = false)
# For standalone access, shows first page only
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@isHead_Shiny = headShiny
@isBody_Shiny = bodyShiny
@isShiny = bodyShiny || headShiny
@idSpecies = getDexNumberForSpecies(species)
dexnum = 0
dexnumshift = false
if $Trainer.pokedex.unlocked?(-1) # National Dex is unlocked
Expand Down Expand Up @@ -148,6 +160,8 @@ def pbStartSceneBrief(species)
@sprites["infosprite"].setOffset(PictureOrigin::Center)
@sprites["infosprite"].x = 104
@sprites["infosprite"].y = 136
@sprites["infosprite"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)

pbSetSystemFont(@sprites["overlay"].bitmap)
Expand Down Expand Up @@ -194,7 +208,13 @@ def pbUpdateDummyPokemon

# species_data = pbGetSpeciesData(@species)
species_data = GameData::Species.get_species_form(@species, @form)
@sprites["infosprite"].setSpeciesBitmap(@species) #, @gender, @form)
if @pokemon != nil
@sprites["infosprite"].setPokemonBitmap(@pokemon)
elsif @idSpecies != nil
@sprites["infosprite"].setPokemonBitmapFromId(@idSpecies, false, @isShiny, @isBody_Shiny, @isHead_Shiny)
else
@sprites["infosprite"].setSpeciesBitmap(@species)
end

# if @sprites["formfront"]
# @sprites["formfront"].setSpeciesBitmap(@species,@gender,@form)
Expand Down Expand Up @@ -285,6 +305,13 @@ def drawPageInfo
shadow = Color.new(168, 184, 184)

imagepos = []
# Show shininess star
if (@pokemon != nil && @pokemon.shiny?)
addShinyStarsToGraphicsArray(imagepos, 220, 82, @pokemon.bodyShiny?, @pokemon.headShiny?, @pokemon.debugShiny?, nil, nil, 32, 32, false, false, true, true)
elsif @isShiny
addShinyStarsToGraphicsArray(imagepos, 220, 82, @isBody_Shiny, @isHead_Shiny, false, nil, nil, 32, 32, false, false, true, true)

end
if @brief
imagepos.push([_INTL("Graphics/Pictures/Pokedex/overlay_info"), 0, 0])
end
Expand Down Expand Up @@ -363,7 +390,7 @@ def drawPageInfo
end


def drawEntryText(overlay, species_data)
def drawEntryText(overlay, species_data)
baseColor = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
shadowCustom = Color.new(160, 200, 150)
Expand Down Expand Up @@ -791,7 +818,8 @@ def pbStartScreen(dexlist, index, region)
return ret # Index of last species viewed in dexlist
end

def pbStartSceneSingle(species)
def pbStartSceneSingle(pokemon)
species = pokemon.species
# For use from a Pokémon's summary screen
region = -1
if Settings::USE_CURRENT_REGION_DEX
Expand All @@ -803,21 +831,21 @@ def pbStartSceneSingle(species)
dexnum = GameData::Species.get(species).id_number #pbGetRegionalNumber(region,species)
dexnumshift = Settings::DEXES_WITH_OFFSETS.include?(region)
dexlist = [[species, GameData::Species.get(species).name, 0, 0, dexnum, dexnumshift]]
@scene.pbStartScene(dexlist, 0, region)
@scene.pbStartScene(dexlist, 0, region, pokemon)
@scene.pbScene
@scene.pbEndScene
end

def pbDexEntry(species)
def pbDexEntry(species, headshiny = false, bodyshiny = false)
# For use when capturing a new species
nb_sprites_for_alts_page = isSpeciesFusion(species) ? 2 : 1
alts_list = @scene.pbGetAvailableForms(species)
if alts_list.length > nb_sprites_for_alts_page
@scene.pbStartSpritesSelectSceneBrief(species, alts_list)
@scene.pbStartSpritesSelectSceneBrief(species, alts_list, headshiny, bodyshiny)
@scene.pbSelectSpritesSceneBrief
@scene.pbEndScene
end
@scene.pbStartSceneBrief(species)
@scene.pbStartSceneBrief(species, headshiny, bodyshiny)
@scene.pbSceneBrief
@scene.pbEndScene
end
Expand Down
6 changes: 3 additions & 3 deletions Data/Scripts/016_UI/006_UI_Summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def drawPage(page)
end
# Show shininess star
if @pokemon.shiny?
addShinyStarsToGraphicsArray(imagepos, 2, 134, @pokemon.bodyShiny?, @pokemon.headShiny?, @pokemon.debugShiny?, nil, nil, nil, nil, true)
addShinyStarsToGraphicsArray(imagepos, 2, 126, @pokemon.bodyShiny?, @pokemon.headShiny?, @pokemon.debugShiny?, nil, nil, nil, nil, true)
#imagepos.push([sprintf("Graphics/Pictures/shiny"), 2, 134])
end
# Draw all images
Expand Down Expand Up @@ -909,7 +909,7 @@ def drawPageFive
pbFadeOutIn {
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbStartSceneSingle(@pokemon.species)
screen.pbStartSceneSingle(@pokemon)
}
pbChangePokemon
@page -= 1
Expand Down Expand Up @@ -1308,7 +1308,7 @@ def pbOptions
pbFadeOutIn {
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbStartSceneSingle(@pokemon.species)
screen.pbStartSceneSingle(@pokemon)
}
pbChangePokemon
dorefresh = true
Expand Down
2 changes: 1 addition & 1 deletion Data/Scripts/016_UI/017_UI_PokemonStorage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ def pbUpdateOverlay(selection, party = nil)
textstrings.push([_INTL("No item"), 86, 336, 2, nonbase, nonshadow])
end
if pokemon.shiny?
addShinyStarsToGraphicsArray(imagepos,156,198,pokemon.bodyShiny?,pokemon.headShiny?,pokemon.debugShiny?,nil,nil,nil,nil,false,true)
addShinyStarsToGraphicsArray(imagepos,148,198,pokemon.bodyShiny?,pokemon.headShiny?,pokemon.debugShiny?,nil,nil,nil,nil,false,true)
#imagepos.push(["Graphics/Pictures/shiny", 156, 198])
end
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
Expand Down
16 changes: 16 additions & 0 deletions Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ def pbAddPokemonSilent(pkmn, level = 1, see_form = true)
return true
end

def pbAddPokemonSilentShiny(pkmn, level = 1, see_form = true)
return false if !pkmn || pbBoxesFull?
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
pkmn.shiny = true
pkmn.natural_shiny=true
$Trainer.pokedex.register(pkmn) if see_form
$Trainer.pokedex.set_owned(pkmn.species)
pkmn.record_first_moves
if $Trainer.party_full?
$PokemonStorage.pbStoreCaught(pkmn)
else
$Trainer.party[$Trainer.party.length] = pkmn
end
return true
end

#===============================================================================
# Giving Pokémon/eggs to the player (can only add to party)
#===============================================================================
Expand Down
Loading