Revamped classes Pokemon, PBMove and PokemonMail

This commit is contained in:
Maruno17
2021-01-21 23:04:51 +00:00
parent 94ce80c183
commit 8a89ef1220
40 changed files with 1016 additions and 1038 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
}

View File

@@ -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