pokeradar

This commit is contained in:
infinitefusion
2022-04-18 15:26:38 -04:00
parent 540adf4760
commit f473ab3cc2
29 changed files with 171 additions and 29 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.

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

@@ -6,7 +6,7 @@
module Settings module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format. # The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '5.0.0' GAME_VERSION = '5.0.0'
GAME_VERSION_NUMBER = "5.0.18.1 - beta" GAME_VERSION_NUMBER = "5.0.19 - beta"
POKERADAR_LIGHT_ANIMATION_RED_ID = 17 POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18 POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18

View File

@@ -353,7 +353,6 @@ end
#=============================================================================== #===============================================================================
class IconSprite < SpriteWrapper class IconSprite < SpriteWrapper
attr_reader :name attr_reader :name
def initialize(*args) def initialize(*args)
if args.length == 0 if args.length == 0
super(nil) super(nil)
@@ -395,6 +394,10 @@ class IconSprite < SpriteWrapper
self.src_rect = oldrc self.src_rect = oldrc
end end
def setColor(r = 0, g = 0, b = 0, a = 255)
@_iconbitmap.pbSetColor(r,g,b,a)
end
# Sets the icon's filename. # Sets the icon's filename.
def setBitmap(file, hue = 0) def setBitmap(file, hue = 0)
oldrc = self.src_rect oldrc = self.src_rect
@@ -427,6 +430,8 @@ class IconSprite < SpriteWrapper
self.src_rect = oldrc self.src_rect = oldrc
end end
end end
end end
#=============================================================================== #===============================================================================

View File

@@ -125,6 +125,10 @@ module GameData
return self.icon_filename(pkmn.species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?, pkmn.egg?) return self.icon_filename(pkmn.species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?, pkmn.egg?)
end end
def self.icon_filename_from_species(species)
return self.icon_filename(species, 0, 0, false, false, false)
end
def self.egg_icon_bitmap(species, form) def self.egg_icon_bitmap(species, form)
filename = self.egg_icon_filename(species, form) filename = self.egg_icon_filename(species, form)
return (filename) ? AnimatedBitmap.new(filename).deanimate : nil return (filename) ? AnimatedBitmap.new(filename).deanimate : nil

View File

@@ -0,0 +1,98 @@
class PokeRadar_UI
attr_reader :sprites
attr_reader :disposed
ICON_START_X = 50
ICON_START_Y = 5
ICON_MARGIN_X = 50
ICON_MARGIN_Y = 50
ICON_LINE_END = 450
def initialize(seenPokemon = [], unseenPokemon = [], rarePokemon = [])
@seen_pokemon = seenPokemon
@unseen_pokemon = unseenPokemon
@rare_pokemon = rarePokemon
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99
@sprites = {}
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@sprites["background"].setBitmap("Graphics/Pictures/Pokeradar/banner")
@sprites["background"].zoom_x = 2
@sprites["background"].zoom_y = 2
@sprites["background"].visible = true
@current_x = 50
@current_y = 0
displaySeen()
displayUnseen()
displayRare()
end
def dispose
pbDisposeSpriteHash(@sprites)
@viewport.dispose if @viewport != nil
end
#display rare with a (circle?) under the sprite to highlight it
# blacken if not seen
def displayRare()
@rare_pokemon.each { |pokemon|
blackened = !$Trainer.seen?(pokemon)
addPokemonIcon(pokemon,blackened,true)
}
end
def displaySeen()
@seen_pokemon.each { |pokemonId|
addPokemonIcon(pokemonId, false )
}
end
def displayUnseen()
@unseen_pokemon.each { |pokemonId|
addPokemonIcon(pokemonId, true)
}
end
def addPokemonIcon(pokemonId, blackened = false, rare=false)
iconId = _INTL("icon{1}", pokemonId)
pokemonBitmap = pbCheckPokemonIconFiles(getDexNumberForSpecies(pokemonId))
if rare
outlineSprite = IconSprite.new(@current_x, @current_y)
outlineSprite.setBitmap("Graphics/Pictures/Pokeradar/highlight")
outlineSprite.visible=true
@sprites[iconId + "_outline"] = outlineSprite
end
iconSprite = IconSprite.new(@current_x, @current_y)
iconSprite.setBitmap(pokemonBitmap)
@sprites[iconId] = iconSprite
@sprites[iconId].src_rect.width /= 2
if blackened
@sprites[iconId].setColor(0,0,0,200)
end
@sprites[iconId].visible = true
@sprites[iconId].x = @current_x
@sprites[iconId].y = @current_y
@sprites[iconId].z = 100
@current_x += ICON_MARGIN_X
if @current_x >= ICON_LINE_END
@current_x = ICON_START_X
@current_y +=ICON_MARGIN_Y
@sprites["background"].zoom_y += 1
end
end
end

View File

@@ -4,6 +4,8 @@ end
class PokemonTemp class PokemonTemp
attr_accessor :pokeradar # [species, level, chain count, grasses (x,y,ring,rarity)] attr_accessor :pokeradar # [species, level, chain count, grasses (x,y,ring,rarity)]
attr_accessor :pokeradar_ui # [species, level, chain count, grasses (x,y,ring,rarity)]
end end
################################################################################ ################################################################################
@@ -22,10 +24,10 @@ def pbCanUsePokeRadar?
return false return false
end end
# Can't use Radar while cycling # Can't use Radar while cycling
if $PokemonGlobal.bicycle # if $PokemonGlobal.bicycle
pbMessage(_INTL("Can't use that while on a bicycle.")) # pbMessage(_INTL("Can't use that while on a bicycle."))
return false # return false
end # end
# Debug # Debug
return true if $DEBUG && Input.press?(Input::CTRL) return true if $DEBUG && Input.press?(Input::CTRL)
# Can't use Radar if it isn't fully charged # Can't use Radar if it isn't fully charged
@@ -41,29 +43,44 @@ def pbUsePokeRadar
return false if !pbCanUsePokeRadar? return false if !pbCanUsePokeRadar?
$PokemonTemp.pokeradar = [0, 0, 0, []] if !$PokemonTemp.pokeradar $PokemonTemp.pokeradar = [0, 0, 0, []] if !$PokemonTemp.pokeradar
$PokemonGlobal.pokeradarBattery = Settings::POKERADAR_BATTERY_STEPS $PokemonGlobal.pokeradarBattery = Settings::POKERADAR_BATTERY_STEPS
rareAllowed = canEncounterRarePokemon() unseenPokemon = listPokemonInCurrentRoute($PokemonEncounters.encounter_type, false, true)
seenPokemon = listPokemonInCurrentRoute($PokemonEncounters.encounter_type, true, false)
rareAllowed = canEncounterRarePokemon(unseenPokemon)
displayPokeradarBanner(seenPokemon, unseenPokemon, rareAllowed)
playPokeradarLightAnimation(rareAllowed) playPokeradarLightAnimation(rareAllowed)
pbWait(20) pbWait(20)
pbPokeRadarHighlightGrass pbPokeRadarHighlightGrass
return true return true
end end
#can only encounter rare if have seen every encounterable land pokemon on the route def listPokeradarRareEncounters()
def canEncounterRarePokemon() map = $game_map.map_id
processed = [] array = []
for encounter in $PokemonEncounters.listPossibleEncounters($PokemonEncounters.pbEncounterType) Settings::POKE_RADAR_ENCOUNTERS.each do |enc|
species = encounter[0] if enc[0] == map
if !processed.include?(species) species = enc[2]
if $Trainer.seen[species] array.push(species)
processed << species
else
return false
end
end end
end end
return true return array
end end
# #can only encounter rare if have seen every encounterable land pokemon on the route
# def canEncounterRarePokemon()
# processed = []
# for encounter in $PokemonEncounters.listPossibleEncounters($PokemonEncounters.pbEncounterType)
# species = encounter[0]
# if !processed.include?(species)
# if $Trainer.seen[species]
# processed << species
# else
# return false
# end
# end
# end
# return true
# end
def playPokeradarLightAnimation(rareAllowed = false) def playPokeradarLightAnimation(rareAllowed = false)
if rareAllowed if rareAllowed
$scene.spriteset.addUserAnimation(Settings::POKERADAR_LIGHT_ANIMATION_GREEN_ID, $game_player.x, $game_player.y, true) $scene.spriteset.addUserAnimation(Settings::POKERADAR_LIGHT_ANIMATION_GREEN_ID, $game_player.x, $game_player.y, true)
@@ -72,17 +89,29 @@ def playPokeradarLightAnimation(rareAllowed = false)
end end
end end
def displayPokeradarBanner(seenPokemon = [], unseenPokemon = [], includeRare = false)
return if $PokemonTemp.pokeradar_ui !=nil
rarePokemon = includeRare ? listPokeradarRareEncounters() : []
$PokemonTemp.pokeradar_ui = PokeRadar_UI.new(seenPokemon, unseenPokemon, rarePokemon)
end
def pbPokeRadarCancel def pbPokeRadarCancel
if $PokemonTemp.pokeradar_ui != nil
$PokemonTemp.pokeradar_ui.dispose
$PokemonTemp.pokeradar_ui=nil
end
$PokemonTemp.pokeradar = nil $PokemonTemp.pokeradar = nil
end end
def listUnseenPokemonInCurrentRoute(encounterType) def listPokemonInCurrentRoute(encounterType, onlySeen = false, onlyUnseen = false)
processed = [] processed = []
seen = []
unseen = [] unseen = []
for encounter in $PokemonEncounters.listPossibleEncounters(encounterType) for encounter in $PokemonEncounters.listPossibleEncounters(encounterType)
species = encounter[1] species = encounter[1]
if !processed.include?(species) if !processed.include?(species)
if $Trainer.seen?(species) if $Trainer.seen?(species)
seen << species
processed << species processed << species
else else
unseen << species unseen << species
@@ -90,15 +119,17 @@ def listUnseenPokemonInCurrentRoute(encounterType)
end end
end end
end end
return unseen if onlySeen
return seen
elsif onlyUnseen
return unseen
else
return processed
end
end end
#can only encounter rare if have seen every encounterable land pokemon on the route #can only encounter rare if have seen every encounterable land pokemon on the route
def canEncounterRarePokemon() def canEncounterRarePokemon(unseenPokemon)
return true
#pokedex register seen doesn't work correctly so temporarily removed
unseenPokemon = listUnseenPokemonInCurrentRoute($PokemonEncounters.encounter_type)
return unseenPokemon.length == 0 return unseenPokemon.length == 0
end end
@@ -201,7 +232,7 @@ end
################################################################################ ################################################################################
EncounterModifier.register(proc { |encounter| EncounterModifier.register(proc { |encounter|
if GameData::EncounterType.get($PokemonTemp.encounterType).type != :land || if GameData::EncounterType.get($PokemonTemp.encounterType).type != :land ||
$PokemonGlobal.bicycle || $PokemonGlobal.partner $PokemonGlobal.partner # $PokemonGlobal.bicycle || $PokemonGlobal.partner
pbPokeRadarCancel pbPokeRadarCancel
next encounter next encounter
end end

View File

@@ -130,6 +130,10 @@ class PokemonIconSprite < SpriteWrapper
super(@logical_y + @adjusted_y) super(@logical_y + @adjusted_y)
end end
def animBitmap=(value)
@animBitmap = value
end
def pokemon=(value) def pokemon=(value)
@pokemon = value @pokemon = value
@animBitmap.dispose if @animBitmap @animBitmap.dispose if @animBitmap

View File

@@ -284,7 +284,7 @@ class PokemonLoadScreen
cmd_debug = -1 cmd_debug = -1
cmd_quit = -1 cmd_quit = -1
show_continue = !@save_data.empty? show_continue = !@save_data.empty?
new_game_plus = @save_data[:player].new_game_plus_unlocked new_game_plus = show_continue && @save_data[:player].new_game_plus_unlocked
if show_continue if show_continue
commands[cmd_continue = commands.length] = _INTL('Continue') commands[cmd_continue = commands.length] = _INTL('Continue')
if @save_data[:player].mystery_gift_unlocked if @save_data[:player].mystery_gift_unlocked

View File

@@ -301,7 +301,7 @@ end
def pbUseKeyItem def pbUseKeyItem
moves = [:CUT, :DEFOG, :DIG, :DIVE, :FLASH, :FLY, :HEADBUTT, :ROCKCLIMB, moves = [:CUT, :DEFOG, :DIG, :DIVE, :FLASH, :FLY, :HEADBUTT, :ROCKCLIMB,
:ROCKSMASH, :SECRETPOWER, :STRENGTH, :SURF, :SWEETSCENT, :TELEPORT, :ROCKSMASH, :SECRETPOWER, :STRENGTH, :SURF, :SWEETSCENT, :TELEPORT,
:WATERFALL, :WHIRLPOOL] :WATERFALL, :WHIRLPOOL, :BOUNCE]
real_moves = [] real_moves = []
moves.each do |move| moves.each do |move|
$Trainer.pokemon_party.each_with_index do |pkmn, i| $Trainer.pokemon_party.each_with_index do |pkmn, i|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.