Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # ZodiacPowers - Compatibility for Elite Battle System
- #
- #===============================================================================
- # This script is to be installed only to allow compatibility with the
- # Zodiac Power add-on for Pokemon Birthsigns, and Luka S.J.'s EliteBattle.
- #===============================================================================
- # ~Installation~
- #===============================================================================
- # Paste this script below EliteBattle_3. This will allow for compatibility
- # between the scripts.
- #===============================================================================
- #===============================================================================
- # Fight Menu
- # UI ovarhaul
- #===============================================================================
- class NewFightWindow
- attr_accessor :index
- attr_accessor :battler
- attr_accessor :refreshpos
- attr_reader :nummoves
- def initialize(viewport=nil)
- if !viewport.nil?
- view = Viewport.new(viewport.rect.x,viewport.rect.y,viewport.rect.width,viewport.rect.height)
- view.z = viewport.z
- view2 = Viewport.new(viewport.rect.x,viewport.rect.y,viewport.rect.width,viewport.rect.height)
- view2.z = viewport.z + 2
- viewport = view
- end
- @viewport=viewport
- @viewport2=(viewport.nil?) ? viewport : view2
- @index=0
- @over=false
- @refreshpos=false
- @battler=nil
- @nummoves=0
- if EBUISTYLE==2
- @buttonBitmap=pbBitmap("#{checkEBFolderPath}/nextGen/moveSelButtons")
- else
- @buttonBitmap=pbBitmap("#{checkEBFolderPath}/moveSelButtons")
- end
- @categoryBitmap=pbBitmap("Graphics/Pictures/category")
- @backdrop=Sprite.new(@viewport)
- @backdrop.bitmap=Bitmap.new(@viewport.rect.width,@viewport.rect.height)
- @backdrop.opacity=0
- @backdrop.tone=Tone.new(64,64,64)
- @background=Sprite.new(@viewport)
- if EBUISTYLE==2
- @background.bitmap=pbBitmap("#{checkEBFolderPath}/nextGen/newBattleMessageBox")
- else
- @background.bitmap=pbBitmap("#{checkEBFolderPath}/newCommandBox")
- end
- @background.y=VIEWPORT_HEIGHT-98+(EBUISTYLE==2 ? 2 : 0)
- @background.z=100
- @selHand=Sprite.new(@viewport2)
- @selHand.bitmap=pbBitmap("#{checkEBFolderPath}/selHand")
- @selHand.oy=@selHand.bitmap.height
- @selHand.ox=@selHand.bitmap.width/2
- @selHand.z=150
- @selHand.visible=false
- @animdata=[0.1,0]
- @arrow1=Sprite.new(@viewport)
- @arrow1.bitmap=pbBitmap("#{checkEBFolderPath}/dirArrow")
- @arrow1.y=@background.y+2
- @arrow1.z=140
- @arrow1.mirror=true
- @arrow1.opacity=0
- @arrow2=Sprite.new(@viewport)
- @arrow2.bitmap=pbBitmap("#{checkEBFolderPath}/dirArrow")
- @arrow2.y=@background.y+2
- @arrow2.z=140
- @arrow2.x=Graphics.width-20
- @arrow2.opacity=0
- @megaButton=Sprite.new(@viewport)
- path = (EBUISTYLE==2) ? "nextGen/" : ""
- @megaButton.bitmap=pbBitmap("#{checkEBFolderPath}/#{path}megaEvoButton")
- @megaButton.y=252
- @megaButton.x=-16
- @megaButton.z=145
- @megaButton.src_rect.set(0,0,116,48)
- #===========================================================================
- if INCLUDE_ZPOWER
- @zodiacButton=Sprite.new(@viewport)
- if EBUISTYLE==0
- @zodiacButton.bitmap=pbBitmap("Graphics/Pictures/Birthsigns/Other/battlezodiac")
- elsif EBUISTYLE==1
- @zodiacButton.bitmap=pbBitmap("Graphics/Pictures/Birthsigns/Other/battlezodiacEB1")
- end
- @zodiacButton.y=252
- @zodiacButton.x=-16
- @zodiacButton.z=145
- @zodiacButton.src_rect.set(0,0,116,48)
- end
- #===========================================================================
- #===========================================================================
- if INCLUDE_ZMOVES
- @zButton=Sprite.new(@viewport)
- path = (EBUISTYLE==2) ? "nextGen/" : ""
- @zButton.bitmap=pbBitmap("#{checkEBFolderPath}/#{path}ZMove")
- @zButton.y=252
- @zButton.x=-16
- @zButton.z=145
- @zButton.src_rect.set(0,0,116,48)
- end
- #===========================================================================
- @button={}
- @moved=false
- @showMega=false
- #===========================================================================
- @showZodiac=false if INCLUDE_ZPOWER
- @showZMove=false if INCLUDE_ZMOVES
- #===========================================================================
- @position=[]
- @alternate=[0,0]
- end
- def hide
- @backdrop.opacity-=25.5
- @selHand.visible=false
- @background.y+=10
- @megaButton.x-=10
- #===========================================================================
- @zodiacButton.x-=10 if INCLUDE_ZPOWER
- @zButton.x-=10 if INCLUDE_ZMOVES
- #===========================================================================
- @arrow1.y+=10
- @arrow2.y+=10
- @showMega=false
- #===========================================================================
- @showZodiac=false if INCLUDE_ZPOWER
- @showZMove=false if INCLUDE_ZMOVES
- #===========================================================================
- for i in 0...5
- next if !@button["#{i}"]
- @button["#{i}"].y=@background.y+10 if @button["#{i}"] && !@button["#{i}"].disposed?
- @button["#{i}_2"].y=@background.y+10 if @button["#{i}_2"] && !@button["#{i}_2"].disposed?
- end
- end
- #=============================================================================
- def zodiacButton
- @showZodiac=true
- end
- def zodiacButtonTrigger
- @zodiacButton.src_rect.y+=48
- @zodiacButton.src_rect.y=0 if @zodiacButton.src_rect.y >=96
- end
- #=============================================================================
- def zButton
- @showZMove=true
- end
- def zButtonTrigger
- @zButton.src_rect.y+=48
- @zButton.src_rect.y=0 if @zButton.src_rect.y >=96
- end
- #=============================================================================
- def update
- if @index==0 or @index==1
- @arrow2.opacity+=25.5 if @arrow2.opacity < 255
- elsif @index==2 or @index==3
- @arrow2.opacity-=25.5 if @arrow2.opacity > 0
- end
- if @index==1 or @index==2 or @index==3
- @arrow1.opacity+=25.5 if @arrow1.opacity < 255
- elsif @index==0
- @arrow1.opacity-=25.5 if @arrow1.opacity > 0
- end
- for i in 0...@position.length
- @position[i]=30+(i*220)-(@index*220) if @index < 3 or @refreshpos
- end
- @refreshpos=false
- for i in 0...@nummoves
- @button["#{i}_2"].visible=false
- @button["#{i}_2"].visible=true if @index==i
- if @index==i
- @button["#{i}"].y-=1 if @button["#{i}"].y > @background.y+2
- else
- @button["#{i}"].y+=1 if @button["#{i}"].y < @background.y+10
- end
- distance=@button["#{i}"].x-@position[i]
- @button["#{i}"].x-=distance/10
- @button["#{i}_2"].x=@button["#{i}"].x
- @button["#{i}_2"].y=@button["#{i}"].y
- end
- if @showMega
- @megaButton.x+=10 if @megaButton.x < -16
- end
- #===========================================================================
- if INCLUDE_ZPOWER
- if @showZodiac
- @zodiacButton.x+=10 if @zodiacButton.x < -16
- end
- end
- #===========================================================================
- if INCLUDE_ZMOVES
- if @showZMove
- @zButton.x+=10 if @zButton.x < -16
- end
- end
- #===========================================================================
- @selHand.x=@button["#{@index}"].x+@button["#{@index}"].src_rect.width/2
- @selHand.y=@button["#{@index}"].y
- @selHand.zoom_y-=@animdata[0]
- @selHand.visible=true
- @animdata[0]=-0.1 if @selHand.zoom_y <=0.5
- if @selHand.zoom_y >=1
- @animdata[0]=0
- @animdata[1]+=1
- if @animdata[1] > 14
- @animdata[0]=0.1
- @animdata[1]=0
- end
- end
- if defined?($mouse)
- @over = false
- for i in 0...5
- next if !@button["#{i}"]
- if $mouse.over?(@button["#{i}"])
- @over = true
- @index = i
- end
- end
- end
- end
- def dispose
- @viewport.dispose
- @viewport2.dispose
- @selHand.dispose
- @backdrop.dispose
- @background.dispose
- @arrow1.dispose
- @arrow2.dispose
- @megaButton.dispose
- #===========================================================================
- @zodiacButton.dispose if INCLUDE_ZPOWER
- @zButton.dispose if INCLUDE_ZMOVES
- #===========================================================================
- pbDisposeSpriteHash(@button)
- end
- #=============================================================================
- def overZodiac?
- return false if !defined?($mouse)
- return $mouse.over?(@zodiacButton)
- end
- #=============================================================================
- def overZMove?
- return false if !defined?($mouse)
- return $mouse.over?(@zButton)
- end
- #=============================================================================
- end
- class PokeBattle_Scene
- alias pbFightMenu_ebs pbFightMenu unless self.method_defined?(:pbFightMenu_ebs)
- def pbFightMenu(index)
- return pbFightMenu_ebs(index) if EBUISTYLE==0
- clearMessageWindow
- if EBUISTYLE==2
- @sprites["battlebox0"].visible = false if @sprites["battlebox0"]
- @sprites["battlebox2"].visible = false if @sprites["battlebox2"]
- end
- cw = @fightWindow
- mega = false
- #===========================================================================
- zodiac = false if INCLUDE_ZPOWER
- zMove = false if INCLUDE_ZMOVES
- #===========================================================================
- battler=@battle.battlers[index]
- cw.megaButton if @battle.pbCanMegaEvolve?(index)
- #===========================================================================
- cw.zodiacButton if (INCLUDE_ZPOWER && @battle.pbCanUseZodiacPower?(index))
- cw.zButton if (INCLUDE_ZMOVES && @battle.pbCanZMove?(index))
- #===========================================================================
- cw.battler=battler
- lastIndex=@lastmove[index]
- if battler.moves[lastIndex].id!=0
- cw.index=lastIndex
- else
- cw.index=0
- end
- cw.generateButtons
- pbSelectBattler(index)
- pbSEPlay("SE_Zoom4",50)
- moveUpperRight(cw)
- pbRefresh
- loop do
- pbGraphicsUpdate
- pbInputUpdate
- animateBattleSprites(true)
- cw.update
- # Update selected command
- if (defined?($mouse) && $mouse.active? && cw.mouseOver?)
- elsif (Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)) && (EBUISTYLE==2)
- pbSEPlay("SE_Select1")
- cw.index=[0,1,2,3][[1,0,3,2].index(cw.index)]
- cw.index=(cw.nummoves-1) if cw.index < 0
- cw.index=0 if cw.index > (cw.nummoves-1)
- elsif (Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)) && (EBUISTYLE==2)
- pbSEPlay("SE_Select1")
- cw.index=[0,1,2,3][[2,3,0,1].index(cw.index)]
- cw.index=0 if cw.index < 0
- cw.index=(cw.nummoves-1) if cw.index > (cw.nummoves-1)
- elsif Input.trigger?(Input::LEFT) && cw.index < 4
- if cw.index > 0
- pbSEPlay("SE_Select1")
- cw.index-=1
- else
- pbSEPlay("SE_Select1")
- cw.index=cw.nummoves-1
- cw.refreshpos=true
- end
- elsif Input.trigger?(Input::RIGHT) && cw.index < 4
- if cw.index < (cw.nummoves-1)
- pbSEPlay("SE_Select1")
- cw.index+=1
- else
- pbSEPlay("SE_Select1")
- cw.index=0
- end
- end
- if Input.trigger?(Input::C) || (defined?($mouse) && cw.mouseOver? && $mouse.leftClick?) # Confirm choice
- if cw.index < 4
- @ret=cw.index
- @battle.pbRegisterMegaEvolution(index) if mega
- #=====================================================================
- if INCLUDE_ZPOWER
- @battle.pbRegisterZodiacPower(index) if zodiac
- end
- if INCLUDE_ZMOVES
- @battle.pbRegisterZMove(index) if zMove
- end
- #=====================================================================
- pbSEPlay("SE_Select2")
- @lastmove[index]=@ret
- @idleTimer=-1
- @inCMx=false
- break
- else
- @lastmove[index]=cw.index
- pbPlayCancelSE()
- @ret=-1
- break
- end
- #=========================================================================
- elsif Input.trigger?(Input::A) ||
- (defined?($mouse) && cw.overMega? && $mouse.leftClick?) ||
- (INCLUDE_ZPOWER && defined?($mouse) && cw.overZodiac? && $mouse.leftClick?) ||
- (INCLUDE_ZMOVES && (defined?($mouse) && cw.overZMove? && $mouse.leftClick?))
- #=========================================================================
- if @battle.pbCanMegaEvolve?(index) # Use Mega Evolution
- if mega
- mega = false
- else
- mega = true
- end
- cw.megaButtonTrigger
- pbSEPlay("SE_Select3")
- end
- #=========================================================================
- if INCLUDE_ZPOWER
- if @battle.pbCanUseZodiacPower?(index) # Use Zodiac Power
- if zodiac
- zodiac = false
- else
- zodiac = true
- end
- cw.zodiacButtonTrigger
- pbSEPlay("SE_Select3")
- end
- end
- #=========================================================================
- if INCLUDE_ZMOVES
- if @battle.pbCanZMove?(index) # Use Z-Move
- if zMove
- zMove = false
- else
- zMove = true
- end
- cw.zButtonTrigger
- pbSEPlay("SE_Select3")
- end
- end
- #=========================================================================
- elsif Input.trigger?(Input::B) || (defined?($mouse) && (cw.goBack? || $mouse.rightClick?)) # Cancel fight menu
- @lastmove[index]=cw.index
- #=======================================================================
- cw.megaButtonTrigger if mega
- cw.zodiacButtonTrigger if zodiac
- cw.zButtonTrigger if zMove
- #=======================================================================
- pbPlayCancelSE()
- @ret=-1
- break
- end
- end
- if @ret > -1
- vector = @battle.doublebattle ? VECTOR2 : VECTOR1
- @vector.set(vector)
- @orgPos=nil
- @vector.inc=0.2
- @vector.lock
- 10.times do
- cw.hide
- wait(1,true)
- end
- else
- moveLowerLeft(cw)
- end
- if EBUISTYLE==2 && !@battle.doublebattle
- @sprites["battlebox0"].visible = true if @sprites["battlebox0"]
- @sprites["battlebox2"].visible = true if @sprites["battlebox2"]
- end
- @sprites["battlebox#{index}"].visible = true if EBUISTYLE==2 && @doublebattle
- if EBUISTYLE==2 && @battle.doublebattle
- @sprites["battlebox0"].positionX = 0
- @sprites["battlebox2"].positionX = Graphics.width
- end
- return @ret
- end
- end
- #===============================================================================
- # Fight Menu (Next Generation)
- # UI ovarhaul
- #===============================================================================
- class NextGenFightWindow
- def initialize(viewport=nil,battle=nil)
- if !viewport.nil?
- view = Viewport.new(viewport.rect.x,viewport.rect.y,viewport.rect.width,viewport.rect.height)
- view.z = viewport.z
- view2 = Viewport.new(viewport.rect.x,viewport.rect.y,viewport.rect.width,viewport.rect.height)
- view2.z = viewport.z# + 2
- viewport = view
- end
- @viewport=viewport
- @viewport2=(viewport.nil?) ? viewport : view2
- @battle=battle
- @index=0
- @oldindex=-1
- @over=false
- @refreshpos=false
- @battler=nil
- @nummoves=0
- @opponent=nil
- @player=nil
- @opponent=@battle.battlers[1] if !@battle.doublebattle
- @player=@battle.battlers[0] if !@battle.doublebattle
- @buttonBitmap=pbBitmap("#{checkEBFolderPath}/nextGen/moveSelButtons")
- @background=Sprite.new(@viewport)
- @background.bitmap=pbBitmap("#{checkEBFolderPath}/nextGen/newBattleMessageBox")
- @background.y=VIEWPORT_HEIGHT-96
- @background.z=100
- @megaButton=Sprite.new(@viewport)
- @megaButton.bitmap=pbBitmap("#{checkEBFolderPath}/nextGen/megaEvoButton")
- @megaButton.z=101
- @megaButton.x=10
- @megaButton.y=316 + 100
- @megaButton.src_rect.set(0,0,44,44)
- #===========================================================================
- if INCLUDE_ZPOWER
- @zodiacButton=Sprite.new(@viewport)
- @zodiacButton.bitmap=pbBitmap("Graphics/Pictures/Birthsigns/Other/battlezodiacEB2")
- @zodiacButton.z=101
- @zodiacButton.x=10
- @zodiacButton.y=316 + 100
- @zodiacButton.src_rect.set(0,0,44,44)
- end
- #===========================================================================
- #===========================================================================
- if INCLUDE_ZMOVES
- @zButton=Sprite.new(@viewport)
- @zButton.bitmap=pbBitmap("#{checkEBFolderPath}/nextGen/ZMove")
- @zButton.z=101
- @zButton.x=10
- @zButton.y=316 + 100
- @zButton.src_rect.set(0,0,44,44)
- end
- #===========================================================================
- @backButton=Sprite.new(@viewport)
- @backButton.bitmap=pbBitmap("#{checkEBFolderPath}/nextGen/backButton")
- @backButton.z=101
- @backButton.x=462
- @backButton.y=316
- @button={}
- @moved=false
- @showMega=false
- #===========================================================================
- @showZodiac=false if INCLUDE_ZPOWER
- @showZMove=false if INCLUDE_ZMOVES
- #===========================================================================
- @ox=[60,258,60,258]
- @oy=[294,294,338,338]
- @category=[_INTL("PHYS"),_INTL("SPEC"),_INTL("STAT")]
- eff=[_INTL("Normal damage"),_INTL("Not very effective"),_INTL("Super effective")]
- @typeInd=Sprite.new(@viewport)
- @typeInd.bitmap=Bitmap.new(192,24*3)
- pbSetSmallFont(@typeInd.bitmap)
- for i in 0...3
- pbDrawOutlineText(@typeInd.bitmap,0,24*i,192,24,eff[i],Color.new(255,255,255),Color.new(0,0,0),1)
- end
- @typeInd.src_rect.set(0,0,192,24)
- @typeInd.ox=96
- @typeInd.oy=16
- @typeInd.z=103
- @typeInd.visible=false
- end
- def hide
- @typeInd.visible=false
- @background.y += 10
- @megaButton.y += 10
- @backButton.y += 10
- #===========================================================================
- @zodiacButton.y += 10 if INCLUDE_ZPOWER
- @zButton.y += 10 if INCLUDE_ZMOVES
- #===========================================================================
- for i in 0...@nummoves
- @button["#{i}"].x -= ((i%2==0) ? 26 : -26)
- end
- @showMega=false
- #===========================================================================
- @showZodiac=false if INCLUDE_ZPOWER
- @showZMove=false if INCLUDE_ZMOVES
- #===========================================================================
- end
- #=============================================================================
- def zodiacButton
- @showZodiac=true
- end
- def zodiacButtonTrigger
- @zodiacButton.src_rect.x+=44
- @zodiacButton.src_rect.x=0 if @zodiacButton.src_rect.x > 44
- @zodiacButton.src_rect.y = -4
- end
- #=============================================================================
- def zButton
- @showZMove=true
- end
- def zButtonTrigger
- @zButton.src_rect.x+=44
- @zButton.src_rect.x=0 if @zButton.src_rect.x > 44
- @zButton.src_rect.y = -4
- end
- #=============================================================================
- def update
- if @showMega
- @megaButton.y -= 10 if @megaButton.y > 316
- @megaButton.src_rect.y += 1 if @megaButton.src_rect.y < 0
- end
- #===========================================================================
- if INCLUDE_ZPOWER
- if @showZodiac
- @zodiacButton.y -= 10 if @zodiacButton.y > 316
- @zodiacButton.src_rect.y += 1 if @zodiacButton.src_rect.y < 0
- end
- end
- #===========================================================================
- if INCLUDE_ZMOVES
- if @showZMove
- @zButton.y -= 10 if @zButton.y > 316
- @zButton.src_rect.y += 1 if @zButton.src_rect.y < 0
- end
- end
- #===========================================================================
- if @oldindex!=@index
- @button["#{@index}"].src_rect.y = -4
- if SHOWTYPEADVANTAGE && !@battle.doublebattle
- move = @battler.moves[@index]
- @modifier = move.pbTypeModifier(move.type,@player,@opponent)
- end
- @oldindex = @index
- end
- for i in 0...@nummoves
- @button["#{i}"].src_rect.x = 198*(@index == i ? 0 : 1)
- @button["#{i}"].y = @y[i]
- @button["#{i}"].src_rect.y += 1 if @button["#{i}"].src_rect.y < 0
- next if i!=@index
- if [0,1].include?(i)
- @button["#{i}"].y = @y[i] - ((@nummoves < 3) ? 18 : 34)
- elsif [2,3].include?(i)
- @button["#{i}"].y = @y[i] - 34
- @button["#{i-2}"].y = @y[i-2] - 34
- end
- end
- if SHOWTYPEADVANTAGE && !@battle.doublebattle
- @typeInd.visible = true
- @typeInd.y = @button["#{@index}"].y
- @typeInd.x = @button["#{@index}"].x + @button["#{@index}"].src_rect.width/2
- eff=0
- if @modifier<8
- eff=1 # "Not very effective"
- elsif @modifier>8
- eff=2 # "Super effective"
- end
- @typeInd.src_rect.y = 24*eff
- end
- if defined?($mouse)
- @over = false
- for i in 0...@nummoves
- if $mouse.overPixel?(@button["#{i}"])
- @index = i
- @over = true
- end
- end
- end
- end
- def dispose
- @viewport.dispose
- @viewport2.dispose
- @background.dispose
- @megaButton.dispose
- #===========================================================================
- @zodiacButton.dispose if INCLUDE_ZPOWER
- @zButton.dispose if INCLUDE_ZMOVES
- #===========================================================================
- @backButton.dispose
- @typeInd.dispose
- pbDisposeSpriteHash(@button)
- end
- #=============================================================================
- def overZodiac?
- return false if !defined?($mouse)
- return $mouse.over?(@zodiacButton)
- end
- #=============================================================================
- def overZMove?
- return false if !defined?($mouse)
- return $mouse.over?(@zButton)
- end
- #=============================================================================
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement