mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Moved battle music filenames to Settings, improved PluginManager's version comparer, removed player bump animation, fixed No Guard not applying to OHKO moves, can reuse the same Repel item quicker
This commit is contained in:
@@ -422,6 +422,16 @@ module Settings
|
||||
# is on the map (for new plant growth mechanics only).
|
||||
PLANT_SPARKLE_ANIMATION_ID = 7
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Files
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
DEFAULT_WILD_BATTLE_BGM = "Battle wild"
|
||||
DEFAULT_WILD_VICTORY_BGM = "Battle victory"
|
||||
DEFAULT_WILD_CAPTURE_ME = "Battle capture success"
|
||||
DEFAULT_TRAINER_BATTLE_BGM = "Battle trainer"
|
||||
DEFAULT_TRAINER_VICTORY_BGM = "Battle victory"
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Languages
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -340,26 +340,47 @@ module PluginManager
|
||||
# 0 if v1 is equal to v2
|
||||
# -1 if v1 is lower than v2
|
||||
def self.compare_versions(v1, v2)
|
||||
d1 = v1.chars
|
||||
d1.insert(0, "0") if d1[0] == "." # Turn ".123" into "0.123"
|
||||
while d1[-1] == "." # Turn "123." into "123"
|
||||
d1 = d1[0..-2]
|
||||
version_chunks1 = v1.split(".")
|
||||
version_chunks1.each_with_index do |val, i|
|
||||
next if val != ""
|
||||
version_chunks1[i] = (i == 0) ? "0" : nil
|
||||
end
|
||||
d2 = v2.chars
|
||||
d2.insert(0, "0") if d2[0] == "." # Turn ".123" into "0.123"
|
||||
while d2[-1] == "." # Turn "123." into "123"
|
||||
d2 = d2[0..-2]
|
||||
version_chunks1.compact!
|
||||
version_chunks2 = v2.split(".")
|
||||
version_chunks2.each_with_index do |val, i|
|
||||
next if val != ""
|
||||
version_chunks2[i] = (i == 0) ? "0" : nil
|
||||
end
|
||||
[d1.size, d2.size].max.times do |i| # Compare each digit in turn
|
||||
c1 = d1[i]
|
||||
c2 = d2[i]
|
||||
if c1
|
||||
return 1 if !c2
|
||||
return 1 if c1.to_i(16) > c2.to_i(16)
|
||||
return -1 if c1.to_i(16) < c2.to_i(16)
|
||||
elsif c2
|
||||
return -1
|
||||
version_chunks2.compact!
|
||||
# Compare each chunk in turn
|
||||
decision = :equal # Could be :higher or :lower
|
||||
[version_chunks1.length, version_chunks2.length].max.times do |i|
|
||||
chunk1 = version_chunks1[i]
|
||||
chunk2 = version_chunks2[i]
|
||||
if !chunk1
|
||||
decision = :lower if decision == :equal
|
||||
break
|
||||
elsif !chunk2
|
||||
decision = :higher if decision == :equal
|
||||
break
|
||||
end
|
||||
# Make both chunks the same left by pre-padding with "0"
|
||||
chars_count = [chunk1.length, chunk2.length].max
|
||||
chunk1 = chunk1.rjust(chars_count, "0").chars
|
||||
chunk2 = chunk2.rjust(chars_count, "0").chars
|
||||
chunk1.length.times do |j|
|
||||
c1 = chunk1[j]
|
||||
c2 = chunk2[j]
|
||||
next if c1 == c2
|
||||
decision = (c1.to_i(16) > c2.to_i(16)) ? :higher : :lower
|
||||
break
|
||||
end
|
||||
break if decision != :equal
|
||||
end
|
||||
case decision
|
||||
when :equal then return 0
|
||||
when :higher then return 1
|
||||
when :lower then return -1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -77,7 +77,6 @@ class Game_Character
|
||||
@always_on_top = false
|
||||
@anime_count = 0 # Time since pattern was last changed
|
||||
@stop_count = 0 # Time since character last finished moving
|
||||
@bumping = false # Used by the player only when walking into something
|
||||
@jump_peak = 0 # Max height while jumping
|
||||
@jump_distance = 0 # Total distance of jump
|
||||
@jump_fraction = 0 # How far through a jump we currently are (0-1)
|
||||
@@ -996,7 +995,6 @@ class Game_Character
|
||||
if moving? && @move_timer >= @move_time &&
|
||||
@real_x == @x * Game_Map::REAL_RES_X && @real_y == @y * Game_Map::REAL_RES_Y
|
||||
@move_timer = nil
|
||||
@bumping = false
|
||||
end
|
||||
# End of jump
|
||||
if jumping? && @jump_fraction >= 1
|
||||
|
||||
@@ -51,7 +51,6 @@ class Game_Player < Game_Character
|
||||
|
||||
def can_run?
|
||||
return @move_speed > 3 if @move_route_forcing
|
||||
return false if @bumping
|
||||
return false if $game_temp.in_menu || $game_temp.in_battle ||
|
||||
$game_temp.message_window_showing || pbMapInterpreterRunning?
|
||||
return false if !$player.has_running_shoes && !$PokemonGlobal.diving &&
|
||||
@@ -95,7 +94,6 @@ class Game_Player < Game_Character
|
||||
self.move_speed = 3 if !@move_route_forcing
|
||||
new_charset = pbGetPlayerCharset(meta.walk_charset)
|
||||
end
|
||||
self.move_speed = 3 if @bumping
|
||||
@character_name = new_charset if new_charset
|
||||
end
|
||||
|
||||
@@ -119,12 +117,10 @@ class Game_Player < Game_Character
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def bump_into_object
|
||||
return if @bump_time_start && (System.uptime - @bump_time_start < @move_time)
|
||||
pbSEPlay("Player bump") if !@move_route_forcing
|
||||
$stats.bump_count += 1
|
||||
@move_initial_x = @x
|
||||
@move_initial_y = @y
|
||||
@move_timer = 0.0
|
||||
@bumping = true
|
||||
@bump_time_start = System.uptime
|
||||
end
|
||||
|
||||
def add_move_distance_to_stats(distance = 1)
|
||||
@@ -421,7 +417,7 @@ class Game_Player < Game_Character
|
||||
update_stop if $game_temp.in_menu && @stopped_last_frame
|
||||
update_screen_position(last_real_x, last_real_y)
|
||||
# Update dependent events
|
||||
if (!@moved_last_frame || @stopped_last_frame) && (moving? || jumping?) && !@bumping
|
||||
if (!@moved_last_frame || @stopped_last_frame) && (moving? || jumping?)
|
||||
$game_temp.followers.move_followers
|
||||
end
|
||||
$game_temp.followers.update
|
||||
@@ -432,28 +428,32 @@ class Game_Player < Game_Character
|
||||
dir = Input.dir4
|
||||
if $PokemonGlobal.forced_movement?
|
||||
move_forward
|
||||
elsif !pbMapInterpreterRunning? && !$game_temp.message_window_showing &&
|
||||
!$game_temp.in_mini_update && !$game_temp.in_menu
|
||||
# Move player in the direction the directional button is being pressed
|
||||
if @moved_last_frame ||
|
||||
(dir > 0 && dir == @lastdir && System.uptime - @lastdirframe >= 0.075)
|
||||
case dir
|
||||
when 2 then move_down
|
||||
when 4 then move_left
|
||||
when 6 then move_right
|
||||
when 8 then move_up
|
||||
end
|
||||
elsif dir != @lastdir
|
||||
case dir
|
||||
when 2 then turn_down
|
||||
when 4 then turn_left
|
||||
when 6 then turn_right
|
||||
when 8 then turn_up
|
||||
end
|
||||
@last_input_time = nil
|
||||
return
|
||||
elsif dir <= 0
|
||||
@last_input_time = nil
|
||||
return
|
||||
end
|
||||
return if pbMapInterpreterRunning? || $game_temp.message_window_showing ||
|
||||
$game_temp.in_mini_update || $game_temp.in_menu
|
||||
# Move player in the direction the directional button is being pressed
|
||||
if @moved_last_frame ||
|
||||
(dir == direction && (!@last_input_time || System.uptime - @last_input_time >= 0.075))
|
||||
case dir
|
||||
when 2 then move_down
|
||||
when 4 then move_left
|
||||
when 6 then move_right
|
||||
when 8 then move_up
|
||||
end
|
||||
# Record last direction input
|
||||
@lastdirframe = System.uptime if dir != @lastdir
|
||||
@lastdir = dir
|
||||
@last_input_time = nil
|
||||
elsif dir != direction
|
||||
case dir
|
||||
when 2 then turn_down
|
||||
when 4 then turn_left
|
||||
when 6 then turn_right
|
||||
when 8 then turn_up
|
||||
end
|
||||
@last_input_time = System.uptime
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -608,6 +608,9 @@ class Battle::Battler
|
||||
user.effects[PBEffects::LockOnPos] == target.index
|
||||
# Toxic
|
||||
return true if move.pbOverrideSuccessCheckPerHit(user, target)
|
||||
# No Guard
|
||||
return true if user.hasActiveAbility?(:NOGUARD) ||
|
||||
target.hasActiveAbility?(:NOGUARD)
|
||||
# Semi-invulnerable target
|
||||
return false if target.damageState.invulnerable
|
||||
# Called by another move
|
||||
|
||||
@@ -448,7 +448,7 @@ class Battle::Scene
|
||||
return nil if ANIMATION_DEFAULTS.include?(wanted_move) # No need to check for these animations twice
|
||||
end
|
||||
# Use Tackle or Defense Curl's animation
|
||||
if target_data.num_targets == 0 && target.data.id != :None
|
||||
if target_data.num_targets == 0 && target_data.id != :None
|
||||
return find_move_animation_for_move(ANIMATION_DEFAULTS[1], 0, user_index)
|
||||
end
|
||||
return find_move_animation_for_move(ANIMATION_DEFAULTS[0], 0, user_index)
|
||||
@@ -593,7 +593,7 @@ class Battle::Scene
|
||||
def pbCommonAnimation(anim_name, user = nil, target = nil)
|
||||
return if nil_or_empty?(anim_name)
|
||||
# Find an animation to play (new format or old format)
|
||||
anims = try_get_better_common_animation(anim_name, user.index)
|
||||
anims = try_get_better_common_animation(anim_name, user&.index)
|
||||
return if !anims
|
||||
# Play a new format animation
|
||||
if anims.is_a?(Array)
|
||||
|
||||
@@ -144,7 +144,7 @@ class Battle::AI
|
||||
:STICKYHOLD, :SUPERLUCK, :UNNERVE, :WIMPOUT],
|
||||
2 => [:BATTLEARMOR, :COLORCHANGE, :CUTECHARM, :DAMP, :GRASSPELT,
|
||||
:HUNGERSWITCH, :INNERFOCUS, :LEAFGUARD, :LIGHTMETAL, :MIMICRY,
|
||||
:OBLIVIOUS, :POWERSPOT, :PROPELLORTAIL, :PUNKROCK, :SHELLARMOR,
|
||||
:OBLIVIOUS, :POWERSPOT, :PROPELLERTAIL, :PUNKROCK, :SHELLARMOR,
|
||||
:STALWART, :STEADFAST, :STEELYSPIRIT, :SUCTIONCUPS, :TANGLEDFEET,
|
||||
:WANDERINGSPIRIT, :WEAKARMOR],
|
||||
1 => [:BIGPECKS, :KEENEYE, :MAGMAARMOR, :PICKUP, :RIVALRY, :STENCH],
|
||||
|
||||
@@ -36,7 +36,7 @@ class PokemonGlobalMetadata
|
||||
attr_accessor :eventvars
|
||||
# Affecting the map
|
||||
attr_accessor :bridge
|
||||
attr_accessor :repel
|
||||
attr_accessor :repel, :repel_item
|
||||
attr_accessor :flashUsed
|
||||
attr_reader :encounter_version
|
||||
# Map transfers
|
||||
|
||||
@@ -32,6 +32,7 @@ def pbRepel(item, steps)
|
||||
$stats.repel_count += 1
|
||||
pbUseItemMessage(item)
|
||||
$PokemonGlobal.repel = steps
|
||||
$PokemonGlobal.repel_item = item
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -58,17 +59,29 @@ EventHandlers.add(:on_player_step_taken, :repel_counter,
|
||||
pbMessage(_INTL("The repellent's effect wore off!"))
|
||||
next
|
||||
end
|
||||
next if !pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
|
||||
ret = nil
|
||||
pbFadeOutIn do
|
||||
bag_screen = UI::Bag.new($bag, mode: :choose_item)
|
||||
bag_screen.set_filter_proc(proc { |item| repels.include?(item) })
|
||||
ret = bag_screen.choose_item
|
||||
commands = {}
|
||||
if $PokemonGlobal.repel_item && $bag.has?($PokemonGlobal.repel_item)
|
||||
commands[:repeat] = _INTL("Use {1}", GameData::Item.get($PokemonGlobal.repel_item).name)
|
||||
end
|
||||
commands[:choose_another] = _INTL("Use another repellent")
|
||||
commands[:cancel] = _INTL("Cancel")
|
||||
cmd = pbMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"), commands.values, -1)
|
||||
next if cmd < 0
|
||||
new_item = nil
|
||||
case commands.keys[cmd]
|
||||
when :repeat
|
||||
new_item = $PokemonGlobal.repel_item
|
||||
when :choose_another
|
||||
pbFadeOutIn do
|
||||
bag_screen = UI::Bag.new($bag, mode: :choose_item)
|
||||
bag_screen.set_filter_proc(proc { |item| repels.include?(item) })
|
||||
new_item = bag_screen.choose_item
|
||||
end
|
||||
end
|
||||
# TODO: Would be nice if this didn't call pbUseItem, so that pbUseItem would
|
||||
# be exclusively called from the Bag screen and could rely on that
|
||||
# screen existing.
|
||||
pbUseItem($bag, ret) if ret
|
||||
pbUseItem($bag, new_item) if new_item
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
# Graphics/Battlers/eggCracks.
|
||||
#===============================================================================
|
||||
class PokemonEggHatch_Scene
|
||||
EGG_HATCH_BGM = "Evolution"
|
||||
|
||||
def pbStartScene(pokemon)
|
||||
@sprites = {}
|
||||
@pokemon = pokemon
|
||||
@@ -50,7 +52,7 @@ class PokemonEggHatch_Scene
|
||||
end
|
||||
|
||||
def pbMain
|
||||
pbBGMPlay("Evolution")
|
||||
pbBGMPlay(EGG_HATCH_BGM)
|
||||
# Egg animation
|
||||
updateScene(1.5)
|
||||
pbPositionHatchMask(0)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# Evolution screen
|
||||
#===============================================================================
|
||||
class PokemonEvolutionScene
|
||||
EVOLUTION_BGM = "Evolution"
|
||||
|
||||
def self.pbDuplicatePokemon(pkmn, new_species)
|
||||
new_pkmn = pkmn.clone
|
||||
new_pkmn.species = new_species
|
||||
@@ -95,7 +97,7 @@ class PokemonEvolutionScene
|
||||
break if System.uptime - timer_start >= 1
|
||||
end
|
||||
pbMEPlay("Evolution start")
|
||||
pbBGMPlay("Evolution")
|
||||
pbBGMPlay(EVOLUTION_BGM)
|
||||
canceled = false
|
||||
timer_start = System.uptime
|
||||
loop do
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonTrade_Scene
|
||||
TRADE_BGM = "Evolution"
|
||||
|
||||
def pbUpdate
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
@@ -181,7 +183,7 @@ class PokemonTrade_Scene
|
||||
@pokemon.name, @pokemon.owner.public_id, @pokemon.owner.name) + "\\wtnp[0]") { pbUpdate }
|
||||
pbMessageWaitForInput(@sprites["msgwindow"], 50, true) { pbUpdate }
|
||||
pbPlayDecisionSE
|
||||
pbBGMPlay("Evolution")
|
||||
pbBGMPlay(TRADE_BGM)
|
||||
pbScene1
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("For {1}'s {2},\n{3} sends {4}.", @trader1, speciesname1, @trader2, speciesname2) + "\1") { pbUpdate }
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
class Scene_Credits
|
||||
# Backgrounds to show in credits. Found in Graphics/Titles/ folder
|
||||
BACKGROUNDS_LIST = ["credits1", "credits2", "credits3", "credits4", "credits5"]
|
||||
BGM = "Credits"
|
||||
CREDITS_BGM = "Credits"
|
||||
SCROLL_SPEED = 40 # Pixels per second
|
||||
SECONDS_PER_BACKGROUND = 11
|
||||
TEXT_OUTLINE_COLOR = Color.new(0, 0, 128, 255)
|
||||
@@ -174,7 +174,7 @@ class Scene_Credits
|
||||
pbBGSStop
|
||||
pbSEStop
|
||||
pbBGMFade(2.0)
|
||||
pbBGMPlay(BGM)
|
||||
pbBGMPlay(CREDITS_BGM)
|
||||
Graphics.transition
|
||||
loop do
|
||||
Graphics.update
|
||||
|
||||
@@ -58,6 +58,10 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonJukeboxScreen
|
||||
HIGHER_ENCOUNTER_RATE_BGM = "Radio - March"
|
||||
LOWER_ENCOUNTER_RATE_BGM = "Radio - Lullaby"
|
||||
NORMAL_ENCOUNTER_RATE_BGM = "Radio - Oak"
|
||||
|
||||
def initialize(scene)
|
||||
@scene = scene
|
||||
end
|
||||
@@ -83,21 +87,21 @@ class PokemonJukeboxScreen
|
||||
break
|
||||
elsif cmdMarch >= 0 && cmd == cmdMarch
|
||||
pbPlayDecisionSE
|
||||
pbBGMPlay("Radio - March", 100, 100)
|
||||
pbBGMPlay(HIGHER_ENCOUNTER_RATE_BGM, 100, 100)
|
||||
if $PokemonMap
|
||||
$PokemonMap.lower_encounter_rate = false
|
||||
$PokemonMap.higher_encounter_rate = true
|
||||
end
|
||||
elsif cmdLullaby >= 0 && cmd == cmdLullaby
|
||||
pbPlayDecisionSE
|
||||
pbBGMPlay("Radio - Lullaby", 100, 100)
|
||||
pbBGMPlay(LOWER_ENCOUNTER_RATE_BGM, 100, 100)
|
||||
if $PokemonMap
|
||||
$PokemonMap.lower_encounter_rate = true
|
||||
$PokemonMap.higher_encounter_rate = false
|
||||
end
|
||||
elsif cmdOak >= 0 && cmd == cmdOak
|
||||
pbPlayDecisionSE
|
||||
pbBGMPlay("Radio - Oak", 100, 100)
|
||||
pbBGMPlay(NORMAL_ENCOUNTER_RATE_BGM, 100, 100)
|
||||
if $PokemonMap
|
||||
$PokemonMap.lower_encounter_rate = false
|
||||
$PokemonMap.higher_encounter_rate = false
|
||||
|
||||
@@ -163,6 +163,8 @@ end
|
||||
# Scene class for handling appearance of the screen.
|
||||
#===============================================================================
|
||||
class TriadScene
|
||||
TRIPLE_TRIAD_BGM = "Triple Triad"
|
||||
|
||||
def pbStartScene(battle)
|
||||
@sprites = {}
|
||||
@bitmaps = []
|
||||
@@ -207,7 +209,7 @@ class TriadScene
|
||||
@sprites["score"] = Sprite.new(@viewport)
|
||||
@sprites["score"].bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||
pbSetSystemFont(@sprites["score"].bitmap)
|
||||
pbBGMPlay("Triple Triad")
|
||||
pbBGMPlay(TRIPLE_TRIAD_BGM)
|
||||
# Fade in all sprites
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ def pbGetWildBattleBGM(_wildParty)
|
||||
music = GameData::Metadata.get.wild_battle_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music != ""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle wild") if !ret
|
||||
ret = pbStringToAudioFile(Settings::DEFAULT_WILD_BATTLE_BGM) if !ret
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ def pbGetWildVictoryBGM
|
||||
music = GameData::Metadata.get.wild_victory_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music != ""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle victory") if !ret
|
||||
ret = pbStringToAudioFile(Settings::DEFAULT_WILD_VICTORY_BGM) if !ret
|
||||
ret.name = "../../Audio/BGM/" + ret.name
|
||||
return ret
|
||||
end
|
||||
@@ -52,7 +52,7 @@ def pbGetWildCaptureME
|
||||
music = GameData::Metadata.get.wild_capture_ME
|
||||
ret = pbStringToAudioFile(music) if music && music != ""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle capture success") if !ret
|
||||
ret = pbStringToAudioFile(Settings::DEFAULT_WILD_CAPTURE_ME) if !ret
|
||||
ret.name = "../../Audio/ME/" + ret.name
|
||||
return ret
|
||||
end
|
||||
@@ -98,7 +98,7 @@ def pbGetTrainerBattleBGM(trainer)
|
||||
music = GameData::Metadata.get.trainer_battle_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music != ""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle trainer") if !ret
|
||||
ret = pbStringToAudioFile(Settings::DEFAULT_TRAINER_BATTLE_BGM) if !ret
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -116,7 +116,7 @@ def pbGetTrainerBattleBGMFromType(trainertype)
|
||||
music = GameData::Metadata.get.trainer_battle_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music != ""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle trainer") if !ret
|
||||
ret = pbStringToAudioFile(Settings::DEFAULT_TRAINER_BATTLE_BGM) if !ret
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -143,7 +143,7 @@ def pbGetTrainerVictoryBGM(trainer)
|
||||
music = GameData::Metadata.get.trainer_victory_BGM
|
||||
ret = pbStringToAudioFile(music) if music && music != ""
|
||||
end
|
||||
ret = pbStringToAudioFile("Battle victory") if !ret
|
||||
ret = pbStringToAudioFile(Settings::DEFAULT_TRAINER_VICTORY_BGM) if !ret
|
||||
ret.name = "../../Audio/BGM/" + ret.name
|
||||
return ret
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user