class PokeContestScene
attr_reader :index
attr_reader :name
attr_accessor :selected
attr_reader :hearts
def update
pbUpdateSpriteHash(@sprites)
end
def pbStartContest(chosen,opponent1,opponent1level,opponent2,opponent2level,opponent3,opponent3level)
pbBGMPlay("021-Field04")
if $game_variables[35]==1
@contestType="Cool"
elsif $game_variables[35]==2
@contestType="Smart"
elsif $game_variables[35]==3
@contestType="Tough"
elsif $game_variables[35]==4
@contestType="Cute"
elsif $game_variables[35]==5
@contestType="Beauty"
end
@lastcmd=[0,0,0,0]
@pkmn1=$Trainer.party[chosen]
@pkmn2=PokeBattle_Pokemon.new(opponent1,opponent1level,$Trainer)
@pkmn3=PokeBattle_Pokemon.new(opponent2,opponent2level,$Trainer)
@pkmn4=PokeBattle_Pokemon.new(opponent3,opponent3level,$Trainer)
@pkmn2.form=0
@pkmn3.form=0
@pkmn4.form=0
@fastest=@pkmn1
@second=@pkmn2
@third=@pkmn3
@fourth=@pkmn4
@firstnumber=0
@secondnumber=0
@thirdnumber=0
@fourthnumber=0
@pkmn1hearts=0
@pkmn2hearts=0
@pkmn3hearts=0
@pkmn4hearts=0
@DoubleNext=[false,false,false,false]
@MissTurn=[false,false,false,false]
@nomoremoves=[false,false,false,false]
@applause=0
@stars=[0,0,0,0]
pbResetContestMoveEffects
@round=1
pbTurnOne
end
def pbTurnOne
@sprites["Judge"]=IconSprite.new(0,0,@viewport)
@sprites["Judge"].setBitmap("Graphics/Characters/trainer017")
Kernel.pbMessage(_INTL("Judge: \\c[1]Welcome to today's Pokemon Contest\nIt's heartwarming to see all these young trainers here to show off their Pokemon's skills!")) #add variable to say contest type later
Kernel.pbMessage(_INTL("\\c[1]I'm going to be the judge for this competition, so let's get started!"))
pbDisposeSprite(@sprites,"Judge")
sleep(1.0/3.0)
Graphics.update
@sprites["RoundOne"]=IconSprite.new(0,0,@viewport)
@sprites["RoundOne"].setBitmap("Graphics/Pictures/Contest/Roundone")
sleep(1.0/2.0)
Graphics.update
roundoneupdown=0
for i in 0...9
if roundoneupdown==0 or roundoneupdown==1 or roundoneupdown==4 or roundoneupdown==5 or roundoneupdown==8 or roundoneupdown==9
@sprites["RoundOne"].y+=6
else
@sprites["RoundOne"].y-=6
end
roundoneupdown+=1
Graphics.update
sleep(1.0/8.0)
end
sleep(1)
pbDisposeSprite(@sprites,"RoundOne")
@sprites["overlay"]=BitmapSprite.new(
Graphics.width,Graphics.height,@viewport)
pbSetSystemFont(@sprites["overlay"].bitmap)
pbFindFastestOrderRanking
pbDisplayFastest
pbDrawTextRoundOne
@attention♥♥♥♥♥=[@fastest,@second,@third,@fourth]
Kernel.pbMessage(_INTL("Judge: \\c[1]Alright {1}, let's see what you can do!",@fastest.name))
@currentpos=1
i=rand(@fastest.moves.length)
movedata=PBMoveData.new(@fastest.moves[i].id)
@currentpoke=@fastest
@currentmovename=PBMoves.getName(@fastest.moves[i].id)
sleep(1)
for i in 1..PBContestMoves.maxValue
name=PBContestMoves.getName(i)
if @currentmovename==name
@currentmove=getID(PBContestMoves,i)
end
end
contestmovedata=PBContestMoveData.new(@currentmove)
@currenthearts=contestmovedata.hearts
@moveType=contestmovedata.contestType
Kernel.pbMessage(_INTL("{1} used {2}",@fastest.name,@currentmovename))
pbAssignLastMove
pbFunctionsAdjustHearts #
pbAssignHearts
pbDisplayAddingPositiveHearts
@lastmoveType=@moveType
Graphics.update
sleep(1.0/10.0)
Kernel.pbMessage(_INTL("Judge: \\c[1]Good job {1}, now onto the next pokemon!",@fastest.name))
sleep(1.0/10.0)
pbDisposeSprite(@sprites,"pokemon#{@firstnumber}")
Graphics.update
sleep(1.0/10.0)
Kernel.pbMessage(_INTL("Judge: \\c[1]Next up we have {1}!",@second.name))
pbDisplaySecondFastest
Graphics.update
sleep(1.0/10.0)
@currentpos=2
i=rand(@second.moves.length)
@currentpoke=@second
@currentmovename=PBMoves.getName(@second.moves[i].id)
sleep(1)
for i in 1..PBContestMoves.maxValue
name=PBContestMoves.getName(i)
if @currentmovename==name
@currentmove=getID(PBContestMoves,i)
end
end
contestmovedata=PBContestMoveData.new(@currentmove)
@currenthearts=contestmovedata.hearts
@moveType=contestmovedata.contestType
Kernel.pbMessage(_INTL("{1} used {2}",@second.name,@currentmovename))
pbAssignLastMove
pbFunctionsAdjustHearts #
pbAssignHearts
pbDisplayAddingPositiveHearts
@lastmoveType=@moveType
Graphics.update
sleep(1.0/10.0)
pbDisposeSprite(@sprites,"pokemon#{@secondnumber}")
Graphics.update
sleep(1.0/10.0)
Kernel.pbMessage(_INTL("Judge: \\c[1]Next up we have {1}!",@third.name))
pbDisplayThirdFastest
Graphics.update
sleep(1.0/10.0)
@currentpos=3
i=rand(@third.moves.length)
@currentpoke=@third
movedata=PBMoveData.new(@third.moves[i].id)
@currentmovename=PBMoves.getName(@third.moves[i].id)
sleep(1)
for i in 1..PBContestMoves.maxValue
name=PBContestMoves.getName(i)
if @currentmovename==name
@currentmove=getID(PBContestMoves,i)
end
end
contestmovedata=PBContestMoveData.new(@currentmove)
@currenthearts=contestmovedata.hearts
@moveType=contestmovedata.contestType
Kernel.pbMessage(_INTL("{1} used {2}",@third.name,@currentmovename))
pbAssignLastMove
pbFunctionsAdjustHearts #
pbAssignHearts
pbDisplayAddingPositiveHearts
@lastmoveType=@moveType
Graphics.update
sleep(1.0/10.0)
pbDisposeSprite(@sprites,"pokemon#{@thirdnumber}")
Graphics.update
sleep(1.0/10.0)
Kernel.pbMessage(_INTL("Judge: \\c[1]Next up we have {1}!",@fourth.name))
pbDisplayFourthFastest
Graphics.update
sleep(1.0/10.0)
@currentpos=4
i=rand(@fourth.moves.length)
movedata=PBMoveData.new(@fourth.moves[i].id)
@currentpoke=@fourth
@currentmovename=PBMoves.getName(@fourth.moves[i].id)
sleep(1)
for i in 1..PBContestMoves.maxValue
name=PBContestMoves.getName(i)
if @currentmovename==name
@currentmove=getID(PBContestMoves,i)
end
end
contestmovedata=PBContestMoveData.new(@currentmove)
@currenthearts=contestmovedata.hearts
@moveType=contestmovedata.contestType
Kernel.pbMessage(_INTL("{1} used {2}",@fourth.name,@currentmovename))
pbAssignLastMove
pbFunctionsAdjustHearts #
pbAssignHearts
pbDisplayAddingPositiveHearts
@lastmoveType=@moveType
Graphics.update
sleep(1.0/10.0)
pbDisposeSprite(@sprites,"pokemon#{@fourthnumber}")
Graphics.update
sleep(1.0/10.0)
end
def pbAssignHearts
if @currentpoke==@pkmn1
@pkmn1hearts=@currenthearts
elsif @currentpoke==@pkmn2
@pkmn2hearts=@currenthearts
elsif @currentpoke==@pkmn3
@pkmn3hearts=@currenthearts
else
@pkmn4hearts=@currenthearts
end
end
def pbAssignLastMove
if @currentpoke==@pkmn1
@pkmn1lastmove=@currentmove
elsif @currentpoke==@pkmn2
@pkmn2lastmove=@currentmove
elsif @currentpoke==@pkmn3
@pkmn3lastmove=@currentmove
else
@pkmn4lastmove=@currentmove
end
end
def pbDrawTextRoundOne
overlay=@sprites["overlay"].bitmap
overlay.clear
pokeone=_INTL("{1}",@fastest.name)
poketwo=_INTL("{1}",@second.name)
pokethree=_INTL("{1}",@third.name)
pokefour=_INTL("{1}",@fourth.name)
baseColor=Color.new(72,72,72)
shadowColor=Color.new(160,160,160)
textPositions=[
[pokeone,353,5,false,baseColor,shadowColor],
[poketwo,353,100,false,baseColor,shadowColor],
[pokethree,353,195,false,baseColor,shadowColor],
[pokefour,353,290,false,baseColor,shadowColor],
]
pbDrawTextPositions(overlay,textPositions)
end
def initialize
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["background"]=IconSprite.new(0,0,@viewport)
@sprites["background"].setBitmap("Graphics/Pictures/Contest/contestbg")
end
def pbInputUpdate
Input.update
if Input.trigger?(Input::B) && @abortable && !@aborted
@aborted=true
@battle.pbAbort
end
end
def pbDisplayAddingPositiveHearts
if @currentpoke==@pkmn1
if @currentpos==1
for i in 0..@pkmn1hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["firstpokehearts"]=IconSprite.new(408,51,@viewport)
@sprites["firstpokehearts"].setBitmap(heartfile)
end
elsif @currentpos==2
for i in 0..@pkmn1hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["secondpokehearts"]=IconSprite.new(408,145,@viewport)
@sprites["scondepokehearts"].setBitmap(heartfile)
end
elsif @currentpos==3
for i in 0..@pkmn1hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["thirdpokehearts"]=IconSprite.new(408,241,@viewport)
@sprites["thirdpokehearts"].setBitmap(heartfile)
end
else
for i in 0..@pkmn1hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["fourthpokehearts"]=IconSprite.new(358,336,@viewport)
@sprites["fourthpokehearts"].setBitmap(heartfile)
end
end
elsif @currentpoke==@pkmn2
if @currentpos==1
for i in 0..@pkmn2hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["firstpokehearts"]=IconSprite.new(408,51,@viewport)
@sprites["firstpokehearts"].setBitmap(heartfile)
end
elsif @currentpos==2
for i in 0..@pkmn2hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["secondpokehearts"]=IconSprite.new(408,145,@viewport)
@sprites["secondpokehearts"].setBitmap(heartfile)
end
elsif @currentpos==3
for i in 0..@pkmn2hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["thirdpokehearts"]=IconSprite.new(408,241,@viewport)
@sprites["thirdpokehearts"].setBitmap(heartfile)
end
else
for i in 0..@pkmn2hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["fourthpokehearts"]=IconSprite.new(408,336,@viewport)
@sprites["fourthpokehearts"].setBitmap(heartfile)
end
end
elsif @currentpoke==@pkmn3
if @currentpos==1
for i in 0..@pkmn3hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["firstpokehearts"]=IconSprite.new(408,51,@viewport)
@sprites["firstpokehearts"].setBitmap(heartfile)
end
elsif @currentpos==2
for i in 0..@pkmn3hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["secondpokehearts"]=IconSprite.new(408,145,@viewport)
@sprites["secondpokehearts"].setBitmap(heartfile)
end
elsif @currentpos==3
for i in 0..@pkmn3hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["thirdpokehearts"]=IconSprite.new(408,241,@viewport)
@sprites["thirdpokehearts"].setBitmap(heartfile)
end
else
for i in 0..@pkmn3hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["fourthpokehearts"]=IconSprite.new(408,336,@viewport)
@sprites["fourthpokehearts"].setBitmap(heartfile)
end
end
else
if @currentpos==1
for i in 0..@pkmn4hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["firstpokehearts"]=IconSprite.new(408,151,@viewport)
@sprites["firstpokehearts"].setBitmap(heartfile)
end
elsif @currentpos==2
for i in 0..@pkmn4hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["secondpokehearts"]=IconSprite.new(408,145,@viewport)
@sprites["secondpokehearts"].setBitmap(heartfile)
end
elsif @currentpos==3
for i in 0..@pkmn4hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["thirdpokehearts"]=IconSprite.new(408,241,@viewport)
@sprites["thirdpokehearts"].setBitmap(heartfile)
end
else
for i in 0..@pkmn4hearts
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
Graphics.update
sleep(1.0/7.0)
@sprites["fourthpokehearts"]=IconSprite.new(408,336,@viewport)
@sprites["fourthpokehearts"].setBitmap(heartfile)
end
end
end
end
def pbDecreaseHearts(target,position)
if target==@pkmn1
if position==1
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@fastest.name))
else
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@fastest.name))
end
@pkmn1hearts.downto((@pkmn1hearts-@pkmn1jam)){|i|
if (@pkmn1hearts-@pkmn1jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["firstpokehearts"]=IconSprite.new(408,51,@viewport)
@sprites["firstpokehearts"].setBitmap(heartfile)
}
elsif position==2
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@second.name))
else
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@second.name))
end
@pkmn1hearts.downto((@pkmn1hearts-@pkmn1jam)){|i|
if (@pkmn1hearts-@pkmn1jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["secondpokehearts"]=IconSprite.new(408,145,@viewport)
@sprites["scondepokehearts"].setBitmap(heartfile)
}
elsif position==3
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@third.name))
else
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@third.name))
end
@pkmn1hearts.downto((@pkmn1hearts-@pkmn1jam)){|i|
if (@pkmn1hearts-@pkmn1jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["thirdpokehearts"]=IconSprite.new(408,241,@viewport)
@sprites["thirdpokehearts"].setBitmap(heartfile)
}
else
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@fourth.name))
else
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@fourth.name))
end
@pkmn1hearts.downto((@pkmn1hearts-@pkmn1jam)){|i|
if (@pkmn1hearts-@pkmn1jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["fourthpokehearts"]=IconSprite.new(358,336,@viewport)
@sprites["fourthpokehearts"].setBitmap(heartfile)
}
end
elsif target==@pkmn2
if position==1
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@fastest.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@fastest.name))
end
@pkmn2hearts.downto((@pkmn2hearts-@pkmn2jam)){|i|
if (@pkmn2hearts-@pkmn2jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["firstpokehearts"]=IconSprite.new(408,51,@viewport)
@sprites["firstpokehearts"].setBitmap(heartfile)
}
elsif position==2
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@second.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@second.name))
end
@pkmn2hearts.downto((@pkmn2hearts-@pkmn2jam)){|i|
if (@pkmn2hearts-@pkmn2jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["secondpokehearts"]=IconSprite.new(408,145,@viewport)
@sprites["secondpokehearts"].setBitmap(heartfile)
}
elsif position==3
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@third.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@third.name))
end
@pkmn2hearts.downto((@pkmn2hearts-@pkmn2jam)){|i|
if (@pkmn2hearts-@pkmn2jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["thirdpokehearts"]=IconSprite.new(408,241,@viewport)
@sprites["thirdpokehearts"].setBitmap(heartfile)
}
else
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@fourth.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@fourth.name))
end
@pkmn2hearts.downto((@pkmn2hearts-@pkmn2jam)){|i|
if (@pkmn2hearts-@pkmn2jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["fourthpokehearts"]=IconSprite.new(408,336,@viewport)
@sprites["fourthpokehearts"].setBitmap(heartfile)
}
end
elsif target==@pkmn3
if position==1
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@fastest.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@fastest.name))
end
@pkmn3hearts.downto((@pkmn3hearts-@pkmn3jam)){|i|
if (@pkmn3hearts-@pkmn3jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["firstpokehearts"]=IconSprite.new(408,51,@viewport)
@sprites["firstpokehearts"].setBitmap(heartfile)
}
elsif position==2
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@second.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@second.name))
end
@pkmn3hearts.downto((@pkmn3hearts-@pkmn3jam)){|i|
if (@pkmn3hearts-@pkmn3jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["secondpokehearts"]=IconSprite.new(408,145,@viewport)
@sprites["secondpokehearts"].setBitmap(heartfile)
}
elsif position==3
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@third.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@third.name))
end
@pkmn3hearts.downto((@pkmn3hearts-@pkmn3jam)){|i|
if (@pkmn3hearts-@pkmn3jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["thirdpokehearts"]=IconSprite.new(408,241,@viewport)
@sprites["thirdpokehearts"].setBitmap(heartfile)
}
else
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@fourth.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@fourth.name))
end
@pkmn3hearts.downto((@pkmn3hearts-@pkmn3jam)){|i|
if (@pkmn3hearts-@pkmn3jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["fourthpokehearts"]=IconSprite.new(408,336,@viewport)
@sprites["fourthpokehearts"].setBitmap(heartfile)
}
end
else
if position==1
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@fastest.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@fastest.name))
end
@pkmn4hearts.downto((@pkmn4hearts-@pkmn4jam)){|i|
if (@pkmn4hearts-@pkmn4jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["firstpokehearts"]=IconSprite.new(408,151,@viewport)
@sprites["firstpokehearts"].setBitmap(heartfile)
}
elsif position==2
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@second.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@second.name))
end
@pkmn4hearts.downto((@pkmn4hearts-@pkmn4jam)){|i| #638
if (@pkmn4hearts-@pkmn4jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["secondpokehearts"]=IconSprite.new(408,145,@viewport)
@sprites["secondpokehearts"].setBitmap(heartfile)
}
elsif position==3
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@third.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@third.name))
end
@pkmn4hearts.downto((@pkmn4hearts-@pkmn4jam)){|i|
if (@pkmn4hearts-@pkmn4jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["thirdpokehearts"]=IconSprite.new(408,241,@viewport)
@sprites["thirdpokehearts"].setBitmap(heartfile)
}
else
if @currentjam==1
Kernel.pbMessage(_INTL("{1} looked down out of distraction.",@fourth.name))
elsif @currentjam>1
Kernel.pbMessage(_INTL("{1} couldn't help leaping up!",@fourth.name))
end
@pkmn4hearts.downto((@pkmn4hearts-@pkmn4jam)){|i|
if (@pkmn4hearts-@pkmn4jam)>=0
heartfile=sprintf("Graphics/Pictures/Contest/heart%d",i)
else
heartfile=sprintf("Graphics/Pictures/Contest/negaheart%d",i)
end
Graphics.update
sleep(1.0/7.0)
@sprites["fourthpokehearts"]=IconSprite.new(408,336,@viewport)
@sprites["fourthpokehearts"].setBitmap(heartfile)
}
end
end
end
def pbFindFastestOrderRanking #Finds the fastest pokemon in the contest
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,@pkmn1.species,13)
basespeed1=dexdata.fgetb
pokespeed1=basespeed1
pbDexDataOffset(dexdata,@pkmn2.species,13)
basespeed2=dexdata.fgetb
pokespeed2=basespeed2
pbDexDataOffset(dexdata,@pkmn3.species,13)
basespeed3=dexdata.fgetb
pokespeed3=basespeed3
pbDexDataOffset(dexdata,@pkmn4.species,13)
basespeed4=dexdata.fgetb
pokespeed4=basespeed4
dexdata.close
fastest = [basespeed1, basespeed2, basespeed3, basespeed4]
fastest=fastest.sort.reverse
@firstnumber=(fastest[0]== pokespeed1)? 1 : ((fastest[0]==pokespeed2) ? 2 : ((fastest[0]==pokespeed3)? 3: 4))
@fastest=(fastest[0]== pokespeed1)? @pkmn1 : ((fastest[0]==pokespeed2) ? @pkmn2 : ((fastest[0]==pokespeed3)? @pkmn3 : @pkmn4))
@secondnumber=(fastest[1]== pokespeed1)? 1 : ((fastest[1]==pokespeed2) ? 2 : ((fastest[1]==pokespeed3)? 3: 4))
@second=(fastest[1]== pokespeed1)? @pkmn1 : ((fastest[1]==pokespeed2) ? @pkmn2 : ((fastest[1]==pokespeed3)? @pkmn3 : @pkmn4))
@thirdnumber=(fastest[2]== pokespeed1)? 1 : ((fastest[2]==pokespeed2) ? 2 : ((fastest[2]==pokespeed3)? 3: 4))
@third=(fastest[2]== pokespeed1)? @pkmn1 : ((fastest[2]==pokespeed2) ? @pkmn2 : ((fastest[2]==pokespeed3)? @pkmn3 : @pkmn4))
@fourthnumber=(fastest[3]== pokespeed1)? 1 : ((fastest[3]==pokespeed2) ? 2 : ((fastest[3]==pokespeed3)? 3: 4))
@fourth=(fastest[3]== pokespeed1)? @pkmn1 : ((fastest[3]==pokespeed2) ? @pkmn2 : ((fastest[3]==pokespeed3)? @pkmn3 : @pkmn4))
end
def pbDisplayFastest #Displays the sprite of the fastest pokemon, as per FindFastest
@sprites["pokemon#{@firstnumber}"]=PokemonSprite.new(@viewport)
@sprites["pokemon#{@firstnumber}"].setPokemonBitmap(@fastest,true)
@sprites["pokemon#{@firstnumber}"].mirror=true
pokemony=Graphics.height/2-32
pokemonyadjust=pokemony-32
pbPositionPokemonSprite(@sprites["pokemon#{@firstnumber}"],178,112)
end
def pbDisplaySecondFastest
@sprites["pokemon#{@secondnumber}"]=PokemonSprite.new(@viewport)
@sprites["pokemon#{@secondnumber}"].setPokemonBitmap(@second,true)
@sprites["pokemon#{@secondnumber}"].mirror=true
pokemony=Graphics.height/2-32
pokemonyadjust=pokemony-32
pbPositionPokemonSprite(@sprites["pokemon#{@secondnumber}"],178,112)
end
def pbDisplayThirdFastest
@sprites["pokemon#{@thirdnumber}"]=PokemonSprite.new(@viewport)
@sprites["pokemon#{@thirdnumber}"].setPokemonBitmap(@third,true)
@sprites["pokemon#{@thirdnumber}"].mirror=true
pokemony=Graphics.height/2-32
pokemonyadjust=pokemony-32
pbPositionPokemonSprite(@sprites["pokemon#{@thirdnumber}"],178,112)
end
def pbDisplayFourthFastest
@sprites["pokemon#{@fourthnumber}"]=PokemonSprite.new(@viewport)
@sprites["pokemon#{@fourthnumber}"].setPokemonBitmap(@fourth,true)
@sprites["pokemon#{@fourthnumber}"].mirror=true
pokemony=Graphics.height/2-32
pokemonyadjust=pokemony-32
pbPositionPokemonSprite(@sprites["pokemon#{@fourthnumber}"],178,112)
end
def pbCurrentPokeNum(currentpos) #find pokemon's number (i.e. 1 for @pkmn1)
if currentpos==1
if @fastest==@pkmn1
return 1
elsif @fastest==@pkmn2
return 2
elsif @fastest==@pkmn3
return 3
else @fastest==@pkmn4
return 4
end
elsif currentpos==2
if @second==@pkmn1
return 1
elsif @second==@pkmn2
return 2
elsif @second==@pkmn3
return 3
else @second==@pkmn4
return 4
end
elsif currentpos==3
if @third==@pkmn1
return 1
elsif @third==@pkmn2
return 2
elsif @third==@pkmn3
return 3
else @third==@pkmn4
return 4
end
else
if @fourth==@pkmn1
return 1
elsif @fourth==@pkmn2
return 2
elsif @fourth==@pkmn3
return 3
else @fourth==@pkmn4
return 4
end
end
end
def pbResetContestMoveEffects #End round reset
@Oblivious=[false,false,false,false]
@AvoidOnce=[0,0,0,0]
@Scramble=false
@MoveUp=[false,false,false,false]
@MoveDown=[false,false,false,false]
@UpCondition=[false,false,false,false]
@previoushearts=0
@crowdexcitment=true
@goodappeal=[false,false,false,false]
@easilystartled=[false,false,false,false]
@nervous=[false,false,false,false]
@jamaffected=[false,false,false,false]
@hasattention=[false,false,false,false]
@priorhearts=[@pkmn1hearts,@pkmn2hearts,@pkmn3hearts,@pkmn4hearts]
end
def pbFunctionsAdjustHearts
contestmovedata=PBContestMoveData.new(@currentmove)
@currentfunction=contestmovedata.contestfunction
@currentjam=contestmovedata.jam
i=pbCurrentPokeNum(@currentpos)
if @currentfunction==1
@AvoidOnce[i]=1
elsif @currentfunction==2
@Oblivious[i]=true
elsif @currentfunction==3
@MoveUp[i]=true
elsif @currentfunction==4
@UpCondition[i]=true
elsif @currentfunction==5
Kernel.pbMessage(_INTL("It tried to startle the other Pokemon!"))
if @currentpos==4
if @Oblivious[2]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@third.name))
elsif @AvoidOnce[2]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@third.name))
@AvoidOnce[2]==0
else
pbJam(@currentjam,@third,3)
pbDecreaseHearts(@third,3)
end
if @Oblivious[1]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
elsif @AvoidOnce[1]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
@AvoidOnce[1]==0
else
pbJam(@currentjam,@second,2)
pbDecreaseHearts(@second,2) #842
end
if @Oblivious[0]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
elsif @AvoidOnce[0]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
@AvoidOnce[0]==0
else
pbJam(@currentjam,@fastest,1)
pbDecreaseHearts(@fastest,1)
end
elsif @currentpos==3
if @Oblivious[1]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
elsif @AvoidOnce[1]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
@AvoidOnce[1]==0
else
pbJam(@currentjam,@second,2)
pbDecreaseHearts(@second,2)
end
if @Oblivious[0]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
elsif @AvoidOnce[0]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
@AvoidOnce[0]==0
else
pbJam(@currentjam,@fastest,1)
pbDecreaseHearts(@fastest,1)
end
elsif @currentpos==2
if @Oblivious[0]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
elsif @AvoidOnce[0]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
@AvoidOnce[0]==0
else
pbJam(@currentjam,@fastest,1)
pbDecreaseHearts(@fastest,1)
end
else
end
elsif @currentfunction==6
@currenthearts=@currentpos
@currenthearts=(@currentpos+1) if @currenpos==4
elsif @currentfunction==7
for i in @hasattention
if @hasattention[i]==true
if @Oblivious[i]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@attention♥♥♥♥♥[i].name))
elsif @AvoidOnce[i]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@attention♥♥♥♥♥[i].name))
@AvoidOnce[i]==0
else
pbJam(@currentjam,@attention♥♥♥♥♥[i],i)
pbDecreaseHearts(@attention♥♥♥♥♥[i],i)
end
end
end
elsif @currentfunction==8
Kernel.pbMessage(_INTL("It tried to startle the previous Pokemon!"))
if @currentpos==4
if @Oblivious[2]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@third.name))
elsif @AvoidOnce[2]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@third.name))
@AvoidOnce[2]==0
else
pbJam(@currentjam,@third,3)
pbDecreaseHearts(@third,3)
end
elsif @currentpos==3
if @Oblivious[1]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
elsif @AvoidOnce[1]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
@AvoidOnce[1]==0
else
pbJam(@currentjam,@second,2)
pbDecreaseHearts(@second,2)
end
elsif @currentpos==2
if @Oblivious[0]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
elsif @AvoidOnce[0]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
@AvoidOnce[0]==0
else
pbJam(@currentjam,@fastest,1)
pbDecreaseHearts(@fastest,1)
end
else
end
elsif @currentfunction==9
if @priorhearts[@currentpos-1]>=3
@currenthearts=(@currenthearts*2)
else
@currenthearts==1
end
elsif @currentfunction==10
@easilystartled[i]=true
elsif @currentfunction==11
@MoveDown[i]=true
elsif @currentfunction==12
for i in 0..3
if @priorhearts[i]>3
if @Oblivious[i]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@attention♥♥♥♥♥[i].name))
elsif @AvoidOnce[i]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@attention♥♥♥♥♥[i].name))
@AvoidOnce[i]==0
else
pbJam(@currentjam,@attention♥♥♥♥♥[i],i)
pbDecreaseHearts(@attention♥♥♥♥♥[i],i)
end
end
end
elsif @currentfunction==13
@crowdexcitment=false
elsif @currentfunction==14
if @currentpos==1
@currenthearts=(@currenthearts*2)
end
elsif @currentfunction==16
@MissTurn[i]=true
Kernel.pbMessage(_INTL("It tried to startle the other Pokemon!"))
if @currentpos==4
if @Oblivious[2]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@third.name))
elsif @AvoidOnce[2]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@third.name))
@AvoidOnce[2]==0
else
pbJam(@currentjam,@third,3)
pbDecreaseHearts(@third,3)
end
if @Oblivious[1]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
elsif @AvoidOnce[1]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
@AvoidOnce[1]==0
else
pbJam(@currentjam,@second,2)
pbDecreaseHearts(@second,2)
end
if @Oblivious[0]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
elsif @AvoidOnce[0]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
@AvoidOnce[0]==0
else
pbJam(@currentjam,@fastest,1)
pbDecreaseHearts(@fastest,1)
end
elsif @currentpos==3
if @Oblivious[1]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
elsif @AvoidOnce[1]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@second.name))
@AvoidOnce[1]==0
else
pbJam(@currentjam,@second,2)
pbDecreaseHearts(@second,2)
end
if @Oblivious[0]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
elsif @AvoidOnce[0]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
@AvoidOnce[0]==0
else
pbJam(@currentjam,@fastest,1)
pbDecreaseHearts(@fastest,1)
end
elsif @currentpos==2
if @Oblivious[0]==true
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
elsif @AvoidOnce[0]>0
Kernel.pbMessage(_INTL("{1} managed to avoid seeing it",@first.name))
@AvoidOnce[0]==0
else
pbJam(@currentjam,@fastest,1)
pbDecreaseHearts(@fastest,1)
end
else
end
elsif @currentfunction==17
if @currentpos==0
for i in 1..3
Kernel.pbMessage(_INTL("{1} became nervous.",@attention♥♥♥♥♥[i].name))
@nervous[i]=true
end
elsif @currentpos==1
for i in 2..3
Kernel.pbMessage(_INTL("{1} became nervous.",@attention♥♥♥♥♥[i].name))
@nervous[i]=true
end
elsif @currentpos==2
Kernel.pbMessage(_INTL("{1} became nervous.",@fourth.name))
@nervous[3]=true
end
elsif @currentfunction==18
@nomoremoves[i]=true
elsif @currentfunction==19
@currenthearts=(@applause+1)
elsif @currentfunction==20
@currenthearts=(rand(5)+1)
elsif @currentfunction==21
@currenthearts=5 if @currentpos==4
elsif @currentunction==22
for i in 0..3
@stars[i]=(@stars[i]-1) if @stars[i]>0
end
elsif @currentfunction==23
@currenthearts=@currentpos
@currenthearts=(@currentpos+1) if @currenpos==4
elsif @currentfunction==24
@Scramble=true
elsif @currentfunction==25
if @moveType==@lastmoveType
@currenthearts=(@currenthearts*2)
end
elsif @currentfunction==26
@MoveDown[i]=true
elsif @currentfunction==27
@DoubleNext[i]=true
Kernel.pbMessage(_INTL("{1} is getting prepared.",@attention♥♥♥♥♥[i]))
elsif @currentfunction==28
@currenthearts=(rand(5)+1)
elsif @currentfunction==29
if @currentpos==1
@currenthearts=1
else
if @priorhearts[@currentpos-1]<3
@currenthearts=(@currenthearts*2)
else
@currenthearts=1
end
end
elsif @currentfunction==30
if @currentpos==1
@currenthearts=1
else
@currenthearts=(@priorhearts[currentpos-1]/2)
end
elsif @currentfunction==31
@applause=5
pbCrowd(move="notnil")
elsif @currentfunction==32
for i in 0...@currentpos
if @stars[i]>0
@stars[i]=(@stars[i]-1)
end
end
elsif @currentfunction==33
@currenthearts=@applause
elsif @currentfunction==34
@currenthearts=@priorhearts[currentpos-1]
elsif @currentfunction==35
@currenthearts=@stars[@currentpos]
elsif @currentfunction==36
if @movetype==@contestType
@currenthearts=(@currenthearts+1)
else
@currenthearts=@currenthearts
end
elsif @currentfunction==37
@currenthearts=(@currenthearts+@priorhearts[@currentpos-1])
elsif @currentfunction==38
if @applause==1
@currenthearts=5
elsif @applause==2
@currenthearts=4
elsif @applause==3
@currenthearts=3
elsif @applause==4
@currenthearts=2
elsif @applause==0
@currenthearts=6
else
@currenthearts=1
end
elsif @currentfunction==39
@currenthearts=(@round+1)
elsif @currentfunction==40
if @currentpos>1
if @priorhearts[@currentpos-1] >3
@currenthearts=(@currenthearts*2)
end
else
@currenthearts=1
end
elsif @currentfunction==41
@currenthearts=@applause
else
@currenthearts=@currenthearts
end
end
def pbCrowd(move=nil)
if @crowdexcitment==true
if move==nil
if @moveType==@contestType
@applause=(@applause+1)
Kernel.pbMessage(_INTL("{1}'s {2} went over great!",attention♥♥♥♥♥[i].name,@contestType))
@currenthearts=(@currenthearts+1)
pbDisplayAddingPositiveHearts
else
Kernel.pbMessage(_INTL("{1}'s {2} didn't go over well!",attention♥♥♥♥♥[i].name,@moveType))
@applause=(@applause-1) if @applause>0
@currenthearts=(@currenthearts+1)
pbDecreaseHearts(@attention♥♥♥♥♥[i],@currentpos)
end
end
if @applause==5
Kernel.pbMessage(_INTL("{1}'s {2} really got the crowd going!",attention♥♥♥♥♥[i].name,@moveType))
@currenthearts=(@currenthearts+5)
pbDisplayAddingPositiveHearts
@applause=0
end
end
end
def pbJam(jam,target,position) #Error
if target=@pkmn1
@pkmn1jam=jam
Kernel.pbMessage(_INTL("{1}",@pkmn1jam))
elsif target==@pkmn2
Kernel.pbMessage(_INTL("{1}",@pkmn2jam))
@pkmn2jam=jam
elsif target==@pkmn3
Kernel.pbMessage(_INTL("{1}",@pkmn3jam))
@pkmn3jam=jam
else
@pkmn4jam=jam
Kernel.pbMessage(_INTL("{1}",@pkmn4jam))
end
end
def pbMoveButtons
pokemon=@pkmn1
pokename=pokemon.name
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["moves"]=IconSprite.new(0,257,@viewport)
@sprites["moves"].setBitmap("Graphics/Pictures/Contest/moves")
base=Color.new(248,248,248)
shadow=Color.new(104,104,104)
@sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
overlay=@sprites["overlay"].bitmap
pbSetSmallFont(overlay)
textpos=[
[_INTL("MOVES"),12,225,0,base,shadow]]
imagepos=[]
yPos=258
xPos=2
count=0
for i in 0...pokemon.moves.length
if pokemon.moves[i].id>0
imagepos.push(["Graphics/Pictures/types",xPos,yPos+2,0,
pokemon.moves[i].type*28,64,28])
textpos.push([PBMoves.getName(pokemon.moves[i].id),xPos+68,yPos+2,0,
Color.new(64,64,64),Color.new(176,176,176)])
else
textpos.push(["-",316,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
end
count=count+1
yPos+=64 if count<=1
yPos=258 if count==2
yPos=322 if count==3
xPos=170 if count>1
end
pbDrawTextPositions(overlay,textpos)
pbDrawImagePositions(overlay,imagepos)
end
def pbEndScene
$game_map.autoplay
pbFadeOutAndHide(@sprites) { update }
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
def middleScene
loop do
Graphics.update
Input.update
self.update
if Input.trigger?(Input::C)
pbMoveButtons
end
if Input.trigger?(Input::B)
break
end
end
end
end
class PokeContest
def initialize(scene)
@scene=scene
end
def pbStartContest(chosen,opponent1,opponent1level,opponent2,opponent2level,opponent3,opponent3level)
@scene.pbStartContest(chosen,opponent1,opponent1level,opponent2,opponent2level,opponent3,opponent3level)
@scene.middleScene
@scene.pbEndScene
end
end
def pbContest(opponent1,opponent1level,opponent2,opponent2level,opponent3,opponent3level)
scene=PokemonScreen_Scene.new
screen=PokemonScreen.new(scene,$Trainer.party)
screen.pbStartScene(_INTL("Choose a Pokémon?"),false)
chosen=screen.pbChoosePokemon
if chosen>=0
scene=PokeContestScene.new
screen=PokeContest.new(scene)
return screen.pbStartContest(chosen,opponent1,opponent1level,opponent2,opponent2level,opponent3,opponent3level)
else
return false
end
end