Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EncounterModifier.register(proc {|encounter|
- return nil if !encounter
- difficulty= LevelBalance::calcDifficulty
- badges = $Trainer.numbadges
- balance = pbBalancedLevel($Trainer.party)
- mlv=0
- for poke in $Trainer.pokemonParty
- mlv=poke.level if poke.level>mlv
- end
- case difficulty
- when 0 #Light
- l = balance/3 - 2 + rand(5)
- when 1 #Easy
- l = 2*balance/3 - 4 + rand(8)
- when 2 #Medium
- l = 3*(balance + 4*mlv)/20 - 4 + rand(8)
- when 3 #Hard
- l = 4*(balance + 4*mlv)/25 - 2 + rand(8)
- when 4 #Insane
- l = (balance + 4*mlv)/6 - 4 + rand(4+balance/10)
- else #Extreme
- l = 9*(balance + 4*mlv)/50 - 4 + rand(4+balance/10)
- end
- newlevel=l
- newlevel=1 if newlevel<1
- newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
- #now we evolve the pokémon, if applicable
- species = encounter[0]
- newspecies = pbGetBabySpecies(species) # revert to the first evolution
- evoflag=0 #used to track multiple evos not done by lvl
- endevo=false
- loop do #beginning of loop to evolve species
- nl = newlevel + 5
- nl = MAXIMUMLEVEL if nl > MAXIMUMLEVEL
- pkmn = PokeBattle_Pokemon.new(newspecies, nl)
- cevo = Kernel.pbCheckEvolution(pkmn)
- evo = pbGetEvolvedFormData(newspecies)
- if evo
- evo = evo[rand(evo.length - 1)]
- # here we evolve things that don't evolve through level
- # that's what we check with evo[0]!=4
- #notice that such species have cevo==-1 and wouldn't pass the last check
- #to avoid it we set evoflag to 1 (with some randomness) so that
- #pokemon may have its second evolution (Raichu, for example)
- if evo && cevo < 1 && rand(50) <= newlevel
- if evo[0] != 4 && rand(50) <= newlevel
- newspecies = evo[2]
- if evoflag == 0 && rand(50) <= newlevel
- evoflag=1
- else
- evoflag=0
- end
- end
- else
- endevo=true
- end
- end
- if evoflag==0 || endevo
- if cevo == -1 || rand(50) > newlevel
- # Breaks if there no more evolutions or randomnly
- # Randomness applies only if the level is under 50
- break
- else
- newspecies = evo[2]
- end
- end
- end
- #fixing some things such as Bellossom would turn into Vileplume
- #check if original species could evolve (Bellosom couldn't)
- couldevo=pbGetEvolvedFormData(species)
- #check if current species can evolve
- evo = pbGetEvolvedFormData(newspecies)
- if evo.length<1 && couldevo.length<1
- else
- species=newspecies
- end
- return [species,newlevel]
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement