Implemented usage of GameData::Item

This commit is contained in:
Maruno17
2020-11-08 22:45:59 +00:00
parent ff70791104
commit 1955d3698e
82 changed files with 1986 additions and 2195 deletions

View File

@@ -192,7 +192,7 @@ def pbDayCareGenerateEgg
father = pokemon0
end
# Determine the egg's species
babyspecies = pbGetBabySpecies(babyspecies,mother.item,father.item)
babyspecies = pbGetBabySpecies(babyspecies,true,mother.item_id,father.item_id)
if isConst?(babyspecies,PBSpecies,:MANAPHY) && hasConst?(PBSpecies,:PHIONE)
babyspecies = getConst(PBSpecies,:PHIONE)
elsif (isConst?(babyspecies,PBSpecies,:NIDORANfE) && hasConst?(PBSpecies,:NIDORANmA)) ||
@@ -233,7 +233,7 @@ def pbDayCareGenerateEgg
isConst?(babyspecies,PBSpecies,:GRIMER)
if mother.form==1
egg.form = 1 if mother.hasItem?(:EVERSTONE)
elsif pbGetBabySpecies(father.species,mother.item,father.item)==babyspecies
elsif pbGetBabySpecies(father.species,true,mother.item_id,father.item_id)==babyspecies
egg.form = 1 if father.form==1 && father.hasItem?(:EVERSTONE)
end
end
@@ -260,11 +260,9 @@ def pbDayCareGenerateEgg
end
# Inheriting Machine Moves
if !NEWEST_BATTLE_MECHANICS
itemsData = pbLoadItemsData
for i in 0...itemsData.length
next if !itemsData[i]
atk = itemsData[i][ItemData::MOVE]
next if !atk || atk==0
GameData::Item.each do |i|
atk = i.move
next if !atk
next if !egg.compatibleWithMove?(atk)
next if !movefather.hasMove?(atk)
moves.push(atk)
@@ -351,7 +349,7 @@ def pbDayCareGenerateEgg
# Masuda method and Shiny Charm
shinyretries = 0
shinyretries += 5 if father.owner.language != mother.owner.language
shinyretries += 2 if hasConst?(PBItems,:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
shinyretries += 2 if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
if shinyretries>0
shinyretries.times do
break if egg.shiny?
@@ -377,8 +375,7 @@ def pbDayCareGenerateEgg
end
# Inheriting Poké Ball from the mother
if mother.female? &&
!isConst?(pbBallTypeToItem(mother.ballused),PBItems,:MASTERBALL) &&
!isConst?(pbBallTypeToItem(mother.ballused),PBItems,:CHERISHBALL)
![:MASTERBALL, :CHERISHBALL].include?(pbBallTypeToItem(mother.ballused).id)
egg.ballused = mother.ballused
end
# Set all stats
@@ -417,7 +414,7 @@ Events.onStepTaken += proc { |_sender,_e|
if $PokemonGlobal.daycareEggSteps==256
$PokemonGlobal.daycareEggSteps = 0
compatval = [0,20,50,70][pbDayCareGetCompat]
if hasConst?(PBItems,:OVALCHARM) && $PokemonBag.pbHasItem?(:OVALCHARM)
if GameData::Item.exists?(:OVALCHARM) && $PokemonBag.pbHasItem?(:OVALCHARM)
compatval = [0,40,80,88][pbDayCareGetCompat]
end
$PokemonGlobal.daycareEgg = 1 if rand(100)<compatval # Egg is generated