Renamed variables and methods relating to the Bag, renamed $PokemonBag to $Bag, $bag.has? can now check for a minimum quantity

This commit is contained in:
Maruno17
2021-10-17 23:02:58 +01:00
parent 72c50db6c0
commit 36ff7c4ba3
30 changed files with 502 additions and 426 deletions

View File

@@ -135,9 +135,7 @@ Events.onStepTakenFieldMovement += proc { |_sender,e|
tile_id = map.data[thistile[1],thistile[2],i]
next if tile_id == nil
next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass
if event == $game_player && GameData::Item.exists?(:SOOTSACK)
$Trainer.soot += 1 if $PokemonBag.pbHasItem?(:SOOTSACK)
end
$Trainer.soot += 1 if event == $game_player && $bag.has?(:SOOTSACK)
# map.data[thistile[1], thistile[2], i] = 0
# $scene.createSingleSpriteset(map.map_id)
break
@@ -711,7 +709,7 @@ def pbItemBall(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
if $bag.add(item, quantity) # If item can be picked up
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))
@@ -727,7 +725,7 @@ def pbItemBall(item,quantity=1)
pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
end
pbMessage(_INTL("You put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.",
itemname,pocket,PokemonBag.pocketNames()[pocket]))
itemname, pocket, PokemonBag.pocket_names[pocket]))
return true
end
# Can't add the item
@@ -771,9 +769,9 @@ def pbReceiveItem(item,quantity=1)
else
pbMessage(_INTL("\\me[{1}]You obtained a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
end
if $PokemonBag.pbStoreItem(item,quantity) # If item can be added
if $bag.add(item, quantity) # If item can be added
pbMessage(_INTL("You put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.",
itemname,pocket,PokemonBag.pocketNames()[pocket]))
itemname, pocket, PokemonBag.pocket_names[pocket]))
return true
end
return false # Can't add the item

View File

@@ -414,7 +414,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
# Improve chances of shiny Pokémon with Shiny Charm and battling more of the
# same species
shiny_retries = 0
shiny_retries += 2 if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
shiny_retries += 2 if $bag.has?(:SHINYCHARM)
if Settings::HIGHER_SHINY_CHANCES_WITH_NUMBER_BATTLED
values = [0, 0]
case $Trainer.pokedex.battled_count(species)

View File

@@ -354,7 +354,7 @@ def pbBerryPlant
end
# Water the growing plant
GameData::BerryPlant::WATERING_CANS.each do |item|
next if !GameData::Item.exists?(item) || !$PokemonBag.pbHasItem?(item)
next if !$bag.has?(item)
break if !pbConfirmMessage(_INTL("Want to sprinkle some water with the {1}?",
GameData::Item.get(item).name))
berry_plant.water
@@ -381,14 +381,14 @@ def pbBerryPlant
mulch = nil
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $PokemonBag)
screen = PokemonBagScreen.new(scene, $bag)
mulch = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_mulch? })
}
return if !mulch
mulch_data = GameData::Item.get(mulch)
if mulch_data.is_mulch?
berry_plant.mulch_id = mulch
$PokemonBag.pbDeleteItem(mulch, 1)
$bag.remove(mulch)
pbMessage(_INTL("The {1} was scattered on the soil.\1", mulch_data.name))
else
pbMessage(_INTL("That won't fertilize the soil!"))
@@ -408,12 +408,12 @@ def pbBerryPlant
if !ask_to_plant || pbConfirmMessage(_INTL("Want to plant a Berry?"))
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $PokemonBag)
screen = PokemonBagScreen.new(scene, $bag)
berry = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).is_berry? })
}
if berry
berry_plant.plant(berry)
$PokemonBag.pbDeleteItem(berry, 1)
$bag.remove(berry)
if Settings::NEW_BERRY_PLANTS
pbMessage(_INTL("The {1} was planted in the soft, earthy soil.",
GameData::Item.get(berry).name))
@@ -437,11 +437,11 @@ def pbPickBerry(berry, qty = 1)
message = _INTL("There is 1 \\c[1]{1}\\c[0]!\nWant to pick it?", berry_name)
end
return false if !pbConfirmMessage(message)
if !$PokemonBag.pbCanStore?(berry, qty)
if !$bag.can_add?(berry, qty)
pbMessage(_INTL("Too bad...\nThe Bag is full..."))
return false
end
$PokemonBag.pbStoreItem(berry, qty)
$bag.add(berry, qty)
if qty > 1
pbMessage(_INTL("You picked the {1} \\c[1]{2}\\c[0].\\wtnp[30]", qty, berry_name))
else
@@ -449,7 +449,7 @@ def pbPickBerry(berry, qty = 1)
end
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, berry_name, pocket, PokemonBag.pocketNames[pocket]))
$Trainer.name, berry_name, pocket, PokemonBag.pocket_names[pocket]))
if Settings::NEW_BERRY_PLANTS
pbMessage(_INTL("The soil returned to its soft and earthy state."))
else

View File

@@ -316,7 +316,7 @@ def pbDayCareGenerateEgg
# Masuda method and Shiny Charm
shinyretries = 0
shinyretries += 5 if father.owner.language != mother.owner.language
shinyretries += 2 if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
shinyretries += 2 if $bag.has?(:SHINYCHARM)
if shinyretries>0
shinyretries.times do
break if egg.shiny?
@@ -380,10 +380,8 @@ Events.onStepTaken += proc { |_sender,_e|
$PokemonGlobal.daycareEggSteps += 1
if $PokemonGlobal.daycareEggSteps==256
$PokemonGlobal.daycareEggSteps = 0
compatval = [0,20,50,70][pbDayCareGetCompat]
if GameData::Item.exists?(:OVALCHARM) && $PokemonBag.pbHasItem?(:OVALCHARM)
compatval = [0,40,80,88][pbDayCareGetCompat]
end
compatval = [0, 20, 50, 70][pbDayCareGetCompat]
compatval = [0, 40, 80, 88][pbDayCareGetCompat] if $bag.has?(:OVALCHARM)
$PokemonGlobal.daycareEgg = 1 if rand(100)<compatval # Egg is generated
end
end