Removed support for ID numbers in species/item/trainer graphics filenames

This commit is contained in:
Maruno17
2021-02-07 15:06:21 +00:00
parent eda301b57b
commit 6bf749d3f3
11 changed files with 21 additions and 72 deletions

View File

@@ -361,12 +361,13 @@ def pbOnStepTaken(eventTriggered)
$PokemonGlobal.stepcount = 0 if !$PokemonGlobal.stepcount
$PokemonGlobal.stepcount += 1
$PokemonGlobal.stepcount &= 0x7FFFFFFF
repel_active = ($PokemonGlobal.repel > 0)
Events.onStepTaken.trigger(nil)
# Events.onStepTakenFieldMovement.trigger(nil,$game_player)
handled = [nil]
Events.onStepTakenTransferPossible.trigger(nil,handled)
return if handled[0]
pbBattleOnStepTaken if !eventTriggered && !$game_temp.in_menu
pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu
$PokemonTemp.encounterTriggered = false # This info isn't needed here
end
@@ -375,7 +376,7 @@ Events.onChangeDirection += proc {
pbBattleOnStepTaken if !$game_temp.in_menu
}
def pbBattleOnStepTaken
def pbBattleOnStepTaken(repel_active)
return if $Trainer.able_pokemon_count == 0
return if !$PokemonEncounters.encounter_possible_here?
encounterType = $PokemonEncounters.encounter_type
@@ -384,7 +385,7 @@ def pbBattleOnStepTaken
$PokemonTemp.encounterType = encounterType
encounter = $PokemonEncounters.choose_wild_pokemon(encounterType)
encounter = EncounterModifier.trigger(encounter)
if $PokemonEncounter.allow_encounter?(encounter)
if $PokemonEncounter.allow_encounter?(encounter, repel_active)
if $PokemonEncounter.have_double_wild_battle?
encounter2 = $PokemonEncounters.choose_wild_pokemon(encounterType)
encounter2 = EncounterModifier.trigger(encounter2)

View File

@@ -132,15 +132,11 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
##### Tweaked by Maruno #####
if (battletype==1 || battletype==3) && foe.length==1 # Against single trainer
tr_type = foe[0].trainer_type
tr_type_id = GameData::TrainerType.get(tr_type).id_number
if tr_type
tbargraphic = sprintf("Graphics/Transitions/vsBar_%s", tr_type.to_s) rescue nil
tbargraphic = sprintf("Graphics/Transitions/vsBar_%d", tr_type_id) if !pbResolveBitmap(tbargraphic)
tgraphic = sprintf("Graphics/Transitions/vsTrainer_%s", tr_type.to_s) rescue nil
tgraphic = sprintf("Graphics/Transitions/vsTrainer_%d", tr_type_id) if !pbResolveBitmap(tgraphic)
if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic)
player_tr_type = $Trainer.trainer_type
player_tr_type_id = GameData::TrainerType.get(player_tr_type).id_number
outfit = $Trainer.outfit
# Set up
viewplayer = Viewport.new(0,Graphics.height/3,Graphics.width/2,128)
@@ -157,10 +153,8 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
overlay.bitmap = Bitmap.new(Graphics.width,Graphics.height)
pbSetSystemFont(overlay.bitmap)
pbargraphic = sprintf("Graphics/Transitions/vsBar_%s_%d", player_tr_type.to_s, outfit) rescue nil
pbargraphic = sprintf("Graphics/Transitions/vsBar_%d_%d", player_tr_type_id, outfit) if !pbResolveBitmap(pbargraphic)
if !pbResolveBitmap(pbargraphic)
pbargraphic = sprintf("Graphics/Transitions/vsBar_%s", player_tr_type.to_s) rescue nil
pbargraphic = sprintf("Graphics/Transitions/vsBar_%d", player_tr_type_id) if !pbResolveBitmap(pbargraphic)
end
xoffset = ((Graphics.width/2)/10)*10
bar1 = Sprite.new(viewplayer)
@@ -198,10 +192,8 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
bar2 = AnimatedPlane.new(viewopp)
bar2.bitmap = BitmapCache.load_bitmap(tbargraphic)
pgraphic = sprintf("Graphics/Transitions/vsTrainer_%s_%d", player_tr_type.to_s, outfit) rescue nil
pgraphic = sprintf("Graphics/Transitions/vsTrainer_%d_%d", player_tr_type_id, outfit) if !pbResolveBitmap(pgraphic)
if !pbResolveBitmap(pgraphic)
pgraphic = sprintf("Graphics/Transitions/vsTrainer_%s", player_tr_type.to_s) rescue nil
pgraphic = sprintf("Graphics/Transitions/vsTrainer_%d", player_tr_type_id) if !pbResolveBitmap(pgraphic)
end
player = Sprite.new(viewplayer)
player.bitmap = BitmapCache.load_bitmap(pgraphic)

View File

@@ -249,10 +249,10 @@ class PokemonEncounters
# Returns whether an encounter with the given Pokémon should be allowed after
# taking into account Repels and ability effects.
def allow_encounter?(enc_data, ignore_repel = false)
def allow_encounter?(enc_data, repel_active = false)
return false if !enc_data
# Repel
if !ignore_repel && $PokemonGlobal.repel > 0 && !pbPokeRadarOnShakingGrass
if repel_active && !pbPokeRadarOnShakingGrass
first_pkmn = (Settings::REPEL_COUNTS_FAINTED_POKEMON) ? $Trainer.first_pokemon : $Trainer.first_able_pokemon
return false if first_pkmn && enc_data[1] < first_pkmn.level
end

View File

@@ -251,9 +251,6 @@ class BerryPlantSprite
@event.turn_down
else
filename=sprintf("berrytree%s",GameData::Item.get(berryData[1]).id.to_s)
if !pbResolveBitmap("Graphics/Characters/"+filename)
filename=sprintf("berrytree%03d",GameData::Item.get(berryData[1]).id_number)
end
if pbResolveBitmap("Graphics/Characters/"+filename)
@event.character_name=filename
case berryData[0]