mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 13:44:59 +00:00
Rewrote party screen, implemented redesign of it
This commit is contained in:
@@ -104,6 +104,10 @@ class HandlerHash
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def keys
|
||||||
|
return @hash.keys
|
||||||
|
end
|
||||||
|
|
||||||
def add(id, handler = nil, &handlerBlock)
|
def add(id, handler = nil, &handlerBlock)
|
||||||
if ![Proc, Hash].include?(handler.class) && !block_given?
|
if ![Proc, Hash].include?(handler.class) && !block_given?
|
||||||
raise ArgumentError, "#{self.class.name} for #{id.inspect} has no valid handler (#{handler.inspect} was given)"
|
raise ArgumentError, "#{self.class.name} for #{id.inspect} has no valid handler (#{handler.inspect} was given)"
|
||||||
@@ -160,6 +164,10 @@ class HandlerHashSymbol
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def keys
|
||||||
|
return @hash.keys
|
||||||
|
end
|
||||||
|
|
||||||
def add(sym, handler = nil, &handlerBlock)
|
def add(sym, handler = nil, &handlerBlock)
|
||||||
if ![Proc, Hash].include?(handler.class) && !block_given?
|
if ![Proc, Hash].include?(handler.class) && !block_given?
|
||||||
raise ArgumentError, "#{self.class.name} for #{sym.inspect} has no valid handler (#{handler.inspect} was given)"
|
raise ArgumentError, "#{self.class.name} for #{sym.inspect} has no valid handler (#{handler.inspect} was given)"
|
||||||
@@ -225,6 +233,10 @@ class HandlerHashEnum
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def keys
|
||||||
|
return @hash.keys
|
||||||
|
end
|
||||||
|
|
||||||
def fromSymbol(sym)
|
def fromSymbol(sym)
|
||||||
return sym unless sym.is_a?(Symbol) || sym.is_a?(String)
|
return sym unless sym.is_a?(Symbol) || sym.is_a?(String)
|
||||||
mod = Object.const_get(@mod) rescue nil
|
mod = Object.const_get(@mod) rescue nil
|
||||||
|
|||||||
@@ -114,6 +114,17 @@ module MenuHandlers
|
|||||||
sorted_keys.each do |option|
|
sorted_keys.each do |option|
|
||||||
hash = options[option]
|
hash = options[option]
|
||||||
next if hash["condition"] && !hash["condition"].call(*args)
|
next if hash["condition"] && !hash["condition"].call(*args)
|
||||||
|
if hash["multi_options"]
|
||||||
|
extra_options = hash["multi_options"].call(*args)
|
||||||
|
if extra_options && extra_options.length > 0
|
||||||
|
if extra_options[0].is_a?(Array)
|
||||||
|
extra_options.each { |opt| yield *opt }
|
||||||
|
else
|
||||||
|
yield *extra_options
|
||||||
|
end
|
||||||
|
end
|
||||||
|
next
|
||||||
|
end
|
||||||
if hash["name"].is_a?(Proc)
|
if hash["name"].is_a?(Proc)
|
||||||
name = hash["name"].call
|
name = hash["name"].call
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ class Game_Temp
|
|||||||
attr_accessor :battle_abort # battle flag: interrupt (unused)
|
attr_accessor :battle_abort # battle flag: interrupt (unused)
|
||||||
attr_accessor :title_screen_calling # return to title screen flag
|
attr_accessor :title_screen_calling # return to title screen flag
|
||||||
attr_accessor :common_event_id # common event ID to start
|
attr_accessor :common_event_id # common event ID to start
|
||||||
|
attr_accessor :field_move_to_use
|
||||||
|
attr_accessor :field_move_user
|
||||||
# Flags indicating something is happening
|
# Flags indicating something is happening
|
||||||
attr_accessor :in_menu # menu is open
|
attr_accessor :in_menu # menu is open
|
||||||
attr_accessor :in_storage # in-Pokémon storage flag
|
attr_accessor :in_storage # in-Pokémon storage flag
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ def using(window)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbUpdateSpriteHash(windows)
|
def pbUpdateSpriteHash(windows)
|
||||||
windows.each do |i|
|
windows&.each do |i|
|
||||||
window = i[1]
|
window = i[1]
|
||||||
if window
|
if window
|
||||||
if window.is_a?(Sprite) || window.is_a?(Window)
|
if window.is_a?(Sprite) || window.is_a?(Window)
|
||||||
@@ -591,7 +591,7 @@ def pbFadeOutIn(z = 99999, nofadeout = false)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbFadeOutInWithUpdate(z, sprites, nofadeout = false)
|
def pbFadeOutInWithUpdate(sprites, z = 99999, nofadeout = false)
|
||||||
duration = 0.4 # In seconds
|
duration = 0.4 # In seconds
|
||||||
col = Color.new(0, 0, 0, 0)
|
col = Color.new(0, 0, 0, 0)
|
||||||
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
|
|||||||
@@ -1243,19 +1243,6 @@ end
|
|||||||
class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
||||||
attr_reader :commands
|
attr_reader :commands
|
||||||
|
|
||||||
def textWidth(bitmap, text)
|
|
||||||
dims = [nil, 0]
|
|
||||||
chars = getFormattedText(bitmap, 0, 0,
|
|
||||||
Graphics.width - self.borderX - SpriteWindow_Base::TEXT_PADDING - 16,
|
|
||||||
-1, text, self.rowHeight, true, true)
|
|
||||||
chars.each do |ch|
|
|
||||||
dims[0] = dims[0] ? [dims[0], ch[1]].min : ch[1]
|
|
||||||
dims[1] = [dims[1], ch[1] + ch[3]].max
|
|
||||||
end
|
|
||||||
dims[0] = 0 if !dims[0]
|
|
||||||
return dims[1] - dims[0]
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize(commands, width = nil)
|
def initialize(commands, width = nil)
|
||||||
@starting = true
|
@starting = true
|
||||||
@commands = []
|
@commands = []
|
||||||
@@ -1321,6 +1308,42 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def textWidth(bitmap, text)
|
||||||
|
dims = [nil, 0]
|
||||||
|
chars = getFormattedText(bitmap, 0, 0,
|
||||||
|
Graphics.width - self.borderX - SpriteWindow_Base::TEXT_PADDING - 16,
|
||||||
|
-1, text, self.rowHeight, true, true)
|
||||||
|
chars.each do |ch|
|
||||||
|
dims[0] = dims[0] ? [dims[0], ch[1]].min : ch[1]
|
||||||
|
dims[1] = [dims[1], ch[1] + ch[3]].max
|
||||||
|
end
|
||||||
|
dims[0] = 0 if !dims[0]
|
||||||
|
return dims[1] - dims[0]
|
||||||
|
end
|
||||||
|
|
||||||
|
def getAutoDims(commands, dims, width = nil)
|
||||||
|
rowMax = ((commands.length + self.columns - 1) / self.columns).to_i
|
||||||
|
windowheight = (rowMax * self.rowHeight)
|
||||||
|
windowheight += self.borderY
|
||||||
|
if !width || width < 0
|
||||||
|
width = 0
|
||||||
|
tmpbitmap = Bitmap.new(1, 1)
|
||||||
|
pbSetSystemFont(tmpbitmap)
|
||||||
|
commands.each do |i|
|
||||||
|
txt = toUnformattedText(i).gsub(/\n/, "")
|
||||||
|
width = [width, tmpbitmap.text_size(txt).width].max
|
||||||
|
end
|
||||||
|
# one 16 to allow cursor
|
||||||
|
width += 16 + 16 + SpriteWindow_Base::TEXT_PADDING
|
||||||
|
tmpbitmap.dispose
|
||||||
|
end
|
||||||
|
# Store suggested width and height of window
|
||||||
|
dims[0] = [self.borderX + 1,
|
||||||
|
(width * self.columns) + self.borderX + ((self.columns - 1) * self.columnSpacing)].max
|
||||||
|
dims[1] = [self.borderY + 1, windowheight].max
|
||||||
|
dims[1] = [dims[1], Graphics.height].min
|
||||||
|
end
|
||||||
|
|
||||||
def resizeToFit(commands, width = nil)
|
def resizeToFit(commands, width = nil)
|
||||||
dims = []
|
dims = []
|
||||||
getAutoDims(commands, dims, width)
|
getAutoDims(commands, dims, width)
|
||||||
@@ -1340,7 +1363,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
pbDrawShadowText(self.contents, rect.x, rect.y + (self.contents.text_offset_y || 0),
|
pbDrawShadowText(self.contents, rect.x, rect.y + (self.contents.text_offset_y || 0),
|
||||||
rect.width, rect.height, @commands[index], self.baseColor, self.shadowColor)
|
rect.width, rect.height, @commands[index], self.baseColor, self.shadowColor)
|
||||||
else
|
else
|
||||||
chars = getFormattedText(self.contents, rect.x, rect.y + (self.contents.text_offset_y || 0),
|
chars = getFormattedText(self.contents, rect.x, rect.y + (self.contents.text_offset_y || 0) + 2, # TEXT OFFSET
|
||||||
rect.width, rect.height, @commands[index], rect.height, true, true)
|
rect.width, rect.height, @commands[index], rect.height, true, true)
|
||||||
drawFormattedChars(self.contents, chars)
|
drawFormattedChars(self.contents, chars)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -152,46 +152,33 @@ class Battle::Scene
|
|||||||
partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||||
modParty = @battle.pbPlayerDisplayParty(idxBattler)
|
modParty = @battle.pbPlayerDisplayParty(idxBattler)
|
||||||
# Start party screen
|
# Start party screen
|
||||||
scene = PokemonParty_Scene.new
|
party_mode = (mode == 1) ? :battle_choose_to_box : :battle_choose_pokemon
|
||||||
switchScreen = PokemonPartyScreen.new(scene, modParty)
|
screen = UI::Party.new(modParty, mode: party_mode)
|
||||||
msg = _INTL("Choose a Pokémon.")
|
screen.choose_pokemon do |pkmn, party_index|
|
||||||
msg = _INTL("Send which Pokémon to Boxes?") if mode == 1
|
next canCancel if party_index < 0
|
||||||
switchScreen.pbStartScene(msg, @battle.pbNumPositions(0, 0))
|
|
||||||
# Loop while in party screen
|
|
||||||
loop do
|
|
||||||
# Select a Pokémon
|
|
||||||
scene.pbSetHelpText(msg)
|
|
||||||
idxParty = switchScreen.pbChoosePokemon
|
|
||||||
if idxParty < 0
|
|
||||||
next if !canCancel
|
|
||||||
break
|
|
||||||
end
|
|
||||||
# Choose a command for the selected Pokémon
|
# Choose a command for the selected Pokémon
|
||||||
cmdSwitch = -1
|
commands = {}
|
||||||
cmdBoxes = -1
|
commands[:switch_in] = _INTL("Switch In") if mode == 0 && pkmn.able? &&
|
||||||
cmdSummary = -1
|
|
||||||
commands = []
|
|
||||||
commands[cmdSwitch = commands.length] = _INTL("Switch In") if mode == 0 && modParty[idxParty].able? &&
|
|
||||||
(@battle.canSwitch || !canCancel)
|
(@battle.canSwitch || !canCancel)
|
||||||
commands[cmdBoxes = commands.length] = _INTL("Send to Boxes") if mode == 1
|
commands[:send_to_boxes] = _INTL("Send to Boxes") if mode == 1
|
||||||
commands[cmdSummary = commands.length] = _INTL("Summary")
|
commands[:summary] = _INTL("Summary")
|
||||||
commands[commands.length] = _INTL("Cancel")
|
commands[:cancel] = _INTL("Cancel")
|
||||||
command = scene.pbShowCommands(_INTL("Do what with {1}?", modParty[idxParty].name), commands)
|
choice = screen.show_choice_message(_INTL("Do what with {1}?", pkmn.name), commands)
|
||||||
if (cmdSwitch >= 0 && command == cmdSwitch) || # Switch In
|
next canCancel if choice.nil?
|
||||||
(cmdBoxes >= 0 && command == cmdBoxes) # Send to Boxes
|
case choice
|
||||||
idxPartyRet = -1
|
when :switch_in, :send_to_boxes
|
||||||
|
real_party_index = -1
|
||||||
partyPos.each_with_index do |pos, i|
|
partyPos.each_with_index do |pos, i|
|
||||||
next if pos != idxParty + partyStart
|
next if pos != party_index + partyStart
|
||||||
idxPartyRet = i
|
real_party_index = i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
break if yield idxPartyRet, switchScreen
|
next true if yield real_party_index, screen
|
||||||
elsif cmdSummary >= 0 && command == cmdSummary # Summary
|
when :summary
|
||||||
scene.pbSummary(idxParty, true)
|
screen.perform_action(:summary)
|
||||||
end
|
end
|
||||||
|
next false
|
||||||
end
|
end
|
||||||
# Close party screen
|
|
||||||
switchScreen.pbEndScene
|
|
||||||
# Fade back into battle screen
|
# Fade back into battle screen
|
||||||
pbFadeInAndShow(@sprites, visibleSprites)
|
pbFadeInAndShow(@sprites, visibleSprites)
|
||||||
end
|
end
|
||||||
@@ -272,34 +259,29 @@ class Battle::Scene
|
|||||||
partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||||
modParty = @battle.pbPlayerDisplayParty(idxBattler)
|
modParty = @battle.pbPlayerDisplayParty(idxBattler)
|
||||||
# Start party screen
|
# Start party screen
|
||||||
pkmnScene = PokemonParty_Scene.new
|
party_idx = -1
|
||||||
pkmnScreen = PokemonPartyScreen.new(pkmnScene, modParty)
|
party_screen = UI::Party.new(modParty, mode: :battle_use_item)
|
||||||
pkmnScreen.pbStartScene(_INTL("Use on which Pokémon?"), @battle.pbNumPositions(0, 0))
|
party_screen.choose_pokemon do |pkmn, party_index|
|
||||||
idxParty = -1
|
party_idx = party_index
|
||||||
# Loop while in party screen
|
next true if party_index < 0
|
||||||
loop do
|
# Use the item on the selected Pokémon
|
||||||
# Select a Pokémon
|
real_party_index = -1
|
||||||
pkmnScene.pbSetHelpText(_INTL("Use on which Pokémon?"))
|
|
||||||
idxParty = pkmnScreen.pbChoosePokemon
|
|
||||||
break if idxParty < 0
|
|
||||||
idxPartyRet = -1
|
|
||||||
partyPos.each_with_index do |pos, i|
|
partyPos.each_with_index do |pos, i|
|
||||||
next if pos != idxParty + partyStart
|
next if pos != party_index + partyStart
|
||||||
idxPartyRet = i
|
real_party_index = i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
next if idxPartyRet < 0
|
next false if real_party_index < 0
|
||||||
pkmn = party[idxPartyRet]
|
next false if !pkmn || pkmn.egg?
|
||||||
next if !pkmn || pkmn.egg?
|
move_index = -1
|
||||||
idxMove = -1
|
|
||||||
if useType == 2 # Use on Pokémon's move
|
if useType == 2 # Use on Pokémon's move
|
||||||
idxMove = pkmnScreen.pbChooseMove(pkmn, _INTL("Restore which move?"))
|
move_index = party_screen.choose_move(pkmn, _INTL("Restore which move?"))
|
||||||
next if idxMove < 0
|
next false if move_index < 0
|
||||||
end
|
end
|
||||||
break if yield item.id, useType, idxPartyRet, idxMove, pkmnScene
|
next true if yield item.id, useType, real_party_index, move_index, party_screen
|
||||||
|
next false
|
||||||
end
|
end
|
||||||
pkmnScene.pbEndScene
|
break if party_idx >= 0 # Item was used; close the Bag screen
|
||||||
break if idxParty >= 0
|
|
||||||
# Cancelled choosing a Pokémon; show the Bag screen again
|
# Cancelled choosing a Pokémon; show the Bag screen again
|
||||||
itemScene.pbFadeInScene
|
itemScene.pbFadeInScene
|
||||||
when 4 # Use on opposing battler (Poké Balls)
|
when 4 # Use on opposing battler (Poké Balls)
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ module HiddenMoveHandlers
|
|||||||
return !CanUseMove[item].nil? && !UseMove[item].nil?
|
return !CanUseMove[item].nil? && !UseMove[item].nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.eachHandler
|
||||||
|
ret = CanUseMove.keys & UseMove.keys
|
||||||
|
ret.each { |key| yield key }
|
||||||
|
end
|
||||||
|
|
||||||
# Returns whether move can be used
|
# Returns whether move can be used
|
||||||
def self.triggerCanUseMove(item, pokemon, showmsg)
|
def self.triggerCanUseMove(item, pokemon, showmsg)
|
||||||
return false if !CanUseMove[item]
|
return false if !CanUseMove[item]
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ end
|
|||||||
def pbChangeLevel(pkmn, new_level, scene)
|
def pbChangeLevel(pkmn, new_level, scene)
|
||||||
new_level = new_level.clamp(1, GameData::GrowthRate.max_level)
|
new_level = new_level.clamp(1, GameData::GrowthRate.max_level)
|
||||||
if pkmn.level == new_level
|
if pkmn.level == new_level
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbDisplay(_INTL("{1}'s level remained unchanged.", pkmn.name))
|
scene.show_message(_INTL("{1}'s level remained unchanged.", pkmn.name))
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("{1}'s level remained unchanged.", pkmn.name))
|
pbMessage(_INTL("{1}'s level remained unchanged.", pkmn.name))
|
||||||
end
|
end
|
||||||
@@ -153,8 +153,8 @@ def pbChangeLevel(pkmn, new_level, scene)
|
|||||||
pkmn.hp = 1 if new_level > old_level && pkmn.species_data.base_stats[:HP] == 1
|
pkmn.hp = 1 if new_level > old_level && pkmn.species_data.base_stats[:HP] == 1
|
||||||
scene.pbRefresh
|
scene.pbRefresh
|
||||||
if old_level > new_level
|
if old_level > new_level
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbDisplay(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level))
|
scene.show_message(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level))
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level))
|
pbMessage(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level))
|
||||||
end
|
end
|
||||||
@@ -170,8 +170,8 @@ def pbChangeLevel(pkmn, new_level, scene)
|
|||||||
pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed), scene)
|
pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed), scene)
|
||||||
else
|
else
|
||||||
pkmn.changeHappiness("vitamin")
|
pkmn.changeHappiness("vitamin")
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbDisplay(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level))
|
scene.show_message(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level))
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level))
|
pbMessage(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level))
|
||||||
end
|
end
|
||||||
@@ -199,7 +199,7 @@ def pbChangeLevel(pkmn, new_level, scene)
|
|||||||
evo.pbStartScreen(pkmn, new_species)
|
evo.pbStartScreen(pkmn, new_species)
|
||||||
evo.pbEvolution
|
evo.pbEvolution
|
||||||
evo.pbEndScreen
|
evo.pbEndScreen
|
||||||
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
|
scene.refresh if scene.is_a?(UI::Party)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -225,8 +225,8 @@ end
|
|||||||
def pbChangeExp(pkmn, new_exp, scene)
|
def pbChangeExp(pkmn, new_exp, scene)
|
||||||
new_exp = new_exp.clamp(0, pkmn.growth_rate.maximum_exp)
|
new_exp = new_exp.clamp(0, pkmn.growth_rate.maximum_exp)
|
||||||
if pkmn.exp == new_exp
|
if pkmn.exp == new_exp
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbDisplay(_INTL("{1}'s Exp. Points remained unchanged.", pkmn.name))
|
scene.show_message(_INTL("{1}'s Exp. Points remained unchanged.", pkmn.name))
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("{1}'s Exp. Points remained unchanged.", pkmn.name))
|
pbMessage(_INTL("{1}'s Exp. Points remained unchanged.", pkmn.name))
|
||||||
end
|
end
|
||||||
@@ -241,8 +241,8 @@ def pbChangeExp(pkmn, new_exp, scene)
|
|||||||
old_speed = pkmn.speed
|
old_speed = pkmn.speed
|
||||||
if pkmn.exp > new_exp # Loses Exp
|
if pkmn.exp > new_exp # Loses Exp
|
||||||
difference = pkmn.exp - new_exp
|
difference = pkmn.exp - new_exp
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbDisplay(_INTL("{1} lost {2} Exp. Points!", pkmn.name, difference))
|
scene.show_message(_INTL("{1} lost {2} Exp. Points!", pkmn.name, difference))
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("{1} lost {2} Exp. Points!", pkmn.name, difference))
|
pbMessage(_INTL("{1} lost {2} Exp. Points!", pkmn.name, difference))
|
||||||
end
|
end
|
||||||
@@ -251,8 +251,8 @@ def pbChangeExp(pkmn, new_exp, scene)
|
|||||||
scene.pbRefresh
|
scene.pbRefresh
|
||||||
return if pkmn.level == old_level
|
return if pkmn.level == old_level
|
||||||
# Level changed
|
# Level changed
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbDisplay(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level))
|
scene.show_message(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level))
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level))
|
pbMessage(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level))
|
||||||
end
|
end
|
||||||
@@ -268,8 +268,8 @@ def pbChangeExp(pkmn, new_exp, scene)
|
|||||||
pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed), scene)
|
pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed), scene)
|
||||||
else # Gains Exp
|
else # Gains Exp
|
||||||
difference = new_exp - pkmn.exp
|
difference = new_exp - pkmn.exp
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbDisplay(_INTL("{1} gained {2} Exp. Points!", pkmn.name, difference))
|
scene.show_message(_INTL("{1} gained {2} Exp. Points!", pkmn.name, difference))
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("{1} gained {2} Exp. Points!", pkmn.name, difference))
|
pbMessage(_INTL("{1} gained {2} Exp. Points!", pkmn.name, difference))
|
||||||
end
|
end
|
||||||
@@ -279,8 +279,8 @@ def pbChangeExp(pkmn, new_exp, scene)
|
|||||||
scene.pbRefresh
|
scene.pbRefresh
|
||||||
return if pkmn.level == old_level
|
return if pkmn.level == old_level
|
||||||
# Level changed
|
# Level changed
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbDisplay(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level))
|
scene.show_message(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level))
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level))
|
pbMessage(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level))
|
||||||
end
|
end
|
||||||
@@ -308,7 +308,7 @@ def pbChangeExp(pkmn, new_exp, scene)
|
|||||||
evo.pbStartScreen(pkmn, new_species)
|
evo.pbStartScreen(pkmn, new_species)
|
||||||
evo.pbEvolution
|
evo.pbEvolution
|
||||||
evo.pbEndScreen
|
evo.pbEndScreen
|
||||||
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
|
scene.refresh if scene.is_a?(UI::Party)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -320,7 +320,7 @@ def pbGainExpFromExpCandy(pkmn, base_amt, qty, scene)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
pbSEPlay("Pkmn level up")
|
pbSEPlay("Pkmn level up")
|
||||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
scene.set_help_text("") if scene.is_a?(UI::Party)
|
||||||
if qty > 1
|
if qty > 1
|
||||||
(qty - 1).times { pkmn.changeHappiness("vitamin") }
|
(qty - 1).times { pkmn.changeHappiness("vitamin") }
|
||||||
end
|
end
|
||||||
@@ -581,9 +581,12 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Teach and forget a move.
|
# Teach and forget a move.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbLearnMove(pkmn, move, ignore_if_known = false, by_machine = false, &block)
|
def pbLearnMove(pkmn, move, ignore_if_known = false, by_machine = false, screen = nil, &block)
|
||||||
return false if !pkmn
|
return false if !pkmn
|
||||||
|
pkmn_name = pkmn.name
|
||||||
move = GameData::Move.get(move).id
|
move = GameData::Move.get(move).id
|
||||||
|
move_name = GameData::Move.get(move).name
|
||||||
|
# Check if Pokémon is unable to learn any moves
|
||||||
if pkmn.egg? && !$DEBUG
|
if pkmn.egg? && !$DEBUG
|
||||||
pbMessage(_INTL("Eggs can't be taught any moves."), &block)
|
pbMessage(_INTL("Eggs can't be taught any moves."), &block)
|
||||||
return false
|
return false
|
||||||
@@ -591,27 +594,29 @@ def pbLearnMove(pkmn, move, ignore_if_known = false, by_machine = false, &block)
|
|||||||
pbMessage(_INTL("Shadow Pokémon can't be taught any moves."), &block)
|
pbMessage(_INTL("Shadow Pokémon can't be taught any moves."), &block)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
pkmn_name = pkmn.name
|
# Check if Pokémon can learn this move
|
||||||
move_name = GameData::Move.get(move).name
|
|
||||||
if pkmn.hasMove?(move)
|
if pkmn.hasMove?(move)
|
||||||
pbMessage(_INTL("{1} already knows {2}.", pkmn_name, move_name), &block) if !ignore_if_known
|
if !ignore_if_known
|
||||||
|
pbMessage(_INTL("{1} already knows {2}.", pkmn_name, move_name), &block)
|
||||||
|
end
|
||||||
return false
|
return false
|
||||||
elsif pkmn.numMoves < Pokemon::MAX_MOVES
|
elsif pkmn.numMoves < Pokemon::MAX_MOVES
|
||||||
pkmn.learn_move(move)
|
pkmn.learn_move(move)
|
||||||
pbMessage("\\se[]" + _INTL("{1} learned {2}!", pkmn_name, move_name) + "\\se[Pkmn move learnt]", &block)
|
pbMessage("\\se[]" + _INTL("{1} learned {2}!", pkmn_name, move_name) + "\\se[Pkmn move learnt]", &block)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
# Pokémon needs to forget a move to learn this one
|
||||||
pbMessage(_INTL("{1} wants to learn {2}, but it already knows {3} moves.",
|
pbMessage(_INTL("{1} wants to learn {2}, but it already knows {3} moves.",
|
||||||
pkmn_name, move_name, pkmn.numMoves.to_word) + "\1", &block)
|
pkmn_name, move_name, pkmn.numMoves.to_word) + "\1", &block)
|
||||||
if pbConfirmMessage(_INTL("Should {1} forget a move to learn {2}?", pkmn_name, move_name), &block)
|
if pbConfirmMessage(_INTL("Should {1} forget a move to learn {2}?", pkmn_name, move_name), &block)
|
||||||
loop do
|
loop do
|
||||||
move_index = pbForgetMove(pkmn, move)
|
move_index = pbForgetMove(pkmn, move, screen)
|
||||||
if move_index >= 0
|
if move_index >= 0
|
||||||
old_move_name = pkmn.moves[move_index].name
|
old_move_name = pkmn.moves[move_index].name
|
||||||
oldmovepp = pkmn.moves[move_index].pp
|
old_move_pp = pkmn.moves[move_index].pp
|
||||||
pkmn.moves[move_index] = Pokemon::Move.new(move) # Replaces current/total PP
|
pkmn.moves[move_index] = Pokemon::Move.new(move) # Replaces current/total PP
|
||||||
if by_machine && Settings::TAUGHT_MACHINES_KEEP_OLD_PP
|
if by_machine && Settings::TAUGHT_MACHINES_KEEP_OLD_PP
|
||||||
pkmn.moves[move_index].pp = [oldmovepp, pkmn.moves[move_index].total_pp].min
|
pkmn.moves[move_index].pp = [old_move_pp, pkmn.moves[move_index].total_pp].min
|
||||||
end
|
end
|
||||||
pbMessage(_INTL("1, 2, and...\\wt[16] ...\\wt[16] ...\\wt[16] Ta-da!") + "\\se[Battle ball drop]\1", &block)
|
pbMessage(_INTL("1, 2, and...\\wt[16] ...\\wt[16] ...\\wt[16] Ta-da!") + "\\se[Battle ball drop]\1", &block)
|
||||||
pbMessage(_INTL("{1} forgot how to use {2}.\nAnd..." + "\1", pkmn_name, old_move_name), &block)
|
pbMessage(_INTL("{1} forgot how to use {2}.\nAnd..." + "\1", pkmn_name, old_move_name), &block)
|
||||||
@@ -629,11 +634,11 @@ def pbLearnMove(pkmn, move, ignore_if_known = false, by_machine = false, &block)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbForgetMove(pkmn, moveToLearn)
|
def pbForgetMove(pkmn, move_to_learn, screen = nil)
|
||||||
ret = -1
|
ret = -1
|
||||||
pbFadeOutIn do
|
pbFadeOutInWithUpdate(screen&.sprites) do
|
||||||
screen = UI::PokemonSummary.new([pkmn], 0, mode: :choose_move, new_move: moveToLearn)
|
summary_screen = UI::PokemonSummary.new([pkmn], 0, mode: :choose_move, new_move: move_to_learn)
|
||||||
ret = screen.choose_move
|
ret = summary_screen.choose_move
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@@ -642,7 +647,7 @@ end
|
|||||||
# Use an item from the Bag and/or on a Pokémon.
|
# Use an item from the Bag and/or on a Pokémon.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# @return [Integer] 0 = item wasn't used; 1 = item used; 2 = close Bag to use in field
|
# @return [Integer] 0 = item wasn't used; 1 = item used; 2 = close Bag to use in field
|
||||||
def pbUseItem(bag, item, bagscene = nil)
|
def pbUseItem(bag, item, bag_scene = nil)
|
||||||
itm = GameData::Item.get(item)
|
itm = GameData::Item.get(item)
|
||||||
useType = itm.field_use
|
useType = itm.field_use
|
||||||
if useType == 1 # Item is usable on a Pokémon
|
if useType == 1 # Item is usable on a Pokémon
|
||||||
@@ -660,37 +665,35 @@ def pbUseItem(bag, item, bagscene = nil)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
scene = PokemonParty_Scene.new
|
screen = UI::Party.new($player.party, mode: :use_item)
|
||||||
screen = PokemonPartyScreen.new(scene, $player.party)
|
if itm.is_evolution_stone?
|
||||||
screen.pbStartScene(_INTL("Use on which Pokémon?"), false, annot)
|
screen.set_able_annotation_proc(proc { |pkmn| next pkmn.check_evolution_on_use_item(item) })
|
||||||
loop do
|
|
||||||
scene.pbSetHelpText(_INTL("Use on which Pokémon?"))
|
|
||||||
chosen = screen.pbChoosePokemon
|
|
||||||
if chosen < 0
|
|
||||||
ret = false
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
pkmn = $player.party[chosen]
|
screen.choose_pokemon do |pkmn, party_index|
|
||||||
next if !pbCheckUseOnPokemon(item, pkmn, screen)
|
next true if party_index < 0
|
||||||
|
next false if !pbCheckUseOnPokemon(item, pkmn, screen)
|
||||||
qty = 1
|
qty = 1
|
||||||
max_at_once = ItemHandlers.triggerUseOnPokemonMaximum(item, pkmn)
|
max_at_once = ItemHandlers.triggerUseOnPokemonMaximum(item, pkmn)
|
||||||
max_at_once = [max_at_once, $bag.quantity(item)].min
|
max_at_once = [max_at_once, bag.quantity(item)].min
|
||||||
if max_at_once > 1
|
if max_at_once > 1
|
||||||
qty = screen.scene.pbChooseNumber(
|
pbPlayDecisionSE
|
||||||
|
qty = screen.choose_number(
|
||||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).portion_name_plural), max_at_once
|
_INTL("How many {1} do you want to use?", GameData::Item.get(item).portion_name_plural), max_at_once
|
||||||
)
|
)
|
||||||
screen.scene.pbSetHelpText("") if screen.is_a?(PokemonPartyScreen)
|
screen.set_help_text("")
|
||||||
end
|
end
|
||||||
next if qty <= 0
|
next false if qty <= 0
|
||||||
ret = ItemHandlers.triggerUseOnPokemon(item, qty, pkmn, screen)
|
ret = ItemHandlers.triggerUseOnPokemon(item, qty, pkmn, screen)
|
||||||
next unless ret && itm.consumed_after_use?
|
if ret && itm.consumed_after_use?
|
||||||
bag.remove(item, qty)
|
bag.remove(item, qty)
|
||||||
next if bag.has?(item)
|
if !bag.has?(item)
|
||||||
pbMessage(_INTL("You used your last {1}.", itm.portion_name)) { screen.pbUpdate }
|
screen.show_message(_INTL("You used your last {1}.", itm.portion_name))
|
||||||
break
|
next true
|
||||||
end
|
end
|
||||||
screen.pbEndScene
|
end
|
||||||
bagscene&.pbRefresh
|
next false
|
||||||
|
end
|
||||||
|
bag_scene&.pbRefresh
|
||||||
end
|
end
|
||||||
return (ret) ? 1 : 0
|
return (ret) ? 1 : 0
|
||||||
elsif useType == 2 || itm.is_machine? # Item is usable from Bag or teaches a move
|
elsif useType == 2 || itm.is_machine? # Item is usable from Bag or teaches a move
|
||||||
@@ -708,6 +711,7 @@ end
|
|||||||
|
|
||||||
# Only called when in the party screen and having chosen an item to be used on
|
# Only called when in the party screen and having chosen an item to be used on
|
||||||
# the selected Pokémon.
|
# the selected Pokémon.
|
||||||
|
# TODO: Replace all pbMessage and so on in here. scene is the party screen.
|
||||||
def pbUseItemOnPokemon(item, pkmn, scene)
|
def pbUseItemOnPokemon(item, pkmn, scene)
|
||||||
itm = GameData::Item.get(item)
|
itm = GameData::Item.get(item)
|
||||||
# TM or HM
|
# TM or HM
|
||||||
@@ -738,12 +742,12 @@ def pbUseItemOnPokemon(item, pkmn, scene)
|
|||||||
qty = scene.scene.pbChooseNumber(
|
qty = scene.scene.pbChooseNumber(
|
||||||
_INTL("How many {1} do you want to use?", itm.portion_name_plural), max_at_once
|
_INTL("How many {1} do you want to use?", itm.portion_name_plural), max_at_once
|
||||||
)
|
)
|
||||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
scene.set_help_text("") if scene.is_a?(UI::Party)
|
||||||
end
|
end
|
||||||
return false if qty <= 0
|
return false if qty <= 0
|
||||||
ret = ItemHandlers.triggerUseOnPokemon(item, qty, pkmn, scene)
|
ret = ItemHandlers.triggerUseOnPokemon(item, qty, pkmn, scene)
|
||||||
scene.pbClearAnnotations
|
scene.clear_annotations
|
||||||
scene.pbHardRefresh
|
scene.refresh
|
||||||
if ret && itm.consumed_after_use?
|
if ret && itm.consumed_after_use?
|
||||||
$bag.remove(item, qty)
|
$bag.remove(item, qty)
|
||||||
if !$bag.has?(item)
|
if !$bag.has?(item)
|
||||||
@@ -779,6 +783,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Give an item to a Pokémon to hold, and take a held item from a Pokémon.
|
# Give an item to a Pokémon to hold, and take a held item from a Pokémon.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
# TODO: Replace all pbDisplay and so on in here.
|
||||||
def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0)
|
def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0)
|
||||||
return false if item.nil?
|
return false if item.nil?
|
||||||
newitemname = GameData::Item.get(item).portion_name
|
newitemname = GameData::Item.get(item).portion_name
|
||||||
@@ -824,6 +829,7 @@ def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: Replace all pbDisplay and so on in here.
|
||||||
def pbTakeItemFromPokemon(pkmn, scene)
|
def pbTakeItemFromPokemon(pkmn, scene)
|
||||||
ret = false
|
ret = false
|
||||||
if !pkmn.hasItem?
|
if !pkmn.hasItem?
|
||||||
@@ -833,23 +839,25 @@ def pbTakeItemFromPokemon(pkmn, scene)
|
|||||||
elsif pkmn.mail
|
elsif pkmn.mail
|
||||||
if scene.pbConfirm(_INTL("Save the removed mail in your PC?"))
|
if scene.pbConfirm(_INTL("Save the removed mail in your PC?"))
|
||||||
if pbMoveToMailbox(pkmn)
|
if pbMoveToMailbox(pkmn)
|
||||||
scene.pbDisplay(_INTL("The mail was saved in your PC."))
|
|
||||||
pkmn.item = nil
|
pkmn.item = nil
|
||||||
|
scene.pbDisplay(_INTL("The mail was saved in your PC."))
|
||||||
ret = true
|
ret = true
|
||||||
else
|
else
|
||||||
scene.pbDisplay(_INTL("Your PC's Mailbox is full."))
|
scene.pbDisplay(_INTL("Your PC's Mailbox is full."))
|
||||||
end
|
end
|
||||||
elsif scene.pbConfirm(_INTL("If the mail is removed, its message will be lost. OK?"))
|
elsif scene.pbConfirm(_INTL("If the mail is removed, its message will be lost. OK?"))
|
||||||
|
item_name = pkmn.item.portion_name
|
||||||
$bag.add(pkmn.item)
|
$bag.add(pkmn.item)
|
||||||
scene.pbDisplay(_INTL("Received the {1} from {2}.", pkmn.item.portion_name, pkmn.name))
|
|
||||||
pkmn.item = nil
|
pkmn.item = nil
|
||||||
pkmn.mail = nil
|
pkmn.mail = nil
|
||||||
|
scene.pbDisplay(_INTL("Received the {1} from {2}.", item_name, pkmn.name))
|
||||||
ret = true
|
ret = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
item_name = pkmn.item.portion_name
|
||||||
$bag.add(pkmn.item)
|
$bag.add(pkmn.item)
|
||||||
scene.pbDisplay(_INTL("Received the {1} from {2}.", pkmn.item.portion_name, pkmn.name))
|
|
||||||
pkmn.item = nil
|
pkmn.item = nil
|
||||||
|
scene.pbDisplay(_INTL("Received the {1} from {2}.", item_name, pkmn.name))
|
||||||
ret = true
|
ret = true
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
|
|||||||
@@ -243,19 +243,19 @@ ItemHandlers::UseInField.add(:SACREDASH, proc { |item|
|
|||||||
end
|
end
|
||||||
revived = 0
|
revived = 0
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
scene = PokemonParty_Scene.new
|
screen = UI::Party.new($player.party, mode: :choose_pokemon)
|
||||||
screen = PokemonPartyScreen.new(scene, $player.party)
|
screen.set_help_text(_INTL("Using item..."))
|
||||||
screen.pbStartScene(_INTL("Using item..."), false)
|
screen.show_and_hide do
|
||||||
pbSEPlay("Use item in party")
|
|
||||||
$player.party.each_with_index do |pkmn, i|
|
$player.party.each_with_index do |pkmn, i|
|
||||||
next if !pkmn.fainted?
|
next if !pkmn.fainted?
|
||||||
revived += 1
|
revived += 1
|
||||||
pkmn.heal
|
pkmn.heal
|
||||||
screen.pbRefreshSingle(i)
|
screen.refresh
|
||||||
screen.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name))
|
pbSEPlay("Use item in party")
|
||||||
|
screen.show_message(_INTL("{1}'s HP was restored.", pkmn.name))
|
||||||
|
end
|
||||||
|
screen.show_message(_INTL("It won't have any effect.")) if revived == 0
|
||||||
end
|
end
|
||||||
screen.pbDisplay(_INTL("It won't have any effect.")) if revived == 0
|
|
||||||
screen.pbEndScene
|
|
||||||
end
|
end
|
||||||
next (revived > 0)
|
next (revived > 0)
|
||||||
})
|
})
|
||||||
@@ -391,16 +391,16 @@ ItemHandlers::UseOnPokemon.addIf(:evolution_stones,
|
|||||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
newspecies = pkmn.check_evolution_on_use_item(item)
|
new_species = pkmn.check_evolution_on_use_item(item)
|
||||||
if newspecies
|
if new_species
|
||||||
pbFadeOutInWithMusic do
|
pbFadeOutInWithMusic do
|
||||||
evo = PokemonEvolutionScene.new
|
evo = PokemonEvolutionScene.new
|
||||||
evo.pbStartScreen(pkmn, newspecies)
|
evo.pbStartScreen(pkmn, new_species)
|
||||||
evo.pbEvolution(false)
|
evo.pbEvolution(false)
|
||||||
evo.pbEndScreen
|
evo.pbEndScreen
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbRefreshAnnotations(proc { |p| !p.check_evolution_on_use_item(item).nil? })
|
scene.set_able_annotation_proc(proc { |pkmn| !pkmn.check_evolution_on_use_item(item).nil? })
|
||||||
scene.pbRefresh
|
scene.refresh
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next true
|
next true
|
||||||
@@ -415,17 +415,17 @@ ItemHandlers::UseOnPokemon.add(:SCROLLOFWATERS, proc { |item, qty, pkmn, scene|
|
|||||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
newspecies = pkmn.check_evolution_on_use_item(item)
|
new_species = pkmn.check_evolution_on_use_item(item)
|
||||||
if newspecies
|
if new_species
|
||||||
pkmn.form = 1 # NOTE: This is the only difference to the generic evolution stone code.
|
pkmn.form = 1 # NOTE: This is the only difference to the generic evolution stone code.
|
||||||
pbFadeOutInWithMusic do
|
pbFadeOutInWithMusic do
|
||||||
evo = PokemonEvolutionScene.new
|
evo = PokemonEvolutionScene.new
|
||||||
evo.pbStartScreen(pkmn, newspecies)
|
evo.pbStartScreen(pkmn, new_species)
|
||||||
evo.pbEvolution(false)
|
evo.pbEvolution(false)
|
||||||
evo.pbEndScreen
|
evo.pbEndScreen
|
||||||
if scene.is_a?(PokemonPartyScreen)
|
if scene.is_a?(UI::Party)
|
||||||
scene.pbRefreshAnnotations(proc { |p| !p.check_evolution_on_use_item(item).nil? })
|
scene.set_able_annotation_proc(proc { |p| !p.check_evolution_on_use_item(item).nil? })
|
||||||
scene.pbRefresh
|
scene.refresh
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next true
|
next true
|
||||||
@@ -995,7 +995,7 @@ ItemHandlers::UseOnPokemon.add(:RARECANDY, proc { |item, qty, pkmn, scene|
|
|||||||
evo.pbStartScreen(pkmn, new_species)
|
evo.pbStartScreen(pkmn, new_species)
|
||||||
evo.pbEvolution
|
evo.pbEvolution
|
||||||
evo.pbEndScreen
|
evo.pbEndScreen
|
||||||
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
|
scene.refresh if scene.is_a?(UI::Party)
|
||||||
end
|
end
|
||||||
next true
|
next true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ def pbWriteMail(item, pkmn, pkmnid, scene)
|
|||||||
message = ""
|
message = ""
|
||||||
loop do
|
loop do
|
||||||
message = pbMessageFreeText(_INTL("Please enter a message (max. 250 characters)."),
|
message = pbMessageFreeText(_INTL("Please enter a message (max. 250 characters)."),
|
||||||
"", false, 250, Graphics.width) { scene.pbUpdate }
|
"", false, 250, Graphics.width) { scene.update }
|
||||||
if message != ""
|
if message != ""
|
||||||
# Store mail if a message was written
|
# Store mail if a message was written
|
||||||
poke1 = poke2 = nil
|
poke1 = poke2 = nil
|
||||||
@@ -120,6 +120,6 @@ def pbWriteMail(item, pkmn, pkmnid, scene)
|
|||||||
pbStoreMail(pkmn, item, message, poke1, poke2, poke3)
|
pbStoreMail(pkmn, item, message, poke1, poke2, poke3)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false if scene.pbConfirm(_INTL("Stop giving the Pokémon Mail?"))
|
return false if scene.show_confirm_message(_INTL("Stop giving the Pokémon Mail?"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class HeldItemIconSprite < Sprite
|
|||||||
self.y = y
|
self.y = y
|
||||||
@pokemon = pokemon
|
@pokemon = pokemon
|
||||||
@item = nil
|
@item = nil
|
||||||
self.item = @pokemon.item_id
|
self.item = @pokemon&.item_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def dispose
|
def dispose
|
||||||
@@ -130,7 +130,7 @@ class HeldItemIconSprite < Sprite
|
|||||||
|
|
||||||
def pokemon=(value)
|
def pokemon=(value)
|
||||||
@pokemon = value
|
@pokemon = value
|
||||||
self.item = @pokemon.item_id
|
self.item = @pokemon&.item_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def item=(value)
|
def item=(value)
|
||||||
@@ -148,7 +148,7 @@ class HeldItemIconSprite < Sprite
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
super
|
super
|
||||||
self.item = @pokemon.item_id
|
self.item = @pokemon&.item_id
|
||||||
if @animbitmap
|
if @animbitmap
|
||||||
@animbitmap.update
|
@animbitmap.update
|
||||||
self.bitmap = @animbitmap.bitmap
|
self.bitmap = @animbitmap.bitmap
|
||||||
|
|||||||
@@ -686,10 +686,7 @@ class PokemonParty_Scene
|
|||||||
self.update
|
self.update
|
||||||
break if oldsprite.x == old_start_x - (old_mult * Graphics.width / 2)
|
break if oldsprite.x == old_start_x - (old_mult * Graphics.width / 2)
|
||||||
end
|
end
|
||||||
Settings::MAX_PARTY_SIZE.times do |i|
|
pbClearSwitching
|
||||||
@sprites["pokemon#{i}"].preselected = false
|
|
||||||
@sprites["pokemon#{i}"].switching = false
|
|
||||||
end
|
|
||||||
pbRefresh
|
pbRefresh
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -914,43 +911,6 @@ class PokemonPartyScreen
|
|||||||
@scene.pbStartScene(@party, helptext, annotations)
|
@scene.pbStartScene(@party, helptext, annotations)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChoosePokemon(helptext = nil)
|
|
||||||
@scene.pbSetHelpText(helptext) if helptext
|
|
||||||
return @scene.pbChoosePokemon
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbPokemonGiveScreen(item)
|
|
||||||
@scene.pbStartScene(@party, _INTL("Give to which Pokémon?"))
|
|
||||||
pkmnid = @scene.pbChoosePokemon
|
|
||||||
ret = false
|
|
||||||
if pkmnid >= 0
|
|
||||||
ret = pbGiveItemToPokemon(item, @party[pkmnid], self, pkmnid)
|
|
||||||
end
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
@scene.pbEndScene
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbPokemonGiveMailScreen(mailIndex)
|
|
||||||
@scene.pbStartScene(@party, _INTL("Give to which Pokémon?"))
|
|
||||||
pkmnid = @scene.pbChoosePokemon
|
|
||||||
if pkmnid >= 0
|
|
||||||
pkmn = @party[pkmnid]
|
|
||||||
if pkmn.hasItem? || pkmn.mail
|
|
||||||
pbDisplay(_INTL("This Pokémon is holding an item. It can't hold mail."))
|
|
||||||
elsif pkmn.egg?
|
|
||||||
pbDisplay(_INTL("Eggs can't hold mail."))
|
|
||||||
else
|
|
||||||
pbDisplay(_INTL("Mail was transferred from the Mailbox."))
|
|
||||||
pkmn.mail = $PokemonGlobal.mailbox[mailIndex]
|
|
||||||
pkmn.item = pkmn.mail.item
|
|
||||||
$PokemonGlobal.mailbox.delete_at(mailIndex)
|
|
||||||
pbRefreshSingle(pkmnid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@scene.pbEndScene
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbEndScene
|
def pbEndScene
|
||||||
@scene.pbEndScene
|
@scene.pbEndScene
|
||||||
end
|
end
|
||||||
@@ -1006,6 +966,53 @@ class PokemonPartyScreen
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# For after using an evolution stone.
|
||||||
|
def pbRefreshAnnotations(ableProc)
|
||||||
|
return if !@scene.pbHasAnnotations?
|
||||||
|
annot = []
|
||||||
|
@party.each do |pkmn|
|
||||||
|
elig = ableProc.call(pkmn)
|
||||||
|
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
|
||||||
|
end
|
||||||
|
@scene.pbAnnotate(annot)
|
||||||
|
end
|
||||||
|
|
||||||
|
def pbClearAnnotations
|
||||||
|
@scene.pbAnnotate(nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
def pbPokemonGiveScreen(item)
|
||||||
|
@scene.pbStartScene(@party, _INTL("Give to which Pokémon?"))
|
||||||
|
pkmnid = @scene.pbChoosePokemon
|
||||||
|
ret = false
|
||||||
|
if pkmnid >= 0
|
||||||
|
ret = pbGiveItemToPokemon(item, @party[pkmnid], self, pkmnid)
|
||||||
|
end
|
||||||
|
pbRefreshSingle(pkmnid)
|
||||||
|
@scene.pbEndScene
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
def pbPokemonGiveMailScreen(mailIndex)
|
||||||
|
@scene.pbStartScene(@party, _INTL("Give to which Pokémon?"))
|
||||||
|
pkmnid = @scene.pbChoosePokemon
|
||||||
|
if pkmnid >= 0
|
||||||
|
pkmn = @party[pkmnid]
|
||||||
|
if pkmn.hasItem? || pkmn.mail
|
||||||
|
pbDisplay(_INTL("This Pokémon is holding an item. It can't hold mail."))
|
||||||
|
elsif pkmn.egg?
|
||||||
|
pbDisplay(_INTL("Eggs can't hold mail."))
|
||||||
|
else
|
||||||
|
pbDisplay(_INTL("Mail was transferred from the Mailbox."))
|
||||||
|
pkmn.mail = $PokemonGlobal.mailbox[mailIndex]
|
||||||
|
pkmn.item = pkmn.mail.item
|
||||||
|
$PokemonGlobal.mailbox.delete_at(mailIndex)
|
||||||
|
pbRefreshSingle(pkmnid)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@scene.pbEndScene
|
||||||
|
end
|
||||||
|
|
||||||
def pbSwitch(oldid, newid)
|
def pbSwitch(oldid, newid)
|
||||||
if oldid != newid
|
if oldid != newid
|
||||||
@scene.pbSwitchBegin(oldid, newid)
|
@scene.pbSwitchBegin(oldid, newid)
|
||||||
@@ -1029,21 +1036,6 @@ class PokemonPartyScreen
|
|||||||
return @scene.pbShowCommands(helptext, movenames, index)
|
return @scene.pbShowCommands(helptext, movenames, index)
|
||||||
end
|
end
|
||||||
|
|
||||||
# For after using an evolution stone.
|
|
||||||
def pbRefreshAnnotations(ableProc)
|
|
||||||
return if !@scene.pbHasAnnotations?
|
|
||||||
annot = []
|
|
||||||
@party.each do |pkmn|
|
|
||||||
elig = ableProc.call(pkmn)
|
|
||||||
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
|
|
||||||
end
|
|
||||||
@scene.pbAnnotate(annot)
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbClearAnnotations
|
|
||||||
@scene.pbAnnotate(nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbPokemonMultipleEntryScreenEx(ruleset)
|
def pbPokemonMultipleEntryScreenEx(ruleset)
|
||||||
annot = []
|
annot = []
|
||||||
statuses = []
|
statuses = []
|
||||||
@@ -1134,6 +1126,11 @@ class PokemonPartyScreen
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pbChoosePokemon(helptext = nil)
|
||||||
|
@scene.pbSetHelpText(helptext) if helptext
|
||||||
|
return @scene.pbChoosePokemon
|
||||||
|
end
|
||||||
|
|
||||||
def pbChooseAblePokemon(ableProc, allowIneligible = false)
|
def pbChooseAblePokemon(ableProc, allowIneligible = false)
|
||||||
annot = []
|
annot = []
|
||||||
eligibility = []
|
eligibility = []
|
||||||
@@ -1480,78 +1477,3 @@ MenuHandlers.add(:party_menu_item, :move, {
|
|||||||
screen.scene.pbSelect(old_party_idx) if !moved
|
screen.scene.pbSelect(old_party_idx) if !moved
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
#===============================================================================
|
|
||||||
# Open the party screen.
|
|
||||||
#===============================================================================
|
|
||||||
def pbPokemonScreen
|
|
||||||
pbFadeOutIn do
|
|
||||||
sscene = PokemonParty_Scene.new
|
|
||||||
sscreen = PokemonPartyScreen.new(sscene, $player.party)
|
|
||||||
sscreen.pbPokemonScreen
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
#===============================================================================
|
|
||||||
# Choose a Pokémon in the party.
|
|
||||||
#===============================================================================
|
|
||||||
# Choose a Pokémon/egg from the party.
|
|
||||||
# Stores result in variable _variableNumber_ and the chosen Pokémon's name in
|
|
||||||
# variable _nameVarNumber_; result is -1 if no Pokémon was chosen
|
|
||||||
def pbChoosePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
|
|
||||||
chosen = 0
|
|
||||||
pbFadeOutIn do
|
|
||||||
scene = PokemonParty_Scene.new
|
|
||||||
screen = PokemonPartyScreen.new(scene, $player.party)
|
|
||||||
if ableProc
|
|
||||||
chosen = screen.pbChooseAblePokemon(ableProc, allowIneligible)
|
|
||||||
else
|
|
||||||
screen.pbStartScene(_INTL("Choose a Pokémon."), false)
|
|
||||||
chosen = screen.pbChoosePokemon
|
|
||||||
screen.pbEndScene
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pbSet(variableNumber, chosen)
|
|
||||||
if chosen >= 0
|
|
||||||
pbSet(nameVarNumber, $player.party[chosen].name)
|
|
||||||
else
|
|
||||||
pbSet(nameVarNumber, "")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbChooseNonEggPokemon(variableNumber, nameVarNumber)
|
|
||||||
pbChoosePokemon(variableNumber, nameVarNumber, proc { |pkmn| !pkmn.egg? })
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbChooseAblePokemon(variableNumber, nameVarNumber)
|
|
||||||
pbChoosePokemon(variableNumber, nameVarNumber, proc { |pkmn| !pkmn.egg? && pkmn.hp > 0 })
|
|
||||||
end
|
|
||||||
|
|
||||||
# Same as pbChoosePokemon, but prevents choosing an egg or a Shadow Pokémon.
|
|
||||||
def pbChooseTradablePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
|
|
||||||
chosen = 0
|
|
||||||
pbFadeOutIn do
|
|
||||||
scene = PokemonParty_Scene.new
|
|
||||||
screen = PokemonPartyScreen.new(scene, $player.party)
|
|
||||||
if ableProc
|
|
||||||
chosen = screen.pbChooseTradablePokemon(ableProc, allowIneligible)
|
|
||||||
else
|
|
||||||
screen.pbStartScene(_INTL("Choose a Pokémon."), false)
|
|
||||||
chosen = screen.pbChoosePokemon
|
|
||||||
screen.pbEndScene
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pbSet(variableNumber, chosen)
|
|
||||||
if chosen >= 0
|
|
||||||
pbSet(nameVarNumber, $player.party[chosen].name)
|
|
||||||
else
|
|
||||||
pbSet(nameVarNumber, "")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbChoosePokemonForTrade(variableNumber, nameVarNumber, wanted)
|
|
||||||
wanted = GameData::Species.get(wanted).species
|
|
||||||
pbChooseTradablePokemon(variableNumber, nameVarNumber, proc { |pkmn|
|
|
||||||
next pkmn.species == wanted
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -513,10 +513,11 @@ class PokemonBagScreen
|
|||||||
@scene.pbDisplay(_INTL("The {1} can't be held.", itm.portion_name))
|
@scene.pbDisplay(_INTL("The {1} can't be held.", itm.portion_name))
|
||||||
else
|
else
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
sscene = PokemonParty_Scene.new
|
screen = UI::Party.new($player.party, mode: :choose_pokemon)
|
||||||
sscreen = PokemonPartyScreen.new(sscene, $player.party)
|
screen.choose_pokemon do |pkmn, party_index|
|
||||||
sscreen.pbPokemonGiveScreen(item)
|
pbGiveItemToPokemon(item, screen.pokemon, screen, chosen) if party_index >= 0
|
||||||
@scene.pbRefresh
|
next true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif cmdToss >= 0 && command == cmdToss # Toss item
|
elsif cmdToss >= 0 && command == cmdToss # Toss item
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ class PokemonReadyMenu
|
|||||||
user = $player.party[commands[0][command[1]][3]]
|
user = $player.party[commands[0][command[1]][3]]
|
||||||
if move == :FLY
|
if move == :FLY
|
||||||
ret = nil
|
ret = nil
|
||||||
pbFadeOutInWithUpdate(99999, @scene.sprites) do
|
pbFadeOutInWithUpdate(@scene.sprites) do
|
||||||
pbHideMenu
|
pbHideMenu
|
||||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||||
screen = PokemonRegionMapScreen.new(scene)
|
screen = PokemonRegionMapScreen.new(scene)
|
||||||
|
|||||||
@@ -1576,7 +1576,7 @@ class PokemonStorageScreen
|
|||||||
elsif cmdRelease >= 0 && command == cmdRelease # Release
|
elsif cmdRelease >= 0 && command == cmdRelease # Release
|
||||||
pbRelease(selected, @heldpkmn)
|
pbRelease(selected, @heldpkmn)
|
||||||
elsif cmdDebug >= 0 && command == cmdDebug # Debug
|
elsif cmdDebug >= 0 && command == cmdDebug # Debug
|
||||||
pbPokemonDebug((@heldpkmn) ? @heldpkmn : pokemon, selected, heldpoke)
|
pokemon_debug_menu((@heldpkmn) ? @heldpkmn : pokemon, selected, heldpoke)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ def pbPCMailbox
|
|||||||
commands.push(_INTL("Cancel"))
|
commands.push(_INTL("Cancel"))
|
||||||
command = pbShowCommands(nil, commands, -1, command)
|
command = pbShowCommands(nil, commands, -1, command)
|
||||||
if command >= 0 && command < $PokemonGlobal.mailbox.length
|
if command >= 0 && command < $PokemonGlobal.mailbox.length
|
||||||
mailIndex = command
|
mail_index = command
|
||||||
commandMail = pbMessage(
|
commandMail = pbMessage(
|
||||||
_INTL("What do you want to do with {1}'s Mail?", $PokemonGlobal.mailbox[mailIndex].sender),
|
_INTL("What do you want to do with {1}'s Mail?", $PokemonGlobal.mailbox[mail_index].sender),
|
||||||
[_INTL("Read"),
|
[_INTL("Read"),
|
||||||
_INTL("Move to Bag"),
|
_INTL("Move to Bag"),
|
||||||
_INTL("Give"),
|
_INTL("Give"),
|
||||||
@@ -79,22 +79,36 @@ def pbPCMailbox
|
|||||||
case commandMail
|
case commandMail
|
||||||
when 0 # Read
|
when 0 # Read
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
pbDisplayMail($PokemonGlobal.mailbox[mailIndex])
|
pbDisplayMail($PokemonGlobal.mailbox[mail_index])
|
||||||
end
|
end
|
||||||
when 1 # Move to Bag
|
when 1 # Move to Bag
|
||||||
if pbConfirmMessage(_INTL("The message will be lost. Is that OK?"))
|
if pbConfirmMessage(_INTL("The message will be lost. Is that OK?"))
|
||||||
if $bag.add($PokemonGlobal.mailbox[mailIndex].item)
|
if $bag.add($PokemonGlobal.mailbox[mail_index].item)
|
||||||
pbMessage(_INTL("The Mail was returned to the Bag with its message erased."))
|
pbMessage(_INTL("The Mail was returned to the Bag with its message erased."))
|
||||||
$PokemonGlobal.mailbox.delete_at(mailIndex)
|
$PokemonGlobal.mailbox.delete_at(mail_index)
|
||||||
else
|
else
|
||||||
pbMessage(_INTL("The Bag is full."))
|
pbMessage(_INTL("The Bag is full."))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when 2 # Give
|
when 2 # Give
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
sscene = PokemonParty_Scene.new
|
screen = UI::Party.new($player.party, mode: :choose_pokemon)
|
||||||
sscreen = PokemonPartyScreen.new(sscene, $player.party)
|
screen.choose_pokemon do |pkmn, party_index|
|
||||||
sscreen.pbPokemonGiveMailScreen(mailIndex)
|
next true if party_index < 0
|
||||||
|
if pkmn.egg?
|
||||||
|
screen.show_message(_INTL("Eggs can't hold mail."))
|
||||||
|
elsif pkmn.hasItem? || pkmn.mail
|
||||||
|
screen.show_message(_INTL("This Pokémon is holding an item. It can't hold mail."))
|
||||||
|
else
|
||||||
|
pkmn.mail = $PokemonGlobal.mailbox[mail_index]
|
||||||
|
pkmn.item = pkmn.mail.item
|
||||||
|
$PokemonGlobal.mailbox.delete_at(mail_index)
|
||||||
|
screen.refresh
|
||||||
|
screen.show_message(_INTL("Mail was transferred from the Mailbox."))
|
||||||
|
next true
|
||||||
|
end
|
||||||
|
next false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2,60 +2,17 @@ module UI
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# The visuals class.
|
# The visuals class.
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
class BaseVisuals
|
module SpriteContainerMixin
|
||||||
UI_FOLDER = "Graphics/UI/"
|
UI_FOLDER = "Graphics/UI/"
|
||||||
GRAPHICS_FOLDER = "" # Subfolder in UI_FOLDER
|
GRAPHICS_FOLDER = "" # Subfolder in UI_FOLDER
|
||||||
BACKGROUND_FILENAME = "bg"
|
|
||||||
TEXT_COLOR_THEMES = { # These color themes are added to @sprites[:overlay]
|
TEXT_COLOR_THEMES = { # These color themes are added to @sprites[:overlay]
|
||||||
:default => [Color.new(72, 72, 72), Color.new(160, 160, 160)] # Base and shadow colour
|
:default => [Color.new(72, 72, 72), Color.new(160, 160, 160)] # Base and shadow colour
|
||||||
}
|
}
|
||||||
|
|
||||||
def initialize
|
def add_overlay(overlay, overlay_width = -1, overlay_height = -1)
|
||||||
@bitmaps = {}
|
overlay_width = Graphics.width if overlay_width < 0
|
||||||
@sprites = {}
|
overlay_height = Graphics.height if overlay_height < 0
|
||||||
initialize_viewport
|
@sprites[overlay] = BitmapSprite.new(overlay_width, overlay_height, @viewport)
|
||||||
initialize_bitmaps
|
|
||||||
initialize_background
|
|
||||||
initialize_overlay
|
|
||||||
initialize_message_box
|
|
||||||
# TODO: Initialize dialogue box for messages to use.
|
|
||||||
initialize_sprites
|
|
||||||
refresh
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_viewport
|
|
||||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
|
||||||
@viewport.z = 99999
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_bitmaps
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_background
|
|
||||||
addBackgroundPlane(@sprites, :background, self.class::GRAPHICS_FOLDER + background_filename, @viewport)
|
|
||||||
@sprites[:background].z = -1000
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_overlay
|
|
||||||
add_overlay(:overlay)
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_message_box
|
|
||||||
@sprites[:message_box] = Window_AdvancedTextPokemon.new("")
|
|
||||||
@sprites[:message_box].viewport = @viewport
|
|
||||||
@sprites[:message_box].z = 2000
|
|
||||||
@sprites[:message_box].visible = false
|
|
||||||
@sprites[:message_box].letterbyletter = true
|
|
||||||
pbBottomLeftLines(@sprites[:message_box], 2)
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_sprites
|
|
||||||
end
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
def add_overlay(overlay)
|
|
||||||
@sprites[overlay] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
|
||||||
@sprites[overlay].z = 1000
|
@sprites[overlay].z = 1000
|
||||||
self.class::TEXT_COLOR_THEMES.each_pair { |key, values| @sprites[overlay].add_text_theme(key, *values) }
|
self.class::TEXT_COLOR_THEMES.each_pair { |key, values| @sprites[overlay].add_text_theme(key, *values) }
|
||||||
pbSetSystemFont(@sprites[overlay].bitmap)
|
pbSetSystemFont(@sprites[overlay].bitmap)
|
||||||
@@ -85,20 +42,16 @@ module UI
|
|||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
def fade_in
|
|
||||||
pbFadeInAndShow(@sprites) { update_visuals }
|
|
||||||
end
|
|
||||||
|
|
||||||
def fade_out
|
|
||||||
pbFadeOutAndHide(@sprites) { update_visuals }
|
|
||||||
end
|
|
||||||
|
|
||||||
def dispose
|
def dispose
|
||||||
@sprites.each_value { |s| s.dispose if s && !s.disposed? }
|
@sprites.each_value { |s| s.dispose if s && !s.disposed? }
|
||||||
@sprites.clear
|
@sprites.clear
|
||||||
@bitmaps.each_value { |b| b.dispose if b && !b.disposed? }
|
@bitmaps.each_value { |b| b.dispose if b && !b.disposed? }
|
||||||
@bitmaps.clear
|
@bitmaps.clear
|
||||||
@viewport.dispose
|
@disposed = true
|
||||||
|
end
|
||||||
|
|
||||||
|
def disposed?
|
||||||
|
return !!@disposed
|
||||||
end
|
end
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -126,123 +79,6 @@ module UI
|
|||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
def show_message(text)
|
|
||||||
@sprites[:message_box].text = text
|
|
||||||
@sprites[:message_box].visible = true
|
|
||||||
loop do
|
|
||||||
Graphics.update
|
|
||||||
Input.update
|
|
||||||
update_visuals
|
|
||||||
if @sprites[:message_box].busy?
|
|
||||||
if Input.trigger?(Input::USE)
|
|
||||||
pbPlayDecisionSE if @sprites[:message_box].pausing?
|
|
||||||
@sprites[:message_box].resume
|
|
||||||
end
|
|
||||||
elsif Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@sprites[:message_box].visible = false
|
|
||||||
end
|
|
||||||
|
|
||||||
def show_confirm_message(text)
|
|
||||||
ret = false
|
|
||||||
@sprites[:message_box].text = text
|
|
||||||
@sprites[:message_box].visible = true
|
|
||||||
using(cmd_window = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) do
|
|
||||||
cmd_window.z = @viewport.z + 1
|
|
||||||
cmd_window.visible = false
|
|
||||||
pbBottomRight(cmd_window)
|
|
||||||
cmd_window.y -= @sprites[:message_box].height
|
|
||||||
loop do
|
|
||||||
Graphics.update
|
|
||||||
Input.update
|
|
||||||
update_visuals
|
|
||||||
cmd_window.visible = true if !@sprites[:message_box].busy?
|
|
||||||
cmd_window.update
|
|
||||||
if !@sprites[:message_box].busy?
|
|
||||||
if Input.trigger?(Input::BACK)
|
|
||||||
pbPlayCancelSE
|
|
||||||
ret = false
|
|
||||||
break
|
|
||||||
elsif Input.trigger?(Input::USE) && @sprites[:message_box].resume
|
|
||||||
pbPlayDecisionSE
|
|
||||||
ret = (cmd_window.index == 0)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@sprites[:message_box].visible = false
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
def show_choice_message(text, options, index = 0)
|
|
||||||
ret = -1
|
|
||||||
commands = options
|
|
||||||
commands = options.values if options.is_a?(Hash)
|
|
||||||
@sprites[:message_box].text = text
|
|
||||||
@sprites[:message_box].visible = true
|
|
||||||
using(cmd_window = Window_CommandPokemon.new(commands)) do
|
|
||||||
cmd_window.z = @viewport.z + 1
|
|
||||||
cmd_window.visible = false
|
|
||||||
cmd_window.index = index
|
|
||||||
pbBottomRight(cmd_window)
|
|
||||||
cmd_window.y -= @sprites[:message_box].height
|
|
||||||
loop do
|
|
||||||
Graphics.update
|
|
||||||
Input.update
|
|
||||||
update_visuals
|
|
||||||
cmd_window.visible = true if !@sprites[:message_box].busy?
|
|
||||||
cmd_window.update
|
|
||||||
if !@sprites[:message_box].busy?
|
|
||||||
if Input.trigger?(Input::BACK)
|
|
||||||
pbPlayCancelSE
|
|
||||||
ret = -1
|
|
||||||
break
|
|
||||||
elsif Input.trigger?(Input::USE) && @sprites[:message_box].resume
|
|
||||||
pbPlayDecisionSE
|
|
||||||
ret = cmd_window.index
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@sprites[:message_box].visible = false
|
|
||||||
ret = options.keys[ret] if options.is_a?(Hash)
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
def show_choice(options, index = 0)
|
|
||||||
ret = -1
|
|
||||||
commands = options
|
|
||||||
commands = options.values if options.is_a?(Hash)
|
|
||||||
using(cmd_window = Window_CommandPokemon.new(commands)) do
|
|
||||||
cmd_window.z = @viewport.z + 1
|
|
||||||
cmd_window.index = index
|
|
||||||
pbBottomRight(cmd_window)
|
|
||||||
loop do
|
|
||||||
Graphics.update
|
|
||||||
Input.update
|
|
||||||
update_visuals
|
|
||||||
cmd_window.update
|
|
||||||
if Input.trigger?(Input::BACK)
|
|
||||||
pbPlayCancelSE
|
|
||||||
ret = -1
|
|
||||||
break
|
|
||||||
elsif Input.trigger?(Input::USE)
|
|
||||||
pbPlayDecisionSE
|
|
||||||
ret = cmd_window.index
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
ret = options.keys[ret] if options.is_a?(Hash)
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# NOTE: max_width should include the width of the text shadow at the end of
|
# NOTE: max_width should include the width of the text shadow at the end of
|
||||||
# the string (because characters in the font have a blank 2 pixels
|
# the string (because characters in the font have a blank 2 pixels
|
||||||
# after them for the shadow to occupy).
|
# after them for the shadow to occupy).
|
||||||
@@ -316,6 +152,311 @@ module UI
|
|||||||
pbUpdateSpriteHash(@sprites)
|
pbUpdateSpriteHash(@sprites)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
update_visuals
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# The visuals class.
|
||||||
|
#=============================================================================
|
||||||
|
class SpriteContainer
|
||||||
|
attr_reader :x, :y, :z, :visible, :color
|
||||||
|
|
||||||
|
include SpriteContainerMixin
|
||||||
|
|
||||||
|
def initialize(viewport)
|
||||||
|
@viewport = viewport
|
||||||
|
@x ||= 0
|
||||||
|
@y ||= 0
|
||||||
|
@z ||= 0
|
||||||
|
@visible = true
|
||||||
|
@color = Color.new(0, 0, 0, 0)
|
||||||
|
@bitmaps = {}
|
||||||
|
@sprites = {}
|
||||||
|
@sprites_values = {}
|
||||||
|
initialize_bitmaps
|
||||||
|
initialize_sprites
|
||||||
|
refresh_sprites_values
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_bitmaps
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_sprites
|
||||||
|
end
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# x, y, z, visible, opacity, color
|
||||||
|
def x=(value)
|
||||||
|
@x = value
|
||||||
|
@sprites.each_pair do |key, sprite|
|
||||||
|
sprite.x = @x + @sprites_values[key][:x]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def y=(value)
|
||||||
|
@y = value
|
||||||
|
@sprites.each_pair do |key, sprite|
|
||||||
|
sprite.y = @y + @sprites_values[key][:y]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def z=(value)
|
||||||
|
@z = value
|
||||||
|
@sprites.each_pair do |key, sprite|
|
||||||
|
sprite.z = @z + @sprites_values[key][:z]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def visible=(value)
|
||||||
|
@visible = value
|
||||||
|
@sprites.each_pair do |key, sprite|
|
||||||
|
sprite.visible = @visible && @sprites_values[key][:visible]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def color=(value)
|
||||||
|
@color = value
|
||||||
|
@sprites.each_pair do |key, sprite|
|
||||||
|
sprite.color = @color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def record_values(key)
|
||||||
|
@sprites_values[key] ||= {}
|
||||||
|
@sprites_values[key][:x] = @sprites[key].x
|
||||||
|
@sprites_values[key][:y] = @sprites[key].y
|
||||||
|
@sprites_values[key][:z] = @sprites[key].z
|
||||||
|
@sprites_values[key][:visible] = @sprites[key].visible
|
||||||
|
end
|
||||||
|
|
||||||
|
def refresh_sprites_values
|
||||||
|
self.x = @x
|
||||||
|
self.y = @y
|
||||||
|
self.z = @z
|
||||||
|
self.visible = @visible
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# The visuals class.
|
||||||
|
#=============================================================================
|
||||||
|
class BaseVisuals
|
||||||
|
BACKGROUND_FILENAME = "bg"
|
||||||
|
|
||||||
|
include SpriteContainerMixin
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@bitmaps = {}
|
||||||
|
@sprites = {}
|
||||||
|
initialize_viewport
|
||||||
|
initialize_bitmaps
|
||||||
|
initialize_background
|
||||||
|
initialize_overlay
|
||||||
|
initialize_message_box
|
||||||
|
initialize_sprites
|
||||||
|
refresh
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_viewport
|
||||||
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
|
@viewport.z = 99999
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_bitmaps
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_background
|
||||||
|
addBackgroundPlane(@sprites, :background, self.class::GRAPHICS_FOLDER + background_filename, @viewport)
|
||||||
|
@sprites[:background].z = -1000
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_overlay
|
||||||
|
add_overlay(:overlay)
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_message_box
|
||||||
|
@sprites[:message_box] = Window_AdvancedTextPokemon.new("")
|
||||||
|
@sprites[:message_box].viewport = @viewport
|
||||||
|
@sprites[:message_box].z = 2000
|
||||||
|
@sprites[:message_box].visible = false
|
||||||
|
@sprites[:message_box].letterbyletter = true
|
||||||
|
pbBottomLeftLines(@sprites[:message_box], 2)
|
||||||
|
@sprites[:speech_box] = Window_AdvancedTextPokemon.new("")
|
||||||
|
@sprites[:speech_box].viewport = @viewport
|
||||||
|
@sprites[:speech_box].z = 2001
|
||||||
|
@sprites[:speech_box].visible = false
|
||||||
|
@sprites[:speech_box].letterbyletter = true
|
||||||
|
@sprites[:speech_box].setSkin(MessageConfig.pbGetSpeechFrame)
|
||||||
|
pbBottomLeftLines(@sprites[:speech_box], 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_sprites
|
||||||
|
end
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def fade_in
|
||||||
|
pbFadeInAndShow(@sprites)# { update_visuals }
|
||||||
|
end
|
||||||
|
|
||||||
|
def fade_out
|
||||||
|
pbFadeOutAndHide(@sprites)# { update_visuals }
|
||||||
|
end
|
||||||
|
|
||||||
|
def dispose
|
||||||
|
super
|
||||||
|
@viewport.dispose
|
||||||
|
end
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def show_message(text)
|
||||||
|
@sprites[:speech_box].visible = true
|
||||||
|
@sprites[:speech_box].text = text
|
||||||
|
pbBottomLeftLines(@sprites[:speech_box], 2)
|
||||||
|
loop do
|
||||||
|
Graphics.update
|
||||||
|
Input.update
|
||||||
|
update_visuals
|
||||||
|
if @sprites[:speech_box].busy?
|
||||||
|
if Input.trigger?(Input::USE)
|
||||||
|
pbPlayDecisionSE if @sprites[:speech_box].pausing?
|
||||||
|
@sprites[:speech_box].resume
|
||||||
|
end
|
||||||
|
elsif Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@sprites[:speech_box].visible = false
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_confirm_message(text)
|
||||||
|
ret = false
|
||||||
|
@sprites[:speech_box].visible = true
|
||||||
|
@sprites[:speech_box].text = text
|
||||||
|
pbBottomLeftLines(@sprites[:speech_box], 2)
|
||||||
|
using(cmd_window = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) do
|
||||||
|
cmd_window.z = @viewport.z + 1
|
||||||
|
cmd_window.visible = false
|
||||||
|
pbBottomRight(cmd_window)
|
||||||
|
cmd_window.y -= @sprites[:speech_box].height
|
||||||
|
cmd_window.visible = true if !@sprites[:speech_box].busy?
|
||||||
|
loop do
|
||||||
|
Graphics.update
|
||||||
|
Input.update
|
||||||
|
update_visuals
|
||||||
|
cmd_window.visible = true if !@sprites[:speech_box].busy?
|
||||||
|
cmd_window.update
|
||||||
|
if !@sprites[:speech_box].busy?
|
||||||
|
if Input.trigger?(Input::BACK)
|
||||||
|
pbPlayCancelSE
|
||||||
|
ret = false
|
||||||
|
break
|
||||||
|
elsif Input.trigger?(Input::USE) && @sprites[:speech_box].resume
|
||||||
|
pbPlayDecisionSE
|
||||||
|
ret = (cmd_window.index == 0)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@sprites[:speech_box].visible = false
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
# align: Where the command window is in relation to the message window.
|
||||||
|
# :horizontal is side by side, :vertical is command window above.
|
||||||
|
def show_choice_message(text, options, index = 0, align: :horizontal, cmd_side: :right)
|
||||||
|
ret = -1
|
||||||
|
commands = options
|
||||||
|
commands = options.values if options.is_a?(Hash)
|
||||||
|
@sprites[:speech_box].visible = true
|
||||||
|
@sprites[:speech_box].text = text
|
||||||
|
using(cmd_window = Window_AdvancedCommandPokemon.new(commands)) do
|
||||||
|
if align == :vertical
|
||||||
|
@sprites[:speech_box].resizeHeightToFit(text, Graphics.width)
|
||||||
|
else
|
||||||
|
@sprites[:speech_box].resizeHeightToFit(text, Graphics.width - cmd_window.width)
|
||||||
|
end
|
||||||
|
cmd_window.z = @viewport.z + 1
|
||||||
|
cmd_window.visible = false
|
||||||
|
cmd_window.index = index
|
||||||
|
if cmd_side == :right
|
||||||
|
pbBottomLeft(@sprites[:speech_box])
|
||||||
|
pbBottomRight(cmd_window)
|
||||||
|
else
|
||||||
|
pbBottomRight(@sprites[:speech_box])
|
||||||
|
pbBottomLeft(cmd_window)
|
||||||
|
end
|
||||||
|
if align == :vertical
|
||||||
|
cmd_window.height = [cmd_window.height, Graphics.height - @sprites[:speech_box].height].min
|
||||||
|
cmd_window.y = Graphics.height - @sprites[:speech_box].height - cmd_window.height
|
||||||
|
end
|
||||||
|
cmd_window.visible = true if !@sprites[:speech_box].busy?
|
||||||
|
loop do
|
||||||
|
Graphics.update
|
||||||
|
Input.update
|
||||||
|
update_visuals
|
||||||
|
cmd_window.visible = true if !@sprites[:speech_box].busy?
|
||||||
|
cmd_window.update
|
||||||
|
if !@sprites[:speech_box].busy?
|
||||||
|
if Input.trigger?(Input::BACK)
|
||||||
|
pbPlayCancelSE
|
||||||
|
ret = -1
|
||||||
|
break
|
||||||
|
elsif Input.trigger?(Input::USE) && @sprites[:speech_box].resume
|
||||||
|
pbPlayDecisionSE
|
||||||
|
ret = cmd_window.index
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@sprites[:speech_box].visible = false
|
||||||
|
ret = options.keys[ret] if options.is_a?(Hash)
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_choice(options, index = 0)
|
||||||
|
ret = -1
|
||||||
|
commands = options
|
||||||
|
commands = options.values if options.is_a?(Hash)
|
||||||
|
using(cmd_window = Window_AdvancedCommandPokemon.new(commands)) do
|
||||||
|
cmd_window.z = @viewport.z + 1
|
||||||
|
cmd_window.index = index
|
||||||
|
pbBottomRight(cmd_window)
|
||||||
|
loop do
|
||||||
|
Graphics.update
|
||||||
|
Input.update
|
||||||
|
update_visuals
|
||||||
|
cmd_window.update
|
||||||
|
if Input.trigger?(Input::BACK)
|
||||||
|
pbPlayCancelSE
|
||||||
|
ret = -1
|
||||||
|
break
|
||||||
|
elsif Input.trigger?(Input::USE)
|
||||||
|
pbPlayDecisionSE
|
||||||
|
ret = cmd_window.index
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ret = options.keys[ret] if options.is_a?(Hash)
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
# TODO: Rewrite this.
|
||||||
|
def choose_number(help_text, maximum, init_num = 1)
|
||||||
|
return UIHelper.pbChooseNumber(@sprites[:speech_box], help_text, maximum, init_num) { update_visuals }
|
||||||
|
end
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
def update_input
|
def update_input
|
||||||
if Input.trigger?(Input::BACK)
|
if Input.trigger?(Input::BACK)
|
||||||
return :quit
|
return :quit
|
||||||
@@ -323,11 +464,6 @@ module UI
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# def update
|
|
||||||
# update_visuals
|
|
||||||
# return update_input
|
|
||||||
# end
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
def navigate
|
def navigate
|
||||||
@@ -395,46 +531,72 @@ module UI
|
|||||||
return @visuals.show_choice_message(text, options, initial_index)
|
return @visuals.show_choice_message(text, options, initial_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias pbShowCommands show_choice_message
|
||||||
|
|
||||||
def show_choice(options, initial_index = 0)
|
def show_choice(options, initial_index = 0)
|
||||||
return @visuals.show_choice(options, initial_index)
|
return @visuals.show_choice(options, initial_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
alias pbShowCommands show_choice
|
def show_choice_from_menu_handler(menu_handler_id, message = nil)
|
||||||
|
|
||||||
def show_choice_from_menu_handler(menu_handler_id)
|
|
||||||
commands = {}
|
commands = {}
|
||||||
MenuHandlers.each_available(menu_handler_id, self) do |option, hash, name|
|
MenuHandlers.each_available(menu_handler_id, self) do |option, _hash, name|
|
||||||
commands[option] = name
|
commands[option] = name
|
||||||
end
|
end
|
||||||
|
return show_choice_message(message, commands) if message
|
||||||
return show_choice(commands)
|
return show_choice(commands)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def choose_number(help_text, maximum, init_num = 1)
|
||||||
|
return @visuals.choose_number(help_text, maximum, init_num)
|
||||||
|
end
|
||||||
|
|
||||||
|
alias pbChooseNumber choose_number
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
def refresh
|
def refresh
|
||||||
@visuals.refresh
|
@visuals.refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias pbRefresh refresh
|
||||||
|
|
||||||
|
def update
|
||||||
|
@visuals.update
|
||||||
|
end
|
||||||
|
|
||||||
|
alias pbUpdate update
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def show_and_hide
|
||||||
|
start_screen
|
||||||
|
yield if block_given?
|
||||||
|
end_screen
|
||||||
|
end
|
||||||
|
|
||||||
def main
|
def main
|
||||||
start_screen
|
start_screen
|
||||||
loop do
|
loop do
|
||||||
|
on_start_main_loop
|
||||||
command = @visuals.navigate
|
command = @visuals.navigate
|
||||||
break if command == :quit
|
break if command == :quit
|
||||||
command = perform_action(command)
|
command = perform_action(command)
|
||||||
break if command == :quit
|
break if command == :quit
|
||||||
|
break if @disposed
|
||||||
end
|
end
|
||||||
end_screen
|
end_screen
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def on_start_main_loop
|
||||||
|
end
|
||||||
|
|
||||||
def perform_action(command)
|
def perform_action(command)
|
||||||
return nil if !self.class::SCREEN_ID
|
return nil if !self.class::SCREEN_ID
|
||||||
action_hash = UIActionHandlers.get(self.class::SCREEN_ID, command)
|
action_hash = UIActionHandlers.get(self.class::SCREEN_ID, command)
|
||||||
return nil if !action_hash
|
return nil if !action_hash
|
||||||
return nil if action_hash[:condition] && !action_hash[:condition].call(self)
|
return nil if action_hash[:condition] && !action_hash[:condition].call(self)
|
||||||
if action_hash[:menu]
|
if action_hash[:menu]
|
||||||
choice = show_choice_from_menu_handler(action_hash[:menu])
|
choice = show_choice_from_menu_handler(action_hash[:menu], action_hash[:menu_message]&.call(self))
|
||||||
perform_action(choice) if choice
|
perform_action(choice) if choice
|
||||||
elsif action_hash[:effect]
|
elsif action_hash[:effect]
|
||||||
return perform_action_effect(action_hash)
|
return perform_action_effect(action_hash)
|
||||||
|
|||||||
@@ -200,16 +200,15 @@ MenuHandlers.add(:pause_menu, :party, {
|
|||||||
"condition" => proc { next $player.party_count > 0 },
|
"condition" => proc { next $player.party_count > 0 },
|
||||||
"effect" => proc { |menu|
|
"effect" => proc { |menu|
|
||||||
pbPlayDecisionSE
|
pbPlayDecisionSE
|
||||||
hidden_move = nil
|
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
sscene = PokemonParty_Scene.new
|
UI::Party.new($player.party).main
|
||||||
sscreen = PokemonPartyScreen.new(sscene, $player.party)
|
($game_temp.field_move_to_use) ? menu.silent_end_screen : menu.refresh
|
||||||
hidden_move = sscreen.pbPokemonScreen
|
|
||||||
(hidden_move) ? menu.silent_end_screen : menu.refresh
|
|
||||||
end
|
end
|
||||||
next false if !hidden_move
|
next false if !$game_temp.field_move_to_use
|
||||||
$game_temp.in_menu = false
|
$game_temp.in_menu = false
|
||||||
pbUseHiddenMove(hidden_move[0], hidden_move[1])
|
pbUseHiddenMove($game_temp.field_move_user, $game_temp.field_move_to_use)
|
||||||
|
$game_temp.field_move_user = nil
|
||||||
|
$game_temp.field_move_to_use = nil
|
||||||
next true
|
next true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
1532
Data/Scripts/016b_UI redesign/005_UI_Party.rb
Normal file
1532
Data/Scripts/016b_UI redesign/005_UI_Party.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -218,6 +218,7 @@ class UI::PokemonSummaryVisuals < UI::BaseVisuals
|
|||||||
@page = (@mode == :choose_move) ? :moves : all_pages[0]
|
@page = (@mode == :choose_move) ? :moves : all_pages[0]
|
||||||
@move_index = (@mode == :choose_move) ? 0 : nil
|
@move_index = (@mode == :choose_move) ? 0 : nil
|
||||||
super()
|
super()
|
||||||
|
refresh_move_cursor if @move_index
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize_bitmaps
|
def initialize_bitmaps
|
||||||
@@ -974,9 +975,9 @@ class UI::PokemonSummaryVisuals < UI::BaseVisuals
|
|||||||
def refresh_move_cursor
|
def refresh_move_cursor
|
||||||
# Update cursor positions
|
# Update cursor positions
|
||||||
@sprites[:move_cursor].index = @move_index
|
@sprites[:move_cursor].index = @move_index
|
||||||
@sprites[:selected_move_cursor].index = @swap_move_index
|
@sprites[:selected_move_cursor].index = @swap_move_index || -1
|
||||||
# Update cursor z values
|
# Update cursor z values
|
||||||
if @swap_move_index >= 0
|
if @swap_move_index && @swap_move_index >= 0
|
||||||
@sprites[:selected_move_cursor].z = @sprites[:move_cursor].z + 1
|
@sprites[:selected_move_cursor].z = @sprites[:move_cursor].z + 1
|
||||||
@sprites[:selected_move_cursor].z -= 2 if @move_index != @swap_move_index
|
@sprites[:selected_move_cursor].z -= 2 if @move_index != @swap_move_index
|
||||||
end
|
end
|
||||||
@@ -1417,7 +1418,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Actions that can be triggered in the Pokémon summary screen.
|
# Actions that can be triggered in the Pokémon summary screen.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :go_to_previous_pokemon,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :go_to_previous_pokemon, {
|
||||||
:effect => proc { |screen|
|
:effect => proc { |screen|
|
||||||
if screen.party_index > 0
|
if screen.party_index > 0
|
||||||
new_index = screen.party_index
|
new_index = screen.party_index
|
||||||
@@ -1434,9 +1435,9 @@ UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :go_to_previous_pokemon,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :go_to_next_pokemon,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :go_to_next_pokemon, {
|
||||||
:effect => proc { |screen|
|
:effect => proc { |screen|
|
||||||
if screen.party_index < screen.party.length - 1
|
if screen.party_index < screen.party.length - 1
|
||||||
new_index = screen.party_index
|
new_index = screen.party_index
|
||||||
@@ -1453,9 +1454,9 @@ UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :go_to_next_pokemon,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :navigate_moves,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :navigate_moves, {
|
||||||
:returns_value => true,
|
:returns_value => true,
|
||||||
:effect => proc { |screen|
|
:effect => proc { |screen|
|
||||||
move_index = screen.visuals.navigate_moves
|
move_index = screen.visuals.navigate_moves
|
||||||
@@ -1463,29 +1464,29 @@ UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :navigate_moves,
|
|||||||
screen.refresh
|
screen.refresh
|
||||||
next nil
|
next nil
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :navigate_ribbons,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :navigate_ribbons, {
|
||||||
:effect => proc { |screen|
|
:effect => proc { |screen|
|
||||||
screen.visuals.navigate_ribbons
|
screen.visuals.navigate_ribbons
|
||||||
screen.refresh
|
screen.refresh
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :marking,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :marking, {
|
||||||
:effect => proc { |screen|
|
:effect => proc { |screen|
|
||||||
screen.visuals.navigate_markings
|
screen.visuals.navigate_markings
|
||||||
screen.refresh
|
screen.refresh
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
# Shows a choice menu using the MenuHandlers options below.
|
# Shows a choice menu using the MenuHandlers options below.
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :interact_menu,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :interact_menu, {
|
||||||
:menu => :summary_screen_interact,
|
:menu => :summary_screen_interact,
|
||||||
:condition => proc { |screen| next screen.mode != :in_battle }
|
:condition => proc { |screen| next screen.mode != :in_battle }
|
||||||
)
|
})
|
||||||
|
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :give_item,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :give_item, {
|
||||||
:effect => proc { |screen|
|
:effect => proc { |screen|
|
||||||
item = nil
|
item = nil
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
@@ -1495,15 +1496,15 @@ UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :give_item,
|
|||||||
end
|
end
|
||||||
screen.refresh if pbGiveItemToPokemon(item, screen.pokemon, screen, screen.party_index)
|
screen.refresh if pbGiveItemToPokemon(item, screen.pokemon, screen, screen.party_index)
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :take_item,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :take_item, {
|
||||||
:effect => proc { |screen|
|
:effect => proc { |screen|
|
||||||
screen.refresh if pbTakeItemFromPokemon(screen.pokemon, screen)
|
screen.refresh if pbTakeItemFromPokemon(screen.pokemon, screen)
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :pokedex,
|
UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :pokedex, {
|
||||||
:effect => proc { |screen|
|
:effect => proc { |screen|
|
||||||
$player.pokedex.register_last_seen(screen.pokemon)
|
$player.pokedex.register_last_seen(screen.pokemon)
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
@@ -1512,7 +1513,7 @@ UIActionHandlers.add(UI::PokemonSummary::SCREEN_ID, :pokedex,
|
|||||||
dex_screen.pbStartSceneSingle(screen.pokemon.species)
|
dex_screen.pbStartSceneSingle(screen.pokemon.species)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Menu options for choice menus that exist in the Pokémon summary screen.
|
# Menu options for choice menus that exist in the Pokémon summary screen.
|
||||||
|
|||||||
@@ -36,17 +36,16 @@ end
|
|||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbEntryScreen(*arg)
|
def pbEntryScreen(*arg)
|
||||||
retval = false
|
ret_val = false
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
scene = PokemonParty_Scene.new
|
screen = UI::Party.new($player.party, mode: :choose_entry_order)
|
||||||
screen = PokemonPartyScreen.new(scene, $player.party)
|
ret = screen.choose_pokemon_entry_order(pbBattleChallenge.rules.ruleset)
|
||||||
ret = screen.pbPokemonMultipleEntryScreenEx(pbBattleChallenge.rules.ruleset)
|
|
||||||
# Set party
|
# Set party
|
||||||
pbBattleChallenge.setParty(ret) if ret
|
pbBattleChallenge.setParty(ret) if ret
|
||||||
# Continue (return true) if Pokémon were chosen
|
# Continue (return true) if Pokémon were chosen
|
||||||
retval = (ret && ret.length > 0)
|
ret_val = (ret && ret.length > 0)
|
||||||
end
|
end
|
||||||
return retval
|
return ret_val
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|||||||
@@ -445,39 +445,35 @@ def pbMoveTutorAnnotations(move, movelist = nil)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbMoveTutorChoose(move, movelist = nil, bymachine = false, oneusemachine = false)
|
def pbMoveTutorChoose(move, movelist = nil, by_machine = false, one_use_machine = false)
|
||||||
ret = false
|
ret = false
|
||||||
move = GameData::Move.get(move).id
|
move = GameData::Move.get(move).id
|
||||||
if movelist.is_a?(Array)
|
if movelist.is_a?(Array)
|
||||||
movelist.map! { |m| GameData::Move.get(m).id }
|
movelist.map! { |m| GameData::Move.get(m).id }
|
||||||
end
|
end
|
||||||
pbFadeOutIn do
|
pbFadeOutIn do
|
||||||
movename = GameData::Move.get(move).name
|
move_name = GameData::Move.get(move).name
|
||||||
|
screen = UI::Party.new($player.party, mode: :teach_pokemon)
|
||||||
annot = pbMoveTutorAnnotations(move, movelist)
|
annot = pbMoveTutorAnnotations(move, movelist)
|
||||||
scene = PokemonParty_Scene.new
|
screen.set_annotations(annot)
|
||||||
screen = PokemonPartyScreen.new(scene, $player.party)
|
screen.choose_pokemon do |pkmn, party_index|
|
||||||
screen.pbStartScene(_INTL("Teach which Pokémon?"), false, annot)
|
next true if party_index < 0
|
||||||
loop do
|
if pkmn.egg?
|
||||||
chosen = screen.pbChoosePokemon
|
screen.show_message(_INTL("Eggs can't be taught any moves."))
|
||||||
break if chosen < 0
|
elsif pkmn.shadowPokemon?
|
||||||
pokemon = $player.party[chosen]
|
screen.show_message(_INTL("Shadow Pokémon can't be taught any moves."))
|
||||||
if pokemon.egg?
|
elsif movelist && movelist.none? { |j| j == pkmn.species }
|
||||||
pbMessage(_INTL("Eggs can't be taught any moves.")) { screen.pbUpdate }
|
screen.show_message(_INTL("{1} can't learn {2}.", pkmn.name, move_name))
|
||||||
elsif pokemon.shadowPokemon?
|
elsif !pkmn.compatible_with_move?(move)
|
||||||
pbMessage(_INTL("Shadow Pokémon can't be taught any moves.")) { screen.pbUpdate }
|
screen.show_message(_INTL("{1} can't learn {2}.", pkmn.name, move_name))
|
||||||
elsif movelist && movelist.none? { |j| j == pokemon.species }
|
elsif pbLearnMove(pkmn, move, false, by_machine, screen) { screen.update }
|
||||||
pbMessage(_INTL("{1} can't learn {2}.", pokemon.name, movename)) { screen.pbUpdate }
|
$stats.moves_taught_by_item += 1 if by_machine
|
||||||
elsif !pokemon.compatible_with_move?(move)
|
$stats.moves_taught_by_tutor += 1 if !by_machine
|
||||||
pbMessage(_INTL("{1} can't learn {2}.", pokemon.name, movename)) { screen.pbUpdate }
|
pkmn.add_first_move(move) if one_use_machine
|
||||||
elsif pbLearnMove(pokemon, move, false, bymachine) { screen.pbUpdate }
|
next true
|
||||||
$stats.moves_taught_by_item += 1 if bymachine
|
|
||||||
$stats.moves_taught_by_tutor += 1 if !bymachine
|
|
||||||
pokemon.add_first_move(move) if oneusemachine
|
|
||||||
ret = true
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
|
next false
|
||||||
end
|
end
|
||||||
screen.pbEndScene
|
|
||||||
end
|
end
|
||||||
return ret # Returns whether the move was learned by a Pokemon
|
return ret # Returns whether the move was learned by a Pokemon
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ end
|
|||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
module PokemonDebugMixin
|
module PokemonDebugMixin
|
||||||
def pbPokemonDebug(pkmn, pkmnid, heldpoke = nil, settingUpBattle = false)
|
def pokemon_debug_menu(pkmn, pkmnid, heldpoke = nil, settingUpBattle = false)
|
||||||
# Get all commands
|
# Get all commands
|
||||||
commands = CommandMenuList.new
|
commands = CommandMenuList.new
|
||||||
MenuHandlers.each_available(:pokemon_debug_menu) do |option, hash, name|
|
MenuHandlers.each_available(:pokemon_debug_menu) do |option, hash, name|
|
||||||
@@ -408,7 +408,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokemonPartyScreen
|
class UI::Party
|
||||||
include PokemonDebugMixin
|
include PokemonDebugMixin
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ MenuHandlers.add(:debug_menu, :test_wild_battle_advanced, {
|
|||||||
else # Edit a Pokémon
|
else # Edit a Pokémon
|
||||||
if pbConfirmMessage(_INTL("Change this Pokémon?"))
|
if pbConfirmMessage(_INTL("Change this Pokémon?"))
|
||||||
scr = PokemonDebugPartyScreen.new
|
scr = PokemonDebugPartyScreen.new
|
||||||
scr.pbPokemonDebug(pkmn[pkmnCmd], -1, nil, true)
|
scr.pokemon_debug_menu(pkmn[pkmnCmd], -1, nil, true)
|
||||||
scr.pbEndScreen
|
scr.pbEndScreen
|
||||||
elsif pbConfirmMessage(_INTL("Delete this Pokémon?"))
|
elsif pbConfirmMessage(_INTL("Delete this Pokémon?"))
|
||||||
pkmn.delete_at(pkmnCmd)
|
pkmn.delete_at(pkmnCmd)
|
||||||
|
|||||||
@@ -738,6 +738,7 @@ end
|
|||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Pseudo-party screen for editing Pokémon being set up for a wild battle.
|
# Pseudo-party screen for editing Pokémon being set up for a wild battle.
|
||||||
|
# TODO: Rewrite this with the new UI code.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokemonDebugPartyScreen
|
class PokemonDebugPartyScreen
|
||||||
def initialize
|
def initialize
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# TODO: Rewrite all code in here to replace pbDisplay and whatnot, once storage
|
||||||
|
# screen and PokemonDebugPartyScreen have been rewritten.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# HP/Status options.
|
# HP/Status options.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@@ -90,8 +92,8 @@ MenuHandlers.add(:pokemon_debug_menu, :full_heal, {
|
|||||||
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
|
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
|
||||||
else
|
else
|
||||||
pkmn.heal
|
pkmn.heal
|
||||||
screen.pbDisplay(_INTL("{1} was fully healed.", pkmn.name))
|
|
||||||
screen.pbRefreshSingle(pkmnid)
|
screen.pbRefreshSingle(pkmnid)
|
||||||
|
screen.pbDisplay(_INTL("{1} was fully healed.", pkmn.name))
|
||||||
end
|
end
|
||||||
next false
|
next false
|
||||||
}
|
}
|
||||||
@@ -1018,7 +1020,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_egg, {
|
|||||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||||
cmd = 0
|
cmd = 0
|
||||||
loop do
|
loop do
|
||||||
msg = [_INTL("Not an egg"),
|
msg = [_INTL("Not an egg."),
|
||||||
_INTL("Egg (hatches in {1} steps).", pkmn.steps_to_hatch)][pkmn.egg? ? 1 : 0]
|
_INTL("Egg (hatches in {1} steps).", pkmn.steps_to_hatch)][pkmn.egg? ? 1 : 0]
|
||||||
cmd = screen.pbShowCommands(msg,
|
cmd = screen.pbShowCommands(msg,
|
||||||
[_INTL("Make egg"),
|
[_INTL("Make egg"),
|
||||||
@@ -1113,9 +1115,10 @@ MenuHandlers.add(:pokemon_debug_menu, :duplicate, {
|
|||||||
next false if !screen.pbConfirm(_INTL("Are you sure you want to copy this Pokémon?"))
|
next false if !screen.pbConfirm(_INTL("Are you sure you want to copy this Pokémon?"))
|
||||||
clonedpkmn = pkmn.clone
|
clonedpkmn = pkmn.clone
|
||||||
case screen
|
case screen
|
||||||
when PokemonPartyScreen
|
when UI::Party
|
||||||
pbStorePokemon(clonedpkmn)
|
pbStorePokemon(clonedpkmn)
|
||||||
screen.pbHardRefresh
|
screen.refresh_party
|
||||||
|
screen.refresh
|
||||||
screen.pbDisplay(_INTL("The Pokémon was duplicated."))
|
screen.pbDisplay(_INTL("The Pokémon was duplicated."))
|
||||||
when PokemonStorageScreen
|
when PokemonStorageScreen
|
||||||
if screen.storage.pbMoveCaughtToParty(clonedpkmn)
|
if screen.storage.pbMoveCaughtToParty(clonedpkmn)
|
||||||
@@ -1145,9 +1148,10 @@ MenuHandlers.add(:pokemon_debug_menu, :delete, {
|
|||||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||||
next false if !screen.pbConfirm(_INTL("Are you sure you want to delete this Pokémon?"))
|
next false if !screen.pbConfirm(_INTL("Are you sure you want to delete this Pokémon?"))
|
||||||
case screen
|
case screen
|
||||||
when PokemonPartyScreen
|
when UI::Party
|
||||||
screen.party.delete_at(pkmnid)
|
screen.party.delete_at(pkmnid)
|
||||||
screen.pbHardRefresh
|
screen.refresh_party
|
||||||
|
screen.refresh
|
||||||
when PokemonStorageScreen
|
when PokemonStorageScreen
|
||||||
screen.scene.pbRelease(pkmnid, heldpoke)
|
screen.scene.pbRelease(pkmnid, heldpoke)
|
||||||
(heldpoke) ? screen.heldpkmn = nil : screen.storage.pbDelete(pkmnid[0], pkmnid[1])
|
(heldpoke) ? screen.heldpkmn = nil : screen.storage.pbDelete(pkmnid[0], pkmnid[1])
|
||||||
|
|||||||
Reference in New Issue
Block a user