#=============================================================================
#
# * Experimental Compatibility Patch for the Tankentai Sideview Battle System
# and MOG - ATB System
# Version 0.3
# by Another Fen (forums.rpgmakerweb.com)
#
# Contents: ------------------------------------------------------------------
# Attempt to fix minor compatibility issues between the two scripts:
# - ATB meters should not stop during camera movement
# - Battler animations during action selection should be fixed
# - Damage popups should occur right after a slip damage effect
#
# Also fixes an issue where states would expire outside their removal timing
# as well as an error occurring when an infliced death state is immediately
# removed during action selection.
#
# Instructions: --------------------------------------------------------------
# Place this script below both scripts, which can be found here:
#
# Tankentai Sideview Battle System Ver100 by Enu
# (English Translation v1.1 by Wishdream):
# https://forums.rpgmakerweb.com/index.php?threads/31961/
# MOG - ATB System v6.1 by Moghunter:
# https://atelierrgss.wordpress.com/rgss3-active-time-battle/
#
# Incompatibility with future versions of either script is possible.
#=============================================================================
#~ Sideview:
#~ #<Class:BattleManager>#process_victory (YEA Victory Aftermath)
#~ Redefinition: Merge might be necessary (DONE)
#~
#~ ATB:
#~ #<Class:BattleManager>#next_command (Sideview)
#~ Redefinition: Merge, also ATB seems to change the way active actor works
#~ (Aliased several methods, maybe find a better solution?)
#~
#~ #<Class:BattleManager>#process_victory (Sideview)
#~ Alias, but Sideview seems to change the function of this method
#~ (Probably not problematic)
#~
#~ #<Class:BattleManager>#turn_start (YEA - Core Engine)
#~ Redefinition
#~ (@performed_battlers clear nullified. ATB doesn't need it anyway? TODO)
#~
#~ Scene_Battle#update_basic (Sideview)
#~ Alias, but Sideview circumvents this function during Camera Wait
#~ (DONE)
#~
#~ Scene_Battle#wait_for_effect (Sideview)
#~ Both scripts skip wait frames
#~ (Hope this doesn't clash if both scripts substitute it differently)
#~
#~ Scene_Battle#turn_end (Sideview)
#~ Redefinition
#~ (Damage Popup moved, Camera Wait not reimplemented, TODO?)
#~
#~ Scene_Battle#process_forced_action (YEA - Core Engine)
#~ Redefinition
#~ (DONE, might not be necessary?)
class << BattleManager
#--------------------------------------------------------------------------
# * Victory Processing
# EDIT: Merge Sideview and YEA Victory Aftermath
#--------------------------------------------------------------------------
def victory
# Sideview Addition:
$sv_camera.win_wait = false
N03.camera(nil, N03::BATTLE_CAMERA["End of Battle"].dup)
for member in $game_party.members do
member.sv.start_action(member.sv.win) if member.movable?
end
# ---
if $imported["YEA-CommandAutobattle"]
SceneManager.scene.close_disable_autobattle_window
end
if $imported["YEA-VictoryAftermath"]
return skip_aftermath if Switch.skip_aftermath
end
if $imported["YEA-JPManager"]
gain_jp
end
play_battle_end_me
replay_bgm_and_bgs
if !$imported["YEA-VictoryAftermath"]
$game_message.add(sprintf(Vocab::Victory, $game_party.name))
end
display_exp
gain_gold
gain_drop_items
gain_exp
SceneManager.return
battle_end(0)
return true
end
#--------------------------------------------------------------------------
# Multiple Methods where @command_actor changes outside initialization
# EDIT: Update Sideview battler animations whenever @command_actor changes
#--------------------------------------------------------------------------
alias_method(:prepare_actor_command_ILC_updateSVAnimation,
:prepare_actor_command)
def prepare_actor_command(battler)
last_battler = @command_actor
prepare_actor_command_ILC_updateSVAnimation(battler)
# Upate Animations:
if last_battler && last_battler.inputable?
last_battler.sv.start_action(last_battler.sv.command_a)
end
if battler && battler.inputable?
battler.sv.start_action(battler.sv.command_b)
end
end
alias_method(:command_selection_clear_ILC_updateSVAnimation,
:command_selection_clear)
def command_selection_clear
last_battler = @command_actor
command_selection_clear_ILC_updateSVAnimation
if last_battler && last_battler.inputable?
last_battler.sv.start_action(last_battler.sv.command_a)
end
end
alias_method(:command_end_ILC_updateSVAnimation, :command_end)
def command_end
last_battler = @command_actor
command_end_ILC_updateSVAnimation
if last_battler && last_battler.inputable?
last_battler.sv.start_action(last_battler.sv.command_a)
end
end
alias_method(:set_cast_action_ILC_updateSVAnimation, :set_cast_action)
def set_cast_action(item)
last_battler = @command_actor
set_cast_action_ILC_updateSVAnimation(item)
if last_battler && last_battler.inputable?
last_battler.sv.start_action(last_battler.sv.command_a)
end
end
alias_method(:cancel_actor_command_ILC_updateSVAnimation,
:cancel_actor_command)
def cancel_actor_command(minus = false)
last_battler = @command_actor
cancel_actor_command_ILC_updateSVAnimation(minus)
if last_battler && last_battler != @command_actor && last_battler.inputable?
last_battler.sv.start_action(last_battler.sv.command_a)
end
end
alias_method(:prepare_ckill_members_ILC_updateSVAnimation,
:prepare_ckill_members)
def prepare_ckill_members
last_battler = @command_actor
prepare_ckill_members_ILC_updateSVAnimation
if last_battler && last_battler != @command_actor && last_battler.inputable?
last_battler.sv.start_action(last_battler.sv.command_a)
end
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● カメラウェイト
# EDIT: added 'update_basic' extension from ATB to this method.
#--------------------------------------------------------------------------
def camera_wait
process_event if $sv_camera.event
$sv_camera.event = false if $sv_camera.event
while $sv_camera.wait != 0
# MOG ATB:
update_break_phase
break_command if force_break_command?
update_atb_basic if !$game_troop.interpreter.running?
# ---
Graphics.update
Input.update
update_all_windows
$game_timer.update
$game_troop.update
$sv_camera.update
@spriteset.update
update_info_viewport
update_message_open
$sv_camera.wait -= 1 if $sv_camera.wait > 0
$sv_camera.wait = 1 if $sv_camera.wait == 0 && @spriteset.effect?
BattleManager.victory if $sv_camera.win_wait && $sv_camera.wait == 0
end
end
#--------------------------------------------------------------------------
# ● Can Break Command?
# EDIT: Break actor command after losing their ability to act
#--------------------------------------------------------------------------
alias_method(:can_break_command_ILC_checkActorInput, :can_break_command?)
def can_break_command?
result = can_break_command_ILC_checkActorInput
result ||= (BattleManager.actor && !BattleManager.actor.input)
return result
end
#--------------------------------------------------------------------------
# ● Process Action
# EDIT: Update Sideview Damage Popups from Slip Damage Effects
#--------------------------------------------------------------------------
def process_action
process_atb_type
return if !process_action_atb?
update_turn if update_turn?
@subject = BattleManager.update_atb
# Sideview (originally from Scene_Battle#turn_end)
for member in $game_troop.members + $game_party.members
result_damage = member.sv.result_damage
N03.set_damage(member, result_damage[0], result_damage[1])
member.sv.result_damage = [0, 0]
if member.result.hp_damage != 0 or member.result.mp_damage != 0
@spriteset.set_damage_pop(member)
end
end
# ---
process_actor_command if BattleManager.actor_command?
force_refresh_status if BattleManager.refresh_status?
process_action_atb if @subject
end
#--------------------------------------------------------------------------
# * Forced Action Processing
# EDIT: merged ATB and YEA - Core Engine
#--------------------------------------------------------------------------
def process_forced_action
while BattleManager.action_forced?
last_subject = @subject
@subject = BattleManager.action_forced_battler
BattleManager.clear_action_force
process_action
@subject = last_subject
end
end
end
class Game_Battler
#--------------------------------------------------------------------------
# ● Remove State Auto ATB
# EDIT: Prevent wrong states to get removed
#--------------------------------------------------------------------------
def remove_states_auto_atb(timing)
states.each do |state|
#if @state_turns[state.id] == 0
if @state_turns[state.id] == 0 && state.auto_removal_timing == timing
if restriction == 4
remove_state(state.id)
#return
next
end
unless state.auto_removal_timing == 2 and state.max_turns <= 1
remove_state(state.id)
end
end
end
end
end