#===========================================================================
# ◆ A1 Scripts ◆
# 陣形(RGSS3)
#
# バージョン : 1.10 (2012/01/21)
# 作者 : A1
# URL : http://a1tktk.web.fc2.com/
#---------------------------------------------------------------------------
# 機能:
# ・われわれはインペリアルクロスという陣形で戦う
#---------------------------------------------------------------------------
# 更新履歴 :2012/01/18 Ver1.00 リリース
# :2012/01/21 Ver1.10 指定した陣形がない時はフリーファイトにするよう調整
#---------------------------------------------------------------------------
# 設置場所
# サイドビューバトルスクリプト以下
#
# 必要スクリプト
# サイドビューバトルスクリプト
# 戦闘中入れ替えスクリプト
#---------------------------------------------------------------------------
# 使い方
# ■ 陣形設定 に設定します
# ■ サイドビューアクション設定 に設定します
#
# イベントコマンド「注釈」に記述します
#
# 陣形メニュー
#
# 陣形メニュー画面を開きます
#
# 陣形習得 追加|削除 陣形no
#
# 指定した陣形noの陣形を追加/削除します
#
# 陣形変更 陣形no
#
# 現在の陣形を指定した陣形noの陣形に変更します
#==============================================================================
$imported ||= {}
if $imported["A1_SideViewBattle"] && $imported["A1_ChangeMember"]
$imported["A1_BattleFormation"] = true
old_common_script("陣形", "4.20") if common_version < 4.20
#==============================================================================
# ■ 陣形設定
#==============================================================================
module A1_System::BattleFormationConfig
#--------------------------------------------------------------------------
# 陣形メニュー画面を開く、メニュー画面でのコマンド名
#--------------------------------------------------------------------------
COMMAND_NAME = "陣形"
#--------------------------------------------------------------------------
# 初期状態で習得している陣形no
#--------------------------------------------------------------------------
STARTING_LEARNED = [0, 1]
#--------------------------------------------------------------------------
# 初期状態の陣形
#--------------------------------------------------------------------------
STARTING_FORMATION = 1
#--------------------------------------------------------------------------
# 最大戦闘参加人数
#--------------------------------------------------------------------------
MAX_BATTLE_MEMBERS = 5
#--------------------------------------------------------------------------
# 戦闘テストで5人目を使う
#--------------------------------------------------------------------------
TEST_5TH_MEMBER = true
#--------------------------------------------------------------------------
# 各陣形のウィンドウ位置/メンバー初期位置/メンバー定位置座標
#--------------------------------------------------------------------------
FF_I_POS = [ [790, 264], [774, 208], [806, 320], [758, 152], [822, 376] ]
FF_W_POS = [ [520, 293], [504, 237], [536, 349], [488, 181], [552, 405] ]
FF_S_POS = [ [504, 364], [488, 304], [520, 418], [472, 250], [536, 476] ]
FF4_W_POS = [ [504, 253], [520, 309], [488, 197], [536, 365] ]
FF4_S_POS = [ [488, 320], [504, 380], [472, 266], [520, 434] ]
IC_W_POS = [ [448, 317], [538, 317], [358, 317], [406, 237], [470, 409] ]
IC_S_POS = [ [464, 334], [554, 334], [374, 334], [448, 254], [480, 426] ]
AS_W_POS = [ [378, 285], [444, 253], [460, 333], [518, 221], [534, 381] ]
AS_S_POS = [ [374, 334], [440, 302], [456, 382], [514, 270], [530, 430] ]
RS_W_POS = [ [498, 293], [504, 237], [536, 349], [488, 181], [552, 405] ]
RS_S_POS = [ [472, 364], [488, 304], [520, 418], [472, 250], [536, 476] ]
#--------------------------------------------------------------------------
# 陣形位置設定
#
# 選択できる陣形は、現在の戦闘参加人数で固定です
#
# 陣形No: 陣形Noを指定します
# イベントコマンドでメンバーの変更をした場合
# 陣形No 0 に強制的に変わります
# 陣形名 :陣形名を指定します
# ウィンドウ位置 :各メンバーの個別ステータスウィンドウの位置を指定します
# 初期位置 :各メンバーのバトル初期位置を指定します
# 定位置 :各メンバーのバトル定位置を指定します
# 上下カーソル移動順:カーソルを上下に動かした時のカーソル移動順を指定します
#--------------------------------------------------------------------------
BATTLE_FORMATION_POS = [
{
#--------------------------------------------------------------------------
# 1人陣形
#--------------------------------------------------------------------------
# 陣形No 陣形名, ウィンドウ位置, 初期位置, 定位置, 上下カーソル移動順
0 => ["フリーファイト", FF_W_POS, FF_I_POS, FF_S_POS, []],
},{
#--------------------------------------------------------------------------
# 2人陣形
#--------------------------------------------------------------------------
# 陣形No 陣形名, ウィンドウ位置, 初期位置, 定位置, 上下カーソル移動順
0 => ["フリーファイト", FF4_W_POS, FF_I_POS, FF4_S_POS, [0, 1]],
},{
#--------------------------------------------------------------------------
# 3人陣形
#--------------------------------------------------------------------------
# 陣形No 陣形名, ウィンドウ位置, 初期位置, 定位置, 上下カーソル移動順
0 => ["フリーファイト", FF_W_POS, FF_I_POS, FF_S_POS, [1, 0, 2]],
},{
#--------------------------------------------------------------------------
# 4人陣形
#--------------------------------------------------------------------------
# 陣形No 陣形名, ウィンドウ位置, 初期位置, 定位置, 上下カーソル移動順
0 => ["フリーファイト", FF4_W_POS, FF_I_POS, FF4_S_POS, [2, 0, 1, 3]],
},{
#--------------------------------------------------------------------------
# 5人陣形
#--------------------------------------------------------------------------
# 陣形No 陣形名, ウィンドウ位置, 初期位置, 定位置, 上下カーソル移動順
0 => ["フリーファイト", FF_W_POS, FF_I_POS, FF_S_POS, [3, 1, 0, 2, 4]],
1 => ["インペリアルクロス", IC_W_POS, FF_I_POS, IC_S_POS, [2, 3, 0, 4, 1]],
2 => ["アマゾンストライク", AS_W_POS, FF_I_POS, AS_S_POS, [0, 1, 2, 3, 4]],
3 => ["ラピッドストリーム", RS_W_POS, FF_I_POS, RS_S_POS, [3, 1, 0, 2, 4]],
}]
#--------------------------------------------------------------------------
# 陣形ボーナス設定
#
# 陣形名 :陣形位置設定で設定した陣形名を指定します
# 付与メンバー:ボーナスを付与するメンバーの位置を指定します
# 内容 :付与するボーナスの内容を指定します
#--------------------------------------------------------------------------
BATTLE_FORMATION_BONUS = {
# 陣形名 付与メンバー => [内容]
"フリーファイト" => {},
"インペリアルクロス" => { 1 => ["狙われ率-50"],
2 => ["行動前防御", "狙われ率50"],
},
"アマゾンストライク" => { 0 => ["攻撃力25", "行動後防御", "すばやさ25"],
1 => ["攻撃力25", "行動後防御", "すばやさ25"],
2 => ["攻撃力25", "行動後防御", "すばやさ25"],
},
"ラピッドストリーム" => { -1 => ["先制行動[RS]"] },
}
#--------------------------------------------------------------------------
# 陣形ボーナスの内容設定
#
# ボーナス名 :任意の文字列を指定します
# 付与タイミング:開始時 行動後 ターン終了時 行動順序 のいずれかを指定します
#
# 「開始時」は各種パラメータボーナスのみ
# 「行動後」は「防御状態」のみ
# 「ターン終了時」は「HP回復」「MP回復」「TP回復」のみ
# 「行動順序」は「先制行動」「敵行動待ち」「連続行動」のみ
#
# 内容 :防御状態 防御状態になります
# 狙われ率[val] 狙われ率が val の値追加されます
# 最大HP[val] 最大HPが val の値追加されます
# 最大MP[val] 最大MPが val の値追加されます
# 攻撃力[val,w_kind] 攻撃力が val の値追加されます w_kind 省略可
# w_kind を指定すると指定した武器タイプのみになります
# 防御力[val] 防御力が val の値追加されます
# 魔法力[val] 魔法力が val の値追加されます
# 魔法防御[val] 魔法防御が val の値追加されます
# すばやさ[val] すばやさが val の値追加されます
# 運[val] 運が val の値追加されます
# HP回復[val%] HPが val% の値回復します
# % を省略すると固定値になります
# MP回復[val%] MPが val% の値回復します
# % を省略すると固定値になります
# TP回復[val%] TPが val% の値回復します
# % を省略すると固定値になります
# 先制行動[order] order の順番に先制行動します
# 敵行動待ち[order] 敵の行動を待ってから order の順番に行動します
# 連続行動[order] order の最初のメンバーの行動順が回ってきたら
# order の順番に連続して行動します
#--------------------------------------------------------------------------
BONUS_INFO = {
# ボーナス名 付与タイミング, 内容, 解除タイミング
"行動前防御" => ["開始時", "防御状態", "行動後"],
"行動後防御" => ["行動後", "防御状態"],
"狙われ率50" => ["開始時", "狙われ率[50]"],
"狙われ率-50" => ["開始時", "狙われ率[-50]"],
"攻撃力25" => ["開始時", "攻撃力[25]"],
"弓攻撃力25" => ["開始時", "攻撃力[25,弓]"],
"魔法力50" => ["開始時", "魔法力[50]"],
"すばやさ25" => ["開始時", "すばやさ[25]"],
"HP回復[5%]" => ["ターン終了時", "HP回復[5%]"],
"先制行動[RS]" => ["行動順序", "先制行動[0, 1, 2, 3, 4]"],
"敵行動待ち[MF]" => ["行動順序", "敵行動待ち[0, 1, 2, 3, 4]"],
"連続行動[稲妻]" => ["行動順序", "連続行動[3, 4, 1, 2, 0]"],
"連続行動[龍陣]" => ["行動順序", "連続行動[0, 1, 2, 3, 4]"],
}
end
#==============================================================================
# ■ サイドビューアクション設定
#==============================================================================
module A1_System::SideViewActionConfig
ACTION_LIST["陣形変更"] = ["同時[陣形変更ジャンプ]"]
ACTION_LIST["位置変更"] = ["同時[陣形変更ジャンプ, Index[{1人目},{2人目}]]"]
ACTION_LIST["陣形変更ジャンプ"] = ["移動[定位置[30, wait],ジャンプ]"]
ACTION_PARAMS["1人目"] = "@parallel_members[0]"
ACTION_PARAMS["2人目"] = "@parallel_members[1]"
end
#==============================================================================
# ■ BattleManager
#------------------------------------------------------------------------------
# 戦闘の進行を管理するモジュールです。
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# ○ エイリアス用特異メソッド
#--------------------------------------------------------------------------
class << self
alias :a1_battle_formation_bm_battle_end :battle_end
alias :a1_battle_formation_bm_make_action_orders :make_action_orders
end
#--------------------------------------------------------------------------
# ☆ 行動順序の作成
#--------------------------------------------------------------------------
def self.make_action_orders
a1_battle_formation_bm_make_action_orders
party_bonus = $game_party.formation_bonus[-1]
return unless party_bonus && !@surprise
members = $game_party.battle_members
party_bonus.each {|bonus| orders_bonus(bonus, members)}
end
#--------------------------------------------------------------------------
# ○ 行動順序系陣形ボーナス付与
#--------------------------------------------------------------------------
def self.orders_bonus(party_bonus, members)
return if call_method(:member_any_dead?)
bonus = $game_party.bonus_info(party_bonus)
return unless bonus[0] == "行動順序"
return all_members_preemptive($a1_common.split_array($1), members) if bonus[1] =~ /^先制行動\[(.+?)\]/
return enemy_actionend_wait($a1_common.split_array($1), members) if bonus[1] =~ /^敵行動待ち\[(.+?)\]/
return chain_start_action($a1_common.split_array($1), members) if bonus[1] =~ /^連続行動\[(.+?)\]/
end
#--------------------------------------------------------------------------
# ○ 先制行動
#--------------------------------------------------------------------------
def self.all_members_preemptive(bonus, members)
members.each {|member| @action_battlers.delete(member) }
bonus.each_with_index {|index, i| @action_battlers.insert(i, members[index.to_i]) }
end
#--------------------------------------------------------------------------
# ○ 敵行動待ち
#--------------------------------------------------------------------------
def self.enemy_actionend_wait(bonus, members)
members.each {|member| @action_battlers.delete(member) }
bonus.each {|index| @action_battlers.push(members[index.to_i]) }
end
#--------------------------------------------------------------------------
# ○ 連続行動
#--------------------------------------------------------------------------
def self.chain_start_action(bonus, members)
start_member = members[bonus[0].to_i]
members.each {|member| next if start_member == member; @action_battlers.delete(member) }
start_order = @action_battlers.index(start_member)
bonus.each_with_index {|index, i| next if i == 0; @action_battlers.insert(start_order + i, members[index.to_i]) }
end
#--------------------------------------------------------------------------
# ☆ 戦闘終了
# result : 結果(0:勝利 1:逃走 2:敗北)
#--------------------------------------------------------------------------
def self.battle_end(result)
call_method(:init_formation_bonus)
a1_battle_formation_bm_battle_end(result)
end
end
#==============================================================================
# ■ DataManager
#------------------------------------------------------------------------------
# データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する
# ほぼ全てのグローバル変数はこのモジュールで初期化されます。
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# ○ エイリアス用特異メソッド
#--------------------------------------------------------------------------
class << self
alias :a1_battle_formation_bm_load_battle_test_database :load_battle_test_database
end
#--------------------------------------------------------------------------
# ☆ 戦闘テスト用のデータベースをロード
#--------------------------------------------------------------------------
def self.load_battle_test_database
a1_battle_formation_bm_load_battle_test_database
return unless A1_System::BattleFormationConfig::TEST_5TH_MEMBER
test_battler = RPG::System::TestBattler.new
test_battler.actor_id = 9
test_battler.level = 30
test_battler.equips = [49,0,0,1]
$data_system.test_battlers.push(test_battler)
end
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
# スのインスタンスは $game_party で参照されます。
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ○ 定数
#--------------------------------------------------------------------------
BATTLE_FORMATION_POS = A1_System::BattleFormationConfig::BATTLE_FORMATION_POS
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :learned_formation
attr_accessor :battle_formation
#--------------------------------------------------------------------------
# ☆ オブジェクト初期化
#--------------------------------------------------------------------------
alias a1_battle_formation_gp_initialize initialize
def initialize
@learned_formation = A1_System::BattleFormationConfig::STARTING_LEARNED
@battle_formation = A1_System::BattleFormationConfig::STARTING_FORMATION
a1_battle_formation_gp_initialize
end
#--------------------------------------------------------------------------
# ☆ 戦闘テスト用パーティのセットアップ
#--------------------------------------------------------------------------
alias a1_battle_formation_gp_setup_battle_test_members setup_battle_test_members
def setup_battle_test_members
a1_battle_formation_gp_setup_battle_test_members
@battle_formation = A1_System::BattleFormationConfig::STARTING_FORMATION
end
#--------------------------------------------------------------------------
# ★ バトルメンバーの最大数を取得
#--------------------------------------------------------------------------
def max_battle_members
return A1_System::BattleFormationConfig::MAX_BATTLE_MEMBERS
end
#--------------------------------------------------------------------------
# ○ 現在有効な陣形を取得
#--------------------------------------------------------------------------
def enable_formation(ret = [])
can_use_formation.keys.each {|key| ret.push(key) if @learned_formation.include?(key) }
return ret
end
#--------------------------------------------------------------------------
# ○ 現在の人数で使用できる陣形の取得
#--------------------------------------------------------------------------
def can_use_formation
BATTLE_FORMATION_POS[battle_members.size - 1]
end
#--------------------------------------------------------------------------
# ☆ アクターを加える
#--------------------------------------------------------------------------
alias a1_battle_formation_gp_add_actor add_actor
def add_actor(actor_id)
@battle_formation = 0
a1_battle_formation_gp_add_actor(actor_id)
end
#--------------------------------------------------------------------------
# ☆ アクターを外す
#--------------------------------------------------------------------------
alias a1_battle_formation_gp_remove_actor remove_actor
def remove_actor(actor_id)
@battle_formation = 0
a1_battle_formation_gp_remove_actor(actor_id)
end
end
#==============================================================================
# ■ Game_Troop
#------------------------------------------------------------------------------
# 敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も
# 行います。このクラスのインスタンスは $game_troop で参照されます。
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :battle_formation
attr_accessor :use_formation_type
#--------------------------------------------------------------------------
# ☆ オブジェクト初期化
#--------------------------------------------------------------------------
alias a1_battle_formation_gtp_initialize initialize
def initialize
@battle_formation = 0
@use_formation_type = 4
a1_battle_formation_gtp_initialize
end
#--------------------------------------------------------------------------
# ○ 現在使用できる陣形の取得
#--------------------------------------------------------------------------
def can_use_formation
@use_formation_type
end
end
#==============================================================================
# ■ Game_Unit
#------------------------------------------------------------------------------
# ユニットを扱うクラスです。このクラスは Game_Party クラスと Game_Troop クラ
# スのスーパークラスとして使用されます。
#==============================================================================
class Game_Unit
#--------------------------------------------------------------------------
# ○ 定数
#--------------------------------------------------------------------------
BATTLE_FORMATION_BONUS = A1_System::BattleFormationConfig::BATTLE_FORMATION_BONUS
BONUS_INFO = A1_System::BattleFormationConfig::BONUS_INFO
#--------------------------------------------------------------------------
# ○ 陣形を取得
#--------------------------------------------------------------------------
def formation(id)
ret = can_use_formation
return ret[0] unless ret[id]
return ret[id]
end
#--------------------------------------------------------------------------
# ○ 現在の陣形の名前を取得
#--------------------------------------------------------------------------
def formation_name(id = @battle_formation)
formation(id)[0]
end
#--------------------------------------------------------------------------
# ○ 現在の陣形のウィンドウ位置を取得
#--------------------------------------------------------------------------
def formation_window_pos(id = @battle_formation)
formation(id)[1]
end
#--------------------------------------------------------------------------
# ○ 現在の陣形のアクター初期位置を取得
#--------------------------------------------------------------------------
def formation_init_pos(id = @battle_formation)
formation(id)[2]
end
#--------------------------------------------------------------------------
# ○ 現在の陣形のアクター定位置を取得
#--------------------------------------------------------------------------
def formation_standard_pos(id = @battle_formation)
formation(id)[3]
end
#--------------------------------------------------------------------------
# ○ 現在の陣形のカーソル順番を取得
#--------------------------------------------------------------------------
def formation_cursor_order(id = @battle_formation)
formation(id)[4]
end
#--------------------------------------------------------------------------
# ○ 現在の陣形の陣形ボーナスを取得
#--------------------------------------------------------------------------
def formation_bonus(id = @battle_formation)
BATTLE_FORMATION_BONUS[formation_name(id)]
end
#--------------------------------------------------------------------------
# ○ 陣形ボーナス情報を取得
#--------------------------------------------------------------------------
def bonus_info(kind)
BONUS_INFO[kind]
end
end
#==============================================================================
# ■ Window_BattleActors
#==============================================================================
class Window_BattleActors < Window_Base
#--------------------------------------------------------------------------
# ★ ウィンドウ位置の取得(サイドビューバトルの再定義)
#--------------------------------------------------------------------------
def window_pos(index)
$game_party.formation_window_pos[index]
end
#--------------------------------------------------------------------------
# ○ アクターの設定
#--------------------------------------------------------------------------
def actor=(actor)
@actor = actor
end
end
#==============================================================================
# ■ Window_BattleActor
#------------------------------------------------------------------------------
# バトル画面で、行動対象のアクターを選択するウィンドウです。
#==============================================================================
class Window_BattleActor < Window_BattleStatus
#--------------------------------------------------------------------------
# ○ カーソルの移動処理
#--------------------------------------------------------------------------
def process_cursor_move
return unless cursor_movable?
last_index = @index
cursor_next (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN)
cursor_prev (Input.trigger?(:UP)) if Input.repeat?(:UP)
cursor_down (Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
cursor_up (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
Sound.play_cursor if @index != last_index
end
#--------------------------------------------------------------------------
# ○ 次のカーソル位置
#--------------------------------------------------------------------------
def cursor_next(wrap = false)
return if order.empty?
next_index = order.index(index) + 1
index = order[next_index]
index = order[0] unless index
select(index)
end
#--------------------------------------------------------------------------
# ○ 前のカーソル位置
#--------------------------------------------------------------------------
def cursor_prev(wrap = false)
return if order.empty?
prev_index = order.index(index) - 1
index = order[prev_index]
index = order[order.size - 1] unless index
select(index)
end
#--------------------------------------------------------------------------
# ○ カーソル位置情報
#--------------------------------------------------------------------------
def order
$game_party.formation_cursor_order
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
# の内部で使用され、Game_Party クラス($game_party)からも参照されます。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ★ 定位置を取得(サイドビューバトルの再定義)
#--------------------------------------------------------------------------
def members_standard_pos(index)
$game_party.formation_standard_pos[index]
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ☆ 開始処理
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_start start
def start
define_battle_manager_method
@formation_bonus = $game_party.formation_bonus
a1_battle_formation_sb_start
end
#--------------------------------------------------------------------------
# ○ バトルマネージャメソッドの定義
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_define_battle_manager_method define_battle_manager_method
def define_battle_manager_method
a1_battle_formation_sb_define_battle_manager_method
BattleManager.define_method(method(:init_formation_bonus), :init_formation_bonus)
BattleManager.define_method(method(:member_any_dead?), :member_any_dead?)
end
#--------------------------------------------------------------------------
# ★ アクターの初期位置(サイドビューバトルの再定義)
#--------------------------------------------------------------------------
def members_init_pos(index)
$game_party.formation_init_pos[index]
end
#--------------------------------------------------------------------------
# ☆ 次のコマンド入力へ
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_next_command next_command
def next_command
index = BattleManager.actor.index if BattleManager.actor
a1_battle_formation_sb_next_command
starting_formation_bonus(index, true)
end
#--------------------------------------------------------------------------
# ☆ 前のコマンド入力へ
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_prior_command prior_command
def prior_command
a1_battle_formation_sb_prior_command
starting_formation_bonus(BattleManager.actor.index, false) if BattleManager.actor
end
#--------------------------------------------------------------------------
# ○ 陣形ボーナスを取得
#--------------------------------------------------------------------------
def bonus_info(bonus)
$game_party.bonus_info(bonus)
end
#--------------------------------------------------------------------------
# ○ 開始時陣形ボーナス付与/解除
#--------------------------------------------------------------------------
def starting_formation_bonus(index, flag)
return if member_any_dead?
return unless @formation_bonus[index]
@formation_bonus[index].each {|bonus| starting_bonus(bonus_info(bonus), index, flag) }
end
#--------------------------------------------------------------------------
# ○ 開始時ボーナス付与/解除
#--------------------------------------------------------------------------
def starting_bonus(bonus, index, flag)
return unless bonus[0] == "開始時"
return bonus_guard(flag, index) if bonus[1] == "防御状態"
return battle_members[index].formation_tgr = $1.to_i / 100.0 if bonus[1] =~ /狙われ率\[([-]?\d+)\]/
return battle_members[index].formation_param[0] = $1.to_i if bonus[1] =~ /最大HP\[([-]?\d+)\]/
return battle_members[index].formation_param[1] = $1.to_i if bonus[1] =~ /最大MP\[([-]?\d+)\]/
return atk_bonus(index, $1.to_i, $2) if bonus[1] =~ /攻撃力\[([-]?\d+)[,]?(\S+)?\]/
return battle_members[index].formation_param[3] = $1.to_i if bonus[1] =~ /防御力\[([-]?\d+)\]/
return battle_members[index].formation_param[4] = $1.to_i if bonus[1] =~ /魔法力\[([-]?\d+)\]/
return battle_members[index].formation_param[5] = $1.to_i if bonus[1] =~ /魔法防御\[([-]?\d+)\]/
return battle_members[index].formation_param[6] = $1.to_i if bonus[1] =~ /すばやさ\[([-]?\d+)\]/
return battle_members[index].formation_param[7] = $1.to_i if bonus[1] =~ /運\[([-]?\d+)\]/
end
#--------------------------------------------------------------------------
# ○ 攻撃力ボーナスの付与/解除
#--------------------------------------------------------------------------
def atk_bonus(index, num, kind)
check_weapon_type(battle_members[index], kind)
return battle_members[index].formation_param[2] = num unless kind
end
#--------------------------------------------------------------------------
# ○ 武器タイプチェック
#--------------------------------------------------------------------------
def check_weapon_type(battler, kind)
return true if battler.weapons[0] && $data_system.weapon_types[battler.weapons[0].wtype_id] == kind
return true if battler.weapons[1] && $data_system.weapon_types[battler.weapons[1].wtype_id] == kind
return false
end
#--------------------------------------------------------------------------
# ○ 陣形防御ボーナスの付与/解除
#--------------------------------------------------------------------------
def bonus_guard(flag, index)
battle_members[index].bounus_guard = flag
battle_members[index].conv_action("状態[防御待機]") if flag
end
#--------------------------------------------------------------------------
# ○ 行動前陣形ボーナスの解除
#--------------------------------------------------------------------------
def remove_before_action_formation_bonus(index)
return unless @formation_bonus[index]
@formation_bonus[index].each {|bonus| remove_before_bonus(bonus_info(bonus), index) }
end
#--------------------------------------------------------------------------
# ○ 行動前陣形ボーナス解除
#--------------------------------------------------------------------------
def remove_before_bonus(bonus, index)
return unless bonus[2] == "行動後"
return bonus_guard(false, index) if bonus[1] == "防御状態"
end
#--------------------------------------------------------------------------
# ○ 行動後陣形ボーナスの付与
#--------------------------------------------------------------------------
def add_after_action_formation_bonus(index)
return if member_any_dead?
return unless @formation_bonus[index]
@formation_bonus[index].each {|bonus| add_after_bonus(bonus_info(bonus), index) }
end
#--------------------------------------------------------------------------
# ○ 行動前陣形ボーナス付与
#--------------------------------------------------------------------------
def add_after_bonus(bonus, index)
return unless bonus[0] == "行動後"
return bonus_guard(true, index) if bonus[1] == "防御状態"
end
#--------------------------------------------------------------------------
# ○ ターン終了時ボーナス検索
#--------------------------------------------------------------------------
def search_turn_end_bonus
return if member_any_dead?
battle_members.each {|member| turn_end_bonus_list(member, $game_party.formation_bonus[member.index]) }
end
#--------------------------------------------------------------------------
# ○ ターン終了時ボーナスリスト作成
#--------------------------------------------------------------------------
def turn_end_bonus_list(member, bonus_key)
return unless bonus_key
bonus_key.each {|bonus| proc_turn_end_bonus(member, bonus) }
end
#--------------------------------------------------------------------------
# ○ ターン終了時ボーナス実行
#--------------------------------------------------------------------------
def proc_turn_end_bonus(member, bonus_key)
bonus = $game_party.bonus_info(bonus_key)
return unless bonus[0] == "ターン終了時"
return bonus_recovery(member, $1, $2) if bonus[1] =~ /(\S+)回復\[(\S+)\]/
end
#--------------------------------------------------------------------------
# ○ 回復ボーナス
#--------------------------------------------------------------------------
def bonus_recovery(member, kind, recovery_num)
num = (member.mhp * ($1.to_i / 100.0)).to_i if recovery_num =~ /(\d+)%/
num = recovery_num.to_i unless recovery_num =~ /(\d+)%/
return turn_end_hp_recovery(member, num) if kind == "HP"
return turn_end_mp_recovery(member, num) if kind == "MP"
return turn_end_tp_recovery(member, num) if kind == "TP"
end
#--------------------------------------------------------------------------
# ○ ターン終了時HP回復ボーナス
#--------------------------------------------------------------------------
def turn_end_hp_recovery(member, num)
member.hp += num
return unless $imported["A1_DamagePopUp"]
member.result.hp_damage = num * -1
popup_damege(member, Sprite_DamagePop::NOML) if num.abs > 0
end
#--------------------------------------------------------------------------
# ○ ターン終了時MP回復ボーナス
#--------------------------------------------------------------------------
def turn_end_mp_recovery(member, num)
member.mp += num
return unless $imported["A1_DamagePopUp"]
member.result.mp_damage = num * -1
popup_damege(member, Sprite_DamagePop::MPRE) if num > 0
popup_damege(member, Sprite_DamagePop::MPDA) if num < 0
end
#--------------------------------------------------------------------------
# ○ ターン終了時TP回復ボーナス
#--------------------------------------------------------------------------
def turn_end_mp_recovery(member, num)
member.tp += num
return unless $imported["A1_DamagePopUp"]
member.result.tp_damage = num * -1
popup_damege(member, Sprite_DamagePop::TPRE) if num > 0
popup_damege(member, Sprite_DamagePop::TPDA) if num < 0
end
#--------------------------------------------------------------------------
# ☆ 戦闘行動の実行
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_execute_action execute_action
def execute_action
remove_before_action_formation_bonus(@subject.index) if @subject.actor?
add_after_action_formation_bonus(@subject.index) if @subject.actor?
a1_battle_formation_sb_execute_action
init_formation_bonus if member_any_dead?
end
#--------------------------------------------------------------------------
# ☆ ターン終了
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_turn_end turn_end
def turn_end
search_turn_end_bonus
init_formation_bonus
a1_battle_formation_sb_turn_end
end
#--------------------------------------------------------------------------
# ○ 勝利アクション
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_victory_action victory_action
def victory_action
init_formation_bonus
a1_battle_formation_sb_victory_action
end
#--------------------------------------------------------------------------
# ○ 陣形ボーナス初期化
#--------------------------------------------------------------------------
def init_formation_bonus
battle_members.each {|battler| battler.init_formation_bonus }
end
#--------------------------------------------------------------------------
# ○ 誰かが戦闘不能?
#--------------------------------------------------------------------------
def member_any_dead?
battle_members.any? {|member| member.hp <= 0 }
end
#--------------------------------------------------------------------------
# ☆ 個別ステータスウィンドウを再作成する
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_recreate_status_windows recreate_status_windows
def recreate_status_windows(member)
prev_pos = reserve_before_pos(member) unless member.index == $game_party.new_index
a1_battle_formation_sb_recreate_status_windows(member)
proc_change_action(member, prev_pos)
end
#--------------------------------------------------------------------------
# ○ 移動ジャンプ実行
#--------------------------------------------------------------------------
def proc_change_action(member, prev_pos)
return unless prev_pos
return if member.screen_x == prev_pos[0] && member.screen_y == prev_pos[1]
member.target_x = member.screen_x
member.target_y = member.screen_y
member.screen_x = prev_pos[0]
member.screen_y = prev_pos[1]
member.proc_action("戦闘開始の登場")
end
#--------------------------------------------------------------------------
# ○ 移動前の位置を保存
#--------------------------------------------------------------------------
def reserve_before_pos(member)
[member.screen_x, member.screen_y]
end
#--------------------------------------------------------------------------
# ○ バトルメンバーの追加後の処理
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_post_add_battler post_add_battler
def post_add_battler(member)
a1_battle_formation_sb_post_add_battler(member)
wait(35)
end
#--------------------------------------------------------------------------
# ☆ バトルメンバーの削除後の処理
#--------------------------------------------------------------------------
alias a1_battle_formation_sb_post_remove_battler post_remove_battler
def post_remove_battler
a1_battle_formation_sb_post_remove_battler
proc_change_formation
init_formation_bonus
end
#--------------------------------------------------------------------------
# ○ 陣形変更の実行
#--------------------------------------------------------------------------
def proc_change_formation
battle_members.each {|actor| actor.setup_standard_pos(actor.index)}
close_status_windows
change_formation_action
@status_windows.each_with_index {|window, i| setup_status_window_pos(window, i) }
end
#--------------------------------------------------------------------------
# ○ 陣形変更アクション
#--------------------------------------------------------------------------
def change_formation_action
battle_members[0].proc_action("陣形変更")
wait(5)
end
#--------------------------------------------------------------------------
# ○ 個別ステータスウィンドウの位置設定
#--------------------------------------------------------------------------
def setup_status_window_pos(window, index)
pos = window.window_pos(index)
window.x = pos[0]
window.y = pos[1]
window.visible = true
end
end
#==============================================================================
# ■ Game_BattlerBase
#------------------------------------------------------------------------------
# バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
# のクラスは Game_Battler クラスのスーパークラスとして使用されます。
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ☆ 防御の判定
#--------------------------------------------------------------------------
alias a1_battle_formation_gbb_guard? guard?
def guard?
a1_battle_formation_gbb_guard? || @bounus_guard && movable?
end
#--------------------------------------------------------------------------
# ☆ 通常能力値の取得
#--------------------------------------------------------------------------
alias a1_battle_formation_gbb_param param
def param(param_id)
a1_battle_formation_gbb_param(param_id) + @formation_param[param_id]
end
#--------------------------------------------------------------------------
# ☆ 特殊能力値の取得
#--------------------------------------------------------------------------
alias a1_battle_formation_gbb_sparam sparam
def sparam(sparam_id)
ret = a1_battle_formation_gbb_sparam(sparam_id)
return ret + @formation_tgr if sparam_id == 0
return ret
end
end
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
# は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :bounus_guard
attr_accessor :after_action_guard
attr_accessor :formation_tgr
attr_accessor :formation_param
#--------------------------------------------------------------------------
# ☆ オブジェクト初期化
#--------------------------------------------------------------------------
alias a1_battle_formation_gb_initialize initialize
def initialize
init_formation_bonus(false)
a1_battle_formation_gb_initialize
end
#--------------------------------------------------------------------------
# ○ 陣形ボーナス初期化
#--------------------------------------------------------------------------
def init_formation_bonus(flag = true)
@bounus_guard = false
@formation_tgr = 0.0
@formation_param = [0, 0, 0, 0, 0, 0, 0, 0]
conv_action("状態") if flag
end
end
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
# バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
# スの内部で使用されます。
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ☆ カーソルスプライトの作成
#--------------------------------------------------------------------------
alias a1_battle_formation_spsb_create_cursor_sprite create_cursor_sprite
def create_cursor_sprite
a1_battle_formation_spsb_create_cursor_sprite
@prev_cursor_sprite = Sprite_BattleCursor.new(Color.new(128,0,128))
@prev_cursor_sprite.plus_x = -8
@prev_cursor_sprite.z -= 10
end
#--------------------------------------------------------------------------
# ○ 前カーソルスプライトの取得
#--------------------------------------------------------------------------
def prev_cursor
@prev_cursor_sprite
end
#--------------------------------------------------------------------------
# ☆ カーソルスプライトの更新
#--------------------------------------------------------------------------
alias a1_battle_formation_spsb_update_cursor update_cursor
def update_cursor
a1_battle_formation_spsb_update_cursor
@prev_cursor_sprite.update if @prev_cursor_sprite.visible
end
#--------------------------------------------------------------------------
# ☆ カーソルの解放
#--------------------------------------------------------------------------
alias a1_battle_formation_spsb_dispose_cursor dispose_cursor
def dispose_cursor
a1_battle_formation_spsb_dispose_cursor
@prev_cursor_sprite.dispose
end
end
#==============================================================================
# ■ Window_ControlInfo
#==============================================================================
class Window_ControlInfo < Window_Base
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, Graphics.height - fitting_height(1), Graphics.width / 2, fitting_height(1))
self.opacity = 0
return if $game_party.all_members.size <= $game_party.max_battle_members
draw_background(Rect.new(0, 0, self.width, self.height))
draw_text(0, 0, contents.width, line_height, "Xボタン:パーティ入れ替え")
end
end
#==============================================================================
# ■ Window_FormationName
#==============================================================================
class Window_FormationName < Window_Base
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(window)
@text = ""
height = fitting_height(1)
super(window.x, window.y - height, window.width, height)
self.openness = 0
end
#--------------------------------------------------------------------------
# ○ テキストの設定
#--------------------------------------------------------------------------
def set_text(text, show_num = true)
@text = text
@text = "#{$game_party.battle_members.size}人陣形:#{text}" if show_num
self.width = text_size(@text).width + standard_padding * 3
create_contents
refresh
end
#--------------------------------------------------------------------------
# ○ リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text(0, 0, contents.width, line_height, @text)
end
end
#==============================================================================
# ■ Window_FormationMenu
#==============================================================================
class Window_FormationMenu < Window_Selectable
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@data = $game_party.enable_formation
@max_width = 0
@index = 0
super(0, 0, 0, fitting_height(@data.size))
setup_formation_list
self.index = @index
self.width = @max_width + standard_padding * 3
self.x = 60
self.y = Graphics.height / 5
create_contents
select(@index)
refresh
activate
end
#--------------------------------------------------------------------------
# ○ 陣形リストのセットアップ
#--------------------------------------------------------------------------
def setup_formation_list
@data.each_with_index {|id, i|
@index = i if id == $game_party.battle_formation
width = text_size($game_party.formation_name(id)).width
@max_width = @max_width < width ? width : @max_width
}
end
#--------------------------------------------------------------------------
# ○ 選択した項目を取得
#--------------------------------------------------------------------------
def select_formation
@data[self.index]
end
#--------------------------------------------------------------------------
# ○ 項目数の取得
#--------------------------------------------------------------------------
def item_max
@data.size
end
#--------------------------------------------------------------------------
# ○ 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
id = @data[index]
draw_text(0, line_height * index, contents.width, line_height, $game_party.formation_name(id))
end
#--------------------------------------------------------------------------
# ○ 決定やキャンセルなどのハンドリング処理
#--------------------------------------------------------------------------
def process_handling
super
return unless open? && active
return process_member_change if handle?(:member_change) && Input.trigger?(:X)
end
#--------------------------------------------------------------------------
# ○ メンバーチェンジ
#--------------------------------------------------------------------------
def process_member_change
return if $game_party.all_members.size <= $game_party.max_battle_members
Sound.play_ok
call_handler(:member_change)
end
end
#==============================================================================
# ■ Scene_FormationMenu
#==============================================================================
class Scene_FormationMenu < Scene_Battle
#--------------------------------------------------------------------------
# ○ 開始処理
#--------------------------------------------------------------------------
def start
@selected = false
BattleManager.init_members
define_battle_manager_method
create_main_viewport
create_spriteset
create_all_windows
end
#--------------------------------------------------------------------------
# ○ 開始後処理
#--------------------------------------------------------------------------
def post_start
perform_transition
Input.update
move_start_pos
wait(30)
@status_windows.each {|window| window.visible = true }
@control_info = Window_ControlInfo.new
@window_formation_menu.open
@formation_name_window.open
end
#--------------------------------------------------------------------------
# ○ 全ウィンドウの作成
#--------------------------------------------------------------------------
def create_all_windows
super
create_formation_manu_window
create_fomarion_name_window
end
#--------------------------------------------------------------------------
# ○ 陣形メニューウィンドウの作成
#--------------------------------------------------------------------------
def create_formation_manu_window
@window_formation_menu = Window_FormationMenu.new
@window_formation_menu.openness = 0
@window_formation_menu.set_handler(:ok, method(:on_formation_ok))
@window_formation_menu.set_handler(:cancel, method(:on_formation_cancel))
@window_formation_menu.set_handler(:member_change, method(:command_member_change))
end
#--------------------------------------------------------------------------
# ○ 陣形名ウィンドウの作成
#--------------------------------------------------------------------------
def create_fomarion_name_window
@formation_name_window = Window_FormationName.new(@window_formation_menu)
@formation_name_window.set_text($game_party.formation_name)
@formation_name_window.openness = 0
end
#--------------------------------------------------------------------------
# ○ フレーム更新
#--------------------------------------------------------------------------
def update
update_basic
end
#--------------------------------------------------------------------------
# ○ フレーム更新(基本)
#--------------------------------------------------------------------------
def update_basic
Graphics.update
Input.update
update_all_windows
$game_timer.update
@spriteset.update
update_info_viewport
update_message_open
end
#--------------------------------------------------------------------------
# ○ アクター[決定]
#--------------------------------------------------------------------------
def on_actor_ok
return next_select unless @selected
change_formation_member
end
#--------------------------------------------------------------------------
# ○ メンバー入れ替え
#--------------------------------------------------------------------------
def change_formation_member
return on_actor_cancel if @prev_index == @actor_window.index
change_formation_pos(@prev_index, @actor_window.index)
@selected = false
actor_select_start
end
#--------------------------------------------------------------------------
# ○ 場所の入れ替え
#--------------------------------------------------------------------------
def change_formation_pos(prev, now)
@actor_window.hide
@spriteset.prev_cursor.visible = false
$game_party.swap_order(now, prev)
battle_members.each {|member| recreate_status_windows(member) }
wait(35)
@actor_window.refresh
@party_battle_members = $game_party.battle_members
battle_members.each {|member| enable_open_status(member.index) }
@prev_index = -1
end
#--------------------------------------------------------------------------
# ○ 入れ替え先の選択
#--------------------------------------------------------------------------
def next_select
@prev_index = @actor_window.index
@selected = true
@spriteset.prev_cursor.target = battle_members[@actor_window.index]
@spriteset.prev_cursor.visible = true
actor_select_start
end
#--------------------------------------------------------------------------
# ○ アクター[キャンセル]
#--------------------------------------------------------------------------
def on_actor_cancel
return restart_select_actor if @spriteset.prev_cursor.visible
@actor_window.hide
@window_formation_menu.activate
@window_formation_menu.open
@formation_name_window.set_text($game_party.formation_name)
@control_info.open
end
#--------------------------------------------------------------------------
# ○ アクター選択の再開
#--------------------------------------------------------------------------
def restart_select_actor
@actor_window.activate
@spriteset.prev_cursor.visible = false
@prev_index = -1
@selected = false
end
#--------------------------------------------------------------------------
# ○ 陣形[決定]
#--------------------------------------------------------------------------
def on_formation_ok
@control_info.close
change_formation if $game_party.battle_formation != @window_formation_menu.select_formation
@actor_window.index = 0 if @actor_window.index < 0
actor_select_start
end
#--------------------------------------------------------------------------
# ○ 陣形の変更
#--------------------------------------------------------------------------
def change_formation
$game_party.battle_formation = @window_formation_menu.select_formation
@formation_name_window.close
@window_formation_menu.close
proc_change_formation
@formation_name_window.set_text($game_party.formation_name)
end
#--------------------------------------------------------------------------
# ○ アクター選択の開始
#--------------------------------------------------------------------------
def actor_select_start
index = @actor_window.index
@actor_window.show.activate
@actor_window.visible = false
@actor_window.index = index
@window_formation_menu.close
@formation_name_window.set_text($game_party.formation_name, false)
@formation_name_window.open
select_actor(index)
end
#--------------------------------------------------------------------------
# ○ 陣形[キャンセル]
#--------------------------------------------------------------------------
def on_formation_cancel
SceneManager.return
end
#--------------------------------------------------------------------------
# ○ 入れ替え
#--------------------------------------------------------------------------
def command_member_change
@window_member_change.setup_members
super
@control_info.close
@window_formation_menu.close
@formation_name_window.set_text("メンバーチェンジ", false)
end
#--------------------------------------------------------------------------
# ○ メンバーチェンジ[キャンセル]
#--------------------------------------------------------------------------
def on_member_change_cancel
super
@party_command_window.close
@control_info.open
@window_formation_menu.open
@party_battle_members = $game_party.battle_members
@formation_name_window.set_text($game_party.formation_name)
battle_members.each {|member| enable_open_status(member.index) }
end
end
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# メニュー画面で表示するコマンドウィンドウです。
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# ☆ 独自コマンドの追加用
#--------------------------------------------------------------------------
alias a1_battle_formation_wmc_add_original_commands add_original_commands
def add_original_commands
a1_battle_formation_wmc_add_original_commands
add_command(A1_System::BattleFormationConfig::COMMAND_NAME, :battle_formation)
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# メニュー画面の処理を行うクラスです。
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ☆ コマンドウィンドウの作成
#--------------------------------------------------------------------------
alias a1_battle_formation_sm_create_command_window create_command_window
def create_command_window
a1_battle_formation_sm_create_command_window
@command_window.set_handler(:battle_formation, method(:menu_battle_formation))
end
#--------------------------------------------------------------------------
# ○ メニュー[陣形]
#--------------------------------------------------------------------------
def menu_battle_formation
SceneManager.call(Scene_FormationMenu)
end
end
#==============================================================================
# ■ A1_System::CommonModule
#==============================================================================
class A1_System::CommonModule
#--------------------------------------------------------------------------
# ☆ 注釈コマンド定義
#--------------------------------------------------------------------------
alias a1_battle_formation_define_command define_command
def define_command
a1_battle_formation_define_command
@cmd_108["陣形メニュー"] = :menu_battle_formation
@cmd_108["陣形習得"] = :learn_battle_formation
@cmd_108["陣形変更"] = :change_battle_formation
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ○ 陣形メニュー
#--------------------------------------------------------------------------
def menu_battle_formation(params)
SceneManager.call(Scene_FormationMenu)
end
#--------------------------------------------------------------------------
# ○ 陣形習得
#--------------------------------------------------------------------------
def learn_battle_formation(params)
$game_party.learned_formation.push(params[1].to_i) if params[0] == "追加"
$game_party.learned_formation.delete(params[1].to_i) if params[0] == "削除"
end
#--------------------------------------------------------------------------
# ○ 陣形変更
#--------------------------------------------------------------------------
def change_battle_formation(params)
$game_party.battle_formation = params[0].to_i
end
end
end