Implemented item portion names, e.g. "bag of Soft Sand"

This commit is contained in:
Maruno17
2023-01-03 21:32:32 +00:00
parent 707cd143d8
commit 2e8329f70b
18 changed files with 917 additions and 130 deletions

View File

@@ -1429,6 +1429,7 @@ MenuHandlers.add(:party_menu_item, :move, {
pkmn = party[party_idx]
item = pkmn.item
itemname = item.name
portionitemname = item.portion_name
screen.scene.pbSetHelpText(_INTL("Move {1} to where?", itemname))
old_party_idx = party_idx
moved = false
@@ -1446,7 +1447,7 @@ MenuHandlers.add(:party_menu_item, :move, {
pkmn.item = nil
screen.scene.pbClearSwitching
screen.pbRefresh
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, itemname))
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, portionitemname))
moved = true
break
elsif newpkmn.item.is_mail?
@@ -1455,10 +1456,8 @@ MenuHandlers.add(:party_menu_item, :move, {
end
# New Pokémon is also holding an item; ask what to do with it
newitem = newpkmn.item
newitemname = newitem.name
if newitem == :LEFTOVERS
screen.pbDisplay(_INTL("{1} is already holding some {2}.\1", newpkmn.name, newitemname))
elsif newitemname.starts_with_vowel?
newitemname = newitem.portion_name
if newitemname.starts_with_vowel?
screen.pbDisplay(_INTL("{1} is already holding an {2}.\1", newpkmn.name, newitemname))
else
screen.pbDisplay(_INTL("{1} is already holding a {2}.\1", newpkmn.name, newitemname))
@@ -1468,7 +1467,7 @@ MenuHandlers.add(:party_menu_item, :move, {
pkmn.item = newitem
screen.scene.pbClearSwitching
screen.pbRefresh
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, itemname))
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, portionitemname))
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", pkmn.name, newitemname))
moved = true
break

View File

@@ -505,7 +505,7 @@ class PokemonBagScreen
if $player.pokemon_count == 0
@scene.pbDisplay(_INTL("There is no Pokémon."))
elsif itm.is_important?
@scene.pbDisplay(_INTL("The {1} can't be held.", itemname))
@scene.pbDisplay(_INTL("The {1} can't be held.", itm.portion_name))
else
pbFadeOutIn {
sscene = PokemonParty_Scene.new
@@ -517,11 +517,11 @@ class PokemonBagScreen
elsif cmdToss >= 0 && command == cmdToss # Toss item
qty = @bag.quantity(item)
if qty > 1
helptext = _INTL("Toss out how many {1}?", itm.name_plural)
helptext = _INTL("Toss out how many {1}?", itm.portion_name_plural)
qty = @scene.pbChooseNumber(helptext, qty)
end
if qty > 0
itemname = itm.name_plural if qty > 1
itemname = (qty > 1) ? itm.portion_name_plural : itm.portion_name
if pbConfirm(_INTL("Is it OK to throw away {1} {2}?", qty, itemname))
pbDisplay(_INTL("Threw away {1} {2}.", qty, itemname))
qty.times { @bag.remove(item) }
@@ -620,7 +620,7 @@ class PokemonBagScreen
end
@scene.pbRefresh
dispqty = (itm.is_important?) ? 1 : qty
itemname = (dispqty > 1) ? itm.name_plural : itm.name
itemname = (dispqty > 1) ? itm.portion_name_plural : itm.portion_name
pbDisplay(_INTL("Withdrew {1} {2}.", dispqty, itemname))
else
pbDisplay(_INTL("There's no more room in the Bag."))
@@ -654,7 +654,7 @@ class PokemonBagScreen
end
@scene.pbRefresh
dispqty = (itm.is_important?) ? 1 : qty
itemname = (dispqty > 1) ? itm.name_plural : itm.name
itemname = (dispqty > 1) ? itm.portion_name_plural : itm.portion_name
pbDisplay(_INTL("Deposited {1} {2}.", dispqty, itemname))
else
pbDisplay(_INTL("There's no room to store items."))
@@ -680,8 +680,8 @@ class PokemonBagScreen
next
end
qty = storage.quantity(item)
itemname = itm.name
itemnameplural = itm.name_plural
itemname = itm.portion_name
itemnameplural = itm.portion_name_plural
if qty > 1
qty = @scene.pbChooseNumber(_INTL("Toss out how many {1}?", itemnameplural), qty)
end

View File

@@ -1896,8 +1896,8 @@ class PokemonStorageScreen
return
end
if pokemon.item
itemname = pokemon.item.name
if pbConfirm(_INTL("Take this {1}?", itemname))
itemname = pokemon.item.portion_name
if pbConfirm(_INTL("Take the {1}?", itemname))
if $bag.add(pokemon.item)
pbDisplay(_INTL("Took the {1}.", itemname))
pokemon.item = nil

View File

@@ -19,15 +19,15 @@ class PokemonMartAdapter
end
def getName(item)
return GameData::Item.get(item).name
return GameData::Item.get(item).portion_name
end
def getNamePlural(item)
return GameData::Item.get(item).name_plural
return GameData::Item.get(item).portion_name_plural
end
def getDisplayName(item)
item_name = getName(item)
item_name = GameData::Item.get(item).name
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name = _INTL("{1} {2}", item_name, GameData::Move.get(machine).name)
@@ -36,7 +36,7 @@ class PokemonMartAdapter
end
def getDisplayNamePlural(item)
item_name_plural = getNamePlural(item)
item_name_plural = GameData::Item.get(item).name_plural
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name_plural = _INTL("{1} {2}", item_name_plural, GameData::Move.get(machine).name)
@@ -103,10 +103,22 @@ class BuyAdapter
@adapter = adapter
end
# For showing in messages
def getName(item)
@adapter.getName(item)
end
# For showing in messages
def getNamePlural(item)
@adapter.getNamePlural(item)
end
# For showing in the list of items
def getDisplayName(item)
@adapter.getDisplayName(item)
end
# For showing in the list of items
def getDisplayNamePlural(item)
@adapter.getDisplayNamePlural(item)
end
@@ -128,10 +140,22 @@ class SellAdapter
@adapter = adapter
end
# For showing in messages
def getName(item)
@adapter.getName(item)
end
# For showing in messages
def getNamePlural(item)
@adapter.getNamePlural(item)
end
# For showing in the list of items
def getDisplayName(item)
@adapter.getDisplayName(item)
end
# For showing in the list of items
def getDisplayNamePlural(item)
@adapter.getDisplayNamePlural(item)
end
@@ -583,15 +607,15 @@ class PokemonMartScreen
item = @scene.pbChooseBuyItem
break if !item
quantity = 0
itemname = @adapter.getDisplayName(item)
itemnameplural = @adapter.getDisplayNamePlural(item)
itemname = @adapter.getName(item)
itemnameplural = @adapter.getNamePlural(item)
price = @adapter.getPrice(item)
if @adapter.getMoney < price
pbDisplayPaused(_INTL("You don't have enough money."))
next
end
if GameData::Item.get(item).is_important?
next if !pbConfirm(_INTL("So you want {1}?\nIt'll be ${2}. All right?",
next if !pbConfirm(_INTL("So you want the {1}?\nIt'll be ${2}. All right?",
itemname, price.to_s_formatted))
quantity = 1
else
@@ -632,8 +656,8 @@ class PokemonMartScreen
break if !@adapter.addItem(:PREMIERBALL)
premier_balls_added += 1
end
ball_name = GameData::Item.get(:PREMIERBALL).name
ball_name = GameData::Item.get(:PREMIERBALL).name_plural if premier_balls_added > 1
ball_name = GameData::Item.get(:PREMIERBALL).portion_name
ball_name = GameData::Item.get(:PREMIERBALL).portion_name_plural if premier_balls_added > 1
$stats.premier_balls_earned += premier_balls_added
pbDisplayPaused(_INTL("And have {1} {2} on the house!", premier_balls_added, ball_name))
elsif !Settings::MORE_BONUS_PREMIER_BALLS && GameData::Item.get(item) == :POKEBALL
@@ -661,8 +685,8 @@ class PokemonMartScreen
loop do
item = @scene.pbChooseSellItem
break if !item
itemname = @adapter.getDisplayName(item)
itemnameplural = @adapter.getDisplayNamePlural(item)
itemname = @adapter.getName(item)
itemnameplural = @adapter.getNamePlural(item)
if !@adapter.canSell?(item)
pbDisplayPaused(_INTL("Oh, no. I can't buy {1}.", itemnameplural))
next

View File

@@ -19,15 +19,15 @@ class BattlePointShopAdapter
end
def getName(item)
return GameData::Item.get(item).name
return GameData::Item.get(item).portion_name
end
def getNamePlural(item)
return GameData::Item.get(item).name_plural
return GameData::Item.get(item).portion_name_plural
end
def getDisplayName(item)
item_name = getName(item)
item_name = GameData::Item.get(item).name
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name = _INTL("{1} {2}", item_name, GameData::Move.get(machine).name)
@@ -36,7 +36,7 @@ class BattlePointShopAdapter
end
def getDisplayNamePlural(item)
item_name_plural = getNamePlural(item)
item_name_plural = GameData::Item.get(item).name_plural
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name_plural = _INTL("{1} {2}", item_name_plural, GameData::Move.get(machine).name)
@@ -446,8 +446,8 @@ class BattlePointShopScreen
item = @scene.pbChooseItem
break if !item
quantity = 0
itemname = @adapter.getDisplayName(item)
itemnameplural = @adapter.getDisplayNamePlural(item)
itemname = @adapter.getName(item)
itemnameplural = @adapter.getNamePlural(item)
price = @adapter.getPrice(item)
if @adapter.getBP < price
pbDisplayPaused(_INTL("You don't have enough BP."))
@@ -484,8 +484,8 @@ class BattlePointShopScreen
end
if added == quantity
$stats.battle_points_spent += price
#Add bpshop_items_bought to $stats?
#$stats.bpshop_items_bought += quantity
# TODO: Add bpshop_items_bought to $stats?
# $stats.bpshop_items_bought += quantity
@adapter.setBP(@adapter.getBP - price)
@stock.delete_if { |item| GameData::Item.get(item).is_important? && $bag.has?(item) }
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }

View File

@@ -406,10 +406,8 @@ def pbReceiveMysteryGift(id)
if $bag.can_add?(item, qty)
$bag.add(item, qty)
itm = GameData::Item.get(item)
itemname = (qty > 1) ? itm.name_plural : itm.name
if item == :LEFTOVERS
pbMessage(_INTL("\\me[Item get]You obtained some \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
elsif itm.is_machine? # TM or HM
itemname = (qty > 1) ? itm.portion_name_plural : itm.portion_name
if itm.is_machine? # TM or HM
pbMessage(_INTL("\\me[Item get]You obtained \\c[1]{1} {2}\\c[0]!\\wtnp[30]", itemname,
GameData::Move.get(itm.move).name))
elsif qty > 1