battle bg

This commit is contained in:
infinitefusion
2021-07-31 16:21:22 -04:00
parent dc7df58c17
commit 4354cc778a
1136 changed files with 109 additions and 157914 deletions

View File

@@ -500,215 +500,6 @@ def pbShowMap(region = -1, wallmap = true) # pokegear
pbBetterRegionMap(region, true, false, wallmap)
end
class PokemonPartyScreen
def pbPokemonScreen
@scene.pbStartScene(@party,
(@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."), nil)
loop do
@scene.pbSetHelpText((@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
pkmnid = @scene.pbChoosePokemon(false, -1, 1)
break if (pkmnid.is_a?(Numeric) && pkmnid < 0) || (pkmnid.is_a?(Array) && pkmnid[1] < 0)
if pkmnid.is_a?(Array) && pkmnid[0] == 1 # Switch
@scene.pbSetHelpText(_INTL("Move to where?"))
oldpkmnid = pkmnid[1]
pkmnid = @scene.pbChoosePokemon(true, -1, 2)
if pkmnid >= 0 && pkmnid != oldpkmnid
pbSwitch(oldpkmnid, pkmnid)
end
next
end
pkmn = @party[pkmnid]
commands = []
cmdSummary = -1
cmdDebug = -1
cmdMoves = [-1, -1, -1, -1]
cmdSwitch = -1
cmdMail = -1
cmdItem = -1
# Build the commands
commands[cmdSummary = commands.length] = _INTL("Summary")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
for i in 0...pkmn.moves.length
move = pkmn.moves[i]
# Check for hidden moves and add any that were found
if !pkmn.egg? && (isConst?(move.id, PBMoves, :MILKDRINK) ||
isConst?(move.id, PBMoves, :SOFTBOILED) ||
HiddenMoveHandlers.hasHandler(move.id))
commands[cmdMoves[i] = commands.length] = [PBMoves.getName(move.id), 1]
end
end
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length > 1
if !pkmn.egg?
if pkmn.mail
commands[cmdMail = commands.length] = _INTL("Mail")
else
commands[cmdItem = commands.length] = _INTL("Item")
end
end
commands[commands.length] = _INTL("Cancel")
command = @scene.pbShowCommands(_INTL("Do what with {1}?", pkmn.name), commands)
havecommand = false
for i in 0...4
if cmdMoves[i] >= 0 && command == cmdMoves[i]
havecommand = true
if isConst?(pkmn.moves[i].id, PBMoves, :SOFTBOILED) ||
isConst?(pkmn.moves[i].id, PBMoves, :MILKDRINK)
amt = [(pkmn.totalhp / 5).floor, 1].max
if pkmn.hp <= amt
pbDisplay(_INTL("Not enough HP..."))
break
end
@scene.pbSetHelpText(_INTL("Use on which Pokémon?"))
oldpkmnid = pkmnid
loop do
@scene.pbPreSelect(oldpkmnid)
pkmnid = @scene.pbChoosePokemon(true, pkmnid)
break if pkmnid < 0
newpkmn = @party[pkmnid]
movename = PBMoves.getName(pkmn.moves[i].id)
if pkmnid == oldpkmnid
pbDisplay(_INTL("{1} can't use {2} on itself!", pkmn.name, movename))
elsif newpkmn.egg?
pbDisplay(_INTL("{1} can't be used on an Egg!", movename))
elsif newpkmn.hp == 0 || newpkmn.hp == newpkmn.totalhp
pbDisplay(_INTL("{1} can't be used on that Pokémon.", movename))
else
pkmn.hp -= amt
hpgain = pbItemRestoreHP(newpkmn, amt)
@scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.", newpkmn.name, hpgain))
pbRefresh
end
break if pkmn.hp <= amt
end
@scene.pbSelect(oldpkmnid)
pbRefresh
break
elsif Kernel.pbCanUseHiddenMove?(pkmn, pkmn.moves[i].id)
if Kernel.pbConfirmUseHiddenMove(pkmn, pkmn.moves[i].id)
@scene.pbEndScene
if isConst?(pkmn.moves[i].id, PBMoves, :FLY)
###############################################
ret = pbBetterRegionMap(-1, true, true)
if ret
$PokemonTemp.flydata = ret
return [pkmn, pkmn.moves[i].id]
end
@scene.pbStartScene(@party,
(@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
break
###############################################
end
return [pkmn, pkmn.moves[i].id]
end
else
break
end
end
end
next if havecommand
if cmdSummary >= 0 && command == cmdSummary
@scene.pbSummary(pkmnid)
elsif cmdDebug >= 0 && command == cmdDebug
pbPokemonDebug(pkmn, pkmnid)
elsif cmdSwitch >= 0 && command == cmdSwitch
@scene.pbSetHelpText(_INTL("Move to where?"))
oldpkmnid = pkmnid
pkmnid = @scene.pbChoosePokemon(true)
if pkmnid >= 0 && pkmnid != oldpkmnid
pbSwitch(oldpkmnid, pkmnid)
end
elsif cmdMail >= 0 && command == cmdMail
command = @scene.pbShowCommands(_INTL("Do what with the mail?"),
[_INTL("Read"), _INTL("Take"), _INTL("Cancel")])
case command
when 0 # Read
pbFadeOutIn(99999) { pbDisplayMail(pkmn.mail, pkmn) }
when 1 # Take
if pbTakeItemFromPokemon(pkmn, self)
pbRefreshSingle(pkmnid)
end
end
elsif cmdItem >= 0 && command == cmdItem
itemcommands = []
cmdUseItem = -1
cmdGiveItem = -1
cmdTakeItem = -1
cmdMoveItem = -1
# Build the commands
itemcommands[cmdUseItem = itemcommands.length] = _INTL("Use")
itemcommands[cmdGiveItem = itemcommands.length] = _INTL("Give")
itemcommands[cmdTakeItem = itemcommands.length] = _INTL("Take") if pkmn.hasItem?
itemcommands[cmdMoveItem = itemcommands.length] = _INTL("Move") if pkmn.hasItem? && !pbIsMail?(pkmn.item)
itemcommands[itemcommands.length] = _INTL("Cancel")
command = @scene.pbShowCommands(_INTL("Do what with an item?"), itemcommands)
if cmdUseItem >= 0 && command == cmdUseItem # Use
item = @scene.pbUseItem($PokemonBag, pkmn)
if item > 0
pbUseItemOnPokemon(item, pkmn, self)
pbRefreshSingle(pkmnid)
end
elsif cmdGiveItem >= 0 && command == cmdGiveItem # Give
item = @scene.pbChooseItem($PokemonBag)
if item > 0
if pbGiveItemToPokemon(item, pkmn, self, pkmnid)
pbRefreshSingle(pkmnid)
end
end
elsif cmdTakeItem >= 0 && command == cmdTakeItem # Take
if pbTakeItemFromPokemon(pkmn, self)
pbRefreshSingle(pkmnid)
end
elsif cmdMoveItem >= 0 && command == cmdMoveItem # Move
item = pkmn.item
itemname = PBItems.getName(item)
@scene.pbSetHelpText(_INTL("Move {1} to where?", itemname))
oldpkmnid = pkmnid
loop do
@scene.pbPreSelect(oldpkmnid)
pkmnid = @scene.pbChoosePokemon(true, pkmnid)
break if pkmnid < 0
newpkmn = @party[pkmnid]
if pkmnid == oldpkmnid
break
elsif newpkmn.egg?
pbDisplay(_INTL("Eggs can't hold items."))
elsif !newpkmn.hasItem?
newpkmn.setItem(item)
pkmn.setItem(0)
@scene.pbClearSwitching
pbRefresh
pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, itemname))
break
elsif pbIsMail?(newpkmn.item)
pbDisplay(_INTL("{1}'s mail must be removed before giving it an item.", newpkmn.name))
else
newitem = newpkmn.item
newitemname = PBItems.getName(newitem)
if isConst?(newitem, PBItems, :LEFTOVERS)
pbDisplay(_INTL("{1} is already holding some {2}.\1", newpkmn.name, newitemname))
elsif ["a", "e", "i", "o", "u"].include?(newitemname[0, 1].downcase)
pbDisplay(_INTL("{1} is already holding an {2}.\1", newpkmn.name, newitemname))
else
pbDisplay(_INTL("{1} is already holding a {2}.\1", newpkmn.name, newitemname))
end
if pbConfirm(_INTL("Would you like to switch the two items?"))
newpkmn.setItem(item)
pkmn.setItem(newitem)
@scene.pbClearSwitching
pbRefresh
pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, itemname))
pbDisplay(_INTL("{1} was given the {2} to hold.", pkmn.name, newitemname))
break
end
end
end
end
end
end
@scene.pbEndScene
return nil
end
end
def calculatePointsAndCenter(mapwidth)
# Fill the array "points" with all squares of the region map in which the