#===============================================================================
# Mobius' Charge Turn Battle System + Target Anyone Scope PATCH
# Author: Mobius XVI (CTB) + KK20 (TAS)
# Version: 1.0
# Date: 14 NOV 2020
#===============================================================================
#
# Introduction:
#
# This is a patch script to make KK20's TAS script compatible with Mobius's
# CTB script.
#
# Instructions:
#
# - Place this script below all the default scripts but above main.
# - The order of scripts should be:
# Default scripts
# TAS
# CTB
# PATCH
# Main
#
# Credits/Thanks:
# - Mobius XVI, author
# - KK20, TAS script: https://forum.chaos-project.com/index.php/topic,12640.0.html
#
# License
# This script is licensed under the MIT license, so you can use it for
# both commercial and non-commercial games.
#
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : skill selection)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# Make skill window visible
@skill_window.visible = true
# Update skill window
@skill_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End skill selection
end_skill_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If it can't be used
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.skill_id = @skill.id
# Make skill window invisible
@skill_window.visible = false
### PATCHING IN ANY TARGET ###
# If effect scope is single enemy or single ally and can target anyone
if @skill.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
(@skill.scope == 1 or @skill.scope == 3)
# Define starting position of the arrow
@orig_scope = @skill.scope
@any_target = true
end
### END PATCH ###
# If effect scope is single enemy
if @skill.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is all enemy - Mobius
elsif @skill.scope == 2
# Start all enemy selection
start_all_enemy_select
# If effect scope is single ally
elsif @skill.scope == 3 or @skill.scope == 5
# Start actor selection
start_actor_select
# If effect scope is all ally - Mobius
elsif @skill.scope == 4 or @skill.scope == 6
# Start all actor selection
start_all_actor_select
# If effect scope is not single
else
# End skill selection
end_skill_select
# Go to command input for next actor
start_phase4
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
def update_phase3_item_select
# Make item window visible
@item_window.visible = true
# Update item window
@item_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End item selection
end_item_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @item_window.item
# If it can't be used
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.item_id = @item.id
# Make item window invisible
@item_window.visible = false
### PATCHING IN ANY TARGET ###
# If effect scope is single enemy or single ally and can target anyone
if @item.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
(@item.scope == 1 or @item.scope == 3)
# Define starting position of the arrow
@orig_scope = @item.scope
@any_target = true
end
### END PATCH ###
# If effect scope is single enemy
if @item.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is all enemy - Mobius
elsif @item.scope == 2
# Start all enemy selection
start_all_enemy_select
# If effect scope is single ally
elsif @item.scope == 3 or @item.scope == 5
# Start actor selection
start_actor_select
# If effect scope is all ally - Mobius
elsif @item.scope == 4 or @item.scope == 6
# Start all actor selection
start_all_actor_select
# If effect scope is not single
else
# End item selection
end_item_select
# Go to command input for next actor
start_phase4
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : enemy selection)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# Update enemy arrow
@enemy_arrow.update
# If Beastiary is added
if Mobius::Charge_Turn_Battle::BEASTIARY
# If Beastiary access button is pressed
if Input.trigger?(Input::BEASTIARY_BATTLE_ACCESS_BUTTON)
# Set enemy
enemy = @enemy_arrow.enemy
# If enemy has been scanned -- Mobius added
if enemy.state?(Mobius::Charge_Turn_Battle::SCAN_STATE_ID)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Start turn order window
start_enemy_detail_window(enemy)
return
else
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
end
end
# If this skill/item can target anyone
if @any_target == true
# If player pressed the key to change targets
if Input.trigger?(Input::DOWN)
# Play decision SE
$game_system.se_play($data_system.cursor_se)
# Initialize actor select, end enemy select
end_enemy_select
start_actor_select
@active_battler.changed_scope = !@active_battler.changed_scope
# Stop processing
return
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End enemy selection
end_enemy_select
@active_battler.changed_scope = false
@any_target = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.target_index = @enemy_arrow.index
# End enemy selection
end_enemy_select
# If skill window is showing
if @skill_window != nil
# End skill selection
end_skill_select
end
# If item window is showing
if @item_window != nil
# End item selection
end_item_select
end
# Go to command input for next actor
start_phase4
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : actor selection)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# Update actor arrow
@actor_arrow.update
# If this skill/item can target anyone
if @any_target == true
# If player pressed the key to change targets
if Input.trigger?(Input::UP)
# Play decision SE
$game_system.se_play($data_system.cursor_se)
# Initialize actor select, end enemy select
end_actor_select
start_enemy_select
@active_battler.changed_scope = !@active_battler.changed_scope
# Stop processing
return
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End actor selection
end_actor_select
@active_battler.changed_scope = false
@any_target = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.target_index = @actor_arrow.index
# End actor selection
end_actor_select
# If skill window is showing
if @skill_window != nil
# End skill selection
end_skill_select
end
# If item window is showing
if @item_window != nil
# End item selection
end_item_select
end
# Go to command input for next actor
start_phase4
end
end
end