Update 6.8

This commit is contained in:
chardub
2026-07-10 15:42:06 -04:00
parent 5b85e72cb2
commit 6a6f126a18
7871 changed files with 493193 additions and 224825 deletions
@@ -103,22 +103,24 @@ class PokemonEggHatch_Scene
@pokemon.play_cry
updateScene(frames)
pbBGMStop()
pbMEPlay("Evolution success")
pbMEPlay("evolution_success")
@pokemon.name = nil
pbMessage(_INTL("\\se[]{1} hatched from the Egg!\\wt[80]", @pokemon.name)) { update }
if pbConfirmMessage(
if $PokemonSystem.prompt_nicknames
if pbConfirmMessage(
_INTL("Would you like to nickname the newly hatched {1}?", @pokemon.name)) { update }
nickname = pbEnterPokemonName(_INTL("{1}'s nickname?", @pokemon.name),
0, Pokemon::MAX_NAME_SIZE, "", @pokemon, true)
@pokemon.name = nickname
@nicknamed = true
nickname = pbEnterPokemonName(_INTL("{1}'s nickname?", @pokemon.name),
0, Pokemon::MAX_NAME_SIZE, "", @pokemon, true)
@pokemon.name = nickname
@nicknamed = true
end
end
if !$Trainer.pokedex.owned?(@pokemon.species)
$Trainer.pokedex.register(@pokemon)
$Trainer.pokedex.set_owned(@pokemon.species)
pbMessage(_INTL("{1}'s data was added to the Pokédex", @pokemon.name))
pbShowPokedex(@pokemon.species)
pbShowPokedex(@pokemon)
end
nb_eggs_hatched = pbGet(VAR_NB_EGGS_HATCHED)
pbSet(VAR_NB_EGGS_HATCHED,nb_eggs_hatched+1)
@@ -205,7 +207,7 @@ def pbHatch(pokemon)
pokemon.name = nil
pokemon.owner = Pokemon::Owner.new_from_trainer($Trainer)
pokemon.happiness = 120
pokemon.timeEggHatched = pbGetTimeNow
pokemon.timeEggHatched = Time.new.to_i
pokemon.obtain_method = 1 # hatched from egg
pokemon.hatched_map = $game_map.map_id
if player_on_hidden_ability_map
@@ -492,6 +492,8 @@ class PokemonEvolutionScene
def pbStartScreen(pokemon,newspecies,reversing=false)
@pokemon = pokemon
@newspecies = newspecies
spriteLoader = BattleSpriteLoader.new
evolution_pif_sprite = spriteLoader.obtain_pif_sprite(newspecies)
@sprites = {}
@bgviewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@bgviewport.z = 99999
@@ -508,9 +510,12 @@ class PokemonEvolutionScene
rsprite1.setPokemonBitmap(@pokemon,false)
rsprite1.x = Graphics.width/2
rsprite1.y = (Graphics.height-64)/2
@pokemon.preEvolved_pif_sprite = @pokemon.pif_sprite
@pokemon.pif_sprite = evolution_pif_sprite
rsprite2 = PokemonSprite.new(@viewport)
rsprite2.setOffset(PictureOrigin::Center)
rsprite2.setPokemonBitmapSpecies(@pokemon,@newspecies,false)
rsprite2.setPokemonBitmapPIFSprite(evolution_pif_sprite)
rsprite2.x = rsprite1.x
rsprite2.y = rsprite1.y
rsprite2.opacity = 0
@@ -551,7 +556,7 @@ class PokemonEvolutionScene
pbPlayDecisionSE
oldstate = pbSaveSpriteState(@sprites["rsprite1"])
oldstate2 = pbSaveSpriteState(@sprites["rsprite2"])
pbMEPlay("Evolution start")
pbMEPlay("evolution_start")
pbBGMPlay("Evolution")
canceled = false
begin
@@ -570,10 +575,20 @@ class PokemonEvolutionScene
end while metaplayer1.playing? && metaplayer2.playing?
pbFlashInOut(canceled,oldstate,oldstate2)
if canceled
pbMessageDisplay(@sprites["msgwindow"],
_INTL("Huh? {1} stopped evolving!",@pokemon.name)) { pbUpdate }
pbMessageDisplay(@sprites["msgwindow"], _INTL("Huh? {1} stopped evolving!",@pokemon.name)) { pbUpdate }
pbMessageDisplay(@sprites["msgwindow"], _INTL("The evolution can be prompted again from the party menu.")) { pbUpdate }
if @pokemon.preEvolved_pif_sprite
@pokemon.pif_sprite = @pokemon.preEvolved_pif_sprite
@pokemon.preEvolved_pif_sprite = nil
else
spriteLoader = BattleSpriteLoader.new
evolution_pif_sprite = spriteLoader.obtain_pif_sprite(@pokemon.species)
@pokemon.pif_sprite = evolution_pif_sprite
end
@pokemon.evolve_from_party = true
else
pbEvolutionSuccess(reversing)
@pokemon.evolve_from_party = false
end
end
@@ -587,7 +602,7 @@ class PokemonEvolutionScene
pbUpdate
end
# Success jingle/message
pbMEPlay("Evolution success")
pbMEPlay("evolution_success")
sprite_bitmap=@sprites["rsprite2"].getBitmap
#drawSpriteCredits(sprite_bitmap.filename,sprite_bitmap.path, @viewport)
@@ -626,7 +641,7 @@ class PokemonEvolutionScene
$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(@pokemon)
end
@@ -654,9 +669,12 @@ class PokemonEvolutionScene
new_pkmn.markings = 0
new_pkmn.poke_ball = :POKEBALL
new_pkmn.item = nil
new_pkmn.personalID = new_pkmn.generate_personal_id
new_pkmn.pif_sprite = nil
new_pkmn.clearAllRibbons
new_pkmn.calc_stats
new_pkmn.heal
# Add duplicate Pokémon to party
$Trainer.party.push(new_pkmn)
# See and own duplicate Pokémon
@@ -249,7 +249,7 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0,saveg
evo.pbEndScreen
}
$Trainer.party[pokemonIndex] = yourPokemon
$Trainer.stats&.incr_nb_trades
setDialogIconOff(@event_id) if @event_id
return yourPokemon
end
@@ -430,32 +430,32 @@ class HallOfFame_Scene
def getCurrentGameMode()
gameMode = "Classic mode"
gameMode = _INTL("Classic mode")
if $game_switches[SWITCH_MODERN_MODE]
gameMode = "Remix mode"
gameMode = _INTL("Remix mode")
end
if $game_switches[SWITCH_EXPERT_MODE]
gameMode = "Expert mode"
gameMode = _INTL("Expert mode")
end
if $game_switches[SWITCH_SINGLE_POKEMON_MODE]
pokemon_number = pbGet(VAR_SINGLE_POKEMON_MODE)
if pokemon_number.is_a?(Integer) && pokemon_number > 0
pokemon = GameData::Species.get(pokemon_number)
gameMode = pokemon.real_name + " mode"
gameMode = _INTL("{1} mode",pokemon.name)
else
gameMode = "Debug mode"
gameMode = _INTL("Debug mode")
end
end
if $game_switches[SWITCH_RANDOMIZED_AT_LEAST_ONCE]
gameMode = "Randomized mode"
gameMode = _INTL("Randomized mode")
end
if $game_switches[SWITCH_LEGENDARY_MODE]
gameMode = "Legendary mode"
gameMode = _INTL("Legendary mode")
end
if $game_switches[ENABLED_DEBUG_MODE_AT_LEAST_ONCE] || $DEBUG
gameMode = "Debug mode"
gameMode = _INTL("Debug mode")
end
return gameMode
end
@@ -1,385 +0,0 @@
#==============================================================================
# * Scene_Credits
#------------------------------------------------------------------------------
# Scrolls the credits you make below. Original Author unknown.
#
## Edited by MiDas Mike so it doesn't play over the Title, but runs by calling
# the following:
# $scene = Scene_Credits.new
#
## New Edit 3/6/2007 11:14 PM by AvatarMonkeyKirby.
# Ok, what I've done is changed the part of the script that was supposed to make
# the credits automatically end so that way they actually end! Yes, they will
# actually end when the credits are finished! So, that will make the people you
# should give credit to now is: Unknown, MiDas Mike, and AvatarMonkeyKirby.
# -sincerly yours,
# Your Beloved
# Oh yea, and I also added a line of code that fades out the BGM so it fades
# sooner and smoother.
#
## New Edit 24/1/2012 by Maruno.
# Added the ability to split a line into two halves with <s>, with each half
# aligned towards the centre. Please also credit me if used.
#
## New Edit 22/2/2012 by Maruno.
# Credits now scroll properly when played with a zoom factor of 0.5. Music can
# now be defined. Credits can't be skipped during their first play.
#
## New Edit 25/3/2020 by Maruno.
# Scroll speed is now independent of frame rate. Now supports non-integer values
# for SCROLL_SPEED.
#
## New Edit 21/8/2020 by Marin.
# Now automatically inserts the credits from the plugins that have been
# registered through the PluginManager module.
#==============================================================================
class Scene_Credits
# Backgrounds to show in credits. Found in Graphics/Titles/ folder
BACKGROUNDS_LIST = ["credits1", "credits2", "credits3", "credits4", "credits5"]
BGM = "Credits"
SCROLL_SPEED = 62 # Pixels per second , ajuster pour fitter avec la musique
SECONDS_PER_BACKGROUND = 4
TEXT_OUTLINE_COLOR = Color.new(0, 0, 128, 255)
TEXT_BASE_COLOR = Color.new(255, 255, 255, 255)
TEXT_SHADOW_COLOR = Color.new(0, 0, 0, 100)
NB_SPRITES_TO_PRELOAD = 30
TOTAL_NB_FRAMES = 4000 #set manually, depends on music length
FUSION_SPRITES_MAX_OPACITY=200
NB_FRAMES_AT_MAX_OPACITY=30
# This next piece of code is the credits.
# Start Editing
CREDIT = <<_END_
Pokémon Infinite Fusion
By Chardub (Frogzilla)
Programming / Game design:
Chardub
Fused Pokemon Sprites :
Japeal - Pokefusion 2
http://japeal.com/pkm
Special thanks to Aegide and Reizod for
helping to download the autogenerated sprites
and to the owners of Japeal for accepting to
share their sprites.
Maps:
Chardub
Kiwikelly
Some of the maps were based on work by:
BenGames, Zeak6464
Gameplay / Story :
Chardub
Kiwikelly
Title screen and logo
Doctor Miawoo
Custom sprites collecting and handling
Kiwikelly, Payapon, Thornsoflight
Discord custom sprites coordination
avianAnnihilator<s>Blaquaza
BéBoutton<s>CaBiNE
CoramSun<s>hero.drawing
Howls<s>Ignus
Kiwi<s>Maelmc
Milchik the Miltank<s>Payapon
Pix<s>Rosemagwin
Thornsoflight
All of the custom fused Pokémon sprites
were made by various members of the
Pokémon Infinite Fusion Discord
Including significant contributions from:
{SPRITER_CREDITS}
Other custom graphics:
Kiwikelly<s>Knuckles
UnworthyPie<s>Doctor Miawoo
Chardub<s>TCGrunler#4583
Elite 4 rematch teams
duskrd<s>anaconja<s>taraline
French translation
anthonygourmand
locpic_
blood.wolf58 (Willi)
The following free ressources were also used
with their respective authors' consent:
Public use tileset graphics:
Alucus BoOmxBiG<s>chimcharsfireworkd
EpicDay<s>EternalTakai
Gallanty Heavy-Metal-Lover<s>Hek-el-grande
DirtyWiggles<s>iametrine
Jorginho<s>kizemaru-kurunosuke
KKKaito<s>kyle-dove
Minorthreat0987<s>Phyromatical
Pokemon-Diamond<s>rayd12smitty
Rossay<s>Shiney570
Spacemotion<s>Speedialga
ThatsSoWitty Thurpok<s>TyranitarDark
UltimoSpriter<s>WesleyFG
Public use music:
Pokeli, TailDoll666100
Kazune Sawatari, sentsinkantéun,
Nanashima, CharizardTheMaster, The Zame Jack
{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE}
"Pokémon Essentials" was created by:
Flameguru
Poccil (Peter O.)
Maruno
With contributions from:
AvatarMonkeyKirby<s>MiDas Mike
Boushy<s>Near Fantastica
Brother1440<s>PinkMan
FL.<s>Popper
Genzai Kawakami<s>Rataime
Harshboy<s>SoundSpawn
help-14<s>the__end
IceGod64<s>Venom12
Jacob O. Wobbrock<s>Wachunga
KitsuneKouta<s>xLeD
Lisa Anthony<s>
and everyone else who helped out
"mkxp-z" by:
Roza
Based on MKXP by Ancurio et al.
"RPG Maker XP" by:
Enterbrain
This game was inspired by the original
fusion generator:
alexonsager.alexonsager.net
All generated fusion sprites in this game
come from the Pokémon Fusion Generator:
https://japeal.com/pkm/
Pokémon is owned by:
The Pokémon Company
Nintendo
Affiliated with Game Freak
This is a non-profit fan-made game.
No copyright infringements intended.
_END_
# Stop Editing
def main
endCredits() if $PokemonSystem.on_mobile
#-------------------------------
# Animated Background Setup
#-------------------------------
@counter = 0.0 # Counts time elapsed since the background image changed
@bg_index = 0
@bitmap_height = Graphics.height # For a single credits text bitmap
@trim = Graphics.height / 10
# Number of game frames per background frame
@realOY = -(Graphics.height - @trim)
@customSpritesList = getSpritesList()
#-------------------------------
# Credits text Setup
#-------------------------------
plugin_credits = ""
PluginManager.plugins.each do |plugin|
pcred = PluginManager.credits(plugin)
plugin_credits << "\"#{plugin}\" v.#{PluginManager.version(plugin)} by:\n"
if pcred.size >= 5
plugin_credits << pcred[0] + "\n"
i = 1
until i >= pcred.size
plugin_credits << pcred[i] + "<s>" + (pcred[i + 1] || "") + "\n"
i += 2
end
else
pcred.each { |name| plugin_credits << name + "\n" }
end
plugin_credits << "\n"
end
CREDIT.gsub!(/\{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE\}/, plugin_credits)
CREDIT.gsub!(/{SPRITER_CREDITS}/, format_names_for_game_credits())
credit_lines = CREDIT.split(/\n/)
#-------------------------------
# Make background and text sprites
#-------------------------------
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
viewport.z = 99999
text_viewport = Viewport.new(0, @trim, Graphics.width, Graphics.height - (@trim * 2))
text_viewport.z = 99999
@background_sprite = IconSprite.new(0, 0)
@background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[0])
@credit_sprites = []
@total_height = credit_lines.size * 32
lines_per_bitmap = @bitmap_height / 32
num_bitmaps = (credit_lines.size.to_f / lines_per_bitmap).ceil
for i in 0...num_bitmaps
credit_bitmap = Bitmap.new(Graphics.width, @bitmap_height)
pbSetSystemFont(credit_bitmap)
for j in 0...lines_per_bitmap
line = credit_lines[i * lines_per_bitmap + j]
next if !line
line = line.split("<s>")
xpos = 0
align = 1 # Centre align
linewidth = Graphics.width
for k in 0...line.length
if line.length > 1
xpos = (k == 0) ? 0 : 20 + Graphics.width / 2
align = (k == 0) ? 2 : 0 # Right align : left align
linewidth = Graphics.width / 2 - 20
end
credit_bitmap.font.color = TEXT_SHADOW_COLOR
credit_bitmap.draw_text(xpos, j * 32 + 8, linewidth, 32, line[k], align)
credit_bitmap.font.color = TEXT_OUTLINE_COLOR
credit_bitmap.draw_text(xpos + 2, j * 32 - 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, j * 32 - 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, j * 32 - 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, j * 32, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, j * 32, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, j * 32 + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, j * 32 + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, j * 32 + 2, linewidth, 32, line[k], align)
credit_bitmap.font.color = TEXT_BASE_COLOR
credit_bitmap.draw_text(xpos, j * 32, linewidth, 32, line[k], align)
end
end
credit_sprite = Sprite.new(text_viewport)
credit_sprite.bitmap = credit_bitmap
credit_sprite.z = 9998
credit_sprite.oy = @realOY - @bitmap_height * i
@credit_sprites[i] = credit_sprite
end
#-------------------------------
# Setup
#-------------------------------
# Stops all audio but background music
previousBGM = $game_system.getPlayingBGM
pbMEStop
pbBGSStop
pbSEStop
pbBGMFade(2.0)
pbBGMPlay(BGM)
Graphics.transition(20)
loop do
Graphics.update
Input.update
update
break if $scene != self
end
pbBGMFade(2.0)
Graphics.freeze
viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
Graphics.transition(20, "fadetoblack")
@background_sprite.dispose
@credit_sprites.each { |s| s.dispose if s }
text_viewport.dispose
viewport.dispose
$PokemonGlobal.creditsPlayed = true
pbBGMPlay(previousBGM)
end
def getSpritesList()
spritesList = []
$PokemonGlobal.alt_sprite_substitutions.each_value do |value|
if value.is_a?(PIFSprite)
spritesList << value
end
end
selected_spritesList = spritesList.sample(NB_SPRITES_TO_PRELOAD)
spriteLoader = BattleSpriteLoader.new
for sprite in selected_spritesList
spriteLoader.preload(sprite)
end
return selected_spritesList
end
# Check if the credits should be cancelled
def cancel?
if Input.trigger?(Input::USE) && $PokemonGlobal.creditsPlayed
endCredits
return true
end
return false
end
def endCredits
$scene = Scene_Map.new
pbBGMFade(1.0)
end
# Checks if credits bitmap has reached its ending point
def last?
if @realOY > @total_height + @trim
$scene = ($game_map) ? Scene_Map.new : nil
pbBGMFade(2.0)
return true
end
return false
end
def update
delta = Graphics.delta_s
@counter += delta
@sprites_counter = 0 if !@sprites_counter
#@background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[@bg_index])
# # Go to next slide
@frames_counter = 0 if !@frames_counter
@frames_counter+=1
stopShowingSprites = @frames_counter >= (TOTAL_NB_FRAMES-300)
pbBGSStop if @frames_counter > TOTAL_NB_FRAMES
spriteLoader = BattleSpriteLoader.new
if @counter >= SECONDS_PER_BACKGROUND && @customSpritesList.length > 0 && !stopShowingSprites
@sprites_counter=0
randomSprite = @customSpritesList.sample
@customSpritesList.delete(randomSprite)
@background_sprite.setBitmapDirectly(spriteLoader.load_pif_sprite(randomSprite))
@background_sprite.x = rand(0..300)
@background_sprite.y = rand(0..200)
@counter -= SECONDS_PER_BACKGROUND
@background_sprite.opacity = 50
@fadingIn=true
end
if @fadingIn
if @background_sprite.opacity < FUSION_SPRITES_MAX_OPACITY
@background_sprite.opacity +=5
else
@fadingIn=false
end
else
@sprites_counter += 1
if @sprites_counter >= NB_FRAMES_AT_MAX_OPACITY
@background_sprite.opacity-=3
end
end
return if cancel?
return if last?
@realOY += SCROLL_SPEED * delta
@credit_sprites.each_with_index { |s, i| s.oy = @realOY - @bitmap_height * i }
end
end
@@ -0,0 +1,178 @@
class HallOfFameSimple_Scene < HallOfFame_Scene
#Hardcoded for Hoenn Pt.1
NB_QUESTS_AVAILABLE = 20 #Doesn't count main quests or unavailable quests.
NB_TEAM_QUESTS_AVAILABLE = 7
NB_QUESTS_PRODUCER = 7
TOTAL_NPC_TRAINERS = 101 #Includes rival, wally, gym leaders, but not non-rematchable trainers like team magma, move tutors, etc.
ANIMATION = true
ENTRYMUSIC = "part1_end"
def getHallOfFameBackground
return "Graphics/Pictures/HallOfFame/hoenn_part1"
end
def saveHallEntry
for i in 0...$Trainer.party.length
@hallEntry.push($Trainer.party[i].clone) if !$Trainer.party[i].egg? || ALLOWEGGS
end
end
def pbUpdateAnimation
if @battlerIndex <= @hallEntry.size
if @xmovement[@battlerIndex] != 0 || @ymovement[@battlerIndex] != 0
spriteIndex = (@battlerIndex < @hallEntry.size) ? @battlerIndex : -1
moveSprite(spriteIndex)
else
@battlerIndex += 1
if @battlerIndex <= @hallEntry.size
# If it is a pokémon, write the pokémon text, wait the
# ENTRYWAITTIME and goes to the next battler
# @hallEntry[@battlerIndex - 1].play_cry
# writePokemonData(@hallEntry[@battlerIndex - 1])
# (ENTRYWAITTIME * Graphics.frame_rate / 20).times do
# Graphics.update
# Input.update
# pbUpdate
# end
if @battlerIndex < @hallEntry.size # Preparates the next battler
setPokemonSpritesOpacity(@battlerIndex, OPACITY)
@sprites["overlay"].bitmap.clear
else
# Show the welcome message and preparates the trainer
setPokemonSpritesOpacity(-1)
writeWelcome
createTrainerBattler
(ENTRYWAITTIME * 2 * Graphics.frame_rate / 20).times do
moveSprite(-1)
Graphics.update
Input.update
pbUpdate
end
writeInfo
while !(waitForInput)
Graphics.update
Input.update
pbUpdate
end
setPokemonSpritesOpacity(-1, OPACITY) # if !@singlerow
end
end
end
elsif @battlerIndex > @hallEntry.size
# Write the trainer data and fade
writeTrainerData
while !(waitForInput)
Graphics.update
Input.update
pbUpdate
end
fadeSpeed = ((Math.log(2 ** 12) - Math.log(FINALFADESPEED)) / Math.log(2)).floor
pbBGMFade((2 ** fadeSpeed).to_f / 20) if @useMusic
slowFadeOut(@sprites, fadeSpeed) { pbUpdate }
@alreadyFadedInEnd = true
@battlerIndex += 1
end
end
def pbStartSceneEntry
@singlerow = true
pbStartScene
@useMusic = (ENTRYMUSIC && ENTRYMUSIC != "")
pbBGMPlay(ENTRYMUSIC) if @useMusic
saveHallEntry
@xmovement = Array.new(@hallEntry.size, 0)
@ymovement = Array.new(@hallEntry.size, 0)
createBattlers(false)
pbFadeInAndShow(@sprites) { pbUpdate }
end
def writeTrainerData
lefttext = _INTL("<ac>PIF2 (Part 1) - Completion </ac>")
lefttext += _INTL("{1} ({2})<br>", getCurrentGameMode, getDisplayDifficulty)
lefttext += _INTL("Pokédex:<r>{1} / {2}<br>", $Trainer.pokedex.owned_count, NB_POKEMON)
lefttext += _INTL("Side Quests:<r>{1}<br>", getSidequestsStats())
lefttext += _INTL("Hats Unlocked:<r>{1} / {2}<br>", $Trainer.unlocked_hats.length, $PokemonGlobal.hats_data.length)
lefttext += _INTL("Clothes Unlocked:<r>{1} / {2}<br>", $Trainer.unlocked_clothes.length, $PokemonGlobal.clothes_data.length)
nb_friends = listNPCFriends().length
lefttext += _INTL("Trainers Befriended:<r>{1}/{2}<br>", nb_friends,TOTAL_NPC_TRAINERS)
for n in 0...@hallEntry.size
if @sprites["pokemon#{n}"]
@sprites["pokemon#{n}"].y += 136
@sprites["pokemon#{n}"].opacity = 255
end
end
@sprites["trainer"].y += 136 if @sprites["trainer"]
@sprites["hallbars"].visible = false if @sprites["hallbars"]
@sprites["overlay"].bitmap.clear if @sprites["overlay"]
@sprites["messagebox"] = Window_AdvancedTextPokemon.new(lefttext)
@sprites["messagebox"].opacity=200
@sprites["messagebox"].viewport = @viewport
@sprites["messagebox"].width = 192 if @sprites["messagebox"].width < 192
#@sprites["msgwindow"] = pbCreateMessageWindow(@viewport)
end
def writeWelcome
overlay = @sprites["overlay"].bitmap
overlay.clear
pbDrawTextPositions(overlay, [[_INTL("Pokémon Infinite Fusion 2: Hoenn"),
Graphics.width / 2, Graphics.height - 80, 2, BASECOLOR, SHADOWCOLOR]])
pbDrawTextPositions(overlay, [[_INTL("Part 1"),
Graphics.width / 2, Graphics.height - 50, 2, BASECOLOR, SHADOWCOLOR]])
end
def writeInfo
overlay = @sprites["overlay"].bitmap
overlay.clear
pbDrawTextPositions(overlay, [[_INTL("Pokémon Infinite Fusion 2: Hoenn (Part 1)"),
Graphics.width / 2, Graphics.height - 80, 2, BASECOLOR, SHADOWCOLOR]])
writeDate(overlay, 120, Graphics.height - 50)
writeGameMode(overlay, (Graphics.width / 2) + 100, Graphics.height - 50)
end
#List every battled trainer that is at at least 1 heart
def listNPCFriends
fixRivalsFriendship
friends_list = []
$PokemonGlobal.battledTrainers.each do |id, trainer|
friends_list << id if trainer.friendship_level >= 1
end
return friends_list
end
#set rival friendships if not already set (for older versions compatibility)
def fixRivalsFriendship
rival = getRebattledTrainerFromKey(BATTLED_TRAINER_RIVAL_KEY)
wally = getRebattledTrainerFromKey(BATTLED_TRAINER_WALLY_KEY)
if rival.friendship_level == 0
rival.friendship_level = 2
$PokemonGlobal.battledTrainers[BATTLED_TRAINER_RIVAL_KEY] = rival
end
if wally.friendship_level == 0
wally.friendship_level = 1
$PokemonGlobal.battledTrainers[BATTLED_TRAINER_WALLY_KEY] = wally
end
end
def getSidequestsStats
nb_completed = get_completed_quests(false,false).length
nb_total = NB_QUESTS_AVAILABLE + NB_QUESTS_PRODUCER + NB_TEAM_QUESTS_AVAILABLE
message = _INTL("{1} / {2}",nb_completed, nb_total)
return message
end
end
def pbHallOfFameSimple
scene = HallOfFameSimple_Scene.new
screen = HallOfFameScreen.new(scene)
screen.pbStartScreenEntry
end
@@ -0,0 +1,461 @@
#==============================================================================
# * Scene_Credits
#------------------------------------------------------------------------------
# Scrolls the credits you make below. Original Author unknown.
#
## Edited by MiDas Mike so it doesn't play over the Title, but runs by calling
# the following:
# $scene = Scene_Credits.new
#
## New Edit 3/6/2007 11:14 PM by AvatarMonkeyKirby.
# Ok, what I've done is changed the part of the script that was supposed to make
# the credits automatically end so that way they actually end! Yes, they will
# actually end when the credits are finished! So, that will make the people you
# should give credit to now is: Unknown, MiDas Mike, and AvatarMonkeyKirby.
# -sincerly yours,
# Your Beloved
# Oh yea, and I also added a line of code that fades out the BGM so it fades
# sooner and smoother.
#
## New Edit 24/1/2012 by Maruno.
# Added the ability to split a line into two halves with <s>, with each half
# aligned towards the centre. Please also credit me if used.
#
## New Edit 22/2/2012 by Maruno.
# Credits now scroll properly when played with a zoom factor of 0.5. Music can
# now be defined. Credits can't be skipped during their first play.
#
## New Edit 25/3/2020 by Maruno.
# Scroll speed is now independent of frame rate. Now supports non-integer values
# for SCROLL_SPEED.
#
## New Edit 21/8/2020 by Marin.
# Now automatically inserts the credits from the plugins that have been
# registered through the PluginManager module.
#==============================================================================
class Scene_Credits
# Backgrounds to show in credits. Found in Graphics/Titles/ folder
BACKGROUNDS_LIST_HOENN = [
"Graphics/Battlebacks/battlebg/ocean_night",
"Graphics/Battlebacks/battlebg/ocean",
"Graphics/Battlebacks/battlebg/oceanicmuseum",
"Graphics/Battlebacks/battlebg/oceanseaweed_eve",
"Graphics/Battlebacks/battlebg/oceanseaweed_night",
"Graphics/Battlebacks/battlebg/oceanseaweed",
"Graphics/Battlebacks/battlebg/ocean_eve",
"Graphics/Battlebacks/battlebg/mauvilletunnel",
"Graphics/Battlebacks/battlebg/pond",
"Graphics/Battlebacks/battlebg/pond_night",
"Graphics/Battlebacks/battlebg/pond_eve",
"Graphics/Battlebacks/battlebg/field_night",
"Graphics/Battlebacks/battlebg/field",
"Graphics/Battlebacks/battlebg/cyclingroad_eve",
"Graphics/Battlebacks/battlebg/cyclingroad_night",
"Graphics/Battlebacks/battlebg/cyclingroad",
"Graphics/Battlebacks/battlebg/cave_eve",
"Graphics/Battlebacks/battlebg/cave_night",
"Graphics/Battlebacks/battlebg/cave-granite_night",
"Graphics/Battlebacks/battlebg/cave-granite",
"Graphics/Battlebacks/battlebg/cave",
"Graphics/Battlebacks/battlebg/beach_eve",
"Graphics/Battlebacks/battlebg/beach_night",
"Graphics/Battlebacks/battlebg/beachspecial_night",
"Graphics/Battlebacks/battlebg/beach",
"Graphics/Battlebacks/battlebg/field_eve",
"Graphics/Battlebacks/battlebg/cave.png",
"Graphics/Battlebacks/battlebg/beach_eve.png",
"Graphics/Battlebacks/battlebg/beach_night.png",
"Graphics/Battlebacks/battlebg/beach.png",
"Graphics/Battlebacks/battlebg/field_eve.png",
"Graphics/Battlebacks/battlebg/mangroves.png",
"Graphics/Battlebacks/battlebg/mangroves_eve.png",
"Graphics/Battlebacks/battlebg/mangroves_night.png",
"Graphics/Battlebacks/battlebg/beach.png",
"Graphics/Battlebacks/battlebg/beach.png",
"Graphics/Battlebacks/battlebg/mountain.png",
"Graphics/Battlebacks/battlebg/mountain_eve.png",
"Graphics/Battlebacks/battlebg/mountain_night.png",
"Graphics/Battlebacks/battlebg/forest.png",
"Graphics/Battlebacks/battlebg/forest_night.png",
"Graphics/Battlebacks/battlebg/forest_eve.png",
"Graphics/Battlebacks/battlebg/gym_2.png",
"Graphics/Battlebacks/battlebg/gym_3.png",
#"Graphics/Titles/bg_back"
]
BACKGROUNDS_LIST_KANTO = [""]
BGM = "Credits"
KANTO_SCROLL_SPEED = 70 # Pixels per second , ajuster pour fitter avec la musique
HOENN_SCROLL_SPEED = 52
SECONDS_PER_BACKGROUND = 8
SECONDS_PER_POKEMON_SPRITE = 6
TEXT_OUTLINE_COLOR = Color.new(0, 0, 128, 255)
TEXT_BASE_COLOR = Color.new(255, 255, 255, 255)
TEXT_SHADOW_COLOR = Color.new(0, 0, 0, 100)
TEXT_TITLE_COLOR = Color.new(154, 216, 8)
TEXT_TITLE_OUTLINE_COLOR = Color.new(0, 100, 0, 255)
NB_SPRITES_TO_PRELOAD = 25
TOTAL_NB_FRAMES = 4000 # set manually, depends on music length
FUSION_SPRITES_MAX_OPACITY = 200
NB_FRAMES_AT_MAX_OPACITY = 30
def main
endCredits() if $PokemonSystem.on_mobile
@counter = 0.0
@bg_index = 0
@bitmap_height = Graphics.height
@trim = Graphics.height / 10
@realOY = -(Graphics.height - @trim)
@customSpritesList = getSpritesList()
if Settings::KANTO
@scroll_speed = KANTO_SCROLL_SPEED
@bg_list = BACKGROUNDS_LIST_KANTO
else
@scroll_speed = HOENN_SCROLL_SPEED
@bg_list = BACKGROUNDS_LIST_HOENN
end
@bg_queue = @bg_list.shuffle
@bg_transitioning = :fade_in
@bg_transition_timer = 0.0
#-------------------------------
# Credits text Setup
#-------------------------------
plugin_credits = ""
PluginManager.plugins.each do |plugin|
pcred = PluginManager.credits(plugin)
plugin_credits << "\"#{plugin}\" v.#{PluginManager.version(plugin)} by:\n"
if pcred.size >= 5
plugin_credits << pcred[0] + "\n"
i = 1
until i >= pcred.size
plugin_credits << pcred[i] + "<s>" + (pcred[i + 1] || "") + "\n"
i += 2
end
else
pcred.each { |name| plugin_credits << name + "\n" }
end
plugin_credits << "\n"
end
credits_version = Settings::KANTO ? CREDIT_KANTO : CREDIT_HOENN
credits_version.gsub!(/\{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE\}/, plugin_credits)
credits_version.gsub!(/{SPRITER_CREDITS}/, format_names_for_game_credits())
credits_version.gsub!(/{CC_CREDITS}/, format_character_customization_names_for_game_credits(50))
credit_lines = credits_version.split(/\n/)
#-------------------------------
# Make background and text sprites
#-------------------------------
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
viewport.z = 99999
text_viewport = Viewport.new(0, @trim, Graphics.width, Graphics.height - (@trim * 2))
text_viewport.z = 99999
# Single @bg creation — zoom and drift applied immediately
@bg = IconSprite.new(0, 0)
@bg.setBitmap(@bg_queue.shift) # Pop first image off the queue
@bg.opacity = 0
setup_bg_zoom_and_drift(@bg)
@pokemon_sprite = IconSprite.new(0, 0)
@pokemon_sprite.z = @bg.z + 1
@pokemon_sprite.setBitmap(@bg_queue[0] || @bg_list[0]) # placeholder bitmap
@pokemon_sprite.opacity = 0
@credit_sprites = []
@total_height = credit_lines.size * 32
lines_per_bitmap = @bitmap_height / 32
num_bitmaps = (credit_lines.size.to_f / lines_per_bitmap).ceil
for i in 0...num_bitmaps
credit_bitmap = Bitmap.new(Graphics.width, @bitmap_height)
pbSetSystemFont(credit_bitmap)
for j in 0...lines_per_bitmap
line = credit_lines[i * lines_per_bitmap + j]
next if !line
line = line.split("<s>")
xpos = 0
align = 1 # Centre align
linewidth = Graphics.width
for k in 0...line.length
if line.length > 1
xpos = (k == 0) ? 0 : 20 + Graphics.width / 2
align = (k == 0) ? 2 : 0
linewidth = Graphics.width / 2 - 20
end
# Strip <title> tag if present; use title color for the fill pass
text_to_draw = line[k]
is_title = false
if text_to_draw =~ /\A<title>(.*)\z/m
is_title = true
text_to_draw = $1
end
base_color = is_title ? TEXT_TITLE_COLOR : TEXT_BASE_COLOR
outline_color = is_title ? TEXT_TITLE_OUTLINE_COLOR : TEXT_OUTLINE_COLOR
credit_bitmap.font.color = TEXT_SHADOW_COLOR
credit_bitmap.draw_text(xpos, j * 32 + 4, linewidth, 32, text_to_draw, align)
credit_bitmap.font.color = outline_color
credit_bitmap.draw_text(xpos + 2, j * 32 - 2, linewidth, 32, text_to_draw, align)
credit_bitmap.draw_text(xpos, j * 32 - 2, linewidth, 32, text_to_draw, align)
credit_bitmap.draw_text(xpos - 2, j * 32 - 2, linewidth, 32, text_to_draw, align)
credit_bitmap.draw_text(xpos + 2, j * 32, linewidth, 32, text_to_draw, align)
credit_bitmap.draw_text(xpos - 2, j * 32, linewidth, 32, text_to_draw, align)
credit_bitmap.draw_text(xpos + 2, j * 32 + 2, linewidth, 32, text_to_draw, align)
credit_bitmap.draw_text(xpos, j * 32 + 2, linewidth, 32, text_to_draw, align)
credit_bitmap.draw_text(xpos - 2, j * 32 + 2, linewidth, 32, text_to_draw, align)
credit_bitmap.font.color = base_color
credit_bitmap.draw_text(xpos, j * 32, linewidth, 32, text_to_draw, align)
end
end
credit_sprite = Sprite.new(text_viewport)
credit_sprite.bitmap = credit_bitmap
credit_sprite.z = 9998
credit_sprite.oy = @realOY - @bitmap_height * i
@credit_sprites[i] = credit_sprite
end
#-------------------------------
# Setup
#-------------------------------
# Stops all audio but background music
previousBGM = $game_system.getPlayingBGM
pbMEStop
pbBGSStop
pbSEStop
pbBGMFade(2.0)
pbBGMPlay(BGM)
Graphics.transition(20)
loop do
Graphics.update
Input.update
update
break if $scene != self
end
pbBGMFade(2.0)
Graphics.freeze
viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
Graphics.transition(20, "fadetoblack")
@pokemon_sprite.dispose
@bg.dispose
@credit_sprites.each { |s| s.dispose if s }
text_viewport.dispose
viewport.dispose
$PokemonGlobal.creditsPlayed = true
pbBGMPlay(previousBGM)
end
def setup_pokemon_drift
# Copy background velocity exactly so pokemon moves with the background
@pokemon_drift_vx = @drift_vx
@pokemon_drift_vy = @drift_vy
@pokemon_drift_x = @pokemon_sprite.x.to_f
@pokemon_drift_y = @pokemon_sprite.y.to_f
end
def setup_bg_zoom_and_drift(sprite)
zoom = 1.5
sprite.zoom_x = zoom
sprite.zoom_y = zoom
sprite.x = -(Graphics.width / 2)
sprite.y = -(Graphics.height / 2) + 180
speed = 16.0
angle = rand * 2 * Math::PI
@drift_vx = Math.cos(angle) * speed
@drift_vy = Math.sin(angle) * speed
@drift_x = sprite.x.to_f
@drift_y = sprite.y.to_f
end
# def getSpritesList()
# spritesList = []
# $PokemonSystem.alt_sprite_substitutions.each_value do |value|
# if value.is_a?(PIFSprite)
# spritesList << value
# end
# end
#
# selected_spritesList = spritesList.sample(NB_SPRITES_TO_PRELOAD)
# spriteLoader = BattleSpriteLoader.new
# for sprite in selected_spritesList
# spriteLoader.preload(sprite)
# end
#
# return selected_spritesList
# end
def getSpritesList()
spriteLoader = BattleSpriteLoader.new
seen_pairs = []
fusions = $Trainer.pokedex.list_seen_fusions
fusions.each_with_index do |bodies, head_id|
next if bodies.nil? || head_id == 0
bodies.each_with_index do |seen, body_id|
next if body_id == 0
seen_pairs << [head_id, body_id] if seen == true
end
end
return [] if seen_pairs.empty?
sample_size = [NB_SPRITES_TO_PRELOAD, seen_pairs.size].min
chosen_pairs = seen_pairs.sample(sample_size)
chosen_pairs.map do |head_id, body_id|
head_species = GameData::Species.get(head_id).species
body_species = GameData::Species.get(body_id).species
sprite = spriteLoader.obtain_pif_sprite(
GameData::Species.get(fusionOf(head_species, body_species))
)
spriteLoader.preload(sprite)
sprite
end
end
# Check if the credits should be cancelled
def cancel?
if Input.trigger?(Input::USE) && $PokemonGlobal.creditsPlayed
endCredits
return true
end
return false
end
def endCredits
$scene = Scene_Map.new
pbBGMFade(1.0)
end
# Checks if credits bitmap has reached its ending point
def last?
if @realOY > @total_height + @trim
$scene = ($game_map) ? Scene_Map.new : nil
pbBGMFade(2.0)
return true
end
return false
end
def update
delta = Graphics.delta_s
@counter += delta
@bg_transition_timer += delta
fade_duration = 0.8 # seconds to fade out or in
hold_duration = SECONDS_PER_BACKGROUND - (fade_duration * 2)
case @bg_transitioning
when :fade_in
progress = [@bg_transition_timer / fade_duration, 1.0].min
@bg.opacity = (progress * 200).to_i # max opacity 200 for subtle look
if @bg_transition_timer >= fade_duration
@bg_transitioning = :hold
@bg_transition_timer = 0.0
end
when :hold
@bg.opacity = 200
if @bg_transition_timer >= hold_duration
@bg_transitioning = :fade_out
@bg_transition_timer = 0.0
end
when :fade_out
progress = [@bg_transition_timer / fade_duration, 1.0].min
@bg.opacity = (200 * (1.0 - progress)).to_i
if @bg_transition_timer >= fade_duration
# Refill and reshuffle only once the queue is fully exhausted
if @bg_queue.empty?
@bg_queue = @bg_list.shuffle
end
@bg.setBitmap(@bg_queue.shift)
setup_bg_zoom_and_drift(@bg)
@bg_transitioning = :fade_in
@bg_transition_timer = 0.0
end
end
# Apply drift to background
@drift_x += @drift_vx * delta
@drift_y += @drift_vy * delta
new_bg_x = @drift_x.round
new_bg_y = @drift_y.round
if @bg.x != new_bg_x || @bg.y != new_bg_y
@bg.x = new_bg_x
@bg.y = new_bg_y
end
# Apply drift to Pokémon sprite
# if @pokemon_drift_vx
# @pokemon_drift_x += @pokemon_drift_vx * delta
# @pokemon_drift_y += @pokemon_drift_vy * delta
# new_pk_x = @pokemon_drift_x.round
# new_pk_y = @pokemon_drift_y.round
# if @pokemon_sprite.x != new_pk_x || @pokemon_sprite.y != new_pk_y
# @pokemon_sprite.x = new_pk_x
# @pokemon_sprite.y = new_pk_y
# end
# end
# --- Pokemon sprite counter init ---
@sprites_counter = 0 if !@sprites_counter
@frames_counter = 0 if !@frames_counter
@frames_counter += 1
stopShowingSprites = @frames_counter >= (TOTAL_NB_FRAMES - 300)
pbBGSStop if @frames_counter > TOTAL_NB_FRAMES
spriteLoader = BattleSpriteLoader.new
# Pokémon Sprite Overlay
@pokemon_cycle_timer = 0.0 if !@pokemon_cycle_timer
@pokemon_cycle_timer += delta
if @pokemon_cycle_timer >= SECONDS_PER_POKEMON_SPRITE
@pokemon_cycle_timer -= SECONDS_PER_POKEMON_SPRITE
if @customSpritesList.length > 0 && !stopShowingSprites
@sprites_counter = 0
randomSprite = @customSpritesList.sample
@customSpritesList.delete(randomSprite)
@pokemon_sprite.setBitmapDirectly(spriteLoader.load_random_alt_for_pif_sprite(randomSprite))
@pokemon_sprite.x = rand(0..300)
@pokemon_sprite.y = rand(0..200)
@pokemon_sprite.opacity = 50
@fadingIn = true
setup_pokemon_drift
end
end
# Handle Pokémon Sprite Fading (unchanged)
if @fadingIn
if @pokemon_sprite.opacity < FUSION_SPRITES_MAX_OPACITY
@pokemon_sprite.opacity += 5
else
@fadingIn = false
end
else
@sprites_counter += 1
if @sprites_counter >= NB_FRAMES_AT_MAX_OPACITY
@pokemon_sprite.opacity -= 3
end
end
return if cancel?
return if last?
# Scroll the text
@realOY += @scroll_speed * delta
@credit_sprites.each_with_index { |s, i| s.oy = @realOY - @bitmap_height * i }
end
end
@@ -0,0 +1,217 @@
class Scene_Credits
CREDIT_HOENN = <<_END_
<title>Pokémon Infinite Fusion 2: Hoenn
<title>PART 1
By Chardub (Frogzilla)
<title>Game design
Chardub<s>Payapon
<title>Programming:
Chardub
<title>Autogenerated Sprites :
Japeal - Pokefusion 2
http://japeal.com/pkm
Special thanks to Aegide and Reizod for
helping to download the autogenerated sprites
and to the owners of Japeal for accepting to
share their sprites.
<title>Maps
Chardub<s>Payapon
Kiwikelly<s>
<title>Gameplay / Story
Chardub<s>Payapon
<title>Title screen and logo
Doctor Miawoo
<title>Intro animation:
Kiwikelly
<title>Music:
Pory
<title>Game Assets Management
Payapon
<title>Custom sprites collecting and handling
Payapon
With contributions and tools by:
Kiwikelly, Greystorm, Sapphire_chuu
<title>Trainer Teams and dialogs:
.realthree<s>chardub
funkytomate<s>kiwikelly
pory<s>shiro0170
gordogamr<s>theheroicorange
<title>Overworld Pokémon Sprites:
milchik<s>.payapon
gordogamr<s>.realthree
chardub<s>
<title>Battle Backgrounds Coordination:
.realthree<s>piponus
<title>Battle Backgrounds Art:
.realthree<s>koalagators
piponus<s>aplastic
cynder_<s>chansondoree
kiwikelly<s>revellr
slowforest<s>takopus
<title>QA Testing (Part 1)
adonis9410<s>casinosluck
firesword2562<s>divinelunaria
sapphire_chuu<s>vampvixen
<title>Character Customization graphics coordination:
Chardub
Gummy.Frog
Payapon
<title>Discord custom sprites coordination:
CaBiNE<s>hero.drawing
Howls<s>Milchik
Payapon<s>
<title>Pokedex entries coordination:
.izik<s>.realthree
<title>Pokedex entries quality control
dragon_hunter_70<s>.izik
knilk<s>lordjoostmeister
quackquackattack<s>.realthree
eiskitsune<s>wildheartrazorfangs
ziggaway<s>
Pokédex entries were submitted by the community
The individual credits are displayed in-game
<title>Custom Sprites
All of the custom fused Pokémon sprites
were made by various members of the
Pokémon Infinite Fusion Discord
The individual credits are displayed in-game
It includes significant contributions from:
{SPRITER_CREDITS}
<title>Character Customization Graphics
<title>(Top Contributors)
{CC_CREDITS}
<title>Other custom graphics:
Kiwikelly<s>Payapon
Knucklese<s>UnworthyPie
Doctor Miawoo<s>TCGrunler#4583
Chardub<s>
<title>French Translation
ITG<s>Piduf
Maydangel<s>Maxifurius
desregah<s>Zemelix
PokemonInfiniteFusionFR Discord
Coordinated by anthonygourmand
<title>Chinese Translation
翻译、UI:Leon (Leonnovation)
技术支持:白崎时绘 (Shiroe)
文本参考:阿省呦 (Sheng)
标题图像:未蓝啊 (Weilan)
字体支持:狼人小林 (FusionPixel)
其他支持:小鱼转晴 (XploreLight)
The following free resources were also used
with their respective authors' consent:
<title>Trainer Overworld and Battle sprites
Pokémon Destination Project
Adapted by Payapon
<title>Pokémon Overworld sprites
Dewitty<s>Chocosrawloid
Kymontonian<s>milomilotic11
Neo-Spriteman<s>hamsterskull
Sparta<s>pokewiki.de
<title>Public use tileset graphics:
Alucus BoOmxBiG<s>chimcharsfireworkd
EpicDay<s>EternalTakai
Gallanty Heavy-Metal-Lover<s>Hek-el-grande
DirtyWiggles<s>iametrine
Jorginho<s>kizemaru-kurunosuke
KKKaito<s>kyle-dove
Minorthreat0987<s>Phyromatical
Pokemon-Diamond<s>rayd12smitty
Rossay<s>Shiney570
Spacemotion<s>Speedialga
ThatsSoWitty Thurpok<s>TyranitarDark
UltimoSpriter<s>WesleyFG
{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE}
<title>Pokémon Contests & Berry Dex script
wrigty12<s>bo4p5687
Marin<s>mej71
Maruno<s>FL
JV<s>Umbreon/Hansiec
Radical Raptr<s>FL
Luka S.J.<s>TastyRedTomato
Adapted by Chardub
<title>"Pokémon Essentials" was created by:
Flameguru
Poccil (Peter O.)
Maruno
With contributions from:
AvatarMonkeyKirby<s>MiDas Mike
Boushy<s>Near Fantastica
Brother1440<s>PinkMan
FL.<s>Popper
Genzai Kawakami<s>Rataime
Harshboy<s>SoundSpawn
help-14<s>the__end
IceGod64<s>Venom12
Jacob O. Wobbrock<s>Wachunga
KitsuneKouta<s>xLeD
Lisa Anthony<s>
and everyone else who helped out
<title>"mkxp-z" by:
Roza
Based on MKXP by Ancurio et al.
<title>"RPG Maker XP" by:
Enterbrain
This game was inspired by the original
fusion generator:
alexonsager.alexonsager.net
All generated fusion sprites in this game
come from the Pokémon Fusion Generator:
https://japeal.com/pkm/
Pokémon is owned by:
The Pokémon Company
Nintendo
Affiliated with Game Freak
<title>Thank for playing!
<title>We hope you're looking forward to the full game!
<title>This is a non-profit fan-made game.
<title>No copyright infringements intended.
_END_
end
@@ -0,0 +1,144 @@
class Scene_Credits
CREDIT_KANTO = <<_END_
<title>Pokémon Infinite Fusion
<title>By Chardub (Frogzilla)
<title>Programming / Game design:
Chardub
<title>Fused Pokemon Sprites :
Japeal - Pokefusion 2
http://japeal.com/pkm
Special thanks to Aegide and Reizod for
helping to download the autogenerated sprites
and to the owners of Japeal for accepting to
share their sprites.
<title>Maps:
Chardub
Kiwikelly
Some of the maps were based on work by:
BenGames, Zeak6464
<title>Gameplay / Story :
Chardub
Kiwikelly
<title>Title screen and logo
Doctor Miawoo
<title>Intro animation:
Kiwikelly
<Music>
mystora (Team Rocket Saffron City)
<title>Custom sprites collecting and handling
Kiwikelly, Payapon, Thornsoflight, Greystorm
<title>Discord custom sprites coordination
avianAnnihilator<s>Blaquaza
BéBoutton<s>CaBiNE
CoramSun<s>hero.drawing
Howls<s>Ignus
Kiwi<s>Maelmc
Milchik the Miltank<s>Payapon
Pix<s>Rosemagwin
Thornsoflight
All of the custom fused Pokémon sprites
were made by various members of the
Pokémon Infinite Fusion Discord
Including significant contributions from:
{SPRITER_CREDITS}
<title>Character Customization Graphics
(Top Contributors)
{CC_CREDITS}
<title>Other custom graphics:
Kiwikelly<s>Knuckles
UnworthyPie<s>Doctor Miawoo
Chardub<s>TCGrunler#4583
<title>Elite 4 rematch teams
duskrd<s>anaconja<s>taraline
<title>French translation
anthonygourmand
locpic_
blood.wolf58 (Willi)
ragzzh
<title>The following free resources were also used
<title>with their respective authors' consent:
<title>Public use tileset graphics:
Alucus BoOmxBiG<s>chimcharsfireworkd
EpicDay<s>EternalTakai
Gallanty Heavy-Metal-Lover<s>Hek-el-grande
DirtyWiggles<s>iametrine
Jorginho<s>kizemaru-kurunosuke
KKKaito<s>kyle-dove
Minorthreat0987<s>Phyromatical
Pokemon-Diamond<s>rayd12smitty
Rossay<s>Shiney570
Spacemotion<s>Speedialga
ThatsSoWitty Thurpok<s>TyranitarDark
UltimoSpriter<s>WesleyFG
<title>Public use music:
Pokeli, TailDoll666100
Kazune Sawatari, sentsinkantéun,
Nanashima, CharizardTheMaster, The Zame Jack
{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE}
<title>"Pokémon Essentials" was created by:
Flameguru
Poccil (Peter O.)
Maruno
With contributions from:
AvatarMonkeyKirby<s>MiDas Mike
Boushy<s>Near Fantastica
Brother1440<s>PinkMan
FL.<s>Popper
Genzai Kawakami<s>Rataime
Harshboy<s>SoundSpawn
help-14<s>the__end
IceGod64<s>Venom12
Jacob O. Wobbrock<s>Wachunga
KitsuneKouta<s>xLeD
Lisa Anthony<s>
and everyone else who helped out
<title>"mkxp-z" by:
Roza
Based on MKXP by Ancurio et al.
<title>"RPG Maker XP" by:
Enterbrain
<title>This game was inspired by the original
<title>fusion generator:
alexonsager.alexonsager.net
<title>All generated fusion sprites in this game
<title>come from the Pokémon Fusion Generator:
https://japeal.com/pkm/
<title>Pokémon is owned by:
The Pokémon Company
Nintendo
Affiliated with Game Freak
<title>This is a non-profit fan-made game.
<title>No copyright infringements intended.
_END_
end
+41 -14
View File
@@ -6,7 +6,7 @@ class PokemonPauseMenu_Scene
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@sprites = {}
@sprites["cmdwindow"] = Window_CommandPokemon.new([])
@sprites["cmdwindow"] = Window_PauseMenuCommand.new([])
@sprites["cmdwindow"].visible = false
@sprites["cmdwindow"].viewport = @viewport
@sprites["infowindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
@@ -49,8 +49,9 @@ class PokemonPauseMenu_Scene
ret = -1
cmdwindow = @sprites["cmdwindow"]
cmdwindow.commands = commands
cmdwindow.index = $PokemonTemp.menuLastChoice
cmdwindow.resizeToFit(commands)
cmdwindow.index = $PokemonTemp.menuLastChoice
cmdwindow.top_row = 0
cmdwindow.x = Graphics.width - cmdwindow.width
cmdwindow.y = 0
cmdwindow.visible = true
@@ -92,6 +93,19 @@ class PokemonPauseMenu
@scene.pbShowMenu
end
ICON_POKEDEX = "menuIcons/POKEDEX"
ICON_POKEMON = "menuIcons/POKEMON"
ICON_BAG = "menuIcons/BAG"
ICON_POKENAV = "menuIcons/POKENAV"
ICON_PLAYER = "menuIcons/PLAYER"
ICON_OUTFIT = "menuIcons/OUTFITS"
ICON_SAVE = "menuIcons/SAVE"
ICON_OPTIONS = "menuIcons/OPTIONS"
ICON_DEBUG = "menuIcons/DEBUG"
ICON_TITLE = "menuIcons/TITLE"
ICON_QUIT_SAFARI = "menuIcons/SAFARI"
def pbStartPokemonMenu
if !$Trainer
if $DEBUG
@@ -114,13 +128,13 @@ class PokemonPauseMenu
cmdQuit = -1
cmdEndGame = -1
if $Trainer.has_pokedex && $Trainer.pokedex.accessible_dexes.length > 0
commands[cmdPokedex = commands.length] = _INTL("Pokédex")
commands[cmdPokedex = commands.length] = " <icon=#{ICON_POKEDEX}> " + _INTL("Pokédex")
end
commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $Trainer.party_count > 0
commands[cmdBag = commands.length] = _INTL("Bag") if !pbInBugContest?
commands[cmdPokegear = commands.length] = _INTL("Pokégear") if $Trainer.has_pokegear
commands[cmdTrainer = commands.length] = $Trainer.name
commands[cmdOutfit = commands.length] = _INTL("Outfit") if $Trainer.can_change_outfit
commands[cmdPokemon = commands.length] = " <icon=#{ICON_POKEMON}> " + _INTL("Pokémon") if $Trainer.party_count > 0
commands[cmdBag = commands.length] = " <icon=#{ICON_BAG}> " + _INTL("Bag") if !pbInBugContest?
commands[cmdPokegear = commands.length] = " <icon=#{ICON_POKENAV}> " + _INTL("PokéNav") if $Trainer.has_pokegear
commands[cmdTrainer = commands.length] = " <icon=#{ICON_PLAYER}> " + _INTL("{1}", $Trainer.name)
commands[cmdOutfit = commands.length] = " <icon=#{ICON_OUTFIT}> " + _INTL("Outfit") if $Trainer.can_change_outfit
if pbInSafari?
if Settings::SAFARI_STEPS <= 0
@scene.pbShowInfo(_INTL("Balls: {1}", pbSafariState.ballcount))
@@ -128,7 +142,7 @@ class PokemonPauseMenu
@scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
end
commands[cmdQuit = commands.length] = _INTL("Quit")
commands[cmdQuit = commands.length] = " <icon=#{ICON_QUIT_SAFARI}> " + _INTL("Quit")
elsif pbInBugContest?
if pbBugContestState.lastPokemon
@scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
@@ -140,11 +154,11 @@ class PokemonPauseMenu
end
commands[cmdQuit = commands.length] = _INTL("Quit Contest")
else
commands[cmdSave = commands.length] = _INTL("Save") if $game_system && !$game_system.save_disabled
commands[cmdSave = commands.length] = " <icon=#{ICON_SAVE}> " + _INTL("Save") if $game_system && !$game_system.save_disabled
end
commands[cmdOption = commands.length] = _INTL("Options")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
commands[cmdEndGame = commands.length] = _INTL("Title screen")
commands[cmdOption = commands.length] = " <icon=#{ICON_OPTIONS}> " + _INTL("Options")
commands[cmdDebug = commands.length] = " <icon=#{ICON_DEBUG}> " + _INTL("Debug") if $DEBUG
commands[cmdEndGame = commands.length] = " <icon=#{ICON_TITLE}> " + _INTL("Title")
loop do
command = @scene.pbShowCommands(commands)
if cmdPokedex >= 0 && command == cmdPokedex
@@ -205,10 +219,13 @@ class PokemonPauseMenu
elsif cmdPokegear >= 0 && command == cmdPokegear
pbPlayDecisionSE
pbFadeOutIn {
@scene.pbHideMenu
scene = PokemonPokegear_Scene.new
screen = PokemonPokegearScreen.new(scene)
screen.pbStartScreen
@scene.pbRefresh
# @scene.pbRefresh
# @scene.pbHideMenu
# @scene.pbEndScene
}
elsif cmdTrainer >= 0 && command == cmdTrainer
pbPlayDecisionSE
@@ -287,3 +304,13 @@ class PokemonPauseMenu
@scene.pbEndScene if endscene
end
end
class Window_PauseMenuCommand < Window_AdvancedCommandPokemon
OFFSET = 8
def drawCursor(index, rect)
if self.index == index
pbCopyBitmap(self.contents, @selarrow.bitmap, rect.x, rect.y)
end
return Rect.new(rect.x + 16 - OFFSET, rect.y, rect.width - 16 + OFFSET, rect.height)
end
end
File diff suppressed because it is too large Load Diff
+39 -11
View File
@@ -141,7 +141,12 @@ class PokemonPartyBlankPanel < SpriteWrapper
super(viewport)
self.x = (index % 2) * Graphics.width / 2
self.y = 16 * (index % 2) + 96 * (index / 2)
@panelbgsprite = AnimatedBitmap.new("Graphics/Pictures/Party/panel_blank")
if isDarkMode
path = "Graphics/Pictures/Party/panel_blank_dark"
else
path = "Graphics/Pictures/Party/panel_blank"
end
@panelbgsprite = AnimatedBitmap.new(path)
self.bitmap = @panelbgsprite.bitmap
@text = nil
end
@@ -428,7 +433,7 @@ class PokemonPartyPanel < SpriteWrapper
# Draw shiny icon
if @pokemon.shiny?
imagePos = []
addShinyStarsToGraphicsArray(imagePos, 80, 48, @pokemon.bodyShiny?, @pokemon.headShiny?, @pokemon.debugShiny?, 0, 0, 16, 16)
addShinyStarsToGraphicsArray(imagePos, 80, 48, @pokemon.bodyShiny?, @pokemon.headShiny?, @pokemon.debugShiny?, @pokemon.radarShiny?, 0, 0, 16, 16)
pbDrawImagePositions(@overlaysprite.bitmap, imagePos)
end
end
@@ -1015,10 +1020,11 @@ class PokemonPartyScreen
@scene.pbAnnotate(nil)
end
def pbPokemonMultipleEntryScreenEx(ruleset,ableProc=nil)
#indexesVar: (Optional) saves the selected indexes in a variable
def pbPokemonMultipleEntryScreenEx(ruleset,ableProc=nil,indexesVar=nil)
annot = []
statuses = []
ordinals = [_INTL("INELIGIBLE"), _INTL("NOT ENTERED"), _INTL("BANNED")]
ordinals = [_INTL("INELIGIBLE"), _INTL("NOT ENTERED"), _INTL("CANNOT ENTER")]
positions = [_INTL("FIRST"), _INTL("SECOND"), _INTL("THIRD"), _INTL("FOURTH"),
_INTL("FIFTH"), _INTL("SIXTH"), _INTL("SEVENTH"), _INTL("EIGHTH"),
_INTL("NINTH"), _INTL("TENTH"), _INTL("ELEVENTH"), _INTL("TWELFTH")]
@@ -1042,6 +1048,7 @@ class PokemonPartyScreen
annot[i] = ordinals[statuses[i]]
end
@scene.pbStartScene(@party, _INTL("Choose Pokémon and confirm."), annot, true)
selected_indexes = []
loop do
realorder = []
for i in 0...@party.length
@@ -1070,6 +1077,7 @@ class PokemonPartyScreen
for i in realorder;
ret.push(@party[i]);
end
selected_indexes = realorder.dup
error = []
break if ruleset.isValid?(ret, error)
pbDisplay(error[0])
@@ -1107,6 +1115,7 @@ class PokemonPartyScreen
end
end
@scene.pbEndScene
pbSet(indexesVar, selected_indexes) if indexesVar && ret
return ret
end
@@ -1165,6 +1174,21 @@ class PokemonPartyScreen
return ret
end
def evolvePokemon(pokemon)
evolution_species = pokemon.check_evolution_on_level_up
if evolution_species
pbFadeOutInWithMusic {
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pokemon, evolution_species)
evo.pbEvolution
evo.pbEndScreen
pbRefresh
}
else
pbDisplay(_INTL("{1} Pokémon cannot evolve.",pokemon.name))
pokemon.evolve_from_party = false
end
end
def pbPokemonHat(pokemon)
cmd = 0
@@ -1227,10 +1251,10 @@ class PokemonPartyScreen
return retval
end
def fuseFromParty(pokemon)
def fuseFromParty(pokemon,partyPosition)
splicerItem = selectSplicer()
return unless splicerItem
if pbDNASplicing(pokemon,@scene,splicerItem)
if pbDNASplicing(pokemon,@scene,splicerItem,partyPosition)
echoln splicerItem
$PokemonBag.pbDeleteItem(splicerItem, 1) unless splicerItem == :INFINITESPLICERS || splicerItem == :INFINITESPLICERS2
end
@@ -1240,7 +1264,8 @@ class PokemonPartyScreen
splicerItem = selectSplicer()
return unless splicerItem
isSuperSplicer = [:SUPERSPLICERS,:INFINITESPLICERS2].include?(splicerItem)
if pbUnfuse(pokemon,@scene,isSuperSplicer)
echoln index
if pbUnfuse(pokemon,@scene,index, nil)
$PokemonBag.pbDeleteItem(splicerItem, 1) unless splicerItem == :INFINITESPLICERS || splicerItem == :INFINITESPLICER2
end
end
@@ -1298,9 +1323,10 @@ class PokemonPartyScreen
cmdLearnMove = -1
cmdUnfuse = -1
cmdFuse = -1
cmdEvolve = -1
# Build the commands
commands[cmdEvolve = commands.length] = _INTL("Evolve!") if pkmn.evolve_from_party && pokemonAllowedToEvolve(pkmn)
commands[cmdSummary = commands.length] = _INTL("Summary")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
if !pkmn.egg?
@@ -1321,8 +1347,8 @@ class PokemonPartyScreen
commands[cmdItem = commands.length] = _INTL("Item")
end
end
commands[cmdNickname = commands.length] = _INTL("Nickname") if !pkmn.egg?
commands[cmdLearnMove = commands.length] = _INTL("Remember moves")
commands[cmdNickname = commands.length] = _INTL("Nickname") unless pkmn.egg?
commands[cmdLearnMove = commands.length] = _INTL("Change moves") unless pkmn.egg?
if playerHasFusionItems
if pkmn.isFusion?
@@ -1392,6 +1418,8 @@ class PokemonPartyScreen
@scene.pbSummary(pkmnid) {
@scene.pbSetHelpText((@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
}
elsif cmdEvolve >= 0 && command == cmdEvolve
evolvePokemon(pkmn)
elsif cmdHat >= 0 && command == cmdHat
pbPokemonHat(pkmn)
elsif cmdLearnMove > 0 && command == cmdLearnMove
@@ -1399,7 +1427,7 @@ class PokemonPartyScreen
elsif cmdNickname >= 0 && command == cmdNickname
pbPokemonRename(pkmn, pkmnid)
elsif cmdFuse >= 0 && command == cmdFuse
fuseFromParty(pkmn)
fuseFromParty(pkmn,pkmnid)
elsif cmdUnfuse >= 0 && command == cmdUnfuse
unfuseFromParty(pkmn,pkmnid)
elsif cmdDebug >= 0 && command == cmdDebug
+94 -87
View File
@@ -108,7 +108,11 @@ class PokemonSummary_Scene
pbUpdateSpriteHash(@sprites)
end
def pbStartScene(party, partyindex, inbattle = false)
def pbStartScene(party, partyindex, inbattle = false, is_player = true)
@is_player = is_player
@text_color_base = isDarkMode ? pbColor(:LIGHT_TEXT_MAIN_COLOR) : Color.new(64, 64, 64)
@text_color_shadow = isDarkMode ? pbColor(:LIGHT_TEXT_SHADOW_COLOR) : Color.new(176, 176, 176)
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@party = party
@@ -200,6 +204,10 @@ class PokemonSummary_Scene
@sprites["movesel"].visible = false
@sprites["movesel"].visible = true
@sprites["movesel"].index = 0
@text_color_base = isDarkMode ? pbColor(:LIGHT_TEXT_MAIN_COLOR) : Color.new(64, 64, 64)
@text_color_shadow = isDarkMode ? pbColor(:LIGHT_TEXT_SHADOW_COLOR) : Color.new(176, 176, 176)
new_move = (move_to_learn) ? Pokemon::Move.new(move_to_learn) : nil
drawSelectedMove(new_move, @pokemon.moves[0])
pbFadeInAndShow(@sprites)
@@ -288,6 +296,7 @@ class PokemonSummary_Scene
return ret
end
def drawMarkings(bitmap, x, y)
markings = @pokemon.markings
markrect = Rect.new(0, 0, 16, 16)
@@ -336,8 +345,8 @@ class PokemonSummary_Scene
end
# Show shininess star
if @pokemon.shiny?
addShinyStarsToGraphicsArray(imagepos, 2, 134, @pokemon.bodyShiny?, @pokemon.headShiny?, @pokemon.debugShiny?, nil, nil, nil, nil, true)
#imagepos.push([sprintf("Graphics/Pictures/shiny"), 2, 134])
addShinyStarsToGraphicsArray(imagepos, 2, 134, @pokemon.bodyShiny?, @pokemon.headShiny?, @pokemon.debugShiny?, @pokemon.radarShiny?, nil, nil, nil, nil, true)
# imagepos.push([sprintf("Graphics/Pictures/shiny"), 2, 134])
end
# Draw all images
pbDrawImagePositions(overlay, imagepos)
@@ -350,12 +359,12 @@ class PokemonSummary_Scene
textpos = [
[pagename, 26, 10, 0, base, shadow],
[@pokemon.name, 46, 56, 0, base, shadow],
[@pokemon.level.to_s, 46, 86, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[@pokemon.level.to_s, 46, 86, 0, @text_color_base, @text_color_shadow],
[_INTL("Item"), 66, 312, 0, base, shadow]
]
# Write the held item's name
if @pokemon.hasItem?
textpos.push([@pokemon.item.name, 16, 346, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
textpos.push([@pokemon.item.name, 16, 346, 0, @text_color_base, @text_color_shadow])
else
textpos.push([_INTL("None"), 16, 346, 0, Color.new(192, 200, 208), Color.new(208, 216, 224)])
end
@@ -405,8 +414,8 @@ class PokemonSummary_Scene
overlay = @sprites["overlay"].bitmap
base = Color.new(248, 248, 248)
shadow = Color.new(104, 104, 104)
dexNumBase = (@pokemon.shiny?) ? Color.new(248, 56, 32) : Color.new(64, 64, 64)
dexNumShadow = (@pokemon.shiny?) ? Color.new(224, 152, 144) : Color.new(176, 176, 176)
dexNumBase = (@pokemon.shiny?) ? Color.new(248, 56, 32) : @text_color_base
dexNumShadow = (@pokemon.shiny?) ? Color.new(224, 152, 144) : @text_color_shadow
# If a Shadow Pokémon, draw the heart gauge area and bar
if @pokemon.shadowPokemon?
shadowfract = @pokemon.heart_gauge.to_f / Pokemon::HEART_GAUGE_SIZE
@@ -420,7 +429,7 @@ class PokemonSummary_Scene
textpos = [
#["Dex No.", 238, dex_no_y, 0, base, shadow],
[_INTL("Species"), 238, species_y, 0, base, shadow],
[@pokemon.speciesName, 435, species_y, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[@pokemon.speciesName, 435, species_y, 2, @text_color_base, @text_color_shadow],
[_INTL("Type"), 238, type_y, 0, base, shadow],
[_INTL("OT"), 238, ot_y, 0, base, shadow],
# ["ID No.", 238, id_no_y, 0, base, shadow],
@@ -430,10 +439,10 @@ class PokemonSummary_Scene
bodyName = getPokemon(@pokemon.species_data.get_body_species).name
textpos << [_INTL("Head"), 238, fusion_head_y, 0, base, shadow]
textpos << [headName, 435, fusion_head_y, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)]
textpos << [headName, 435, fusion_head_y, 2, @text_color_base, @text_color_shadow]
textpos << [_INTL("Body"), 238, fusion_body_y, 0, base, shadow]
textpos << [bodyName, 435, fusion_body_y, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)]
textpos << [bodyName, 435, fusion_body_y, 2, @text_color_base, @text_color_shadow]
else
dexnum = GameData::Species.get(@pokemon.species).id_number
textpos << [_INTL("Dex No"), 238, fusion_head_y, 0, base, shadow]
@@ -465,11 +474,11 @@ class PokemonSummary_Scene
# end
# Write Original Trainer's name and ID number
if @pokemon.owner.name.empty?
textpos.push([_INTL("RENTAL"), 435, ot_y, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
#textpos.push(["?????", 435, 202, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
textpos.push([_INTL("RENTAL"), 435, ot_y, 2, @text_color_base, @text_color_shadow])
# textpos.push(["?????", 435, 202, 2, @text_color_base_LIGHT, @text_color_shadow_LIGHT])
else
ownerbase = Color.new(64, 64, 64)
ownershadow = Color.new(176, 176, 176)
ownerbase = @text_color_base
ownershadow = @text_color_shadow
case @pokemon.owner.gender
when 0
ownerbase = Color.new(24, 112, 216)
@@ -479,7 +488,7 @@ class PokemonSummary_Scene
ownershadow = Color.new(224, 152, 144)
end
textpos.push([@pokemon.owner.name, 435, ot_y, 2, ownerbase, ownershadow])
#textpos.push([sprintf("%05d", @pokemon.owner.public_id), 435, 202, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
# textpos.push([sprintf("%05d", @pokemon.owner.public_id), 435, 202, 2, @text_color_base_LIGHT, @text_color_shadow_LIGHT])
end
# Write Exp text OR heart gauge message (if a Shadow Pokémon)
# if @pokemon.shadowPokemon?
@@ -490,15 +499,15 @@ class PokemonSummary_Scene
# "The door to its heart is opening wider.",
# "The door to its heart is opening up.",
# "The door to its heart is tightly shut."][@pokemon.heartStage]
# memo = sprintf("<c3=404040,B0B0B0>%s\n", heartmessage)
# memo = sprintf("%s\n", heartmessage)
# drawFormattedTextEx(overlay, 234, 304, 264, memo)
# else
endexp = @pokemon.growth_rate.minimum_exp_for_level(@pokemon.level + 1)
textpos.push([_INTL("Exp. Points"), 238, 234, 0, base, shadow])
textpos.push([@pokemon.exp.to_s_formatted, 488, 266, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)])
textpos.push([@pokemon.exp.to_s_formatted, 488, 266, 1, @text_color_base, @text_color_shadow])
textpos.push([_INTL("To Next Lv."), 238, 298, 0, base, shadow])
textpos.push([(endexp - @pokemon.exp).to_s_formatted, 488, 330, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)])
#end
textpos.push([(endexp - @pokemon.exp).to_s_formatted, 488, 330, 1, @text_color_base, @text_color_shadow])
# end
# Draw all text
pbDrawTextPositions(overlay, textpos)
# Draw Pokémon type(s)
@@ -549,7 +558,7 @@ class PokemonSummary_Scene
]
# Write the held item's name
if @pokemon.hasItem?
textpos.push([@pokemon.item.name, 16, 346, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
textpos.push([@pokemon.item.name, 16, 346, 0, @text_color_base, @text_color_shadow])
else
textpos.push([_INTL("None"), 16, 346, 0, Color.new(192, 200, 208), Color.new(208, 216, 224)])
end
@@ -561,24 +570,24 @@ class PokemonSummary_Scene
date = @pokemon.timeReceived.day
month = pbGetMonthName(@pokemon.timeReceived.mon)
year = @pokemon.timeReceived.year
memo += _INTL("<c3=404040,B0B0B0>{1} {2}, {3}\n", date, month, year)
memo += _INTL("{1} {2}, {3}\n", date, month, year)
end
# Write map name egg was received on
mapname = pbGetMapNameFromId(@pokemon.obtain_map)
mapname = @pokemon.obtain_text if @pokemon.obtain_text && !@pokemon.obtain_text.empty?
if mapname && mapname != ""
memo += _INTL("<c3=404040,B0B0B0>A mysterious Pokémon Egg received from <c3=F83820,E09890>{1}<c3=404040,B0B0B0>.\n", mapname)
memo += _INTL("A mysterious Pokémon Egg received from <c3=F83820,E09890>{1}.\n", mapname)
else
memo += _INTL("<c3=404040,B0B0B0>A mysterious Pokémon Egg.\n", mapname)
memo += _INTL("A mysterious Pokémon Egg.\n", mapname)
end
memo += "\n" # Empty line
# Write Egg Watch blurb
memo += _INTL("<c3=404040,B0B0B0>\"The Egg Watch\"\n")
memo += _INTL("\"The Egg Watch\"\n")
eggstate = _INTL("It looks like this Egg will take a long time to hatch.")
eggstate = _INTL("What will hatch from this? It doesn't seem close to hatching.") if @pokemon.steps_to_hatch < 10200
eggstate = _INTL("It appears to move occasionally. It may be close to hatching.") if @pokemon.steps_to_hatch < 2550
eggstate = _INTL("Sounds can be heard coming from inside! It will hatch soon!") if @pokemon.steps_to_hatch < 1275
memo += sprintf("<c3=404040,B0B0B0>%s\n", eggstate)
memo += sprintf("%s\n", eggstate)
# Draw all text
drawFormattedTextEx(overlay, 232, 82, 268, memo)
# Draw the Pokémon's markings
@@ -592,20 +601,20 @@ class PokemonSummary_Scene
showNature = !@pokemon.shadowPokemon? || @pokemon.heartStage > 3
if showNature
natureName = @pokemon.nature.name
memo += _INTL("<c3=F83820,E09890>{1}<c3=404040,B0B0B0> nature.\n", natureName)
memo += _INTL("{1} nature.\n", natureName)
end
# Write date received
if @pokemon.timeReceived
date = @pokemon.timeReceived.day
month = pbGetMonthName(@pokemon.timeReceived.mon)
year = @pokemon.timeReceived.year
memo += _INTL("<c3=404040,B0B0B0>{1} {2}, {3}\n", date, month, year)
memo += _INTL("{1} {2}, {3}\n", date, month, year)
end
# Write map name Pokémon was received on
mapname = pbGetMapNameFromId(@pokemon.obtain_map)
mapname = @pokemon.obtain_text if @pokemon.obtain_text && !@pokemon.obtain_text.empty?
mapname = _INTL("Faraway place") if nil_or_empty?(mapname)
memo += sprintf("<c3=F83820,E09890>%s\n", mapname)
memo += sprintf("%s\n", mapname)
# Write how Pokémon was obtained
mettext = [_INTL("Met at Lv. {1}.", @pokemon.obtain_level),
_INTL("Egg received."),
@@ -613,19 +622,19 @@ class PokemonSummary_Scene
"",
_INTL("Had a fateful encounter at Lv. {1}.", @pokemon.obtain_level)
][@pokemon.obtain_method]
memo += sprintf("<c3=404040,B0B0B0>%s\n", mettext) if mettext && mettext != ""
memo += sprintf("%s\n", mettext) if mettext && mettext != ""
# If Pokémon was hatched, write when and where it hatched
if @pokemon.obtain_method == 1
if @pokemon.timeEggHatched
date = @pokemon.timeEggHatched.day
month = pbGetMonthName(@pokemon.timeEggHatched.mon)
year = @pokemon.timeEggHatched.year
memo += _INTL("<c3=404040,B0B0B0>{1} {2}, {3}\n", date, month, year)
memo += _INTL("{1} {2}, {3}\n", date, month, year)
end
mapname = pbGetMapNameFromId(@pokemon.hatched_map)
mapname = _INTL("Faraway place") if nil_or_empty?(mapname)
memo += sprintf("<c3=F83820,E09890>%s\n", mapname)
memo += _INTL("<c3=404040,B0B0B0>Egg hatched.\n")
memo += sprintf("%s\n", mapname)
memo += _INTL("Egg hatched.\n")
else
memo += "\n" # Empty line
end
@@ -674,7 +683,7 @@ class PokemonSummary_Scene
_INTL("Somewhat of a clown."),
_INTL("Quick to flee.")]
}
memo += sprintf("<c3=404040,B0B0B0>%s\n", characteristics[best_stat][best_iv % 5])
memo += sprintf("%s\n", characteristics[best_stat][best_iv % 5])
end
# Write all text
drawFormattedTextEx(overlay, 232, 82, 268, memo)
@@ -696,35 +705,27 @@ class PokemonSummary_Scene
# Write various bits of text
textpos = [
[_INTL("HP"), 292, 70, 2, base, statshadows[:HP]],
[sprintf("%d/%d", @pokemon.hp, @pokemon.totalhp), 462, 70, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[sprintf("%d/%d", @pokemon.hp, @pokemon.totalhp), 462, 70, 1, @text_color_base, @text_color_shadow],
[_INTL("Attack"), 248, 114, 0, base, statshadows[:ATTACK]],
[sprintf("%d", @pokemon.attack), 456, 114, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[sprintf("%d", @pokemon.attack), 456, 114, 1, @text_color_base, @text_color_shadow],
[_INTL("Defense"), 248, 146, 0, base, statshadows[:DEFENSE]],
[sprintf("%d", @pokemon.defense), 456, 146, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[sprintf("%d", @pokemon.defense), 456, 146, 1, @text_color_base, @text_color_shadow],
[_INTL("Sp. Atk"), 248, 178, 0, base, statshadows[:SPECIAL_ATTACK]],
[sprintf("%d", @pokemon.spatk), 456, 178, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[sprintf("%d", @pokemon.spatk), 456, 178, 1, @text_color_base, @text_color_shadow],
[_INTL("Sp. Def"), 248, 210, 0, base, statshadows[:SPECIAL_DEFENSE]],
[sprintf("%d", @pokemon.spdef), 456, 210, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[sprintf("%d", @pokemon.spdef), 456, 210, 1, @text_color_base, @text_color_shadow],
[_INTL("Speed"), 248, 242, 0, base, statshadows[:SPEED]],
[sprintf("%d", @pokemon.speed), 456, 242, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[sprintf("%d", @pokemon.speed), 456, 242, 1, @text_color_base, @text_color_shadow],
[_INTL("Ability"), 224, 278, 0, base, shadow]
]
# Draw ability name and description
ability = @pokemon.ability
ability2 = @pokemon.ability2
if ability
textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
drawTextEx(overlay, 224, 320, 282, 2, ability.description, Color.new(64, 64, 64), Color.new(176, 176, 176))
textpos.push([ability.name, 362, 278, 0, @text_color_base, @text_color_shadow])
drawTextEx(overlay, 224, 320, 282, 2, ability.description, @text_color_base, @text_color_shadow)
end
#fixme temp double abilities
# if ability
# textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
# if ability2
# drawTextEx(overlay, 224, 320, 282, 2, ability2.name, Color.new(64, 64, 64), Color.new(176, 176, 176))
# end
# end
# Draw all text
pbDrawTextPositions(overlay, textpos)
@@ -745,8 +746,8 @@ class PokemonSummary_Scene
def drawPageFour
overlay = @sprites["overlay"].bitmap
moveBase = Color.new(64, 64, 64)
moveShadow = Color.new(176, 176, 176)
moveBase = @text_color_base
moveShadow = @text_color_shadow
ppBase = [moveBase, # More than 1/2 of total PP
Color.new(248, 192, 0), # 1/2 of total PP or less
Color.new(248, 136, 32), # 1/4 of total PP or less
@@ -796,8 +797,8 @@ class PokemonSummary_Scene
overlay.clear
base = Color.new(248, 248, 248)
shadow = Color.new(104, 104, 104)
moveBase = Color.new(64, 64, 64)
moveShadow = Color.new(176, 176, 176)
moveBase = @text_color_base
moveShadow = @text_color_shadow
ppBase = [moveBase, # More than 1/2 of total PP
Color.new(248, 192, 0), # 1/2 of total PP or less
Color.new(248, 136, 32), # 1/4 of total PP or less
@@ -869,12 +870,11 @@ class PokemonSummary_Scene
end
def drawSelectedMove(move_to_learn, selected_move)
# Draw all of page four, except selected move's details
drawPageFourSelecting(move_to_learn)
# Set various values
overlay = @sprites["overlay"].bitmap
base = Color.new(64, 64, 64)
shadow = Color.new(176, 176, 176)
base = @text_color_base
shadow = @text_color_shadow
@sprites["pokemon"].visible = false if @sprites["pokemon"]
@sprites["pokeicon"].pokemon = @pokemon
@sprites["pokeicon"].visible = true
@@ -904,16 +904,21 @@ class PokemonSummary_Scene
end
def drawPageFive
return if !$Trainer.has_pokedex
if !$Trainer.has_pokedex
pbPlayBuzzerSE
drawPageFour
@page -= 1
return
end
$Trainer.pokedex.register_last_seen(@pokemon)
pbFadeOutIn {
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbStartSceneSingle(@pokemon.species)
screen.pbStartSceneSingle(@pokemon)
}
pbChangePokemon
@page -= 1
drawPageFour #stay on the same page
drawPageFour # stay on the same page
end
# def drawPageFive
@@ -922,8 +927,8 @@ class PokemonSummary_Scene
# @sprites["downarrow"].visible = false
# # Write various bits of text
# textpos = [
# ["No. of Ribbons:", 234, 326, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)],
# [@pokemon.numRibbons.to_s, 450, 326, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)],
# ["No. of Ribbons:", 234, 326, 0, @text_color_base_LIGHT, @text_color_shadow_LIGHT],
# [@pokemon.numRibbons.to_s, 450, 326, 1, @text_color_base_LIGHT, @text_color_shadow_LIGHT],
# ]
# # Draw all text
# pbDrawTextPositions(overlay, textpos)
@@ -948,8 +953,8 @@ class PokemonSummary_Scene
drawPage(5)
# Set various values
overlay = @sprites["overlay"].bitmap
base = Color.new(64, 64, 64)
shadow = Color.new(176, 176, 176)
base = @text_color_base
shadow = @text_color_shadow
nameBase = Color.new(248, 248, 248)
nameShadow = Color.new(104, 104, 104)
# Get data for selected ribbon
@@ -1270,6 +1275,7 @@ class PokemonSummary_Scene
end
def pbOptions
return unless @is_player
dorefresh = false
commands = []
cmdGiveItem = -1
@@ -1308,7 +1314,7 @@ class PokemonSummary_Scene
pbFadeOutIn {
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbStartSceneSingle(@pokemon.species)
screen.pbStartSceneSingle(@pokemon)
}
pbChangePokemon
dorefresh = true
@@ -1319,15 +1325,15 @@ class PokemonSummary_Scene
end
def pbOpenHatScreenSummary(pokemon)
#oldsprites = pbFadeOutAndHide(@sprites)
x_pos = -8 #todo: Set as relative position instead of hardcoded value
y_pos = 94#
# oldsprites = pbFadeOutAndHide(@sprites)
x_pos = -8 # todo: Set as relative position instead of hardcoded value
y_pos = 94 #
scene = PokemonHatView.new(x_pos,y_pos,false)
scene = PokemonHatView.new(x_pos, y_pos, false)
screen = PokemonHatPresenter.new(scene, pokemon)
screen.pbStartScreen()
yield if block_given?
#pbFadeInAndShow(@sprites, oldsprites)
# pbFadeInAndShow(@sprites, oldsprites)
end
def pbPokemonHatFromSummary(pokemon)
@@ -1336,21 +1342,21 @@ class PokemonSummary_Scene
msg = "What should you do?"
loop do
cmd = pbShowCommands([
_INTL("Put on hat"),
_INTL("Remove hat"),
_INTL("Back")])
_INTL("Put on hat"),
_INTL("Remove hat"),
_INTL("Back")])
break if cmd == -1
if cmd == 0 #Put on hat
@sprites["pokemon"].visible=false
if cmd == 0 # Put on hat
@sprites["pokemon"].visible = false
pbOpenHatScreenSummary(pokemon)
@sprites["pokemon"].visible=true
pbDisplay(_INTL("{1} put on a hat!",pokemon.name))
@sprites["pokemon"].visible = true
pbDisplay(_INTL("{1} put on a hat!", pokemon.name))
#@sprites["pokemon"].visible=false
elsif cmd == 1 #remove hat
if pbConfirm(_INTL("Remove {1}'s hat?",pokemon.name))
pokemon.hat=nil
pbDisplay(_INTL("{1}'s hat was removed",pokemon.name))
elsif cmd == 1 # remove hat
if pbConfirm(_INTL("Remove {1}'s hat?", pokemon.name))
pokemon.hat = nil
pbDisplay(_INTL("{1}'s hat was removed", pokemon.name))
end
else
break
@@ -1418,8 +1424,8 @@ class PokemonSummary_Scene
elsif @page == 5
@page -= 1
pbPlayDecisionSE
#pbRibbonSelection
#dorefresh = true
# pbRibbonSelection
# dorefresh = true
elsif !@inbattle
pbPlayDecisionSE
dorefresh = pbOptions
@@ -1451,7 +1457,7 @@ class PokemonSummary_Scene
dorefresh = true
end
elsif Input.trigger?(Input::RIGHT) && !@pokemon.egg?
if @page == 4 && !$Trainer.has_pokedex
if @page == 4 && (!$Trainer.has_pokedex || !@is_player)
pbSEPlay("GUI sel buzzer")
else
oldpage = @page
@@ -1482,8 +1488,9 @@ class PokemonSummaryScreen
@inbattle = inbattle
end
def pbStartScreen(party, partyindex)
@scene.pbStartScene(party, partyindex, @inbattle)
def pbStartScreen(party, partyindex, is_player = true)
@is_player = is_player # If viewing the team of not the player
@scene.pbStartScene(party, partyindex, @inbattle, @is_player)
ret = @scene.pbScene
@scene.pbEndScene
return ret
@@ -1496,7 +1503,7 @@ class PokemonSummaryScreen
ret = @scene.pbChooseMoveToForget(move_to_learn)
break if ret < 0 || !move_to_learn
break if party[partyindex].moves[ret]
#pbMessage("HM moves can't be forgotten now.") { @scene.pbUpdate }
# pbMessage("HM moves can't be forgotten now.") { @scene.pbUpdate }
end
@scene.pbEndScene
return ret
+50 -17
View File
@@ -66,11 +66,20 @@ class Window_PokemonBag < Window_DrawableCommand
rect = Rect.new(rect.x+16,rect.y+16,rect.width-16,rect.height)
thispocket = @bag.pockets[@pocket]
if index==self.itemCount-1
textpos.push([_INTL("CLOSE BAG"),rect.x,rect.y-2,false,self.baseColor,self.shadowColor])
closeBase = @baseColor
closeShadow = @shadowColor
if isDarkMode
closeBase, closeShadow = closeShadow, closeBase
end
textpos.push([_INTL("CLOSE BAG"),rect.x,rect.y-2,false,closeBase,closeShadow])
else
item = (@filterlist) ? thispocket[@filterlist[@pocket][index]][0] : thispocket[index][0]
baseColor = self.baseColor
shadowColor = self.shadowColor
baseColor = @baseColor
shadowColor = @shadowColor
if isDarkMode
baseColor, shadowColor = shadowColor, baseColor
end
if @sorting && index==self.index
baseColor = Color.new(224,0,0)
shadowColor = Color.new(248,144,144)
@@ -280,8 +289,13 @@ class PokemonBag_Scene
overlay = @sprites["overlay"].bitmap
overlay.clear
# Draw the pocket name
pnBase = POCKETNAMEBASECOLOR
pnShadow = POCKETNAMESHADOWCOLOR
if isDarkMode
pnBase, pnShadow = pnShadow, pnBase
end
pbDrawTextPositions(overlay,[
[PokemonBag.pocketNames[@bag.lastpocket],94,176,2,POCKETNAMEBASECOLOR,POCKETNAMESHADOWCOLOR]
[PokemonBag.pocketNames[@bag.lastpocket],94,176,2,pnBase,pnShadow]
])
# Draw slider arrows
showslider = false
@@ -447,6 +461,15 @@ end
# Bag mechanics
#===============================================================================
class PokemonBagScreen
POCKET_ITEMS = 1
POCKET_MEDICINE = 2
POCKET_BALLS = 3
POCKET_TM = 4
POCKET_BERRIES = 5
POCKET_MAIL = 6
POCKET_BATTLE = 7
POCKET_KEY = 8
def initialize(scene,bag)
@bag = bag
@scene = scene
@@ -534,21 +557,31 @@ class PokemonBagScreen
end
@scene.pbRefresh
elsif cmdSort >=0 && command == cmdSort # Sort bag
command = @scene.pbShowCommands(_INTL("How to sort?",itemname),[
_INTL("Alphabetically"),
_INTL("By quantity"),
# "Recently used",
# "Recently obtained",
_INTL("Cancel")
],0)
case command
commands = []
cmd_alphabet =_INTL("Alphabetically")
cmd_quantity = _INTL("By quantity")
cmd_number = _INTL("By number")
cmd_type = _INTL("By move type")
cmd_cancel = _INTL("Cancel")
commands << cmd_alphabet
commands << cmd_quantity unless @bag.lastpocket == POCKET_TM || @bag.lastpocket == POCKET_KEY
commands << cmd_number if @bag.lastpocket == POCKET_TM
commands << cmd_type if @bag.lastpocket == POCKET_TM
commands << cmd_cancel
command = @scene.pbShowCommands(_INTL("How to sort?",itemname),commands,0)
case commands[command]
### Cancel ###
when -1, 3
next
when 0
@bag.sort_pocket_alphabetically()
when 1
when cmd_alphabet
@bag.sort_pocket_alphabetically()
when cmd_quantity
@bag.sort_pocket_by_quantity()
when cmd_number
@bag.sort_pocket_by_tm_number()
when cmd_type
@bag.sort_pocket_by_move_type()
else
next
end
@scene.pbRefresh
elsif cmdDebug>=0 && command==cmdDebug # Debug
-157
View File
@@ -1,157 +0,0 @@
#===============================================================================
#
#===============================================================================
class PokegearButton < SpriteWrapper
attr_reader :index
attr_reader :name
attr_reader :selected
def initialize(command,x,y,viewport=nil)
super(viewport)
@image = command[0]
@name = command[1]
@selected = false
if $Trainer.female? && pbResolveBitmap(sprintf("Graphics/Pictures/Pokegear/icon_button_f"))
@button = AnimatedBitmap.new("Graphics/Pictures/Pokegear/icon_button_f")
else
@button = AnimatedBitmap.new("Graphics/Pictures/Pokegear/icon_button")
end
@contents = BitmapWrapper.new(@button.width,@button.height)
self.bitmap = @contents
self.x = x
self.y = y
pbSetSystemFont(self.bitmap)
refresh
end
def dispose
@button.dispose
@contents.dispose
super
end
def selected=(val)
oldsel = @selected
@selected = val
refresh if oldsel!=val
end
def refresh
self.bitmap.clear
rect = Rect.new(0,0,@button.width,@button.height/2)
rect.y = @button.height/2 if @selected
self.bitmap.blt(0,0,@button.bitmap,rect)
textpos = [
[@name,self.bitmap.width/2,4,2,Color.new(248,248,248),Color.new(40,40,40)],
]
pbDrawTextPositions(self.bitmap,textpos)
imagepos = [
[sprintf("Graphics/Pictures/Pokegear/icon_"+@image),18,10]
]
pbDrawImagePositions(self.bitmap,imagepos)
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokegear_Scene
def pbUpdate
for i in 0...@commands.length
@sprites["button#{i}"].selected = (i==@index)
end
pbUpdateSpriteHash(@sprites)
end
def pbStartScene(commands)
@commands = commands
@index = 0
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z = 99999
@sprites = {}
@sprites["background"] = IconSprite.new(0,0,@viewport)
if $Trainer.female? && pbResolveBitmap(sprintf("Graphics/Pictures/Pokegear/bg_f"))
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg_f")
else
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg")
end
for i in 0...@commands.length
y = 196 - (@commands.length*24) + (i*48)
@sprites["button#{i}"] = PokegearButton.new(@commands[i],118,y,@viewport)
end
pbFadeInAndShow(@sprites) { pbUpdate }
end
def pbScene
ret = -1
loop do
Graphics.update
Input.update
pbUpdate
if Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
break
elsif Input.trigger?(Input::USE)
pbPlayDecisionSE
ret = @index
break
elsif Input.trigger?(Input::UP)
pbPlayCursorSE if @commands.length>1
@index -= 1
@index = @commands.length-1 if @index<0
elsif Input.trigger?(Input::DOWN)
pbPlayCursorSE if @commands.length>1
@index += 1
@index = 0 if @index>=@commands.length
end
end
return ret
end
def pbEndScene
pbFadeOutAndHide(@sprites) { pbUpdate }
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokegearScreen
def initialize(scene)
@scene = scene
end
def pbStartScreen
commands = []
cmdMap = -1
cmdPhone = -1
cmdJukebox = -1
commands[cmdMap = commands.length] = ["map",_INTL("Map")]
if $PokemonGlobal.phoneNumbers && $PokemonGlobal.phoneNumbers.length>0
commands[cmdPhone = commands.length] = ["phone",_INTL("Phone")]
end
commands[cmdJukebox = commands.length] = ["jukebox",_INTL("Jukebox")]
@scene.pbStartScene(commands)
loop do
cmd = @scene.pbScene
if cmd<0
break
elsif cmdMap>=0 && cmd==cmdMap
pbShowMap(-1,false)
elsif cmdPhone>=0 && cmd==cmdPhone
pbFadeOutIn {
PokemonPhoneScene.new.start
}
elsif cmdJukebox>=0 && cmd==cmdJukebox
pbFadeOutIn {
scene = PokemonJukebox_Scene.new
screen = PokemonJukeboxScreen.new(scene)
screen.pbStartScreen
}
end
end
@scene.pbEndScene
end
end
+1 -1
View File
@@ -92,7 +92,7 @@ class PokemonPhoneScene
end
end
infotext = _INTL("Registered<br>")
infotext += _INTL(" <r>{1}<br>",@sprites["list"].commands.length)
infotext += " <r>#{@sprites["list"].commands.length}<br>"
infotext += _INTL("Waiting for a rematch<r>{1}",rematchcount)
@sprites["info"].text = infotext
pbFadeInAndShow(@sprites)
+57 -36
View File
@@ -11,16 +11,34 @@ class PokemonJukebox_Scene
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z = 99999
@sprites = {}
@sprites["background"] = IconSprite.new(0,0,@viewport)
@sprites["background"].setBitmap("Graphics/Pictures/jukeboxbg")
if isDarkMode
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg_dark")
else
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg")
end
@sprites["ui"] = IconSprite.new(0,0,@viewport)
@sprites["ui"].setBitmap("Graphics/Pictures/jukeboxbg")
@sprites["header"] = Window_UnformattedTextPokemon.newWithSize(
_INTL("Jukebox"),2,-18,128,64,@viewport)
@sprites["header"].baseColor = Color.new(248,248,248)
@sprites["header"].shadowColor = Color.new(0,0,0)
if isDarkMode
@sprites["header"].baseColor = pbColor(:LIGHT_TEXT_MAIN_COLOR)
@sprites["header"].shadowColor = pbColor(:LIGHT_TEXT_SHADOW_COLOR)
else
@sprites["header"].baseColor = pbColor(:DARK_TEXT_MAIN_COLOR)
@sprites["header"].shadowColor = pbColor(:DARK_TEXT_SHADOW_COLOR)
end
@sprites["header"].windowskin = nil
@sprites["commands"] = Window_CommandPokemon.newWithSize(@commands,
94,92,324,224,@viewport)
@sprites["commands"].windowskin = nil
@sprites["commands"].baseColor = pbColor(:DARK_TEXT_MAIN_COLOR)
@sprites["commands"].shadowColor = pbColor(:DARK_TEXT_SHADOW_COLOR)
pbFadeInAndShow(@sprites) { pbUpdate }
end
@@ -66,10 +84,7 @@ class PokemonJukeboxScreen
cmdLullaby = -1
cmdOak = -1
cmdCustom = -1
commands[cmdMarch = commands.length] = _INTL("March")
commands[cmdLullaby = commands.length] = _INTL("Lullaby")
commands[cmdOak = commands.length] = _INTL("Oak")
commands[cmdCustom = commands.length] = _INTL("Custom")
commands[cmdCustom = commands.length] = _INTL("Play Music")
commands[commands.length] = _INTL("Exit")
@scene.pbStartScene(commands)
loop do
@@ -77,36 +92,9 @@ class PokemonJukeboxScreen
if cmd<0
pbPlayCloseMenuSE
break
elsif cmdMarch>=0 && cmd==cmdMarch
pbPlayDecisionSE
pbBGMPlay("Radio - March", 100, 100)
$PokemonMap.whiteFluteUsed = true if $PokemonMap
$PokemonMap.blackFluteUsed = false if $PokemonMap
elsif cmdLullaby>=0 && cmd==cmdLullaby
pbPlayDecisionSE
pbBGMPlay("Radio - Lullaby", 100, 100)
$PokemonMap.blackFluteUsed = true if $PokemonMap
$PokemonMap.whiteFluteUsed = false if $PokemonMap
elsif cmdOak>=0 && cmd==cmdOak
pbPlayDecisionSE
pbBGMPlay("Radio - Oak", 100, 100)
$PokemonMap.whiteFluteUsed = false if $PokemonMap
$PokemonMap.blackFluteUsed = false if $PokemonMap
elsif cmdCustom>=0 && cmd==cmdCustom
pbPlayDecisionSE
files = [_INTL("(Default)")]
Dir.chdir("Audio/BGM/") {
Dir.glob("*.mp3") { |f| files.push(f) }
Dir.glob("*.MP3") { |f| files.push(f) }
Dir.glob("*.ogg") { |f| files.push(f) }
Dir.glob("*.OGG") { |f| files.push(f) }
Dir.glob("*.wav") { |f| files.push(f) }
Dir.glob("*.WAV") { |f| files.push(f) }
Dir.glob("*.mid") { |f| files.push(f) }
Dir.glob("*.MID") { |f| files.push(f) }
Dir.glob("*.midi") { |f| files.push(f) }
Dir.glob("*.MIDI") { |f| files.push(f) }
}
files = getMusicList
@scene.pbSetCommands(files,0)
loop do
cmd2 = @scene.pbScene
@@ -115,12 +103,16 @@ class PokemonJukeboxScreen
break
elsif cmd2==0
pbPlayDecisionSE
pbBGMPlay($game_map.bgm)
$game_system.setDefaultBGM(nil)
$PokemonMap.whiteFluteUsed = false if $PokemonMap
$PokemonMap.blackFluteUsed = false if $PokemonMap
else
pbPlayDecisionSE
$game_system.setDefaultBGM(files[cmd2])
$game_system.bgm_stop
bgm_name = files[cmd2]
pbBGMPlay(bgm_name)
$game_system.setDefaultBGM(bgm_name)
$PokemonMap.whiteFluteUsed = false if $PokemonMap
$PokemonMap.blackFluteUsed = false if $PokemonMap
end
@@ -133,4 +125,33 @@ class PokemonJukeboxScreen
end
@scene.pbEndScene
end
def getFolderMusic
files = []
Dir.chdir("Audio/BGM/") {
Dir.glob("*.mp3") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.MP3") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.ogg") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.OGG") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.wav") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.WAV") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.mid") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.MID") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.midi") { |f| files.push(File.basename(f, ".*")) }
Dir.glob("*.MIDI") { |f| files.push(File.basename(f, ".*")) }
}
return files
end
def getMusicList
folder_music = getFolderMusic
encountered_music_list = $PokemonSystem.encountered_music
available_music = [_INTL("(Default)")]
encountered_music_list.each do |track|
available_music << track if folder_music.include?(track)
end
return available_music
end
end
+35 -17
View File
@@ -6,6 +6,7 @@ class PokemonTrainerCard_Scene
pbUpdateSpriteHash(@sprites)
end
TOTAL_PAGES = 2
def pbStartScene
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@@ -25,6 +26,7 @@ class PokemonTrainerCard_Scene
@sprites["trainer"].x -= (@sprites["trainer"].bitmap.width - 128) / 2
@sprites["trainer"].y -= (@sprites["trainer"].bitmap.height - 128)
@sprites["trainer"].z = 2
@page = 0
pbDrawTrainerCardFront
pbFadeInAndShow(@sprites) { pbUpdate }
end
@@ -40,14 +42,14 @@ class PokemonTrainerCard_Scene
else
@sprites["card"].setBitmap("Graphics/Pictures/Trainer Card/card")
end
@sprites["card"].z=-100
@sprites["card"].z = -100
end
def trainerCardActions
cmd_swapBackground = _INTL("Swap background")
cmd_copyTrainerID = _INTL("Copy Trainer ID")
cmd_cancel = _INTL("Cancel")
commands = [cmd_swapBackground, cmd_copyTrainerID,cmd_cancel]
commands = [cmd_swapBackground, cmd_copyTrainerID, cmd_cancel]
choice = optionsMenu(commands)
case commands[choice]
when cmd_swapBackground
@@ -71,7 +73,7 @@ class PokemonTrainerCard_Scene
end
end
else
pbMessage("You can purchase new Trainer Card backgrounds at PokéMarts!")
pbMessage(_INTL("You can purchase new Trainer Card backgrounds at Poké Marts!"))
end
end
@@ -86,21 +88,31 @@ class PokemonTrainerCard_Scene
time = (hour > 0) ? _INTL("{1}h {2}m", hour, min) : _INTL("{1}m", min)
$PokemonGlobal.startTime = pbGetTimeNow if !$PokemonGlobal.startTime
starttime = "#{pbGetAbbrevMonthName($PokemonGlobal.startTime.mon)} #{$PokemonGlobal.startTime.day}, #{$PokemonGlobal.startTime.year}"
textPositions = [
[_INTL("Name"), 34, 58, 0, baseColor, shadowColor],
[$Trainer.name, 302, 58, 1, baseColor, shadowColor],
[_INTL("Trainer ID"), 352, 28, 0, baseColor, shadowColor], # [_INTL("ID"), 332, 58, 0, baseColor, shadowColor],
[sprintf("%05d", $Trainer.id), 462, 58, 1, baseColor, shadowColor], # [sprintf("%05d", $Trainer.id), 468, 58, 1, baseColor, shadowColor],
textPositions = []
textPositions << [_INTL("Name"), 34, 58, 0, baseColor, shadowColor]
textPositions << [$Trainer.name, 302, 58, 1, baseColor, shadowColor]
textPositions << [_INTL("Trainer ID"), 352, 28, 0, baseColor, shadowColor] # [_INTL("ID"), 332, 58, 0, baseColor, shadowColor],
textPositions << [sprintf("%05d", $Trainer.id), 462, 58, 1, baseColor, shadowColor] # [sprintf("%05d", $Trainer.id), 468, 58, 1, baseColor, shadowColor],
if @page == 0
textPositions << [_INTL("Money"), 34, 106, 0, baseColor, shadowColor]
textPositions << [_INTL("${1}", $Trainer.money.to_s_formatted), 302, 106, 1, baseColor, shadowColor]
textPositions << [_INTL("Pokédex"), 34, 154, 0, baseColor, shadowColor]
textPositions << [sprintf("%d/%d", $Trainer.pokedex.owned_count, $Trainer.pokedex.seen_count), 302, 154, 1, baseColor, shadowColor]
elsif @page == 1
$Trainer.cosmetics_money = 0 unless $Trainer.cosmetics_money
textPositions << [_INTL("Glimmer Coins"), 34, 106, 0, baseColor, shadowColor]
textPositions << [_INTL("{1}", $Trainer.cosmetics_money.to_s_formatted), 302, 106, 1, baseColor, shadowColor]
textPositions << [_INTL("Clothes / Hats"), 34, 154, 0, baseColor, shadowColor]
textPositions << [sprintf("%d/%d", $Trainer.unlocked_clothes.length, $Trainer.unlocked_hats.length), 302, 154, 1, baseColor, shadowColor]
end
textPositions << [_INTL("Time"), 34, 202, 0, baseColor, shadowColor]
textPositions << [time, 302, 202, 1, baseColor, shadowColor]
textPositions << [_INTL("Started"), 34, 250, 0, baseColor, shadowColor]
textPositions << [starttime, 302, 250, 1, baseColor, shadowColor]
[_INTL("Money"), 34, 106, 0, baseColor, shadowColor],
[_INTL("${1}", $Trainer.money.to_s_formatted), 302, 106, 1, baseColor, shadowColor],
[_INTL("Pokédex"), 34, 154, 0, baseColor, shadowColor],
[sprintf("%d/%d", $Trainer.pokedex.owned_count, $Trainer.pokedex.seen_count), 302, 154, 1, baseColor, shadowColor],
[_INTL("Time"), 34, 202, 0, baseColor, shadowColor],
[time, 302, 202, 1, baseColor, shadowColor],
[_INTL("Started"), 34, 250, 0, baseColor, shadowColor],
[starttime, 302, 250, 1, baseColor, shadowColor]
]
pbDrawTextPositions(overlay, textPositions)
x = 72
imagePositions = []
@@ -141,8 +153,14 @@ class PokemonTrainerCard_Scene
Graphics.update
Input.update
pbUpdate
if Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT) && Settings::HOENN
pbSEPlay("GUI party switch")
@page = (@page + 1) % TOTAL_PAGES
pbDrawTrainerCardFront
end
if Input.trigger?(Input::USE)
trainerCardActions()
pbDrawTrainerCardFront
end
if Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
+48 -40
View File
@@ -133,35 +133,42 @@ class PokemonLoad_Scene
addBackgroundOrColoredPlane(@sprites,"background","loadbg",Color.new(248,248,248),@viewport)
end
def pbSelectPanel(oldi, newi)
return if oldi == newi
@sprites["panel#{oldi}"].selected = false if @sprites["panel#{oldi}"]
@sprites["panel#{oldi}"].pbRefresh if @sprites["panel#{oldi}"]
@sprites["panel#{newi}"].selected = true if @sprites["panel#{newi}"]
@sprites["panel#{newi}"].pbRefresh if @sprites["panel#{newi}"]
while @sprites["panel#{newi}"].y > Graphics.height - 40*2
for i in 0...@commands.length
@sprites["panel#{i}"].y -= 24*2
end
for i in 0...6
break if !@sprites["party#{i}"]
@sprites["party#{i}"].y -= 24*2
end
@sprites["player"].y -= 24*2 if @sprites["player"]
end
while @sprites["panel#{newi}"].y < 16*2
for i in 0...@commands.length
@sprites["panel#{i}"].y += 24*2
end
for i in 0...6
break if !@sprites["party#{i}"]
@sprites["party#{i}"].y += 24*2
end
@sprites["player"].y += 24*2 if @sprites["player"]
end
end
def pbUpdate
oldi = @sprites["cmdwindow"].index rescue 0
pbUpdateSpriteHash(@sprites)
newi = @sprites["cmdwindow"].index rescue 0
if oldi!=newi
@sprites["panel#{oldi}"].selected = false
@sprites["panel#{oldi}"].pbRefresh
@sprites["panel#{newi}"].selected = true
@sprites["panel#{newi}"].pbRefresh
while @sprites["panel#{newi}"].y>Graphics.height-40*2
for i in 0...@commands.length
@sprites["panel#{i}"].y -= 24*2
end
for i in 0...6
break if !@sprites["party#{i}"]
@sprites["party#{i}"].y -= 24*2
end
@sprites["player"].y -= 24*2 if @sprites["player"]
end
while @sprites["panel#{newi}"].y<16*2
for i in 0...@commands.length
@sprites["panel#{i}"].y += 24*2
end
for i in 0...6
break if !@sprites["party#{i}"]
@sprites["party#{i}"].y += 24*2
end
@sprites["player"].y += 24*2 if @sprites["player"]
end
pbSelectPanel(oldi, newi)
if @sprites["langicon"] && @sprites["panel0"]
@sprites["langicon"].visible = (@sprites["panel0"].y == 16 * 2)
end
end
@@ -229,7 +236,7 @@ class PokemonLoadScreen
save_data = SaveData.read_from_file(file_path)
unless SaveData.valid?(save_data)
if File.file?(file_path + '.bak')
pbMessage(_INTL('The save file is corrupt. A backup will be loaded.'))
pbMessage(_INTL("The save file is corrupt. A backup will be loaded."))
save_data = load_save_file(file_path + '.bak')
else
self.prompt_save_deletion
@@ -242,9 +249,9 @@ class PokemonLoadScreen
# Called if all save data is invalid.
# Prompts the player to delete the save files.
def prompt_save_deletion
pbMessage(_INTL('The save file is corrupt, or is incompatible with this game.'))
pbMessage(_INTL("The save file is corrupt, or is incompatible with this game."))
exit unless pbConfirmMessageSerious(
_INTL('Do you want to delete the save file and start anew?')
_INTL("Do you want to delete the save file and start anew?")
)
self.delete_save_data
$game_system = Game_System.new
@@ -272,9 +279,9 @@ class PokemonLoadScreen
def delete_save_data
begin
SaveData.delete_file
pbMessage(_INTL('The saved data was deleted.'))
pbMessage(_INTL("The saved data was deleted."))
rescue SystemCallError
pbMessage(_INTL('All saved data could not be deleted.'))
pbMessage(_INTL("All saved data could not be deleted."))
end
end
@@ -295,6 +302,7 @@ class PokemonLoadScreen
def pbStartLoadScreen
copyKeybindings()
commands = []
cmd_continue = -1
cmd_new_game = -1
@@ -306,19 +314,19 @@ class PokemonLoadScreen
show_continue = !@save_data.empty?
new_game_plus = show_continue && (@save_data[:player].new_game_plus_unlocked || $DEBUG)
if show_continue
commands[cmd_continue = commands.length] = _INTL('Continue')
commands[cmd_continue = commands.length] = _INTL("Continue")
if @save_data[:player].mystery_gift_unlocked
commands[cmd_mystery_gift = commands.length] = _INTL('Mystery Gift')
commands[cmd_mystery_gift = commands.length] = _INTL("Mystery Gift")
end
end
commands[cmd_new_game = commands.length] = _INTL('New Game')
commands[cmd_new_game = commands.length] = _INTL("New Game")
if new_game_plus
commands[cmd_new_game_plus = commands.length] = _INTL('New Game +')
commands[cmd_new_game_plus = commands.length] = _INTL("New Game +")
end
commands[cmd_options = commands.length] = _INTL('Options')
commands[cmd_language = commands.length] = _INTL('Language') if Settings::LANGUAGES.length >= 2
commands[cmd_debug = commands.length] = _INTL('Debug') if $DEBUG
commands[cmd_quit = commands.length] = _INTL('Quit Game')
commands[cmd_options = commands.length] = _INTL("System Options")
commands[cmd_language = commands.length] = _INTL("Language") if Settings::LANGUAGES[Settings::GAME_ID].length >= 2
#commands[cmd_debug = commands.length] = _INTL("Debug") if $DEBUG
commands[cmd_quit = commands.length] = _INTL("Quit Game")
map_id = show_continue ? @save_data[:map_factory].map.map_id : 0
@scene.pbStartScene(commands, show_continue, @save_data[:player],
@save_data[:frame_count] || 0, map_id)
@@ -347,14 +355,14 @@ class PokemonLoadScreen
pbFadeOutIn { pbDownloadMysteryGift(@save_data[:player]) }
when cmd_options
pbFadeOutIn do
scene = PokemonGameOption_Scene.new
scene = SystemOptionsScene.new
screen = PokemonOptionScreen.new(scene)
screen.pbStartScreen(true)
end
when cmd_language
@scene.pbEndScene
$PokemonSystem.language = pbChooseLanguage
pbLoadMessages('Data/' + Settings::LANGUAGES[$PokemonSystem.language][1])
pbLoadMessages('Data/' + Settings::LANGUAGES[Settings::GAME_ID][$PokemonSystem.language][1])
if show_continue
@save_data[:pokemon_system] = $PokemonSystem
File.open(SaveData::FILE_PATH, 'wb') { |file| Marshal.dump(@save_data, file) }
+4 -4
View File
@@ -89,13 +89,13 @@ class PokemonSaveScreen
def pbSaveScreen
ret = false
@scene.pbStartScreen
if pbConfirmMessage(_INTL('Would you like to save the game?'))
if pbConfirmMessage(_INTL("Would you like to save the game?"))
if SaveData.exists? && $PokemonTemp.begunNewGame
pbMessage(_INTL('WARNING!'))
pbMessage(_INTL('There is a different game file that is already saved.'))
pbMessage(_INTL("WARNING!"))
pbMessage(_INTL("There is a different game file that is already saved."))
pbMessage(_INTL("If you save now, the other file's adventure, including items and Pokémon, will be entirely lost."))
if !pbConfirmMessageSerious(
_INTL('Are you sure you want to save now and overwrite the other save file?'))
_INTL("Are you sure you want to save now and overwrite the other save file?"))
pbSEPlay('GUI save choice')
@scene.pbEndScreen
return false
+110 -29
View File
@@ -4,6 +4,7 @@
class PokemonSystem
attr_accessor :textspeed
attr_accessor :battlescene
attr_accessor :nobattlemovement
attr_accessor :battlestyle
attr_accessor :frame
attr_accessor :textskin
@@ -13,18 +14,29 @@ class PokemonSystem
attr_accessor :bgmvolume
attr_accessor :sevolume
attr_accessor :textinput
attr_accessor :quicksurf
attr_accessor :quickHM
attr_accessor :level_caps
attr_accessor :battle_type
attr_accessor :download_sprites
attr_accessor :speedup
attr_accessor :speedup_speed
attr_accessor :speedup_speed_battles
attr_accessor :max_nb_sprites_download
attr_accessor :on_mobile
attr_accessor :type_icons
attr_accessor :use_generated_dex_entries
attr_accessor :hide_custom_eggs
attr_accessor :include_alt_sprites_in_random
attr_accessor :overworld_encounters
attr_accessor :encountered_music
attr_accessor :random_sprites
attr_accessor :prompt_nicknames
attr_accessor :no_reviving
attr_accessor :no_healing_items_battles
attr_accessor :no_healing_items_ow
attr_accessor :no_pokemon_center
attr_accessor :obtained_transfer_box
def initialize
@textspeed = 1 # Text speed (0=slow, 1=normal, 2=fast)
@@ -38,10 +50,11 @@ class PokemonSystem
@bgmvolume = 40 # Volume of background music and ME
@sevolume = 40 # Volume of sound effects
@textinput = 1 # Text input mode (0=cursor, 1=keyboard)
@quicksurf = 0
@quickHM = 0
@battle_type = 0
@speedup = 0 #0= hold, 1=toggle
@speedup_speed = 3 #for hold only
@speedup = 0 # 0= hold, 1=toggle
@speedup_speed = 3 # for hold only
@speedup_speed_battles = 3 # for hold only
@download_sprites = 0
@max_nb_sprites_download = 5
@on_mobile = false
@@ -49,6 +62,12 @@ class PokemonSystem
@use_generated_dex_entries = true
@hide_custom_eggs = true
@include_alt_sprites_in_random = false
@no_reviving = false
@no_healing_items_battles = false
@no_pokemon_center = false
@random_sprites = true
@prompt_nicknames = true
end
end
@@ -139,7 +158,7 @@ class NumberOption < Option
attr_reader :optstart
attr_reader :optend
def initialize(name, optstart, optend, getProc, setProc, description="")
def initialize(name, optstart, optend, getProc, setProc, description = "")
super(description)
@name = name
@optstart = optstart
@@ -197,6 +216,30 @@ class SliderOption < Option
end
end
class ButtonOption < Option
attr_reader :name
def initialize(name, onPressProc, description = "")
super(description)
@name = name
@onPressProc = onPressProc
end
# Button options don't have values
def get
0;
end
def set(_value)
;
end
# When the player presses confirm
def trigger
@onPressProc.call if @onPressProc
end
end
#===============================================================================
# Main options list
#===============================================================================
@@ -265,10 +308,30 @@ class Window_PokemonOption < Window_DrawableCommand
def drawItem(index, _count, rect)
return if dont_draw_item(index)
rect = drawCursor(index, rect)
optionname = (index == @options.length) ? _INTL("Confirm") : @options[index].name
optionwidth = rect.width * 9 / 20
optionname = (index == @options.length) ? _INTL("Confirm") : @options[index].name
if index == @options.length
base_color = Color.new(
[@nameBaseColor.red + 80, 255].min,
[@nameBaseColor.green + 80, 255].min,
[@nameBaseColor.blue + 80, 255].min
)
shadow_color = Color.new(
[base_color.red - 60, 0].max,
[base_color.green - 60, 0].max,
[base_color.blue - 60, 0].max
)
else
base_color = @nameBaseColor
shadow_color = @nameShadowColor
end
pbDrawShadowText(self.contents, rect.x, rect.y, optionwidth, rect.height, optionname,
@nameBaseColor, @nameShadowColor)
base_color, shadow_color)
return if index == @options.length
if @options[index].is_a?(EnumOption)
if @options[index].values.length > 1
@@ -313,6 +376,8 @@ class Window_PokemonOption < Window_DrawableCommand
xpos += optionwidth - self.contents.text_size(value).width
pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value,
@selBaseColor, @selShadowColor)
elsif @options[index].is_a?(ButtonOption)
return
else
value = @options[index].values[self[index]]
xpos = optionwidth + rect.x
@@ -337,22 +402,33 @@ class Window_PokemonOption < Window_DrawableCommand
end
if self.active && self.index < @options.length
if Input.repeat?(Input::LEFT)
self[self.index] = @options[self.index].prev(self[self.index])
@selected_position = self[self.index]
@mustUpdateOptions = true
@mustUpdateDescription = true
refresh if self[self.index]
return
end
if Input.repeat?(Input::RIGHT)
self[self.index] = @options[self.index].next(self[self.index])
@selected_position = self[self.index]
@mustUpdateOptions = true
@mustUpdateDescription = true
refresh
return
if @options[self.index].is_a?(ButtonOption) #submenus
if Input.trigger?(Input::USE) || Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)
@options[self.index].trigger
@mustUpdateDescription = true
refresh
return
end
else
if Input.repeat?(Input::LEFT)
self[self.index] = @options[self.index].prev(self[self.index])
@selected_position = self[self.index]
@mustUpdateOptions = true
@mustUpdateDescription = true
refresh if self[self.index]
return
end
if Input.repeat?(Input::RIGHT)
self[self.index] = @options[self.index].next(self[self.index])
@selected_position = self[self.index]
@mustUpdateOptions = true
@mustUpdateDescription = true
refresh
return
end
end
if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
@selected_position = self[self.index]
@mustUpdateOptions = true
@@ -370,7 +446,8 @@ end
#===============================================================================
class PokemonOption_Scene
def getDefaultDescription
return _INTL("Speech frame {1}.", 1 + $PokemonSystem.textskin)
#return _INTL("Speech frame {1}.", 1 + $PokemonSystem.textskin)
return _INTL("Save changes and close the menu.")
end
def pbUpdate
@@ -383,7 +460,8 @@ class PokemonOption_Scene
def initialize
@autosave_menu = false
@manually_changed_difficulty=false
@challenge_menu = false
@manually_changed_difficulty = false
end
def initUIElements
@@ -416,9 +494,11 @@ class PokemonOption_Scene
end
def initOptionsWindow
width = Graphics.width
height = (Graphics.height - @sprites["title"].height - @sprites["textbox"].height) +32
optionsWindow = Window_PokemonOption.new(@PokemonOptions, 0,
@sprites["title"].height, Graphics.width,
Graphics.height - @sprites["title"].height - @sprites["textbox"].height)
@sprites["title"].height,
width, height)
optionsWindow.viewport = @viewport
optionsWindow.visible = true
return optionsWindow
@@ -446,7 +526,7 @@ class PokemonOption_Scene
end
end
#IMPLEMENT IN INHERITED CLASSES
# IMPLEMENT IN INHERITED CLASSES
def pbGetOptions(inloadscreen = false)
options = []
return options
@@ -457,7 +537,7 @@ class PokemonOption_Scene
end
def openAutosaveMenu()
return if !@autosave_menu
return unless @autosave_menu
pbFadeOutIn {
scene = AutosaveOptionsScene.new
screen = PokemonOptionScreen.new(scene)
@@ -466,6 +546,7 @@ class PokemonOption_Scene
@autosave_menu = false
end
def pbOptions
oldSystemSkin = $PokemonSystem.frame # Menu
oldTextSkin = $PokemonSystem.textskin # Speech
@@ -512,7 +593,7 @@ class PokemonOption_Scene
end
pbDisposeMessageWindow(@sprites["textbox"])
pbDisposeSpriteHash(@sprites)
pbRefreshSceneMap
#pbRefreshSceneMap
@viewport.dispose
end
end
+68 -65
View File
@@ -13,11 +13,11 @@ class ReadyMenuButton < SpriteWrapper
@selected = selected
@side = side
if @command[2]
@button = AnimatedBitmap.new("Graphics/Pictures/Ready Menu/icon_movebutton")
@cursor = AnimatedBitmap.new("Graphics/Pictures/Ready Menu/icon_movebutton")
else
@button = AnimatedBitmap.new("Graphics/Pictures/Ready Menu/icon_itembutton")
@cursor = AnimatedBitmap.new("Graphics/Pictures/Ready Menu/icon_itembutton")
end
@contents = BitmapWrapper.new(@button.width,@button.height/2)
@contents = BitmapWrapper.new(@cursor.width, @cursor.height/2)
self.bitmap = @contents
pbSetSystemFont(self.bitmap)
if @command[2]
@@ -31,7 +31,7 @@ class ReadyMenuButton < SpriteWrapper
end
def dispose
@button.dispose
@cursor.dispose
@contents.dispose
@icon.dispose
super
@@ -56,19 +56,19 @@ class ReadyMenuButton < SpriteWrapper
def refresh
sel = (@selected==@index && (@side==0)==@command[2])
self.y = (Graphics.height-@button.height/2)/2 - (@selected-@index)*(@button.height/2+4)
self.y = (Graphics.height-@cursor.height/2)/2 - (@selected-@index)*(@cursor.height/2+4)
if @command[2] # Pokémon
self.x = (sel) ? 0 : -16
@icon.x = self.x+52
@icon.y = self.y+32
else # Item
self.x = (sel) ? Graphics.width-@button.width : Graphics.width+16-@button.width
self.x = (sel) ? Graphics.width-@cursor.width : Graphics.width+16-@cursor.width
@icon.x = self.x+32
@icon.y = self.y+@button.height/4
@icon.y = self.y+@cursor.height/4
end
self.bitmap.clear
rect = Rect.new(0,(sel) ? @button.height/2 : 0,@button.width,@button.height/2)
self.bitmap.blt(0,0,@button.bitmap,rect)
rect = Rect.new(0, (sel) ? @cursor.height/2 : 0, @cursor.width, @cursor.height/2)
self.bitmap.blt(0, 0, @cursor.bitmap, rect)
textx = (@command[2]) ? 164 : (GameData::Item.get(@command[0]).is_important?) ? 146 : 124
textpos = [
[@command[1],textx,16,2,Color.new(248,248,248),Color.new(40,40,40),1],
@@ -238,68 +238,70 @@ class PokemonReadyMenu
@scene.pbShowMenu
end
def pbStartReadyMenu(moves,items)
commands = [[],[]] # Moves, items
for i in moves
commands[0].push([i[0], GameData::Move.get(i[0]).name, true, i[1]])
end
commands[0].sort! { |a,b| a[1]<=>b[1] }
for i in items
commands[1].push([i, GameData::Item.get(i).name, false])
end
commands[1].sort! { |a,b| a[1]<=>b[1] }
@scene.pbStartScene(commands)
loop do
command = @scene.pbShowCommands
break if command==-1
if command[0]==0 # Use a move
move = commands[0][command[1]][0]
user = $Trainer.party[commands[0][command[1]][3]]
if move == :FLY
ret = nil
pbFadeOutInWithUpdate(99999,@scene.sprites) {
pbHideMenu
scene = PokemonRegionMap_Scene.new(-1,false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartFlyScreen
pbShowMenu if !ret
}
if ret
$PokemonTemp.flydata = ret
$game_temp.in_menu = false
pbUseHiddenMove(user,move)
break
end
else
pbHideMenu
if pbConfirmUseHiddenMove(user,move)
$game_temp.in_menu = false
pbUseHiddenMove(user,move)
break
else
pbShowMenu
end
end
else # Use an item
item = commands[1][command[1]][0]
pbHideMenu
if ItemHandlers.triggerConfirmUseInField(item)
$game_temp.in_menu = false
break if pbUseKeyItemInField(item)
$game_temp.in_menu = true
end
end
pbShowMenu
end
@scene.pbEndScene
end
#Overriden in BetterRegionMap.rb
# def pbStartReadyMenu(moves,items)
# commands = [[],[]] # Moves, items
# for i in moves
# commands[0].push([i[0], GameData::Move.get(i[0]).name, true, i[1]])
# end
# commands[0].sort! { |a,b| a[1]<=>b[1] }
# for i in items
# commands[1].push([i, GameData::Item.get(i).name, false])
# end
# commands[1].sort! { |a,b| a[1]<=>b[1] }
# @scene.pbStartScene(commands)
# loop do
# command = @scene.pbShowCommands
# break if command==-1
# if command[0]==0 # Use a move
# move = commands[0][command[1]][0]
# user = $Trainer.party[commands[0][command[1]][3]]
# if move == :FLY
# ret = nil
# pbFadeOutInWithUpdate(99999,@scene.sprites) {
# pbHideMenu
# scene = PokemonRegionMap_Scene.new(-1,false)
# screen = PokemonRegionMapScreen.new(scene)
# ret = screen.pbStartFlyScreen
# pbShowMenu if !ret
# }
# if ret
# $PokemonTemp.flydata = ret
# $game_temp.in_menu = false
# pbUseHiddenMove(user,move)
# break
# end
# else
# pbHideMenu
# if pbConfirmUseHiddenMove(user,move)
# $game_temp.in_menu = false
# pbUseHiddenMove(user,move)
# break
# else
# pbShowMenu
# end
# end
# else # Use an item
# item = commands[1][command[1]][0]
# pbHideMenu
# if ItemHandlers.triggerConfirmUseInField(item)
# $game_temp.in_menu = false
# break if pbUseKeyItemInField(item)
# $game_temp.in_menu = true
# end
# end
# pbShowMenu
# end
# @scene.pbEndScene
# end
end
#===============================================================================
# Using a registered item
#===============================================================================
def pbUseKeyItem
moves = [:CUT, :DEFOG, :DIG, :DIVE, :FLASH, :FLY, :HEADBUTT, :ROCKCLIMB,
moves = [:CUT, :DEFOG, :DIG, :DIVE, :FLASH, :FLY, :ROCKCLIMB,
:ROCKSMASH, :SECRETPOWER, :STRENGTH, :SURF, :SWEETSCENT, :TELEPORT,
:WATERFALL, :WHIRLPOOL, :BOUNCE, :SUNNYDAY, :RAINDANCE, :WHIRLWIND]
real_moves = []
@@ -314,6 +316,7 @@ def pbUseKeyItem
itm = GameData::Item.get(i).id
real_items.push(itm) if $PokemonBag.pbHasItem?(itm)
end
real_items << GameData::Item.get(:POKENAV) if $Trainer.has_pokegear
if real_items.length == 0 && real_moves.length == 0
pbMessage(_INTL("An item in the Bag can be registered to this key for instant use."))
else
+18 -11
View File
@@ -53,16 +53,23 @@ end
#
#===============================================================================
class ItemStorage_Scene
ITEMLISTBASECOLOR = Color.new(88,88,80)
ITEMLISTSHADOWCOLOR = Color.new(168,184,184)
ITEMTEXTBASECOLOR = Color.new(248,248,248)
ITEMTEXTSHADOWCOLOR = Color.new(0,0,0)
TITLEBASECOLOR = Color.new(248,248,248)
TITLESHADOWCOLOR = Color.new(0,0,0)
ITEMSVISIBLE = 7
def initialize(title)
@title = title
@item_list_base_color = Color.new(88,88,80)
@item_list_shadow_color = Color.new(168,184,184)
@item_text_base_color = Color.new(248,248,248)
@item_text_shadow_color = Color.new(0,0,0)
@title_base_color = Color.new(248,248,248)
@title_shadow_color = Color.new(0,0,0)
if isDarkMode
@item_list_base_color, @item_list_shadow_color = @item_list_shadow_color, @item_list_base_color
end
end
def update
@@ -81,8 +88,8 @@ class ItemStorage_Scene
@sprites["itemwindow"] = Window_PokemonItemStorage.new(@bag,98,14,334,32+ITEMSVISIBLE*32)
@sprites["itemwindow"].viewport = @viewport
@sprites["itemwindow"].index = 0
@sprites["itemwindow"].baseColor = ITEMLISTBASECOLOR
@sprites["itemwindow"].shadowColor = ITEMLISTSHADOWCOLOR
@sprites["itemwindow"].baseColor = @item_list_base_color
@sprites["itemwindow"].shadowColor = @item_list_shadow_color
@sprites["itemwindow"].refresh
# Title
@sprites["pocketwindow"] = BitmapSprite.new(88,64,@viewport)
@@ -91,8 +98,8 @@ class ItemStorage_Scene
pbSetNarrowFont(@sprites["pocketwindow"].bitmap)
# Item description
@sprites["itemtextwindow"] = Window_UnformattedTextPokemon.newWithSize("",84,270,Graphics.width-84,128,@viewport)
@sprites["itemtextwindow"].baseColor = ITEMTEXTBASECOLOR
@sprites["itemtextwindow"].shadowColor = ITEMTEXTSHADOWCOLOR
@sprites["itemtextwindow"].baseColor = @item_text_base_color
@sprites["itemtextwindow"].shadowColor = @item_text_shadow_color
@sprites["itemtextwindow"].windowskin = nil
@sprites["helpwindow"] = Window_UnformattedTextPokemon.new("")
@sprites["helpwindow"].visible = false
@@ -132,7 +139,7 @@ class ItemStorage_Scene
def pbRefresh
bm = @sprites["pocketwindow"].bitmap
# Draw title at upper left corner ("Toss Item/Withdraw Item")
drawTextEx(bm,0,4,bm.width,2,@title,TITLEBASECOLOR,TITLESHADOWCOLOR)
drawTextEx(bm,0,4,bm.width,2,@title, @title_base_color, @title_shadow_color)
itemwindow = @sprites["itemwindow"]
# Draw item icon
@sprites["icon"].item = itemwindow.item
+1 -1
View File
@@ -25,7 +25,7 @@ class StorageSystemPC
end
def name
return "Pokemon Storage"
return _INTL("Pokemon Storage")
#if $Trainer.seen_storage_creator
# return "{1}'s PC",pbGetStorageCreator
#else
+98 -73
View File
@@ -88,7 +88,7 @@ class PokemonMartAdapter
return nil
end
#specialType is a symbol
# specialType is a symbol
def getSpecialItemCaption(specialType)
return nil
end
@@ -97,7 +97,7 @@ class PokemonMartAdapter
return nil
end
def doSpecialItemAction(specialType,itemId=nil)
def doSpecialItemAction(specialType, itemId = nil)
return nil
end
@@ -109,7 +109,6 @@ class PokemonMartAdapter
return nil
end
end
#===============================================================================
@@ -202,6 +201,10 @@ class Window_PokemonMart < Window_DrawableCommand
@selarrow = AnimatedBitmap.new("Graphics/Pictures/martSel")
@baseColor = Color.new(88, 88, 80)
@shadowColor = Color.new(168, 184, 184)
if isDarkMode
@baseColor, @shadowColor = @shadowColor, @baseColor
end
self.windowskin = nil
end
@@ -223,8 +226,8 @@ class Window_PokemonMart < Window_DrawableCommand
item = @stock[index]
if item.is_a?(Symbol) && @adapter.getAdapter().is_a?(OutfitsMartAdapter)
itemname = @adapter.getSpecialItemCaption(item)
baseColor = @adapter.getSpecialItemBaseColor(item) ? @adapter.getSpecialItemBaseColor(item) : baseColor
shadowColor = @adapter.getSpecialItemShadowColor(item) ? @adapter.getSpecialItemShadowColor(item) : shadowColor
baseColor = @adapter.getSpecialItemBaseColor(item) || self.baseColor
shadowColor = @adapter.getSpecialItemShadowColor(item) || self.shadowColor
textpos.push([itemname, rect.x, ypos - 4, false, baseColor, shadowColor])
else
itemname = @adapter.getDisplayName(item)
@@ -249,7 +252,7 @@ end
#
#===============================================================================
class PokemonMart_Scene
def initialize(currency_name = "Money")
def initialize(currency_name = _INTL("Money"))
@currency_name = currency_name
end
@@ -298,6 +301,7 @@ class PokemonMart_Scene
@sprites["itemwindow"].refresh
@sprites["itemtextwindow"] = Window_UnformattedTextPokemon.newWithSize("",
64, Graphics.height - 96 - 16, Graphics.width - 64, 128, @viewport)
pbPrepareWindow(@sprites["itemtextwindow"])
@sprites["itemtextwindow"].baseColor = Color.new(248, 248, 248)
@sprites["itemtextwindow"].shadowColor = Color.new(0, 0, 0)
@@ -504,64 +508,64 @@ class PokemonMart_Scene
itemprice /= 2 if !@buying
pbDisplay(helptext, true)
using(numwindow = Window_AdvancedTextPokemon.new("")) { # Showing number of items
qty = @adapter.getQuantity(item)
using(inbagwindow = Window_AdvancedTextPokemon.new("")) { # Showing quantity in bag
pbPrepareWindow(numwindow)
pbPrepareWindow(inbagwindow)
numwindow.viewport = @viewport
numwindow.width = 224
numwindow.height = 64
numwindow.baseColor = Color.new(88, 88, 80)
numwindow.shadowColor = Color.new(168, 184, 184)
inbagwindow.visible = @buying
inbagwindow.viewport = @viewport
inbagwindow.width = 190
inbagwindow.height = 64
inbagwindow.baseColor = Color.new(88, 88, 80)
inbagwindow.shadowColor = Color.new(168, 184, 184)
inbagwindow.text = _INTL("In Bag:<r>{1} ", qty)
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
pbBottomRight(numwindow)
numwindow.y -= helpwindow.height
pbBottomLeft(inbagwindow)
inbagwindow.y -= helpwindow.height
loop do
Graphics.update
Input.update
numwindow.update
inbagwindow.update
self.update
if Input.repeat?(Input::LEFT)
pbPlayCursorSE
curnumber -= 10
curnumber = 1 if curnumber < 1
qty = @adapter.getQuantity(item)
using(inbagwindow = Window_AdvancedTextPokemon.new("")) { # Showing quantity in bag
pbPrepareWindow(numwindow)
pbPrepareWindow(inbagwindow)
numwindow.viewport = @viewport
numwindow.width = 224
numwindow.height = 64
numwindow.baseColor = Color.new(88, 88, 80)
numwindow.shadowColor = Color.new(168, 184, 184)
inbagwindow.visible = @buying
inbagwindow.viewport = @viewport
inbagwindow.width = 190
inbagwindow.height = 64
inbagwindow.baseColor = Color.new(88, 88, 80)
inbagwindow.shadowColor = Color.new(168, 184, 184)
inbagwindow.text = _INTL("In Bag:<r>{1} ", qty)
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
elsif Input.repeat?(Input::RIGHT)
pbPlayCursorSE
curnumber += 10
curnumber = maximum if curnumber > maximum
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
elsif Input.repeat?(Input::UP)
pbPlayCursorSE
curnumber += 1
curnumber = 1 if curnumber > maximum
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
elsif Input.repeat?(Input::DOWN)
pbPlayCursorSE
curnumber -= 1
curnumber = maximum if curnumber < 1
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
elsif Input.trigger?(Input::USE)
pbPlayDecisionSE
ret = curnumber
break
elsif Input.trigger?(Input::BACK)
pbPlayCancelSE
ret = 0
break
end
end
}
pbBottomRight(numwindow)
numwindow.y -= helpwindow.height
pbBottomLeft(inbagwindow)
inbagwindow.y -= helpwindow.height
loop do
Graphics.update
Input.update
numwindow.update
inbagwindow.update
self.update
if Input.repeat?(Input::LEFT)
pbPlayCursorSE
curnumber -= 10
curnumber = 1 if curnumber < 1
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
elsif Input.repeat?(Input::RIGHT)
pbPlayCursorSE
curnumber += 10
curnumber = maximum if curnumber > maximum
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
elsif Input.repeat?(Input::UP)
pbPlayCursorSE
curnumber += 1
curnumber = 1 if curnumber > maximum
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
elsif Input.repeat?(Input::DOWN)
pbPlayCursorSE
curnumber -= 1
curnumber = maximum if curnumber < 1
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
elsif Input.trigger?(Input::USE)
pbPlayDecisionSE
ret = curnumber
break
elsif Input.trigger?(Input::BACK)
pbPlayCancelSE
ret = 0
break
end
end
}
}
helpwindow.visible = false
return ret
@@ -616,6 +620,10 @@ class PokemonMartScreen
@adapter = adapter
end
def set_price_overrides(value)
@price_overrides = value
end
def pbConfirm(msg)
return @scene.pbConfirm(msg)
end
@@ -685,13 +693,24 @@ class PokemonMartScreen
end
@stock.compact!
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }
extra_item = nil
if $PokemonBag
if quantity >= 10 && GameData::Item.get(item).is_poke_ball? && GameData::Item.exists?(:PREMIERBALL)
if @adapter.addItem(GameData::Item.get(:PREMIERBALL))
pbDisplayPaused(_INTL("I'll throw in a Premier Ball, too."))
if quantity >= 10
if GameData::Item.get(item).is_poke_ball?
extra_item = :PREMIERBALL
elsif item == :DNASPLICERS || item == :SUPERSPLICERS
extra_item = :DNAREVERSER
elsif item == :DNAREVERSER
extra_item = :DNASPLICERS
end
end
end
if extra_item
item_name = GameData::Item.get(extra_item).name
if @adapter.addItem(GameData::Item.get(extra_item))
pbDisplayPaused(_INTL("I'll throw in a {1}, too.", item_name))
end
end
end
end
@scene.pbEndBuyScene
@@ -736,6 +755,9 @@ class PokemonMartScreen
end
def replaceShopStockWithRandomized(stock)
unless $PokemonGlobal.randomItemsHash
pbShuffleItems
end
if $PokemonGlobal.randomItemsHash != nil
newStock = []
for item in stock
@@ -754,14 +776,15 @@ end
#===============================================================================
#
#===============================================================================
def pbPokemonMart(stock, speech = nil, cantsell = false)
def pbPokemonMart(stock, speech_welcome = nil, cantsell = false, speech_bye=nil, speech_what_else=nil)
stock = [] unless stock
stock = [] unless stock.is_a?(Array)
if $game_switches[SWITCH_RANDOM_ITEMS_GENERAL] && $game_switches[SWITCH_RANDOM_SHOP_ITEMS]
stock = replaceShopStockWithRandomized(stock)
end
for i in 0...stock.length
stock[i] = GameData::Item.get(stock[i]).id
stock[i] = nil if GameData::Item.get(stock[i]).is_important? && $PokemonBag.pbHasItem?(stock[i])
stock[i] = GameData::Item.get(stock[i])&.id
stock[i] = nil if GameData::Item.get(stock[i])&.is_important? && $PokemonBag.pbHasItem?(stock[i])
end
stock.compact!
commands = []
@@ -772,7 +795,7 @@ def pbPokemonMart(stock, speech = nil, cantsell = false)
commands[cmdSell = commands.length] = _INTL("Sell") if !cantsell
commands[cmdQuit = commands.length] = _INTL("Quit")
cmd = pbMessage(
speech ? speech : _INTL("Welcome! How may I serve you?"),
speech_welcome ? speech_welcome : _INTL("Welcome! How may I serve you?"),
commands, cmdQuit + 1)
loop do
if cmdBuy >= 0 && cmd == cmdBuy
@@ -784,10 +807,12 @@ def pbPokemonMart(stock, speech = nil, cantsell = false)
screen = PokemonMartScreen.new(scene, stock)
screen.pbSellScreen
else
pbMessage(_INTL("Please come again!"))
unless speech_bye == ""
pbMessage(speech_bye ? speech_bye : _INTL("Please come again!"))
end
break
end
cmd = pbMessage(_INTL("Is there anything else I can help you with?"),
cmd = pbMessage(speech_what_else ? speech_what_else : _INTL("Is there anything else I can help you with?"),
commands, cmdQuit + 1)
end
$game_temp.clear_mart_prices
+24 -10
View File
@@ -33,13 +33,13 @@ class MoveRelearner_Scene
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites={}
addBackgroundPlane(@sprites,"bg","reminderbg",@viewport)
addBackgroundPlane(@sprites,"bg","moveReminder/reminderbg",@viewport)
@sprites["pokeicon"]=PokemonIconSprite.new(@pokemon,@viewport)
@sprites["pokeicon"].setOffset(PictureOrigin::Center)
@sprites["pokeicon"].x=320
@sprites["pokeicon"].y=84
@sprites["background"]=IconSprite.new(0,0,@viewport)
@sprites["background"].setBitmap("Graphics/Pictures/reminderSel")
@sprites["background"].setBitmap("Graphics/Pictures/moveReminder/reminderSel")
@sprites["background"].y=78
@sprites["background"].src_rect=Rect.new(0,72,258,72)
@sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
@@ -51,10 +51,21 @@ class MoveRelearner_Scene
@sprites["msgwindow"].visible=false
@sprites["msgwindow"].viewport=@viewport
@typebitmap=AnimatedBitmap.new("Graphics/Pictures/types")
@text_color_base = Color.new(64,64,64)
@text_color_shadow = Color.new(176,176,176)
if isDarkMode
@text_color_base, @text_color_shadow = @text_color_shadow, @text_color_base
end
pbDrawMoveList
pbDeactivateWindows(@sprites)
# Fade in all sprites
pbFadeInAndShow(@sprites) { pbUpdate }
end
def pbDrawMoveList
@@ -75,7 +86,7 @@ class MoveRelearner_Scene
text = @pokemon ? "Teach which move?" : "Moves list"
textpos=[
[_INTL(text),16,2,0,Color.new(88,88,80),Color.new(168,184,184)]
[_INTL(text),16,2,0,Color.new(168, 184, 184),Color.new(88, 88, 80)]
]
imagepos=[]
yPos=76
@@ -89,15 +100,15 @@ class MoveRelearner_Scene
if moveData.total_pp>0
textpos.push([_INTL("PP"),112,yPos+32,0,Color.new(64,64,64),Color.new(176,176,176)])
textpos.push([_INTL("{1}/{1}",moveData.total_pp),230,yPos+32,1,
Color.new(64,64,64),Color.new(176,176,176)])
Color.new(64,64,64),Color.new(176,176,176)])
else
textpos.push(["-",80,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
textpos.push(["--",228,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
textpos.push(["-",80,yPos,0,@text_color_base,@text_color_shadow])
textpos.push(["--",228,yPos+32,1,@text_color_base,@text_color_shadow])
end
end
yPos+=64
end
imagepos.push(["Graphics/Pictures/reminderSel",
imagepos.push(["Graphics/Pictures/moveReminder/reminderSel",
0,78+(@sprites["commands"].index-@sprites["commands"].top_item)*64,
0,0,258,72])
selMoveData=GameData::Move.get(@moves[@sprites["commands"].index])
@@ -107,10 +118,10 @@ class MoveRelearner_Scene
textpos.push([_INTL("CATEGORY"),272,108,0,Color.new(248,248,248),Color.new(0,0,0)])
textpos.push([_INTL("POWER"),272,140,0,Color.new(248,248,248),Color.new(0,0,0)])
textpos.push([basedamage<=1 ? basedamage==1 ? "???" : "---" : sprintf("%d",basedamage),
468,140,2,Color.new(64,64,64),Color.new(176,176,176)])
468,140,2,@text_color_base,@text_color_shadow])
textpos.push([_INTL("ACCURACY"),272,172,0,Color.new(248,248,248),Color.new(0,0,0)])
textpos.push([accuracy==0 ? "---" : "#{accuracy}%",
468,172,2,Color.new(64,64,64),Color.new(176,176,176)])
468,172,2,@text_color_base,@text_color_shadow])
pbDrawTextPositions(overlay,textpos)
imagepos.push(["Graphics/Pictures/category",436,116,0,category*28,64,28])
if @sprites["commands"].index<@moves.length-1
@@ -121,7 +132,7 @@ class MoveRelearner_Scene
end
pbDrawImagePositions(overlay,imagepos)
drawTextEx(overlay,272,214,230,5,selMoveData.description,
Color.new(64,64,64),Color.new(176,176,176))
@text_color_base,@text_color_shadow)
end
# Processes the scene
@@ -167,6 +178,8 @@ class MoveRelearnerScreen
def pbGetRelearnableMoves(pkmn)
return [] if !pkmn || pkmn.egg? || pkmn.shadowPokemon?
moves = []
pkmn.learned_moves = [] unless pkmn.learned_moves
pkmn.getMoveList.each do |m|
next if m[0] > pkmn.level || pkmn.hasMove?(m[1])
moves.push(m[1]) if !moves.include?(m[1])
@@ -175,6 +188,7 @@ class MoveRelearnerScreen
pkmn.learned_moves.each do |move|
move_id = move.is_a?(Symbol) ? move : move.id
next if pkmn.hasMove?(move_id)
next unless pkmn.compatible_with_move?(move_id)
moves.push(move_id) if !moves.include?(move_id)
end
+5 -5
View File
@@ -503,7 +503,7 @@ class PurifyChamberScreen
@scene.pbSummary(cmd[1],heldpkmn)
elsif choice==2
if pbBoxesFull?
@scene.pbDisplay("All boxes are full.")
@scene.pbDisplay(_INTL("All boxes are full."))
elsif heldpkmn
@scene.pbWithdraw(cmd[1],heldpkmn)
$PokemonStorage.pbStoreCaught(heldpkmn)
@@ -558,9 +558,9 @@ class PurifyChamberScreen
heldpkmn=pkmn if pkmn
else # cancel
if heldpkmn
@scene.pbDisplay("You're holding a Pokémon!")
@scene.pbDisplay(_INTL("You're holding a Pokémon!"))
else
if !@scene.pbConfirm("Continue editing sets?")
if !@scene.pbConfirm(_INTL("Continue editing sets?"))
break
end
end
@@ -616,7 +616,7 @@ class PurifyChamberScreen
@chamber.setShadow(set,nil) # Remove shadow Pokemon from set
if (i+1)!=purifiables.length
@scene.pbDisplay(_INTL("There is another Pokémon that is ready to open its heart!"))
if !@scene.pbConfirm("Would you like to switch sets?")
if !@scene.pbConfirm(_INTL("Would you like to switch sets?"))
@scene.pbCloseSet()
break
end
@@ -637,7 +637,7 @@ class PurifyChamberScreen
loop do
set=@scene.pbChooseSet
if set<0
if !@scene.pbConfirm("Continue viewing holograms?")
if !@scene.pbConfirm(_INTL("Continue viewing holograms?"))
break
end
else
+194 -19
View File
@@ -2,13 +2,6 @@
# Mystery Gift system
# By Maruno
#===============================================================================
# This url is the location of an example Mystery Gift file.
# You should change it to your file's url once you upload it.
#===============================================================================
module MysteryGift
URL = "https://pastebin.com/raw/w6BqqUsm"
end
#===============================================================================
# Creating a new Mystery Gift for the Master file, and editing an existing one.
#===============================================================================
@@ -121,6 +114,7 @@ end
# Debug option for managing gifts in the Master file and exporting them to a
# file to be uploaded.
#===============================================================================
def pbManageMysteryGifts
if !safeExists?("MysteryGiftMaster.txt")
pbMessage(_INTL("There are no Mystery Gifts defined."))
@@ -162,7 +156,7 @@ def pbManageMysteryGifts
for gift in master
newfile.push(gift) if online.include?(gift[0])
end
string=pbMysteryGiftEncrypt(newfile)
string=pbMysteryGiftExportToJson(newfile)
File.open("MysteryGift.txt","wb") { |f| f.write(string) }
pbMessage(_INTL("The gifts were saved to MysteryGift.txt."))
pbMessage(_INTL("Upload MysteryGift.txt to the Internet."))
@@ -228,8 +222,12 @@ def pbRefreshMGCommands(master, online)
elsif gift[1] > 0
itemname = GameData::Item.get(gift[2]).name + sprintf(" x%d", gift[1])
end
ontext = ["[ ]", "[X]"][(online.include?(gift[0])) ? 1 : 0]
commands.push("#{ontext} #{gift[0]}: #{gift[3]} (#{itemname})")
# ontext = ["[ ]", "[X]"][(online.include?(gift[0])) ? 1 : 0]
# commands.push("#{ontext} #{gift[0]}: #{gift[3]} (#{itemname})")
#commands.push("#{gift[0]}: #{gift[3]} (#{itemname})")
commands.push("#{gift[3]} (#{itemname})")
end
commands.push(_INTL("Export selected to file"))
commands.push(_INTL("Cancel"))
@@ -247,12 +245,85 @@ def pbDownloadMysteryGift(trainer)
addBackgroundPlane(sprites,"background","mysteryGiftbg",viewport)
pbFadeInAndShow(sprites)
sprites["msgwindow"]=pbCreateMessageWindow
options = []
cmd_online = _INTL("Search for public gifts")
cmd_code = _INTL("Redeem from a code")
cmd_cancel = _INTL("Cancel")
options << cmd_online
options << cmd_code
options << cmd_cancel
choice = pbMessage(_INTL("What would you like to do?"),options)
case options[choice]
when cmd_online
downloadMysteryGifts(MysteryGift::URL,sprites, viewport, trainer)
when cmd_code
code = pbEnterText(_INTL("Enter code to redeem"),1,20)
url = MysteryGift::PRIVATE_URL + code + ".json"
downloadMysteryGifts(url,sprites, viewport, trainer)
when cmd_cancel
pbFadeOutAndHide(sprites)
pbDisposeMessageWindow(sprites["msgwindow"])
pbDisposeSpriteHash(sprites)
viewport.dispose
end
end
#From debug menu - for event organizers
#From debug menu - for event organizers
def testMysteryGift
mystery_gifts = scanLocalMysteryGifts
pending=[]
for gift in mystery_gifts
pending.push(gift)
end
if pending.length==0
pbMessage(_INTL("No testable gift was found. Make sure that your Json doesn't have any formatting errors. You can use any online json validator to make sure!"))
return
end
loop do
commands=[]
for gift in pending; commands.push(gift[3]); end
commands.push(_INTL("Cancel"))
command=pbMessage(_INTL("Choose the gift you want to receive.\\wtnp[0]"),commands,-1)
break if command==-1 || command==commands.length-1
gift=pending[command]
$Trainer.mystery_gifts.push(gift)
pbReceiveMysteryGift(gift[0])
pending[command]=nil; pending.compact!
break if pending.length==0
end
end
def scanLocalMysteryGifts
skipped_filenames = ["configuration.json", "mkxp.json"]
mystery_gifts = []
Dir.glob("*.json").each do |filename|
next if skipped_filenames.include?(filename)
begin
next if !safeExists?(filename)
string = File.open(filename, "rb") { |f| f.read } rescue nil
next if nil_or_empty?(string)
gifts = pbMysteryGiftReadFromJson(string, $Trainer) rescue []
mystery_gifts.concat(gifts) if gifts.is_a?(Array)
rescue Exception => ex
pbMessage("There was an error when parsing #{filename}. #{ex.message}")
pbMessage("The stacktrace will be copied to your clipboard.")
clipboard_content = "#{filename}\n[#{ex.class}] #{ex.message}\n\n#{ex.backtrace.join("\n")}"
Input.clipboard = clipboard_content
end
end
return mystery_gifts
end
def downloadMysteryGifts(url,sprites, viewport, trainer)
pbMessageDisplay(sprites["msgwindow"],_INTL("Searching for a gift.\nPlease wait...\\wtnp[0]"))
string = pbDownloadToString(MysteryGift::URL)
string = pbDownloadToString(url)
if nil_or_empty?(string)
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gift was found."))
else
online=pbMysteryGiftDecrypt(string)
online=pbMysteryGiftReadFromJson(string,trainer) rescue []
pending=[]
for gift in online
notgot=true
@@ -262,7 +333,7 @@ def pbDownloadMysteryGift(trainer)
pending.push(gift) if notgot
end
if pending.length==0
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gift was found."))
else
loop do
commands=[]
@@ -275,16 +346,24 @@ def pbDownloadMysteryGift(trainer)
else
gift=pending[command]
sprites["msgwindow"].visible=false
if gift[1]==0
if gift[2].is_a?(Pokemon)
sprite=PokemonSprite.new(viewport)
sprite.setOffset(PictureOrigin::Center)
sprite.setPokemonBitmap(gift[2])
sprite.x=Graphics.width/2
sprite.y=-sprite.bitmap.height/2
else
elsif gift[2].is_a?(Symbol) #Item
sprite=ItemIconSprite.new(0,0,gift[2],viewport)
sprite.x=Graphics.width/2
sprite.y=-sprite.height/2
elsif gift[2].is_a?(Hat)
sprite=IconSprite.new(0,0,viewport)
sprite.setBitmap(getTrainerSpriteHatFilename(gift[2].id))
sprite.zoom_x = 2
sprite.zoom_y = 2
sprite.x=80
elsif gift[2].is_a?(Clothes)
sprite = showOutfitPicture(gift[2].id)
end
distanceDiff = 8*20/Graphics.frame_rate
loop do
@@ -317,7 +396,7 @@ def pbDownloadMysteryGift(trainer)
sprite.dispose
end
if pending.length==0
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gift was found."))
break
end
end
@@ -337,6 +416,84 @@ def pbMysteryGiftEncrypt(gift)
return ret
end
def pbMysteryGiftExportToJson(gift_data)
json = {}
exporter = SecretBaseExporter.new
gift_data.each do |gift_array|
id = gift_array[0].to_s.to_i
quantity = gift_array[1]
gift = gift_array[2] # Pokemon or item
if gift.is_a?(Pokemon)
pokemon_hash = exporter.export_fused_pokemon_hash(gift)
elsif gift.is_a?(Symbol)
item = gift
end
name = gift_array[3]
gift_json = {}
gift_json[:quantity] = quantity if quantity
gift_json[:pokemon] = pokemon_hash if pokemon_hash
gift_json[:item] = item if item
gift_json[:name] = name
gift_json[:enabled] = true
json[id] = gift_json
end
ret = JSON.generate(json)
return ret
end
def pbMysteryGiftReadFromJson(json_string,trainer)
json_data = JSON.parse(json_string) rescue {}
mystery_gifts = []
importer = SecretBaseImporter.new
json_data.each do |key, value|
id = key.to_s
gift_data = json_data[key]
minimum_version = gift_data[:minimum_version] || nil
if minimum_version && !is_higher_version(Settings::GAME_VERSION_NUMBER, minimum_version)
next
end
trainer_id = gift_data[:trainerId] || nil
if trainer_id
next unless trainer.id == trainer_id
end
pokemon= gift_data[:pokemon]
item = gift_data[:item] || nil
hat = gift_data[:hat] || nil
clothes = gift_data[:clothes] || nil
quantity = gift_data[:quantity] || 0
name = gift_data[:name]
enabled = gift_data[:enabled]
kanto_only = gift_data[:kanto_only] || false
hoenn_only = gift_data[:hoenn_only] || false
next if kanto_only && !Settings::KANTO
next if hoenn_only && !Settings::HOENN
next unless enabled
if pokemon
gift_content = importer.import_pokemon_from_json(pokemon)
elsif item
gift_content = item.to_sym
quantity = quantity.to_i
elsif hat
gift_content = Hat.new(hat,nil,nil,nil)
elsif clothes
gift_content = Clothes.new(clothes,nil,nil,nil)
else
next
end
gift_array = [id,quantity,gift_content,name]
mystery_gifts.push(gift_array)
end
return mystery_gifts
end
def pbMysteryGiftDecrypt(gift)
return [] if nil_or_empty?(gift)
ret = Marshal.restore(Zlib::Inflate.inflate(gift.unpack("m")[0]))
@@ -355,6 +512,13 @@ end
#===============================================================================
# Collecting a Mystery Gift from the deliveryman.
#===============================================================================
def hasUnclaimedMysteryGift?
for gift in $Trainer.mystery_gifts
return true if gift.length>1
end
return false
end
def pbNextMysteryGiftID
for i in $Trainer.mystery_gifts
return i[0] if i.length>1
@@ -375,7 +539,7 @@ def pbReceiveMysteryGift(id)
return false
end
gift=$Trainer.mystery_gifts[index]
if gift[1]==0 # Pokémon
if gift[2].is_a?(Pokemon) # Pokémon
gift[2].personalID = rand(2**16) | rand(2**16) << 16
gift[2].calc_stats
time=pbGetTimeNow
@@ -391,10 +555,13 @@ def pbReceiveMysteryGift(id)
end
if pbAddPokemonSilent(gift[2])
pbMessage(_INTL("\\me[Pkmn get]{1} received {2}!",$Trainer.name,gift[2].name))
if $Trainer.party.length>=6
pbMessage(_INTL("It was transferred to the PC."))
end
$Trainer.mystery_gifts[index]=[id]
return true
end
elsif gift[1]>0 # Item
elsif gift[2].is_a?(Symbol) # Item
item=gift[2]
qty=gift[1]
if $PokemonBag.pbCanStore?(item,qty)
@@ -416,6 +583,14 @@ def pbReceiveMysteryGift(id)
$Trainer.mystery_gifts[index]=[id]
return true
end
elsif gift[2].is_a?(Hat)
obtainHat(gift[2].id)
$Trainer.mystery_gifts[index]=[id]
return true
elsif gift[2].is_a?(Clothes)
obtainClothes(gift[2].id)
$Trainer.mystery_gifts[index]=[id]
return true
end
return false
end
+41 -20
View File
@@ -5,15 +5,20 @@ class Window_CharacterEntry < Window_DrawableCommand
XSIZE=13
YSIZE=4
def initialize(charset,viewport=nil)
@viewport=viewport
@charset=charset
@othercharset=""
super(0,96,480,192)
colors=getDefaultTextColors(self.windowskin)
self.baseColor=colors[0]
self.shadowColor=colors[1]
self.columns=XSIZE
def initialize(charset, viewport=nil)
@viewport = viewport
@charset = charset
@othercharset = ""
super(0, 96, 480, 192)
colors = getDefaultTextColors(self.windowskin)
@text_color_base = colors[0]
@text_color_shadow = colors[1]
if isDarkMode
@text_color_base, @text_color_shadow = @text_color_shadow, @text_color_base
end
self.baseColor = @text_color_base
self.shadowColor = @text_color_shadow
self.columns = XSIZE
refresh
end
@@ -50,16 +55,16 @@ class Window_CharacterEntry < Window_DrawableCommand
rect=drawCursor(index,rect)
if index==@charset.length # -1
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,"[ ]",
self.baseColor,self.shadowColor)
@text_color_base,@text_color_shadow)
elsif index==@charset.length+1 # -2
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,@othercharset,
self.baseColor,self.shadowColor)
@text_color_base,@text_color_shadow)
elsif index==@charset.length+2 # -3
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,_INTL("OK"),
self.baseColor,self.shadowColor)
@text_color_base,@text_color_shadow)
else
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,@charset[index],
self.baseColor,self.shadowColor)
@text_color_base,@text_color_shadow)
end
end
end
@@ -77,6 +82,13 @@ class PokemonEntryScene
USEKEYBOARD=true
def pbStartScene(helptext,minlength,maxlength,initialText,subject=0,pokemon=nil)
@text_color_base = Color.new(16, 24, 32)
@text_color_shadow = Color.new(168, 184, 184)
if isDarkMode
@text_color_base, @text_color_shadow = @text_color_shadow, @text_color_base
end
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@@ -115,8 +127,8 @@ class PokemonEntryScene
@sprites["helpwindow"].letterbyletter=false
@sprites["helpwindow"].viewport=@viewport
@sprites["helpwindow"].visible=USEKEYBOARD
@sprites["helpwindow"].baseColor=Color.new(16,24,32)
@sprites["helpwindow"].shadowColor=Color.new(168,184,184)
@sprites["helpwindow"].baseColor=@text_color_base
@sprites["helpwindow"].shadowColor=@text_color_shadow
addBackgroundPlane(@sprites,"background","Naming/bg_2",@viewport)
case subject
when 1 # Player
@@ -374,6 +386,11 @@ class PokemonEntryScene2
def pbStartScene(helptext,minlength,maxlength,initialText,subject=0,pokemon=nil)
@text_color_base = Color.new(16, 24, 32)
@text_color_shadow = Color.new(168, 184, 184)
if isDarkMode
@text_color_base, @text_color_shadow = @text_color_shadow, @text_color_base
end
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@helptext = helptext
@@ -389,15 +406,15 @@ class PokemonEntryScene2
for x in 0...ROWS
pos = y * ROWS + x
textPos.push([@@Characters[i][0][pos], 44 + x * 32, 12 + y * 38, 2,
Color.new(16, 24, 32), Color.new(160, 160, 160)])
@text_color_base,@text_color_shadow])
end
end
pbDrawTextPositions(b, textPos)
@bitmaps[@@Characters.length + i] = b
end
underline_bitmap = BitmapWrapper.new(24, 6)
underline_bitmap.fill_rect(2, 2, 22, 4, Color.new(168, 184, 184))
underline_bitmap.fill_rect(0, 0, 22, 4, Color.new(16, 24, 32))
underline_bitmap.fill_rect(2, 2, 22, 4, @text_color_shadow)
underline_bitmap.fill_rect(0, 0, 22, 4, @text_color_base)
@bitmaps.push(underline_bitmap)
# Create sprites
@sprites = {}
@@ -491,6 +508,10 @@ class PokemonEntryScene2
@cursorpos = 0
@refreshOverlay = true
@sprites["cursor"].setCursorPos(@cursorpos)
pbFadeInAndShow(@sprites) { pbUpdate }
end
@@ -512,12 +533,12 @@ class PokemonEntryScene2
bgoverlay.clear
pbSetSystemFont(bgoverlay)
textPositions = [
[@helptext, 160, 6, false, Color.new(16, 24, 32), Color.new(168, 184, 184)]
[@helptext, 160, 6, false, @text_color_base, @text_color_shadow]
]
chars = @helper.textChars
x = 166
for ch in chars
textPositions.push([ch, x, 42, false, Color.new(16, 24, 32), Color.new(168, 184, 184)])
textPositions.push([ch, x, 42, false, @text_color_base, @text_color_shadow])
x += 24
end
pbDrawTextPositions(bgoverlay, textPositions)
@@ -0,0 +1,328 @@
#===============================================================================
#
#===============================================================================
class Game_Temp
attr_accessor :pokenav_last_index
end
class PokegearButton < SpriteWrapper
attr_reader :index
attr_reader :name
attr_reader :selected
attr_reader :held
attr_accessor :rearranging
def initialize(command,x,y,viewport=nil)
super(viewport)
@image = command[0]
@name = command[1]
@selected = false
@cursor = AnimatedBitmap.new("Graphics/Pictures/Pokegear/icon_button")
@contents = BitmapWrapper.new(@cursor.width, @cursor.height)
@held = false
@base_x = x
@base_y = y
@rearranging = false
@wobble_phase = rand * Math::PI * 2
self.bitmap = @contents
self.x = x
self.y = y
pbSetSystemFont(self.bitmap)
refresh
end
def dispose
@cursor.dispose
@contents.dispose
super
end
def selected=(val)
oldsel = @selected
@selected = val
refresh if oldsel!=val
end
def held=(val)
old = @held
@held = val
refresh if old != val
end
def set_command(command)
@image = command[0]
@name = command[1]
refresh
end
def refresh
self.bitmap.clear
rect = Rect.new(0, 0, @cursor.width, @cursor.height / 2)
rect.y = @cursor.height / 2 if @selected
self.bitmap.blt(0, 0, @cursor.bitmap, rect)
if @held
self.opacity = 200
self.y -= 6
else
self.opacity = 255
end
imagepos = [
[sprintf("Graphics/Pictures/Pokegear/icon_%s", @image), 0, 0]
]
pbDrawImagePositions(self.bitmap, imagepos)
self.x = @base_x
self.y = @base_y
self.y -= 6 if @held
end
def update_wobble
return unless @rearranging && !@held
wobble = Math.sin(@wobble_phase) * 0.2 #amplitude
self.x = @base_x + wobble
self.y = @base_y
wobble_speed = 0.3 + rand * 0.2 #
@wobble_phase += wobble_speed
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokegear_Scene
attr_accessor :exiting
GRID_COLUMNS = 4
GRID_X_START = 72
GRID_Y_START = 120
GRID_X_GAP = 96
GRID_Y_GAP = 72
def pbUpdate
return if @exiting
for i in 0...@commands.length
button = @sprites["button#{i}"]
button.rearranging = @rearranging
button.selected = (i == @index)
button.held = (@rearranging && i == @held_index)
button.update_wobble
end
return unless @commands && @commands[@index]
# Draw selected app name
name_sprite = @sprites["appName"]
name_sprite.bitmap.clear
text = @commands[@index][1]
pbDrawTextPositions(
name_sprite.bitmap,
[[text, Graphics.width / 2, -4, 2,
Color.new(248,248,248), Color.new(40,40,40)]]
)
pbUpdateSpriteHash(@sprites)
end
def pbStartScene(commands)
@commands = commands
@index = 0
@held_index
@rearranging = false
if $game_temp.pokenav_last_index
@index = $game_temp.pokenav_last_index
end
$game_temp.pokenav_last_index = @index
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z = 99999
@sprites = {}
@sprites["background"] = IconSprite.new(0,0,@viewport)
reloadBackground
@sprites["UI"] = IconSprite.new(0,0,@viewport)
@sprites["UI"].setBitmap("Graphics/Pictures/Pokegear/ui_mainMenu")
for i in 0...@commands.length
col = i % GRID_COLUMNS
row = i / GRID_COLUMNS
x = GRID_X_START + (col * GRID_X_GAP)
y = GRID_Y_START + (row * GRID_Y_GAP)
@sprites["button#{i}"] = PokegearButton.new(@commands[i], x, y, @viewport)
end
@sprites["appName"] = BitmapSprite.new(Graphics.width, 48, @viewport)
@sprites["appName"].y = Graphics.height - 48
pbSetSystemFont(@sprites["appName"].bitmap)
@sprites["pokenavIcon"] = AnimatedSprite.new("Graphics/Pictures/Pokegear/pokenav_icon", 8,32,32,4,@viewport)
@sprites["pokenavIcon"].zoom_x = 2
@sprites["pokenavIcon"].zoom_y = 2
@sprites["pokenavIcon"].z = 10
@sprites["pokenavIcon"].x = 400
@sprites["pokenavIcon"].y = 16
@sprites["pokenavIcon"].start
pbFadeInAndShow(@sprites) { pbUpdate }
end
def reloadBackground
if isDarkMode
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg_dark")
else
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg")
end
end
def pbScene
ret = -1
loop do
Graphics.update
Input.update
pbUpdate
if Input.trigger?(Input::BACK) || @exiting
if @rearranging
pbPlayCloseMenuSE
@rearranging = false
else
pbPlayCloseMenuSE
break
end
elsif Input.trigger?(Input::USE)
if @rearranging
swap_apps
else
pbPlayDecisionSE
ret = @index
break
end
elsif Input.trigger?(Input::LEFT)
pbPlayCursorSE
col = grid_col(@index)
if col > 0
@index -= 1
end
$game_temp.pokenav_last_index = @index
elsif Input.trigger?(Input::RIGHT)
pbPlayCursorSE
col = grid_col(@index)
if col < GRID_COLUMNS - 1 && @index + 1 < @commands.length
@index += 1
end
$game_temp.pokenav_last_index = @index
elsif Input.trigger?(Input::UP)
pbPlayCursorSE
new_index = @index - GRID_COLUMNS
if new_index >= 0
@index = new_index
end
$game_temp.pokenav_last_index = @index
elsif Input.trigger?(Input::DOWN)
pbPlayCursorSE
new_index = @index + GRID_COLUMNS
if new_index < @commands.length
@index = new_index
end
$game_temp.pokenav_last_index = @index
end
end
return ret
end
def swap_apps
if @held_index
pbSEPlay("GUI storage put down")
apps = $Trainer.pokenav.installed_apps
apps[@index], apps[@held_index] =
apps[@held_index], apps[@index]
refresh_buttons
@held_index = nil
else
pbSEPlay("GUI storage pick up")
@held_index = @index
end
end
def refresh_buttons
@commands = []
$Trainer.pokenav.installed_apps.each do |app|
@commands << [app.to_s, Pokenav::AVAILABLE_APPS[app]]
end
@commands.each_with_index do |cmd, i|
@sprites["button#{i}"].set_command(cmd)
end
end
# def refresh_apps
#
# end
def rearrange_order
pbSEPlay("GUI naming tab swap start")
@rearranging = true
end
def grid_row(index)
return index / GRID_COLUMNS
end
def grid_col(index)
return index % GRID_COLUMNS
end
def pbEndScene
pbFadeOutAndHide(@sprites) { pbUpdate }
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokegearScreen
def initialize(scene)
@scene = scene
end
def pbStartScreen
commands = []
cmdMap = -1
cmdPhone = -1
cmdJukebox = -1
commands[cmdMap = commands.length] = ["map",_INTL("Map")]
if $PokemonGlobal.phoneNumbers && $PokemonGlobal.phoneNumbers.length>0
commands[cmdPhone = commands.length] = ["phone",_INTL("Phone")]
end
commands[cmdJukebox = commands.length] = ["jukebox",_INTL("Jukebox")]
@scene.pbStartScene(commands)
loop do
cmd = @scene.pbScene
if cmd<0
break
elsif cmdMap>=0 && cmd==cmdMap
pbShowMap(-1,false)
elsif cmdPhone>=0 && cmd==cmdPhone
pbFadeOutIn {
PokemonPhoneScene.new.start
}
elsif cmdJukebox>=0 && cmd==cmdJukebox
pbFadeOutIn {
scene = PokemonJukebox_Scene.new
screen = PokemonJukeboxScreen.new(scene)
screen.pbStartScreen
}
end
end
@scene.pbEndScene
end
end
@@ -0,0 +1,759 @@
class PokemonPokedex_Scene
def pbRefreshDexSearch(params, _index)
overlay = @sprites["overlay"].bitmap
overlay.clear
base = Color.new(248, 248, 248)
shadow = Color.new(72, 72, 72)
if isDarkMode
base, shadow = shadow, base
end
# Write various bits of text
textpos = [
[_INTL("Search Mode"), Graphics.width / 2, -2, 2, base, shadow],
[_INTL("Order"), 136, 52, 2, base, shadow],
[_INTL("Name"), 58, 110, 2, base, shadow],
[_INTL("Type"), 58, 162, 2, base, shadow],
[_INTL("Height"), 58, 214, 2, base, shadow],
[_INTL("Weight"), 58, 266, 2, base, shadow],
[_INTL("Color"), 326, 110, 2, base, shadow],
[_INTL("Shape"), 454, 162, 2, base, shadow],
[_INTL("Reset"), 80, 338, 2, base, shadow, 1],
[_INTL("Start"), Graphics.width / 2, 338, 2, base, shadow, 1],
[_INTL("Cancel"), Graphics.width - 80, 338, 2, base, shadow, 1]
]
# Write order, name and color parameters
textpos.push([@orderCommands[params[0]], 344, 58, 2, base, shadow, 1])
textpos.push([(params[1] < 0) ? "----" : @nameCommands[params[1]], 176, 116, 2, base, shadow, 1])
textpos.push([(params[8] < 0) ? "----" : @colorCommands[params[8]].name, 444, 116, 2, base, shadow, 1])
# Draw type icons
if params[2] >= 0
type_number = @typeCommands[params[2]].id_number
typerect = Rect.new(0, type_number * 32, 96, 32)
overlay.blt(128, 168, @typebitmap.bitmap, typerect)
else
textpos.push(["----", 176, 168, 2, base, shadow, 1])
end
if params[3] >= 0
type_number = @typeCommands[params[3]].id_number
typerect = Rect.new(0, type_number * 32, 96, 32)
overlay.blt(256, 168, @typebitmap.bitmap, typerect)
else
textpos.push(["----", 304, 168, 2, base, shadow, 1])
end
# Write height and weight limits
ht1 = (params[4] < 0) ? 0 : (params[4] >= @heightCommands.length) ? 999 : @heightCommands[params[4]]
ht2 = (params[5] < 0) ? 999 : (params[5] >= @heightCommands.length) ? 0 : @heightCommands[params[5]]
wt1 = (params[6] < 0) ? 0 : (params[6] >= @weightCommands.length) ? 9999 : @weightCommands[params[6]]
wt2 = (params[7] < 0) ? 9999 : (params[7] >= @weightCommands.length) ? 0 : @weightCommands[params[7]]
hwoffset = false
if System.user_language[3..4] == "US" # If the user is in the United States
ht1 = (params[4] >= @heightCommands.length) ? 99 * 12 : (ht1 / 0.254).round
ht2 = (params[5] < 0) ? 99 * 12 : (ht2 / 0.254).round
wt1 = (params[6] >= @weightCommands.length) ? 99990 : (wt1 / 0.254).round
wt2 = (params[7] < 0) ? 99990 : (wt2 / 0.254).round
textpos.push([sprintf("%d'%02d''", ht1 / 12, ht1 % 12), 166, 220, 2, base, shadow, 1])
textpos.push([sprintf("%d'%02d''", ht2 / 12, ht2 % 12), 294, 220, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 272, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 272, 2, base, shadow, 1])
hwoffset = true
else
textpos.push([sprintf("%.1f", ht1 / 10.0), 166, 220, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", ht2 / 10.0), 294, 220, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", wt1 / 10.0), 166, 272, 2, base, shadow, 1])
textpos.push([sprintf("%.1f", wt2 / 10.0), 294, 272, 2, base, shadow, 1])
end
overlay.blt(344, 214, @hwbitmap.bitmap, Rect.new(0, (hwoffset) ? 44 : 0, 32, 44))
overlay.blt(344, 266, @hwbitmap.bitmap, Rect.new(32, (hwoffset) ? 44 : 0, 32, 44))
# Draw shape icon
if params[9] >= 0
shape_number = @shapeCommands[params[9]].id_number
shaperect = Rect.new(0, (shape_number - 1) * 60, 60, 60)
overlay.blt(424, 218, @shapebitmap.bitmap, shaperect)
end
# Draw all text
pbDrawTextPositions(overlay, textpos)
end
def pbRefreshDexSearchParam(mode, cmds, sel, _index)
overlay = @sprites["overlay"].bitmap
overlay.clear
base = Color.new(248, 248, 248)
shadow = Color.new(72, 72, 72)
if isDarkMode
base, shadow = shadow, base
end
# Write various bits of text
textpos = [
[_INTL("Search Mode"), Graphics.width / 2, -2, 2, base, shadow],
[_INTL("OK"), 80, 338, 2, base, shadow, 1],
[_INTL("Cancel"), Graphics.width - 80, 338, 2, base, shadow, 1]
]
title = [_INTL("Order"), _INTL("Name"), _INTL("Type"), _INTL("Height"),
_INTL("Weight"), _INTL("Color"), _INTL("Shape")][mode]
textpos.push([title, 102, (mode == 6) ? 58 : 52, 0, base, shadow])
case mode
when 0 # Order
xstart = 46; ystart = 128
xgap = 236; ygap = 64
halfwidth = 92; cols = 2
selbuttony = 0; selbuttonheight = 44
when 1 # Name
xstart = 78; ystart = 114
xgap = 52; ygap = 52
halfwidth = 22; cols = 7
selbuttony = 156; selbuttonheight = 44
when 2 # Type
xstart = 8; ystart = 104
xgap = 124; ygap = 44
halfwidth = 62; cols = 4
selbuttony = 44; selbuttonheight = 44
when 3, 4 # Height, weight
xstart = 44; ystart = 110
xgap = 304 / (cmds.length + 1); ygap = 112
halfwidth = 60; cols = cmds.length + 1
when 5 # Color
xstart = 62; ystart = 114
xgap = 132; ygap = 52
halfwidth = 62; cols = 3
selbuttony = 44; selbuttonheight = 44
when 6 # Shape
xstart = 82; ystart = 116
xgap = 70; ygap = 70
halfwidth = 0; cols = 5
selbuttony = 88; selbuttonheight = 68
end
# Draw selected option(s) text in top bar
case mode
when 2 # Type icons
for i in 0...2
if !sel[i] || sel[i] < 0
textpos.push(["----", 298 + 128 * i, 58, 2, base, shadow, 1])
else
type_number = @typeCommands[sel[i]].id_number
typerect = Rect.new(0, type_number * 32, 96, 32)
overlay.blt(250 + 128 * i, 58, @typebitmap.bitmap, typerect)
end
end
when 3 # Height range
ht1 = (sel[0] < 0) ? 0 : (sel[0] >= @heightCommands.length) ? 999 : @heightCommands[sel[0]]
ht2 = (sel[1] < 0) ? 999 : (sel[1] >= @heightCommands.length) ? 0 : @heightCommands[sel[1]]
hwoffset = false
if System.user_language[3..4] == "US" # If the user is in the United States
ht1 = (sel[0] >= @heightCommands.length) ? 99 * 12 : (ht1 / 0.254).round
ht2 = (sel[1] < 0) ? 99 * 12 : (ht2 / 0.254).round
txt1 = sprintf("%d'%02d''", ht1 / 12, ht1 % 12)
txt2 = sprintf("%d'%02d''", ht2 / 12, ht2 % 12)
hwoffset = true
else
txt1 = sprintf("%.1f", ht1 / 10.0)
txt2 = sprintf("%.1f", ht2 / 10.0)
end
textpos.push([txt1, 286, 58, 2, base, shadow, 1])
textpos.push([txt2, 414, 58, 2, base, shadow, 1])
overlay.blt(462, 52, @hwbitmap.bitmap, Rect.new(0, (hwoffset) ? 44 : 0, 32, 44))
when 4 # Weight range
wt1 = (sel[0] < 0) ? 0 : (sel[0] >= @weightCommands.length) ? 9999 : @weightCommands[sel[0]]
wt2 = (sel[1] < 0) ? 9999 : (sel[1] >= @weightCommands.length) ? 0 : @weightCommands[sel[1]]
hwoffset = false
if System.user_language[3..4] == "US" # If the user is in the United States
wt1 = (sel[0] >= @weightCommands.length) ? 99990 : (wt1 / 0.254).round
wt2 = (sel[1] < 0) ? 99990 : (wt2 / 0.254).round
txt1 = sprintf("%.1f", wt1 / 10.0)
txt2 = sprintf("%.1f", wt2 / 10.0)
hwoffset = true
else
txt1 = sprintf("%.1f", wt1 / 10.0)
txt2 = sprintf("%.1f", wt2 / 10.0)
end
textpos.push([txt1, 286, 58, 2, base, shadow, 1])
textpos.push([txt2, 414, 58, 2, base, shadow, 1])
overlay.blt(462, 52, @hwbitmap.bitmap, Rect.new(32, (hwoffset) ? 44 : 0, 32, 44))
when 5 # Color
if sel[0] < 0
textpos.push(["----", 362, 58, 2, base, shadow, 1])
else
textpos.push([cmds[sel[0]].name, 362, 58, 2, base, shadow, 1])
end
when 6 # Shape icon
if sel[0] >= 0
shaperect = Rect.new(0, (@shapeCommands[sel[0]].id_number - 1) * 60, 60, 60)
overlay.blt(332, 50, @shapebitmap.bitmap, shaperect)
end
else
if sel[0] < 0
text = ["----", "-", "----", "", "", "----", ""][mode]
textpos.push([text, 362, 58, 2, base, shadow, 1])
else
textpos.push([cmds[sel[0]], 362, 58, 2, base, shadow, 1])
end
end
# Draw selected option(s) button graphic
if mode == 3 || mode == 4 # Height, weight
xpos1 = xstart + (sel[0] + 1) * xgap
xpos1 = xstart if sel[0] < -1
xpos2 = xstart + (sel[1] + 1) * xgap
xpos2 = xstart + cols * xgap if sel[1] < 0
xpos2 = xstart if sel[1] >= cols - 1
ypos1 = ystart + 172
ypos2 = ystart + 28
overlay.blt(16, 120, @searchsliderbitmap.bitmap, Rect.new(0, 192, 32, 44)) if sel[1] < cols - 1
overlay.blt(464, 120, @searchsliderbitmap.bitmap, Rect.new(32, 192, 32, 44)) if sel[1] >= 0
overlay.blt(16, 264, @searchsliderbitmap.bitmap, Rect.new(0, 192, 32, 44)) if sel[0] >= 0
overlay.blt(464, 264, @searchsliderbitmap.bitmap, Rect.new(32, 192, 32, 44)) if sel[0] < cols - 1
hwrect = Rect.new(0, 0, 120, 96)
overlay.blt(xpos2, ystart, @searchsliderbitmap.bitmap, hwrect)
hwrect.y = 96
overlay.blt(xpos1, ystart + ygap, @searchsliderbitmap.bitmap, hwrect)
textpos.push([txt1, xpos1 + halfwidth, ypos1, 2, base, nil, 1])
textpos.push([txt2, xpos2 + halfwidth, ypos2, 2, base, nil, 1])
else
for i in 0...sel.length
if sel[i] >= 0
selrect = Rect.new(0, selbuttony, @selbitmap.bitmap.width, selbuttonheight)
overlay.blt(xstart + (sel[i] % cols) * xgap, ystart + (sel[i] / cols).floor * ygap, @selbitmap.bitmap, selrect)
else
selrect = Rect.new(0, selbuttony, @selbitmap.bitmap.width, selbuttonheight)
overlay.blt(xstart + (cols - 1) * xgap, ystart + (cmds.length / cols).floor * ygap, @selbitmap.bitmap, selrect)
end
end
end
# Draw options
case mode
when 0, 1 # Order, name
for i in 0...cmds.length
x = xstart + halfwidth + (i % cols) * xgap
y = ystart + 6 + (i / cols).floor * ygap
textpos.push([cmds[i], x, y, 2, base, shadow, 1])
end
if mode != 0
textpos.push([(mode == 1) ? "-" : "----",
xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1])
end
when 2 # Type
typerect = Rect.new(0, 0, 96, 32)
for i in 0...cmds.length
typerect.y = @typeCommands[i].id_number * 32
overlay.blt(xstart + 14 + (i % cols) * xgap, ystart + 6 + (i / cols).floor * ygap, @typebitmap.bitmap, typerect)
end
textpos.push(["----",
xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1])
when 5 # Color
for i in 0...cmds.length
x = xstart + halfwidth + (i % cols) * xgap
y = ystart + 6 + (i / cols).floor * ygap
textpos.push([cmds[i].name, x, y, 2, base, shadow, 1])
end
textpos.push(["----",
xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1])
when 6 # Shape
shaperect = Rect.new(0, 0, 60, 60)
for i in 0...cmds.length
shaperect.y = (@shapeCommands[i].id_number - 1) * 60
overlay.blt(xstart + 4 + (i % cols) * xgap, ystart + 4 + (i / cols).floor * ygap, @shapebitmap.bitmap, shaperect)
end
end
# Draw all text
pbDrawTextPositions(overlay, textpos)
end
def pbSearchDexList(params)
$PokemonGlobal.pokedexMode = params[0]
dexlist = pbGetDexList
# Filter by name
if params[1] >= 0
scanNameCommand = @nameCommands[params[1]].scan(/./)
dexlist = dexlist.find_all { |item|
next false if !$Trainer.seen?(item[0])
firstChar = item[1][0, 1]
next scanNameCommand.any? { |v| v == firstChar }
}
end
# Filter by type
if params[2] >= 0 || params[3] >= 0
stype1 = (params[2] >= 0) ? @typeCommands[params[2]].id : nil
stype2 = (params[3] >= 0) ? @typeCommands[params[3]].id : nil
dexlist = dexlist.find_all { |item|
next false if !$Trainer.owned?(item[0])
type1 = item[6]
type2 = item[7]
if stype1 && stype2
# Find species that match both types
next (type1 == stype1 && type2 == stype2) || (type1 == stype2 && type2 == stype1)
elsif stype1
# Find species that match first type entered
next type1 == stype1 || type2 == stype1
elsif stype2
# Find species that match second type entered
next type1 == stype2 || type2 == stype2
else
next false
end
}
end
# Filter by height range
if params[4] >= 0 || params[5] >= 0
minh = (params[4] < 0) ? 0 : (params[4] >= @heightCommands.length) ? 999 : @heightCommands[params[4]]
maxh = (params[5] < 0) ? 999 : (params[5] >= @heightCommands.length) ? 0 : @heightCommands[params[5]]
dexlist = dexlist.find_all { |item|
next false if !$Trainer.owned?(item[0])
height = item[2]
next height >= minh && height <= maxh
}
end
# Filter by weight range
if params[6] >= 0 || params[7] >= 0
minw = (params[6] < 0) ? 0 : (params[6] >= @weightCommands.length) ? 9999 : @weightCommands[params[6]]
maxw = (params[7] < 0) ? 9999 : (params[7] >= @weightCommands.length) ? 0 : @weightCommands[params[7]]
dexlist = dexlist.find_all { |item|
next false if !$Trainer.owned?(item[0])
weight = item[3]
next weight >= minw && weight <= maxw
}
end
# Filter by color
if params[8] >= 0
scolor = @colorCommands[params[8]].id
dexlist = dexlist.find_all { |item|
next false if !$Trainer.seen?(item[0])
next item[8] == scolor
}
end
# Filter by shape
if params[9] >= 0
sshape = @shapeCommands[params[9]].id
dexlist = dexlist.find_all { |item|
next false if !$Trainer.seen?(item[0])
next item[9] == sshape
}
end
# Remove all unseen species from the results
dexlist = dexlist.find_all { |item| next $Trainer.seen?(item[0]) }
case $PokemonGlobal.pokedexMode
when MODENUMERICAL then dexlist.sort! { |a, b| a[4] <=> b[4] }
when MODEATOZ then dexlist.sort! { |a, b| a[1] <=> b[1] }
when MODEHEAVIEST then dexlist.sort! { |a, b| b[3] <=> a[3] }
when MODELIGHTEST then dexlist.sort! { |a, b| a[3] <=> b[3] }
when MODETALLEST then dexlist.sort! { |a, b| b[2] <=> a[2] }
when MODESMALLEST then dexlist.sort! { |a, b| a[2] <=> b[2] }
end
return dexlist
end
def pbCloseSearch
oldsprites = pbFadeOutAndHide(@sprites)
oldspecies = @sprites["pokedex"].species
@searchResults = false
$PokemonGlobal.pokedexMode = MODENUMERICAL
@searchParams = [$PokemonGlobal.pokedexMode, -1, -1, -1, -1, -1, -1, -1, -1, -1]
pbRefreshDexList($PokemonGlobal.pokedexIndex[pbGetSavePositionIndex])
for i in 0...@dexlist.length
next if @dexlist[i][0] != oldspecies
@sprites["pokedex"].index = i
pbRefresh
break
end
$PokemonGlobal.pokedexIndex[pbGetSavePositionIndex] = @sprites["pokedex"].index
pbFadeInAndShow(@sprites, oldsprites)
end
def pbDexSearchCommands(mode, selitems, mainindex)
cmds = [@orderCommands, @nameCommands, @typeCommands, @heightCommands,
@weightCommands, @colorCommands, @shapeCommands][mode]
cols = [2, 7, 4, 1, 1, 3, 5][mode]
ret = nil
# Set background
case mode
when 0 then @sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_order")
when 1 then @sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_name")
when 2
count = 0
GameData::Type.each { |t| count += 1 if !t.pseudo_type && t.id != :SHADOW }
if count == 18
@sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_type_18")
else
@sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_type")
end
when 3, 4 then @sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_size")
when 5 then @sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_color")
when 6 then @sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_shape")
end
selindex = selitems.clone
index = selindex[0]
oldindex = index
minmax = 1
oldminmax = minmax
if mode == 3 || mode == 4
index = oldindex = selindex[minmax]
end
@sprites["searchcursor"].mode = mode
@sprites["searchcursor"].cmds = cmds.length
@sprites["searchcursor"].minmax = minmax
@sprites["searchcursor"].index = index
nextparam = cmds.length % 2
pbRefreshDexSearchParam(mode, cmds, selindex, index)
loop do
pbUpdate
if index != oldindex || minmax != oldminmax
@sprites["searchcursor"].minmax = minmax
@sprites["searchcursor"].index = index
oldindex = index
oldminmax = minmax
end
Graphics.update
Input.update
if mode == 3 || mode == 4
if Input.trigger?(Input::UP)
if index < -1;
minmax = 0; index = selindex[minmax] # From OK/Cancel
elsif minmax == 0;
minmax = 1; index = selindex[minmax]
end
if index != oldindex || minmax != oldminmax
pbPlayCursorSE
pbRefreshDexSearchParam(mode, cmds, selindex, index)
end
elsif Input.trigger?(Input::DOWN)
if minmax == 1;
minmax = 0; index = selindex[minmax]
elsif minmax == 0;
minmax = -1; index = -2
end
if index != oldindex || minmax != oldminmax
pbPlayCursorSE
pbRefreshDexSearchParam(mode, cmds, selindex, index)
end
elsif Input.repeat?(Input::LEFT)
if index == -3;
index = -2
elsif index >= -1
if minmax == 1 && index == -1
index = cmds.length - 1 if selindex[0] < cmds.length - 1
elsif minmax == 1 && index == 0
index = cmds.length if selindex[0] < 0
elsif index > -1 && !(minmax == 1 && index >= cmds.length)
index -= 1 if minmax == 0 || selindex[0] <= index - 1
end
end
if index != oldindex
selindex[minmax] = index if minmax >= 0
pbPlayCursorSE
pbRefreshDexSearchParam(mode, cmds, selindex, index)
end
elsif Input.repeat?(Input::RIGHT)
if index == -2;
index = -3
elsif index >= -1
if minmax == 1 && index >= cmds.length;
index = 0
elsif minmax == 1 && index == cmds.length - 1;
index = -1
elsif index < cmds.length && !(minmax == 1 && index < 0)
index += 1 if minmax == 1 || selindex[1] == -1 ||
(selindex[1] < cmds.length && selindex[1] >= index + 1)
end
end
if index != oldindex
selindex[minmax] = index if minmax >= 0
pbPlayCursorSE
pbRefreshDexSearchParam(mode, cmds, selindex, index)
end
end
else
if Input.trigger?(Input::UP)
if index == -1;
index = cmds.length - 1 - (cmds.length - 1) % cols - 1 # From blank
elsif index == -2;
index = ((cmds.length - 1) / cols).floor * cols # From OK
elsif index == -3 && mode == 0;
index = cmds.length - 1 # From Cancel
elsif index == -3;
index = -1 # From Cancel
elsif index >= cols;
index -= cols
end
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::DOWN)
if index == -1;
index = -3 # From blank
elsif index >= 0
if index + cols < cmds.length;
index += cols
elsif (index / cols).floor < ((cmds.length - 1) / cols).floor
index = (index % cols < cols / 2.0) ? cmds.length - 1 : -1
else
index = (index % cols < cols / 2.0) ? -2 : -3
end
end
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::LEFT)
if index == -3;
index = -2
elsif index == -1;
index = cmds.length - 1
elsif index > 0 && index % cols != 0;
index -= 1
end
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::RIGHT)
if index == -2;
index = -3
elsif index == cmds.length - 1 && mode != 0;
index = -1
elsif index >= 0 && index % cols != cols - 1;
index += 1
end
pbPlayCursorSE if index != oldindex
end
end
if Input.trigger?(Input::ACTION)
index = -2
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
ret = nil
break
elsif Input.trigger?(Input::USE)
if index == -2 # OK
pbPlayDecisionSE
ret = selindex
break
elsif index == -3 # Cancel
pbPlayCloseMenuSE
ret = nil
break
elsif selindex != index && mode != 3 && mode != 4
if mode == 2
if index == -1
nextparam = (selindex[1] >= 0) ? 1 : 0
elsif index >= 0
nextparam = (selindex[0] < 0) ? 0 : (selindex[1] < 0) ? 1 : nextparam
end
if index < 0 || selindex[(nextparam + 1) % 2] != index
pbPlayDecisionSE
selindex[nextparam] = index
nextparam = (nextparam + 1) % 2
end
else
pbPlayDecisionSE
selindex[0] = index
end
pbRefreshDexSearchParam(mode, cmds, selindex, index)
end
end
end
Input.update
# Set background image
@sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search")
@sprites["searchcursor"].mode = -1
@sprites["searchcursor"].index = mainindex
return ret
end
def pbDexSearch
oldsprites = pbFadeOutAndHide(@sprites)
params = @searchParams.clone
@orderCommands = []
@orderCommands[MODENUMERICAL] = _INTL("Numerical")
@orderCommands[MODEATOZ] = _INTL("A to Z")
@orderCommands[MODEHEAVIEST] = _INTL("Heaviest")
@orderCommands[MODELIGHTEST] = _INTL("Lightest")
@orderCommands[MODETALLEST] = _INTL("Tallest")
@orderCommands[MODESMALLEST] = _INTL("Smallest")
@nameCommands = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
@typeCommands = []
count = 0
GameData::Type.each do |t|
@typeCommands.push(t) if !t.pseudo_type && count <= 18
count += 1
end
@typeCommands.sort! { |a, b| a.id_number <=> b.id_number }
@heightCommands = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 30, 35, 40, 45, 50,
55, 60, 65, 70, 80, 90, 100]
@weightCommands = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50,
55, 60, 70, 80, 90, 100, 110, 120, 140, 160,
180, 200, 250, 300, 350, 400, 500, 600, 700, 800,
900, 1000, 1250, 1500, 2000, 3000, 5000]
@colorCommands = []
GameData::BodyColor.each { |c| @colorCommands.push(c) }
@shapeCommands = []
GameData::BodyShape.each { |c| @shapeCommands.push(c) if c.id != :None }
@sprites["searchbg"].visible = true
@sprites["overlay"].visible = true
@sprites["searchcursor"].visible = true
index = 0
oldindex = index
@sprites["searchcursor"].mode = -1
@sprites["searchcursor"].index = index
pbRefreshDexSearch(params, index)
pbFadeInAndShow(@sprites)
loop do
Graphics.update
Input.update
pbUpdate
if index != oldindex
@sprites["searchcursor"].index = index
oldindex = index
end
if Input.trigger?(Input::UP)
if index >= 7;
index = 4
elsif index == 5;
index = 0
elsif index > 0;
index -= 1
end
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::DOWN)
if index == 4 || index == 6;
index = 8
elsif index < 7;
index += 1
end
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::LEFT)
if index == 5;
index = 1
elsif index == 6;
index = 3
elsif index > 7;
index -= 1
end
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::RIGHT)
if index == 1;
index = 5
elsif index >= 2 && index <= 4;
index = 6
elsif index == 7 || index == 8;
index += 1
end
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::ACTION)
index = 8
pbPlayCursorSE if index != oldindex
elsif Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
break
elsif Input.trigger?(Input::USE)
pbPlayDecisionSE if index != 9
case index
when 0 # Choose sort order
newparam = pbDexSearchCommands(0, [params[0]], index)
params[0] = newparam[0] if newparam != nil
pbRefreshDexSearch(params, index)
when 1 # Filter by name
newparam = pbDexSearchCommands(1, [params[1]], index)
params[1] = newparam[0] if newparam != nil
pbRefreshDexSearch(params, index)
when 2 # Filter by type
newparam = pbDexSearchCommands(2, [params[2], params[3]], index)
if newparam != nil
params[2] = newparam[0]
params[3] = newparam[1]
end
pbRefreshDexSearch(params, index)
when 3 # Filter by height range
newparam = pbDexSearchCommands(3, [params[4], params[5]], index)
if newparam != nil
params[4] = newparam[0]
params[5] = newparam[1]
end
pbRefreshDexSearch(params, index)
when 4 # Filter by weight range
newparam = pbDexSearchCommands(4, [params[6], params[7]], index)
if newparam != nil
params[6] = newparam[0]
params[7] = newparam[1]
end
pbRefreshDexSearch(params, index)
when 5 # Filter by color filter
newparam = pbDexSearchCommands(5, [params[8]], index)
params[8] = newparam[0] if newparam != nil
pbRefreshDexSearch(params, index)
when 6 # Filter by form
newparam = pbDexSearchCommands(6, [params[9]], index)
params[9] = newparam[0] if newparam != nil
pbRefreshDexSearch(params, index)
when 7 # Clear filters
for i in 0...10
params[i] = (i == 0) ? MODENUMERICAL : -1
end
pbRefreshDexSearch(params, index)
when 8 # Start search (filter)
dexlist = pbSearchDexList(params)
if dexlist.length == 0
pbMessage(_INTL("No matching Pokémon were found."))
else
@dexlist = dexlist
@sprites["pokedex"].commands = @dexlist
@sprites["pokedex"].index = 0
@sprites["pokedex"].refresh
@searchResults = true
@searchParams = params
break
end
when 9 # Cancel
pbPlayCloseMenuSE
break
end
end
end
pbFadeOutAndHide(@sprites)
if @searchResults
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_listsearch")
else
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_list")
end
pbRefresh
pbFadeInAndShow(@sprites, oldsprites)
Input.update
return 0
end
def pokedexQuickSearch
if $PokemonSystem.textinput == 1 # keyboard
scene = PokedexTextEntry.new
else
# cursor
scene = PokemonEntryScene2.new
end
scene.pbStartScene(
_INTL("Search Pokémon by name."),
1, # min length
12, # max length
""
)
query = scene.pbEntry
scene.pbEndScene
if query && !query.empty?
pbApplyTextNameSearch(query)
end
end
def pbApplyTextNameSearch(query)
query = query.downcase
dexlist = pbGetDexList(@filter_owned)
dexlist = dexlist.find_all do |item|
next false if !$Trainer.seen?(item[0])
item[1].downcase.include?(query)
end
@searchResults = true
@dexlist = dexlist
@sprites["pokedex"].commands = @dexlist
@sprites["pokedex"].index = 0
@sprites["pokedex"].refresh
pbRefresh
end
end
@@ -0,0 +1,585 @@
#===============================================================================
#
#===============================================================================
class Window_Pokedex < Window_DrawableCommand
def initialize(x, y, width, height, viewport)
@commands = []
super(x, y, width, height, viewport)
@selarrow = AnimatedBitmap.new("Graphics/Pictures/Pokedex/cursor_list")
@pokeballOwn = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_own")
icon_seen_path = "Graphics/Pictures/Pokedex/icon_seen"
if isDarkMode
icon_seen_path_dark = icon_seen_path + "_dark"
icon_seen_path = icon_seen_path_dark if pbResolveBitmap(icon_seen_path_dark)
end
@pokeballSeen = AnimatedBitmap.new(icon_seen_path)
@allow_arrows_jump = true
self.baseColor = Color.new(88, 88, 80)
self.shadowColor = Color.new(168, 184, 184)
if isDarkMode
self.baseColor, self.shadowColor = self.shadowColor, self.baseColor
end
self.windowskin = nil
end
def commands=(value)
@commands = value
refresh
end
def dispose
@pokeballOwn.dispose
@pokeballSeen.dispose
super
end
def species
if self.index > @commands.size - 1
self.index = 0
end
current_position = self.index
return (@commands.length == 0) ? 0 : @commands[current_position][0]
end
def itemCount
return @commands.length
end
def drawItem(index, _count, rect)
return if index >= self.top_row + self.page_item_max
rect = Rect.new(rect.x + 16, rect.y, rect.width - 16, rect.height)
species = @commands[index][0]
indexNumber = @commands[index][4]
indexNumber -= 1 if @commands[index][5]
if $Trainer.seen?(species)
if $Trainer.owned?(species)
pbCopyBitmap(self.contents, @pokeballOwn.bitmap, rect.x - 6, rect.y + 8)
else
pbCopyBitmap(self.contents, @pokeballSeen.bitmap, rect.x - 6, rect.y + 8)
end
text = sprintf("%03d%s %s", indexNumber, " ", @commands[index][1])
else
text = sprintf("%03d ----------", indexNumber)
end
pbDrawShadowText(self.contents, rect.x + 36, rect.y + 6, rect.width, rect.height,
text, self.baseColor, self.shadowColor)
end
def refresh
@item_max = itemCount
dwidth = self.width - self.borderX
dheight = self.height - self.borderY
self.contents = pbDoEnsureBitmap(self.contents, dwidth, dheight)
self.contents.clear
for i in 0...@item_max
next if i < self.top_item || i > self.top_item + self.page_item_max
drawItem(i, @item_max, itemRect(i))
end
drawCursor(self.index, itemRect(self.index))
end
def update
super
@uparrow.visible = false
@downarrow.visible = false
end
end
#===============================================================================
#
#===============================================================================
class PokedexSearchSelectionSprite < SpriteWrapper
attr_reader :index
attr_accessor :cmds
attr_accessor :minmax
def initialize(viewport = nil)
super(viewport)
@selbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/cursor_search")
self.bitmap = @selbitmap.bitmap
self.mode = -1
@index = 0
refresh
end
def dispose
@selbitmap.dispose
super
end
def index=(value)
@index = value
refresh
end
def mode=(value)
@mode = value
case @mode
when 0 # Order
@xstart = 46; @ystart = 128
@xgap = 236; @ygap = 64
@cols = 2
when 1 # Name
@xstart = 78; @ystart = 114
@xgap = 52; @ygap = 52
@cols = 7
when 2 # Type
@xstart = 8; @ystart = 104
@xgap = 124; @ygap = 44
@cols = 4
when 3, 4 # Height, weight
@xstart = 44; @ystart = 110
@xgap = 8; @ygap = 112
when 5 # Color
@xstart = 62; @ystart = 114
@xgap = 132; @ygap = 52
@cols = 3
when 6 # Shape
@xstart = 82; @ystart = 116
@xgap = 70; @ygap = 70
@cols = 5
end
end
def refresh
# Size and position cursor
if @mode == -1 # Main search screen
case @index
when 0 # Order
self.src_rect.y = 0; self.src_rect.height = 44
when 1, 5 # Name, color
self.src_rect.y = 44; self.src_rect.height = 44
when 2 # Type
self.src_rect.y = 88; self.src_rect.height = 44
when 3, 4 # Height, weight
self.src_rect.y = 132; self.src_rect.height = 44
when 6 # Form
self.src_rect.y = 176; self.src_rect.height = 68
else
# Reset/start/cancel
self.src_rect.y = 244; self.src_rect.height = 40
end
case @index
when 0 # Order
self.x = 252; self.y = 52
when 1, 2, 3, 4 # Name, type, height, weight
self.x = 114; self.y = 110 + (@index - 1) * 52
when 5 # Color
self.x = 382; self.y = 110
when 6 # Shape
self.x = 420; self.y = 214
when 7, 8, 9 # Reset, start, cancel
self.x = 4 + (@index - 7) * 176; self.y = 334
end
else
# Parameter screen
case @index
when -2, -3 # OK, Cancel
self.src_rect.y = 244; self.src_rect.height = 40
else
case @mode
when 0 # Order
self.src_rect.y = 0; self.src_rect.height = 44
when 1 # Name
self.src_rect.y = 284; self.src_rect.height = 44
when 2, 5 # Type, color
self.src_rect.y = 44; self.src_rect.height = 44
when 3, 4 # Height, weight
self.src_rect.y = (@minmax == 1) ? 328 : 424; self.src_rect.height = 96
when 6 # Shape
self.src_rect.y = 176; self.src_rect.height = 68
end
end
case @index
when -1 # Blank option
if @mode == 3 || @mode == 4 # Height/weight range
self.x = @xstart + (@cmds + 1) * @xgap * (@minmax % 2)
self.y = @ystart + @ygap * ((@minmax + 1) % 2)
else
self.x = @xstart + (@cols - 1) * @xgap
self.y = @ystart + (@cmds / @cols).floor * @ygap
end
when -2 # OK
self.x = 4; self.y = 334
when -3 # Cancel
self.x = 356; self.y = 334
else
case @mode
when 0, 1, 2, 5, 6 # Order, name, type, color, shape
if @index >= @cmds
self.x = @xstart + (@cols - 1) * @xgap
self.y = @ystart + (@cmds / @cols).floor * @ygap
else
self.x = @xstart + (@index % @cols) * @xgap
self.y = @ystart + (@index / @cols).floor * @ygap
end
when 3, 4 # Height, weight
if @index >= @cmds
self.x = @xstart + (@cmds + 1) * @xgap * ((@minmax + 1) % 2)
else
self.x = @xstart + (@index + 1) * @xgap
end
self.y = @ystart + @ygap * ((@minmax + 1) % 2)
end
end
end
end
end
#===============================================================================
# Pokédex main screen
#===============================================================================
class PokemonPokedex_Scene
MODENUMERICAL = 0
MODEATOZ = 1
MODETALLEST = 2
MODESMALLEST = 3
MODEHEAVIEST = 4
MODELIGHTEST = 5
def pbUpdate
pbUpdateSpriteHash(@sprites)
end
def pbStartScene(filter_owned = false)
@filter_owned = filter_owned
@sliderbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_slider")
@typebitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_types")
@shapebitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_shapes")
@hwbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_hw")
@selbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_searchsel")
@searchsliderbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_searchslider")
@sprites = {}
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
addBackgroundPlane(@sprites, "background", "Pokedex/bg_list", @viewport)
=begin
# Suggestion for changing the background depending on region. You can change
# the line above with the following:
if pbGetPokedexRegion==-1 # Using national Pokédex
addBackgroundPlane(@sprites,"background","Pokedex/bg_national",@viewport)
elsif pbGetPokedexRegion==0 # Using first regional Pokédex
addBackgroundPlane(@sprites,"background","Pokedex/bg_regional",@viewport)
end
=end
addBackgroundPlane(@sprites, "searchbg", "Pokedex/bg_search", @viewport)
@sprites["searchbg"].visible = false
@sprites["pokedex"] = Window_Pokedex.new(206, 30, 276, 364, @viewport)
@sprites["icon"] = PokemonSprite.new(@viewport)
@sprites["icon"].setOffset(PictureOrigin::Center)
@sprites["icon"].x = 112
@sprites["icon"].y = 196
@sprites["icon"].zoom_y = Settings::FRONTSPRITE_SCALE
@sprites["icon"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
pbSetSystemFont(@sprites["overlay"].bitmap)
@sprites["searchcursor"] = PokedexSearchSelectionSprite.new(@viewport)
@sprites["searchcursor"].visible = false
@searchResults = false
@searchParams = [$PokemonGlobal.pokedexMode, -1, -1, -1, -1, -1, -1, -1, -1, -1]
pbRefreshDexList($PokemonGlobal.pokedexIndex[pbGetSavePositionIndex])
pbDeactivateWindows(@sprites)
pbFadeInAndShow(@sprites)
end
def pbEndScene
pbFadeOutAndHide(@sprites)
pbDisposeSpriteHash(@sprites)
@sliderbitmap.dispose
@typebitmap.dispose
@shapebitmap.dispose
@hwbitmap.dispose
@selbitmap.dispose
@searchsliderbitmap.dispose
@viewport.dispose
end
# Gets the region used for displaying Pokédex entries. Species will be listed
# according to the given region's numbering and the returned region can have
# any value defined in the town map data file. It is currently set to the
# return value of pbGetCurrentRegion, and thus will change according to the
# current map's MapPosition metadata setting.
def pbGetPokedexRegion
if Settings::USE_CURRENT_REGION_DEX
region = pbGetCurrentRegion
region = -1 if region >= $Trainer.pokedex.dexes_count - 1
return region
else
return $PokemonGlobal.pokedexDex # National Dex -1, regional Dexes 0, 1, etc.
end
end
# Determines which index of the array $PokemonGlobal.pokedexIndex to save the
# "last viewed species" in. All regional dexes come first in order, then the
# National Dex at the end.
def pbGetSavePositionIndex
index = pbGetPokedexRegion
if index == -1 # National Dex (comes after regional Dex indices)
index = $Trainer.pokedex.dexes_count - 1
end
return index
end
def pbCanAddForModeList?(mode, species)
case mode
when MODEATOZ
return $Trainer.seen?(species)
when MODEHEAVIEST, MODELIGHTEST, MODETALLEST, MODESMALLEST
return $Trainer.owned?(species)
end
return true # For MODENUMERICAL
end
# def pbGetDexList
# region = pbGetPokedexRegion
# regionalSpecies = pbAllRegionalSpecies(region)
# if !regionalSpecies || regionalSpecies.length == 0
# # If no Regional Dex defined for the given region, use the National Pokédex
# regionalSpecies = []
# GameData::Species.each { |s| regionalSpecies.push(s.id) if s.form == 0 }
# end
# shift = Settings::DEXES_WITH_OFFSETS.include?(region)
# ret = []
# regionalSpecies.each_with_index do |species, i|
# next if !species
# next if !pbCanAddForModeList?($PokemonGlobal.pokedexMode, species)
# species_data = GameData::Species.get(species)
# color = species_data.color
# type1 = species_data.type1
# type2 = species_data.type2 || type1
# shape = species_data.shape
# height = species_data.height
# weight = species_data.weight
# ret.push([species, species_data.name, height, weight, i + 1, shift, type1, type2, color, shape])
# end
# return ret
# end
def pbGetDexList(filter_owned = false)
dexlist = []
regionalSpecies = []
for i in 1..PBSpecies.maxValue
regionalSpecies.push(i)
end
for i in 1...PBSpecies.maxValue
nationalSpecies = i
if $Trainer.seen?(nationalSpecies)
if !filter_owned || $Trainer.owned?(nationalSpecies)
species = GameData::Species.get(nationalSpecies)
dexlist.push([species.id_number, species.name, 0, 0, i + 1, 0])
end
end
end
return dexlist
end
def pbRefreshDexList(index = 0)
if index == nil
index = 0
end
dexlist = pbGetDexList(@filter_owned)
case $PokemonGlobal.pokedexMode
when MODENUMERICAL
# Hide the Dex number 0 species if unseen
dexlist[0] = nil if dexlist[0][5] && !$Trainer.seen?(dexlist[0][0])
# Remove unseen species from the end of the list
i = dexlist.length - 1
loop do
break unless i >= 0
break if !dexlist[i] || $Trainer.seen?(dexlist[i][0])
dexlist[i] = nil
i -= 1
end
dexlist.compact!
# Sort species in ascending order by Regional Dex number
dexlist.sort! { |a, b| a[4] <=> b[4] }
when MODEATOZ
dexlist.sort! { |a, b| (a[1] == b[1]) ? a[4] <=> b[4] : a[1] <=> b[1] }
when MODEHEAVIEST
dexlist.sort! { |a, b| (a[3] == b[3]) ? a[4] <=> b[4] : b[3] <=> a[3] }
when MODELIGHTEST
dexlist.sort! { |a, b| (a[3] == b[3]) ? a[4] <=> b[4] : a[3] <=> b[3] }
when MODETALLEST
dexlist.sort! { |a, b| (a[2] == b[2]) ? a[4] <=> b[4] : b[2] <=> a[2] }
when MODESMALLEST
dexlist.sort! { |a, b| (a[2] == b[2]) ? a[4] <=> b[4] : a[2] <=> b[2] }
end
@dexlist = dexlist
@sprites["pokedex"].commands = @dexlist
@sprites["pokedex"].index = index
@sprites["pokedex"].refresh
if @searchResults
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_listsearch")
else
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_list")
end
pbRefresh
end
def pbRefresh
overlay = @sprites["overlay"].bitmap
overlay.clear
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
if isDarkMode
base, shadow = shadow, base
end
iconspecies = @sprites["pokedex"].species
iconspecies = nil if !$Trainer.seen?(iconspecies)
# Write various bits of text
dexname = _INTL("Pokédex")
if $Trainer.pokedex.dexes_count > 1
thisdex = Settings.pokedex_names[pbGetSavePositionIndex]
if thisdex != nil
dexname = (thisdex.is_a?(Array)) ? thisdex[0] : thisdex
end
end
textpos = [
[dexname, Graphics.width / 2, -2, 2, Color.new(248, 248, 248), Color.new(0, 0, 0)]
]
textpos.push([GameData::Species.get(iconspecies).name, 112, 46, 2, base, shadow]) if iconspecies
if @searchResults
textpos.push([_INTL("Search results"), 112, 302, 2, base, shadow])
textpos.push([@dexlist.length.to_s, 112, 334, 2, base, shadow])
else
textpos.push([_INTL("Seen:"), 42, 302, 0, base, shadow])
textpos.push([$Trainer.pokedex.seen_count(pbGetPokedexRegion).to_s, 182, 302, 1, base, shadow])
textpos.push([_INTL("Owned:"), 42, 334, 0, base, shadow])
textpos.push([$Trainer.pokedex.owned_count(pbGetPokedexRegion).to_s, 182, 334, 1, base, shadow])
end
# Draw all text
pbDrawTextPositions(overlay, textpos)
# Set Pokémon sprite
setIconBitmap(iconspecies) if iconspecies
# Draw slider arrows
itemlist = @sprites["pokedex"]
showslider = false
if itemlist.top_row > 0
overlay.blt(468, 48, @sliderbitmap.bitmap, Rect.new(0, 0, 40, 30))
showslider = true
end
if itemlist.top_item + itemlist.page_item_max < itemlist.itemCount
overlay.blt(468, 346, @sliderbitmap.bitmap, Rect.new(0, 30, 40, 30))
showslider = true
end
# Draw slider box
if showslider
sliderheight = 268
boxheight = (sliderheight * itemlist.page_row_max / itemlist.row_max).floor
boxheight += [(sliderheight - boxheight) / 2, sliderheight / 6].min
boxheight = [boxheight.floor, 40].max
y = 78
y += ((sliderheight - boxheight) * itemlist.top_row / (itemlist.row_max - itemlist.page_row_max)).floor
overlay.blt(468, y, @sliderbitmap.bitmap, Rect.new(40, 0, 40, 8))
i = 0
while i * 16 < boxheight - 8 - 16
height = [boxheight - 8 - 16 - i * 16, 16].min
overlay.blt(468, y + 8 + i * 16, @sliderbitmap.bitmap, Rect.new(40, 8, 40, height))
i += 1
end
overlay.blt(468, y + boxheight - 16, @sliderbitmap.bitmap, Rect.new(40, 24, 40, 16))
end
end
def setIconBitmap(species)
@sprites_cache = {} unless @sprites_cache
if @sprites_cache[species]
@sprites["icon"].setBitmapDirectly(@sprites_cache[species])
else
gender, form = $Trainer.pokedex.last_form_seen(species)
@sprites["icon"].setSpeciesBitmap(species, gender, form)
@sprites_cache[species] = @sprites["icon"].bitmap.clone
end
end
def pbDexEntry(index)
oldsprites = pbFadeOutAndHide(@sprites)
region = -1
if !Settings::USE_CURRENT_REGION_DEX
dexnames = Settings.pokedex_names
if dexnames[pbGetSavePositionIndex].is_a?(Array)
region = dexnames[pbGetSavePositionIndex][1]
end
end
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
ret = screen.pbStartScreen(@dexlist, index, region)
if @searchResults
dexlist = pbSearchDexList(@searchParams)
@dexlist = dexlist
@sprites["pokedex"].commands = @dexlist
ret = @dexlist.length - 1 if ret >= @dexlist.length
ret = 0 if ret < 0
else
pbRefreshDexList($PokemonGlobal.pokedexIndex[pbGetSavePositionIndex])
$PokemonGlobal.pokedexIndex[pbGetSavePositionIndex] = ret
end
@sprites["pokedex"].index = ret
@sprites["pokedex"].refresh
pbRefresh
pbFadeInAndShow(@sprites, oldsprites)
end
def pbPokedex()
pbActivateWindow(@sprites, "pokedex") {
loop do
Graphics.update
Input.update
oldindex = @sprites["pokedex"].index
pbUpdate
if oldindex != @sprites["pokedex"].index
$PokemonGlobal.pokedexIndex[pbGetSavePositionIndex] = @sprites["pokedex"].index if !@searchResults
pbRefresh
end
if Input.trigger?(Input::ACTION)
pbPlayDecisionSE
pokedexQuickSearch
elsif Input.trigger?(Input::SPECIAL)
pbPlayDecisionSE
@sprites["pokedex"].active = false
pbDexSearch
@sprites["pokedex"].active = true
elsif Input.trigger?(Input::BACK)
if @searchResults
pbPlayCancelSE
pbCloseSearch
else
pbPlayCloseMenuSE
break
end
elsif Input.trigger?(Input::USE)
if $Trainer.seen?(@sprites["pokedex"].species)
pbPlayDecisionSE
pbDexEntry(@sprites["pokedex"].index)
end
end
end
}
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokedexScreen
def initialize(scene)
@scene = scene
end
def pbStartScreen(filter_owned = false)
@scene.pbStartScene(filter_owned)
@scene.pbPokedex()
@scene.pbEndScene
end
end
@@ -2,7 +2,9 @@
#
#===============================================================================
class PokemonPokedexInfo_Scene
def pbStartScene(dexlist, index, region)
def pbStartScene(dexlist, index, region, pokemon = nil, fromSummary = false)
@fromSummary = fromSummary
@pokemon = pokemon
@endscene = false
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@@ -71,10 +73,11 @@ class PokemonPokedexInfo_Scene
pbFadeInAndShow(@sprites) { pbUpdate }
end
def initializeSpritesPageGraphics()
@sprites["leftarrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow", 8, 40, 28, 2, @viewport)
@sprites["leftarrow"].x = 20
@sprites["leftarrow"].y = 250 #268
@sprites["leftarrow"].y = 250 # 268
@sprites["leftarrow"].play
@sprites["leftarrow"].visible = false
@sprites["rightarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow", 8, 40, 28, 2, @viewport)
@@ -85,17 +88,25 @@ class PokemonPokedexInfo_Scene
@sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/uparrow", 8, 28, 40, 2, @viewport)
@sprites["uparrow"].x = 250
@sprites["uparrow"].y = 50 #268
@sprites["uparrow"].y = 50 # 268
@sprites["uparrow"].play
@sprites["uparrow"].visible = false
@sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/downarrow", 8, 28, 40, 2, @viewport)
@sprites["downarrow"].x = 250
@sprites["downarrow"].x = 25
@sprites["downarrow"].y = 350
@sprites["downarrow"].play
@sprites["downarrow"].visible = false
@sprites["blacklistIcon"] = IconSprite.new(0, 0, @viewport)
@sprites["blacklistIcon"].setBitmap("Graphics/Pictures/Pokedex/enabled_disabled_icon")
@sprites["blacklistIcon"].x = 10
@sprites["blacklistIcon"].y = 320
@sprites["blacklistIcon"].z = 9999999
@sprites["blacklistIcon"].visible = false
end
def pbStartSpritesSelectSceneBrief(species, alts_list)
def pbStartSpritesSelectSceneBrief(species, alts_list, pokemon = nil)
@available = alts_list
@species = species
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@@ -109,6 +120,7 @@ class PokemonPokedexInfo_Scene
@sprites["infosprite"] = PokemonSprite.new(@viewport)
@spritesLoader = BattleSpriteLoader.new
@page = 3
@pokemon = pokemon
initializeSpritesPageGraphics
initializeSpritesPage(@available)
drawPage(@page)
@@ -116,7 +128,9 @@ class PokemonPokedexInfo_Scene
pbFadeInAndShow(@sprites) { pbUpdate }
end
def pbStartSceneBrief(species)
def pbStartSceneBrief(pokemon)
species = pokemon.species
@pokemon = pokemon
# For standalone access, shows first page only
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@@ -191,68 +205,24 @@ class PokemonPokedexInfo_Scene
@sprites["previousSprite"].visible = false
end
# species_data = pbGetSpeciesData(@species)
species_data = GameData::Species.get_species_form(@species, @form)
@sprites["infosprite"].setSpeciesBitmap(@species) #, @gender, @form)
# if @sprites["formfront"]
# @sprites["formfront"].setSpeciesBitmap(@species,@gender,@form)
# end
# if @sprites["formback"]
# @sprites["formback"].setSpeciesBitmap(@species,@gender,@form,false,false,true)
# @sprites["formback"].y = 256
# @sprites["formback"].y += species_data.back_sprite_y * 2
# end
# if @sprites["formicon"]
# @sprites["formicon"].pbSetParams(@species,@gender,@form)
# end
if @pokemon && @pokemon.pif_sprite
@spritesLoader = BattleSpriteLoader.new unless @spritesLoader
animated = @spritesLoader.load_pif_sprite_directly(@pokemon.pif_sprite)
@displayed_pif_sprite = @pokemon.pif_sprite
@sprites["infosprite"].setAnimatedBitmap(animated)
elsif @displayed_pif_sprite
@sprites["infosprite"].setPokemonBitmapPIFSprite(@displayed_pif_sprite)
else
spritesLoader = BattleSpriteLoader.new
@displayed_pif_sprite = spritesLoader.obtain_pif_sprite(GameData::Species.get(@species).species)
@sprites["infosprite"].setPokemonBitmapPIFSprite(@displayed_pif_sprite)
end
end
# def pbGetAvailableForms
# ret = []
# return ret
# # multiple_forms = false
# # # Find all genders/forms of @species that have been seen
# # GameData::Species.each do |sp|
# # next if sp.species != @species
# # next if sp.form != 0 && (!sp.real_form_name || sp.real_form_name.empty?)
# # next if sp.pokedex_form != sp.form
# # multiple_forms = true if sp.form > 0
# # case sp.gender_ratio
# # when :AlwaysMale, :AlwaysFemale, :Genderless
# # real_gender = (sp.gender_ratio == :AlwaysFemale) ? 1 : 0
# # next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
# # real_gender = 2 if sp.gender_ratio == :Genderless
# # ret.push([sp.form_name, real_gender, sp.form])
# # else # Both male and female
# # for real_gender in 0...2
# # next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
# # ret.push([sp.form_name, real_gender, sp.form])
# # break if sp.form_name && !sp.form_name.empty? # Only show 1 entry for each non-0 form
# # end
# # end
# # end
# # # Sort all entries
# # ret.sort! { |a, b| (a[2] == b[2]) ? a[1] <=> b[1] : a[2] <=> b[2] }
# # # Create form names for entries if they don't already exist
# # ret.each do |entry|
# # if !entry[0] || entry[0].empty? # Necessarily applies only to form 0
# # case entry[1]
# # when 0 then entry[0] = "Male"
# # when 1 then entry[0] = "Female"
# # else
# # entry[0] = multiple_forms ? "One Form" : "Genderless"
# # end
# # end
# # entry[1] = 0 if entry[1] == 2 # Genderless entries are treated as male
# # end
# # return ret
# end
def drawPage(page)
overlay = @sprites["overlay"].bitmap
overlay.clear
@creditsOverlay.clear if @creditsOverlay && !@creditsOverlay.disposed?
# Make certain sprites visible
@sprites["infosprite"].visible = (@page == 1)
@sprites["areamap"].visible = (@page == 2) if @sprites["areamap"]
@@ -278,12 +248,18 @@ class PokemonPokedexInfo_Scene
end
end
def drawPageInfo(reloading=false)
def drawPageInfo(reloading = false)
@entry_author = nil
pbUpdateDummyPokemon
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_info")
overlay = @sprites["overlay"].bitmap
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
if isDarkMode
base, shadow = shadow, base
end
imagepos = []
if @brief
imagepos.push(["Graphics/Pictures/Pokedex/overlay_info", 0, 0])
@@ -291,48 +267,40 @@ class PokemonPokedexInfo_Scene
species_data = GameData::Species.get_species_form(@species, @form)
# Write various bits of text
indexText = "???"
#if @dexlist[@index][4] > 0
indexNumber = @dexlist[@index][4]
indexNumber -= 1 if @dexlist[@index][5]
indexNumber = GameData::Species.get(@species).id_number
indexText = sprintf("%03d", indexNumber)
# end
textpos = [
["#{indexText} #{species_data.name}",
246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)],
[_INTL("Height"), 314, 152, 0, base, shadow],
[_INTL("Weight"), 314, 184, 0, base, shadow]
["#{indexText} #{species_data.name}", 246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)],
]
if $Trainer.owned?(@species)
# Write the category
# Category
textpos.push([_INTL("{1} Pokémon", species_data.category), 246, 68, 0, base, shadow])
# Write the height and weight
height = species_data.height
weight = species_data.weight
if System.user_language[3..4] == "US" # If the user is in the United States
inches = (height / 0.254).round
pounds = (weight / 0.45359).round
textpos.push([_ISPRINTF("{1:d}'{2:02d}\"", inches / 12, inches % 12), 460, 152, 1, base, shadow])
textpos.push([_ISPRINTF("{1:4.1f} lbs.", pounds / 10.0), 494, 184, 1, base, shadow])
else
textpos.push([_ISPRINTF("{1:.1f} m", height / 10.0), 470, 152, 1, base, shadow])
textpos.push([_ISPRINTF("{1:.1f} kg", weight / 10.0), 482, 184, 1, base, shadow])
end
# Draw the Pokédex entry text
# drawTextEx(overlay, 40, 244, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
# species_data.pokedex_entry, base, shadow)
#
#
#$PokemonSystem.use_generated_dex_entries=true if $PokemonSystem.use_generated_dex_entries ==nil
drawEntryText(overlay, species_data,reloading)
#Weighty / Height
weight_value = species_data.weight / 10.0
weight_unit = _INTL("kg")
height_value = species_data.height / 10.0
height_unit = _INTL("m")
if System.user_language[3..4] == "US"
weight_value = ((weight_value / 0.45359) * 10).round / 10.0 # e.g. 13.2
weight_unit = _INTL("lbs")
# Draw the footprint
footprintfile = GameData::Species.footprint_filename(@species, @form)
if footprintfile
footprint = RPG::Cache.load_bitmap("", footprintfile)
overlay.blt(226, 138, footprint, footprint.rect)
footprint.dispose
total_inches = (height_value / 0.0254).round
feet = total_inches / 12
inches = total_inches % 12
height_text = _INTL("{1}'{2}\"", feet, inches)
height_unit = ""
else
height_text = _INTL("{1} {2}", height_value, height_unit)
end
weight_text = _INTL("{1} {2}", weight_value, weight_unit)
textpos.push(["#{height_text}", 224, 102, 0, base, shadow])
textpos.push(["#{weight_text}", 224, 124, 0, base, shadow])
drawEntryText(overlay, species_data, reloading)
# Show the owned icon
imagepos.push(["Graphics/Pictures/Pokedex/icon_own", 212, 44])
# Draw the type icon(s)
@@ -342,41 +310,56 @@ class PokemonPokedexInfo_Scene
type2_number = GameData::Type.get(type2).id_number
type1rect = Rect.new(0, type1_number * 32, 96, 32)
type2rect = Rect.new(0, type2_number * 32, 96, 32)
overlay.blt(296, 120, @typebitmap.bitmap, type1rect)
overlay.blt(396, 120, @typebitmap.bitmap, type2rect) if type1 != type2
overlay.blt(300, 120, @typebitmap.bitmap, type1rect)
overlay.blt(400, 120, @typebitmap.bitmap, type2rect) if type1 != type2
else
# Write the category
textpos.push([_INTL("????? Pokémon"), 246, 68, 0, base, shadow])
# Write the height and weight
if System.user_language[3..4] == "US" # If the user is in the United States
textpos.push([_INTL("???'??\""), 460, 152, 1, base, shadow])
textpos.push([_INTL("????.? lbs."), 494, 184, 1, base, shadow])
else
textpos.push([_INTL("????.? m"), 470, 152, 1, base, shadow])
textpos.push([_INTL("????.? kg"), 482, 184, 1, base, shadow])
end
end
sprite_author = "Japeal (Generated)"
unless @displayed_pif_sprite.type == :AUTOGEN
echoln @displayed_pif_sprite&.to_filename
sprite_author = getSpriteCredits(@displayed_pif_sprite&.to_filename(false))
end
dex_author = @entry_author if @entry_author
unless dex_author
dex_author = _INTL("Auto-generated")
dex_author = _INTL("None") unless $PokemonSystem.use_generated_dex_entries
dex_author = _INTL("Game Freak") unless getDexNumberForSpecies(@species) > NB_POKEMON
end
textpos.push([_INTL("Sprite: {1}", sprite_author), 224, 156, 0, base, shadow])
textpos.push([_INTL("Entry: {1}", dex_author), 224, 188, 0, base, shadow]) if $Trainer.owned?(@species)
# Draw all text
pbDrawTextPositions(overlay, textpos)
# Draw all images
pbDrawImagePositions(overlay, imagepos)
end
def drawEntryText(overlay, species_data, reloading=false)
def drawEntryText(overlay, species_data, reloading = false)
baseColor = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
baseCustom = Color.new(88, 88, 80)
shadowCustom = Color.new(160, 200, 150)
shadowAI = Color.new(168, 184, 220)
if isDarkMode
baseColor, shadow = shadow, baseColor
baseCustom, shadowCustom = shadowCustom, baseCustom
end
if species_data.is_fusion
customEntry = getCustomEntryText(species_data)
customEntry, entryAuthor = getCustomEntryText(species_data)
if customEntry
entryText = customEntry
@entry_text = entryText
@entry_author = entryAuthor
baseColor = baseCustom
shadowColor = shadowCustom
else
if $PokemonSystem.use_generated_dex_entries && species_data.is_a?(GameData::FusedSpecies)
@randomEntryText = species_data.get_random_dex_entry if !reloading
@randomEntryText = species_data.get_random_dex_entry if !reloading || @randomEntryText.nil?
entryText = @randomEntryText
shadowColor = shadow
else
@@ -438,14 +421,21 @@ class PokemonPokedexInfo_Scene
return !sprite_path.include?(Settings::CUSTOM_BATTLERS_FOLDER)
end
# Returns array
# [text, author]
def getCustomEntryText(species_data)
spriteLoader = BattleSpriteLoader.new
pif_sprite=spriteLoader.get_pif_sprite_from_species(species_data)
if @displayed_pif_sprite
pif_sprite = @displayed_pif_sprite
else
# fallback - should never go through here in theory
pif_sprite = spriteLoader.get_pif_sprite_from_species(species_data)
end
return nil if pif_sprite.type != :CUSTOM
possibleCustomEntries = getCustomDexEntry(pif_sprite)
if possibleCustomEntries && possibleCustomEntries.length > 0
customEntry = possibleCustomEntries.sample
customEntry = customEntry.gsub(Settings::CUSTOM_ENTRIES_NAME_PLACEHOLDER, species_data.name)
customEntry[0] = customEntry[0].gsub(Settings::CUSTOM_ENTRIES_NAME_PLACEHOLDER, species_data.name)
end
return customEntry
end
@@ -457,14 +447,14 @@ class PokemonPokedexInfo_Scene
entries = parsed_data.select { |entry| entry["sprite"] == sprite }
if entries.any?
return entries.map { |entry| entry["entry"] }
return entries.map { |entry| [entry["entry"], entry["author"]] }
else
echoln "No custom entry found for sprite " + sprite.to_s
return nil
end
end
#unused
# unused
def getAIDexEntry(pokemonID, name)
begin
head_number = get_head_number_from_symbol(pokemonID).to_s
@@ -526,6 +516,11 @@ class PokemonPokedexInfo_Scene
overlay = @sprites["overlay"].bitmap
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
if isDarkMode
base, shadow = shadow, base
end
@sprites["areahighlight"].bitmap.clear
# Fill the array "points" with all squares of the region map in which the
# species can be found
@@ -602,6 +597,11 @@ class PokemonPokedexInfo_Scene
overlay = @sprites["overlay"].bitmap
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
if isDarkMode
base, shadow = shadow, base
end
# Write species and form name
formname = ""
for i in @available
@@ -618,7 +618,9 @@ class PokemonPokedexInfo_Scene
end
def pbGoToPrevious
@displayed_pif_sprite = nil
@entry_page = 0
@randomEntryText = nil
newindex = @index
while newindex > 0
newindex -= 1
@@ -630,7 +632,9 @@ class PokemonPokedexInfo_Scene
end
def pbGoToNext
@displayed_pif_sprite = nil
@entry_page = 0
@randomEntryText = nil
newindex = @index
while newindex < @dexlist.length - 1
newindex += 1
@@ -641,113 +645,114 @@ class PokemonPokedexInfo_Scene
end
end
def pbChooseAlt(brief = false)
index = 0
for i in 0...@available.length
if @available[i][1] == @gender && @available[i][2] == @form
index = i
break
end
def updateBlacklistIconVisibility
visible = (@page == 3 && @selecting_sprites && @selecting_blacklist)
visible = false unless $PokemonSystem.random_sprites
%w[
selectedSprite
previousSprite
nextSprite
].each do |base|
next unless @sprites["#{base}_blacklistEnabled"]
@sprites["#{base}_blacklistEnabled"].visible &&= visible
@sprites["#{base}_blacklistDisabled"].visible &&= visible
@sprites["#{base}_blacklistAutogen"].visible &&= visible
end
oldindex = -1
loop do
if oldindex != index
$Trainer.pokedex.set_last_form_seen(@species, @available[index][1], @available[index][2])
pbUpdateDummyPokemon
drawPage(@page)
@sprites["uparrow"].visible = (index > 0)
@sprites["downarrow"].visible = (index < @available.length - 1)
oldindex = index
end
Graphics.update
Input.update
pbUpdate
if Input.trigger?(Input::UP)
pbPlayCursorSE
index = (index + @available.length - 1) % @available.length
elsif Input.trigger?(Input::DOWN)
pbPlayCursorSE
index = (index + 1) % @available.length
elsif Input.trigger?(Input::BACK)
pbPlayCancelSE
break
elsif Input.trigger?(Input::USE)
pbPlayDecisionSE
break
end
end
@sprites["uparrow"].visible = false
@sprites["downarrow"].visible = false
end
def updateBlackListInstructionIcons
visible = (@page == 3 && @fromSummary && !@selecting_sprites)
visible = false unless $PokemonSystem.random_sprites
@sprites["downarrow"].visible = visible
@sprites["blacklistIcon"].visible = visible
end
def pbScene
Pokemon.play_cry(@species, @form)
@selecting_sprites = false
until @endscene
Graphics.update
Input.update
pbUpdate
updateBlackListInstructionIcons
dorefresh = false
if Input.trigger?(Input::ACTION)
#changeEntryPage()
elsif Input.trigger?(Input::BACK)
if Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
break
elsif Input.trigger?(Input::USE)
if @page == 1 # entry
changeEntryPage()
elsif @page == 3 # Forms
#if @available.length > 1
if @page == 1
changeEntryPage
elsif @page == 3
pbPlayDecisionSE
pbChooseAlt
dorefresh = true
# end
end
elsif Input.trigger?(Input::UP)
oldindex = @index
pbGoToPrevious
if @index != oldindex
@selected_index = 0
pbUpdateDummyPokemon
@available = pbGetAvailableForms
pbSEStop
(@page == 1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
dorefresh = true
end
dorefresh = handleVerticalInput(-1)
elsif Input.trigger?(Input::DOWN)
oldindex = @index
pbGoToNext
if @index != oldindex
@selected_index = 0
pbUpdateDummyPokemon
@available = pbGetAvailableForms
pbSEStop
(@page == 1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
dorefresh = true
end
elsif Input.trigger?(Input::LEFT)
dorefresh = handleVerticalInput(1)
elsif Input.trigger?(Input::RIGHT) && @page == 3 && @fromSummary
pbPlayDecisionSE
pbChooseAlt
dorefresh = true
elsif Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)
oldpage = @page
@page -= 2
@page += (Input.trigger?(Input::RIGHT) ? 2 : -2)
@page = 1 if @page < 1
@page = 3 if @page > 3
if @page != oldpage
pbPlayCursorSE
dorefresh = true
end
elsif Input.trigger?(Input::RIGHT)
oldpage = @page
@page += 2
@page = 1 if @page < 1
@page = 3 if @page > 3
if @page != oldpage
pbPlayCursorSE
dorefresh = true
end
pbPlayCursorSE if @page != oldpage
dorefresh = true if @page != oldpage
elsif Input.trigger?(Input::AUX2) && @page == 1
update_displayed_sprite(1)
elsif Input.trigger?(Input::AUX1) && @page == 1
update_displayed_sprite(-1)
end
if dorefresh
drawPage(@page)
drawPage(@page) if dorefresh
end
return @index
end
def update_displayed_sprite(delta)
playCry(@species)
if @available && @available.size > 1
@selected_index = ((@selected_index || 0) + delta) % @available.size
@displayed_pif_sprite = @available[@selected_index]
@sprites["infosprite"].setPokemonBitmapPIFSprite(@displayed_pif_sprite)
else
@displayed_pif_sprite = nil
end
reloadDexEntry()
end
def handleVerticalInput(direction)
dorefresh = false
if @page == 3 && @fromSummary
pbSEPlay("GUI storage show party panel")
@selecting_blacklist = (direction > 0)
pbChooseAlt
else
oldindex = @index
direction > 0 ? pbGoToNext : pbGoToPrevious
if @index != oldindex
@selected_index = 0
pbUpdateDummyPokemon
@available = pbGetAvailableForms
pbSEStop
(@page == 1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
dorefresh = true
end
end
return @index
return dorefresh
end
def pbSceneBrief
@@ -792,7 +797,8 @@ class PokemonPokedexInfoScreen
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
@@ -801,24 +807,26 @@ class PokemonPokedexInfoScreen
else
region = $PokemonGlobal.pokedexDex # National Dex -1, regional Dexes 0, 1, etc.
end
dexnum = GameData::Species.get(species).id_number #pbGetRegionalNumber(region,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, true)
@scene.pbScene
@scene.pbEndScene
end
def pbDexEntry(species)
def pbDexEntry(pokemon)
species = pokemon.species
# 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, pokemon)
@scene.pbSelectSpritesSceneBrief
@scene.pbEndScene
end
@scene.pbStartSceneBrief(species)
@scene.pbStartSceneBrief(pokemon)
@scene.pbSceneBrief
@scene.pbEndScene
end
@@ -0,0 +1,188 @@
#===============================================================================
# Text entry screen - free typing.
#===============================================================================
class PokedexTextEntry
@@Characters=[
[("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").scan(/./),"[*]"],
[("0123456789 !@\#$%^&*() ~`-_+={}[] :;'\"<>,.?/ ").scan(/./),"[A]"],
]
USEKEYBOARD=true
def pbStartScene(helptext,minlength,maxlength,initialText,subject=0,pokemon=nil)
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
if USEKEYBOARD
@sprites["entry"]=Window_TextEntry_Keyboard.new(initialText,
0,0,400-112,96,helptext,false)
Input.text_input = true
else
@sprites["entry"]=Window_TextEntry.new(initialText,0,0,400,96,helptext,false)
end
@sprites["entry"].x=(Graphics.width/2)-(@sprites["entry"].width/2)+32
@sprites["entry"].viewport=@viewport
@sprites["entry"].visible=true
@minlength=minlength
@maxlength=maxlength
@symtype=0
@sprites["entry"].maxlength=maxlength
if !USEKEYBOARD
@sprites["entry2"]=Window_CharacterEntry.new(@@Characters[@symtype][0])
@sprites["entry2"].setOtherCharset(@@Characters[@symtype][1])
@sprites["entry2"].viewport=@viewport
@sprites["entry2"].visible=true
@sprites["entry2"].x=(Graphics.width/2)-(@sprites["entry2"].width/2)
end
if minlength==0
@sprites["helpwindow"]=Window_UnformattedTextPokemon.newWithSize(
_INTL("Enter text using the keyboard. Press\nEnter to confirm, or Esc to cancel."),
32,Graphics.height-96,Graphics.width-64,96,@viewport
)
else
@sprites["helpwindow"]=Window_UnformattedTextPokemon.newWithSize(
_INTL("Enter text using the keyboard.\nPress Enter to confirm."),
32,Graphics.height-96,Graphics.width-64,96,@viewport
)
end
@sprites["helpwindow"].letterbyletter=false
@sprites["helpwindow"].viewport=@viewport
@sprites["helpwindow"].baseColor = pbColor(:LIGHT_TEXT_MAIN_COLOR)
@sprites["helpwindow"].shadowColor = pbColor(:LIGHT_TEXT_SHADOW_COLOR)
case subject
when 1 # Player
meta=GameData::Metadata.get_player($Trainer.character_ID)
if meta
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x=33*2
@sprites["shadow"].y=32*2
filename=pbGetPlayerCharset(meta,1,nil,true)
@sprites["subject"]=TrainerWalkingCharSprite.new(filename,@viewport)
charwidth=@sprites["subject"].bitmap.width
charheight=@sprites["subject"].bitmap.height
@sprites["subject"].x = 44*2 - charwidth/8
@sprites["subject"].y = 38*2 - charheight/4
end
when 2 # Pokémon
if pokemon
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x=33*2
@sprites["shadow"].y=32*2
@sprites["subject"]=PokemonIconSprite.new(pokemon,@viewport)
@sprites["subject"].setOffset(PictureOrigin::Center)
@sprites["subject"].x=88
@sprites["subject"].y=54
@sprites["gender"]=BitmapSprite.new(32,32,@viewport)
@sprites["gender"].x=430
@sprites["gender"].y=54
@sprites["gender"].bitmap.clear
pbSetSystemFont(@sprites["gender"].bitmap)
textpos=[]
if pokemon.male?
textpos.push(["♂",0,-6,false,Color.new(0,128,248),Color.new(168,184,184)])
elsif pokemon.female?
textpos.push(["♀",0,-6,false,Color.new(248,24,24),Color.new(168,184,184)])
end
pbDrawTextPositions(@sprites["gender"].bitmap,textpos)
end
when 3 # NPC
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x=33*2
@sprites["shadow"].y=32*2
@sprites["subject"]=TrainerWalkingCharSprite.new(pokemon.to_s,@viewport)
charwidth=@sprites["subject"].bitmap.width
charheight=@sprites["subject"].bitmap.height
@sprites["subject"].x = 44*2 - charwidth/8
@sprites["subject"].y = 38*2 - charheight/4
when 4 # Storage box
@sprites["subject"]=TrainerWalkingCharSprite.new(nil,@viewport)
@sprites["subject"].altcharset="Graphics/Pictures/Naming/icon_storage"
@sprites["subject"].animspeed=4
charwidth=@sprites["subject"].bitmap.width
charheight=@sprites["subject"].bitmap.height
@sprites["subject"].x = 44*2 - charwidth/8
@sprites["subject"].y = 26*2 - charheight/2
end
pbFadeInAndShow(@sprites)
end
def pbEntry1
ret=""
loop do
Graphics.update
Input.update
if Input.triggerex?(:ESCAPE) && @minlength==0
ret=""
break
elsif Input.triggerex?(:RETURN) && @sprites["entry"].text.length>=@minlength
ret=@sprites["entry"].text
break
end
@sprites["helpwindow"].update
@sprites["entry"].update
@sprites["subject"].update if @sprites["subject"]
end
Input.update
return ret
end
def pbEntry2
ret=""
loop do
Graphics.update
Input.update
@sprites["helpwindow"].update
@sprites["entry"].update
@sprites["entry2"].update
@sprites["subject"].update if @sprites["subject"]
if Input.trigger?(Input::USE)
index=@sprites["entry2"].command
if index==-3 # Confirm text
ret=@sprites["entry"].text
if ret.length<@minlength || ret.length>@maxlength
pbPlayBuzzerSE()
else
pbPlayDecisionSE()
break
end
elsif index==-1 # Insert a space
if @sprites["entry"].insert(" ")
pbPlayDecisionSE()
else
pbPlayBuzzerSE()
end
elsif index==-2 # Change character set
pbPlayDecisionSE()
@symtype+=1
@symtype=0 if @symtype>=@@Characters.length
@sprites["entry2"].setCharset(@@Characters[@symtype][0])
@sprites["entry2"].setOtherCharset(@@Characters[@symtype][1])
else # Insert given character
if @sprites["entry"].insert(@sprites["entry2"].character)
pbPlayDecisionSE()
else
pbPlayBuzzerSE()
end
end
next
end
end
Input.update
return ret
end
def pbEntry
return USEKEYBOARD ? pbEntry1 : pbEntry2
end
def pbEndScene
pbFadeOutAndHide(@sprites)
pbDisposeSpriteHash(@sprites)
@viewport.dispose
Input.text_input = false if USEKEYBOARD
end
end
@@ -4,6 +4,8 @@
class PokemonStorageScene
attr_reader :quickswap
attr_accessor :sprites
attr_accessor :choseFromParty
attr_reader :inTransferBox
def initialize
@command = 1
@@ -41,9 +43,15 @@ class PokemonStorageScene
@quickswap = false
@sprites = {}
@choseFromParty = false
@partyTabBackButton = nil
@command = command
addBackgroundPlane(@sprites, "background", "Storage/bg", @bgviewport)
@sprites["box"] = PokemonBoxSprite.new(@storage, @storage.currentBox, @boxviewport)
checkOpenTransferBox(@storage.currentBox)
@sprites["box"] = PokemonBoxSprite.new(@storage, @storage.currentBox, @boxviewport,true,@screen.filterProc)
# echoln @screen.filterProc
# if @screen.filterProc
# @sprites["box"].setFilterProc(@screen.filterProc)
# end
@sprites["boxsides"] = IconSprite.new(0, 0, @boxsidesviewport)
@sprites["boxsides"].setBitmap("Graphics/Pictures/Storage/overlay_main")
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @boxsidesviewport)
@@ -54,8 +62,8 @@ class PokemonStorageScene
@sprites["pokemon"].y = 134
@sprites["pokemon"].zoom_y = Settings::FRONTSPRITE_SCALE
@sprites["pokemon"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["boxparty"] = PokemonBoxPartySprite.new(@storage.party, @boxsidesviewport)
if command != 2 # Drop down tab only on Deposit
@sprites["boxparty"] = PokemonBoxPartySprite.new(@storage.party, @boxsidesviewport,@screen.filterProc)
if command != 2 && command != 3 # Drop down tab only on Deposit and Select Pokemon
@sprites["boxparty"].x = 182
@sprites["boxparty"].y = Graphics.height
end
@@ -266,7 +274,6 @@ class PokemonStorageScene
end
return selection
end
def pbSelectBoxInternal(_party)
selection = @selection
pbSetArrow(@sprites["arrow"], selection)
@@ -369,6 +376,11 @@ class PokemonStorageScene
end
end
def setStartingTab(symbol)
@command = (symbol == :party ? 1 : 0) # 1 = party, 0 = box
end
def pbSelectPartyInternal(party, depositing)
selection = @selection
pbPartySetArrow(@sprites["arrow"], selection)
@@ -453,7 +465,7 @@ class PokemonStorageScene
end
def pbSwitchBoxToRight(newbox)
newbox = PokemonBoxSprite.new(@storage, newbox, @boxviewport, @sprites["box"].isFusionEnabled)
newbox = PokemonBoxSprite.new(@storage, newbox, @boxviewport, @sprites["box"].isFusionEnabled,@screen.filterProc)
newbox.x = 520
Graphics.frame_reset
distancePerFrame = 64 * 20 / Graphics.frame_rate
@@ -471,10 +483,11 @@ class PokemonStorageScene
@sprites["box"].dispose
@sprites["box"] = newbox
newbox.refreshAllBoxSprites
checkOpenTransferBox(newbox.boxnumber)
end
def pbSwitchBoxToLeft(newbox)
newbox = PokemonBoxSprite.new(@storage, newbox, @boxviewport, @sprites["box"].isFusionEnabled)
newbox = PokemonBoxSprite.new(@storage, newbox, @boxviewport, @sprites["box"].isFusionEnabled,@screen.filterProc)
newbox.x = -152
Graphics.frame_reset
distancePerFrame = 64 * 20 / Graphics.frame_rate
@@ -492,6 +505,7 @@ class PokemonStorageScene
@sprites["box"].dispose
@sprites["box"] = newbox
newbox.refreshAllBoxSprites
checkOpenTransferBox(newbox.boxnumber)
end
def pbJumpToBox(newbox)
@@ -503,8 +517,31 @@ class PokemonStorageScene
end
@storage.currentBox = newbox
end
checkOpenTransferBox(newbox)
end
def checkOpenTransferBox(newbox)
@inTransferBox = @storage[newbox].is_a?(StorageTransferBox)
if @inTransferBox
checkTransferBoxTutorial(newbox)
if @storage[newbox].can_use_transfer_box?
@storage[newbox].loadTransferBoxPokemon
else
@storage[newbox].setDisabled
end
end
end
def checkTransferBoxTutorial(newbox)
isTransferBox = @storage[newbox].is_a?(StorageTransferBox)
if isTransferBox
unless $PokemonGlobal.seen_transfer_box_tutorial
transferBoxTutorial
$PokemonGlobal.seen_transfer_box_tutorial=true
end
end
end
def pbSetMosaic(selection)
if !@screen.pbHeldPokemon
if @boxForMosaic != @storage.currentBox || @selectionForMosaic != selection
@@ -648,13 +685,18 @@ class PokemonStorageScene
def pbChooseBox(msg)
commands = []
boxIndices = []
for i in 0...@storage.maxBoxes
box = @storage[i]
if box
next if box.is_a?(StorageTransferBox)
commands.push(_INTL("{1} ({2}/{3})", box.name, box.nitems, box.length))
boxIndices.push(i)
end
end
return pbShowCommands(msg, commands, @storage.currentBox)
defaultIndex = boxIndices.index(@storage.currentBox) || 0
cmdIndex = pbShowCommands(msg, commands, defaultIndex)
return cmdIndex >= 0 ? boxIndices[cmdIndex] : -1
end
def pbBoxName(helptext, minchars, maxchars)
@@ -835,9 +877,9 @@ class PokemonStorageScene
def pbHardRefresh
oldPartyY = @sprites["boxparty"].y
@sprites["box"].dispose
@sprites["box"] = PokemonBoxSprite.new(@storage, @storage.currentBox, @boxviewport)
@sprites["box"] = PokemonBoxSprite.new(@storage, @storage.currentBox, @boxviewport,@screen.filterProc)
@sprites["boxparty"].dispose
@sprites["boxparty"] = PokemonBoxPartySprite.new(@storage.party, @boxsidesviewport)
@sprites["boxparty"] = PokemonBoxPartySprite.new(@storage.party, @boxsidesviewport,@screen.filterProc)
@sprites["boxparty"].y = oldPartyY
end
@@ -874,6 +916,11 @@ class PokemonStorageScene
shadow = Color.new(168, 184, 184)
nonbase = Color.new(208, 208, 208)
nonshadow = Color.new(224, 224, 224)
if isDarkMode
base, shadow = shadow, base
end
pokename = pokemon.name
textstrings = [
[pokename, 10, 2, false, base, shadow]
@@ -881,27 +928,27 @@ class PokemonStorageScene
if !pokemon.egg?
imagepos = []
if pokemon.male?
textstrings.push([_INTL("♂"), 148, 2, false, Color.new(24, 112, 216), Color.new(136, 168, 208)])
textstrings.push(["♂", 148, 2, false, Color.new(24, 112, 216), Color.new(136, 168, 208)])
elsif pokemon.female?
textstrings.push([_INTL("♀"), 148, 2, false, Color.new(248, 56, 32), Color.new(224, 152, 144)])
textstrings.push(["♀", 148, 2, false, Color.new(248, 56, 32), Color.new(224, 152, 144)])
end
imagepos.push(["Graphics/Pictures/Storage/overlay_lv", 6, 246])
textstrings.push([pokemon.level.to_s, 28, 228, false, base, shadow])
if pokemon.ability
textstrings.push([pokemon.ability.name, 86, 300, 2, base, shadow])
else
textstrings.push([_INTL("No ability"), 86, 300, 2, nonbase, nonshadow])
textstrings.push([_INTL("No ability"), 86, 300, 2, base, nonshadow])
end
if pokemon.item
textstrings.push([pokemon.item.name, 86, 336, 2, base, shadow])
else
textstrings.push([_INTL("No item"), 86, 336, 2, nonbase, nonshadow])
textstrings.push([_INTL("No item"), 86, 336, 2, base, nonshadow])
end
if pokemon.shiny?
addShinyStarsToGraphicsArray(imagepos, 156, 198, pokemon.bodyShiny?, pokemon.headShiny?, pokemon.debugShiny?, nil, nil, nil, nil, false, true)
addShinyStarsToGraphicsArray(imagepos, 156, 198, pokemon.bodyShiny?, pokemon.headShiny?, pokemon.debugShiny?, pokemon.radarShiny?, nil, nil, nil, nil, false, true)
# imagepos.push(["Graphics/Pictures/shiny", 156, 198])
end
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
typebitmap = AnimatedBitmap.new("Graphics/Pictures/types")
type1_number = GameData::Type.get(pokemon.type1).id_number
type2_number = GameData::Type.get(pokemon.type2).id_number
type1rect = Rect.new(0, type1_number * 28, 64, 28)
@@ -943,4 +990,4 @@ class PokemonStorageScene
pbRefresh
end
end
end
@@ -6,15 +6,22 @@ class PokemonStorageScreen
attr_reader :storage
attr_accessor :heldpkmn
attr_accessor :fusionMode
attr_accessor :filterProc
def initialize(scene, storage)
@scene = scene
@storage = storage
@pbHeldPokemon = nil
@command =0
@command = 0
@filterProc = nil
@saveWhenPlaceDown = false
end
def pbStartScreen(command,animate=true)
def setFilter(filterProc)
@filterProc = filterProc
end
def pbStartScreen(command, animate = true)
@heldpkmn = nil
@command = command
if command == 0 # Organise
@@ -26,14 +33,21 @@ class PokemonStorageScreen
elsif command == 2 # Deposit
@scene.pbStartBox(self, command, animate)
pcDepositCommand
elsif command == 3
else
@scene.pbStartBox(self, command, animate)
@scene.pbCloseBox
end
end
# TODO: Open party screen by default.
# Handle when player chooses a Pokemon from their party instead of a box
def choosePokemon
command = COMMAND_SELECT_POKEMON
@scene.pbStartBox(self, command, true)
return pcSelectCommand
end
def pcOrganizeCommand()
isTransferBox = @storage[@storage.currentBox].is_a?(StorageTransferBox)
loop do
selected = @scene.pbSelectBox(@storage.party)
if selected == nil
@@ -65,7 +79,7 @@ class PokemonStorageScreen
if @fusionMode
pbFusionCommands(selected)
else
organizeActions(selected, pokemon, heldpoke, isTransferBox)
organizeActions(selected, pokemon, heldpoke, @scene.inTransferBox)
end
end
end
@@ -87,8 +101,6 @@ class PokemonStorageScreen
cmdCancel = -1
cmdNickname = -1
echoln selected
if heldpoke
helptext = _INTL("{1} is selected.", heldpoke.name)
commands[cmdMove = commands.length] = (pokemon) ? _INTL("Shift") : _INTL("Place")
@@ -109,7 +121,7 @@ class PokemonStorageScreen
commands[cmdWithdraw = commands.length] = (selected[0] == -1) ? _INTL("Store") : _INTL("Withdraw")
commands[cmdItem = commands.length] = _INTL("Item") if !isTransferBox
commands[cmdRelease = commands.length] = _INTL("Release") if !isTransferBox
commands[cmdRelease = commands.length] = _INTL("Release")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
commands[cmdCancel = commands.length] = _INTL("Cancel")
command = pbShowCommands(helptext, commands)
@@ -153,6 +165,51 @@ class PokemonStorageScreen
end
end
def pcSelectCommand
@scene.choseFromParty = true
loop do
selected = @scene.pbSelectBox(@storage.party)
if selected == nil
next if pbConfirm(_INTL("Continue Box operations?"))
break
else
case selected[0]
when -2 # Party Pokémon
pbDisplay(_INTL("Which one will you choose?"))
next
when -3 # Close box
if pbConfirm(_INTL("Cancel choosing a Pokémon?"))
pbSEPlay("PC close")
break
end
return nil
when -4 # Box name
pbBoxCommands
next
end
pokemon = @storage[selected[0], selected[1]]
next if !pokemon
if @filterProc.call(pokemon)
command = pbShowCommands(_INTL("{1} is selected.", pokemon.name), [
_INTL("Choose"),
_INTL("Summary"),
_INTL("Cancel")
])
case command
when 0 then
return selected
when 1 then
pbSummary(selected, nil)
end
else
pbDisplay(_INTL("This Pokémon cannot be chosen..."))
next
end
end
end
@scene.pbCloseBox
end
def pcWithdrawCommand
isTransferBox = @storage[@storage.currentBox].is_a?(StorageTransferBox)
loop do
@@ -325,8 +382,9 @@ class PokemonStorageScreen
pbDisplay(_INTL("Your party's full!"))
return false
end
if @storage[box].is_a?(StorageTransferBox)
if @scene.inTransferBox && @storage[box].can_use_transfer_box?
pokemon = $PokemonStorage[*selected]
return if @storage[box].check_is_duplicate(pokemon)
unless verifyTransferBoxAutosave
return
end
@@ -388,13 +446,13 @@ class PokemonStorageScreen
def pbHold(selected)
box = selected[0]
index = selected[1]
if @storage[box].is_a?(StorageTransferBox)
if @scene.inTransferBox && box != -1
pokemon = $PokemonStorage[*selected]
return if @storage[box].check_is_duplicate(pokemon)
unless verifyTransferBoxAutosave
return
end
end
if box == -1 && pbAble?(@storage[box, index]) && pbAbleCount <= 1
pbPlayBuzzerSE
pbDisplay(_INTL("That's your last Pokémon!"))
@@ -404,18 +462,21 @@ class PokemonStorageScreen
@heldpkmn = @storage[box, index]
@storage.pbDelete(box, index)
@scene.pbRefresh
if @scene.inTransferBox && box != -1
@saveWhenPlaceDown = true
end
end
def pbPlace(selected)
box = selected[0]
index = selected[1]
if @storage[box].is_a?(StorageTransferBox)
if @scene.inTransferBox && box != -1
if @heldpkmn.owner.name == "RENTAL"
pbMessage(_INTL("This Pokémon cannot be transferred."))
return
end
unless verifyTransferBoxAutosave
return if @storage[box].check_is_duplicate(@heldpkmn)
unless verifyTransferBoxAutosave #Warning on the first time
return
end
end
@@ -445,6 +506,10 @@ class PokemonStorageScreen
end
@scene.pbRefresh
@heldpkmn = nil
if @saveWhenPlaceDown
@saveWhenPlaceDown = false
Game.save()
end
end
def pbSwap(selected)
@@ -455,11 +520,14 @@ class PokemonStorageScreen
raise _INTL("Position {1},{2} is empty...", box, index)
end
if @storage[box].is_a?(StorageTransferBox)
if @scene.inTransferBox && box != -1
if @heldpkmn.owner.name == "RENTAL"
pbMessage(_INTL("This Pokémon cannot be transferred."))
return
end
pokemon = $PokemonStorage[*selected]
return if @storage[box].check_is_duplicate(pokemon)
unless verifyTransferBoxAutosave
return
end
@@ -483,6 +551,10 @@ class PokemonStorageScreen
tmp = @storage[box, index]
@storage[box, index] = @heldpkmn
@heldpkmn = tmp
if @saveWhenPlaceDown
@saveWhenPlaceDown = false
Game.save()
end
@scene.pbRefresh
return true
end
@@ -589,8 +661,8 @@ class PokemonStorageScreen
commands = []
commands << cmd_jump
commands << cmd_wallpaper
commands << cmd_name if !@storage[@storage.currentBox].is_a?(StorageTransferBox)
commands << cmd_wallpaper unless @storage[@storage.currentBox].is_a?(StorageTransferBox)
commands << cmd_name unless @storage[@storage.currentBox].is_a?(StorageTransferBox)
commands << cmd_info if @storage[@storage.currentBox].is_a?(StorageTransferBox)
commands << cmd_cancel
@@ -604,23 +676,21 @@ class PokemonStorageScreen
when cmd_name
boxCommandName
when cmd_info
boxCommandTransferInfo
transferBoxTutorial
end
end
def boxCommandTransferInfo
pbMessage(_INTL("This is the Transfer Box. It's used to transfer Pokémon between savefiles!"))
pbMessage(_INTL("Any Pokémon that is placed in this box will be shared between all savefiles of Pokémon Infinite Fusion 1 and Pokémon Infinite Fusion 2."))
end
def boxCommandName
@scene.pbBoxName(_INTL("Box name?"), 0, 20)
end
def boxCommandJump
destbox = @scene.pbChooseBox(_INTL("Jump to which Box?"))
if destbox >= 0
@scene.pbJumpToBox(destbox)
end
end
def boxCommandSetWallpaper
papers = @storage.availableWallpapers
index = 0
@@ -800,7 +870,7 @@ class PokemonStorageScreen
end
isSuperSplicer = isSuperSplicer?(@fusionItem)
selectedHead = selectFusion(pokemon, heldpoke, isSuperSplicer)
selectedHead, selected_sprite = selectFusion(pokemon, heldpoke, isSuperSplicer)
if selectedHead == nil
pbDisplay(_INTL("It won't have any effect."))
return false
@@ -814,7 +884,7 @@ class PokemonStorageScreen
if (Kernel.pbConfirmMessage(_INTL("Fuse the two Pokémon?")))
playingBGM = $game_system.getPlayingBGM
pbFuse(selectedHead, selectedBase, @fusionItem)
pbFuse(selectedHead, selectedBase, @fusionItem, selected_sprite)
if canDeleteItem(@fusionItem)
$PokemonBag.pbDeleteItem(@fusionItem)
end
@@ -859,7 +929,7 @@ class PokemonStorageScreen
scene.pbDisplay(_INTL("It won't have any effect."))
return
end
if Kernel.pbConfirmMessageSerious(_INTL("Should {1} be reversed?", pokemon.name))
if Kernel.pbConfirmMessage(_INTL("Should {1} be reversed?", pokemon.name))
reverseFusion(pokemon)
$PokemonBag.pbDeleteItem(:DNAREVERSER) if $PokemonBag.pbQuantity(:INFINITEREVERSERS) <= 0
end
@@ -875,7 +945,7 @@ class PokemonStorageScreen
item = selectSplicer()
return if item == nil
isSuperSplicer = isSuperSplicer?(item)
if pbUnfuse(pokemon, @scene, isSuperSplicer, selected)
if pbUnfuse(pokemon, @scene, nil, selected)
if canDeleteItem(item)
$PokemonBag.pbDeleteItem(item)
end
@@ -34,6 +34,7 @@ class PokemonStorageScreen
pbHold(selected)
pbDisplay(_INTL("Select a Pokémon to fuse it with"))
@scene.sprites["box"].disableFusions()
return
end
if !poke_body
@@ -109,7 +110,7 @@ class PokemonStorageScreen
end
isSuperSplicer = isSuperSplicer?(@fusionItem)
selectedHead = selectFusion(pokemon, heldpoke, isSuperSplicer)
selectedHead, selected_sprite = selectFusion(pokemon, heldpoke, isSuperSplicer)
if selectedHead == nil
pbDisplay(_INTL("It won't have any effect."))
return false
@@ -123,7 +124,7 @@ class PokemonStorageScreen
if (Kernel.pbConfirmMessage(_INTL("Fuse the two Pokémon?")))
playingBGM = $game_system.getPlayingBGM
pbFuse(selectedHead, selectedBase, @fusionItem)
pbFuse(selectedHead, selectedBase, @fusionItem, selected_sprite)
if canDeleteItem(@fusionItem)
$PokemonBag.pbDeleteItem(@fusionItem)
end
@@ -168,7 +169,7 @@ class PokemonStorageScreen
scene.pbDisplay(_INTL("It won't have any effect."))
return
end
if Kernel.pbConfirmMessageSerious(_INTL("Should {1} be reversed?", pokemon.name))
if Kernel.pbConfirmMessage(_INTL("Should {1} be reversed?", pokemon.name))
reverseFusion(pokemon)
$PokemonBag.pbDeleteItem(:DNAREVERSER) if $PokemonBag.pbQuantity(:INFINITEREVERSERS) <= 0
end
@@ -184,7 +185,7 @@ class PokemonStorageScreen
item = selectSplicer()
return if item == nil
isSuperSplicer = isSuperSplicer?(item)
if pbUnfuse(pokemon, @scene, isSuperSplicer, selected)
if pbUnfuse(pokemon, @scene, nil, selected)
if canDeleteItem(item)
$PokemonBag.pbDeleteItem(item)
end
@@ -9,6 +9,7 @@ class PokemonBoxIcon < IconSprite
@pokemon = pokemon
@release = Interpolator.new
@startRelease = false
@enabled=true
refresh
end
@@ -66,20 +67,20 @@ class PokemonBoxIcon < IconSprite
@startRelease = true
end
def refresh(fusion_enabled = true)
return if !@pokemon
if useRegularIcon(@pokemon.species) || @pokemon.egg?
self.setBitmap(GameData::Species.icon_filename_from_pokemon(@pokemon))
else
self.setBitmapDirectly(createFusionIcon(@pokemon.species, @pokemon.spriteform_head, @pokemon.spriteform_body))
if fusion_enabled
self.visible = true
else
self.opacity = false
end
end
self.src_rect = Rect.new(0, 0, self.bitmap.height, self.bitmap.height)
end
# def refresh(fusion_enabled = true, filter_proc = nil)
# return if !@pokemon
# if useRegularIcon(@pokemon.species) || @pokemon.egg?
# self.setBitmap(GameData::Species.icon_filename_from_pokemon(@pokemon))
# else
# self.setBitmapDirectly(createFusionIcon(@pokemon.species, @pokemon.spriteform_head, @pokemon.spriteform_body))
# if fusion_enabled
# self.visible = true
# else
# self.opacity = false
# end
# end
# self.src_rect = Rect.new(0, 0, self.bitmap.height, self.bitmap.height)
# end
def update
super
@@ -3,16 +3,24 @@
# Party pop-up panel
#===============================================================================
class PokemonBoxPartySprite < SpriteWrapper
def initialize(party, viewport = nil)
attr_accessor :filterProc
def initialize(party, viewport = nil, filter= nil)
super(viewport)
@party = party
@boxbitmap = AnimatedBitmap.new("Graphics/Pictures/Storage/overlay_party")
dark_mode = isDarkMode
party_tab_path ="Graphics/Pictures/Storage/overlay_party"
party_tab_path += "_dark" if dark_mode
@boxbitmap = AnimatedBitmap.new(party_tab_path)
@pokemonsprites = []
@filterProc = filter
for i in 0...Settings::MAX_PARTY_SIZE
@pokemonsprites[i] = nil
pokemon = @party[i]
if pokemon
@pokemonsprites[i] = PokemonBoxIcon.new(pokemon, viewport)
@pokemonsprites[i].apply_filter(@filterProc)
end
end
@contents = BitmapWrapper.new(172, 352)
@@ -90,7 +98,7 @@ class PokemonBoxPartySprite < SpriteWrapper
def refresh
@contents.blt(0, 0, @boxbitmap.bitmap, Rect.new(0, 0, 172, 352))
pbDrawTextPositions(self.bitmap, [
[_INTL("Back"), 86, 240, 2, Color.new(248, 248, 248), Color.new(80, 80, 80), 1]
[_INTL("Boxes"), 86, 240, 2, Color.new(248, 248, 248), Color.new(80, 80, 80), 1]
])
xvalues = [] # [18, 90, 18, 90, 18, 90]
yvalues = [] # [2, 18, 66, 82, 130, 146]
@@ -4,35 +4,43 @@
class PokemonBoxSprite < SpriteWrapper
attr_accessor :refreshBox
attr_accessor :refreshSprites
def initialize(storage, boxnumber, viewport = nil, fusionsEnabled = true)
attr_accessor :filterProc
attr_reader :boxnumber
def initialize(storage, boxnumber, viewport = nil, fusionsEnabled = true, filter = nil)
super(viewport)
@storage = storage
@boxnumber = boxnumber
@refreshBox = true
@refreshSprites = true
@pokemonsprites = []
@filterProc = filter
for i in 0...PokemonBox::BOX_SIZE
@pokemonsprites[i] = nil
pokemon = @storage[boxnumber, i]
@pokemonsprites[i] = PokemonBoxIcon.new(pokemon, viewport)
@pokemonsprites[i].apply_filter(@filterProc)
end
@contents = BitmapWrapper.new(324, 296)
self.bitmap = @contents
self.x = 184
self.y = 18
@fusions_enabled = fusionsEnabled
refresh
end
def setFilterProc(filter)
@filterProc=filter
end
def disableFusions()
@fusions_enabled = false
#@fusions_enabled = false
@filterProc = proc { |pokemon| pokemon&.isFusion? == false }
refreshAllBoxSprites()
end
def enableFusions()
@fusions_enabled = true
@filterProc = nil
# @fusions_enabled = true
refreshAllBoxSprites()
end
@@ -159,11 +167,13 @@ class PokemonBoxSprite < SpriteWrapper
end
end
def refreshAllBoxSprites
# spriteLoader = BattleSpriteLoader.new
#@filterProc is called on the @pokemon object of each BoxIcon.
# If true, full opacity, selectable, otherwise, low opacity, not selectable
def refreshAllBoxSprites()
for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].refresh(@fusions_enabled)
@pokemonsprites[i].refresh
@pokemonsprites[i].apply_filter(@filterProc)
end
# spriteLoader.preload_sprite_from_pokemon(@pokemonsprites[i].pokemon) if @pokemonsprites[i].pokemon
end
@@ -174,6 +184,7 @@ class PokemonBoxSprite < SpriteWrapper
for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].update
#@pokemonsprites[i].apply_filter(@filterProc)
end
end
end