Update 6.8

This commit is contained in:
chardub
2026-07-10 15:42:06 -04:00
parent 5b85e72cb2
commit 6a6f126a18
7871 changed files with 493194 additions and 224826 deletions
+14 -4
View File
@@ -173,7 +173,8 @@ def pbChangeLevel(pkmn, newlevel, scene)
pbLearnMove(pkmn, i[1], true) { scene.pbUpdate }
end
# Check for evolution
newspecies = pkmn.check_evolution_on_level_up
newspecies = pkmn.check_evolution_on_level_up unless pkmn.evolve_from_party
echoln newspecies
if newspecies
pbFadeOutInWithMusic {
evo = PokemonEvolutionScene.new
@@ -215,6 +216,10 @@ def pbItemRestoreHP(pkmn, restoreHP)
end
def pbHPItem(pkmn, restoreHP, scene)
if $PokemonSystem.no_healing_items_ow
scene.pbDisplay(_INTL("Your challenge options prevent healing!"))
return false
end
if !pkmn.able? || pkmn.hp == pkmn.totalhp
scene.pbDisplay(_INTL("It won't have any effect."))
return false
@@ -226,6 +231,10 @@ def pbHPItem(pkmn, restoreHP, scene)
end
def pbBattleHPItem(pkmn, battler, restoreHP, scene)
if $PokemonSystem.no_healing_items_battles
scene.pbDisplay(_INTL("Your challenge options prevent healing!"))
return false
end
if battler
if battler.pbRecoverHP(restoreHP) > 0
scene.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
@@ -365,7 +374,9 @@ def pbClosestHiddenItem
playerX = $game_player.x
playerY = $game_player.y
for event in $game_map.events.values
next if !event.name[/hiddenitem/i]
next unless event.name.downcase.start_with?("item")
next unless event.active?
next if event.name.include?("Present") && !event.visible?
next if (playerX - event.x).abs >= 8
next if (playerY - event.y).abs >= 6
next if $game_self_switches[[$game_map.map_id, event.id, "A"]]
@@ -542,8 +553,7 @@ def pbUseItem(bag, item, bagscene = nil)
break
end
pkmn = $Trainer.party[chosen]
if
pbCheckUseOnPokemon(item, pkmn, screen)
if pbCheckUseOnPokemon(item, pkmn, screen)
ret = ItemHandlers.triggerUseOnPokemon(item, pkmn, screen)
if ret && useType == 1 # Usable on Pokémon, consumed
bag.pbDeleteItem(item)
+74 -24
View File
@@ -97,7 +97,6 @@ def pbRepel(item, steps)
return 3
end
ItemHandlers::UseInField.add(:FUSIONREPEL, proc { |item|
$game_switches[SWITCH_FORCE_ALL_WILD_FUSIONS] = true
$game_switches[SWITCH_USED_AN_INCENSE] = true
@@ -119,16 +118,16 @@ ItemHandlers::UseInField.add(:MAXREPEL, proc { |item|
Events.onStepTaken += proc {
if $PokemonGlobal.repel > 0 && !$game_player.terrain_tag.ice # Shouldn't count down if on ice
$PokemonGlobal.repel -= 1
if $PokemonGlobal.repel <= 0 && ! $PokemonGlobal.tempRepel
if $PokemonGlobal.repel <= 0 && !$PokemonGlobal.tempRepel
isIncense = $game_switches[SWITCH_USED_AN_INCENSE]
$game_switches[SWITCH_FORCE_ALL_WILD_FUSIONS] = false
$game_switches[SWITCH_USED_AN_INCENSE] = false
itemName= isIncense ? "incense" : "repellent"
itemName = isIncense ? "incense" : "repellent"
if $PokemonBag.pbHasItem?(:REPEL) ||
$PokemonBag.pbHasItem?(:SUPERREPEL) ||
$PokemonBag.pbHasItem?(:MAXREPEL) ||
$PokemonBag.pbHasItem?(:FUSIONREPEL)
if pbConfirmMessage(_INTL("The {1}'s effect wore off! Would you like to use another one?",itemName))
if pbConfirmMessage(_INTL("The {1}'s effect wore off! Would you like to use another one?", itemName))
ret = nil
pbFadeOutIn {
scene = PokemonBag_Scene.new
@@ -140,7 +139,7 @@ Events.onStepTaken += proc {
pbUseItem($PokemonBag, ret) if ret
end
else
pbMessage(_INTL("The {1}'s effect wore off!",itemName))
pbMessage(_INTL("The {1}'s effect wore off!", itemName))
end
end
end
@@ -148,7 +147,7 @@ Events.onStepTaken += proc {
ItemHandlers::UseInField.add(:BLACKFLUTE, proc { |item|
pbUseItemMessage(item)
message = $PokemonMap.blackFluteUsed ? "Wild Pokemon will no longer be repelled.": "Wild Pokémon will be repelled."
message = $PokemonMap.blackFluteUsed ? "Wild Pokemon will no longer be repelled." : "Wild Pokémon will be repelled."
pbMessage(_INTL(message))
$PokemonMap.blackFluteUsed = !$PokemonMap.blackFluteUsed
$PokemonMap.whiteFluteUsed = false
@@ -157,7 +156,7 @@ ItemHandlers::UseInField.add(:BLACKFLUTE, proc { |item|
ItemHandlers::UseInField.add(:WHITEFLUTE, proc { |item|
pbUseItemMessage(item)
message = $PokemonMap.whiteFluteUsed ? "Wild Pokemon will no longer be lured.": "Wild Pokémon will be lured."
message = $PokemonMap.whiteFluteUsed ? "Wild Pokemon will no longer be lured." : "Wild Pokémon will be lured."
pbMessage(_INTL(message))
$PokemonMap.whiteFluteUsed = !$PokemonMap.whiteFluteUsed
$PokemonMap.blackFluteUsed = false
@@ -317,7 +316,7 @@ ItemHandlers::UseInField.add(:ITEMFINDER, proc { |item|
end
pbWait(Graphics.frame_rate * 3 / 10)
pbMessage(_INTL("Huh? The {1}'s responding!\1", GameData::Item.get(item).name))
pbMessage(_INTL("There's an item buried around here!"))
pbMessage(_INTL("There's an item around here!"))
end
end
next 1
@@ -335,17 +334,17 @@ ItemHandlers::UseInField.add(:COINCASE, proc { |item|
next 1
})
ItemHandlers::UseInField.add(:EXPALL, proc { |item|
$PokemonBag.pbChangeItem(:EXPALL, :EXPALLOFF)
pbMessage(_INTL("The Exp Share was turned off."))
next 1
})
ItemHandlers::UseInField.add(:EXPALLOFF, proc { |item|
$PokemonBag.pbChangeItem(:EXPALLOFF, :EXPALL)
pbMessage(_INTL("The Exp Share was turned on."))
next 1
})
# ItemHandlers::UseInField.add(:EXPALL, proc { |item|
# $PokemonBag.pbChangeItem(:EXPALL, :EXPALLOFF)
# pbMessage(_INTL("The Exp Share was turned off."))
# next 1
# })
#
# ItemHandlers::UseInField.add(:EXPALLOFF, proc { |item|
# $PokemonBag.pbChangeItem(:EXPALLOFF, :EXPALL)
# pbMessage(_INTL("The Exp Share was turned on."))
# next 1
# })
#===============================================================================
# UseOnPokemon handlers
@@ -519,6 +518,10 @@ ItemHandlers::UseOnPokemon.add(:FULLRESTORE, proc { |item, pkmn, scene|
})
ItemHandlers::UseOnPokemon.add(:REVIVE, proc { |item, pkmn, scene|
if pkmn.fainted? && $PokemonSystem.no_reviving
scene.pbDisplay(_INTL("Your challenge options prevent you from reviving fainted Pokémon!"))
next false
end
if !pkmn.fainted?
scene.pbDisplay(_INTL("It won't have any effect."))
next false
@@ -788,7 +791,7 @@ ItemHandlers::UseOnPokemon.add(:SWIFTWING, proc { |item, pkmn, scene|
def can_use_rare_candy(pkmn)
return false if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
return false if $PokemonSystem.level_caps==1 && pokemonExceedsLevelCap(pkmn)
return false if $PokemonSystem.level_caps == 1 && pokemonExceedsLevelCap(pkmn)
return true
end
@@ -797,12 +800,60 @@ ItemHandlers::UseOnPokemon.add(:RARECANDY, proc { |item, pkmn, scene|
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
pbSet(VAR_STAT_RARE_CANDY,pbGet(VAR_STAT_RARE_CANDY)+1)
pbSet(VAR_STAT_RARE_CANDY, pbGet(VAR_STAT_RARE_CANDY) + 1)
pbChangeLevel(pkmn, pkmn.level + 1, scene)
scene.pbHardRefresh
next true
})
ItemHandlers::UseOnPokemon.add(:EXPCANDY, proc { |item, pkmn, scene|
if !(can_use_rare_candy(pkmn))
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
quantity = $PokemonBag.pbQuantity(:EXPCANDY)
nb = 1
if quantity > 1
params = ChooseNumberParams.new
params.setRange(1, quantity)
params.setDefaultValue(1)
nb = pbMessageChooseNumber(_INTL("\How many would you like to use?<br>({1} in bag)", quantity), params)
end
item_data = GameData::Item.get(item)
item_name = nb > 1 ? item_data.name_plural : item_data.name
message = _INTL("Use an {1} on {2}?", item_name, pkmn.name)
message = _INTL("Use {1} {2} on {3}?", nb, item_name, pkmn.name) if nb > 1
previous_level = pkmn.level
if pbConfirmMessage(message)
exp = 1000 * nb
pkmn.exp += exp
pkmn.exp_gained_with_player =0 unless pkmn.exp_gained_with_player
echoln pkmn.exp_gained_with_player
pkmn.exp_gained_with_player += exp
echoln pkmn.exp_gained_with_player
pkmn.calc_stats
if pkmn.level != previous_level
pbSEPlay("itemlevel")
pbMessage(_INTL("{1} grew to level {2}!",pkmn.name,pkmn.level))
else
pbMessage(_INTL("{1} gained some experience.",pkmn.name))
end
$PokemonBag.pbDeleteItem(:EXPCANDY, nb -1)
scene.pbHardRefresh
next true
else
next false
end
next false
})
ItemHandlers::UseOnPokemon.add(:POMEGBERRY, proc { |item, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :HP, [
_INTL("{1} adores you! Its base HP fell!", pkmn.name),
@@ -1079,15 +1130,14 @@ ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE, proc { |item, pkmn, scene|
pkmn.ability_index = newabil
pkmn.ability = GameData::Ability.get((newabil == 0) ? abil1 : abil2).id
#pkmn.ability = GameData::Ability.get((newabil == 0) ? abil1 : abil2).id
scene.pbHardRefresh
# pkmn.ability = GameData::Ability.get((newabil == 0) ? abil1 : abil2).id
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!", pkmn.name, newabilname))
next true
end
next false
})
# ItemHandlers::UseInField.add(:REGITABLET, proc { |item|
# pbCommonEvent(COMMON_EVENT_REGI_TABLET)
# next true
@@ -78,6 +78,10 @@ ItemHandlers::CanUseInBattle.add(:POTION,proc { |item,pokemon,battler,move,first
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
next false
end
if $PokemonSystem.no_healing_items_battles
scene.pbDisplay(_INTL("Your challenge options prevent healing!")) if showMessages
next false
end
next true
})
@@ -147,10 +151,18 @@ ItemHandlers::CanUseInBattle.add(:FULLRESTORE,proc { |item,pokemon,battler,move,
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
next false
end
if $PokemonSystem.no_healing_items_battles
scene.pbDisplay(_INTL("Your challenge options prevent healing!")) if showMessages
next false
end
next true
})
ItemHandlers::CanUseInBattle.add(:REVIVE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
if pokemon.fainted? && $PokemonSystem.no_reviving
scene.pbDisplay(_INTL("Your challenge options prevent you from reviving fainted Pokémon!")) if showMessages
next false
end
if pokemon.able? || pokemon.egg?
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
next false
@@ -323,6 +335,8 @@ ItemHandlers::UseInBattle.add(:POKEFLUTE,proc { |item,battler,battle|
ItemHandlers::UseInBattle.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? }, # Poké Balls
proc { |item,battler,battle|
battle.pbThrowPokeBall(battler.index,item)
battle.balls_thrown +=1
echoln battle.balls_thrown
}
)
+15 -1
View File
@@ -1,5 +1,5 @@
class PokeRadar_UI
attr_reader :sprites
attr_accessor :sprites
attr_reader :disposed
ICON_START_X = 50
@@ -34,6 +34,20 @@ class PokeRadar_UI
displayRare()
end
def set_text(text,x,y,baseColor=nil,shadowColor=nil)
baseColor = pbColor(:DARK_TEXT_MAIN_COLOR) unless baseColor
shadowColor = pbColor(:DARK_TEXT_SHADOW_COLOR) unless shadowColor
@sprites["text"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
@sprites["text"].x=x
@sprites["text"].y=y
pbSetSystemFont(@sprites["text"].bitmap)
#@sprites["text"].bitmap.font.size=26
pbDrawShadowText(@sprites["text"].bitmap,x,y,-1,-1, text,baseColor,shadowColor)
end
def set_background_visible(value)
@sprites["background"].visible = value
end
def dispose
pbDisposeSpriteHash(@sprites)
@viewport.dispose if @viewport != nil
+2 -2
View File
@@ -285,7 +285,7 @@ end
# The phone call itself
#===============================================================================
def pbPhoneCall(call,phonenum)
pbMessage("......\\wt[5] ......\\1")
pbMessage(_INTL("......\\wt[5] ......") + "\\1")
encspecies = pbEncounterSpecies(phonenum)
trainerspecies = pbTrainerSpecies(phonenum)
trainermap = pbTrainerMapName(phonenum)
@@ -298,5 +298,5 @@ def pbPhoneCall(call,phonenum)
messages[i] += "\\1" if i<messages.length-1
pbMessage(messages[i])
end
pbMessage("Click!\\wt[10]\n......\\wt[5] ......\\1")
pbMessage(_INTL("Click!\\wt[10]\n......\\wt[5] ......") + "\\1")
end
+74 -23
View File
@@ -35,11 +35,11 @@ def pbCanUsePokeRadar?
# Debug
return true if $DEBUG && Input.press?(Input::CTRL)
# Can't use Radar if it isn't fully charged
if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery > 0
pbMessage(_INTL("The battery has run dry!\nFor it to recharge, you need to walk another {1} steps.",
$PokemonGlobal.pokeradarBattery))
return false
end
# if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery > 0
# pbMessage(_INTL("The battery has run dry!\nFor it to recharge, you need to walk another {1} steps.",
# $PokemonGlobal.pokeradarBattery))
# return false
# end
return true
end
@@ -56,8 +56,8 @@ def pbUsePokeRadar
pbWait(20)
pbPokeRadarHighlightGrass
if $PokemonGlobal.repel <= 0
$PokemonGlobal.repel=10
$PokemonGlobal.tempRepel=true
$PokemonGlobal.repel = 10
$PokemonGlobal.tempRepel = true
end
return true
end
@@ -106,9 +106,9 @@ end
def pbPokeRadarCancel
if $PokemonGlobal.tempRepel
$PokemonGlobal.repel=0
$PokemonGlobal.repel = 0
end
$PokemonGlobal.tempRepel=false
$PokemonGlobal.tempRepel = false
if $PokemonTemp.pokeradar_ui != nil
$PokemonTemp.pokeradar_ui.dispose
@@ -117,14 +117,12 @@ def pbPokeRadarCancel
$PokemonTemp.pokeradar = nil
end
def listPokemonInCurrentRoute(encounterType, onlySeen = false, onlyUnseen = false)
def listPokemonInCurrentRoute(encounterType, onlySeen = false, onlyUnseen = false, include_weather = false)
return [] if encounterType == nil
processed = []
seen = []
unseen = []
for encounter in $PokemonEncounters.listPossibleEncounters(encounterType)
for encounter in $PokemonEncounters.listPossibleEncounters(encounterType, include_weather)
species = $game_switches[SWITCH_RANDOM_WILD] && !$game_switches[SWITCH_RANDOM_WILD_AREA] ? getRandomizedTo(encounter[1]) : encounter[1]
if !processed.include?(species)
@@ -146,7 +144,7 @@ def listPokemonInCurrentRoute(encounterType, onlySeen = false, onlyUnseen = fals
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(unseenPokemon)
terrain = $game_map.terrain_tag($game_player.x, $game_player.y)
return unseenPokemon.length == 0 &&
@@ -155,6 +153,35 @@ def canEncounterRarePokemon(unseenPokemon)
terrain.shows_grass_rustle
end
def getTerrainTilesNearPlayer(terrainType, min_distance_from_player = 2, max_distance_from_player = 10, max_attempts = 5)
tiles = []
px = $game_player.x
py = $game_player.y
# Scan square area around player
for x in (px - max_distance_from_player)..(px + max_distance_from_player)
for y in (py - max_distance_from_player)..(py + max_distance_from_player)
next unless $game_map.OWPokemonPassable?(x, y, DIRECTION_ALL)
next if x == px && y == py
# Manhattan distance (PokéRadar-style ring)
distance = (x - px).abs + (y - py).abs
next if distance < min_distance_from_player
next if distance > max_distance_from_player
# Check terrain
terrain = $game_map.terrain_tag(x, y)
if terrainType == :Grass
tiles << [x, y] if terrain.land_wild_encounters
elsif terrainType == :Water
tiles << [x, y] if terrain.can_surf
else
tiles << [x, y]
end
end
end
return tiles
end
def pbPokeRadarHighlightGrass(showmessage = true)
grasses = [] # x, y, ring (0-3 inner to outer), rarity§
# Choose 1 random tile from each ring around the player
@@ -181,7 +208,8 @@ def pbPokeRadarHighlightGrass(showmessage = true)
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
s = (rand(100) < 25) ? 1 : 0
if $PokemonTemp.pokeradar && $PokemonTemp.pokeradar[2] > 0
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - $PokemonTemp.pokeradar[2] * 200, 200].max
chain_for_odds = [$PokemonTemp.pokeradar[2], 40].min
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - chain_for_odds * 200, 200].max
v = 0xFFFF / v
v = rand(65536) / v
s = 2 if v == 0
@@ -212,6 +240,7 @@ def pbPokeRadarHighlightGrass(showmessage = true)
end
def pbPokeRadarGetShakingGrass
return -1 if $PokemonSystem.overworld_encounters
return -1 if !$PokemonTemp.pokeradar
grasses = $PokemonTemp.pokeradar[3]
return -1 if grasses.length == 0
@@ -222,6 +251,7 @@ def pbPokeRadarGetShakingGrass
end
def pbPokeRadarOnShakingGrass
return false if $PokemonSystem.overworld_encounters
return pbPokeRadarGetShakingGrass >= 0
end
@@ -235,7 +265,7 @@ def pbPokeRadarGetEncounter(rarity = 0)
array.push(enc) if enc[0] == map && GameData::Species.exists?(enc[2])
end
# If there are any exclusives, first have a chance of encountering those
if array.length > 0 && listPokemonInCurrentRoute($PokemonEncounters.encounter_type, false, true).length==0
if array.length > 0 && listPokemonInCurrentRoute($PokemonEncounters.encounter_type, false, true).length == 0
rnd = rand(100)
array.each do |enc|
rnd -= enc[1]
@@ -253,6 +283,7 @@ end
# Event handlers
################################################################################
EncounterModifier.register(proc { |encounter|
next encounter if Settings::HOENN
if GameData::EncounterType.get($PokemonTemp.encounterType).type != :land ||
$PokemonGlobal.partner # $PokemonGlobal.bicycle || $PokemonGlobal.partner
pbPokeRadarCancel
@@ -284,21 +315,27 @@ EncounterModifier.register(proc { |encounter|
end
else
# Encounter triggered by stepping in non-rustling grass
pbPokeRadarCancel if encounter && $PokemonGlobal.repel <= 0
pbPokeRadarCancel if encounter && $PokemonGlobal.repel <= 0
end
next encounter
})
Events.onWildPokemonCreate += proc { |_sender, e|
pokemon = e[0]
next if Settings::HOENN # pokeradar shininess is handled in spawn_pokeradar_pokemon for pokenav pokeradar
next if !$PokemonTemp.pokeradar
grasses = $PokemonTemp.pokeradar[3]
next if !grasses
for grass in grasses
next if $game_player.x != grass[0] || $game_player.y != grass[1]
pokemon.shiny = true if grass[3] == 2
break
if grass[3] == 2
pokemon.shiny = true
pokemon.debug_shiny = false
pokemon.radar_shiny = true
end
end
}
Events.onWildBattleEnd += proc { |_sender, e|
@@ -306,11 +343,24 @@ Events.onWildBattleEnd += proc { |_sender, e|
level = e[1]
decision = e[2]
if $PokemonTemp.pokeradar && (decision == 1 || decision == 4) # Defeated/caught
$PokemonTemp.pokeradar[0] = species
$PokemonTemp.pokeradar[1] = level
$PokemonTemp.pokeradar[2] += 1
$PokemonTemp.pokeradar[2] = 40 if $PokemonTemp.pokeradar[2] > 40
pbPokeRadarHighlightGrass(false)
if Settings::HOENN
pokeradar_species = $PokemonTemp.pokeradar[0]
else
pokeradar_species = species
end
if species == pokeradar_species
$PokemonTemp.pokeradar[0] = species
$PokemonTemp.pokeradar[1] = level
$PokemonTemp.pokeradar[2] += 1
if Settings::HOENN
continue_pokeradar_app_chain
else
$PokemonTemp.pokeradar[2] = 40 if $PokemonTemp.pokeradar[2] > 40
pbPokeRadarHighlightGrass(false)
end
else
pbPokeRadarCancel
end
else
pbPokeRadarCancel
end
@@ -321,6 +371,7 @@ Events.onStepTaken += proc { |_sender, _e|
!$PokemonTemp.pokeradar
$PokemonGlobal.pokeradarBattery -= 1
end
next if $PokemonSystem.overworld_encounters
terrain = $game_map.terrain_tag($game_player.x, $game_player.y)
if !terrain.land_wild_encounters || !terrain.shows_grass_rustle
pbPokeRadarCancel
+63 -1
View File
@@ -44,10 +44,17 @@ class PokemonBag
end
end
def sort_pocket_alphabetically()
current_pocket = @pockets[@lastpocket]
sorted = current_pocket.sort_by do |item|
GameData::Item.get(item[0]).name
item_data = GameData::Item.get(item[0])
if item_data.is_machine?
name= GameData::Move.get(item_data.move).real_name
else
name = item_data.name
end
next name
end
sorted.reverse! if @descending_sort
@@ -68,6 +75,61 @@ class PokemonBag
@pockets[@lastpocket] = sorted
end
def sort_pocket_by_tm_number()
current_pocket = @pockets[@lastpocket]
sorted = current_pocket.sort_by do |item|
item_name = item[0].to_s
match = item_name.match(/\A([A-Z]+)(\d+)/)
if match
prefix = match[1] # "HM" or "TM"
tm_number = match[2].to_i # 24
group_priority = (prefix == "HM") ? 1 : 2
if @descending_sort
[group_priority, -tm_number, item_name]
else
[group_priority, tm_number, item_name]
end
else
[3, 0, item_name]
end
end
@descending_sort = !@descending_sort
@pockets[@lastpocket] = sorted
end
def sort_pocket_by_move_type()
current_pocket = @pockets[@lastpocket]
sorted = current_pocket.sort_by do |item|
item_id = item.is_a?(Array) ? item[0] : item
item_data = GameData::Item.get(item_id)
type_name = "zzzz" # so that it goes at the end
move_power = 0
if item_data.is_machine?
move = GameData::Move.get(item_data.move)
move_type = move.type
move_power = move.base_damage || 0
type_name = GameData::Type.get(move_type).real_name
end
if @descending_sort
is_machine = item_data.is_machine? ? 0 : 1
inverted_chars = type_name.chars.map { |c| -c.ord }
[is_machine, inverted_chars, move_power, item_id.to_s]
else
is_machine = item_data.is_machine? ? 0 : 1
[is_machine, type_name, move_power, item_id.to_s]
end
end
@descending_sort = !@descending_sort
@pockets[@lastpocket] = sorted
end
def sort_pocket_by_last_used()
end