Registrarse

[Duda] Ayuda con Script Del Pokemon World Tournament

Estado
Cerrado para nuevas respuestas.

Master_Trainer

Usuario mítico
Hola a todos de nuevo, bueno pues resulta que encontre en The pokemon Comunity un script para realizar el PWT, mas sinembargo me da error, alguien que sepa mas de script me podria echar una mano?

#===============================================================================
# Pokemon World Tournament script created by Luka S.J.
# Please give credit when used
#===============================================================================
# Place the script above Main and you're ready to go. This script aims to
# provide a full PWT experience for Essentials (minus the nice visual part).
# I've even gone a little further, and added some things not present in the
# official PWT.
# Call it in a script/even script as PokemonWorldTournament.new
#
#===============================================================================
# Settings
#===============================================================================
# Here you can configure the various aspects of the system.
# Trainers should be defined through the editor, or the PBS file, but should be
# linked/called here just the same way you would in a normal trainer event
#
# This is a list of the types of battles available
# Make sure that World Leaders is in the list after all the other Gym Leader
# Tournament branches.
BATTLE_LIST = [
"Kanto Leaders",
"Johto Leaders",
"Hoenn Leaders",
"Sinnoh Leaders",
"Unova Leaders",
"World Leaders",
"World Champions",
"Rental Masters", # not yet implemented
"Mix Master" # not yet implemented
]
# This is a list of the Pokemon that cannot be used in the PWT
BAN_LIST = [
PBSpecies::MEWTWO,
PBSpecies::MEW,
PBSpecies::HOOH,
PBSpecies::LUGIA,
PBSpecies::CELEBI,
PBSpecies::KYOGRE,
PBSpecies::GROUDON,
PBSpecies::RAYQUAZA,
PBSpecies::DEOXYS,
PBSpecies::JIRACHI,
PBSpecies::DIALGA,
PBSpecies::pALKIA,
PBSpecies::GIRATINA,
PBSpecies::HEATRAN,
PBSpecies::DARKRAI,
PBSpecies::SHAYMIN,
PBSpecies::ARCEUS,
PBSpecies::ZEKROM,
PBSpecies::RESHIRAM,
PBSpecies::KYUREM,
PBSpecies::LANDORUS,
PBSpecies::MELOETTA,
PBSpecies::KELDEO,
PBSpecies::GENESECT
]

# This is the list of all the defined trainers
# Trainers are defined as arrays containing:
# [ trainer type , trainer name , player victory speech , player loss speech , region they are from , City/Town they are from , Sprite image name (this can be left blank, and the sprite will be used as Leader_Name) ]
#
# The index of the trainer list has to correspond with the category type.
# If you're creating your own trainer list, make sure it has at least 8 entries, otherwise it won't work.
TRAINER_LIST = [
#-------------------------------------------------------------
[
# List of all the trainers for the Kanto Leaders Tournament
[PBTrainers::LEADER_0,"Brock","Looks like you were the sturdier of us.","My barrier was tough to break. Maybe next time.","Kanto","Pewter City"],
[PBTrainers::LEADER_1,"Misty","You are a skilled Trainer, I have to admit that.","Looks like out of the two of us, I was the better Trainer.","Kanto","Cerulean City"],
[PBTrainers::LEADER_2,"Lt.Surge","You shocked my very core, soldier!","At ease son, not everyone can beat me.","Kanto","Vermillion City"],
[PBTrainers::LEADER_3,"Erika","Oh my! \n Looks like I've underestimated you.","Keep practicing hard, and one day you will be the victor.","Kanto","Celadon City"],
[PBTrainers::LEADER_4,"Sabrina","Impossible! I did not predict this!","The outcome was just as I predicted.","Kanto","Saffron City"],
[PBTrainers::LEADER_5,"Janine","You've got a great battle technique!","My technique was the superior one!","Kanto","Fuchsia City"],
[PBTrainers::LEADER_6,"Blaine","Your flame burnt me up!","My flames are not something everyone can handle.","Kanto","Cinnabar Island"],
[PBTrainers::LEADER_7,"Giovanni","What? \nMe, lose?!","I could have never lost to a kid like you!","Kanto","Viridian City"]
],
#-------------------------------------------------------------
#-------------------------------------------------------------
[
# List of all the trainers for the Johto Leaders Tournament
[PBTrainers::LEADER_8,"Falkner","I understand... I'll bow out gracefully.","My birds and I will always fly!","Johto","Violet City"],
[PBTrainers::LEADER_9,"Bugsy","Aw, that's the end of it...","My tough Bug Pokemon cannot be defeated easily.","Johto","Azlea Town"],
[PBTrainers::LEADER_10,"Whitney","Ugh...","You really are strong! But I won't lose to you!","Johto","Goldenrod City"],
[PBTrainers::LEADER_11,"Morty","How is this possible...","We've got more discipline than anyone else!","Johto","Ecruteak City"],
[PBTrainers::LEADER_12,"Chuck","We...lost...","No... Not...yet...","Johto","Cianwood City"],
[PBTrainers::LEADER_13,"Jasmine","Well done...","Steel will hang on to the very last!","Johto","Olivine City"],
[PBTrainers::LEADER_14,"Pryce","Hmm. Seems as if my luck has run out.","My luck has not run out just yet.","Johto","Mahogany Town"],
[PBTrainers::LEADER_15,"Clair","I lost... I don't believe it. There must be some mistake...","I was destined to win! I had already decided that!","Johto","Blackthorn City"]
],
#-------------------------------------------------------------
#-------------------------------------------------------------
[
# List of all the trainers for the Hoenn Leaders Tournament
[PBTrainers::LEADER_16,"Roxanne","So... I lost...","I learned many things from our battle.","Hoenn","Rustboro City"],
[PBTrainers::LEADER_17,"Brawly","Whoa, wow! You made a much bigger splash than I expected!","All right! I rode the big wave!","Hoenn","Dewford Town"],
[PBTrainers::LEADER_18,"Wattson","Wahahahah! Fine, I lost! You ended up giving me a thrill!","Wahahahah! Well, I won! How was the battle? Thrilling, right?","Hoenn","Mauville City"],
[PBTrainers::LEADER_19,"Flannery","Oh... I guess I was trying too hard...","I... I won! I guess my well-honed moves worked!","Hoenn","Lavaridge Town"],
[PBTrainers::LEADER_20,"Norman","... I... I can't... I can't believe it. I lost to you?","We both gave everything we had. That was a wonderful match.","Hoenn","Petalburg City"],
[PBTrainers::LEADER_21,"Winona","A Trainer that commands Pokémon with more grace than I...","Our elegant dance is finished!","Hoenn","Fortree City"],
[PBTrainers::LEADER_22,"Tate&Liza","Oh! The combination of me and my Pokémon...","The combination of me and my Pokémon was superior!","Hoenn","Mossdeep City"],
[PBTrainers::LEADER_24,"Juan","Ahahaha, excellent! Very well, you are the winner.","Ahahaha, I'm the winner! Which is to say, you lost.","Hoenn","Sootopolis City"]
],
#-------------------------------------------------------------
#-------------------------------------------------------------
[
# List of all the trainers for the Sinnoh Leaders Tournament
[PBTrainers::LEADER_25,"Roark","W-what? That can't be! My buffed-up Pokémon!","No way I would have lost to you!","Sinnoh","Oreburgh City"],
[PBTrainers::LEADER_26,"Gardenia","Amazing! You're very good, aren't you?","You did not have me concerned at all.","Sinnoh","Eterna City"],
[PBTrainers::LEADER_27,"Fantina","You are so fantastically strong. I know now why I have lost.","Never give up, never surrender!","Sinnoh","Hearthome City"],
[PBTrainers::LEADER_28,"Mayleene","I shall admit defeat... You are much too strong.","I take battling very seriously.","Sinnoh","Veilstone City"],
[PBTrainers::LEADER_29,"Wake","Hunwah! It's gone and ended! How will I say... I want more! I wanted to battle a lot more!","I had a great time battling with you!","Sinnoh","Solaceon"],
[PBTrainers::LEADER_30,"Byron","Hmm! My sturdy Pokémon, defeated!","Though you may lost today, the road of a great Trainer still lies ahead of you.","Sinnoh","Canalave City"],
[PBTrainers::LEADER_31,"Candice","I must say, I've warmed up to you! I might even admire you a little.","I'm tough because I know how to focus. It's all about focus!","Sinnoh","Snowpoint City"],
[PBTrainers::LEADER_32,"Volkner","You've got me beat... Your desire and the noble way your Pokémon battled for you... I even felt thrilled during our match. That was a very good battle.","You guys are tough! But we surpass your toughness!","Sinnoh","Sunyshore City"]
],
#-------------------------------------------------------------
#-------------------------------------------------------------
[
# List of all the trainers for the Unova Leaders Tournament
[PBTrainers::LEADER_33,"Cheren","This! This is what a real Pokémon battle is!","You were a powerful opponent, there is no denying that.","Unova","Aspertia City"],
[PBTrainers::LEADER_34,"Roxie","Wait! I was right in the middle of the chorus!","Looks like I knocked some sense outta ya!","Unova","Virbank City"],
[PBTrainers::LEADER_35,"Burgh","Is it over? Has my muse abandoned me?"," bug Pokémon are scurrying with excitement of battling!","Unova","Castelia City"],
[PBTrainers::LEADER_36,"Elesa","I meant to make your head spin, but you shocked me instead.","My Pokemon shined brilliantly!","Unova","Nimbasa City"],
[PBTrainers::LEADER_37,"Clay","Well, I've had enough... and just so you know, I didn't go easy on you.","Sorry, I didn't go easy on you.","Unova","Driftveil City"],
[PBTrainers::LEADER_38,"Skyla","Being your opponent in battle is a new source of strength to me. Thank you!","Next time, why don't you try something else?","Unova","Mistralton City"],
[PBTrainers::LEADER_39,"Drayden","This intense feeling that floods me after a defeat... I don't know how to describe it.","I'm grateful we had a chance to meet and battle.","Unova","Opelucid City"],
[PBTrainers::LEADER_40,"Marlon","You totally rocked that! You're raising some wicked Pokémon. You got this Trainer thing down!","Fightin' you felt real good, so I kept goin' and goin'.","Unova","Humilau City"]
],
#-------------------------------------------------------------
# Generates the list for the World Leaders Tournament
[ "slot reserved for World Leaders Tournament" ],
#-------------------------------------------------------------
#-------------------------------------------------------------
[
# List of all the trainers for the World Champions Tournament
[PBTrainers::CHAMPION_0,"Blue","So this is the standard over here...","Just as I expected! We were too much for you!","Kanto","Indigo Plateau"],
[PBTrainers::CHAMPION_1,"Lance","…It’s over. But it’s an odd feeling. I’m not angry that I lost. In fact, I feel happy.","I never give up, no matter what. You must be the same?","Johto","Indigo Plateau"],
[PBTrainers::CHAMPION_2,"Wallace","I, the Champion, fall in defeat... That was wonderful work.","The Pokémon you sent into battle...at times they were strong, at times they were weak. One day you will overcome your weakness.","Hoenn","Evergrande City"],
[PBTrainers::CHAMPION_3,"Cynthia","It seems that you are the most powerful Trainer.","For now, you're just a powerful challenger.","Sinnoh","Pokemon League"],
[PBTrainers::CHAMPION_4,"Iris","Aghhhh... I did my best, but we lost...","Hah! I knew that we could win!","Unova","Pokemon League"],
[PBTrainers::CHAMPION_5,"Alder","Well done! You certainly are an unmatched talent!","Use the battle with me as a stepping stone and move forward!","Unova","Pokemon League"],
[PBTrainers::CHAMPION_6,"Red","...\n...","...\n...","Kanto","Mt. Silver"],
[PBTrainers::CHAMPION_7,"Steven","I, the Champion, fall in defeat... Kudos to you, \PN! You are a truly noble Pokemon Trainer!","You might not have won today, but that does not make you a weak Trainer.","Hoenn","Evergrande City"]
],
#-------------------------------------------------------------
# Generates the list for the Rental Masters Tournament
[ "slot reserved for Rental Masters Tournament" ],
#-------------------------------------------------------------
#-------------------------------------------------------------
# Generates the list for the Mix Masters Tournament
[ "slot reserved for Mix Masters Tournament" ]
#-------------------------------------------------------------
]
#===============================================================================

class PokemonWorldTournament

# Starts up the PWT system and generates missing trainer categories
def initialize(announce=false)
@Sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=9999
@Sprites["scoreboard"]=Sprite.new(@viewport)
@Sprites["scoreboard"].bitmap=Bitmap.new(Graphics.width,Graphics.height)
@Sprites["scoreboard"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0))
@Sprites["scoreboard"].opacity=0

$Trainer.battle_points=0 if !$Trainer.battle_points
if !$Trainer.pwt_wins or $Trainer.pwt_wins.length<BATTLE_LIST.length
$Trainer.pwt_wins=[]
for i in 0...BATTLE_LIST.length
$Trainer.pwt_wins.push(0)
end
end

@current_party = $Trainer.party

self.generateWorldLeaders if BATTLE_LIST.include?("World Leaders")
self.generateRentalMasters if BATTLE_LIST.include?("Rental Masters")
self.generateMixMasters if BATTLE_LIST.include?("Mix Masters")

self.introduction
@tournament_type = chooseTournament
return cancelEntry if !@tournament_type
@battle_type = chooseBattle
return cancelEntry if !@battle_type
@modified_party = choosePokemon
if @modified_party=="notEligible"
Kernel.pbMessage(_INTL("We're terribly sorry, but your Pokemon are not eligible for the Tournament."))
Kernel.pbMessage(_INTL(showBanList))
Kernel.pbMessage(_INTL("Please come back once your Pokemon Party has been adjusted."))
elsif !@modified_party
cancelEntry
else
self.generateRounds
ret=self.startTournament(announce)
end

@Sprites["scoreboard"].bitmap.clear
@Sprites["scoreboard"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0))
15.times do
@Sprites["scoreboard"].opacity-=17
pbWait(1)
end
case ret
when "win"
Kernel.pbMessage(_INTL("Congratulations on today's win."))
Kernel.pbMessage(_INTL("For your victory you have earned 3 BP."))
Kernel.pbMessage(_INTL("We hope to see you again."))
$Trainer.pwt_wins[@tournament_type]+=1
$Trainer.battle_points+=3
when "loss"
Kernel.pbMessage(_INTL("I'm sorry that you lost this tournament."))
Kernel.pbMessage(_INTL("Maybe you'll have better luck next time."))
cancelEntry
end
$Trainer.party = @current_party
end

# The function used to generate the World Leaders Tournament trainers
def generateWorldLeaders
index = BATTLE_LIST.index("World Leaders")
return false if index.nil?
full_list = []
for i in 0...index
for j in 0...TRAINER_LIST.length
full_list.push(TRAINER_LIST[j])
end
end
trainers = []

loop do
n = rand(full_list.length)
trainer = full_list[n]
full_list.delete_at(n)
trainers.push(trainer)
break if trainers.length>7
end

TRAINER_LIST[index] = trainers
end

# The function used to generate the RentalMasters Tournament trainers
def generateRentalMasters
index = BATTLE_LIST.index("Rental Masters")
return false if index.nil?
full_list = []
for i in 0...index
if i!=BATTLE_LIST.index("World Leaders")
for j in 0...TRAINER_LIST.length
full_list.push(TRAINER_LIST[j])
end
end
end
trainers = []

loop do
n = rand(full_list.length)
trainer = full_list[n]
full_list.delete_at(n)
trainers.push(trainer)
break if trainers.length>7
end

TRAINER_LIST[index] = trainers
end

# The function used to generate the RentalMasters Tournament trainers
def generateMixMasters
index = BATTLE_LIST.index("Mix Master")
return false if index.nil?
full_list = []
for i in 0...index
if i!=BATTLE_LIST.index("World Leaders") or i!=BATTLE_LIST.index("Rental Masters")
for j in 0...TRAINER_LIST.length
full_list.push(TRAINER_LIST[j])
end
end
end
trainers = []

loop do
n = rand(full_list.length)
trainer = full_list[n]
full_list.delete_at(n)
trainers.push(trainer)
break if trainers.length>7
end

TRAINER_LIST[index] = trainers
end

# Creates a small introductory conversation
def introduction
Kernel.pbMessage(_INTL("Hello, and welcome to the Pokemon World Tournament!"))
Kernel.pbMessage(_INTL("The place where the strongest gather to compete."))
end

def announceContest(trainer,i)
n=rand(4)
if i==7
Kernel.pbMessage(_INTL("Announcer: Last but not least, joining us is our very own #{$Trainer.name}!")) if (@player_index==i)
Kernel.pbMessage(_INTL("Announcer: Last but not least, joining our stadium is #{trainer[1]} from #{trainer[5]}, #{trainer[4]}!")) if !(@player_index==i)
return true
end
case n
when 0
Kernel.pbMessage(_INTL("Announcer: Our local youth has talent too, please join me in welcoming #{$Trainer.name}!")) if (@player_index==i)
Kernel.pbMessage(_INTL("Announcer: Visiting us all the way from #{trainer[5]}, #{trainer[4]}, is #{trainer[1]}!")) if !(@player_index==i)
when 1
Kernel.pbMessage(_INTL("Announcer: Spot no. #{i+1} takes a local trainer by the name, #{$Trainer.name}!")) if (@player_index==i)
Kernel.pbMessage(_INTL("Announcer: Spot no. #{i+1} takes #{trainer[1]} from #{trainer[5]}, #{trainer[4]}!")) if !(@player_index==i)
when 2
Kernel.pbMessage(_INTL("Announcer: Our very own aspiring challenger #{$Trainer.name} is here to make a name for themself!")) if (@player_index==i)
Kernel.pbMessage(_INTL("Announcer: From #{trainer[5]}, #{trainer[4]}, comes the legendary #{trainer[1]}!")) if !(@player_index==i)
when 3
Kernel.pbMessage(_INTL("Announcer: The next trainer is #{$Trainer.name} from our very own region!")) if (@player_index==i)
Kernel.pbMessage(_INTL("Announcer: The next trainer is from #{trainer[5]}, #{trainer[4]}. Please, put your hands together for #{trainer[1]}!")) if !(@player_index==i)
end

end

# Cancels the entry into the Tournament
def cancelEntry
Kernel.pbMessage(_INTL("We hope to see you again."))
return false
end

# Creates a list of choices depending on the types of battles in BATTLE_LIST
def chooseTournament
choices = []
for i in 0...BATTLE_LIST.index("World Leaders")
choices.push(BATTLE_LIST)
end
if ($Trainer.pwt_wins[BATTLE_LIST.index("Kanto Leaders")]>0 &&
$Trainer.pwt_wins[BATTLE_LIST.index("Johto Leaders")]>0 &&
$Trainer.pwt_wins[BATTLE_LIST.index("Hoenn Leaders")]>0 &&
$Trainer.pwt_wins[BATTLE_LIST.index("Sinnoh Leaders")]>0 &&
$Trainer.pwt_wins[BATTLE_LIST.index("Unova Leaders")]>0)
choices.push("World Leaders")
end
if ($Trainer.pwt_wins[BATTLE_LIST.index("World Champions")]>0)
choices.push("Rental Masters")
end
if ($Trainer.pwt_wins[BATTLE_LIST.index("World Champions")]>0)
choices.push("Mix Master")
end
if ($Trainer.pwt_wins[BATTLE_LIST.index("World Leaders")]>0)
choices.push("World Champions")
end
choices.push("Cancel")
cmd=Kernel.pbMessage(_INTL("Which Tournament would you like to participate in?"),choices,choices.index("Cancel"))
return false if choices[cmd]=="Cancel"
return cmd
end

# Allows the player to choose which style of battle they would like to do
def chooseBattle
choices = ["Single","Double","Full","Sudden Death","Cancel"]
cmd=Kernel.pbMessage(_INTL("Which type of Battle would you like to participate in?"),choices,choices.length-1)
return false if cmd==choices.length-1
return cmd
end

# Checks if the party is eligible
def partyEligible?
case @battle_type
when 0
length = 3
when 1
length = 4
when 2
length = 6
when 3
length = 1
end
count=0
return false if $Trainer.party.length < length
for i in 0...$Trainer.party.length
count+=1 if !(BAN_LIST.include?($Trainer.party.species)) && !($Trainer.party.egg?)
end

return true if count>=length
return false
end

# Creates a new trainer party based on the battle type, and the Pokemon chosen to enter
def choosePokemon
ret=false
return "notEligible" if !partyEligible?
case @battle_type
when 0
length = 3
when 1
length = 4
when 2
length = 6
when 3
length = 1
end
Kernel.pbMessage(_INTL("Please choose the Pokemon you would like to participate."))
ruleset=PokemonRuleSet.new
ruleset.addPokemonRule(RestrictSpecies.new)
ruleset.setNumberRange(length,length)
pbFadeOutIn(99999){
scene=PokemonScreen_Scene.new
screen=PokemonScreen.new(scene,$Trainer.party)
ret=screen.pbPokemonMultipleEntryScreenEx(ruleset)
}
return ret
end

# Creates the initial trainer list for the first round, depending on the category chosen
def generateRounds
for i in 0...@modified_party.length
@modified_party.level=50
@modified_party.calcStats
end

@trainer_list = []
full_list = TRAINER_LIST[@tournament_type]

loop do
n = rand(full_list.length)
trainer = full_list[n]
full_list.delete_at(n)
@trainer_list.push(trainer)
break if @trainer_list.length>7
end

n = rand(8)
@player_index = n
@player_index_int = @player_index
for i in 0.. @trainer_list.length
@trainer_list.push("Leader_# @trainer_list[1]}") if @trainer_list[6].nil?
end
@trainer_list[n] = @modified_party
$Trainer.party = @modified_party
@trainer_list_int @trainer_list
end

# Outputs a message which lists all the Pokemon banned from the Tournament
def showBanList
msg = ""
for i in 0...BAN_LIST.length

pkmn = PokeBattle_Pokemon.new(BAN_LIST,1,nil,false)
msg+="#{pkmn.name}, "
end
msg+="and Eggs are not eligible for entry in the Tournament."

return msg
end

# Handles the tournament branch
# and adds some additional flavour such as an announcer talking
def startTournament(announce)
@round=0
doublebattle=false
doublebattle=true if @battle_type==1
15.times do
@Sprites["scoreboard"].opacity+=17
pbWait(1)
end
Kernel.pbMessage(_INTL("Announcer: Welcome to the #{BATTLE_LIST[@tournament_type]} Tournament!"))
Kernel.pbMessage(_INTL("Announcer: Today we have 8 very eager contestants, waiting to compete for the title of \"Champion\"."))
Kernel.pbMessage(_INTL("Announcer: Let us turn our attention to the scoreboard, to see who will be competing today."))
self.createScoreBoard @trainer_list)
for i in 0...8
announceContest @trainer_list,i) if announce
end
Kernel.pbMessage(_INTL("Announcer: Without further ado, let the first match begin."))
trainer=self.generateRound1
Kernel.pbMessage(_INTL("Announcer: This will be a battle between #{$Trainer.name} and #{trainer[1]}."))
outcome=pbPWTTrainerBattle(trainer[0],trainer[1],trainer[2],trainer[3],doublebattle)
if outcome==1
@round=1
Kernel.pbMessage(_INTL("Announcer: Wow! What an exciting first round!"))
Kernel.pbMessage(_INTL("Announcer: The stadium is getting heated up, and the contestants are on fire!"))
Kernel.pbMessage(_INTL("Announcer: Let us turn our attention back to the scoreboard for the results."))
trainer=self.generateRound2
self.createScoreBoard @trainer_list)
Kernel.pbMessage(_INTL("Announcer: It looks like the next match will be between #{$Trainer.name} and #{trainer[1]}."))
Kernel.pbMessage(_INTL("Announcer: Let the battle begin!"))
outcome=pbPWTTrainerBattle(trainer[0],trainer[1],trainer[2],trainer[3],doublebattle)
if outcome==1
@round=2
Kernel.pbMessage(_INTL("Announcer: What spectacular matches!"))
Kernel.pbMessage(_INTL("Announcer: These trainers are really giving it all."))
Kernel.pbMessage(_INTL("Announcer: Let's direct our attention at the scoreboard one final time."))
trainer=self.generateRound3
self.createScoreBoard @trainer_list)
Kernel.pbMessage(_INTL("Announcer: Alright! It's all set!"))
Kernel.pbMessage(_INTL("Announcer: The final match of this tournament will be between #{$Trainer.name} and #{trainer[1]}!"))
Kernel.pbMessage(_INTL("Announcer: May the best trainer win!"))
outcome=pbPWTTrainerBattle(trainer[0],trainer[1],trainer[2],trainer[3],doublebattle)
if outcome==1
Kernel.pbMessage(_INTL("Announcer: What an amazing battle!"))
Kernel.pbMessage(_INTL("Announcer: Both the trainers put up a great fight, but our very own #{$Trainer.name} was the one to come out on top!"))
Kernel.pbMessage(_INTL("Announcer: Congratulations #{$Trainer.name}! You have certainly earned today's title of \"Champion\"!"))

Kernel.pbMessage(_INTL("Announcer: That's all we have time for. I hope you enjoyed todays contest. And we hope to see you again soon."))
return "win"
end
end
end
return "loss"
end

# Creates a basic Image illustrating a scoreboard
def createScoreBoard(list)
nlist=[]
for i in 0...list.length
nlist.push(list[0])
end
x=0
y=0
@Sprites["scoreboard"].bitmap.clear
@Sprites["scoreboard"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0))
@Sprites["scoreboard"].bitmap.blt(0,0,BitmapCache.load_bitmap("Graphics/Pictures/scoreboard"),Rect.new(0,0,Graphics.width,Graphics.height))
pbSetSystemFont @Sprites["scoreboard"].bitmap)
for i in 0.. @trainer_list_int.length
opacity=255
if i==@player_index_int
trname="#{$Trainer.name}"
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
char=pbGetPlayerCharset(meta,1)
bitmap=BitmapCache.load_bitmap("Graphics/Characters/#{char}")
else
opacity=80 if !(nlist.include? @trainer_list_int[0]))
trname @trainer_list_int[1]
bitmap=BitmapCache.load_bitmap("Graphics/Characters/# @trainer_list_int[6]}")
end
@Sprites["scoreboard"].bitmap.blt(20+(Graphics.width-24-(bitmap.width/4))*x,20+(Graphics.height/6)*y,bitmap,Rect.new(0,0,bitmap.width/4,bitmap.height/4),opacity)
text=[["#{trname}",24+(bitmap.width/4)+(Graphics.width-32-(bitmap.width/2))*x,34+(Graphics.height/6)*y,x*1,Color.new(255,255,255),Color.new(80,80,80)]]
pbDrawTextPositions @Sprites["scoreboard"].bitmap,text)
y+=1
x+=1 if y>3
y=0 if y>3
end

end

# Heals your party
def healParty
for pokemon in $Trainer.party
pokemon.heal
end
end

def generateRound1
healParty
case @player_index
when 0
trainer @trainer_list[1]
when 1
trainer @trainer_list[0]
when 2
trainer @trainer_list[3]
when 3
trainer @trainer_list[2]
when 4
trainer @trainer_list[5]
when 5
trainer @trainer_list[4]
when 6
trainer @trainer_list[7]
when 7
trainer @trainer_list[6]
end
return trainer
end

def generateRound2
healParty
list=["","","",""]
case @player_index
when 0
@player_index=0
list[0]=@modified_party
list[1] @trainer_list[2+rand(2)]
list[2] @trainer_list[4+rand(2)]
list[3] @trainer_list[6+rand(2)]
when 1
@player_index=0
list[0]=@modified_party
list[1] @trainer_list[2+rand(2)]
list[2] @trainer_list[4+rand(2)]
list[3] @trainer_list[6+rand(2)]
when 2
@player_index=1
list[1]=@modified_party
list[0] @trainer_list[0+rand(2)]
list[2] @trainer_list[4+rand(2)]
list[3] @trainer_list[6+rand(2)]
when 3
@player_index=1
list[1]=@modified_party
list[0] @trainer_list[0+rand(2)]
list[2] @trainer_list[4+rand(2)]
list[3] @trainer_list[6+rand(2)]
when 4
@player_index=2
list[2]=@modified_party
list[0] @trainer_list[0+rand(2)]
list[1] @trainer_list[2+rand(2)]
list[3] @trainer_list[6+rand(2)]
when 5
@player_index=2
list[2]=@modified_party
list[0] @trainer_list[0+rand(2)]
list[1] @trainer_list[2+rand(2)]
list[3] @trainer_list[6+rand(2)]
when 6
@player_index=3
list[3]=@modified_party
list[0] @trainer_list[0+rand(2)]
list[1] @trainer_list[2+rand(2)]
list[2] @trainer_list[4+rand(2)]
when 7
@player_index=3
list[3]=@modified_party
list[0] @trainer_list[0+rand(2)]
list[1] @trainer_list[2+rand(2)]
list[2] @trainer_list[4+rand(2)]
end
@trainer_list=list
case @player_index
when 0
trainer @trainer_list[1]
when 1
trainer @trainer_list[0]
when 2
trainer @trainer_list[3]
when 3
trainer @trainer_list[2]
end
return trainer
end

def generateRound3
healParty
list=["","","",""]
case @player_index
when 0
@player_index=0
list[0]=@modified_party
list[1] @trainer_list[2+rand(2)]
when 1
@player_index=0
list[0]=@modified_party
list[1] @trainer_list[2+rand(2)]
when 2
@player_index=1
list[1]=@modified_party
list[0] @trainer_list[0+rand(2)]
when 3
@player_index=1
list[1]=@modified_party
list[0] @trainer_list[0+rand(2)]
end
@trainer_list=list
case @player_index
when 0
trainer @trainer_list[1]
when 1
trainer @trainer_list[0]
end
return trainer
end

end

#===============================================================================
# PWT battle rules
#===============================================================================
class RestrictSpecies
def initialize
@specieslist=BAN_LIST.clone
end
def isSpecies?(species,specieslist)
for s in specieslist
return true if species==s
end
return false
end
def isValid?(pokemon)
count=0
if isSpecies?(pokemon.species,@specieslist) && !(pokemon.egg?)
count+=1
end
return count==0
end
end

#===============================================================================
# Exta classes and functions for PWT trainer and battle generation
#===============================================================================

class PokeBattle_Trainer
attr_accessor:)battle_points)
attr_accessor:)pwt_wins)
end

# Generates a new PWT styled trainer, where the party is randomized (from the options in the trainer party definition of PBS/trainers.txt)
def pbPWTLoadTrainer(trainerid,trainername,partyid=0)
success=false
items=[]
party=[]
opponent=nil
trainers=load_data("Data/trainers.dat")
case @battle_type
when 0
length = 3
when 1
length = 4
when 2
length = 6
when 3
length = 1
end
for trainer in trainers
name=trainer[1]
thistrainerid=trainer[0]
thispartyid=trainer[4]
next if trainerid!=thistrainerid || name!=trainername || partyid!=thispartyid
items=trainer[2].clone
name=pbGetMessageFromHash(MessageTypes::TrainerNames,name)
for i in RIVALNAMES
if isConst?(trainerid,PBTrainers,i[0]) && $game_variables[i[1]]!=0
name=$game_variables[i[1]]
end
end
opponent=PokeBattle_Trainer.new(name,thistrainerid)
opponent.setForeignID($Trainer) if $Trainer
for poke in trainer[3]
species=poke[TPSPECIES]
level=poke[TPLEVEL]
pokemon=PokeBattle_Pokemon.new(species,level,opponent)
pokemon.form=poke[TPFORM]
pokemon.resetMoves
pokemon.item=poke[TPITEM]
if poke[TPMOVE1]>0 || poke[TPMOVE2]>0 || poke[TPMOVE3]>0 || poke[TPMOVE4]>0
k=0
for move in [TPMOVE1,TPMOVE2,TPMOVE3,TPMOVE4]
pokemon.moves[k]=PBMove.new(poke[move])
k+=1
end
pokemon.moves.compact!
end
pokemon.setAbility(poke[TPABILITY])
pokemon.setGender(poke[TPGENDER])
if poke[TPSHINY] # if this is a shiny Pokémon
pokemon.makeShiny
else
pokemon.makeNotShiny
end
pokemon.setNature(poke[TPNATURE])
iv=poke[TPIV]
for i in 0...6
pokemon.iv=iv&0x1F
pokemon.ev=[85,level*3/2].min
end
pokemon.happiness=poke[TPHAPPINESS]
pokemon.name=poke[TPNAME] if poke[TPNAME] && poke[TPNAME]!=""
if poke[TPSHADOW] # if this is a Shadow Pokémon
pokemon.makeShadow rescue nil
pokemon.pbUpdateShadowMoves(true) rescue nil
pokemon.makeNotShiny
end
pokemon.ballused=poke[TPBALL]
pokemon.calcStats
party.push(pokemon)
end
old_party=party
new_party=[]
count=0
loop do
n=rand(old_party.length)
new_party.push(old_party[n])
old_party.delete_at(n)
break if new_party.length>=length
end
party=new_party
success=true
break
end
return success ? [opponent,items,party] : nil
end

# Creates the PWT styled battle, where exp gain, money gain and switching is disabled
def pbPWTTrainerBattle(trainerid,trainername,endspeech,endspeechwin,
doublebattle=false,trainerparty=0,canlose=true)
if $Trainer.pokemonCount==0
Kernel.pbMessage(_INTL("SKIPPING BATTLE...")) if $DEBUG
return false
end
if !$PokemonTemp.waitingTrainer && $Trainer.ablePokemonCount>1 &&
pbMapInterpreterRunning?
thisEvent=pbMapInterpreter.get_character(0)
triggeredEvents=$game_player.pbTriggeredTrainerEvents([2],false)
otherEvent=[]
for i in triggeredEvents
if i.id!=thisEvent.id && !$game_self_switches[[$game_map.map_id,i.id,"A"]]
otherEvent.push(i)
end
end
if otherEvent.length==1
trainer=pbLoadTrainer(trainerid,trainername,trainerparty)
if !trainer
pbMissingTrainer(trainerid,trainername,trainerparty)
return false
end
if trainer[2].length<=3
$PokemonTemp.waitingTrainer=[trainer,thisEvent.id,endspeech,doublebattle]
return false
end
end
end
trainer=pbPWTLoadTrainer(trainerid,trainername,trainerparty)
if !trainer
pbMissingTrainer(trainerid,trainername,trainerparty)
return false
end
playerparty=$Trainer.party
playertrainer=$Trainer
fullparty1=false
scene=pbNewBattleScene
battle=PokeBattle_Battle.new(scene,playerparty,trainer[2],playertrainer,trainer[0])
battle.fullparty1=fullparty1
battle.doublebattle=doublebattle
battle.endspeech=endspeech
battle.endspeechwin=endspeechwin
battle.items=trainer[1]
trainerbgm=pbGetTrainerBattleBGM(trainer[0])
trainerbgm="PWT Finals.mp3" if @round==2 && !(["World Champions","Rental Masters","Mix Master"].include?(BATTLE_LIST[@tournament_type]))
if Input.press?(Input::CTRL) && $DEBUG
Kernel.pbMessage(_INTL("SKIPPING BATTLE..."))
Kernel.pbMessage(_INTL("AFTER LOSING..."))
Kernel.pbMessage(battle.endspeech)
Kernel.pbMessage(battle.endspeech2) if battle.endspeech2
if $PokemonTemp.waitingTrainer
pbMapInterpreter.pbSetSelfSwitch(
$PokemonTemp.waitingTrainer[1],"A",true
)
$PokemonTemp.waitingTrainer=nil
end
return true
end
Events.onStartBattle.trigger(nil,nil)
battle.internalbattle=false
pbPrepareBattle(battle)
restorebgm=true
decision=0
pbBattleAnimation(trainerbgm,trainer[0].trainertype,trainer[0].name) {
pbSceneStandby {
decision=battle.pbStartBattle(canlose)
}
for i in $Trainer.party; (i.makeUnmega rescue nil); end
if $PokemonGlobal.partner
pbHealAll
for i in $PokemonGlobal.partner[3]
i.heal
i.makeUnmega rescue nil
end
end
if decision==2 || decision==5
if canlose
for i in $Trainer.party; i.heal; end
for i in 0...10
Graphics.update
end
else
$game_system.bgm_unpause
$game_system.bgs_unpause
Kernel.pbStartOver
end
else
Events.onEndBattle.trigger(nil,decision)
if decision==1
if $PokemonTemp.waitingTrainer
pbMapInterpreter.pbSetSelfSwitch(
$PokemonTemp.waitingTrainer[1],"A",true
)
end
end
end
}
Input.update
$PokemonTemp.waitingTrainer=nil
return decision
end
 
Estado
Cerrado para nuevas respuestas.
Arriba