Yet more script rearranging

This commit is contained in:
Maruno17
2021-04-17 23:45:42 +01:00
parent 96c68e79a3
commit 2ca8a42949
236 changed files with 923 additions and 928 deletions

View File

@@ -0,0 +1,139 @@
class SafariState
attr_accessor :ballcount
attr_accessor :decision
attr_accessor :steps
def initialize
@start = nil
@ballcount = 0
@inProgress = false
@steps = 0
@decision = 0
end
def pbReceptionMap
return @inProgress ? @start[0] : 0
end
def inProgress?
return @inProgress
end
def pbGoToStart
if $scene.is_a?(Scene_Map)
pbFadeOutIn {
$game_temp.player_transferring = true
$game_temp.transition_processing = true
$game_temp.player_new_map_id = @start[0]
$game_temp.player_new_x = @start[1]
$game_temp.player_new_y = @start[2]
$game_temp.player_new_direction = 2
$scene.transfer_player
}
end
end
def pbStart(ballcount)
@start = [$game_map.map_id,$game_player.x,$game_player.y,$game_player.direction]
@ballcount = ballcount
@inProgress = true
@steps = Settings::SAFARI_STEPS
end
def pbEnd
@start = nil
@ballcount = 0
@inProgress = false
@steps = 0
@decision = 0
$game_map.need_refresh = true
end
end
Events.onMapChange += proc { |_sender,*args|
pbSafariState.pbEnd if !pbInSafari?
}
def pbInSafari?
if pbSafariState.inProgress?
# Reception map is handled separately from safari map since the reception
# map can be outdoors, with its own grassy patches.
reception = pbSafariState.pbReceptionMap
return true if $game_map.map_id == reception
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
return true if map_metadata && map_metadata.safari_map
end
return false
end
def pbSafariState
$PokemonGlobal.safariState = SafariState.new if !$PokemonGlobal.safariState
return $PokemonGlobal.safariState
end
Events.onStepTakenTransferPossible += proc { |_sender,e|
handled = e[0]
next if handled[0]
if pbInSafari? && pbSafariState.decision==0 && Settings::SAFARI_STEPS > 0
pbSafariState.steps -= 1
if pbSafariState.steps<=0
pbMessage(_INTL("PA: Ding-dong!\1"))
pbMessage(_INTL("PA: Your safari game is over!"))
pbSafariState.decision = 1
pbSafariState.pbGoToStart
handled[0] = true
end
end
}
Events.onWildBattleOverride += proc { |_sender,e|
species = e[0]
level = e[1]
handled = e[2]
next if handled[0]!=nil
next if !pbInSafari?
handled[0] = pbSafariBattle(species,level)
}
def pbSafariBattle(species,level)
# Generate a wild Pokémon based on the species and level
pkmn = pbGenerateWildPokemon(species,level)
foeParty = [pkmn]
# Calculate who the trainer is
playerTrainer = $Trainer
# Create the battle scene (the visual side of it)
scene = pbNewBattleScene
# Create the battle class (the mechanics side of it)
battle = PokeBattle_SafariZone.new(scene,playerTrainer,foeParty)
battle.ballCount = pbSafariState.ballcount
pbPrepareBattle(battle)
# Perform the battle itself
decision = 0
pbBattleAnimation(pbGetWildBattleBGM(foeParty),0,foeParty) {
pbSceneStandby {
decision = battle.pbStartBattle
}
}
Input.update
# Update Safari game data based on result of battle
pbSafariState.ballcount = battle.ballCount
if pbSafariState.ballcount<=0
if decision!=2 # Last Safari Ball was used to catch the wild Pokémon
pbMessage(_INTL("Announcer: You're out of Safari Balls! Game over!"))
end
pbSafariState.decision = 1
pbSafariState.pbGoToStart
end
# Save the result of the battle in Game Variable 1
# 0 - Undecided or aborted
# 2 - Player ran out of Safari Balls
# 3 - Player or wild Pokémon ran from battle, or player forfeited the match
# 4 - Wild Pokémon was caught
pbSet(1,decision)
# Used by the Poké Radar to update/break the chain
Events.onWildBattleEnd.trigger(nil,species,level,decision)
# Return the outcome of the battle
return decision
end

View File

@@ -0,0 +1,398 @@
class BugContestState
attr_accessor :ballcount
attr_accessor :decision
attr_accessor :lastPokemon
attr_reader :timer
ContestantNames = [
_INTL("Bug Catcher Ed"),
_INTL("Bug Catcher Benny"),
_INTL("Bug Catcher Josh"),
_INTL("Camper Barry"),
_INTL("Cool Trainer Nick"),
_INTL("Lass Abby"),
_INTL("Picnicker Cindy"),
_INTL("Youngster Samuel")
]
TimerSeconds = Settings::BUG_CONTEST_TIME
def initialize
clear
@lastContest=nil
end
def pbContestHeld?
return false if !@lastContest
timenow=pbGetTimeNow
return timenow.to_i-@lastContest<86400
end
def expired?
return false if !undecided?
return false if TimerSeconds<=0
curtime=@timer+TimerSeconds*Graphics.frame_rate
curtime=[curtime-Graphics.frame_count,0].max
return (curtime<=0)
end
def clear
@ballcount=0
@ended=false
@inProgress=false
@decision=0
@encounterMap=0
@lastPokemon=nil
@otherparty=[]
@contestants=[]
@places=[]
@start=nil
@reception=[]
end
def inProgress?
return @inProgress
end
def undecided?
return (@inProgress && @decision==0)
end
def decided?
return (@inProgress && @decision!=0) || @ended
end
def pbSetPokemon(chosenpoke)
@chosenPokemon=chosenpoke
end
# Reception map is handled separately from contest map since the reception map
# can be outdoors, with its own grassy patches.
def pbSetReception(*arg)
@reception=[]
for i in arg
@reception.push(i)
end
end
def pbOffLimits?(map)
# p [map,@contestMap,@reception]
return false if map==@contestMap
for i in @reception
return false if map==i
end
return true
end
def pbSetJudgingPoint(startMap,startX,startY,dir=8)
@start=[startMap,startX,startY,dir]
end
def pbSetContestMap(map)
@contestMap=map
end
def pbJudge
judgearray=[]
if @lastPokemon
judgearray.push([-1,@lastPokemon.species,pbBugContestScore(@lastPokemon)])
end
@contestants=[]
[5,ContestantNames.length].min.times do
loop do
value=rand(ContestantNames.length)
if !@contestants.any? { |i| i==value }
@contestants.push(value)
break
end
end
end
enctype = :BugContest
if !$PokemonEncounters.map_has_encounter_type?(@contestMap, enctype)
enctype = :Land
end
for cont in @contestants
enc=$PokemonEncounters.choose_wild_pokemon_for_map(@contestMap,enctype)
if !enc
raise _INTL("No encounters for map {1}, so can't judge contest",@contestMap)
end
pokemon=Pokemon.new(enc[0],enc[1])
pokemon.hp = rand(1..pokemon.totalhp - 1)
score=pbBugContestScore(pokemon)
judgearray.push([cont,pokemon.species,score])
end
if judgearray.length<3
raise _INTL("Too few bug catching contestants")
end
judgearray.sort! { |a,b| b[2]<=>a[2] } # sort by score in descending order
@places.push(judgearray[0])
@places.push(judgearray[1])
@places.push(judgearray[2])
end
def pbGetPlaceInfo(place)
cont=@places[place][0]
if cont<0
$game_variables[1]=$Trainer.name
else
$game_variables[1]=ContestantNames[cont]
end
$game_variables[2]=GameData::Species.get(@places[place][1]).name
$game_variables[3]=@places[place][2]
end
def pbClearIfEnded
clear if !@inProgress && (!@start || @start[0] != $game_map.map_id)
end
def pbStartJudging
@decision=1
pbJudge
if $scene.is_a?(Scene_Map)
pbFadeOutIn {
$game_temp.player_transferring = true
$game_temp.player_new_map_id = @start[0]
$game_temp.player_new_x = @start[1]
$game_temp.player_new_y = @start[2]
$game_temp.player_new_direction = @start[3]
$scene.transfer_player
$game_map.need_refresh = true # in case player moves to the same map
}
end
end
def pbIsContestant?(i)
return @contestants.any? { |item| i==item }
end
def pbStart(ballcount)
@ballcount=ballcount
@inProgress=true
@otherparty=[]
@lastPokemon=nil
@lastContest=nil
@timer=Graphics.frame_count
@places=[]
chosenpkmn=$Trainer.party[@chosenPokemon]
for i in 0...$Trainer.party.length
@otherparty.push($Trainer.party[i]) if i!=@chosenPokemon
end
@contestants=[]
[5,ContestantNames.length].min.times do
loop do
value=rand(ContestantNames.length)
if !@contestants.any? { |i| i==value }
@contestants.push(value)
break
end
end
end
$Trainer.party=[chosenpkmn]
@decision=0
@ended=false
end
def place
for i in 0...3
return i if @places[i][0]<0
end
return 3
end
def pbEnd(interrupted=false)
return if !@inProgress
for poke in @otherparty
$Trainer.party.push(poke)
end
if !interrupted
if @lastPokemon
pbNicknameAndStore(@lastPokemon)
end
@ended=true
else
@ended=false
end
@lastPokemon=nil
@otherparty=[]
@reception=[]
@ballcount=0
@inProgress=false
@decision=0
timenow=pbGetTimeNow
@lastContest=timenow.to_i
$game_map.need_refresh=true
end
end
class TimerDisplay # :nodoc:
def initialize(start,maxtime)
@timer=Window_AdvancedTextPokemon.newWithSize("",Graphics.width-120,0,120,64)
@timer.z=99999
@total_sec=nil
@start=start
@maxtime=maxtime
end
def dispose
@timer.dispose
end
def disposed?
@timer.disposed?
end
def update
curtime=[(@start+@maxtime)-Graphics.frame_count,0].max
curtime/=Graphics.frame_rate
if curtime != @total_sec
# Calculate total number of seconds
@total_sec = curtime
# Make a string for displaying the timer
min = @total_sec / 60
sec = @total_sec % 60
@timer.text = _ISPRINTF("<ac>{1:02d}:{2:02d}", min, sec)
end
end
end
# Returns a score for this Pokemon in the Bug Catching Contest.
# Not exactly the HGSS calculation, but it should be decent enough.
def pbBugContestScore(pkmn)
levelscore = pkmn.level * 4
ivscore = 0
pkmn.iv.each_value { |iv| ivscore += iv.to_f / Pokemon::IV_STAT_LIMIT }
ivscore = (ivscore * 100).floor
hpscore = (100.0 * pkmn.hp / pkmn.totalhp).floor
catch_rate = pkmn.species_data.catch_rate
rarescore = 60
rarescore += 20 if catch_rate <= 120
rarescore += 20 if catch_rate <= 60
return levelscore + ivscore + hpscore + rarescore
end
def pbBugContestState
if !$PokemonGlobal.bugContestState
$PokemonGlobal.bugContestState=BugContestState.new
end
return $PokemonGlobal.bugContestState
end
# Returns true if the Bug Catching Contest in progress
def pbInBugContest?
return pbBugContestState.inProgress?
end
# Returns true if the Bug Catching Contest in progress and has not yet been judged
def pbBugContestUndecided?
return pbBugContestState.undecided?
end
# Returns true if the Bug Catching Contest in progress and is being judged
def pbBugContestDecided?
return pbBugContestState.decided?
end
Events.onMapChange += proc { |_sender,_e|
pbBugContestState.pbClearIfEnded
}
Events.onMapSceneChange += proc { |_sender,e|
scene=e[0]
if pbInBugContest? && pbBugContestState.decision==0 && BugContestState::TimerSeconds>0
scene.spriteset.addUserSprite(TimerDisplay.new(
pbBugContestState.timer,
BugContestState::TimerSeconds*Graphics.frame_rate))
end
}
Events.onMapUpdate += proc { |_sender,_e|
if !$game_player.move_route_forcing && !pbMapInterpreterRunning? &&
!$game_temp.message_window_showing
if pbBugContestState.expired?
pbMessage(_INTL("ANNOUNCER: BEEEEEP!"))
pbMessage(_INTL("Time's up!"))
pbBugContestState.pbStartJudging
end
end
}
Events.onMapChanging += proc { |_sender,e|
newmapID=e[0]
if pbInBugContest?
if pbBugContestState.pbOffLimits?(newmapID)
# Clear bug contest if player flies/warps/teleports out of the contest
pbBugContestState.pbEnd(true)
end
end
}
def pbBugContestStartOver
$Trainer.party.each do |pkmn|
pkmn.heal
pkmn.makeUnmega
pkmn.makeUnprimal
end
pbBugContestState.pbStartJudging
end
Events.onWildBattleOverride += proc { |_sender,e|
species = e[0]
level = e[1]
handled = e[2]
next if handled[0]!=nil
next if !pbInBugContest?
handled[0] = pbBugContestBattle(species,level)
}
def pbBugContestBattle(species,level)
# Record information about party Pokémon to be used at the end of battle (e.g.
# comparing levels for an evolution check)
Events.onStartBattle.trigger(nil)
# Generate a wild Pokémon based on the species and level
pkmn = pbGenerateWildPokemon(species,level)
foeParty = [pkmn]
# Calculate who the trainers and their party are
playerTrainer = [$Trainer]
playerParty = $Trainer.party
playerPartyStarts = [0]
# Create the battle scene (the visual side of it)
scene = pbNewBattleScene
# Create the battle class (the mechanics side of it)
battle = PokeBattle_BugContestBattle.new(scene,playerParty,foeParty,playerTrainer,nil)
battle.party1starts = playerPartyStarts
battle.ballCount = pbBugContestState.ballcount
setBattleRule("single")
pbPrepareBattle(battle)
# Perform the battle itself
decision = 0
pbBattleAnimation(pbGetWildBattleBGM(foeParty),0,foeParty) {
decision = battle.pbStartBattle
pbAfterBattle(decision,true)
if decision==2 || decision==5 # Lost or drew
$game_system.bgm_unpause
$game_system.bgs_unpause
pbBugContestStartOver
end
}
Input.update
# Update Bug Contest game data based on result of battle
pbBugContestState.ballcount = battle.ballCount
if pbBugContestState.ballcount==0
pbMessage(_INTL("ANNOUNCER: The Bug-Catching Contest is over!"))
pbBugContestState.pbStartJudging
end
# Save the result of the battle in Game Variable 1
# 0 - Undecided or aborted
# 1 - Player won
# 2 - Player lost
# 3 - Player or wild Pokémon ran from battle, or player forfeited the match
# 4 - Wild Pokémon was caught
# 5 - Draw
pbSet(1,decision)
# Used by the Poké Radar to update/break the chain
Events.onWildBattleEnd.trigger(nil,species,level,decision)
# Return false if the player lost or drew the battle, and true if any other result
return (decision!=2 && decision!=5)
end

View File

@@ -0,0 +1,971 @@
#===============================================================================
# Pokémon Organized Battle
#===============================================================================
def pbHasEligible?(*arg)
return pbBattleChallenge.rules.ruleset.hasValidTeam?($Trainer.party)
end
class PBPokemon
attr_accessor :species
attr_accessor :item
attr_accessor :nature
attr_accessor :move1
attr_accessor :move2
attr_accessor :move3
attr_accessor :move4
attr_accessor :ev
def initialize(species,item,nature,move1,move2,move3,move4,ev)
@species = species
itm = GameData::Item.try_get(item)
@item = itm ? itm.id : nil
@nature = nature
@move1 = move1 ? move1 : 0
@move2 = move2 ? move2 : 0
@move3 = move3 ? move3 : 0
@move4 = move4 ? move4 : 0
@ev = ev
end
# This method is how each Pokémon is compiled from the PBS files listing
# Battle Tower/Cup Pokémon.
def self.fromInspected(str)
insp=str.gsub(/^\s+/,"").gsub(/\s+$/,"")
pieces=insp.split(/\s*;\s*/)
species = (GameData::Species.exists?(pieces[0])) ? GameData::Species.get(pieces[0]).id : nil
item = (GameData::Item.exists?(pieces[1])) ? GameData::Item.get(pieces[1]).id : nil
nature = (GameData::Nature.exists?(pieces[2])) ? GameData::Nature.get(pieces[2]).id : nil
ev = pieces[3].split(/\s*,\s*/)
ev_array = []
ev.each do |stat|
case stat.upcase
when "HP" then ev_array.push(:HP)
when "ATK" then ev_array.push(:ATTACK)
when "DEF" then ev_array.push(:DEFENSE)
when "SA", "SPATK" then ev_array.push(:SPECIAL_ATTACK)
when "SD", "SPDEF" then ev_array.push(:SPECIAL_DEFENSE)
when "SPD" then ev_array.push(:SPEED)
end
end
moves=pieces[4].split(/\s*,\s*/)
moveid=[]
for i in 0...Pokemon::MAX_MOVES
move_data = GameData::Move.try_get(moves[i])
moveid.push(move_data.id) if move_data
end
moveid=[GameData::Move.get(1)] if moveid.length==0
return self.new(species, item, nature, moveid[0], moveid[1], moveid[2], moveid[3], ev_array)
end
def self.fromPokemon(pokemon)
mov1 = (pokemon.moves[0]) ? pokemon.moves[0].id : nil
mov2 = (pokemon.moves[1]) ? pokemon.moves[1].id : nil
mov3 = (pokemon.moves[2]) ? pokemon.moves[2].id : nil
mov4 = (pokemon.moves[3]) ? pokemon.moves[3].id : nil
ev_array = []
GameData::Stat.each_main do |s|
ev_array.push(s.id) if pokemon.ev[s.id] > 60
end
return self.new(pokemon.species,pokemon.item_id,pokemon.nature,
mov1,mov2,mov3,mov4,ev_array)
end
# Unused.
def self.constFromStr(mod,str)
maxconst=0
for constant in mod.constants
maxconst=[maxconst,mod.const_get(constant.to_sym)].max
end
for i in 1..maxconst
val=mod.getName(i)
next if !val || val==""
return i if val==str
end
return 0
end
# Unused.
def self.fromString(str)
return self.fromstring(str)
end
# Unused.
def self.fromstring(str)
s=str.split(/\s*,\s*/)
species=GameData::Species.get(s[1]).id
item=s[2].to_sym
nature=GameData::Nature.get(s[3]).id
move1=GameData::Move.get(s[4]).id
move2=(s.length>=12) ? GameData::Move.get(s[5]).id : nil
move3=(s.length>=13) ? GameData::Move.get(s[6]).id : nil
move4=(s.length>=14) ? GameData::Move.get(s[7]).id : nil
slen = s.length - 6
ev_array = []
GameData::Stat.each_main do |s|
ev_array.push(s.id) if s[slen + s.pbs_order].to_i > 0
end
return self.new(species,item,nature,move1,move2,move3,move4,ev_array)
end
=begin
def _dump(depth)
return [@species,@item,@nature,@move1,@move2,
@move3,@move4,@ev].pack("vvCvvvvC")
end
def self._load(str)
data=str.unpack("vvCvvvvC")
return self.new(
data[0],data[1],data[2],data[3],
data[4],data[5],data[6],data[7]
)
end
=end
def inspect
c1=GameData::Species.get(@species).id.to_s
c2=(@item) ? GameData::Item.get(@item).id.to_s : ""
c3=(@nature) ? GameData::Nature.get(@nature).id.to_s : ""
evlist = ""
@ev.each do |stat|
evlist += "," if evlist != ""
evlist += stat.real_name_brief
end
c4=(@move1) ? GameData::Move.get(@move1).id_to_s : ""
c5=(@move2) ? GameData::Move.get(@move2).id_to_s : ""
c6=(@move3) ? GameData::Move.get(@move3).id_to_s : ""
c7=(@move4) ? GameData::Move.get(@move4).id_to_s : ""
return "#{c1};#{c2};#{c3};#{evlist};#{c4},#{c5},#{c6},#{c7}"
end
# Unused.
def tocompact
return "#{species},#{item},#{nature},#{move1},#{move2},#{move3},#{move4},#{ev}"
end
def convertMove(move)
move = :FRUSTRATION if move == :RETURN && GameData::Move.exists?(:FRUSTRATION)
return move
end
def createPokemon(level,iv,trainer)
pokemon=Pokemon.new(@species,level,trainer,false)
pokemon.item = @item
pokemon.personalID = rand(2**16) | rand(2**16) << 16
pokemon.personalID -= pokemon.personalID % 25
pokemon.personalID += nature
pokemon.personalID &= 0xFFFFFFFF
pokemon.happiness=0
pokemon.moves[0] = Pokemon::Move.new(self.convertMove(@move1))
pokemon.moves[1] = Pokemon::Move.new(self.convertMove(@move2))
pokemon.moves[2] = Pokemon::Move.new(self.convertMove(@move3))
pokemon.moves[3] = Pokemon::Move.new(self.convertMove(@move4))
if ev.length > 0
ev.each { |stat| pokemon.ev[stat] = Pokemon::EV_LIMIT / ev.length }
end
GameData::Stat.each_main { |s| pokemon.iv[s.id] = iv }
pokemon.calc_stats
return pokemon
end
end
def pbGetBTTrainers(challengeID)
trlists=(load_data("Data/trainer_lists.dat") rescue [])
for i in 0...trlists.length
tr=trlists[i]
if !tr[5] && tr[2].include?(challengeID)
return tr[0]
end
end
for i in 0...trlists.length
tr=trlists[i]
if tr[5] # is default list
return tr[0]
end
end
return []
end
def pbGetBTPokemon(challengeID)
trlists=(load_data("Data/trainer_lists.dat") rescue [])
for tr in trlists
if !tr[5] && tr[2].include?(challengeID)
return tr[1]
end
end
for tr in trlists
if tr[5] # is default list
return tr[1]
end
end
return []
end
class Game_Player < Game_Character
attr_accessor :direction
def moveto2(x, y)
@x = x
@y = y
@real_x = @x * 128
@real_y = @y * 128
@prelock_direction = 0
end
end
class BattleChallengeType
attr_accessor :currentWins
attr_accessor :previousWins
attr_accessor :maxWins
attr_accessor :currentSwaps
attr_accessor :previousSwaps
attr_accessor :maxSwaps
attr_reader :doublebattle
attr_reader :numPokemon
attr_reader :battletype
attr_reader :mode
def initialize
@previousWins=0
@maxWins=0
@currentWins=0
@currentSwaps=0
@previousSwaps=0
@maxSwaps=0
end
def saveWins(challenge)
if challenge.decision==0 # if undecided
@currentWins=0
@currentSwaps=0
else
if challenge.decision==1 # if won
@currentWins=challenge.wins
@currentSwaps=challenge.swaps
else # if lost
@currentWins=0
@currentSwaps=0
end
@maxWins=[@maxWins,challenge.wins].max
@previousWins=challenge.wins
@maxSwaps=[@maxSwaps,challenge.swaps].max
@previousSwaps=challenge.swaps
end
end
end
class BattleChallengeData
attr_reader :resting
attr_reader :wins
attr_reader :swaps
attr_reader :inProgress
attr_reader :battleNumber
attr_reader :numRounds
attr_accessor :decision
attr_reader :party
attr_reader :extraData
def setExtraData(value)
@extraData=value
end
def pbAddWin
if @inProgress
@battleNumber+=1
@wins+=1
end
end
def pbAddSwap
if @inProgress
@swaps+=1
end
end
def pbMatchOver?
return true if !@inProgress
return true if @decision!=0
return (@battleNumber>@numRounds)
end
def initialize
reset
end
def nextTrainer
return @trainers[@battleNumber-1]
end
def pbGoToStart
if $scene.is_a?(Scene_Map)
$game_temp.player_transferring = true
$game_temp.player_new_map_id = @start[0]
$game_temp.player_new_x = @start[1]
$game_temp.player_new_y = @start[2]
$game_temp.player_new_direction = 8
$scene.transfer_player
end
end
def setParty(value)
if @inProgress
$Trainer.party=value
@party=value
else
@party=value
end
end
def pbStart(t,numRounds)
@inProgress=true
@resting=false
@decision=0
@swaps=t.currentSwaps
@wins=t.currentWins
@battleNumber=1
@trainers=[]
raise _INTL("Number of rounds is 0 or less.") if numRounds<=0
@numRounds=numRounds
btTrainers=pbGetBTTrainers(pbBattleChallenge.currentChallenge)
while @trainers.length<@numRounds
newtrainer=pbBattleChallengeTrainer(@wins+@trainers.length,btTrainers)
found=false
for tr in @trainers
found=true if tr==newtrainer
end
@trainers.push(newtrainer) if !found
end
@start=[$game_map.map_id,$game_player.x,$game_player.y]
@oldParty=$Trainer.party
$Trainer.party=@party if @party
Game.save(safe: true)
end
def pbCancel
$Trainer.party=@oldParty if @oldParty
reset
end
def pbEnd
$Trainer.party=@oldParty
return if !@inProgress
save=(@decision!=0)
reset
$game_map.need_refresh=true
Game.save(safe: true) if save
end
def pbGoOn
return if !@inProgress
@resting=false
pbSaveInProgress
end
def pbRest
return if !@inProgress
@resting=true
pbSaveInProgress
end
private
def reset
@inProgress=false
@resting=false
@start=nil
@decision=0
@wins=0
@swaps=0
@battleNumber=0
@trainers=[]
@oldParty=nil
@party=nil
@extraData=nil
end
def pbSaveInProgress
oldmapid=$game_map.map_id
oldx=$game_player.x
oldy=$game_player.y
olddirection=$game_player.direction
$game_map.map_id=@start[0]
$game_player.moveto2(@start[1],@start[2])
$game_player.direction=8 # facing up
Game.save(safe: true)
$game_map.map_id=oldmapid
$game_player.moveto2(oldx,oldy)
$game_player.direction=olddirection
end
end
class BattleChallenge
attr_reader :currentChallenge
BattleTowerID = 0
BattlePalaceID = 1
BattleArenaID = 2
BattleFactoryID = 3
def initialize
@bc=BattleChallengeData.new
@currentChallenge=-1
@types={}
end
def rules
if !@rules
@rules=modeToRules(self.data.doublebattle,
self.data.numPokemon,
self.data.battletype,self.data.mode)
end
return @rules
end
def modeToRules(doublebattle,numPokemon,battletype,mode)
rules=PokemonChallengeRules.new
if battletype==BattlePalaceID
rules.setBattleType(BattlePalace.new)
elsif battletype==BattleArenaID
rules.setBattleType(BattleArena.new)
doublebattle=false
else
rules.setBattleType(BattleTower.new)
end
if mode==1 # Open Level
rules.setRuleset(StandardRules(numPokemon,GameData::GrowthRate.max_level))
rules.setLevelAdjustment(OpenLevelAdjustment.new(30))
elsif mode==2 # Battle Tent
rules.setRuleset(StandardRules(numPokemon,GameData::GrowthRate.max_level))
rules.setLevelAdjustment(OpenLevelAdjustment.new(60))
else
rules.setRuleset(StandardRules(numPokemon,50))
rules.setLevelAdjustment(OpenLevelAdjustment.new(50))
end
if doublebattle
rules.addBattleRule(DoubleBattle.new)
else
rules.addBattleRule(SingleBattle.new)
end
return rules
end
def set(id,numrounds,rules)
@id=id
@numRounds=numrounds
@rules=rules
pbWriteCup(id,rules)
end
def start(*args)
ensureType(@id)
@currentChallenge=@id # must appear before pbStart
@bc.pbStart(t,@numRounds)
end
def register(id,doublebattle,numrounds,numPokemon,battletype,mode=1)
ensureType(id)
if battletype==BattleFactoryID
@bc.setExtraData(BattleFactoryData.new(@bc))
numPokemon=3
battletype=BattleTowerID
end
@numRounds=numrounds
@rules=modeToRules(doublebattle,numPokemon,battletype,mode)
end
def pbInChallenge?
return pbInProgress?
end
def data
return nil if !pbInProgress? || @currentChallenge<0
return ensureType(@currentChallenge).clone
end
def getCurrentWins(challenge)
return ensureType(challenge).currentWins
end
def getPreviousWins(challenge)
return ensureType(challenge).previousWins
end
def getMaxWins(challenge)
return ensureType(challenge).maxWins
end
def getCurrentSwaps(challenge)
return ensureType(challenge).currentSwaps
end
def getPreviousSwaps(challenge)
return ensureType(challenge).previousSwaps
end
def getMaxSwaps(challenge)
return ensureType(challenge).maxSwaps
end
def pbStart(challenge)
end
def pbEnd
if @currentChallenge!=-1
ensureType(@currentChallenge).saveWins(@bc)
@currentChallenge=-1
end
@bc.pbEnd
end
def pbBattle
return @bc.extraData.pbBattle(self) if @bc.extraData
opponent=pbGenerateBattleTrainer(self.nextTrainer,self.rules)
bttrainers=pbGetBTTrainers(@id)
trainerdata=bttrainers[self.nextTrainer]
ret=pbOrganizedBattleEx(opponent,self.rules,
pbGetMessageFromHash(MessageTypes::EndSpeechLose,trainerdata[4]),
pbGetMessageFromHash(MessageTypes::EndSpeechWin,trainerdata[3]))
return ret
end
def pbInProgress?
return @bc.inProgress
end
def pbResting?
return @bc.resting
end
def setDecision(value)
@bc.decision=value
end
def setParty(value)
@bc.setParty(value)
end
def extra; @bc.extraData; end
def decision; @bc.decision; end
def wins; @bc.wins; end
def swaps; @bc.swaps; end
def battleNumber; @bc.battleNumber; end
def nextTrainer; @bc.nextTrainer; end
def pbGoOn; @bc.pbGoOn; end
def pbAddWin; @bc.pbAddWin; end
def pbCancel; @bc.pbCancel; end
def pbRest; @bc.pbRest; end
def pbMatchOver?; @bc.pbMatchOver?; end
def pbGoToStart; @bc.pbGoToStart; end
private
def ensureType(id)
if @types.is_a?(Array)
oldtypes=@types
@types={}
for i in 0...oldtypes.length
@types[i]=oldtypes[i] if oldtypes[i]
end
end
@types[id]=BattleChallengeType.new if !@types[id]
return @types[id]
end
end
def pbRecordLastBattle
$PokemonGlobal.lastbattle = $PokemonTemp.lastbattle
$PokemonTemp.lastbattle = nil
end
def pbPlayBattle(battledata)
return if !battledata
scene = pbNewBattleScene
scene.abortable = true
lastbattle = Marshal.restore(StringInput.new(battledata))
case lastbattle[0]
when BattleChallenge::BattleTowerID
battleplayer = PokeBattle_BattlePlayer.new(scene,lastbattle)
when BattleChallenge::BattlePalaceID
battleplayer = PokeBattle_BattlePalacePlayer.new(scene,lastbattle)
when BattleChallenge::BattleArenaID
battleplayer = PokeBattle_BattleArenaPlayer.new(scene,lastbattle)
end
bgm = BattlePlayerHelper.pbGetBattleBGM(lastbattle)
pbBattleAnimation(bgm) {
pbSceneStandby {
battleplayer.pbStartBattle
}
}
end
def pbDebugPlayBattle
params = ChooseNumberParams.new
params.setRange(0,500)
params.setInitialValue(0)
params.setCancelValue(-1)
num = pbMessageChooseNumber(_INTL("Choose a battle."),params)
if num>=0
pbPlayBattleFromFile(sprintf("Battles/Battle%03d.dat",num))
end
end
def pbPlayLastBattle
pbPlayBattle($PokemonGlobal.lastbattle)
end
def pbPlayBattleFromFile(filename)
pbRgssOpen(filename,"rb") { |f| pbPlayBattle(f.read) }
end
class Game_Event
def pbInChallenge?
return pbBattleChallenge.pbInChallenge?
end
end
def pbBattleChallenge
if !$PokemonGlobal.challenge
$PokemonGlobal.challenge=BattleChallenge.new
end
return $PokemonGlobal.challenge
end
def pbBattleChallengeTrainer(numwins,bttrainers)
table=[
0,5,0,100,
6,6,80,40,
7,12,80,40,
13,13,120,20,
14,19,100,40,
20,20,140,20,
21,26,120,40,
27,27,160,20,
28,33,140,40,
34,34,180,20,
35,40,160,40,
41,41,200,20,
42,47,180,40,
48,48,220,40,
49,-1,200,100
]
for i in 0...table.length/4
if table[i*4]<=numwins
if (table[i*4+1]<0 || table[i*4+1]>=numwins)
offset=((table[i*4+2]*bttrainers.length).floor/300).floor
length=((table[i*4+3]*bttrainers.length).floor/300).floor
return (offset+rand(length)).floor
end
end
end
return 0
end
def pbBattleChallengeGraphic(event)
nextTrainer=pbBattleChallenge.nextTrainer
bttrainers=pbGetBTTrainers(pbBattleChallenge.currentChallenge)
filename=GameData::TrainerType.charset_filename_brief((bttrainers[nextTrainer][0] rescue 0))
begin
bitmap=AnimatedBitmap.new("Graphics/Characters/"+filename)
bitmap.dispose
event.character_name=filename
rescue
event.character_name="NPC 01"
end
end
def pbBattleChallengeBeginSpeech
if !pbBattleChallenge.pbInProgress?
return "..."
else
bttrainers=pbGetBTTrainers(pbBattleChallenge.currentChallenge)
tr=bttrainers[pbBattleChallenge.nextTrainer]
return tr ? pbGetMessageFromHash(MessageTypes::BeginSpeech,tr[2]) : "..."
end
end
def pbEntryScreen(*arg)
retval = false
pbFadeOutIn {
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene,$Trainer.party)
ret = screen.pbPokemonMultipleEntryScreenEx(pbBattleChallenge.rules.ruleset)
# Set party
pbBattleChallenge.setParty(ret) if ret
# Continue (return true) if Pokémon were chosen
retval = (ret!=nil && ret.length>0)
}
return retval
end
def pbBattleChallengeBattle
return pbBattleChallenge.pbBattle
end
class BattleFactoryData
def initialize(bcdata)
@bcdata=bcdata
end
def pbPrepareRentals
@rentals=pbBattleFactoryPokemon(1,@bcdata.wins,@bcdata.swaps,[])
@trainerid=@bcdata.nextTrainer
bttrainers=pbGetBTTrainers(@bcdata.currentChallenge)
trainerdata=bttrainers[@trainerid]
@opponent=NPCTrainer.new(
pbGetMessageFromHash(MessageTypes::TrainerNames,trainerdata[1]),
trainerdata[0])
opponentPkmn=pbBattleFactoryPokemon(1,@bcdata.wins,@bcdata.swaps,@rentals)
@opponent.party=opponentPkmn.shuffle[0,3]
end
def pbChooseRentals
pbFadeOutIn {
scene = BattleSwapScene.new
screen = BattleSwapScreen.new(scene)
@rentals = screen.pbStartRent(@rentals)
@bcdata.pbAddSwap
pbBattleChallenge.setParty(@rentals)
}
end
def pbBattle(challenge)
bttrainers=pbGetBTTrainers(@bcdata.currentChallenge)
trainerdata=bttrainers[@trainerid]
return pbOrganizedBattleEx(@opponent,challenge.rules,
pbGetMessageFromHash(MessageTypes::EndSpeechLose,trainerdata[4]),
pbGetMessageFromHash(MessageTypes::EndSpeechWin,trainerdata[3]))
end
def pbPrepareSwaps
@oldopponent=@opponent.party
trainerid=@bcdata.nextTrainer
bttrainers=pbGetBTTrainers(@bcdata.currentChallenge)
trainerdata=bttrainers[trainerid]
@opponent=NPCTrainer.new(
pbGetMessageFromHash(MessageTypes::TrainerNames,trainerdata[1]),
trainerdata[0])
opponentPkmn=pbBattleFactoryPokemon(
challenge.rules,@bcdata.wins,@bcdata.swaps,
[].concat(@rentals).concat(@oldopponent))
@opponent.party=opponentPkmn.shuffle[0,3]
end
def pbChooseSwaps
swapMade = true
pbFadeOutIn {
scene = BattleSwapScene.new
screen = BattleSwapScreen.new(scene)
swapMade = screen.pbStartSwap(@rentals,@oldopponent)
if swapMade
@bcdata.pbAddSwap
end
@bcdata.setParty(@rentals)
}
return swapMade
end
end
def pbBattleFactoryPokemon(rule,numwins,numswaps,_rentals)
table=nil
btpokemon=pbGetBTPokemon(pbBattleChallenge.currentChallenge)
ivtable=[
0,6,3,6,
7,13,6,9,
14,20,9,12,
21,27,12,15,
28,34,15,21,
35,41,21,31,
42,-1,31,31
]
groups=[
1,14,6,0,
15,21,5,1,
22,28,4,2,
29,35,3,3,
36,42,2,4,
43,-1,1,5
]
if rule.ruleset.suggestedLevel!=100
table=[
0,6,110,199,
7,13,162,266,
14,20,267,371,
21,27,372,467,
28,34,468,563,
35,41,564,659,
42,48,660,755,
49,-1,372,849
]
else # Open Level (Level 100)
table=[
0,6,372,467,
7,13,468,563,
14,20,564,659,
21,27,660,755,
28,34,372,881,
35,41,372,881,
42,48,372,881,
49,-1,372,881
]
end
pokemonNumbers=[0,0]
ivs=[0,0]
ivgroups=[6,0]
for i in 0...table.length/4
if table[i*4]<=numwins
if (table[i*4+1]<0 || table[i*4+1]>=numwins)
pokemonNumbers=[
table[i*4+2]*btpokemon.length/882,
table[i*4+3]*btpokemon.length/882
]
end
end
end
for i in 0...ivtable.length/4
if ivtable[i*4]<=numwins
if (ivtable[i*4+1]<0 || ivtable[i*4+1]>=numwins)
ivs=[ivtable[i*4+2],ivtable[i*4+3]]
end
end
end
for i in 0...groups.length/4
if groups[i*4]<=numswaps
if (groups[i*4+1]<0 || groups[i*4+1]>=numswaps)
ivgroups=[groups[i*4+2],groups[i*4+3]]
end
end
end
party=[]
loop do
party.clear
while party.length < Settings::MAX_PARTY_SIZE
rnd=pokemonNumbers[0]+rand(pokemonNumbers[1]-pokemonNumbers[0]+1)
rndpoke=btpokemon[rnd]
indvalue=(party.length<ivgroups[0]) ? ivs[0] : ivs[1]
party.push(rndpoke.createPokemon(rule.ruleset.suggestedLevel,indvalue,nil))
end
break if rule.ruleset.isValid?(party)
end
return party
end
def pbGenerateBattleTrainer(trainerid,rule)
bttrainers=pbGetBTTrainers(pbBattleChallenge.currentChallenge)
trainerdata=bttrainers[trainerid]
opponent=NPCTrainer.new(
pbGetMessageFromHash(MessageTypes::TrainerNames,trainerdata[1]),
trainerdata[0])
btpokemon=pbGetBTPokemon(pbBattleChallenge.currentChallenge)
# Individual Values
indvalues=31
indvalues=21 if trainerid<220
indvalues=18 if trainerid<200
indvalues=15 if trainerid<180
indvalues=12 if trainerid<160
indvalues=9 if trainerid<140
indvalues=6 if trainerid<120
indvalues=3 if trainerid<100
pokemonnumbers=trainerdata[5]
#p trainerdata
if pokemonnumbers.length<rule.ruleset.suggestedNumber
for n in pokemonnumbers
rndpoke=btpokemon[n]
pkmn=rndpoke.createPokemon(rule.ruleset.suggestedLevel,indvalues,opponent)
opponent.party.push(pkmn)
end
return opponent
end
loop do
opponent.party.clear
while opponent.party.length<rule.ruleset.suggestedNumber
rnd=pokemonnumbers[rand(pokemonnumbers.length)]
rndpoke=btpokemon[rnd]
pkmn=rndpoke.createPokemon(
rule.ruleset.suggestedLevel,indvalues,opponent)
opponent.party.push(pkmn)
end
break if rule.ruleset.isValid?(opponent.party)
end
return opponent
end
def pbOrganizedBattleEx(opponent,challengedata,endspeech,endspeechwin)
# Skip battle if holding Ctrl in Debug mode
if Input.press?(Input::CTRL) && $DEBUG
pbMessage(_INTL("SKIPPING BATTLE..."))
pbMessage(_INTL("AFTER WINNING..."))
endspeech.each { |msg| pbMessage(msg || "...") }
$PokemonTemp.lastbattle = nil
return true
end
$Trainer.heal_party
# Remember original data, to be restored after battle
challengedata = PokemonChallengeRules.new if !challengedata
oldlevels = challengedata.adjustLevels($Trainer.party,opponent.party)
olditems = $Trainer.party.transform { |p| p.item_id }
olditems2 = opponent.party.transform { |p| p.item_id }
# Create the battle scene (the visual side of it)
scene = pbNewBattleScene
# Create the battle class (the mechanics side of it)
battle = challengedata.createBattle(scene,$Trainer,opponent)
battle.internalBattle = false
battle.endSpeeches = [endspeech]
battle.endSpeechesWin = [endspeechwin]
# Set various other properties in the battle class
pbPrepareBattle(battle)
# Perform the battle itself
decision = 0
pbBattleAnimation(pbGetTrainerBattleBGM(opponent)) {
pbSceneStandby{
decision = battle.pbStartBattle
}
}
Input.update
# Restore both parties to their original levels
challengedata.unadjustLevels($Trainer.party,opponent.party,oldlevels)
# Heal both parties and restore their original items
$Trainer.party.each_with_index do |pkmn,i|
pkmn.heal
pkmn.makeUnmega
pkmn.makeUnprimal
pkmn.item = olditems[i]
end
opponent.party.each_with_index do |pkmn,i|
pkmn.heal
pkmn.makeUnmega
pkmn.makeUnprimal
pkmn.item = olditems2[i]
end
# Save the record of the battle
$PokemonTemp.lastbattle = nil
if decision==1 || decision==2 || decision==5 # if win, loss or draw
$PokemonTemp.lastbattle = battle.pbDumpRecord
end
# Return true if the player won the battle, and false if any other result
return (decision==1)
end
def pbIsBanned?(pokemon)
return StandardSpeciesRestriction.new.isValid?(pokemon)
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,240 @@
class BattleSwapScene
def pbStartRentScene(rentals)
# Create sprite hash
@sprites={}
@mode=0 # rental
# Allocate viewport
@rentals=rentals
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["title"]=Window_UnformattedTextPokemon.newWithSize(
_INTL("RENTAL POKéMON"),0,0,Graphics.width,64,@viewport)
@sprites["help"]=Window_UnformattedTextPokemon.newWithSize("",
0,Graphics.height-64,Graphics.width,64,@viewport)
@sprites["list"]=Window_AdvancedCommandPokemonEx.newWithSize(
[],0,64,Graphics.width,Graphics.height-128,@viewport)
@sprites["msgwindow"]=Window_AdvancedTextPokemon.newWithSize("",
0,Graphics.height-64,Graphics.height,64,@viewport)
@sprites["msgwindow"].visible=false
addBackgroundPlane(@sprites,"bg","rentbg",@viewport)
pbUpdateChoices([])
pbDeactivateWindows(@sprites)
# Fade in all sprites
pbFadeInAndShow(@sprites) { pbUpdate }
end
def pbStartSwapScene(currentPokemon,newPokemon)
# Create sprite hash
@sprites={}
@mode=1 # swap
# Allocate viewport
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["title"]=Window_UnformattedTextPokemon.newWithSize(
_INTL("POKéMON SWAP"),0,0,Graphics.width,64,@viewport)
@sprites["help"]=Window_UnformattedTextPokemon.newWithSize(
"",0,Graphics.height-64,Graphics.width,64,@viewport)
@sprites["list"]=Window_AdvancedCommandPokemonEx.newWithSize(
[],0,64,Graphics.width,Graphics.height-128,@viewport)
@sprites["msgwindow"]=Window_AdvancedTextPokemon.newWithSize(
"",0,Graphics.height-64,Graphics.width,64,@viewport)
@sprites["msgwindow"].visible=false
addBackgroundPlane(@sprites,"bg","swapbg",@viewport)
@currentPokemon=currentPokemon
@newPokemon=newPokemon
pbInitSwapScreen()
pbDeactivateWindows(@sprites)
# Fade in all sprites
pbFadeInAndShow(@sprites) { pbUpdate }
end
def pbInitSwapScreen
commands=pbGetCommands(@currentPokemon,[])
commands.push(_INTL("CANCEL"))
@sprites["help"].text=_INTL("Select Pokémon to swap.")
@sprites["list"].commands=commands
@sprites["list"].index=0
@mode=1
end
# End the scene here
def pbEndScene
pbFadeOutAndHide(@sprites) { pbUpdate } # Fade out all sprites
pbDisposeSpriteHash(@sprites) # Dispose all sprites
@viewport.dispose # Dispose the viewport
end
def pbShowCommands(commands)
UIHelper.pbShowCommands(@sprites["msgwindow"],nil,commands) { pbUpdate }
end
def pbConfirm(message)
UIHelper.pbConfirm(@sprites["msgwindow"],message) { pbUpdate }
end
def pbGetCommands(list, choices)
commands = []
for i in 0...list.length
pkmn = list[i]
category = pkmn.species_data.category
selected = shadowctagFromColor(Color.new(232, 0, 0))
cmd = _INTL("{1} - {2} Pokémon", pkmn.speciesName, category)
cmd = selected + cmd if choices.include?(i)
commands.push(cmd)
end
return commands
end
# Processes the scene
def pbChoosePokemon(canCancel)
pbActivateWindow(@sprites,"list") {
loop do
Graphics.update
Input.update
pbUpdate
if Input.trigger?(Input::BACK) && canCancel
return -1
end
if Input.trigger?(Input::USE)
index=@sprites["list"].index
if index==@sprites["list"].commands.length-1 && canCancel
return -1
elsif index==@sprites["list"].commands.length-2 && canCancel && @mode==2
return -2
else
return index
end
end
end
}
end
def pbUpdateChoices(choices)
commands=pbGetCommands(@rentals,choices)
@choices=choices
if choices.length==0
@sprites["help"].text=_INTL("Choose the first Pokémon.")
elsif choices.length==1
@sprites["help"].text=_INTL("Choose the second Pokémon.")
else
@sprites["help"].text=_INTL("Choose the third Pokémon.")
end
@sprites["list"].commands=commands
end
def pbSwapChosen(_pkmnindex)
commands=pbGetCommands(@newPokemon,[])
commands.push(_INTL("PKMN FOR SWAP"))
commands.push(_INTL("CANCEL"))
@sprites["help"].text=_INTL("Select Pokémon to accept.")
@sprites["list"].commands=commands
@sprites["list"].index=0
@mode=2
end
def pbSwapCanceled
pbInitSwapScreen
end
def pbSummary(list,index)
visibleSprites=pbFadeOutAndHide(@sprites) { pbUpdate }
scene=PokemonSummary_Scene.new
screen=PokemonSummaryScreen.new(scene)
@sprites["list"].index=screen.pbStartScreen(list,index)
pbFadeInAndShow(@sprites,visibleSprites) { pbUpdate }
end
# Update the scene here, this is called once each frame
def pbUpdate
pbUpdateSpriteHash(@sprites)
# Add other things that should be updated
end
end
class BattleSwapScreen
def initialize(scene)
@scene = scene
end
def pbStartRent(rentals)
@scene.pbStartRentScene(rentals)
chosen=[]
loop do
index=@scene.pbChoosePokemon(false)
commands=[]
commands.push(_INTL("SUMMARY"))
if chosen.any? { |item| item==index }
commands.push(_INTL("DESELECT"))
else
commands.push(_INTL("RENT"))
end
commands.push(_INTL("OTHERS"))
command=@scene.pbShowCommands(commands)
if command==0
@scene.pbSummary(rentals,index)
elsif command==1
if chosen.any? { |item| item==index }
chosen.delete(index)
@scene.pbUpdateChoices(chosen.clone)
else
chosen.push(index)
@scene.pbUpdateChoices(chosen.clone)
if chosen.length==3
if @scene.pbConfirm(_INTL("Are these three Pokémon OK?"))
retval=[]
chosen.each { |i| retval.push(rentals[i]) }
@scene.pbEndScene
return retval
else
chosen.delete(index)
@scene.pbUpdateChoices(chosen.clone)
end
end
end
end
end
end
def pbStartSwap(currentPokemon,newPokemon)
@scene.pbStartSwapScene(currentPokemon,newPokemon)
loop do
pkmn=@scene.pbChoosePokemon(true)
if pkmn>=0
commands=[_INTL("SUMMARY"),_INTL("SWAP"),_INTL("RECHOOSE")]
command=@scene.pbShowCommands(commands)
if command==0
@scene.pbSummary(currentPokemon,pkmn)
elsif command==1
@scene.pbSwapChosen(pkmn)
yourPkmn=pkmn
loop do
pkmn=@scene.pbChoosePokemon(true)
if pkmn>=0
if @scene.pbConfirm(_INTL("Accept this Pokémon?"))
@scene.pbEndScene
currentPokemon[yourPkmn]=newPokemon[pkmn]
return true
end
elsif pkmn==-2
@scene.pbSwapCanceled
break # Back to first screen
elsif pkmn==-1
if @scene.pbConfirm(_INTL("Quit swapping?"))
@scene.pbEndScene
return false
end
end
end
end
else
# Canceled
if @scene.pbConfirm(_INTL("Quit swapping?"))
@scene.pbEndScene
return false
end
end
end
end
end