In 'PBEffects' script, paste a new effect:
In 'PokeBattle_Battler' script:
'def pbInitEffects(batonpass)', paste the effect:
Then, 'def pbUseMoveSimple(moveid,index=-1,target=-1)', replace fot:
Now, paste above '# End of move usage':
Inside 'def pbEndTurn(choice)', paste below '@battle.battlers.pbCheckForm':
For 'PokeBattle_Move' script:
Paste above 'def successCheckPerHit?'
In 'PokeBattle_Battle' script:
Look for '@usepriority = false' and paste below '@dancerpriority = []' and '@dancerusepriority = false':
Above 'def pbCanSwitchLax?(idxPokemon,pkmnidxTo,showMessages)' paste a new def, 'def pbDancerPriority':
Now, we need add two new codes, 'lastMoveFailed', 'lastMoveStolen':
In 'PokeBattle_Battler' add new attrs:
Below '@lastMoveUsed = -1', add:
Then, inside both 'if i.effects[PBEffects::Snatch]', add below '@battle.lastMoveStolen=true';
Below 'if target.effects[PBEffects::MagicCoat]' add '@battle.lastMoveStolen=true';
Below 'elsif !user.hasMoldBreaker && target.hasWorkingAbility(:MAGICBOUNCE)' add '@battle.lastMoveStolen=true';
Now, 'def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true)' add:
Replace 'return if numhits>1 && target.damagestate.calcdamage<=0':
Below 'if !pbTryUseMove(choice,thismove,turneffects)', add 'self.lastMoveFailed=thismove.id';
Below '@battle.pbDisplay(_INTL("But there was no PP left for the move!"))' add 'self.lastMoveFailed=thismove.id';
Inside 'when -1 # Was hurt while readying Focus Punch, fails use', below 'self.lastMoveUsedType=thismove.pbType(thismove.type,self,nil)', add 'self.lastMoveFailed=thismove.id';
Below 'if !thismove.pbOnStartUse(user) # Selfdestruct, Natural Gift, Beat Up can return false here', add 'user.lastMoveFailed=thismove.id';
Below '@battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!"))', add 'user.lastMoveFailed=thismove.id';
Below '@battle.pbDisplay(_INTL("The Water-type attack evaporated in the harsh sunlight!"))', add 'user.lastMoveFailed=thismove.id';
Inside Powder's code, add 'user.lastMoveFailed=thismove.id' below 'user.pbReduceHP(1+(user.totalhp/4).floor) if !user.hasWorkingAbility(:MAGICGUARD)';
Above 'battle.pbDisplay(_INTL("But there was no target..."))' add 'user.lastMoveFailed=thismove.id';
Replace:
To:
Inside 'def pbEndTurn(choice)', above '@battle.pbPrimordialWeather' add '@battle.lastMoveStolen=false';
For 'PokeBattle_Move' script:
In 'def pbTypeModMessages(type,attacker,opponent)', replace for:
Now, 'PokeBattle_Battle' script:
Add 'attr_accessor(:lastMoveFailed)' and 'attr_accessor(:lastMoveStolen)'
Then below '@lastMoveUser = -1' add '@lastMoveFailed = 0' and '@lastMoveStolen = false'
And done guys! Was too hard to script it, so you shall give credits to me if used. xD
Cya!
Code:
Yawn = 108
Dancer = 109
In 'PokeBattle_Battler' script:
Spoiler:
'def pbInitEffects(batonpass)', paste the effect:
Code:
@effects[PBEffects::Yawn] = 0
@effects[PBEffects::Dancer] = false
end
Then, 'def pbUseMoveSimple(moveid,index=-1,target=-1)', replace fot:
Code:
def pbUseMoveSimple(moveid,index=-1,target=-1)
choice=[]
choice[0]=1 # "Use move"
choice[1]=index # Index of move to be used in user's moveset
choice[2]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(moveid)) # PokeBattle_Move object of the move
choice[2].pp=-1
choice[3]=target # Target (-1 means no target yet)
if index>=0
@battle.choices[@index][1]=index
end
PBDebug.log("#{pbThis} used simple move #{choice[2].name}")
if self.effects[PBEffects::Dancer]
pbUseMove(choice,false)
else
pbUseMove(choice,true)
end
return
end
Now, paste above '# End of move usage':
Spoiler:
Code:
# Dancer
if thismove.isDanceMove? && !user.effects[PBEffects::Dancer] && user.lastMoveFailed<=0
[email protected][user.index][3]; opptarget=user.index
user.pbFaint if user.fainted?
user.effects[PBEffects::Dancer]=true if !user.fainted?
dancers=[]
for i in @battle.pbDancerPriority #pbPriority
dancers.push(i) if i.hasWorkingAbility(:DANCER) && !i.effects[PBEffects::Dancer] && !i.fainted?
end
for i in dancers
i.effects[PBEffects::Dancer]=true
current=i.effects[PBEffects::Outrage]
movedAlready=i.lastRoundMoved
@battle.pbDisplay(_INTL("{1} is also dances!",i.pbThis))
PBDebug.log("[Ability triggered]#{i.pbThis} copied move #{thismove.name}")
if i.effects[PBEffects::Confusion]>0
i.damagestate.reset; confmove=PokeBattle_Confusion.new(@battle,nil); confmove.pbEffect(i,i)
if i.fainted?; i.pbFaint
else; @battle.pbDisplay(_INTL("It hurt itself in its confusion!"))
end
elsif i.effects[PBEffects::Flinch]
i.effects[PBEffects::Flinch]=false
@battle.pbDisplay(_INTL("{1} flinched and couldn't move!",i.pbThis))
PBDebug.log("[Lingering effect triggered] #{i.pbThis} flinched")
elsif ((i.effects[PBEffects::Taunt]>0 && thismove.basedamage==0) ||
(i.effects[PBEffects::ChoiceBand]>=0 && (i.hasWorkingItem(:CHOICEBAND) ||
i.hasWorkingItem(:CHOICESPECS) ||
i.hasWorkingItem(:CHOICESCARF)) &&
i.effects[PBEffects::ChoiceBand][email protected]) ||
(i.effects[PBEffects::Encore]>0 && i.effects[PBEffects::EncoreMove][email protected]) ||
(i.effects[PBEffects::Outrage]>0 && [email protected]))
@battle.pbDisplay(_INTL("But it failed!"))
else
if i.status==PBStatuses::SLEEP
i.statusCount-=1
@battle.pbCommonAnimation("Sleep",i,nil)
@battle.pbDisplay(_INTL("{1} is fast asleep.",i.pbThis))
else
target=(pbIsOpposing?(i.index)) ? opptarget : usertarget
i.pbUseMoveSimple(@battle.lastMoveUsed,-1,target)
end
end
i.lastRoundMoved=movedAlready
i.effects[PBEffects::Outrage]=current
i.pbFaint if i.fainted?
end
end
# Gain Exp
@battle.pbGainEXP
# Battle Arena only - update skills
for i in 0...4
@battle.successStates[i].updateSkill
end
# End of move usage FOR REFERENCE
# pbEndTurn(choice)
# @battle.pbJudge # @battle.pbSwitch
# return
# end
Inside 'def pbEndTurn(choice)', paste below '@battle.battlers.pbCheckForm':
Code:
for i in 0...4
@battle.battlers[i].pbCheckForm
@battle.battlers[i].effects[PBEffects::Dancer]=false
end
end
For 'PokeBattle_Move' script:
Spoiler:
Paste above 'def successCheckPerHit?'
Code:
def isDanceMove?
return isConst?(@id,PBMoves,:QUIVERDANCE) ||
isConst?(@id,PBMoves,:DRAGONDANCE) ||
isConst?(@id,PBMoves,:FIERYDANCE) ||
isConst?(@id,PBMoves,:FEATHERDANCE) ||
isConst?(@id,PBMoves,:PETALDANCE) ||
isConst?(@id,PBMoves,:SWORDSDANCE) ||
isConst?(@id,PBMoves,:TEETERDANCE) ||
isConst?(@id,PBMoves,:LUNARDANCE) ||
isConst?(@id,PBMoves,:REVELATIONDANCE)
end
def successCheckPerHit?
return false
end
In 'PokeBattle_Battle' script:
Spoiler:
Look for '@usepriority = false' and paste below '@dancerpriority = []' and '@dancerusepriority = false':
Code:
@usepriority = false
@dancerpriority = []
@dancerusepriority = false
@snaggedpokemon = []
@runCommand = 0
Above 'def pbCanSwitchLax?(idxPokemon,pkmnidxTo,showMessages)' paste a new def, 'def pbDancerPriority':
Spoiler:
Code:
################################################################################
# Priority for Dancer Ability.
################################################################################
def pbDancerPriority
return @dancerpriority if @usedancerpriority # use stored priority if round isn't over yet
@dancerpriority.clear
speeds=[]
priorities=[]
minpri=0; maxpri=0
temp=[]
# Calculate each Pokémon's speed
for i in 0...4
speeds[i]=@battlers[i].pbSpeed
end
# Calculate each Pokémon's priority bracket, and get the min/max priorities
for i in 0...4
# Assume that doing something other than using a move is priority 0
pri=0
if @choices[i][0]==1 # Chose to use a move
pri=@choices[i][2].priority
end
priorities[i]=pri
if i==0
minpri=pri
maxpri=pri
else
minpri=pri if minpri>pri
maxpri=pri if maxpri<pri
end
end
# Find and order all moves with the same priority
curpri=maxpri
loop do
temp.clear
for j in 0...4
temp.push(j) if priorities[j]==curpri
end
# Sort by speed
if temp.length==1
@dancerpriority[@dancerpriority.length]=@battlers[temp[0]]
elsif temp.length>1
n=temp.length
for m in 0...temp.length-1
for i in 1...temp.length
# For each pair of battlers, rank the second compared to the first
# -1 means rank higher, 0 means rank equal, 1 means rank lower
cmp=0
if speeds[temp[i]]!=speeds[temp[i-1]]
cmp=(speeds[temp[i]]>speeds[temp[i-1]]) ? 1 : -1
end
if cmp<0 || # Swap the pair according to the second battler's rank
(cmp==0 && pbRandom(2)==0)
swaptmp=temp[i]
temp[i]=temp[i-1]
temp[i-1]=swaptmp
end
end
end
# Battlers in this bracket are properly sorted, so add them to @priority
for i in temp
@dancerpriority[@dancerpriority.length]=@battlers[i]
end
end
curpri-=1
break if curpri<minpri
end
@usedancerpriority=true
return @dancerpriority
end
Now, we need add two new codes, 'lastMoveFailed', 'lastMoveStolen':
Spoiler:
In 'PokeBattle_Battler' add new attrs:
Code:
attr_accessor :lastMoveUsed
attr_accessor :lastMoveFailed
attr_accessor :lastMoveStolen
attr_accessor :lastMoveUsedType
Below '@lastMoveUsed = -1', add:
Code:
@lastMoveUsed = -1
@lastMoveFailed = 0
@lastMoveStolen = false
@lastMoveUsedType = -1
Then, inside both 'if i.effects[PBEffects::Snatch]', add below '@battle.lastMoveStolen=true';
Below 'if target.effects[PBEffects::MagicCoat]' add '@battle.lastMoveStolen=true';
Below 'elsif !user.hasMoldBreaker && target.hasWorkingAbility(:MAGICBOUNCE)' add '@battle.lastMoveStolen=true';
Now, 'def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true)' add:
Code:
user.effects[PBEffects::Outrage]=0 if thismove.function==0xD2 # Outrage
user.effects[PBEffects::Rollout]=0 if thismove.function==0xD3 # Rollout
user.effects[PBEffects::FuryCutter]=0 if thismove.function==0x91 # Fury Cutter
user.effects[PBEffects::Stockpile]=0 if thismove.function==0x113 # Spit Up
user.lastMoveFailed=thismove.id
return
end
Replace 'return if numhits>1 && target.damagestate.calcdamage<=0':
Code:
if numhits>1 && target.damagestate.calcdamage<=0
user.lastMoveFailed=thismove.id
return
end
@battle.pbJudgeCheckpoint(user,thismove)
Below 'if !pbTryUseMove(choice,thismove,turneffects)', add 'self.lastMoveFailed=thismove.id';
Below '@battle.pbDisplay(_INTL("But there was no PP left for the move!"))' add 'self.lastMoveFailed=thismove.id';
Inside 'when -1 # Was hurt while readying Focus Punch, fails use', below 'self.lastMoveUsedType=thismove.pbType(thismove.type,self,nil)', add 'self.lastMoveFailed=thismove.id';
Below 'if !thismove.pbOnStartUse(user) # Selfdestruct, Natural Gift, Beat Up can return false here', add 'user.lastMoveFailed=thismove.id';
Below '@battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!"))', add 'user.lastMoveFailed=thismove.id';
Below '@battle.pbDisplay(_INTL("The Water-type attack evaporated in the harsh sunlight!"))', add 'user.lastMoveFailed=thismove.id';
Inside Powder's code, add 'user.lastMoveFailed=thismove.id' below 'user.pbReduceHP(1+(user.totalhp/4).floor) if !user.hasWorkingAbility(:MAGICGUARD)';
Above 'battle.pbDisplay(_INTL("But there was no target..."))' add 'user.lastMoveFailed=thismove.id';
Replace:
Code:
PBDebug.logonerr{
thismove.pbEffect(user,nil)
}
To:
Code:
PBDebug.logonerr{
check=thismove.pbEffect(user,nil)
if check==-1
user.lastMoveFailed=thismove.id
end
}
Inside 'def pbEndTurn(choice)', above '@battle.pbPrimordialWeather' add '@battle.lastMoveStolen=false';
For 'PokeBattle_Move' script:
Spoiler:
In 'def pbTypeModMessages(type,attacker,opponent)', replace for:
Code:
def pbTypeModMessages(type,attacker,opponent)
return 8 if type<0
typemod=pbTypeModifier(type,attacker,opponent)
if typemod==0
@battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
else
if pbTypeImmunityByAbility(type,attacker,opponent)
attacker.lastMoveFailed=@id
return 0
end
end
return typemod
end
Now, 'PokeBattle_Battle' script:
Spoiler:
Add 'attr_accessor(:lastMoveFailed)' and 'attr_accessor(:lastMoveStolen)'
Code:
attr_accessor(:lastMoveUsed) # Last move used
attr_accessor(:lastMoveUser) # Last move user
attr_accessor(:lastMoveFailed) # Last move used was failed
attr_accessor(:lastMoveStolen) # Last move used was stolen
attr_accessor(:megaEvolution) # Battle index of each trainer's Pokémon to Mega Evolve
attr_accessor(:amuletcoin) # Whether Amulet Coin's effect applies
Then below '@lastMoveUser = -1' add '@lastMoveFailed = 0' and '@lastMoveStolen = false'
And done guys! Was too hard to script it, so you shall give credits to me if used. xD
Cya!
Last edited: