From line 313 to line 323:
@zMove = []
if @player.is_a?(Array)
@zMove[0]=[-1]*@player.length
else
@zMove[0]=[-1]
end
if @opponent.is_a?(Array)
@zMove[1]=[-1]*@opponent.length
else
@zMove[1]=[-1]
end
Line 461:
return true if pbIsZCrystal?(item)
From line 558 to line 566:
def pbHasZRing(battlerIndex)
return true if !pbBelongsToPlayer?(battlerIndex)
for i in MEGARINGS
next if !hasConst?(PBItems,i)
return true if $PokemonBag.pbQuantity(i)>0
end
return false
end
From line 813 at line 816:
def zMove
return @zMove
end
From line 1057 at line 1059:
if @choices
[2].zmove && (@choices[2].pbIsPhysical?(@choices[2].type) || @choices[2].pbIsSpecial?(@choices[2].type))
pri=0
end
From line 1238 at line1240:
if @zMove[side]==idxPokemon
@zMove[side]=-1
end
From line 1516 at line 1518:
if @zMove[side]==idxPokemon
@zMove[side]=-1
end
From line 1777 at line 1810:
################################################################################
# Use Z-Move.
################################################################################
def pbCanZMove?(index)
return false if $game_switches[NO_Z_MOVE]
return false if !@battlers[index].hasZMove?
return false if !pbHasZRing(index)
side=(pbIsOpposing?(index)) ? 1 : 0
owner=pbGetOwnerIndex(index)
return false if @zMove[side]!=-1
return true
end
def pbRegisterZMove(index)
side=(pbIsOpposing?(index)) ? 1 : 0
owner=pbGetOwnerIndex(index)
@zMove[side]=index
end
def pbUseZMove(index,move,crystal)
return if !@battlers[index] || !@battlers[index].pokemon
return if !(@battlers[index].hasZMove? rescue false)
ownername=pbGetOwner(index).fullname
ownername=pbGetOwner(index).name if pbBelongsToPlayer?(index)
pbDisplay(_INTL("{1} surrounded itself with its Z-Power!",@battlers[index].pbThis))
pbCommonAnimation("ZPower",@battlers[index],nil)
PokeBattle_ZMoves.new(self,@battlers[index],move,crystal)
side=(pbIsOpposing?(index)) ? 1 : 0
owner=pbGetOwnerIndex(index)
@zMove[side]=-2
end
From line 2649 at line 2654:
for i in 0...@zMove[0].length
@zMove[0]=-1 if @zMove[0]>=0
end
for i in 0...@zMove[1].length
@zMove[1]=-1 if @zMove[1]>=0
end
In this see the red codes:
if @zMove[side]==i
@zMove[side]=-1
end
break
end
next if !pbRegisterMove(i,index)
if @doublebattle
thismove=@battlers.moves[index]
target=@battlers.pbTarget(thismove)
if target==PBTargets::SingleNonUser # single non-user
[email protected](i,target)
next if target<0
pbRegisterTarget(i,target)
elsif target==PBTargets::UserOrPartner # Acupressure
[email protected](i,target)
next if target<0 || (target&1)==1
pbRegisterTarget(i,target)
end
end
commandDone=true
end
else
pbAutoChooseMove(i)
commandDone=true
end
elsif cmd!=0 && @battlers.effects[PBEffects::SkyDrop]
pbDisplay(_INTL("Sky Drop won't let {1} go!",@battlers.pbThis(true)))
elsif cmd==1 # Bag
if !@internalbattle
if pbOwnedByPlayer?(i)
pbDisplay(_INTL("Items can't be used here."))
end
else
item=pbItemMenu(i)
if item[0]>0
if pbRegisterItem(i,item[0],item[1])
commandDone=true
end
end
end
elsif cmd==2 # Pokémon
pkmn=pbSwitchPlayer(i,false,true)
if pkmn>=0
commandDone=true if pbRegisterSwitch(i,pkmn)
end
elsif cmd==3 # Run
run=pbRun(i)
if run>0
commandDone=true
return
elsif run<0
commandDone=true
side=(pbIsOpposing?(i)) ? 1 : 0
owner=pbGetOwnerIndex(i)
if @megaEvolution[side]==i
@megaEvolution[side]=-1
end
if @zMove[side]==i
@zMove[side]=-1
end
end
elsif cmd==4 # Call
thispkmn=@battlers
@choices[0]=4 # "Call Pokémon"
@choices[1]=0
@choices[2]=nil
side=(pbIsOpposing?(i)) ? 1 : 0
owner=pbGetOwnerIndex(i)
if @megaEvolution[side]==i
@megaEvolution[side]=-1
end
if @zMove[side]==i
@zMove[side]=-1
end
commandDone=true
elsif cmd==-1 # Go back to first battler's choice
@megaEvolution[0][0]=-1 if @megaEvolution[0][0]>=0
@megaEvolution[1][0]=-1 if @megaEvolution[1][0]>=0
@zMove[0][0]=-1 if @zMove[0][0]>=0
@zMove[1][0]=-1 if @zMove[1][0]>=0
# Restore the item the player's first Pokémon was due to use
if @choices[0][0]==3 && $PokemonBag && $PokemonBag.pbCanStore?(@choices[0][1])
$PokemonBag.pbStoreItem(@choices[0][1])
end
pbCommandPhase
return
end
break if commandDone
end
end
end
end
end
################################################################################
# Attack phase.
################################################################################
def pbAttackPhase
@scene.pbBeginAttackPhase
for i in 0...4
@successStates.clear
if @choices[0]!=1 && @choices[0]!=2
@battlers.effects[PBEffects::DestinyBond]=false
@battlers.effects[PBEffects::Grudge]=false
end
@battlers.turncount+=1 if !@battlers.fainted?
@battlers.effects[PBEffects::Rage]=false if !pbChoseMove?(i,:RAGE)
end
# Prepare for Z Moves
for i in 0..3
next if @choices[0]!=1
side=(pbIsOpposing?(i)) ? 1 : 0
owner=pbGetOwnerIndex(i)
if @zMove[side]==i
@choices[2].zmove=true
end
end