mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
Revamped classes Pokemon, PBMove and PokemonMail
This commit is contained in:
@@ -686,17 +686,16 @@ def pbPickup(pkmn)
|
||||
chances.each_with_index do |c,i|
|
||||
cumul += c
|
||||
next if rnd>=cumul
|
||||
pkmn.setItem(items[i])
|
||||
pkmn.item = items[i]
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
# Try to gain a Honey item after a battle if a Pokemon has the ability Honey Gather.
|
||||
def pbHoneyGather(pkmn)
|
||||
return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER)
|
||||
return if pkmn.hasItem?
|
||||
return if !GameData::Item.exists?(:HONEY)
|
||||
chance = 5+((pkmn.level-1)/10)*5
|
||||
return unless rand(100)<chance
|
||||
pkmn.setItem(:HONEY)
|
||||
return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER) || pkmn.hasItem?
|
||||
chance = 5 + ((pkmn.level - 1) / 10) * 5
|
||||
return unless rand(100) < chance
|
||||
pkmn.item = :HONEY
|
||||
end
|
||||
|
||||
@@ -405,11 +405,11 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||
chances = [60,20,5] if firstPkmn && firstPkmn.hasAbility?(:COMPOUNDEYES)
|
||||
itemrnd = rand(100)
|
||||
if (items[0]==items[1] && items[1]==items[2]) || itemrnd<chances[0]
|
||||
genwildpoke.setItem(items[0])
|
||||
genwildpoke.item = items[0]
|
||||
elsif itemrnd<(chances[0]+chances[1])
|
||||
genwildpoke.setItem(items[1])
|
||||
genwildpoke.item = items[1]
|
||||
elsif itemrnd<(chances[0]+chances[1]+chances[2])
|
||||
genwildpoke.setItem(items[2])
|
||||
genwildpoke.item = items[2]
|
||||
end
|
||||
# Shiny Charm makes shiny Pokémon more likely to generate
|
||||
if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
|
||||
@@ -432,7 +432,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||
(rand(3)<2) ? genwildpoke.makeMale : genwildpoke.makeFemale
|
||||
end
|
||||
elsif firstPkmn.hasAbility?(:SYNCHRONIZE)
|
||||
genwildpoke.setNature(firstPkmn.nature) if !isRoamer && rand(100)<50
|
||||
genwildpoke.nature = firstPkmn.nature if !isRoamer && rand(100)<50
|
||||
end
|
||||
end
|
||||
# Trigger events that may alter the generated Pokémon further
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
pokemon = e[0]
|
||||
if $game_switches[SHINY_WILD_POKEMON_SWITCH]
|
||||
pokemon.makeShiny
|
||||
pokemon.shiny = true
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ def pbDayCareGenerateEgg
|
||||
first_move_index = 0 if first_move_index < 0
|
||||
finalmoves = []
|
||||
for i in first_move_index...moves.length
|
||||
finalmoves.push(PBMove.new(moves[i]))
|
||||
finalmoves.push(Pokemon::Move.new(moves[i]))
|
||||
end
|
||||
# Inheriting Individual Values
|
||||
ivs = []
|
||||
@@ -311,7 +311,7 @@ def pbDayCareGenerateEgg
|
||||
new_natures.push(father.nature) if father.hasItem?(:EVERSTONE)
|
||||
if new_natures.length > 0
|
||||
new_nature = (new_natures.length == 1) ? new_natures[0] : new_natures[rand(new_natures.length)]
|
||||
egg.setNature(new_nature)
|
||||
egg.nature = new_nature
|
||||
end
|
||||
# Masuda method and Shiny Charm
|
||||
shinyretries = 0
|
||||
@@ -327,12 +327,12 @@ def pbDayCareGenerateEgg
|
||||
if !ditto0 || !ditto1
|
||||
parent = (ditto0) ? father : mother # The non-Ditto
|
||||
if parent.hasHiddenAbility?
|
||||
egg.setAbility(parent.abilityIndex) if rand(100) < 60
|
||||
egg.ability_index = parent.ability_index if rand(100) < 60
|
||||
elsif !ditto0 && !ditto1
|
||||
if rand(100) < 80
|
||||
egg.setAbility(mother.abilityIndex)
|
||||
egg.ability_index = mother.ability_index
|
||||
else
|
||||
egg.setAbility((mother.abilityIndex + 1) % 2)
|
||||
egg.ability_index = (mother.ability_index + 1) % 2
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -390,7 +390,7 @@ Events.onStepTaken += proc { |_sender,_e|
|
||||
for i in 0...2
|
||||
pkmn = $PokemonGlobal.daycare[i][0]
|
||||
next if !pkmn
|
||||
maxexp = PBExperience.pbGetMaxExperience(pkmn.growthrate)
|
||||
maxexp = PBExperience.pbGetMaxExperience(pkmn.growth_rate)
|
||||
next if pkmn.exp>=maxexp
|
||||
oldlevel = pkmn.level
|
||||
pkmn.exp += 1 # Gain Exp
|
||||
|
||||
Reference in New Issue
Block a user