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

@@ -325,7 +325,7 @@ Events.onStepTakenFieldMovement += proc { |_sender,e|
break
end
end
if sootlevel>=0 && hasConst?(PBItems,:SOOTSACK)
if sootlevel>=0 && GameData::Item.exists?(:SOOTSACK)
$PokemonGlobal.sootsack = 0 if !$PokemonGlobal.sootsack
# map.data[thistile[1],thistile[2],sootlevel]=0
if event==$game_player && $PokemonBag.pbHasItem?(:SOOTSACK)
@@ -1322,16 +1322,17 @@ end
# Picking up an item found on the ground
#===============================================================================
def pbItemBall(item,quantity=1)
item = getID(PBItems,item)
return false if !item || item<=0 || quantity<1
itemname = (quantity>1) ? PBItems.getNamePlural(item) : PBItems.getName(item)
pocket = pbGetPocket(item)
item = GameData::Item.get(item)
return false if !item || quantity<1
itemname = (quantity>1) ? item.name_plural : item.name
pocket = item.pocket
move = item.move
if $PokemonBag.pbStoreItem(item,quantity) # If item can be picked up
meName = (pbIsKeyItem?(item)) ? "Key item get" : "Item get"
if isConst?(item,PBItems,:LEFTOVERS)
meName = (item.is_key_item?) ? "Key item get" : "Item get"
if item == :LEFTOVERS
pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
elsif pbIsMachine?(item) # TM or HM
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,PBMoves.getName(pbGetMachine(item))))
elsif item.is_machine? # TM or HM
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,PBMoves.getName(move)))
elsif quantity>1
pbMessage(_INTL("\\me[{1}]You found {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname))
elsif itemname.starts_with_vowel?
@@ -1344,10 +1345,10 @@ def pbItemBall(item,quantity=1)
return true
end
# Can't add the item
if isConst?(item,PBItems,:LEFTOVERS)
if item == :LEFTOVERS
pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
elsif pbIsMachine?(item) # TM or HM
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(pbGetMachine(item))))
elsif item.is_machine? # TM or HM
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(move)))
elsif quantity>1
pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
elsif itemname.starts_with_vowel?
@@ -1365,15 +1366,16 @@ end
# Being given an item
#===============================================================================
def pbReceiveItem(item,quantity=1)
item = getID(PBItems,item)
return false if !item || item<=0 || quantity<1
itemname = (quantity>1) ? PBItems.getNamePlural(item) : PBItems.getName(item)
pocket = pbGetPocket(item)
meName = (pbIsKeyItem?(item)) ? "Key item get" : "Item get"
if isConst?(item,PBItems,:LEFTOVERS)
item = GameData::Item.get(item)
return false if !item || quantity<1
itemname = (quantity>1) ? item.name_plural : item.name
pocket = item.pocket
move = item.move
meName = (item.is_key_item?) ? "Key item get" : "Item get"
if item == :LEFTOVERS
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
elsif pbIsMachine?(item) # TM or HM
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,PBMoves.getName(pbGetMachine(item))))
elsif item.is_machine? # TM or HM
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]",meName,itemname,PBMoves.getName(move)))
elsif quantity>1
pbMessage(_INTL("\\me[{1}]You obtained {2} \\c[1]{3}\\c[0]!\\wtnp[30]",meName,quantity,itemname))
elsif itemname.starts_with_vowel?

View File

@@ -596,8 +596,7 @@ end
def pbDynamicItemList(*args)
ret = []
for i in 0...args.length
next if !hasConst?(PBItems,args[i])
ret.push(getConst(PBItems,args[i].to_sym))
ret.push(i) if GameData::Item.exists?(args[i])
end
return ret
end
@@ -674,7 +673,7 @@ end
def pbHoneyGather(pkmn)
return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER)
return if pkmn.hasItem?
return if !hasConst?(PBItems,:HONEY)
return if !GameData::Item.exists?(:HONEY)
chance = 5+((pkmn.level-1)/10)*5
return unless rand(100)<chance
pkmn.setItem(:HONEY)

View File

@@ -338,9 +338,10 @@ class PokemonEncounters
end
firstPkmn = $Trainer.firstPokemon
if firstPkmn
if firstPkmn.hasItem?(:CLEANSETAG)
case firstPkmn.item_id
when :CLEANSETAG
encount *= 2.0 / 3
elsif firstPkmn.hasItem?(:PUREINCENSE)
when :PUREINCENSE
encount *= 2.0 / 3
else # Ignore ability effects if an item effect applies
case firstPkmn.ability_id
@@ -411,7 +412,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
genwildpoke.setItem(items[2])
end
# Shiny Charm makes shiny Pokémon more likely to generate
if hasConst?(PBItems,:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
2.times do # 3 times as likely
break if genwildpoke.shiny?
genwildpoke.personalID = rand(65536)|(rand(65536)<<16)

View File

@@ -10,7 +10,7 @@ def pbLoadBerryPlantData
if pbRgssExists?("Data/berry_plants.dat")
$PokemonTemp.berryPlantData = load_data("Data/berry_plants.dat")
else
$PokemonTemp.berryPlantData = []
$PokemonTemp.berryPlantData = {}
end
end
return $PokemonTemp.berryPlantData
@@ -19,7 +19,7 @@ end
def pbGetBerryPlantData(item)
data = pbLoadBerryPlantData
return data[item] if data[item]
return [3,15,2,5] # Hours/stage, drying/hour, min yield, max yield
return [3, 15, 2, 5] # Hours/stage, drying/hour, min yield, max yield
end
alias __berryPlant__pbClearData pbClearData
@@ -77,7 +77,7 @@ class BerryPlantMoistureSprite
def update
return if !@light || !@event
newmoisture=-1
if @event.variable && @event.variable.length>6 && @event.variable[1]>0
if @event.variable && @event.variable.length>6 && @event.variable[1]
# Berry was planted, show moisture patch
newmoisture=(@event.variable[4]>50) ? 2 : (@event.variable[4]>0) ? 1 : 0
end
@@ -153,16 +153,17 @@ class BerryPlantSprite
dryingrate=berryvalues[1]
maxreplants=REPLANTS
ripestages=4
if isConst?(berryData[7],PBItems,:GROWTHMULCH)
timeperstage=(timeperstage*0.75).to_i
dryingrate=(dryingrate*1.5).ceil
elsif isConst?(berryData[7],PBItems,:DAMPMULCH)
timeperstage=(timeperstage*1.25).to_i
dryingrate=(dryingrate*0.5).floor
elsif isConst?(berryData[7],PBItems,:GOOEYMULCH)
maxreplants=(maxreplants*1.5).ceil
elsif isConst?(berryData[7],PBItems,:STABLEMULCH)
ripestages=6
case berryData[7]
when :GROWTHMULCH
timeperstage = (timeperstage * 0.75).to_i
dryingrate = (dryingrate * 1.5).ceil
when :DAMPMULCH
timeperstage = (timeperstage * 1.25).to_i
dryingrate = (dryingrate * 0.5).floor
when :GOOEYMULCH
maxreplants = (maxreplants * 1.5).ceil
when :STABLEMULCH
ripestages = 6
end
# Cycle through all replants since last check
loop do
@@ -281,8 +282,10 @@ class BerryPlantSprite
@event.character_name="berrytreeplanted" # Common to all berries
@event.turn_down
else
filename=sprintf("berrytree%s",getConstantName(PBItems,berryData[1])) rescue nil
filename=sprintf("berrytree%03d",berryData[1]) if !pbResolveBitmap("Graphics/Characters/"+filename)
filename=sprintf("berrytree%s",GameData::Item.get(berryData[1]).id.to_s) rescue nil
if !pbResolveBitmap("Graphics/Characters/"+filename)
filename=sprintf("berrytree%03d",GameData::Item.get(berryData[1]).id_number)
end
if pbResolveBitmap("Graphics/Characters/"+filename)
@event.character_name=filename
case berryData[0]
@@ -310,9 +313,9 @@ def pbBerryPlant
berryData=interp.getVariable
if !berryData
if NEW_BERRY_PLANTS
berryData=[0,0,0,0,0,0,0,0]
berryData=[0,nil,0,0,0,0,0,0]
else
berryData=[0,0,false,0,0,0]
berryData=[0,nil,false,0,0,0]
end
end
# Stop the event turning towards the player
@@ -323,12 +326,7 @@ def pbBerryPlant
when 4; thisEvent.turn_right # X flowering
when 5; thisEvent.turn_up # X berries
end
watering=[]
watering.push(getConst(PBItems,:SPRAYDUCK))
watering.push(getConst(PBItems,:SQUIRTBOTTLE))
watering.push(getConst(PBItems,:WAILMERPAIL))
watering.push(getConst(PBItems,:SPRINKLOTAD))
watering.compact!
watering = [:SPRAYDUCK, :SQUIRTBOTTLE, :WAILMERPAIL, :SPRINKLOTAD]
berry=berryData[1]
case berryData[0]
when 0 # empty
@@ -344,19 +342,19 @@ def pbBerryPlant
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag)
ret = screen.pbChooseItemScreen(Proc.new { |item| pbIsMulch?(item) })
ret = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_mulch? })
}
if ret>0
if pbIsMulch?(ret)
if ret
if GameData::Item.get(ret).is_mulch?
berryData[7]=ret
pbMessage(_INTL("The {1} was scattered on the soil.\1",PBItems.getName(ret)))
pbMessage(_INTL("The {1} was scattered on the soil.\1",GameData::Item.get(ret).name))
if pbConfirmMessage(_INTL("Want to plant a Berry?"))
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag)
berry = screen.pbChooseItemScreen(Proc.new { |item| pbIsBerry?(item) })
berry = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_berry? })
}
if berry>0
if berry
timenow=pbGetTimeNow
berryData[0]=1 # growth stage (1-5)
berryData[1]=berry # item ID of planted berry
@@ -367,7 +365,7 @@ def pbBerryPlant
berryData[6]=0 # yield penalty
$PokemonBag.pbDeleteItem(berry,1)
pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
PBItems.getName(berry)))
GameData::Item.get(berry).name))
end
end
interp.setVariable(berryData)
@@ -380,9 +378,9 @@ def pbBerryPlant
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag)
berry = screen.pbChooseItemScreen(Proc.new { |item| pbIsBerry?(item) })
berry = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_berry? })
}
if berry>0
if berry
timenow=pbGetTimeNow
berryData[0]=1 # growth stage (1-5)
berryData[1]=berry # item ID of planted berry
@@ -393,20 +391,20 @@ def pbBerryPlant
berryData[6]=0 # yield penalty
$PokemonBag.pbDeleteItem(berry,1)
pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
PBItems.getName(berry)))
GameData::Item.get(berry).name))
interp.setVariable(berryData)
end
return
end
else
pbMessage(_INTL("{1} has been laid down.\1",PBItems.getName(berryData[7])))
pbMessage(_INTL("{1} has been laid down.\1",GameData::Item.get(berryData[7]).name))
if pbConfirmMessage(_INTL("Want to plant a Berry?"))
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag)
berry = screen.pbChooseItemScreen(Proc.new { |item| pbIsBerry?(item) })
berry = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_berry? })
}
if berry>0
if berry
timenow=pbGetTimeNow
berryData[0]=1 # growth stage (1-5)
berryData[1]=berry # item ID of planted berry
@@ -417,7 +415,7 @@ def pbBerryPlant
berryData[6]=0 # yield penalty
$PokemonBag.pbDeleteItem(berry,1)
pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
PBItems.getName(berry)))
GameData::Item.get(berry).name))
interp.setVariable(berryData)
end
return
@@ -429,9 +427,9 @@ def pbBerryPlant
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag)
berry = screen.pbChooseItemScreen(Proc.new { |item| pbIsBerry?(item) })
berry = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_berry? })
}
if berry>0
if berry
timenow=pbGetTimeNow
berryData[0]=1 # growth stage (1-5)
berryData[1]=berry # item ID of planted berry
@@ -442,33 +440,33 @@ def pbBerryPlant
berryData[6]=nil; berryData[7]=nil; berryData.compact! # for compatibility
$PokemonBag.pbDeleteItem(berry,1)
pbMessage(_INTL("{1} planted a {2} in the soft loamy soil.",
$Trainer.name,PBItems.getName(berry)))
$Trainer.name,GameData::Item.get(berry).name))
interp.setVariable(berryData)
end
return
end
end
when 1 # X planted
pbMessage(_INTL("A {1} was planted here.",PBItems.getName(berry)))
pbMessage(_INTL("A {1} was planted here.",GameData::Item.get(berry).name))
when 2 # X sprouted
pbMessage(_INTL("The {1} has sprouted.",PBItems.getName(berry)))
pbMessage(_INTL("The {1} has sprouted.",GameData::Item.get(berry).name))
when 3 # X taller
pbMessage(_INTL("The {1} plant is growing bigger.",PBItems.getName(berry)))
pbMessage(_INTL("The {1} plant is growing bigger.",GameData::Item.get(berry).name))
when 4 # X flowering
if NEW_BERRY_PLANTS
pbMessage(_INTL("This {1} plant is in bloom!",PBItems.getName(berry)))
pbMessage(_INTL("This {1} plant is in bloom!",GameData::Item.get(berry).name))
else
case berryData[4]
when 4
pbMessage(_INTL("This {1} plant is in fabulous bloom!",PBItems.getName(berry)))
pbMessage(_INTL("This {1} plant is in fabulous bloom!",GameData::Item.get(berry).name))
when 3
pbMessage(_INTL("This {1} plant is blooming very beautifully!",PBItems.getName(berry)))
pbMessage(_INTL("This {1} plant is blooming very beautifully!",GameData::Item.get(berry).name))
when 2
pbMessage(_INTL("This {1} plant is blooming prettily!",PBItems.getName(berry)))
pbMessage(_INTL("This {1} plant is blooming prettily!",GameData::Item.get(berry).name))
when 1
pbMessage(_INTL("This {1} plant is blooming cutely!",PBItems.getName(berry)))
pbMessage(_INTL("This {1} plant is blooming cutely!",GameData::Item.get(berry).name))
else
pbMessage(_INTL("This {1} plant is in bloom!",PBItems.getName(berry)))
pbMessage(_INTL("This {1} plant is in bloom!",GameData::Item.get(berry).name))
end
end
when 5 # X berries
@@ -487,7 +485,9 @@ def pbBerryPlant
berrycount=berryvalues[2]
end
end
itemname=(berrycount>1) ? PBItems.getNamePlural(berry) : PBItems.getName(berry)
item = GameData::Item.get(berry)
itemname = (berrycount>1) ? item.name_plural : item.name
pocket = item.pocket
if berrycount>1
message=_INTL("There are {1} \\c[1]{2}\\c[0]!\nWant to pick them?",berrycount,itemname)
else
@@ -504,15 +504,14 @@ def pbBerryPlant
else
pbMessage(_INTL("You picked the \\c[1]{1}\\c[0].\\wtnp[30]",itemname))
end
pocket = pbGetPocket(berry)
pbMessage(_INTL("{1} put the \\c[1]{2}\\c[0] in the <icon=bagPocket{3}>\\c[1]{4}\\c[0] Pocket.\1",
$Trainer.name,itemname,pocket,PokemonBag.pocketNames()[pocket]))
if NEW_BERRY_PLANTS
pbMessage(_INTL("The soil returned to its soft and earthy state."))
berryData=[0,0,0,0,0,0,0,0]
berryData=[0,nil,0,0,0,0,0,0]
else
pbMessage(_INTL("The soil returned to its soft and loamy state."))
berryData=[0,0,false,0,0,0]
berryData=[0,nil,false,0,0,0]
end
interp.setVariable(berryData)
end
@@ -520,38 +519,37 @@ def pbBerryPlant
case berryData[0]
when 1, 2, 3, 4
for i in watering
if i!=0 && $PokemonBag.pbHasItem?(i)
if pbConfirmMessage(_INTL("Want to sprinkle some water with the {1}?",PBItems.getName(i)))
if berryData.length>6
# Gen 4 berry watering mechanics
berryData[4]=100
else
# Gen 3 berry watering mechanics
if berryData[2]==false
berryData[4]+=1
berryData[2]=true
end
end
interp.setVariable(berryData)
pbMessage(_INTL("{1} watered the plant.\\wtnp[40]",$Trainer.name))
if NEW_BERRY_PLANTS
pbMessage(_INTL("There! All happy!"))
else
pbMessage(_INTL("The plant seemed to be delighted."))
next if !GameData::Item.exists?(i) || !$PokemonBag.pbHasItem?(i)
if pbConfirmMessage(_INTL("Want to sprinkle some water with the {1}?",GameData::Item.get(i).name))
if berryData.length>6
# Gen 4 berry watering mechanics
berryData[4]=100
else
# Gen 3 berry watering mechanics
if berryData[2]==false
berryData[4]+=1
berryData[2]=true
end
end
break
interp.setVariable(berryData)
pbMessage(_INTL("{1} watered the plant.\\wtnp[40]",$Trainer.name))
if NEW_BERRY_PLANTS
pbMessage(_INTL("There! All happy!"))
else
pbMessage(_INTL("The plant seemed to be delighted."))
end
end
break
end
end
end
def pbPickBerry(berry,qty=1)
def pbPickBerry(berry, qty = 1)
interp=pbMapInterpreter
thisEvent=interp.get_character(0)
berryData=interp.getVariable
berry=getID(PBItems,berry)
itemname=(qty>1) ? PBItems.getNamePlural(berry) : PBItems.getName(berry)
berry=GameData::Item.get(berry)
itemname=(qty>1) ? berry.name_plural : berry.name
if qty>1
message=_INTL("There are {1} \\c[1]{2}\\c[0]!\nWant to pick them?",qty,itemname)
else
@@ -568,15 +566,15 @@ def pbPickBerry(berry,qty=1)
else
pbMessage(_INTL("You picked the \\c[1]{1}\\c[0].\\wtnp[30]",itemname))
end
pocket = pbGetPocket(berry)
pocket = berry.pocket
pbMessage(_INTL("{1} put the \\c[1]{2}\\c[0] in the <icon=bagPocket{3}>\\c[1]{4}\\c[0] Pocket.\1",
$Trainer.name,itemname,pocket,PokemonBag.pocketNames()[pocket]))
if NEW_BERRY_PLANTS
pbMessage(_INTL("The soil returned to its soft and earthy state."))
berryData=[0,0,0,0,0,0,0,0]
berryData=[0,nil,0,0,0,0,0,0]
else
pbMessage(_INTL("The soil returned to its soft and loamy state."))
berryData=[0,0,false,0,0,0]
berryData=[0,nil,false,0,0,0]
end
interp.setVariable(berryData)
pbSetSelfSwitch(thisEvent.id,"A",true)

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