Tweaked some overworld weather animations, added NPCTrainer#version, added Debug function for editing more things in the phone and its contacts

This commit is contained in:
Maruno17
2023-06-24 23:52:09 +01:00
parent 4fc0806c8a
commit 7d77c5f3fc
6 changed files with 179 additions and 101 deletions

View File

@@ -357,11 +357,11 @@ module Settings
#=============================================================================
# An array of available languages in the game, and their corresponding
# filename. Text files for a language are extracted to a folder called
# "Text_filename_core" or "Text_filename_game", and are recompiled into files
# in the Data folder called "messages_filename_core.dat" or
# "messages_filename_game.dat".
# An array of available languages in the game. Each one is an array containing
# the display name of the language in-game, and that language's filename
# fragment. A language will use the language data files from the Data folder
# called messages_FRAGMENT_core.dat and messages_FRAGMENT_game.dat (if they
# exist).
LANGUAGES = [
# ["English", "english"],
# ["Deutsch", "deutsch"]

View File

@@ -72,10 +72,10 @@ GameData::Weather.register({
:id_number => 1, # Must be 1 (preset RMXP weather)
:category => :Rain,
:graphics => [["rain_1", "rain_2", "rain_3", "rain_4"]], # Last is splash
:particle_delta_x => -1200,
:particle_delta_y => 4800,
:particle_delta_x => -600,
:particle_delta_y => 2400,
:tone_proc => proc { |strength|
next Tone.new(-strength * 3 / 4, -strength * 3 / 4, -strength * 3 / 4, 10)
next Tone.new(-strength / 2, -strength / 2, -strength / 2, 10)
}
})
@@ -85,10 +85,10 @@ GameData::Weather.register({
:id_number => 2, # Must be 2 (preset RMXP weather)
:category => :Rain,
:graphics => [["storm_1", "storm_2", "storm_3", "storm_4"]], # Last is splash
:particle_delta_x => -4800,
:particle_delta_y => 4800,
:particle_delta_x => -3600,
:particle_delta_y => 3600,
:tone_proc => proc { |strength|
next Tone.new(-strength * 3 / 2, -strength * 3 / 2, -strength * 3 / 2, 20)
next Tone.new(-strength * 3 / 4, -strength * 3 / 4, -strength * 3 / 4, 10)
}
})
@@ -110,10 +110,10 @@ GameData::Weather.register({
:id_number => 4,
:category => :Hail,
:graphics => [["blizzard_1", "blizzard_2", "blizzard_3", "blizzard_4"], ["blizzard_tile"]],
:particle_delta_x => -960,
:particle_delta_x => -720,
:particle_delta_y => 240,
:tile_delta_x => -1440,
:tile_delta_y => 720,
:tile_delta_x => -1200,
:tile_delta_y => 600,
:tone_proc => proc { |strength|
next Tone.new(strength * 3 / 4, strength * 3 / 4, strength * 3 / 4, 0)
}
@@ -126,8 +126,8 @@ GameData::Weather.register({
:graphics => [["sandstorm_1", "sandstorm_2", "sandstorm_3", "sandstorm_4"], ["sandstorm_tile"]],
:particle_delta_x => -1200,
:particle_delta_y => 640,
:tile_delta_x => -720,
:tile_delta_y => 360,
:tile_delta_x => -800,
:tile_delta_y => 400,
:tone_proc => proc { |strength|
next Tone.new(strength / 2, 0, -strength / 2, 0)
}
@@ -138,10 +138,10 @@ GameData::Weather.register({
:id_number => 6,
:category => :Rain,
:graphics => [["storm_1", "storm_2", "storm_3", "storm_4"]], # Last is splash
:particle_delta_x => -4800,
:particle_delta_y => 4800,
:particle_delta_x => -3600,
:particle_delta_y => 3600,
:tone_proc => proc { |strength|
next Tone.new(-strength * 3 / 2, -strength * 3 / 2, -strength * 3 / 2, 20)
next Tone.new(-strength * 3 / 4, -strength * 3 / 4, -strength * 3 / 4, 10)
}
})

View File

@@ -121,7 +121,7 @@ module GameData
break
end
# Create trainer object
trainer = NPCTrainer.new(tr_name, @trainer_type)
trainer = NPCTrainer.new(tr_name, @trainer_type, @version)
trainer.id = $player.make_foreign_ID
trainer.items = @items.clone
trainer.lose_text = self.lose_text

View File

@@ -411,7 +411,7 @@ module RPG
@sun_magnitude = weather_max if @sun_magnitude != weather_max && @sun_magnitude != -weather_max
@sun_magnitude *= -1 if (@sun_magnitude > 0 && @sun_strength > @sun_magnitude) ||
(@sun_magnitude < 0 && @sun_strength < 0)
@sun_strength += @sun_magnitude.to_f * Graphics.delta / 0.4 # 0.4 seconds per half flash
@sun_strength += @sun_magnitude.to_f * Graphics.delta / 0.8 # 0.8 seconds per half flash
tone_red += @sun_strength
tone_green += @sun_strength
tone_blue += @sun_strength / 2

View File

@@ -182,12 +182,14 @@ end
# Trainer class for NPC trainers
#===============================================================================
class NPCTrainer < Trainer
attr_accessor :version
attr_accessor :items
attr_accessor :lose_text
attr_accessor :win_text
def initialize(name, trainer_type)
def initialize(name, trainer_type, version = 0)
super
@version = version
@items = []
@lose_text = nil
@win_text = nil

View File

@@ -500,35 +500,6 @@ MenuHandlers.add(:debug_menu, :roamers, {
}
})
MenuHandlers.add(:debug_menu, :toggle_rematches_possible, {
"name" => _INTL("Toggle Phone Rematches Possible"),
"parent" => :battle_menu,
"description" => _INTL("Toggles whether trainers in the phone can be rebattled."),
"effect" => proc {
Phone.rematches_enabled = !Phone.rematches_enabled
pbMessage(_INTL("Trainers in the phone can now be rebattled.")) if Phone.rematches_enabled
pbMessage(_INTL("Trainers in the phone cannot be rebattled.")) if !Phone.rematches_enabled
}
})
MenuHandlers.add(:debug_menu, :ready_rematches, {
"name" => _INTL("Ready All Phone Rematches"),
"parent" => :battle_menu,
"description" => _INTL("Make all trainers in the phone ready for rematches."),
"effect" => proc {
if !$PokemonGlobal.phone || $PokemonGlobal.phone.contacts.length == 0
pbMessage(_INTL("There are no trainers in the Phone."))
else
$PokemonGlobal.phone.contacts.each do |contact|
next if !contact.trainer?
contact.rematch_flag = 1
contact.set_trainer_event_ready_for_rematch
end
pbMessage(_INTL("All trainers in the Phone are now ready to rebattle."))
end
}
})
MenuHandlers.add(:debug_menu, :reset_trainers, {
"name" => _INTL("Reset Map's Trainers"),
"parent" => :battle_menu,
@@ -744,6 +715,56 @@ MenuHandlers.add(:debug_menu, :open_storage, {
}
})
#===============================================================================
# Shadow Pokémon options
#===============================================================================
MenuHandlers.add(:debug_menu, :shadow_pokemon_menu, {
"name" => _INTL("Shadow Pokémon Options..."),
"parent" => :pokemon_menu,
"description" => _INTL("Snag Machine and purification."),
"always_show" => false
})
MenuHandlers.add(:debug_menu, :toggle_snag_machine, {
"name" => _INTL("Toggle Snag Machine"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Toggle all Poké Balls being able to catch Shadow Pokémon."),
"effect" => proc {
$player.has_snag_machine = !$player.has_snag_machine
pbMessage(_INTL("Gave the Snag Machine.")) if $player.has_snag_machine
pbMessage(_INTL("Lost the Snag Machine.")) if !$player.has_snag_machine
}
})
MenuHandlers.add(:debug_menu, :toggle_purify_chamber_access, {
"name" => _INTL("Toggle Purify Chamber Access"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Toggle access to the Purify Chamber via the PC."),
"effect" => proc {
$player.seen_purify_chamber = !$player.seen_purify_chamber
pbMessage(_INTL("The Purify Chamber is accessible.")) if $player.seen_purify_chamber
pbMessage(_INTL("The Purify Chamber is not accessible.")) if !$player.seen_purify_chamber
}
})
MenuHandlers.add(:debug_menu, :purify_chamber, {
"name" => _INTL("Use Purify Chamber"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Open the Purify Chamber for Shadow Pokémon purification."),
"effect" => proc {
pbPurifyChamber
}
})
MenuHandlers.add(:debug_menu, :relic_stone, {
"name" => _INTL("Use Relic Stone"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Choose a Shadow Pokémon to show to the Relic Stone for purification."),
"effect" => proc {
pbRelicStone
}
})
#===============================================================================
# Item options
#===============================================================================
@@ -937,6 +958,111 @@ MenuHandlers.add(:debug_menu, :toggle_pokegear, {
}
})
MenuHandlers.add(:debug_menu, :edit_phone_contacts, {
"name" => _INTL("Edit Phone And Contacts"),
"parent" => :player_menu,
"description" => _INTL("Edit properties of the phone and of contacts registered in it."),
"effect" => proc {
if !$PokemonGlobal.phone
pbMessage(_INTL("The phone is not defined."))
next
end
cmd = 0
loop do
cmds = []
time = $PokemonGlobal.phone.time_to_next_call.to_i # time is in seconds
min = time / 60
sec = time % 60
cmds.push(_INTL("Time until next call: {1}m {2}s", min, sec))
cmds.push((Phone.rematches_enabled ? "[Y]" : "[ ]") + " " + _INTL("Rematches possible"))
cmds.push(_INTL("Maximum rematch version : {1}", Phone.rematch_variant))
if $PokemonGlobal.phone.contacts.length > 0
cmds.push(_INTL("Make all contacts ready for a rematch"))
cmds.push(_INTL("Edit individual contacts: {1}", $PokemonGlobal.phone.contacts.length))
end
cmd = pbShowCommands(nil, cmds, -1, cmd)
break if cmd < 0
case cmd
when 0 # Time until next call
params = ChooseNumberParams.new
params.setRange(0, 99999)
params.setDefaultValue(min)
params.setCancelValue(-1)
new_time = pbMessageChooseNumber(_INTL("Set the time (in minutes) until the next phone call."), params)
$PokemonGlobal.phone.time_to_next_call = new_time * 60 if new_time >= 0
when 1 # Rematches possible
Phone.rematches_enabled = !Phone.rematches_enabled
when 2 # Maximum rematch version
params = ChooseNumberParams.new
params.setRange(0, 99)
params.setDefaultValue(Phone.rematch_variant)
new_version = pbMessageChooseNumber(_INTL("Set the maximum version number a trainer contact can reach."), params)
Phone.rematch_variant = new_version
when 3 # Make all contacts ready for a rematch
$PokemonGlobal.phone.contacts.each do |contact|
next if !contact.trainer?
contact.rematch_flag = 1
contact.set_trainer_event_ready_for_rematch
end
pbMessage(_INTL("All trainers in the phone are now ready to rebattle."))
when 4 # Edit individual contacts
contact_cmd = 0
loop do
contact_cmds = []
$PokemonGlobal.phone.contacts.each do |contact|
visible_string = (contact.visible?) ? "[Y]" : "[ ]"
if contact.trainer?
battle_string = (contact.can_rematch?) ? "(can battle)" : ""
contact_cmds.push(sprintf("%s %s (%i) %s", visible_string, contact.display_name, contact.variant, battle_string))
else
contact_cmds.push(sprintf("%s %s", visible_string, contact.display_name))
end
end
contact_cmd = pbShowCommands(nil, contact_cmds, -1, contact_cmd)
break if contact_cmd < 0
contact = $PokemonGlobal.phone.contacts[contact_cmd]
edit_cmd = 0
loop do
edit_cmds = []
edit_cmds.push((contact.visible? ? "[Y]" : "[ ]") + " " + _INTL("Contact visible")) if contact.can_hide?
if contact.trainer?
edit_cmds.push((contact.can_rematch? ? "[Y]" : "[ ]") + " " + _INTL("Can battle"))
ready_time = contact.time_to_ready # time is in seconds
ready_min = ready_time / 60
ready_sec = ready_time % 60
edit_cmds.push(_INTL("Time until ready to battle: {1}m {2}s", ready_min, ready_sec))
edit_cmds.push(_INTL("Last defeated version: {1}", contact.variant))
end
break if edit_cmds.length == 0
edit_cmd = pbShowCommands(nil, edit_cmds, -1, edit_cmd)
break if edit_cmd < 0
case edit_cmd
when 0 # Visibility
contact.visible = !contact.visible
when 1 # Can battle
contact.rematch_flag = (contact.can_rematch?) ? 0 : 1
contact.time_to_ready = 0 if contact.can_rematch?
when 2 # Time until ready to battle
params = ChooseNumberParams.new
params.setRange(0, 99999)
params.setDefaultValue(ready_min)
params.setCancelValue(-1)
new_time = pbMessageChooseNumber(_INTL("Set the time (in minutes) until this trainer is ready to battle."), params)
contact.time_to_ready = new_time * 60 if new_time >= 0
when 3 # Last defeated version
params = ChooseNumberParams.new
params.setRange(0, 99)
params.setDefaultValue(contact.variant)
new_version = pbMessageChooseNumber(_INTL("Set the last defeated version number of this trainer."), params)
contact.version = contact.start_version + new_version
end
end
end
end
end
}
})
MenuHandlers.add(:debug_menu, :toggle_box_link, {
"name" => _INTL("Toggle Party Screen Access To Storage"),
"parent" => :player_menu,
@@ -1017,56 +1143,6 @@ MenuHandlers.add(:debug_menu, :random_id, {
}
})
#===============================================================================
# Shadow Pokémon options
#===============================================================================
MenuHandlers.add(:debug_menu, :shadow_pokemon_menu, {
"name" => _INTL("Shadow Pokémon Options..."),
"parent" => :main,
"description" => _INTL("Snag Machine and purification."),
"always_show" => false
})
MenuHandlers.add(:debug_menu, :toggle_snag_machine, {
"name" => _INTL("Toggle Snag Machine"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Toggle all Poké Balls being able to catch Shadow Pokémon."),
"effect" => proc {
$player.has_snag_machine = !$player.has_snag_machine
pbMessage(_INTL("Gave the Snag Machine.")) if $player.has_snag_machine
pbMessage(_INTL("Lost the Snag Machine.")) if !$player.has_snag_machine
}
})
MenuHandlers.add(:debug_menu, :toggle_purify_chamber_access, {
"name" => _INTL("Toggle Purify Chamber Access"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Toggle access to the Purify Chamber via the PC."),
"effect" => proc {
$player.seen_purify_chamber = !$player.seen_purify_chamber
pbMessage(_INTL("The Purify Chamber is accessible.")) if $player.seen_purify_chamber
pbMessage(_INTL("The Purify Chamber is not accessible.")) if !$player.seen_purify_chamber
}
})
MenuHandlers.add(:debug_menu, :purify_chamber, {
"name" => _INTL("Use Purify Chamber"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Open the Purify Chamber for Shadow Pokémon purification."),
"effect" => proc {
pbPurifyChamber
}
})
MenuHandlers.add(:debug_menu, :relic_stone, {
"name" => _INTL("Use Relic Stone"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Choose a Shadow Pokémon to show to the Relic Stone for purification."),
"effect" => proc {
pbRelicStone
}
})
#===============================================================================
# PBS file editors
#===============================================================================