Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pbSwitch(favorDraws=false)
- if !favorDraws
- return if @decision>0
- else
- return if @decision==5
- end
- pbJudge()
- return if @decision>0
- firstbattlerhp=@battlers[0].hp
- switched=[]
- loop do # SAGE ADDED
- for index in 0...4
- next if !@doublebattle && pbIsDoubleBattler?(index)
- next if @battlers[index] && !@battlers[index].isFainted?
- next if !pbCanChooseNonActive?(index)
- if !pbOwnedByPlayer?(index)
- if !pbIsOpposing?(index) || (@opponent && pbIsOpposing?(index))
- newenemy=pbSwitchInBetween(index,false,false)
- newenemyname=newenemy
- if newenemy>=0 && isConst?(pbParty(index)[newenemy].ability,PBAbilities,:ILLUSION)
- newenemyname=pbGetLastPokeInTeam(index)
- end
- opponent=pbGetOwner(index)
- if !@doublebattle && firstbattlerhp>0 && @shiftStyle && @opponent &&
- @internalbattle && pbCanChooseNonActive?(0) && pbIsOpposing?(index) &&
- @battlers[0].effects[PBEffects::Outrage]==0
- pbDisplayPaused(_INTL("{1} is about to send in {2}.",opponent.fullname,pbParty(index)[newenemyname].name))
- if pbDisplayConfirm(_INTL("Will {1} change Pokémon?",self.pbPlayer.name))
- newpoke=pbSwitchPlayer(0,true,true)
- if newpoke>=0
- newpokename=newpoke
- if isConst?(@party1[newpoke].ability,PBAbilities,:ILLUSION)
- newpokename=pbGetLastPokeInTeam(0)
- end
- pbDisplayBrief(_INTL("{1}, that's enough! Come back!",@battlers[0].name))
- pbRecallAndReplace(0,newpoke,newpokename)
- switched.push(0)
- end
- end
- end
- pbRecallAndReplace(index,newenemy,newenemyname,false,false)
- switched.push(index)
- end
- elsif @opponent
- newpoke=pbSwitchInBetween(index,true,false)
- newpokename=newpoke
- if isConst?(@party1[newpoke].ability,PBAbilities,:ILLUSION)
- newpokename=pbGetLastPokeInTeam(index)
- end
- pbRecallAndReplace(index,newpoke,newpokename)
- switched.push(index)
- else
- switch=false
- if !pbDisplayConfirm(_INTL("Use next Pokémon?"))
- switch=(pbRun(index,true)<=0)
- else
- switch=true
- end
- if switch
- newpoke=pbSwitchInBetween(index,true,false)
- newpokename=newpoke
- if isConst?(@party1[newpoke].ability,PBAbilities,:ILLUSION)
- newpokename=pbGetLastPokeInTeam(index)
- end
- pbRecallAndReplace(index,newpoke,newpokename)
- switched.push(index)
- end
- end
- end
- if switched.length>0
- priority=pbPriority
- for i in priority
- i.pbAbilitiesOnSwitchIn(true) if switched.include?(i.index)
- end
- else # SAGE ADDED
- break # SAGE ADDED
- end
- end # SAGE ADDED
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement