mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Bugfixes and small additions (#109)
* Add a converter for Player charsets in metadara * Fixed Sprite position editor not working with new shadow filenames. Also added check for custom shadows * Fixed pbTrainerBattleCore not working with NPC Trainer argument * Fixed typo which caused crash with old trainers.txt format * Fixed reference to non-existent variable which crashed the trainertype editor
This commit is contained in:
@@ -384,9 +384,9 @@ def pbGetPlayerCharset(meta,charset,trainer=nil,force=false)
|
||||
trainer = $Trainer if !trainer
|
||||
outfit = (trainer) ? trainer.outfit : 0
|
||||
if $game_player && $game_player.charsetData && !force
|
||||
return nil if $game_player.charsetData[0]==$Trainer.character_ID &&
|
||||
$game_player.charsetData[1]==charset &&
|
||||
$game_player.charsetData[2]==outfit
|
||||
return nil if $game_player.charsetData[0] == $Trainer.character_ID &&
|
||||
$game_player.charsetData[1] == charset &&
|
||||
$game_player.charsetData[2] == outfit
|
||||
end
|
||||
$game_player.charsetData = [$Trainer.character_ID,charset,outfit] if $game_player
|
||||
ret = meta[charset]
|
||||
|
||||
@@ -368,11 +368,11 @@ def pbTrainerBattleCore(*args)
|
||||
foePartyStarts = []
|
||||
for arg in args
|
||||
if arg.is_a?(NPCTrainer)
|
||||
foeTrainers.push(arg[0])
|
||||
foeTrainers.push(arg)
|
||||
foePartyStarts.push(foeParty.length)
|
||||
arg[0].party.each { |pkmn| foeParty.push(pkmn) }
|
||||
foeEndSpeeches.push(arg[0].lose_text)
|
||||
foeItems.push(arg[0].items)
|
||||
arg.party.each { |pkmn| foeParty.push(pkmn) }
|
||||
foeEndSpeeches.push(arg.lose_text)
|
||||
foeItems.push(arg.items)
|
||||
elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)]
|
||||
trainer = pbLoadTrainer(arg[0],arg[1],arg[2])
|
||||
pbMissingTrainer(arg[0],arg[1],arg[2]) if !trainer
|
||||
|
||||
@@ -834,7 +834,7 @@ def pbSweetScent
|
||||
end
|
||||
viewport.dispose
|
||||
enctype = $PokemonEncounters.encounter_type
|
||||
if enctype < 0 || !$PokemonEncounters.encounter_possible_here? ||
|
||||
if enctype || !$PokemonEncounters.encounter_possible_here? ||
|
||||
!pbEncounter(enctype)
|
||||
pbMessage(_INTL("There appears to be nothing here..."))
|
||||
end
|
||||
|
||||
@@ -233,7 +233,7 @@ MultipleForms.register(:ROTOM,{
|
||||
move_name = pkmn.moves[move_index].name
|
||||
pkmn.forget_move_at_index(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name))
|
||||
pkmn.learn_move(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
# Turned into an alternate form; try learning that form's unique move
|
||||
@@ -250,7 +250,7 @@ MultipleForms.register(:ROTOM,{
|
||||
else
|
||||
pkmn.forget_move_at_index(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, old_move_name))
|
||||
pkmn.learn_move(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
# Just try to learn this form's unique move
|
||||
@@ -578,7 +578,7 @@ MultipleForms.register(:NECROZMA,{
|
||||
move_name = pkmn.moves[move_index].name
|
||||
pkmn.forget_move_at_index(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name))
|
||||
pkmn.learn_move(:CONFUSION) if pkmn.numMoves == 0
|
||||
pbLearnMove(:CONFUSION) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
# Turned into an alternate form; try learning that form's unique move
|
||||
|
||||
@@ -456,7 +456,7 @@ def pbMoveTutorChoose(move,movelist=nil,bymachine=false,oneusemachine=false)
|
||||
pbMessage(_INTL("{1} can't learn {2}.",pokemon.name,movename)) { screen.pbUpdate }
|
||||
else
|
||||
if pbLearnMove(pokemon,move,false,bymachine) { screen.pbUpdate }
|
||||
pkmn.add_first_move(move) if oneusemachine
|
||||
pokemon.add_first_move(move) if oneusemachine
|
||||
ret = true
|
||||
break
|
||||
end
|
||||
|
||||
@@ -386,14 +386,14 @@ def pbTrainerTypeEditor
|
||||
type_hash = {
|
||||
:id_number => t_data.id_number,
|
||||
:id => t_data.id,
|
||||
:name => line[1],
|
||||
:base_money => line[2],
|
||||
:battle_BGM => line[3],
|
||||
:victory_ME => line[4],
|
||||
:intro_ME => line[5],
|
||||
:gender => line[6],
|
||||
:skill_level => line[7],
|
||||
:skill_code => line[8]
|
||||
:name => data[1],
|
||||
:base_money => data[2],
|
||||
:battle_BGM => data[3],
|
||||
:victory_ME => data[4],
|
||||
:intro_ME => data[5],
|
||||
:gender => data[6],
|
||||
:skill_level => data[7],
|
||||
:skill_code => data[8]
|
||||
}
|
||||
# Add trainer type's data to records
|
||||
GameData::TrainerType.register(type_hash)
|
||||
|
||||
@@ -166,6 +166,11 @@ class SpritePositioner
|
||||
pbChangeSpecies(@species)
|
||||
refresh
|
||||
species_data = GameData::Species.get(@species)
|
||||
if pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", species_data.species, species_data.form)) ||
|
||||
pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
|
||||
pbMessage("This species has its own shadow sprite in Graphics/Pokemon/Shadow/. The shadow size metric cannot be edited.")
|
||||
return false
|
||||
end
|
||||
oldval = species_data.shadow_size
|
||||
cmdvals = [0]
|
||||
commands = [_INTL("None")]
|
||||
@@ -173,7 +178,7 @@ class SpritePositioner
|
||||
i = 0
|
||||
loop do
|
||||
i += 1
|
||||
fn = sprintf("Graphics/Pictures/Battle/battler_shadow_%d", i)
|
||||
fn = sprintf("Graphics/Pokemon/Shadow/%d", i)
|
||||
break if !pbResolveBitmap(fn)
|
||||
cmdvals.push(i)
|
||||
commands.push(i.to_s)
|
||||
|
||||
@@ -231,6 +231,25 @@ module SpriteRenamer
|
||||
end
|
||||
end
|
||||
|
||||
def convert_player_metadata_charsets
|
||||
changed = false
|
||||
for i in 0...8
|
||||
metadata = GameData::Metadata.get_player(i)
|
||||
next if !metadata
|
||||
if metadata[1][/^trchar(\d{3})$/]
|
||||
tr_type_number = $~[1].to_i
|
||||
tr_type_data = GameData::TrainerType.try_get(tr_type_number)
|
||||
raise _INTL("Trainer type {1} is not defined (trying to rename player metadata filename {2}).", tr_type_number, metadata[1]) if !tr_type_data
|
||||
metadata[1] = "trainer_" + tr_type_data.id.to_s
|
||||
changed = true
|
||||
end
|
||||
end
|
||||
return if !changed
|
||||
# Save changes to metadata and rewrite PBS file
|
||||
GameData::Metadata.save
|
||||
Compiler.write_metadata
|
||||
end
|
||||
|
||||
def convert_files
|
||||
return if !pbConfirmMessage("Check for Pokémon/item/trainer files in their old folders that need renaming and moving?")
|
||||
any_changed = false
|
||||
@@ -255,6 +274,8 @@ module SpriteRenamer
|
||||
pbSetWindowText(nil)
|
||||
if pbConfirmMessage("Rename all trainer charsets? This will also edit map data to change events' charsets accordingly.")
|
||||
convert_trainer_sprites("Graphics/Characters/")
|
||||
convert_player_metadata_charsets
|
||||
pbSetWindowText(nil)
|
||||
# Edit all maps to replace used charsets
|
||||
mapData = Compiler::MapData.new
|
||||
t = Time.now.to_i
|
||||
|
||||
@@ -1277,7 +1277,7 @@ module Compiler
|
||||
line_data = [line_data] if !line_data.is_a?(Array)
|
||||
trainer_hash[:name] = line_data[0]
|
||||
trainer_hash[:version] = line_data[1] if line_data[1]
|
||||
trainer_names[trainer_hash[:id]] = line_data[0]
|
||||
trainer_names[trainer_hash[:id_number]] = line_data[0]
|
||||
when 3 # Number of Pokémon, items
|
||||
line_data = pbGetCsvRecord(line, line_no,
|
||||
[0, "vEEEEEEEE", nil, :Item, :Item, :Item, :Item, :Item, :Item, :Item, :Item])
|
||||
|
||||
Reference in New Issue
Block a user