Ego13
hollow_ego
- 311
- Posts
- 7
- Years
- Larua Region
- Seen Mar 24, 2023
As requested by WolfPP i took his work of the Dancer Ability and modified/improved/cleaned it up.
Most credits go to him, as he did most of the work (even if that itself is based on my first Dancer Script)
This script lets the slowest dancer move first and doesn't trigger on snatched or bounced dancer moves.
I did not test all situations, so if the script behaves wrong, let me know.
So here is how to implement it
In PBEffects add the following effects ("XXX" will be your last number):
In PokeBattle_Battler, inside def pbInitEffects(batonpass) add below @effects[PBEffects::Yawn]=0:
Inside def pbUseMoveSimple(moveid,index=-1,target=-1) replace pbUseMove(choice,true) for:
Below # Record that user has used a move this round (ot at least tried to), replace [email protected] for:
Look for # Record move as having been used and then add @effects[PBEffects::DancerUser]=user.index below @battle.lastMoveUser=user.index:
And below # End of move usage, paste (you need to check the ID number if need to change or not):
Then, in def pbBeginTurn(choice), below @effects[PBEffects::Grudge]=false, paste:
Replace def pbChangeUser(thismove,user) with:
Find and change if thismove.canMagicCoat? to
In PokeBattle_BattlerEffects In def pbConfuse, add @effects[PBEffects::DancerConfused]=true:
Now, in PokeBattle_Battle beforte # Switching Pokémon. add:
Most credits go to him, as he did most of the work (even if that itself is based on my first Dancer Script)
This script lets the slowest dancer move first and doesn't trigger on snatched or bounced dancer moves.
I did not test all situations, so if the script behaves wrong, let me know.
So here is how to implement it
In PBEffects add the following effects ("XXX" will be your last number):
Spoiler:
Code:
Snatched = XXX
Dancer = XXX
Bounced = XXX
DancerConfused = XXX
DancerUser = XXX
In PokeBattle_Battler, inside def pbInitEffects(batonpass) add below @effects[PBEffects::Yawn]=0:
Spoiler:
Code:
@effects[PBEffects::Snatched] = false
@effects[PBEffects::Dancer] = false
@effects[PBEffects::Bounced] = false
@effects[PBEffects::DancerConfused] = false
@effects[PBEffects::DancerUser] = 0
Inside def pbUseMoveSimple(moveid,index=-1,target=-1) replace pbUseMove(choice,true) for:
Spoiler:
Code:
# Dancer Modification
pbUseMove(choice,true) if $dancercount!=1
pbUseMove(choice,false) if $dancercount==1
Below # Record that user has used a move this round (ot at least tried to), replace [email protected] for:
Spoiler:
Code:
# Dancer Modification
if self.effects[PBEffects::Dancer] && $dancercount==1
$dancercount=0
else
[email protected]
end
Look for # Record move as having been used and then add @effects[PBEffects::DancerUser]=user.index below @battle.lastMoveUser=user.index:
Spoiler:
Code:
@battle.lastMoveUsed=thismove.id
@battle.lastMoveUser=user.index
@effects[PBEffects::DancerUser]=user.index
And below # End of move usage, paste (you need to check the ID number if need to change or not):
Spoiler:
Code:
# Dancer
if !user.effects[PBEffects::Dancer]
[email protected][user.index][3]
opptarget=@effects[PBEffects::DancerUser]
nodance=false
if thismove.function==0x02B # Quiver Dance
if user.stages[PBStats::SPATK]==6 && user.stages[PBStats::SPDEF]==6 && user.stages[PBStats::SPEED]==6
nodance=true
end
elsif thismove.function==0x026 # Dragon Dance
if user.stages[PBStats::ATTACK]==6 && user.stages[PBStats::SPEED]==6; nodance=true; end
elsif thismove.function==0x04B # Feather Dance
if user.stages[PBStats::ATTACK]==-6; nodance=true; end
elsif thismove.function==0x02E # Swords Dance
if user.stages[PBStats::ATTACK]==6; nodance=true; end
end
for i in @battle.battlers
if thismove.function==0x13 && i!=user && i.effects[PBEffects::Confusion]>0 # Teeter Dance
nodance=true if !i.effects[PBEffects::DancerConfused]
end
if thismove.function==0x0E4 # Lunar Dance
i.pbFaint if i.fainted?
end
end
if !nodance
dancermoves=[17,63,138,170,192,418,420,483,651]; dancers=[]
user.effects[PBEffects::Dancer]=true if dancermoves.include?(@battle.lastMoveUsed)
for i in @battle.pbDancerPriority
dancers.push(i) if i.hasWorkingAbility(:DANCER) && !i.effects[PBEffects::Dancer]
end
for i in dancers
if dancermoves.include?(@battle.lastMoveUsed) && !i.isFainted?
dance = !( @effects[PBEffects::Snatched] || @effects[PBEffects::Bounced] || (thismove.basedamage>0 && turneffects[PBEffects::TotalDamage]==0))
if dance
@battle.pbDisplay(_INTL("#{i.pbThis} joined the dance!"))
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::Taunt]>0 && thismove.basedamage==0
@battle.pbDisplay(_INTL("But it failed!"))
elsif i.effects[PBEffects::ChoiceBand]>=0 && (i.hasWorkingItem(:CHOICEBAND) ||
i.hasWorkingItem(:CHOICESPECS) ||
i.hasWorkingItem(:CHOICESCARF)) &&
i.effects[PBEffects::ChoiceBand][email protected]
@battle.pbDisplay(_INTL("But it failed!"))
elsif i.effects[PBEffects::Encore]>0 && i.effects[PBEffects::EncoreMove][email protected]
@battle.pbDisplay(_INTL("But it failed!"))
elsif 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
petaldanceturn=i.effects[PBEffects::Outrage]
$dancercount=1
i.effects[PBEffects::Dancer]=true
target=(pbIsOpposing?(i.index)) ? @battle.lastMoveUser : usertarget
i.pbUseMoveSimple(@battle.lastMoveUsed,-1,target)
i.effects[PBEffects::Outrage]=petaldanceturn
end
end
end
for i in dancers
i.pbFaint if i.fainted?
i.effects[PBEffects::Dancer]=false
i.effects[PBEffects::DancerConfused]=false
end
user.effects[PBEffects::Dancer]=false
end
end
end
end
Then, in def pbBeginTurn(choice), below @effects[PBEffects::Grudge]=false, paste:
Spoiler:
Code:
# Reset Dancer
@effects[PBEffects::Snatched]=false
@effects[PBEffects::Bounced]=false
@effects[PBEffects::DancerUser]=0
Replace def pbChangeUser(thismove,user) with:
Spoiler:
Code:
def pbChangeUser(thismove,user)
# Change user to user of Snatch
if thismove.canSnatch?
[email protected]
for i in priority
if i.effects[PBEffects::Snatch]
@battle.pbDisplay(_INTL("{1} snatched {2}'s move!",i.pbThis,user.pbThis(true)))
PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Snatch made it use #{user.pbThis(true)}'s #{thismove.name}")
i.effects[PBEffects::Snatch]=false
@effects[PBEffects::Snatched]=true
target=user
user=i
# Snatch's PP is reduced if old user has Pressure
[email protected][user.index][1]
if target.hasWorkingAbility(:PRESSURE) && user.pbIsOpposing?(target.index) && userchoice>=0
pressuremove=user.moves[userchoice]
pbSetPP(pressuremove,pressuremove.pp-1) if pressuremove.pp>0
end
break if USENEWBATTLEMECHANICS
end
end
end
return user
end
Find and change if thismove.canMagicCoat? to
Spoiler:
Code:
if thismove.canMagicCoat?
if target.effects[PBEffects::MagicCoat]
# switch user and target
PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Magic Coat made it use #{user.pbThis(true)}'s #{thismove.name}")
@effects[PBEffects::Bounced]=true
changeeffect=3; tmp=user; user=target; target=tmp
# Magic Coat's PP is reduced if old user has Pressure
[email protected][user.index][1]
if target.hasWorkingAbility(:PRESSURE) && user.pbIsOpposing?(target.index) && userchoice>=0
PBDebug.log("[Ability triggered] #{target.pbThis}'s Pressure (part of Magic Coat)")
pressuremove=user.moves[userchoice]
pbSetPP(pressuremove,pressuremove.pp-1) if pressuremove.pp>0
end
elsif !user.hasMoldBreaker && target.hasWorkingAbility(:MAGICBOUNCE)
# switch user and target
@effects[PBEffects::Bounced]=true
PBDebug.log("[Ability triggered] #{target.pbThis}'s Magic Bounce made it use #{user.pbThis(true)}'s #{thismove.name}")
changeeffect=4 # was 3
tmp=user; user=target; target=tmp
end
end
In PokeBattle_BattlerEffects In def pbConfuse, add @effects[PBEffects::DancerConfused]=true:
Spoiler:
Code:
def pbConfuse
@effects[PBEffects::Confusion][email protected](4)
@effects[PBEffects::DancerConfused]=true
@battle.pbCommonAnimation("Confusion",self,nil)
PBDebug.log("[Lingering effect triggered] #{pbThis} became confused (#{@effects[PBEffects::Confusion]} turns)")
end
Now, in PokeBattle_Battle beforte # Switching Pokémon. add:
Spoiler:
Code:
################################################################################
# Priority for Dancer Ability.
################################################################################
def pbDancerPriority
dancerPriority = []
speeds=[]
speedSorted=[]
# Calculate each Pokémon's speed
for i in 0...4
speeds[i]=@battlers[i].pbSpeed(true)
end
speedSorted=speeds.sort
for i in speedSorted.reverse
dancerPriority.push(@battlers[speeds.index(i)])
end
return dancerPriority
end