mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
pokeradar
This commit is contained in:
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.
@@ -6,7 +6,7 @@
|
||||
module Settings
|
||||
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
|
||||
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_GREEN_ID = 18
|
||||
|
||||
@@ -353,7 +353,6 @@ end
|
||||
#===============================================================================
|
||||
class IconSprite < SpriteWrapper
|
||||
attr_reader :name
|
||||
|
||||
def initialize(*args)
|
||||
if args.length == 0
|
||||
super(nil)
|
||||
@@ -395,6 +394,10 @@ class IconSprite < SpriteWrapper
|
||||
self.src_rect = oldrc
|
||||
end
|
||||
|
||||
def setColor(r = 0, g = 0, b = 0, a = 255)
|
||||
@_iconbitmap.pbSetColor(r,g,b,a)
|
||||
end
|
||||
|
||||
# Sets the icon's filename.
|
||||
def setBitmap(file, hue = 0)
|
||||
oldrc = self.src_rect
|
||||
@@ -427,6 +430,8 @@ class IconSprite < SpriteWrapper
|
||||
self.src_rect = oldrc
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -125,6 +125,10 @@ module GameData
|
||||
return self.icon_filename(pkmn.species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?, pkmn.egg?)
|
||||
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)
|
||||
filename = self.egg_icon_filename(species, form)
|
||||
return (filename) ? AnimatedBitmap.new(filename).deanimate : nil
|
||||
|
||||
98
Data/Scripts/013_Items/004_1_PokeradarUI.rb
Normal file
98
Data/Scripts/013_Items/004_1_PokeradarUI.rb
Normal 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
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ end
|
||||
|
||||
class PokemonTemp
|
||||
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
|
||||
|
||||
################################################################################
|
||||
@@ -22,10 +24,10 @@ def pbCanUsePokeRadar?
|
||||
return false
|
||||
end
|
||||
# Can't use Radar while cycling
|
||||
if $PokemonGlobal.bicycle
|
||||
pbMessage(_INTL("Can't use that while on a bicycle."))
|
||||
return false
|
||||
end
|
||||
# if $PokemonGlobal.bicycle
|
||||
# pbMessage(_INTL("Can't use that while on a bicycle."))
|
||||
# return false
|
||||
# end
|
||||
# Debug
|
||||
return true if $DEBUG && Input.press?(Input::CTRL)
|
||||
# Can't use Radar if it isn't fully charged
|
||||
@@ -41,29 +43,44 @@ def pbUsePokeRadar
|
||||
return false if !pbCanUsePokeRadar?
|
||||
$PokemonTemp.pokeradar = [0, 0, 0, []] if !$PokemonTemp.pokeradar
|
||||
$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)
|
||||
pbWait(20)
|
||||
pbPokeRadarHighlightGrass
|
||||
return true
|
||||
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
|
||||
def listPokeradarRareEncounters()
|
||||
map = $game_map.map_id
|
||||
array = []
|
||||
Settings::POKE_RADAR_ENCOUNTERS.each do |enc|
|
||||
if enc[0] == map
|
||||
species = enc[2]
|
||||
array.push(species)
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
return array
|
||||
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)
|
||||
if rareAllowed
|
||||
$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
|
||||
|
||||
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
|
||||
if $PokemonTemp.pokeradar_ui != nil
|
||||
$PokemonTemp.pokeradar_ui.dispose
|
||||
$PokemonTemp.pokeradar_ui=nil
|
||||
end
|
||||
$PokemonTemp.pokeradar = nil
|
||||
end
|
||||
|
||||
def listUnseenPokemonInCurrentRoute(encounterType)
|
||||
def listPokemonInCurrentRoute(encounterType, onlySeen = false, onlyUnseen = false)
|
||||
processed = []
|
||||
seen = []
|
||||
unseen = []
|
||||
for encounter in $PokemonEncounters.listPossibleEncounters(encounterType)
|
||||
species = encounter[1]
|
||||
if !processed.include?(species)
|
||||
if $Trainer.seen?(species)
|
||||
seen << species
|
||||
processed << species
|
||||
else
|
||||
unseen << species
|
||||
@@ -90,15 +119,17 @@ def listUnseenPokemonInCurrentRoute(encounterType)
|
||||
end
|
||||
end
|
||||
end
|
||||
if onlySeen
|
||||
return seen
|
||||
elsif onlyUnseen
|
||||
return unseen
|
||||
else
|
||||
return processed
|
||||
end
|
||||
end
|
||||
|
||||
#can only encounter rare if have seen every encounterable land pokemon on the route
|
||||
def canEncounterRarePokemon()
|
||||
return true
|
||||
|
||||
#pokedex register seen doesn't work correctly so temporarily removed
|
||||
unseenPokemon = listUnseenPokemonInCurrentRoute($PokemonEncounters.encounter_type)
|
||||
def canEncounterRarePokemon(unseenPokemon)
|
||||
return unseenPokemon.length == 0
|
||||
end
|
||||
|
||||
@@ -201,7 +232,7 @@ end
|
||||
################################################################################
|
||||
EncounterModifier.register(proc { |encounter|
|
||||
if GameData::EncounterType.get($PokemonTemp.encounterType).type != :land ||
|
||||
$PokemonGlobal.bicycle || $PokemonGlobal.partner
|
||||
$PokemonGlobal.partner # $PokemonGlobal.bicycle || $PokemonGlobal.partner
|
||||
pbPokeRadarCancel
|
||||
next encounter
|
||||
end
|
||||
|
||||
@@ -130,6 +130,10 @@ class PokemonIconSprite < SpriteWrapper
|
||||
super(@logical_y + @adjusted_y)
|
||||
end
|
||||
|
||||
def animBitmap=(value)
|
||||
@animBitmap = value
|
||||
end
|
||||
|
||||
def pokemon=(value)
|
||||
@pokemon = value
|
||||
@animBitmap.dispose if @animBitmap
|
||||
|
||||
@@ -284,7 +284,7 @@ class PokemonLoadScreen
|
||||
cmd_debug = -1
|
||||
cmd_quit = -1
|
||||
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
|
||||
commands[cmd_continue = commands.length] = _INTL('Continue')
|
||||
if @save_data[:player].mystery_gift_unlocked
|
||||
|
||||
@@ -301,7 +301,7 @@ end
|
||||
def pbUseKeyItem
|
||||
moves = [:CUT, :DEFOG, :DIG, :DIVE, :FLASH, :FLY, :HEADBUTT, :ROCKCLIMB,
|
||||
:ROCKSMASH, :SECRETPOWER, :STRENGTH, :SURF, :SWEETSCENT, :TELEPORT,
|
||||
:WATERFALL, :WHIRLPOOL]
|
||||
:WATERFALL, :WHIRLPOOL, :BOUNCE]
|
||||
real_moves = []
|
||||
moves.each do |move|
|
||||
$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.
Reference in New Issue
Block a user