Skip to content

Commit

Permalink
Agrega opcion de elegir los huevos para la incubadora desde el PC
Browse files Browse the repository at this point in the history
  • Loading branch information
dpertierra committed Jan 23, 2025
1 parent 144627b commit 00332c3
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 15 deletions.
2 changes: 2 additions & 0 deletions LA BASE DE SKY/Data/Scripts/001_Settings/002_Settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ module Settings
# Las MOs se pueden olvidar
CAN_FORGET_HMS = true

INCUBATOR_CHOOSE_EGG_FROM_PC = true

#=============================================================================

# Los nombres de cada bolsillo de la Mochila.
Expand Down
112 changes: 97 additions & 15 deletions LA BASE DE SKY/Data/Scripts/067_Scripts de la base/027_Incubadora.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,28 @@ def update
if $PokemonGlobal.eggs[@index] == nil
ret = Kernel.pbConfirmMessage("La incubadora está vacía\\n¿Quieres agregar un Huevo?")
if ret == true
chosen=0
pbFadeOutIn(99999){
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
screen.pbStartScene(_INTL("Elige un Huevo."),false)
chosen=screen.pbChoosePokemon
screen.pbEndScene
}
if chosen != -1 && $player.party[chosen] != nil
if !$player.party[chosen].egg?
Kernel.pbMessage("El Pokémon elegido no es un Huevo.")
else
$PokemonGlobal.eggs[@index] = $player.party[chosen]
$player.party.delete_at(chosen)
$game_temp.bag_scene.pbHardRefresh if $game_temp && $game_temp.bag_scene && defined?($game_temp.bag_scene.pbHardRefresh)
if Settings::INCUBATOR_CHOOSE_EGG_FROM_PC
chosen = pbChooseEggFromPC
if chosen && chosen.is_a?(Pokemon)
$PokemonGlobal.eggs[@index] = chosen
end
else
chosen=0
pbFadeOutIn(99999){
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
screen.pbStartScene(_INTL("Elige un Huevo."),false)
chosen=screen.pbChoosePokemon
screen.pbEndScene
}
if chosen != -1 && $player.party[chosen] != nil
if !$player.party[chosen].egg?
Kernel.pbMessage("El Pokémon elegido no es un Huevo.")
else
$PokemonGlobal.eggs[@index] = $player.party[chosen]
$player.party.delete_at(chosen)
$game_temp.bag_scene.pbHardRefresh if $game_temp && $game_temp.bag_scene && defined?($game_temp.bag_scene.pbHardRefresh)
end
end
end
end
Expand Down Expand Up @@ -332,6 +339,81 @@ def openHatcher
end


class PokemonStorageScreen
def pbChooseEggFromPC
$game_temp.in_storage = true
@heldpkmn = nil
@scene.pbStartBox(self, 0)
retval = nil
to_delete = []
loop do
selected = @scene.pbSelectBox(@storage.party)
if selected && selected[0] == -3 # Close box
if pbConfirm(_INTL("¿Salir del PC?"))
pbSEPlay("PC close")
break
end
next
end
if selected.nil?
next if pbConfirm(_INTL("¿Continuar operaciones?"))
break
elsif selected[0] == -4 # Box name
pbBoxCommands
else
pokemon = @storage[selected[0], selected[1]]
next if !pokemon
commands = [
_INTL("Intercambiar"),
_INTL("Datos"),
]
commands.push(_INTL("Debug")) if $DEBUG
commands.push(_INTL("Cancelar"))
helptext = _INTL("Huevo elegido.")
command = pbShowCommands(helptext, commands)
case command
when 0 # Select
if pokemon.egg?
retval = pokemon
to_delete = selected
break
else
pbMessage(_INTL("¡Debes elegir un huevo!"))
end
when 1 # Summary
pbSummary(selected, nil)
when 2
if $DEBUG
pbPokemonDebug(pokemon, selected)
end
end
end
end
@scene.pbCloseBox
$game_temp.in_storage = false
if retval && retval.is_a?(Pokemon)
if to_delete[0] == -1
$player.party.delete_at(to_delete[1])
$game_temp&.bag_scene&.pbHardRefresh
else
@storage[to_delete[0], to_delete[1]] = nil
end
end
return retval
end
end

def pbChooseEggFromPC
chosen = nil
pbFadeOutIn {
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
chosen = screen.pbChooseEggFromPC
}
chosen
end


ItemHandlers::UseFromBag.add(:EGGHATCHER,proc{|item|
pbFadeOutIn(99999){
openHatcher
Expand Down

0 comments on commit 00332c3

Please sign in to comment.