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

@@ -32,6 +32,8 @@ module Settings
OVERRIDE_BATTLE_LEVEL_SWITCH = 785
OVERRIDE_BATTLE_LEVEL_VALUE_VAR =240
ZAPMOLCUNO_NB = 176821
# The generation that the battle system follows. Used throughout the battle
# scripts, and also by some other settings which are used in and out of battle
# (you can of course change those settings to suit your game).

View File

@@ -12,13 +12,20 @@ class PokemonDataBox < SpriteWrapper
# Maximum time in seconds to make a change to the HP bar.
HP_BAR_CHANGE_TIME = 1.0
STATUS_ICON_HEIGHT = 16
NAME_BASE_COLOR = Color.new(72,72,72)
NAME_SHADOW_COLOR = Color.new(184,184,184)
# NAME_BASE_COLOR = Color.new(72,72,72)
# NAME_SHADOW_COLOR = Color.new(184,184,184)
# MALE_BASE_COLOR = Color.new(48,96,216)
# MALE_SHADOW_COLOR = NAME_SHADOW_COLOR
# FEMALE_BASE_COLOR = Color.new(248,88,40)
# FEMALE_SHADOW_COLOR = NAME_SHADOW_COLOR
NAME_BASE_COLOR = Color.new(255,255,255)
NAME_SHADOW_COLOR = Color.new(32,32,32)
MALE_BASE_COLOR = Color.new(48,96,216)
MALE_SHADOW_COLOR = NAME_SHADOW_COLOR
FEMALE_BASE_COLOR = Color.new(248,88,40)
FEMALE_SHADOW_COLOR = NAME_SHADOW_COLOR
def initialize(battler,sideSize,viewport=nil)
super(viewport)
@battler = battler
@@ -59,9 +66,9 @@ class PokemonDataBox < SpriteWrapper
@spriteY = Graphics.height - 192
@spriteBaseX = 34
else
@spriteX = -16
@spriteX = 8 #-16
@spriteY = 36
@spriteBaseX = 16
@spriteBaseX = 8 #16
end
case sideSize
when 2
@@ -111,15 +118,15 @@ class PokemonDataBox < SpriteWrapper
def x=(value)
super
@hpBar.x = value+@spriteBaseX+102
@expBar.x = value+@spriteBaseX+6
@hpBar.x = value+@spriteBaseX+12#102
@expBar.x = value+@spriteBaseX+24
@hpNumbers.x = value+@spriteBaseX+80
end
def y=(value)
super
@hpBar.y = value+40
@expBar.y = value+74
@expBar.y = value+64
@hpNumbers.y = value+52
end
@@ -243,7 +250,7 @@ class PokemonDataBox < SpriteWrapper
end
# Draw owned icon (foe Pokémon only)
if @battler.owned? && @battler.opposes?(0)
imagePos.push(["Graphics/Pictures/Battle/icon_own",@spriteBaseX+8,36])
imagePos.push(["Graphics/Pictures/Battle/icon_own",@spriteBaseX-8,42])
end
# Draw status icon
if @battler.status != :NONE
@@ -251,8 +258,8 @@ class PokemonDataBox < SpriteWrapper
if s == :POISON && @battler.statusCount > 0 # Badly poisoned
s = GameData::Status::DATA.keys.length / 2
end
imagePos.push(["Graphics/Pictures/Battle/icon_statuses",@spriteBaseX+24,36,
0,(s-1)*STATUS_ICON_HEIGHT,-1,STATUS_ICON_HEIGHT])
imagePos.push(["Graphics/Pictures/Battle/icon_statuses",@spriteBaseX+24,56,
0,(s-1)*STATUS_ICON_HEIGHT,-1,STATUS_ICON_HEIGHT])
end
pbDrawImagePositions(self.bitmap,imagePos)
refreshHP

View File

@@ -126,10 +126,15 @@ class PokeBattle_Scene
end
end
# Finalise filenames
battleBG = "Graphics/Battlebacks/"+backdropFilename+"_bg"
playerBase = "Graphics/Battlebacks/"+baseFilename+"_base0"
enemyBase = "Graphics/Battlebacks/"+baseFilename+"_base1"
# battleBG = "Graphics/Battlebacks/"+backdropFilename+"_bg"
# playerBase = "Graphics/Battlebacks/"+baseFilename+"_base0"
# enemyBase = "Graphics/Battlebacks/"+baseFilename+"_base1"
# messageBG = "Graphics/Battlebacks/"+messageFilename+"_message"
battleBG = "Graphics/Battlebacks/battlebg/"+backdropFilename
playerBase = "Graphics/Battlebacks/playerbase/"+baseFilename
enemyBase = "Graphics/Battlebacks/enemybase/"+baseFilename
messageBG = "Graphics/Battlebacks/"+messageFilename+"_message"
# Apply graphics
bg = pbAddSprite("battle_bg",0,0,battleBG,@viewport)
bg.z = 0

View File

@@ -140,7 +140,13 @@ def pbPrepareBattle(battle)
back = GameData::MapMetadata.get($game_map.map_id).battle_background
backdrop = back if back && back != ""
end
backdrop = "indoor1" if !backdrop
if !backdrop
isOutdoor = GameData::MapMetadata.get($game_map.map_id).outdoor_map rescue false
backdrop = "indoorA" if !isOutdoor
backdrop = "Field" if isOutdoor
end
backdrop = "indoorA" if !backdrop
battle.backdrop = backdrop
# Choose a name for bases depending on environment
if battleRules["base"].nil?

View File

@@ -1200,12 +1200,10 @@ class PokemonPartyScreen
if pbConfirmUseHiddenMove(pkmn,pkmn.moves[i].id)
@scene.pbEndScene
if pkmn.moves[i].id == :FLY
scene = PokemonRegionMap_Scene.new(-1,false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartFlyScreen
ret = pbBetterRegionMap(-1, true, true)
if ret
$PokemonTemp.flydata=ret
return [pkmn,pkmn.moves[i].id]
$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."))

View File

@@ -63,13 +63,16 @@
# # (e.g. 4 -> to_digits -> "004")
# # (e.g. 19 -> to_digits -> "019")
# # (e.g. 123 -> to_digits -> "123")
# def to_digits(n = 3)
# str = self.to_s
# return str if str.size >= n
# ret = ""
# (n - str.size).times { ret += "0" }
# return ret + str
# end
class Numeric
def to_digits(n = 3)
str = self.to_s
return str if str.size >= n
ret = ""
(n - str.size).times { ret += "0" }
return ret + str
end
end
#
# # n root of self. Defaults to 2 => square root.
# def root(n = 2)
@@ -692,7 +695,7 @@ class Sprite
# Returns the x, y, and z coordinates in the xyz=(args) format, [x,y,z]
def xyz
return [self.x,self.y,self.z]
return [self.x, self.y, self.z]
end
# Centers the sprite by setting the origin points to half the width and height
@@ -712,6 +715,7 @@ class Sprite
return self.bitmap.height.to_f * self.zoom_y
end
end
#
class TextSprite < Sprite
# Sets up the sprite and bitmap. You can also pass text to draw
@@ -726,9 +730,9 @@ class TextSprite < Sprite
pbSetSystemFont(self.bmp)
if text.is_a?(Array)
if text[0].is_a?(Array)
pbDrawTextPositions(self.bmp,text)
pbDrawTextPositions(self.bmp, text)
else
pbDrawTextPositions(self.bmp,[text])
pbDrawTextPositions(self.bmp, [text])
end
end
end
@@ -745,9 +749,9 @@ class TextSprite < Sprite
def draw(text, clear = false)
self.clear if clear
if text[0].is_a?(Array)
pbDrawTextPositions(self.bmp,text)
pbDrawTextPositions(self.bmp, text)
else
pbDrawTextPositions(self.bmp,[text])
pbDrawTextPositions(self.bmp, [text])
end
end
@@ -758,12 +762,12 @@ class TextSprite < Sprite
if text[0].is_a?(Array)
for e in text
e[2] -= 224
pbDrawOutlineText(self.bmp,e[1],e[2],640,480,e[0],e[4],e[5],e[3])
pbDrawOutlineText(self.bmp, e[1], e[2], 640, 480, e[0], e[4], e[5], e[3])
end
else
e = text
e[2] -= 224
pbDrawOutlineText(self.bmp,e[1],e[2],640,480,e[0],e[4],e[5],e[3])
pbDrawOutlineText(self.bmp, e[1], e[2], 640, 480, e[0], e[4], e[5], e[3])
end
end
@@ -773,11 +777,11 @@ class TextSprite < Sprite
self.clear if clear
if text[0].is_a?(Array)
for e in text
drawTextEx(self.bmp,e[1],e[2],e[3],e[4],e[0],e[5],e[6])
drawTextEx(self.bmp, e[1], e[2], e[3], e[4], e[0], e[5], e[6])
end
else
e = text
drawTextEx(self.bmp,e[1],e[2],e[3],e[4],e[0],e[5],e[6])
drawTextEx(self.bmp, e[1], e[2], e[3], e[4], e[0], e[5], e[6])
end
end
@@ -827,8 +831,13 @@ class SpriteHash
return @hash.keys
end
def length; return self.size; end
def count; return self.size; end
def length
return self.size;
end
def count
return self.size;
end
# Returns the amount of keys in the hash
def size
@@ -925,7 +934,7 @@ class SpriteHash
for key in @hash.keys
@hash[key].opacity += value - @opacity
end
@opacity = [0,value,255].sort[1]
@opacity = [0, value, 255].sort[1]
end
# Fades out all sprites
@@ -1070,17 +1079,16 @@ end
# end
# end
# Stand-alone methods
# Fades in a black overlay
def showBlk(n = 16)
return if $blkVp || $blk
$blkVp = Viewport.new(0,0,Settings::SCREEN_WIDTH,Settings::SCREEN_HEIGHT)
$blkVp = Viewport.new(0, 0, Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
$blkVp.z = 9999999
$blk = Sprite.new($blkVp)
$blk.bmp(-1,-1)
$blk.bitmap.fill_rect(0,0,Settings::SCREEN_WIDTH,Settings::SCREEN_HEIGHT,Color.new(0,0,0))
$blk.bmp(-1, -1)
$blk.bitmap.fill_rect(0, 0, Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT, Color.new(0, 0, 0))
$blk.opacity = 0
for i in 0...(n + 1)
Graphics.update
@@ -1154,9 +1162,6 @@ end
# end
# end
#
# if SPECIAL_ERRORS
#
@@ -1266,7 +1271,6 @@ end
#
# end # if SPECIAL_ERRORS
# def pbGetActiveEventPage(event, mapid = nil)
# mapid ||= event.map.map_id if event.respond_to?(:map)
# pages = (event.is_a?(RPG::Event) ? event.pages : event.instance_eval { @event.pages })

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

View File

@@ -39,16 +39,50 @@ module GameData
return (filename) ? AnimatedBitmap.new(filename) : nil
end
def self.getSpecialSpriteName(dexNum)
base_path="Graphics/Battlers/special/"
case dexNum
when Settings::ZAPMOLCUNO_NB..Settings::ZAPMOLCUNO_NB+1
return sprintf(base_path + "144.145.146")
when Settings::ZAPMOLCUNO_NB+2
return sprintf(base_path + "243.244.245")
when Settings::ZAPMOLCUNO_NB+3
return sprintf(base_path +"340.341.342")
when Settings::ZAPMOLCUNO_NB+4
return sprintf(base_path +"343.344.345")
when Settings::ZAPMOLCUNO_NB+5
return sprintf(base_path +"349.350.351")
when Settings::ZAPMOLCUNO_NB+6
return sprintf(base_path +"151.251.381")
#starters
when Settings::ZAPMOLCUNO_NB+7
return sprintf(base_path +"3.6.9")
when Settings::ZAPMOLCUNO_NB+8
return sprintf(base_path +"154.157.160")
when Settings::ZAPMOLCUNO_NB+9
return sprintf(base_path +"278.281.284")
when Settings::ZAPMOLCUNO_NB+10
return sprintf(base_path +"318.321.324")
else
return sprintf(base_path + "000")
end
end
def self.sprite_filename(dex_number)
return nil if dex_number == nil
if dex_number <= Settings::NB_POKEMON
folder = dex_number.to_s
filename = sprintf("%s.png", dex_number)
else
body_id = getBodyID(dex_number)
head_id = getHeadID(dex_number, body_id)
folder = head_id.to_s
filename = sprintf("%s.%s.png", head_id, body_id)
if dex_number >=Settings::ZAPMOLCUNO_NB
specialPath = getSpecialSpriteName(dex_number)
return pbResolveBitmap(specialPath)
else
body_id = getBodyID(dex_number)
head_id = getHeadID(dex_number, body_id)
folder = head_id.to_s
filename = sprintf("%s.%s.png", head_id, body_id)
end
end
customPath = pbResolveBitmap(Settings::CUSTOM_BATTLERS_FOLDER + filename)
regularPath = Settings::BATTLERS_FOLDER + folder + "/" + filename

View File

@@ -96,37 +96,6 @@ def pbLoadPokemonBitmapSpecies(pokemon, species, back = false, scale = POKEMONSP
return ret
end
def getSpecialSpriteName(dexNum)
base_path = "Graphics/Battlers/special/"
case dexNum
when NUM_ZAPMOLCUNO..NUM_ZAPMOLCUNO + 1
path = sprintf(base_path + "144.145.146")
when NUM_ZAPMOLCUNO + 2
path = sprintf(base_path + "243.244.245")
when NUM_ZAPMOLCUNO + 3
path = sprintf(base_path +"340.341.342")
when NUM_ZAPMOLCUNO + 4
path = sprintf(base_path +"343.344.345")
when NUM_ZAPMOLCUNO + 5
path = sprintf(base_path +"349.350.351")
when NUM_ZAPMOLCUNO + 6
path = sprintf(base_path +"151.251.381")
#starters
when NUM_ZAPMOLCUNO + 7
path = sprintf(base_path +"3.6.9")
when NUM_ZAPMOLCUNO + 8
path = sprintf(base_path +"154.157.160")
when NUM_ZAPMOLCUNO + 9
path = sprintf(base_path +"278.281.284")
when NUM_ZAPMOLCUNO + 10
path = sprintf(base_path +"318.321.324")
else
path = sprintf(base_path + "000")
end
end
#######################
# NEW CODE SECTION #
#######################