6.4 update (minus sprites)

This commit is contained in:
infinitefusion
2024-12-21 09:43:11 -05:00
parent f70c2cfde4
commit 1e325366d2
1717 changed files with 140299 additions and 27845 deletions

View File

@@ -120,7 +120,8 @@ class PokemonEggHatch_Scene
pbMessage(_INTL("{1}'s data was added to the Pokédex", @pokemon.name))
pbShowPokedex(@pokemon.species)
end
nb_eggs_hatched = pbGet(VAR_NB_EGGS_HATCHED)
pbSet(VAR_NB_EGGS_HATCHED,nb_eggs_hatched+1)
end
def pbEndScene
@@ -233,6 +234,7 @@ Events.onStepTaken += proc { |_sender,_e|
for egg in $Trainer.party
next if egg.steps_to_hatch <= 0
egg.steps_to_hatch -= 1
egg.steps_to_hatch -= 1 if isWearingClothes(CLOTHES_BREEDER)
for i in $Trainer.pokemon_party
next if !i.hasAbility?(:FLAMEBODY) && !i.hasAbility?(:MAGMAARMOR)
egg.steps_to_hatch -= 1

View File

@@ -589,7 +589,8 @@ class PokemonEvolutionScene
# Success jingle/message
pbMEPlay("Evolution success")
sprite_bitmap=@sprites["rsprite2"].getBitmap
drawSpriteCredits(sprite_bitmap.filename,sprite_bitmap.path, @viewport)
#drawSpriteCredits(sprite_bitmap.filename,sprite_bitmap.path, @viewport)
newspeciesname = GameData::Species.get(@newspecies).name
if !reversing
@@ -608,13 +609,10 @@ class PokemonEvolutionScene
pbEvolutionMethodAfterEvolution if !reversing
@pokemon
@pokemon.ability
oldAbility = @pokemon.ability.id
#oldAbility = @pokemon.ability.id if @pokemon.ability
newSpecies = GameData::Species.get(@newspecies)
allNewPossibleAbilities = newSpecies.abilities + newSpecies.hidden_abilities
#allNewPossibleAbilities = newSpecies.abilities + newSpecies.hidden_abilities
# Modify Pokémon to make it evolved
@pokemon.species = @newspecies

View File

@@ -17,7 +17,7 @@
class HallOfFame_Scene
# When true, all pokémon will be in one line
# When false, all pokémon will be in two lines
SINGLEROW = false
@singlerow = true
# Make the pokémon movement ON in hall entry
ANIMATION = true
# Speed in pokémon movement in hall entry. Don't use less than 2!
@@ -34,7 +34,7 @@ class HallOfFame_Scene
# Allow eggs to be show and saved in hall
ALLOWEGGS = true
# Remove the hallbars when the trainer sprite appears
REMOVEBARS = true
REMOVEBARS = false
# The final fade speed on entry
FINALFADESPEED = 16
# Sprites opacity value when them aren't selected
@@ -48,7 +48,8 @@ class HallOfFame_Scene
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
# Comment the below line to doesn't use a background
addBackgroundPlane(@sprites, "bg", "hallfamebg", @viewport)
bgFile = @singlerow ? "hallfamebg" : "hallfamebg_multiline"
addBackgroundPlane(@sprites, "bg", bgFile, @viewport)
@sprites["hallbars"] = IconSprite.new(@viewport)
@sprites["hallbars"].setBitmap("Graphics/Pictures/hallfamebars")
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@@ -61,6 +62,7 @@ class HallOfFame_Scene
end
def pbStartSceneEntry
@singlerow = true
pbStartScene
@useMusic = (ENTRYMUSIC && ENTRYMUSIC != "")
pbBGMPlay(ENTRYMUSIC) if @useMusic
@@ -72,9 +74,12 @@ class HallOfFame_Scene
end
def pbStartScenePC
@singlerow = false
pbStartScene
@hallIndex = $PokemonGlobal.hallOfFame.size - 1
@hallEntry = $PokemonGlobal.hallOfFame[-1]
echoln $PokemonGlobal.hallOfFame[-1]
@hallEntry = $PokemonGlobal.hallOfFame[-1][:TEAM]
createBattlers(false)
pbFadeInAndShow(@sprites) { pbUpdate }
pbUpdatePC
@@ -126,32 +131,61 @@ class HallOfFame_Scene
# Clones every pokémon object
@hallEntry.push($Trainer.party[i].clone) if !$Trainer.party[i].egg? || ALLOWEGGS
end
entryData = {}
entryData[:TEAM] = @hallEntry
entryData[:DIFFICULTY] = getDifficulty
entryData[:MODE] = getCurrentGameMode()
entryData[:DATE] = getCurrentDate()
#Save trainer data (unused for now)
entryData[:TRAINER_HAT] = $Trainer.hat
entryData[:TRAINER_HAT_COLOR] = $Trainer.hat_color
entryData[:TRAINER_HAIR] = $Trainer.hair
entryData[:TRAINER_HAIR_COLOR] = $Trainer.hair_color
entryData[:TRAINER_CLOTHES] = $Trainer.clothes
entryData[:TRAINER_CLOTHES_COLOR] = $Trainer.clothes_color
entryData[:TRAINER_SKIN] = $Trainer.skin_tone
# Update the global variables
$PokemonGlobal.hallOfFame.push(@hallEntry)
$PokemonGlobal.hallOfFame.push(entryData)
$PokemonGlobal.hallOfFameLastNumber += 1
$PokemonGlobal.hallOfFame.delete_at(0) if HALLLIMIT > -1 &&
$PokemonGlobal.hallOfFame.size > HALLLIMIT
$PokemonGlobal.hallOfFame.size > HALLLIMIT
end
# Return the x/y point position in screen for battler index number
# Don't use odd numbers!
def xpointformula(battlernumber)
ret = 0
if !SINGLEROW
if !@singlerow
ret = 92 + 160 * xpositionformula(battlernumber) #32
else
ret = (60 * (battlernumber / 2) + 48) * (xpositionformula(battlernumber) - 1)
ret += Graphics.width / 2 - 56
start_position = -16 #-56
spacing = 70 # spacing between mons
ret = (spacing * (battlernumber / 2) + 48) * (xpositionformula(battlernumber) - 1)
gap_size = 40 #gap for the trainer sprite in the middle
if battlernumber % 2 == 0 #left side
ret -= gap_size / 2
else
ret += gap_size / 2
end
ret += Graphics.width / 2 + start_position
end
return ret
end
def ypointformula(battlernumber)
ret = 0
if !SINGLEROW
if !@singlerow
ret = 92 + 128 * ypositionformula(battlernumber) / 2
else
ret = 96 - 8 * (battlernumber / 2)
y_position_base = 125
height_increase = 20
# Calculate the decrement based on the battlernumber:
# Each pair (1-2, 3-4, etc.) will decrease y by 20
y_decrement = 40 - height_increase * (battlernumber / 2)
ret = y_position_base + y_decrement
end
return ret
end
@@ -159,7 +193,7 @@ class HallOfFame_Scene
# Returns 0, 1 or 2 as the x/y column value
def xpositionformula(battlernumber)
ret = 0
if !SINGLEROW
if !@singlerow
ret = (battlernumber / 3 % 2 == 0) ? (19 - battlernumber) % 3 : (19 + battlernumber) % 3
else
ret = battlernumber % 2 * 2
@@ -169,7 +203,7 @@ class HallOfFame_Scene
def ypositionformula(battlernumber)
ret = 0
if !SINGLEROW
if !@singlerow
ret = (battlernumber / 3) % 2 * 2
else
ret = 1
@@ -221,7 +255,7 @@ class HallOfFame_Scene
@sprites["pokemon#{i}"].x += (128 - @sprites["pokemon#{i}"].bitmap.width) / 2
@sprites["pokemon#{i}"].y += (128 - @sprites["pokemon#{i}"].bitmap.height) / 2
end
@sprites["pokemon#{i}"].z = 7 - i if SINGLEROW
@sprites["pokemon#{i}"].z = 7 - i if @singlerow
next if !hide
# Animation distance calculation
horizontal = 1 - xpositionformula(i)
@@ -246,13 +280,14 @@ class HallOfFame_Scene
def createTrainerBattler
@sprites["trainer"] = IconSprite.new(@viewport)
@sprites["trainer"].setBitmapDirectly(generate_front_trainer_sprite_bitmap())
if !SINGLEROW
if !@singlerow
@sprites["trainer"].x = Graphics.width - 96
@sprites["trainer"].y = 160
else
@sprites["trainer"].x = Graphics.width / 2
@sprites["trainer"].x = Graphics.width / 2 # - 96
@sprites["trainer"].y = 178
end
@sprites["trainer"].opacity = 255
@sprites["trainer"].z = 9
@sprites["trainer"].ox = @sprites["trainer"].bitmap.width / 2
@sprites["trainer"].oy = @sprites["trainer"].bitmap.height / 2
@@ -262,18 +297,18 @@ class HallOfFame_Scene
end
@xmovement[@battlerIndex] = 0
@ymovement[@battlerIndex] = 0
if (ANIMATION && !SINGLEROW) # Trainer Animation
startpoint = Graphics.width / 2
# 2 is the trainer speed
@xmovement[@battlerIndex] = (startpoint - @sprites["trainer"].x) / 2
@sprites["trainer"].x = startpoint
else
ENTRYWAITTIME.times do
Graphics.update
Input.update
pbUpdate
end
end
#if (ANIMATION)#) && !@singlerow) # Trainer Animation
startpoint = (Graphics.width / 2) - 200
# 2 is the trainer speed
@xmovement[@battlerIndex] = (startpoint - @sprites["trainer"].x) / 2
@sprites["trainer"].x = startpoint
# else
# ENTRYWAITTIME.times do
# Graphics.update
# Input.update
# pbUpdate
# end
# end
end
#Get difficulty for displaying in-game
@@ -339,17 +374,35 @@ class HallOfFame_Scene
pbDrawTextPositions(overlay, [[_INTL("Welcome to the Hall of Fame!"),
Graphics.width / 2, Graphics.height - 80, 2, BASECOLOR, SHADOWCOLOR]])
writeCurrentDate(overlay, 120, Graphics.height - 50)
writeDate(overlay, 120, Graphics.height - 50)
writeGameMode(overlay, (Graphics.width / 2) + 100, Graphics.height - 50)
end
def writeCurrentDate(overlay, x, y)
currentTime = Time.new
timeString = currentTime.year.to_s + "-" + ("%02d" % currentTime.month) + "-" + ("%02d" % currentTime.day)
def writeWelcomePC
overlay = @sprites["overlay"].bitmap
overlay.clear
pbDrawTextPositions(overlay, [[_INTL("Entered the Hall of Fame!"),
Graphics.width / 2, Graphics.height - 80, 2, BASECOLOR, SHADOWCOLOR]])
date = $PokemonGlobal.hallOfFame[@hallIndex][:DATE]
mode = $PokemonGlobal.hallOfFame[@hallIndex][:MODE]
difficulty = $PokemonGlobal.hallOfFame[@hallIndex][:DIFFICULTY]
writeDate(overlay, 120, Graphics.height - 50,date) if date
writeGameMode(overlay, (Graphics.width / 2) + 100, Graphics.height - 50, mode, difficulty) if mode && difficulty
end
def writeDate(overlay, x, y, timeString = nil)
timeString = getCurrentDate() if !timeString
pbDrawTextPositions(overlay, [[_INTL("{1}", timeString), x, y, 2, BASECOLOR, SHADOWCOLOR]])
end
def writeGameMode(overlay, x, y)
def getCurrentDate()
currentTime = Time.new
return currentTime.year.to_s + "-" + ("%02d" % currentTime.month) + "-" + ("%02d" % currentTime.day)
end
def getCurrentGameMode()
gameMode = "Classic mode"
if $game_switches[SWITCH_MODERN_MODE]
gameMode = "Remix mode"
@@ -372,8 +425,13 @@ class HallOfFame_Scene
if $game_switches[ENABLED_DEBUG_MODE_AT_LEAST_ONCE] || $DEBUG
gameMode = "Debug mode"
end
return gameMode
end
pbDrawTextPositions(overlay, [[_INTL("{1} ({2})", gameMode, getDifficulty), x, y, 2, BASECOLOR, SHADOWCOLOR]])
def writeGameMode(overlay, x, y, gameMode = nil, difficulty = nil)
gameMode = getCurrentGameMode() if !gameMode
difficulty = getDifficulty() if !difficulty
pbDrawTextPositions(overlay, [[_INTL("{1} ({2})", gameMode, difficulty), x, y, 2, BASECOLOR, SHADOWCOLOR]])
end
def pbAnimationLoop
@@ -437,18 +495,20 @@ class HallOfFame_Scene
# 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
while !(waitForInput)
Graphics.update
Input.update
pbUpdate
end
setPokemonSpritesOpacity(-1, OPACITY) if !SINGLEROW
createTrainerBattler
setPokemonSpritesOpacity(-1, OPACITY) # if !@singlerow
end
end
end
@@ -477,16 +537,23 @@ class HallOfFame_Scene
def pbUpdatePC
# Change the team
if @battlerIndex >= @hallEntry.size
if @battlerIndex >= @hallEntry.size + 1
@hallIndex -= 1
return false if @hallIndex == -1
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex]
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex][:TEAM]
@battlerIndex = 0
createBattlers(false)
elsif @battlerIndex == @hallEntry.size
for n in 0...@hallEntry.size
@sprites["pokemon#{n}"].opacity = 255
end
echoln @hallEntry
writeWelcomePC
return true
elsif @battlerIndex < 0
@hallIndex += 1
return false if @hallIndex >= $PokemonGlobal.hallOfFame.size
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex]
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex][:TEAM]
@battlerIndex = @hallEntry.size - 1
createBattlers(false)
end
@@ -552,9 +619,37 @@ class PokemonGlobalMetadata
# Number necessary if hallOfFame array reach in its size limit
attr_writer :hallOfFameLastNumber
#
# [{:TEAM:[], :DATE:string, :MODE:string, :DIFFICULTY:string}]
#
def hallOfFame
@hallOfFame = [] if !@hallOfFame
if @hallOfFame.size > 0 && @hallOfFame[0].is_a?(Array)
echoln "converting hall of fame"
convertedHallOfFame = []
@hallOfFame.each do |team|
hallOfFame = {}
hallOfFame[:TEAM] = team
hallOfFame[:DATE] = nil
hallOfFame[:MODE] = nil
hallOfFame[:DIFFICULTY] = nil
hallOfFame[:TRAINER_HAT] = nil
hallOfFame[:TRAINER_HAT_COLOR] = nil
hallOfFame[:TRAINER_HAIR] = nil
hallOfFame[:TRAINER_HAIR_COLOR] = nil
hallOfFame[:TRAINER_CLOTHES] = nil
hallOfFame[:TRAINER_CLOTHES_COLOR] = nil
hallOfFame[:TRAINER_SKIN] = nil
convertedHallOfFame << hallOfFame
end
@hallOfFame = convertedHallOfFame
echoln @hallOfFame
end
return @hallOfFame
# @hallOfFame = [] if !@hallOfFame
# return @hallOfFame
end
def hallOfFameLastNumber

View File

@@ -37,33 +37,36 @@ class Scene_Credits
# Backgrounds to show in credits. Found in Graphics/Titles/ folder
BACKGROUNDS_LIST = ["credits1", "credits2", "credits3", "credits4", "credits5"]
BGM = "Credits"
SCROLL_SPEED = 60 # Pixels per second
SECONDS_PER_BACKGROUND = 11
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 (Frogman)
By Chardub (Frogzilla)
General graphics / Music / Intellectual property
Nintendo
GameFreak
Programming / Eventing:
Programming / Game design:
Chardub
Fused Pokemon Sprites :
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.
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
@@ -75,12 +78,6 @@ Gameplay / Story :
Chardub
Kiwikelly
Most of the story and dialogues were based
off Pokémon Red and Blue, as well as
Pokémon Gold and Silver.
Both games are made by Game Freak.
Custom sprites collecting and handling
Kiwikelly, Payapon, Thornsoflight
@@ -94,36 +91,22 @@ Milchik the Miltank<s>Payapon
Pix<s>Rosemagwin
Thornsoflight
All of the custom fused Pokémon sprites
were made by various members of the sp
were made by various members of the
Pokémon Infinite Fusion Discord
Including massive contributions from these users:
Including significant contributions from:
{SPRITER_CREDITS}
Other custom graphics:
Kiwikelly
Knuckles
UnworthyPie
Doctor Miawoo
Chardub
TCGrunler#4583
Kiwikelly<s>Knuckles
UnworthyPie<s>Doctor Miawoo
Chardub<s>TCGrunler#4583
The following free ressources were also used
with their respective authors' consent:
Pokémon Sprites:
The Smogon XY Sprite Project:
Smogon Sun/Moon Sprite Project:
Other sprites:
Hankiro, luckygirl88, Nalty,
OceansLugiaSpirit,Pokemon-Diamond,
rekman, Rick1234, SailorVicious,WolfPP
Public use tileset graphics:
Alucus BoOmxBiG<s>chimcharsfireworkd
EpicDay<s>EternalTakai
@@ -143,24 +126,8 @@ Pokeli, TailDoll666100
Kazune Sawatari, sentsinkantéun,
Nanashima, CharizardTheMaster, The Zame Jack
Public use RPG Maker scripts:
Luka S.J, shiney570, Erasus, Umbreon
FL, KleinStudio, carmaniac, Wootius,
andracass
{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE}
Data sources:
Bulbapedia
PBS files:
Generation 6 for Pokémon Essentials
WorldSlayer
mej71,karstictrainer, WorldSlayer,
TheDeKay, viperk1, SunakazeKun,
Radical Raptr, RPD490,
Takyon!, Pokegod7020, Drakath569,
Florio, MrDeepDarkMind, snooper117
"Pokémon Essentials" was created by:
Flameguru
Poccil (Peter O.)
@@ -195,12 +162,6 @@ All generated fusion sprites in this game
come from the Pokémon Fusion Generator:
https://japeal.com/pkm/
Playtesting and Custom Sprites were made by
various members of the Discord channel.
Special thanks to all of you and to
everyone who has been involved in the
development of the game!
Pokémon is owned by:
The Pokémon Company
Nintendo
@@ -212,7 +173,7 @@ _END_
# Stop Editing
def main
endCredits() if $PokemonSystem.on_mobile
#endCredits() if $PokemonSystem.on_mobile
#-------------------------------
# Animated Background Setup
#-------------------------------
@@ -222,6 +183,7 @@ _END_
@trim = Graphics.height / 10
# Number of game frames per background frame
@realOY = -(Graphics.height - @trim)
@customSpritesList = getSpritesList()
#-------------------------------
# Credits text Setup
#-------------------------------
@@ -325,6 +287,22 @@ _END_
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
@@ -352,15 +330,42 @@ _END_
def update
delta = Graphics.delta_s
@counter += delta
@background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[@bg_index])
@sprites_counter = 0 if !@sprites_counter
#@background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[@bg_index])
# # Go to next slide
# if @counter >= SECONDS_PER_BACKGROUND
# @counter -= SECONDS_PER_BACKGROUND
# @bg_index += 1
# @bg_index = 0 if @bg_index >= BACKGROUNDS_LIST.length
# @background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[@bg_index])
# end
@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

View File

@@ -120,6 +120,7 @@ class PokemonPauseMenu
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
if pbInSafari?
if Settings::SAFARI_STEPS <= 0
@scene.pbShowInfo(_INTL("Balls: {1}", pbSafariState.ballcount))
@@ -217,6 +218,10 @@ class PokemonPauseMenu
screen.pbStartScreen
@scene.pbRefresh
}
elsif cmdOutfit && cmdOutfit >= 0 && command == cmdOutfit
@scene.pbHideMenu
pbCommonEvent(COMMON_EVENT_OUTFIT)
elsif cmdQuit >= 0 && command == cmdQuit
@scene.pbHideMenu
if pbInSafari?

View File

@@ -10,6 +10,7 @@ class PokemonPokedexInfo_Scene
@index = index
@region = region
@page = 1
@entry_page = 0
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
@sprites = {}
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@@ -19,6 +20,7 @@ class PokemonPokedexInfo_Scene
@sprites["infosprite"].y = 136
@sprites["infosprite"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE
@spritesLoader = BattleSpriteLoader.new
# @mapdata = pbLoadTownMapData
# map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
@@ -93,7 +95,7 @@ class PokemonPokedexInfo_Scene
@sprites["downarrow"].visible = false
end
def pbStartSpritesSelectSceneBrief(species,alts_list)
def pbStartSpritesSelectSceneBrief(species, alts_list)
@available = alts_list
@species = species
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@@ -105,7 +107,7 @@ class PokemonPokedexInfo_Scene
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["infosprite"] = PokemonSprite.new(@viewport)
@spritesLoader = BattleSpriteLoader.new
@page = 3
initializeSpritesPageGraphics
initializeSpritesPage(@available)
@@ -188,9 +190,11 @@ class PokemonPokedexInfo_Scene
if @sprites["previousSprite"]
@sprites["previousSprite"].visible = false
end
# species_data = pbGetSpeciesData(@species)
species_data = GameData::Species.get_species_form(@species, @form)
@sprites["infosprite"].setSpeciesBitmap(@species)#, @gender, @form)
@sprites["infosprite"].setSpeciesBitmap(@species) #, @gender, @form)
# if @sprites["formfront"]
# @sprites["formfront"].setSpeciesBitmap(@species,@gender,@form)
@@ -279,7 +283,6 @@ class PokemonPokedexInfo_Scene
overlay = @sprites["overlay"].bitmap
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
shadowCustom = Color.new(160, 200, 150)
imagepos = []
if @brief
@@ -320,12 +323,9 @@ class PokemonPokedexInfo_Scene
# species_data.pokedex_entry, base, shadow)
#
#
customEntry = getCustomEntryText(species_data)
entryText = customEntry ? customEntry : species_data.pokedex_entry
shadowColor = customEntry ? shadowCustom : shadow
drawTextEx(overlay, 40, 244, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
entryText, base, shadowColor)
drawEntryText(overlay, species_data)
# Draw the footprint
footprintfile = GameData::Species.footprint_filename(@species, @form)
if footprintfile
@@ -362,30 +362,95 @@ class PokemonPokedexInfo_Scene
pbDrawImagePositions(overlay, imagepos)
end
def drawEntryText(overlay, species_data)
baseColor = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
shadowCustom = Color.new(160, 200, 150)
shadowAI = Color.new(168, 184, 220)
def reloadDexEntry()
overlay = @sprites["overlay"].bitmap
overlay.clear
drawPageInfo
end
if species_data.is_fusion
customEntry = getCustomEntryText(species_data)
if customEntry
entryText = customEntry
shadowColor = shadowCustom
else
aiEntry = getAIDexEntry(species_data.species, species_data.name)
if aiEntry
entryText = aiEntry
shadowColor = shadowAI
else
entryText = species_data.pokedex_entry
shadowColor = shadow
end
end
else
entryText = species_data.pokedex_entry
shadowColor = shadow
end
max_chars_per_page = 150
pages = splitTextIntoPages(entryText, max_chars_per_page)
@entry_page = 0 if !@entry_page || pages.length == 1
displayedText = pages[@entry_page]
if pages.length > 1
page_indicator_text = "#{@entry_page + 1}/#{pages.length}"
drawTextEx(overlay, 425, 340, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
page_indicator_text, baseColor, shadow)
end
drawTextEx(overlay, 40, 244, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
displayedText, baseColor, shadowColor)
end
def splitTextIntoPages(text, max_chars_per_page)
words = text.split
pages = []
current_page = ""
words.each do |word|
if current_page.length + word.length + 1 > max_chars_per_page
pages << current_page.strip
current_page = word
else
current_page += " " unless current_page.empty?
current_page += word
end
end
pages << current_page.strip unless current_page.empty?
pages
end
def reloadDexEntry()
overlay = @sprites["overlay"].bitmap
overlay.clear
drawPageInfo
end
def changeEntryPage()
pbSEPlay("GUI sel cursor")
@entry_page = @entry_page == 1 ? 0 : 1
reloadDexEntry
end
def isAutogenSprite(sprite_path)
return !sprite_path.include?(Settings::CUSTOM_BATTLERS_FOLDER)
end
def getCustomEntryText(species_data)
sprite_bitmap= GameData::Species.sprite_bitmap(species_data.species)
return nil if isAutogenSprite(sprite_bitmap.path)
spritename = sprite_bitmap.filename
possibleCustomEntries = getCustomDexEntry(spritename)
spriteLoader = BattleSpriteLoader.new
pif_sprite=spriteLoader.get_pif_sprite_from_species(species_data)
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 = customEntry.gsub(Settings::CUSTOM_ENTRIES_NAME_PLACEHOLDER, species_data.name)
end
return customEntry
end
def getCustomDexEntry(sprite)
def getCustomDexEntry(pif_sprite)
sprite = pif_sprite.to_filename()
json_data = File.read(Settings::CUSTOM_DEX_ENTRIES_PATH)
parsed_data = HTTPLite::JSON.parse(json_data)
@@ -398,6 +463,52 @@ end
end
end
def getAIDexEntry(pokemonID, name)
begin
head_number = get_head_number_from_symbol(pokemonID).to_s
body_number = get_body_number_from_symbol(pokemonID).to_s
# Ensure the file exists, if not, create it
unless File.exist?(Settings::AI_DEX_ENTRIES_PATH)
File.write(Settings::AI_DEX_ENTRIES_PATH, '{}')
end
json_data = File.read(Settings::AI_DEX_ENTRIES_PATH)
data = HTTPLite::JSON.parse(json_data)
# Check if the entry exists
unless data[head_number] && data[head_number][body_number]
# If not, fetch it from the API
url = Settings::AI_ENTRIES_URL + "?head=#{head_number}&body=#{body_number}"
if !requestRateExceeded?(Settings::AI_ENTRIES_RATE_LOG_FILE, Settings::AI_ENTRIES_RATE_TIME_WINDOW, Settings::AI_ENTRIES_RATE_MAX_NB_REQUESTS)
fetched_entry = clean_json_string(pbDownloadToString(url))
else
echoln "API rate exceeded for AI entries"
end
return nil if !fetched_entry || fetched_entry.empty?
# If the fetched entry is valid, update the JSON and save it
unless fetched_entry.empty?
data[head_number] ||= {}
data[head_number][body_number] = fetched_entry
serialized_data = serialize_json(data)
File.write(Settings::AI_DEX_ENTRIES_PATH, serialized_data)
else
echoln "No AI entry found for Pokemon " + pokemonID.to_s
return nil
end
end
entry = data[head_number][body_number]
entry = entry.gsub(Settings::CUSTOM_ENTRIES_NAME_PLACEHOLDER, name)
entry = entry.gsub("\n", "")
# Unescape any escaped quotes before returning the entry
entry = entry.gsub('\\"', '"')
return clean_json_string(entry)
rescue MKXPError
return nil
end
end
def pbFindEncounter(enc_types, species)
return false if !enc_types
@@ -505,6 +616,7 @@ end
end
def pbGoToPrevious
@entry_page = 0
newindex = @index
while newindex > 0
newindex -= 1
@@ -516,6 +628,7 @@ end
end
def pbGoToNext
@entry_page = 0
newindex = @index
while newindex < @dexlist.length - 1
newindex += 1
@@ -526,7 +639,7 @@ end
end
end
def pbChooseAlt(brief=false)
def pbChooseAlt(brief = false)
index = 0
for i in 0...@available.length
if @available[i][1] == @gender && @available[i][2] == @form
@@ -573,15 +686,13 @@ end
pbUpdate
dorefresh = false
if Input.trigger?(Input::ACTION)
pbSEStop
#reloadDexEntry()
Pokemon.play_cry(@species, @form) if @page == 1
changeEntryPage()
elsif Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
break
elsif Input.trigger?(Input::USE)
if @page == 2 # Area
# dorefresh = true
if @page == 1 # entry
changeEntryPage()
elsif @page == 3 # Forms
#if @available.length > 1
pbPlayDecisionSE
@@ -593,7 +704,7 @@ end
oldindex = @index
pbGoToPrevious
if @index != oldindex
@selected_index=0
@selected_index = 0
pbUpdateDummyPokemon
@available = pbGetAvailableForms
pbSEStop
@@ -604,7 +715,7 @@ end
oldindex = @index
pbGoToNext
if @index != oldindex
@selected_index=0
@selected_index = 0
pbUpdateDummyPokemon
@available = pbGetAvailableForms
pbSEStop
@@ -644,7 +755,7 @@ end
Input.update
pbUpdate
if Input.trigger?(Input::ACTION)
pbSEStop
changeEntryPage()
Pokemon.play_cry(@species, @form)
elsif Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
@@ -652,24 +763,14 @@ end
elsif Input.trigger?(Input::USE)
pbPlayDecisionSE
break
elsif Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
changeEntryPage()
end
end
end
def pbSelectSpritesSceneBrief
pbChooseAlt(true)
# loop do
# Graphics.update
# Input.update
# pbUpdate
# if Input.trigger?(Input::ACTION)
# pbPlayDecisionSE
# elsif Input.trigger?(Input::BACK)
# pbPlayCloseMenuSE
# break
# end
# end
end
end
@@ -711,7 +812,7 @@ class PokemonPokedexInfoScreen
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)
@scene.pbSelectSpritesSceneBrief
@scene.pbEndScene
end

View File

@@ -1015,7 +1015,7 @@ class PokemonPartyScreen
@scene.pbAnnotate(nil)
end
def pbPokemonMultipleEntryScreenEx(ruleset)
def pbPokemonMultipleEntryScreenEx(ruleset,ableProc=nil)
annot = []
statuses = []
ordinals = [_INTL("INELIGIBLE"), _INTL("NOT ENTERED"), _INTL("BANNED")]
@@ -1033,8 +1033,11 @@ class PokemonPartyScreen
ret = nil
addedEntry = false
for i in 0...@party.length
statuses[i] = (ruleset.isPokemonValid?(@party[i])) ? 1 : 2
statuses[i] = (ruleset.isPokemonValid?(@party[i],ableProc)) ? 1 : 2
end
for i in 0...@party.length
annot[i] = ordinals[statuses[i]]
end

View File

@@ -1331,6 +1331,7 @@ class PokemonSummary_Scene
end
def pbPokemonHatFromSummary(pokemon)
echoln pokemon.hat
cmd = 0
msg = "What should you do?"
loop do
@@ -1338,7 +1339,6 @@ class PokemonSummary_Scene
_INTL("Put on hat"),
_INTL("Remove hat"),
_INTL("Back")])
echoln cmd
break if cmd == -1
if cmd == 0 #Put on hat
@sprites["pokemon"].visible=false

View File

@@ -7,98 +7,114 @@ class PokemonTrainerCard_Scene
end
def pbStartScene
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@sprites = {}
background = pbResolveBitmap(sprintf("Graphics/Pictures/Trainer Card/bg_f"))
if $Trainer.female? && background
addBackgroundPlane(@sprites,"bg","Trainer Card/bg_f",@viewport)
else
addBackgroundPlane(@sprites,"bg","Trainer Card/bg",@viewport)
end
cardexists = pbResolveBitmap(sprintf("Graphics/Pictures/Trainer Card/card_f"))
@sprites["card"] = IconSprite.new(0,0,@viewport)
setCardBackground()
is_postgame = $game_switches[SWITCH_BEAT_THE_LEAGUE]
if $Trainer.female? && cardexists
path = "Graphics/Pictures/Trainer Card/card_f"
if is_postgame
path+="_postgame"
end
@sprites["card"].setBitmap(path)
else
path = "Graphics/Pictures/Trainer Card/card"
if is_postgame
path+="_postgame"
end
@sprites["card"].setBitmap(path)
end
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
overlay_version = is_postgame ? "overlay_postgame" : "overlay"
addBackgroundPlane(@sprites, "highlights", "Trainer Card/#{overlay_version}", @viewport)
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
pbSetSystemFont(@sprites["overlay"].bitmap)
@sprites["trainer"] = IconSprite.new(336,112,@viewport)
@sprites["trainer"] = IconSprite.new(336, 112, @viewport)
@sprites["trainer"].setBitmapDirectly(generate_front_trainer_sprite_bitmap())
@sprites["trainer"].x -= (@sprites["trainer"].bitmap.width-128)/2
@sprites["trainer"].y -= (@sprites["trainer"].bitmap.height-128)
@sprites["trainer"].x -= (@sprites["trainer"].bitmap.width - 128) / 2
@sprites["trainer"].y -= (@sprites["trainer"].bitmap.height - 128)
@sprites["trainer"].z = 2
pbDrawTrainerCardFront
pbFadeInAndShow(@sprites) { pbUpdate }
end
def setCardBackground()
background_img = $Trainer.card_background ? $Trainer.card_background : "BLUE"
background_img_path = "Graphics/Pictures/Trainer Card/backgrounds/#{background_img}"
cardexists = pbResolveBitmap(sprintf(background_img_path))
@sprites["card"] = IconSprite.new(0, 0, @viewport)
if cardexists
@sprites["card"].setBitmap(background_img_path) if cardexists
else
@sprites["card"].setBitmap("Graphics/Pictures/Trainer Card/card")
end
@sprites["card"].z=-100
end
def promptSwapBackground()
$Trainer.unlocked_card_backgrounds = [] if !$Trainer.unlocked_card_backgrounds
if $Trainer.unlocked_card_backgrounds.length >= 1
if pbConfirmMessage("Swap your current Trainer Card background")
chosen = pbListScreen("Trainer card", TrainerCardBackgroundLister.new($Trainer.unlocked_card_backgrounds))
echoln chosen
if chosen
$Trainer.card_background = chosen
pbSEPlay("GUI trainer card open")
setCardBackground()
end
end
else
pbMessage("You can purchase new Trainer Card backgrounds at PokéMarts!")
end
end
def pbDrawTrainerCardFront
overlay = @sprites["overlay"].bitmap
overlay.clear
baseColor = Color.new(72,72,72)
shadowColor = Color.new(160,160,160)
baseColor = Color.new(72, 72, 72)
shadowColor = Color.new(160, 160, 160)
totalsec = Graphics.frame_count / Graphics.frame_rate
hour = totalsec / 60 / 60
min = totalsec / 60 % 60
time = (hour>0) ? _INTL("{1}h {2}m",hour,min) : _INTL("{1}m",min)
time = (hour > 0) ? _INTL("{1}h {2}m", hour, min) : _INTL("{1}m", min)
$PokemonGlobal.startTime = pbGetTimeNow if !$PokemonGlobal.startTime
starttime = _INTL("{1} {2}, {3}",
pbGetAbbrevMonthName($PokemonGlobal.startTime.mon),
$PokemonGlobal.startTime.day,
$PokemonGlobal.startTime.year)
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("ID No."),332,58,0,baseColor,shadowColor],
[sprintf("%05d",$Trainer.public_ID),468,58,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]
[_INTL("Name"), 34, 58, 0, baseColor, shadowColor],
[$Trainer.name, 302, 58, 1, baseColor, shadowColor],
[_INTL("ID No."), 332, 58, 0, baseColor, shadowColor],
[sprintf("%05d", $Trainer.public_ID), 468, 58, 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)
pbDrawTextPositions(overlay, textPositions)
x = 72
imagePositions = []
postgame = $game_switches[SWITCH_BEAT_THE_LEAGUE]
numberOfBadgesDisplayed = postgame ? 16 : 8
for i in 0...numberOfBadgesDisplayed
badgeRow= i<8 ? 0 : 1
badgeRow = i < 8 ? 0 : 1
if $Trainer.badges[i]
if i == 8
x =72
x = 72
end
badge_graphic_x = badgeRow == 0 ? i*32 : (i-8)*32
badge_graphic_y =badgeRow*32
y = getBadgeDisplayHeight(postgame,i)
imagePositions.push(["Graphics/Pictures/Trainer Card/icon_badges",x,y,badge_graphic_x,badge_graphic_y,32,32])
badge_graphic_x = badgeRow == 0 ? i * 32 : (i - 8) * 32
badge_graphic_y = badgeRow * 32
y = getBadgeDisplayHeight(postgame, i)
imagePositions.push(["Graphics/Pictures/Trainer Card/icon_badges", x, y, badge_graphic_x, badge_graphic_y, 32, 32])
end
x += 48
end
pbDrawImagePositions(overlay,imagePositions)
pbDrawImagePositions(overlay, imagePositions)
end
def getBadgeDisplayHeight(postgame,i)
def getBadgeDisplayHeight(postgame, i)
if postgame
if i < 8
y=310
y = 310
else
y=344
y = 344
end
else
y = 312
@@ -112,6 +128,9 @@ class PokemonTrainerCard_Scene
Graphics.update
Input.update
pbUpdate
if Input.trigger?(Input::USE)
promptSwapBackground()
end
if Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
break

View File

@@ -21,6 +21,7 @@ class PokemonSystem
attr_accessor :speedup_speed
attr_accessor :max_nb_sprites_download
attr_accessor :on_mobile
attr_accessor :type_icons
def initialize
@textspeed = 1 # Text speed (0=slow, 1=normal, 2=fast)
@@ -40,7 +41,8 @@ class PokemonSystem
@speedup_speed = 3 #for hold only
@download_sprites = 0
@max_nb_sprites_download = 5
@on_mobile = false
@type_icons = true
end
end

View File

@@ -2,6 +2,7 @@
# Pokémon icons
#===============================================================================
class PokemonBoxIcon < IconSprite
attr_accessor :pokemon
def initialize(pokemon, viewport = nil)
super(0, 0, viewport)
@pokemon = pokemon
@@ -516,10 +517,12 @@ class PokemonBoxSprite < SpriteWrapper
end
def refreshAllBoxSprites
# spriteLoader = BattleSpriteLoader.new
for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].refresh(@fusions_enabled)
end
#spriteLoader.preload_sprite_from_pokemon(@pokemonsprites[i].pokemon) if @pokemonsprites[i].pokemon
end
end
@@ -2040,6 +2043,11 @@ class PokemonStorageScreen
end
command = pbShowCommands(_INTL("Release this Pokémon?"), [_INTL("No"), _INTL("Yes")])
if command == 1
if pokemon.owner.name == "RENTAL"
pbDisplay(_INTL("This Pokémon cannot be released"))
return
end
pkmnname = pokemon.name
@scene.pbRelease(selected, heldpoke)
if heldpoke

View File

@@ -235,8 +235,23 @@ def pbTrainerPC
pbSEPlay("PC close")
end
def checkPorygonEncounter
porygon_chance = 200
if $PokemonGlobal.stepcount % porygon_chance == 0
pbSEPlay("Paralyze3")
pbWait(12)
pbMessage(_INTL("Huh? The PC glitched for a second while it booted."))
pbMessage(_INTL("Did something make its way into the PC?"))
pbWait(8)
pbAddPokemonSilent(:PORYGON,1)
$PokemonGlobal.stepcount += 1
end
# code here
end
def pbPokeCenterPC
pbMessage(_INTL("\\se[PC open]{1} booted up the PC.",$Trainer.name))
checkPorygonEncounter()
command = 0
loop do
commands = PokemonPCList.getCommandList

View File

@@ -11,7 +11,7 @@ class PokemonMartAdapter
end
def setMoney(value)
$Trainer.money=value
$Trainer.money = value
end
def getInventory
@@ -87,6 +87,29 @@ class PokemonMartAdapter
def getShadowColorOverride(item)
return nil
end
#specialType is a symbol
def getSpecialItemCaption(specialType)
return nil
end
def getSpecialItemDescription(specialType)
return nil
end
def doSpecialItemAction(specialType)
return nil
end
def getSpecialItemBaseColor(specialType)
return nil
end
def getSpecialItemShadowColor(specialType)
return nil
end
end
#===============================================================================
@@ -116,6 +139,22 @@ class BuyAdapter
def isSelling?
return false
end
def getSpecialItemCaption(specialType)
return @adapter.getSpecialItemCaption(specialType)
end
def getSpecialItemBaseColor(specialType)
return @adapter.getSpecialItemBaseColor(specialType)
end
def getSpecialItemShadowColor(specialType)
return @adapter.getSpecialItemShadowColor(specialType)
end
def getAdapter()
return @adapter
end
end
#===============================================================================
@@ -157,12 +196,12 @@ end
#===============================================================================
class Window_PokemonMart < Window_DrawableCommand
def initialize(stock, adapter, x, y, width, height, viewport = nil)
@stock = stock
@adapter = adapter
@stock = stock
@adapter = adapter
super(x, y, width, height, viewport)
@selarrow = AnimatedBitmap.new("Graphics/Pictures/martSel")
@baseColor = Color.new(88,88,80)
@shadowColor = Color.new(168,184,184)
@selarrow = AnimatedBitmap.new("Graphics/Pictures/martSel")
@baseColor = Color.new(88, 88, 80)
@shadowColor = Color.new(168, 184, 184)
self.windowskin = nil
end
@@ -178,23 +217,29 @@ class Window_PokemonMart < Window_DrawableCommand
textpos = []
rect = drawCursor(index, rect)
ypos = rect.y
if index == count-1
if index == count - 1
textpos.push([_INTL("CANCEL"), rect.x, ypos - 4, false, self.baseColor, self.shadowColor])
else
item = @stock[index]
itemname = @adapter.getDisplayName(item)
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
textpos.push([itemname, rect.x, ypos - 4, false, baseColor, shadowColor])
else
itemname = @adapter.getDisplayName(item)
baseColorOverride = @adapter.getBaseColorOverride(item)
shadowColorOverride = @adapter.getShadowColorOverride(item)
baseColorOverride = @adapter.getBaseColorOverride(item)
shadowColorOverride = @adapter.getShadowColorOverride(item)
baseColor = baseColorOverride ? baseColorOverride : self.baseColor
shadowColor = shadowColorOverride ? shadowColorOverride : self.shadowColor
baseColor = baseColorOverride ? baseColorOverride : self.baseColor
shadowColor = shadowColorOverride ? shadowColorOverride : self.shadowColor
qty = @adapter.getDisplayPrice(item)
sizeQty = self.contents.text_size(qty).width
xQty = rect.x + rect.width - sizeQty - 2 - 16
textpos.push([itemname, rect.x, ypos - 4, false, baseColor, shadowColor])
textpos.push([qty, xQty, ypos - 4, false, baseColor, shadowColor])
qty = @adapter.getDisplayPrice(item)
sizeQty = self.contents.text_size(qty).width
xQty = rect.x + rect.width - sizeQty - 2 - 16
textpos.push([itemname, rect.x, ypos - 4, false, baseColor, shadowColor])
textpos.push([qty, xQty, ypos - 4, false, baseColor, shadowColor])
end
end
pbDrawTextPositions(self.contents, textpos)
end
@@ -204,7 +249,7 @@ end
#
#===============================================================================
class PokemonMart_Scene
def initialize(currency_name="Money")
def initialize(currency_name = "Money")
@currency_name = currency_name
end
@@ -223,7 +268,7 @@ class PokemonMart_Scene
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit shopping.")
itemwindow.refresh
end
@sprites["moneywindow"].text = _INTL("{2}:\r\n<r>{1}", @adapter.getMoneyString,@currency_name)
@sprites["moneywindow"].text = _INTL("{2}:\r\n<r>{1}", @adapter.getMoneyString, @currency_name)
end
def scroll_map()
@@ -408,7 +453,7 @@ class PokemonMart_Scene
wasbusy = cw.busy?
self.update
if !cw.busy? && !yielded
yield if block_given? # For playing SE as soon as the message is all shown
yield if block_given? # For playing SE as soon as the message is all shown
yielded = true
end
pbRefresh if !cw.busy? && wasbusy
@@ -451,16 +496,16 @@ class PokemonMart_Scene
end
end
def pbChooseNumber(helptext,item,maximum)
def pbChooseNumber(helptext, item, maximum)
curnumber = 1
ret = 0
helpwindow = @sprites["helpwindow"]
itemprice = @adapter.getPrice(item, !@buying)
itemprice /= 2 if !@buying
pbDisplay(helptext, true)
using(numwindow = Window_AdvancedTextPokemon.new("")) { # Showing number of items
using(numwindow = Window_AdvancedTextPokemon.new("")) { # Showing number of items
qty = @adapter.getQuantity(item)
using(inbagwindow = Window_AdvancedTextPokemon.new("")) { # Showing quantity in bag
using(inbagwindow = Window_AdvancedTextPokemon.new("")) { # Showing quantity in bag
pbPrepareWindow(numwindow)
pbPrepareWindow(inbagwindow)
numwindow.viewport = @viewport
@@ -565,10 +610,10 @@ end
#
#===============================================================================
class PokemonMartScreen
def initialize(scene,stock,adapter=PokemonMartAdapter.new)
@scene=scene
@stock=stock
@adapter=adapter
def initialize(scene, stock, adapter = PokemonMartAdapter.new)
@scene = scene
@stock = stock
@adapter = adapter
end
def pbConfirm(msg)
@@ -579,52 +624,52 @@ class PokemonMartScreen
return @scene.pbDisplay(msg)
end
def pbDisplayPaused(msg,&block)
return @scene.pbDisplayPaused(msg,&block)
def pbDisplayPaused(msg, &block)
return @scene.pbDisplayPaused(msg, &block)
end
def pbBuyScreen
@scene.pbStartBuyScene(@stock,@adapter)
item=nil
@scene.pbStartBuyScene(@stock, @adapter)
item = nil
loop do
pbWait(4)
item=@scene.pbChooseBuyItem
item = @scene.pbChooseBuyItem
break if !item
quantity=0
itemname=@adapter.getDisplayName(item)
price=@adapter.getPrice(item)
if @adapter.getMoney<price
quantity = 0
itemname = @adapter.getDisplayName(item)
price = @adapter.getPrice(item)
if @adapter.getMoney < price
pbDisplayPaused(_INTL("You don't have enough money."))
next
end
if GameData::Item.get(item).is_important?
if !pbConfirm(_INTL("Certainly. You want {1}. That will be ${2}. OK?",
itemname,price.to_s_formatted))
itemname, price.to_s_formatted))
next
end
quantity=1
quantity = 1
else
maxafford = (price <= 0) ? Settings::BAG_MAX_PER_SLOT : @adapter.getMoney / price
maxafford = Settings::BAG_MAX_PER_SLOT if maxafford > Settings::BAG_MAX_PER_SLOT
quantity=@scene.pbChooseNumber(
_INTL("{1}? Certainly. How many would you like?",itemname),item,maxafford)
next if quantity==0
price*=quantity
quantity = @scene.pbChooseNumber(
_INTL("{1}? Certainly. How many would you like?", itemname), item, maxafford)
next if quantity == 0
price *= quantity
if !pbConfirm(_INTL("{1}, and you want {2}. That will be ${3}. OK?",
itemname,quantity,price.to_s_formatted))
itemname, quantity, price.to_s_formatted))
next
end
end
if @adapter.getMoney<price
if @adapter.getMoney < price
pbDisplayPaused(_INTL("You don't have enough money."))
next
end
added=0
added = 0
quantity.times do
break if !@adapter.addItem(item)
added+=1
added += 1
end
if added!=quantity
if added != quantity
added.times do
if !@adapter.removeItem(item)
raise _INTL("Failed to delete stored items")
@@ -632,16 +677,16 @@ class PokemonMartScreen
end
pbDisplayPaused(_INTL("You have no more room in the Bag."))
else
@adapter.setMoney(@adapter.getMoney-price)
@adapter.setMoney(@adapter.getMoney - price)
for i in 0...@stock.length
if GameData::Item.get(@stock[i]).is_important? && $PokemonBag.pbHasItem?(@stock[i])
@stock[i]=nil
@stock[i] = nil
end
end
@stock.compact!
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }
if $PokemonBag
if quantity>=10 && GameData::Item.get(item).is_poke_ball? && GameData::Item.exists?(:PREMIERBALL)
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."))
end
@@ -653,35 +698,35 @@ class PokemonMartScreen
end
def pbSellScreen
item=@scene.pbStartSellScene(@adapter.getInventory,@adapter)
item = @scene.pbStartSellScene(@adapter.getInventory, @adapter)
loop do
item=@scene.pbChooseSellItem
item = @scene.pbChooseSellItem
break if !item
itemname=@adapter.getDisplayName(item)
price=@adapter.getPrice(item,true)
itemname = @adapter.getDisplayName(item)
price = @adapter.getPrice(item, true)
if !@adapter.canSell?(item)
pbDisplayPaused(_INTL("{1}? Oh, no. I can't buy that.",itemname))
pbDisplayPaused(_INTL("{1}? Oh, no. I can't buy that.", itemname))
next
end
qty=@adapter.getQuantity(item)
next if qty==0
qty = @adapter.getQuantity(item)
next if qty == 0
@scene.pbShowMoney
if qty>1
qty=@scene.pbChooseNumber(
_INTL("{1}? How many would you like to sell?",itemname),item,qty)
if qty > 1
qty = @scene.pbChooseNumber(
_INTL("{1}? How many would you like to sell?", itemname), item, qty)
end
if qty==0
if qty == 0
@scene.pbHideMoney
next
end
price/=2
price*=qty
if pbConfirm(_INTL("I can pay ${1}. Would that be OK?",price.to_s_formatted))
@adapter.setMoney(@adapter.getMoney+price)
price /= 2
price *= qty
if pbConfirm(_INTL("I can pay ${1}. Would that be OK?", price.to_s_formatted))
@adapter.setMoney(@adapter.getMoney + price)
qty.times do
@adapter.removeItem(item)
end
pbDisplayPaused(_INTL("Turned over the {1} and received ${2}.",itemname,price.to_s_formatted)) { pbSEPlay("Mart buy item") }
pbDisplayPaused(_INTL("Turned over the {1} and received ${2}.", itemname, price.to_s_formatted)) { pbSEPlay("Mart buy item") }
@scene.pbRefresh
end
@scene.pbHideMoney
@@ -694,8 +739,8 @@ def replaceShopStockWithRandomized(stock)
if $PokemonGlobal.randomItemsHash != nil
newStock = []
for item in stock
newItem =$PokemonGlobal.randomItemsHash[item]
if newItem != nil && GameData::Item.get(newItem).price >0 && !Settings::EXCLUDE_FROM_RANDOM_SHOPS.include?(newItem)
newItem = $PokemonGlobal.randomItemsHash[item]
if newItem != nil && GameData::Item.get(newItem).price > 0 && !Settings::EXCLUDE_FROM_RANDOM_SHOPS.include?(newItem)
newStock << newItem
else
newStock << item
@@ -709,7 +754,7 @@ end
#===============================================================================
#
#===============================================================================
def pbPokemonMart(stock,speech=nil,cantsell=false)
def pbPokemonMart(stock, speech = nil, cantsell = false)
if $game_switches[SWITCH_RANDOM_ITEMS_GENERAL] && $game_switches[SWITCH_RANDOM_SHOP_ITEMS]
stock = replaceShopStockWithRandomized(stock)
end
@@ -720,30 +765,30 @@ def pbPokemonMart(stock,speech=nil,cantsell=false)
end
stock.compact!
commands = []
cmdBuy = -1
cmdBuy = -1
cmdSell = -1
cmdQuit = -1
commands[cmdBuy = commands.length] = _INTL("Buy")
commands[cmdBuy = commands.length] = _INTL("Buy")
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?"),
commands,cmdQuit+1)
commands, cmdQuit + 1)
loop do
if cmdBuy>=0 && cmd==cmdBuy
if cmdBuy >= 0 && cmd == cmdBuy
scene = PokemonMart_Scene.new
screen = PokemonMartScreen.new(scene,stock)
screen = PokemonMartScreen.new(scene, stock)
screen.pbBuyScreen
elsif cmdSell>=0 && cmd==cmdSell
elsif cmdSell >= 0 && cmd == cmdSell
scene = PokemonMart_Scene.new
screen = PokemonMartScreen.new(scene,stock)
screen = PokemonMartScreen.new(scene, stock)
screen.pbSellScreen
else
pbMessage(_INTL("Please come again!"))
break
end
cmd = pbMessage(_INTL("Is there anything else I can help you with?"),
commands,cmdQuit+1)
commands, cmdQuit + 1)
end
$game_temp.clear_mart_prices
end