pokeradar

This commit is contained in:
infinitefusion
2022-01-02 14:05:29 -05:00
parent 1b0577139c
commit 1b931732a0
17 changed files with 137 additions and 76 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

@@ -6,7 +6,12 @@
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.11 - beta" GAME_VERSION_NUMBER = "5.0.13 - beta"
POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
POKERADAR_HIDDEN_ABILITY_POKE_CHANCE = 32
POKERADAR_BATTERY_STEPS = 0
# #
FUSION_ICON_SPRITE_OFFSET = 10 FUSION_ICON_SPRITE_OFFSET = 10
@@ -310,10 +315,48 @@ module Settings
# * Minimum possible level. # * Minimum possible level.
# * Maximum possible level (optional). # * Maximum possible level (optional).
POKE_RADAR_ENCOUNTERS = [ POKE_RADAR_ENCOUNTERS = [
[5, 20, :STARLY, 12, 15], [78, 30, :FLETCHLING,2,5], #Rt. 1
[21, 10, :STANTLER, 14], [86, 30, :FLETCHLING,2,5], #Rt. 2
[28, 20, :BUTTERFREE, 15, 18], [90, 30, :FLETCHLING,2,5], #Rt. 2
[28, 20, :BEEDRILL, 15, 18] [491, 30, :SHROOMISH,2,5], #Viridian Forest
[490, 30, :BUDEW,4,9], #Rt. 3
[106, 30, :NINCADA,8,10], #Rt. 4
[12, 30, :TOGEPI,10,10], #Rt. 5
[16, 30, :SLAKOTH,12,15], #Rt. 6
[413, 30, :DRIFLOON,17,20], #Rt. 7
[409, 30, :SHINX,17,18], #Rt. 8
[495, 30, :ARON,12,15], #Rt. 9
[351, 30, :ARON,12,15], #Rt. 9
[154, 30, :KLINK,14,17], #Rt. 10
[155, 30, :NINCADA,12,15], #Rt. 11
[159, 30, :COTTONEE,22,25], #Rt. 12
[437, 30, :COTTONEE,22,25], #Rt. 13
[437, 30, :JOLTIK,22,25], #Rt. 13
[440, 30, :JOLTIK,22,25], #Rt. 14
[444, 30, :SOLOSIS,22,25], #Rt. 15
[438, 30, :NATU,22,25], #Rt. 16
[146, 30, :KLEFKI,22,25], #Rt. 17
[517, 30, :FERROSEED,22,25], #Rt. 18
[445, 30, :BAGON,20,20], #Safari zone 1
[484, 30, :AXEW,20,20], #Safari zone 2
[485, 30, :DEINO,20,20], #Safari zone 3
[486, 30, :LARVITAR,20,20], #Safari zone 4
[487, 30, :BELDUM,20,20], #Safari zone 5
[59, 30, :DUNSPARSE,25,30], #Rt. 21
[171, 30, :BIDOOF,2,5], #Rt. 22
[143, 30, :RIOLU,25,25], #Rt. 23
[8, 30, :BUNEARY,12,13], #Rt. 24
[145, 5, :ABSOL,30,35], #Rt. 26
[147, 5, :ABSOL,30,35], #Rt. 27
[311, 30, :BIDOOF,5,5], #Rt. 29
[265, 30, :KIRLIA,25,30], #Rt. 34
[300, 30, :ROSELIA,30,30], #National Park
[300, 30, :BRELOOM,30,30], #Ilex Forest
[670, 30, :WEAVILE,50,50], #Ice mountains
[528, 30, :PYUKUMUKU,20,20], #Treasure Beach
[690, 30, :OCTILLERY,32,45], #Deep Ocean
[561, 30, :MAGMAR,32,45], #Mt. Ember
[654, 30, :WHIMSICOTT,32,45], #Brine Road
] ]
#============================================================================= #=============================================================================

View File

@@ -109,6 +109,9 @@ class PokemonEncounters
# Check if enc_type has a defined step chance/encounter table # Check if enc_type has a defined step chance/encounter table
return false if !@step_chances[enc_type] || @step_chances[enc_type] == 0 return false if !@step_chances[enc_type] || @step_chances[enc_type] == 0
return false if !has_encounter_type?(enc_type) return false if !has_encounter_type?(enc_type)
#Always check encounter if pokeradar is active
return true if $PokemonTemp.pokeradar != nil
# Get base encounter chance and minimum steps grace period # Get base encounter chance and minimum steps grace period
encounter_chance = @step_chances[enc_type].to_f encounter_chance = @step_chances[enc_type].to_f
min_steps_needed = (8 - encounter_chance / 10).clamp(0, 8).to_f min_steps_needed = (8 - encounter_chance / 10).clamp(0, 8).to_f

View File

@@ -2,14 +2,10 @@ class PokemonGlobalMetadata
attr_accessor :pokeradarBattery attr_accessor :pokeradarBattery
end 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)]
end end
################################################################################ ################################################################################
# Using the Poke Radar # Using the Poke Radar
################################################################################ ################################################################################
@@ -44,33 +40,14 @@ end
def pbUsePokeRadar 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 = 50 $PokemonGlobal.pokeradarBattery = Settings::POKERADAR_BATTERY_STEPS
rareAllowed = canEncounterRarePokemon()
playPokeradarLightAnimation(rareAllowed)
pbWait(20)
pbPokeRadarHighlightGrass pbPokeRadarHighlightGrass
return true return true
end end
def pbPokeRadarCancel
$PokemonTemp.pokeradar = nil
end
def listUnseenPokemonInCurrentRoute(encounterType)
processed = []
unseen = []
for encounter in $PokemonEncounters.listPossibleEncounters(encounterType)
species = encounter[0]
if !processed.include?(species)
if $Trainer.seen?(species)
processed<<species
else
unseen<<species
processed<<species
end
end
end
return unseen
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()
processed = [] processed = []
@@ -87,8 +64,46 @@ def canEncounterRarePokemon()
return true return true
end end
def playPokeradarLightAnimation(rareAllowed = false)
if rareAllowed
$scene.spriteset.addUserAnimation(Settings::POKERADAR_LIGHT_ANIMATION_GREEN_ID, $game_player.x, $game_player.y, true)
else
$scene.spriteset.addUserAnimation(Settings::POKERADAR_LIGHT_ANIMATION_RED_ID, $game_player.x, $game_player.y, true)
end
end
def pbPokeRadarCancel
$PokemonTemp.pokeradar = nil
end
def listUnseenPokemonInCurrentRoute(encounterType)
processed = []
unseen = []
for encounter in $PokemonEncounters.listPossibleEncounters(encounterType)
species = encounter[1]
if !processed.include?(species)
if $Trainer.seen?(species)
processed << species
else
unseen << species
processed << species
end
end
end
return unseen
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)
return unseenPokemon.length == 0
end
def pbPokeRadarHighlightGrass(showmessage = true) def pbPokeRadarHighlightGrass(showmessage = true)
grasses = [] # x, y, ring (0-3 inner to outer), rarity grasses = [] # x, y, ring (0-3 inner to outer), rarity§
# Choose 1 random tile from each ring around the player # Choose 1 random tile from each ring around the player
for i in 0...4 for i in 0...4
r = rand((i + 1) * 8) r = rand((i + 1) * 8)
@@ -208,13 +223,15 @@ EncounterModifier.register(proc { |encounter|
end end
pbPokeRadarCancel pbPokeRadarCancel
end end
else # Not chaining; will start one else
# Not chaining; will start one
# Force random wild encounter, vigorous shaking means rarer species # Force random wild encounter, vigorous shaking means rarer species
encounter = pbPokeRadarGetEncounter(rarity) encounter = pbPokeRadarGetEncounter(rarity)
$PokemonTemp.forceSingleBattle = true $PokemonTemp.forceSingleBattle = true
end end
else # Encounter triggered by stepping in non-rustling grass else
pbPokeRadarCancel if encounter # Encounter triggered by stepping in non-rustling grass
pbPokeRadarCancel if encounter && $PokemonGlobal.repel <= 0
end end
next encounter next encounter
}) })

View File

@@ -371,5 +371,3 @@ def reverseFusionSpecies(species)
return getPokemon(newspecies) return getPokemon(newspecies)
end end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.