trainer card fixes

This commit is contained in:
infinitefusion
2022-03-13 21:09:50 -04:00
parent a8073ef6d8
commit 6794004d94
18 changed files with 271 additions and 18 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -131,7 +131,6 @@ class PokeBattle_Scene
# 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

View File

@@ -85,11 +85,14 @@ def pbRoamPokemonOne(idxRoamer)
if rand(32)==0
newMapChoices.push(mapIDs[rand(mapIDs.length)])
end
#50% chance of moving to a new map
if rand(2)==0
# Choose a random new map to roam to
if newMapChoices.length>0
$PokemonGlobal.roamPosition[idxRoamer] = newMapChoices[rand(newMapChoices.length)]
end
end
end
# When the player moves to a new map (with a different name), make all roaming
# Pokémon roam.

View File

@@ -390,7 +390,8 @@ Events.onAction += proc { |_sender, _e|
break
end
if surface_map_id &&
$MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_dive
#$MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_dive
$MapFactory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_surf
pbSurfacing
end
else

View File

@@ -38,7 +38,7 @@ ItemHandlers::UseFromBag.add(:BICYCLE,proc { |item|
next (pbBikeCheck) ? 2 : 0
})
ItemHandlers::UseFromBag.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
ItemHandlers::UseFromBag.copy(:BICYCLE,:RACEBIKE)
ItemHandlers::UseFromBag.add(:OLDROD,proc { |item|
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
@@ -227,7 +227,7 @@ ItemHandlers::UseInField.add(:BICYCLE,proc { |item|
next 0
})
ItemHandlers::UseInField.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
ItemHandlers::UseInField.copy(:BICYCLE,:RACEBIKE)
ItemHandlers::UseInField.add(:OLDROD,proc { |item|
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)

View File

@@ -18,10 +18,19 @@ class PokemonTrainerCard_Scene
end
cardexists = pbResolveBitmap(sprintf("Graphics/Pictures/Trainer Card/card_f"))
@sprites["card"] = IconSprite.new(0,0,@viewport)
is_postgame = $game_switches[BEAT_THE_LEAGUE]
if $Trainer.female? && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/Trainer Card/card_f")
path = "Graphics/Pictures/Trainer Card/card_f"
if is_postgame
path+="_postgame"
end
@sprites["card"].setBitmap(path)
else
@sprites["card"].setBitmap("Graphics/Pictures/Trainer Card/card")
path = "Graphics/Pictures/Trainer Card/card"
if is_postgame
path+="_postgame"
end
@sprites["card"].setBitmap(path)
end
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
pbSetSystemFont(@sprites["overlay"].bitmap)
@@ -64,17 +73,38 @@ class PokemonTrainerCard_Scene
]
pbDrawTextPositions(overlay,textPositions)
x = 72
region = pbGetCurrentRegion(0) # Get the current region
imagePositions = []
for i in 0...8
if $Trainer.badges[i+region*8]
imagePositions.push(["Graphics/Pictures/Trainer Card/icon_badges",x,310,i*32,region*32,32,32])
postgame = $game_switches[BEAT_THE_LEAGUE]
numberOfBadgesDisplayed = postgame ? 16 : 8
for i in 0...numberOfBadgesDisplayed
badgeRow= i<8 ? 0 : 1
if $Trainer.badges[i]
if i == 8
x =72
end
badge_graphic_x = badgeRow == 0 ? i*32 : (i-8)*32
badge_graphic_y =badgeRow*32
y = getBadgeDisplayHeight(postgame,i)
imagePositions.push(["Graphics/Pictures/Trainer Card/icon_badges",x,y,badge_graphic_x,badge_graphic_y,32,32])
end
x += 48
end
pbDrawImagePositions(overlay,imagePositions)
end
def getBadgeDisplayHeight(postgame,i)
if postgame
if i < 8
y=310
else
y=344
end
else
y = 312
end
return y
end
def pbTrainerCard
pbSEPlay("GUI trainer card open")
loop do

View File

@@ -0,0 +1,225 @@
#===============================================================================
# Klein Footprints / WolfPP for Pokémon Essentials
# Give credits if you're using this!
# http://kleinstudio.deviantart.com
#
# bo4p5687 update (v.19)
#===============================================================================
# Fix event comment
def pbEventCommentInput(*args)
parameters = []
list = *args[0].list # Event or event page
elements = *args[1] # Number of elements
trigger = *args[2] # Trigger
return nil if list == nil
return nil unless list.is_a?(Array)
for item in list
next unless item.code == 108 || item.code == 408
if item.parameters[0] == trigger[0]
start = list.index(item) + 1
finish = start + elements[0]
for id in start...finish
next if !list[id]
parameters.push(list[id].parameters[0])
end
return parameters
end
end
return nil
end
module FootprintVariables
# If you set pokemon here, they doesn't have footprints
FOLLOWING_DONT_WALK = [
# Example:
# 12,15,17
]
# Set here the terrain tag for footprints, 3 is sand
TERRAIN_FOOT = 3
# Initial opacity for footprints
FOOT_OPACITY = 62
# Delay velocity
FOOT_DELAY = 1.1
def self.get_new_id
newId = 1
while !$game_map.events[newId].nil? do
break if $game_map.events[newId].erased
newId += 1
end
return newId
end
def self.show(event, position)
if event != $game_player
return if event.character_name == "" || event.character_name == "nil" || event.name.include?("/nofoot/")
return if pbEventCommentInput(event, 0, "NoFoot")
if $Trainer.party.length > 0
return if (!($game_map.events[event] && $game_map.events[event].name == "Dependent") &&
(FOLLOWING_DONT_WALK.include?($Trainer.party[0].species) || $PokemonGlobal.bicycle))
end
end
character_sprites = $scene.spriteset.character_sprites
viewport = $scene.spriteset.viewport1
footsprites = $scene.spriteset.footsprites
nid = self.get_new_id
rpgEvent = RPG::Event.new(position[0], position[1])
rpgEvent.id = nid
fev = Game_Event.new($game_map.map_id, rpgEvent, $game_map)
eventsprite = Sprite_Character.new(viewport, fev)
character_sprites.push(eventsprite)
footsprites.push(Footsprite.new(eventsprite, fev, viewport, $game_map, position[2], nid, character_sprites, (event==$game_player)))
end
end
class Game_Event < Game_Character
attr_reader :erased
end
class Sprite_Character
alias old_initialize_foot initialize
def initialize(viewport, character=nil)
old_initialize_foot(viewport, character)
@disposed = false
end
alias old_update_foot update
def update
return if @disposed
old_update_foot
end
alias old_dispose_foot dispose
def dispose
old_dispose_foot
@disposed = true
end
end
class Spriteset_Map
attr_accessor :character_sprites
attr_accessor :footsprites
alias old_initialize initialize
def initialize(map=nil)
old_initialize(map)
@footsprites = []
end
def viewport1
return @@viewport1
end
def putFootprint(event, pos)
return FootprintVariables.show(event, pos)
end
alias old_dispose dispose
def dispose
old_dispose
@footsprites.each { |sprite| sprite.dispose } if !@footsprites.nil?
@footsprites.clear
end
alias old_update update
def update
old_update
return if @footsprites.nil?
@footsprites.each { |sprite| sprite.update }
end
end
class Scene_Map
def spriteset?
return !@spritesets.nil?
end
end
class Game_Character
def get_last_pos
case direction
when 2 then return [@x, @y-1, direction] # Move down
when 4 then return [@x+1, @y, direction] # Move left
when 6 then return [@x-1, @y, direction] # Move right
when 8 then return [@x, @y+1, direction] # Move up
end
return false
end
def foot_prints?
return $game_map.terrain_tag(get_last_pos[0], get_last_pos[1]) == FootprintVariables::TERRAIN_FOOT && $scene.is_a?(Scene_Map) && $scene.spriteset?
end
alias leave_tile_footprints triggerLeaveTile
def triggerLeaveTile
leave_tile_footprints
$scene.spriteset.putFootprint(self, get_last_pos) if foot_prints?
end
end
class Footsprite
def initialize(sprite,event,viewport,map,direction,nid,chardata,player)
@rsprite = sprite
# Sprite
@sprite = Sprite.new(viewport)
file = player && $PokemonGlobal.bicycle ? "footsetbike.png" : "footset.png"
@sprite.bitmap = RPG::Cache.load_bitmap("Graphics/Pictures/", file)
# Set position
@realwidth = @sprite.bitmap.width/4
@sprite.src_rect.width = @realwidth
@opacity = FootprintVariables::FOOT_OPACITY
setFootset(direction)
# Values
@map = map
@event = event
@disposed = false
@eventid = nid
@viewport = viewport
@chardata = chardata
update
end
def setFootset(direction)
@sprite.src_rect.x =
case direction
when 2 then 0 # Move down
when 4 then @realwidth * 3 # Move left
when 6 then @realwidth * 2 # Move right
when 8 then @realwidth # Move up
end
@sprite.opacity = @opacity
end
def dispose
return if @disposed
@disposed = true
@event.erase
(0...@chardata.length).each { |i| @chardata.delete_at(i) if @chardata[i] == @rsprite }
@rsprite.dispose
@sprite.dispose
@sprite = nil
end
def update
return if @disposed
x = @rsprite.x - @rsprite.ox
y = @rsprite.y - @rsprite.oy
width = @rsprite.src_rect.width
height = @rsprite.src_rect.height
@sprite.x = x + width / 2
@sprite.y = y + height
@sprite.ox = @realwidth / 2
@sprite.oy = @sprite.bitmap.height
@sprite.z = @rsprite.z - 2
@opacity -= FootprintVariables::FOOT_DELAY
@sprite.opacity = @opacity
dispose if @sprite.opacity <= 0
end
end

View File

@@ -70,31 +70,26 @@ BallHandlers::OnCatch.add(:PERFECTBALL,proc{|ball,battle,pokemon|
#DREAMBALL - endormi
BallHandlers::ModifyCatchRate.add(:DREAMBALL,proc{|ball,catchRate,battle,battler|
battler.status = :SLEEP
catchRate = 1
next catchRate
})
#TOXICBALL - empoisonné
BallHandlers::ModifyCatchRate.add(:TOXICBALL,proc{|ball,catchRate,battle,battler|
battler.status = :POISON
catchRate = 1
next catchRate
})
#SCORCHBALL - brulé
BallHandlers::ModifyCatchRate.add(:SCORCHBALL,proc{|ball,catchRate,battle,battler|
battler.status = :BURN
catchRate = 1
next catchRate
})
#FROSTBALL - frozen
BallHandlers::ModifyCatchRate.add(:FROSTBALL,proc{|ball,catchRate,battle,battler|
battler.status = :FROZEN
catchRate = 1
next catchRate
})
#SPARKBALL - paralizé
BallHandlers::ModifyCatchRate.add(:SPARKBALL,proc{|ball,catchRate,battle,battler|
battler.status = :PARALYSIS
catchRate = 1
next catchRate
})
#PUREBALL - marche mieux quand pas de status

Binary file not shown.

Binary file not shown.

Binary file not shown.