# =========================================================================== # ◆ A1 Scripts ◆ # A1バトル共通スクリプト(RGSS3) # # バージョン : 1.23 (2012/01/27) # 作者 : A1 # URL     : http://a1tktk.web.fc2.com/ # --------------------------------------------------------------------------- # 更新履歴   :2012/01/18 Ver1.00 リリース # 2012/01/21 Ver1.10 装備拡張対応 # 2012/01/21 Ver1.10 メンバー加入時の不具合を修正 # 2012/01/21 Ver1.10 メンバー加入時に既にパーティに居るさい何もしないように修正 # 2012/01/24 Ver1.20 スキル拡張対応 # 2012/01/24 Ver1.21 Window_BattleActorの不具合を修正 # 2012/01/26 Ver1.22 Window_BattleSkillの不具合を修正 # 2012/01/27 Ver1.23 戦闘行動がない際の不具合を修正 # --------------------------------------------------------------------------- # 設置場所 #  A1共通スクリプトより下 # 一部再定義メソッドがあるため、なるべく上の方 # # 必要スクリプト # A1共通スクリプトVer4.30以上 #============================================================================== $imported = {} if $imported == nil if $imported["A1_Common_Script"] $imported["A1_BattleCommonScript"] = true old_common_script("A1バトル共通スクリプト", "4.30") if common_version < 4.30 #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ #  ゲーム中の全てのウィンドウのスーパークラスです。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ○ メソッドの定義 #-------------------------------------------------------------------------- def define_method(method, symbol) @method ||= {} @method[symbol] = method end #-------------------------------------------------------------------------- # ○ メソッドのコール #-------------------------------------------------------------------------- def call_method(symbol, *args) @method ||= {} @method[symbol].call(*args) if @method[symbol] end #-------------------------------------------------------------------------- # ○ 顔グラフィックの描画(解放なし) #-------------------------------------------------------------------------- def draw_face_no_dispose(face_name, face_index, x, y, enabled = true) bitmap = Cache.face(face_name) rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) end #-------------------------------------------------------------------------- # ○ 背景の描画 #-------------------------------------------------------------------------- def draw_background(rect) temp_rect = rect.clone temp_rect.width /= 2 contents.gradient_fill_rect(temp_rect, back_color2, back_color1) temp_rect.x = temp_rect.width contents.gradient_fill_rect(temp_rect, back_color1, back_color2) end #-------------------------------------------------------------------------- # ○ 背景色 1 の取得 #-------------------------------------------------------------------------- def back_color1 Color.new(0, 0, 0, 192) end #-------------------------------------------------------------------------- # ○ 背景色 2 の取得 #-------------------------------------------------------------------------- def back_color2 Color.new(0, 0, 0, 0) end end #============================================================================== # ■ Window_Help #------------------------------------------------------------------------------ #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。 #============================================================================== class Window_Help < Window_Base #-------------------------------------------------------------------------- # ○ センターにテキストを描画 #-------------------------------------------------------------------------- def draw_center_text(text) contents.clear draw_text(0, 0, contents.width, line_height, text, 1) end end #============================================================================== # ■ Window_BattleActor #------------------------------------------------------------------------------ #  バトル画面で、行動対象のアクターを選択するウィンドウです。 #============================================================================== class Window_BattleActor < Window_BattleStatus #-------------------------------------------------------------------------- # ★ ウィンドウの表示 #-------------------------------------------------------------------------- def show setup_remain if @info_viewport self.visible = true refresh open self end #-------------------------------------------------------------------------- # ★ ウィンドウの非表示 #-------------------------------------------------------------------------- def hide close @info_viewport.rect.width = Graphics.width if @info_viewport call_method(:select_actor_end) end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update return update_basic unless self.visible super self.visible = false if self.openness == 0 end #-------------------------------------------------------------------------- # ○ フレーム更新(基本) #-------------------------------------------------------------------------- def update_basic process_cursor_move process_handling end #-------------------------------------------------------------------------- # ○ 項目の選択 #-------------------------------------------------------------------------- def select(index) super call_method(:select_actor, index) end #-------------------------------------------------------------------------- # ○ ウィンドウの調整 #-------------------------------------------------------------------------- def setup_remain width_remain = Graphics.width - width self.x = width_remain @info_viewport.rect.width = width_remain select(0) end end #============================================================================== # ■ Window_BattleEnemy #------------------------------------------------------------------------------ #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。 #============================================================================== class Window_BattleEnemy < Window_Selectable #-------------------------------------------------------------------------- # ★ ウィンドウの表示 #-------------------------------------------------------------------------- def show setup_remain if @info_viewport self.visible = true open self end #-------------------------------------------------------------------------- # ★ ウィンドウの非表示 #-------------------------------------------------------------------------- def hide close @info_viewport.rect.width = Graphics.width if @info_viewport call_method(:select_enemy_end) end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update return update_basic unless self.visible super self.visible = false if self.openness == 0 end #-------------------------------------------------------------------------- # ○ フレーム更新(基本) #-------------------------------------------------------------------------- def update_basic process_cursor_move process_handling end #-------------------------------------------------------------------------- # ○ 項目の選択 #-------------------------------------------------------------------------- def select(index) super call_method(:select_enemy, index) end #-------------------------------------------------------------------------- # ○ ウィンドウの調整 #-------------------------------------------------------------------------- def setup_remain width_remain = Graphics.width - width self.x = width_remain @info_viewport.rect.width = width_remain select(0) end end #============================================================================== # ■ Window_BattleSkill #------------------------------------------------------------------------------ #  バトル画面で、使用するスキルを選択するウィンドウです。 #============================================================================== class Window_BattleSkill < Window_SkillList #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- alias a1_psw_wbs_initialize initialize def initialize(help_window, info_viewport) a1_psw_wbs_initialize(help_window, info_viewport) self.openness = 0 self.visible = true @help_window.openness = 0 @help_window.visible = true end #-------------------------------------------------------------------------- # ○ 高さを変える #-------------------------------------------------------------------------- def resize_height(base_y) self.height = base_y - self.y create_contents end #-------------------------------------------------------------------------- # ★ ウィンドウの表示 #-------------------------------------------------------------------------- def show self.visible = true @help_window.visible = true select_last open @help_window.open self end #-------------------------------------------------------------------------- # ★ ウィンドウの非表示 #-------------------------------------------------------------------------- def hide close @help_window.close @info_viewport.rect.width = Graphics.width if @info_viewport call_method(:skill_item_window_hide) end #-------------------------------------------------------------------------- # ○ オープン #-------------------------------------------------------------------------- def open self.visible = true call_method(:skill_item_window_show) super end #-------------------------------------------------------------------------- # ○ アクティブ化 #-------------------------------------------------------------------------- def activate open @help_window.open super end end #============================================================================== # ■ Window_BattleItem #------------------------------------------------------------------------------ #  バトル画面で、使用するアイテムを選択するウィンドウです。 #============================================================================== class Window_BattleItem < Window_ItemList #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- alias a1_battle_common_wbi_initialize initialize def initialize(help_window, info_viewport) a1_battle_common_wbi_initialize(help_window, info_viewport) self.openness = 0 self.visible = true @help_window.openness = 0 @help_window.visible = true end #-------------------------------------------------------------------------- # ○ 高さを変える #-------------------------------------------------------------------------- def resize_height(base_y) self.height = base_y - self.y create_contents end #-------------------------------------------------------------------------- # ★ ウィンドウの表示 #-------------------------------------------------------------------------- def show self.visible = true @help_window.visible = true select_last open @help_window.open self end #-------------------------------------------------------------------------- # ★ ウィンドウの非表示 #-------------------------------------------------------------------------- def hide close @help_window.close call_method(:skill_item_window_hide) end #-------------------------------------------------------------------------- # ○ オープン #-------------------------------------------------------------------------- def open self.visible = true call_method(:skill_item_window_show) super end #-------------------------------------------------------------------------- # ○ アクティブ化 #-------------------------------------------------------------------------- def activate open @help_window.open super end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update return unless self.visible super self.visible = false if self.openness == 0 end end #============================================================================== # ■ Window_ActorCommand #------------------------------------------------------------------------------ #  バトル画面で、アクターの行動を選択するウィンドウです。 #============================================================================== class Window_ActorCommand < Window_Command #-------------------------------------------------------------------------- # ☆ セットアップ #-------------------------------------------------------------------------- alias a1_battle_common_wac_setup setup def setup(actor) call_method(:actor_command_setup, actor) a1_battle_common_wac_setup(actor) end #-------------------------------------------------------------------------- # ○ ウィンドウのアクティブ化 #-------------------------------------------------------------------------- def activate open super end #-------------------------------------------------------------------------- # ○ オープン #-------------------------------------------------------------------------- def open call_method(:actor_command_open) super end #-------------------------------------------------------------------------- # ○ クローズ #-------------------------------------------------------------------------- def close call_method(:actor_command_close) super end end #============================================================================== # ■ Window_BattleStatus #------------------------------------------------------------------------------ #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。 #============================================================================== class Window_BattleStatus < Window_Selectable #-------------------------------------------------------------------------- # ☆ リフレッシュ #-------------------------------------------------------------------------- alias a1_battle_common_wbs_refresh refresh def refresh call_method(:refresh_statsu_window) return unless self.visible a1_battle_common_wbs_refresh end #-------------------------------------------------------------------------- # ○ ウィンドウを開く #-------------------------------------------------------------------------- def open super call_method(:open_status_window) end #-------------------------------------------------------------------------- # ○ ウィンドウを閉じる #-------------------------------------------------------------------------- def close super call_method(:close_status_window) end #-------------------------------------------------------------------------- # ○ 項目の選択 #-------------------------------------------------------------------------- def select(index) super call_method(:select_status_window, index) end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update call_method(:update_status_window) return unless self.visible super end #-------------------------------------------------------------------------- # ○ 解放 #-------------------------------------------------------------------------- def dispose super call_method(:dispose_status_window) end end #============================================================================== # ■ Window_PersonalStatus #============================================================================== class Window_PersonalStatus < Window_Base #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, opacity = 0) super(x, y, Graphics.width / 2, 120) self.opacity = opacity self.openness = 0 @actor = nil end #-------------------------------------------------------------------------- # ○ アクターの設定 #-------------------------------------------------------------------------- def actor=(actor) @actor = actor refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_face(@actor.face_name, @actor.face_index, 0, 0) draw_text(116, line_height * 0, contents.width, line_height, @actor.name) draw_actor_level(@actor, 116, 0 + line_height * 1) draw_actor_icons(@actor, 180, 0 + line_height * 1) draw_actor_hp(@actor, 116, 0 + line_height * 2, 128) draw_actor_mp(@actor, 116, 0 + line_height * 3, 60) draw_actor_tp(@actor, 184, 0 + line_height * 3, 60) if $data_system.opt_display_tp end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update return unless self.visible super self.visible = false if self.openness == 0 end #-------------------------------------------------------------------------- # ○ オープン #-------------------------------------------------------------------------- def open self.visible = true super end #-------------------------------------------------------------------------- # ○ 顔グラフィックの描画 #-------------------------------------------------------------------------- def draw_face(face_name, face_index, x, y, enabled = true) draw_face_no_dispose(face_name, face_index, x, y, enabled) end end #============================================================================== # ■ RPG::Enemy #============================================================================== class RPG::Enemy < RPG::BaseItem #-------------------------------------------------------------------------- # ○ 初期装備 #-------------------------------------------------------------------------- def equips @equips ||= [0,0,0,0,0] @equips[0] ||= $a1_common.note_data_one(self.note, "エネミー武器", 0) return @equips end end #============================================================================== # ■ Game_Enemy #------------------------------------------------------------------------------ #  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の # 内部で使用されます。 #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_battle_common_ge_initialize initialize def initialize(index, enemy_id) @equips = [] a1_battle_common_ge_initialize(index, enemy_id) init_equips(enemy.equips) end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors) # の内部で使用され、Game_Party クラス($game_party)からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ★ 装備品の初期化 # equips : 初期装備の配列 #-------------------------------------------------------------------------- def init_equips(equips) super end #-------------------------------------------------------------------------- # ★ 装備タイプからスロット ID に変換(空きを優先) #-------------------------------------------------------------------------- def empty_slot(etype_id) super end #-------------------------------------------------------------------------- # ★ 装備タイプからスロット ID のリストに変換 #-------------------------------------------------------------------------- def slot_list(etype_id) super end #-------------------------------------------------------------------------- # ★ エディタで設定されたインデックスを装備タイプ ID に変換 #-------------------------------------------------------------------------- def index_to_etype_id(index) super end #-------------------------------------------------------------------------- # ★ 装備スロットの配列を取得 #-------------------------------------------------------------------------- def equip_slots super end #-------------------------------------------------------------------------- # ★ 装備品オブジェクトの配列取得 #-------------------------------------------------------------------------- def equips super end #-------------------------------------------------------------------------- # ★ 武器オブジェクトの配列取得 #-------------------------------------------------------------------------- def weapons super end #-------------------------------------------------------------------------- # ★ 通常能力値の加算値取得 #-------------------------------------------------------------------------- def param_plus(param_id) super end #-------------------------------------------------------------------------- # ☆ 通常攻撃 アニメーション ID の取得 #-------------------------------------------------------------------------- alias a1_battle_common_ga_atk_animation_id1 atk_animation_id1 def atk_animation_id1 return a1_battle_common_ga_atk_animation_id1 if !@current_weapon || @current_weapon.is_a?(Array) @current_weapon.animation_id end #-------------------------------------------------------------------------- # ☆ 通常攻撃 アニメーション ID の取得(二刀流:武器2) #-------------------------------------------------------------------------- alias a1_battle_common_ga_atk_animation_id2 atk_animation_id2 def atk_animation_id2 return a1_battle_common_ga_atk_animation_id2 if !@current_weapon || @current_weapon.is_a?(Array) @current_weapon.animation_id end #-------------------------------------------------------------------------- # ○ 装備タイプ名を取得 #-------------------------------------------------------------------------- def e_type_name(item) return $data_system.weapon_types[item.wtype_id] if item.is_a?(RPG::Weapon) return $data_system.armor_types[item.atype_id] if item.is_a?(RPG::Armor) end end #============================================================================== # ■ Game_BattlerBase #------------------------------------------------------------------------------ #  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ # のクラスは Game_Battler クラスのスーパークラスとして使用されます。 #============================================================================== class Game_BattlerBase #-------------------------------------------------------------------------- # ○ 二刀流? #-------------------------------------------------------------------------- def two_sword_style? weapons[0] && weapons[1] end #-------------------------------------------------------------------------- # ○ バトラーオブジェクト取得 #-------------------------------------------------------------------------- def battler return actor if self.actor? return enemy end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。 #============================================================================== class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :current_weapon attr_accessor :current_main #-------------------------------------------------------------------------- # ○ 装備品の初期化 # equips : 初期装備の配列 #-------------------------------------------------------------------------- def init_equips(equips) @equips = Array.new(equip_slots.size) { Game_BaseItem.new } equips.each_with_index do |item_id, i| etype_id = index_to_etype_id(i) slot_id = empty_slot(etype_id) @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id end refresh end #-------------------------------------------------------------------------- # ○ 装備タイプからスロット ID に変換(空きを優先) #-------------------------------------------------------------------------- def empty_slot(etype_id) list = slot_list(etype_id) list.find {|i| @equips[i].is_nil? } || list[0] end #-------------------------------------------------------------------------- # ○ 装備タイプからスロット ID のリストに変換 #-------------------------------------------------------------------------- def slot_list(etype_id) result = [] equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id } result end #-------------------------------------------------------------------------- # ○ エディタで設定されたインデックスを装備タイプ ID に変換 #-------------------------------------------------------------------------- def index_to_etype_id(index) index == 1 && dual_wield? ? 0 : index end #-------------------------------------------------------------------------- # ○ 装備スロットの配列を取得 #-------------------------------------------------------------------------- def equip_slots return [0,0,2,3,4] if dual_wield? # 二刀流 return [0,1,2,3,4] # 通常 end #-------------------------------------------------------------------------- # ○ 装備品オブジェクトの配列取得 #-------------------------------------------------------------------------- def equips @equips.collect {|item| item.object } end #-------------------------------------------------------------------------- # ○ 武器オブジェクトの配列取得 #-------------------------------------------------------------------------- def weapons @equips.select {|item| item.is_weapon? }.collect {|item| item.object } end #-------------------------------------------------------------------------- # ○ 通常能力値の加算値取得 #-------------------------------------------------------------------------- def param_plus(param_id) equips.compact.inject(super) {|r, item| r += item.params[param_id] + ex_item_params(item, param_id) } end #-------------------------------------------------------------------------- # ○ アイテムにかける追加要素 #-------------------------------------------------------------------------- def ex_item_params(item, param_id) return 0 end #-------------------------------------------------------------------------- # ○ スキルを取得 #-------------------------------------------------------------------------- def skill(skill_id) $data_skills[skill_id] end end #============================================================================== # ■ Game_Party #------------------------------------------------------------------------------ #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ # スのインスタンスは $game_party で参照されます。 #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ☆ アクターを加える #-------------------------------------------------------------------------- alias a1_battle_common_gp_add_actor add_actor def add_actor(actor_id) return a1_battle_common_gp_add_actor(actor_id) unless in_battle return if @actors.include?(actor_id) prev_add_actor(battle_members) insert_actor(actor_id) post_add_actor($game_actors[actor_id]) end #-------------------------------------------------------------------------- # ○ アクターを加える #-------------------------------------------------------------------------- def insert_actor(actor_id) @new_index = @remove_member_index ? @remove_member_index[0] : @actors.size @actors.insert(@new_index, actor_id) unless @actors.include?(actor_id) $game_player.refresh $game_map.need_refresh = true return unless @remove_member_index @remove_member_index.delete_at(0) @remove_member_index = nil if @remove_member_index.empty? end #-------------------------------------------------------------------------- # ○ アクターを加えたIndexを取得 #-------------------------------------------------------------------------- def new_index @new_index end #-------------------------------------------------------------------------- # ○ アクターを加える前処理 #-------------------------------------------------------------------------- def prev_add_actor(members) BattleManager.call_method(:prev_add_battler, members) end #-------------------------------------------------------------------------- # ○ アクターを加えた後処理 #-------------------------------------------------------------------------- def post_add_actor(member) BattleManager.call_method(:post_add_battler, member) end #-------------------------------------------------------------------------- # ☆ アクターを外す #-------------------------------------------------------------------------- alias a1_battle_common_gp_remove_actor remove_actor def remove_actor(actor_id) prev_remove_actor($game_actors[actor_id]) if in_battle a1_battle_common_gp_remove_actor(actor_id) post_remove_actor if in_battle end #-------------------------------------------------------------------------- # ○ アクターを外す前処理 #-------------------------------------------------------------------------- def prev_remove_actor(member) @remove_member_index ||= [] @remove_member_index.push(member.index) BattleManager.call_method(:prev_remove_battler, member) end #-------------------------------------------------------------------------- # ○ アクターを外した後処理 #-------------------------------------------------------------------------- def post_remove_actor BattleManager.call_method(:post_remove_battler) end end #============================================================================== # ■ BattleManager #------------------------------------------------------------------------------ #  戦闘の進行を管理するモジュールです。 #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ○ エイリアス用特異メソッド #-------------------------------------------------------------------------- class << self alias :a1_battle_common_bm_turn_end :turn_end alias :a1_battle_common_bm_turn_start :turn_start alias :a1_battle_common_bm_battle_end :battle_end end #-------------------------------------------------------------------------- # ☆ ターン開始 #-------------------------------------------------------------------------- def self.turn_start @turn_end_wait = 0 a1_battle_common_bm_turn_start end #-------------------------------------------------------------------------- # ☆ ターン終了 #-------------------------------------------------------------------------- def self.turn_end call_method(:wait, @turn_end_wait) if @turn_end_wait > 0 @turn_end_wait = 0 a1_battle_common_bm_turn_end end #-------------------------------------------------------------------------- # ○ メソッドの設定 #-------------------------------------------------------------------------- def self.define_method(method, symbol) @method ||= {} @method[symbol] = method end #-------------------------------------------------------------------------- # ○ メソッドのコール #-------------------------------------------------------------------------- def self.call_method(symbol, *args) @method[symbol].call(*args) if @method[symbol] end #-------------------------------------------------------------------------- # ○ ターン終了後ウェイト設定 #-------------------------------------------------------------------------- def self.turn_end_wait=(flame) @turn_end_wait = flame if @turn_end_wait < flame || flame == 0 end #-------------------------------------------------------------------------- # ☆ 戦闘終了 # result : 結果(0:勝利 1:逃走 2:敗北) #-------------------------------------------------------------------------- def self.battle_end(result) call_method(:battle_end, result) a1_battle_common_bm_battle_end(result) end end #============================================================================== # ■ Game_Action #------------------------------------------------------------------------------ #  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され # ます。 #============================================================================== class Game_Action #-------------------------------------------------------------------------- # ☆ ターゲットの配列作成 #-------------------------------------------------------------------------- alias a1_battle_common_gac_make_targets make_targets def make_targets @targets ||= pre_make_targets return @targets end #-------------------------------------------------------------------------- # ○ ターゲットの配列先行作成 #-------------------------------------------------------------------------- def pre_make_targets @targets = a1_battle_common_gac_make_targets end #-------------------------------------------------------------------------- # ○ ターゲットの配列を取得 #-------------------------------------------------------------------------- def targets @targets.compact end #-------------------------------------------------------------------------- # ○ ターゲットの配列をクリア #-------------------------------------------------------------------------- def clear_targets @targets = nil end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ☆ 開始処理 #-------------------------------------------------------------------------- alias a1_battle_common_sb_start start def start a1_battle_common_sb_start define_battle_manager_method end #-------------------------------------------------------------------------- # ○ バトルマネージャメソッドの定義 #-------------------------------------------------------------------------- def define_battle_manager_method BattleManager.define_method(method(:wait), :wait) BattleManager.define_method(method(:post_add_battler), :post_add_battler) BattleManager.define_method(method(:post_remove_battler), :post_remove_battler) BattleManager.define_method(method(:prev_remove_battler), :prev_remove_battler) BattleManager.define_method(method(:prev_add_battler), :prev_add_battler) BattleManager.define_method(method(:process_victory), :process_victory) BattleManager.define_method(method(:battle_end), :battle_end) end #-------------------------------------------------------------------------- # ☆ ステータスウィンドウの作成 #-------------------------------------------------------------------------- alias a1_battle_common_sb_create_status_window create_status_window def create_status_window a1_battle_common_sb_create_status_window post_create_status_window define_status_window_method end #-------------------------------------------------------------------------- # ○ ステータスウィンドウ作成の後処理 #-------------------------------------------------------------------------- def post_create_status_window end #-------------------------------------------------------------------------- # ○ ステータスウィンドウメソッドの定義 #-------------------------------------------------------------------------- def define_status_window_method @status_window.define_method(method(:refresh_statsu_window), :refresh_statsu_window) @status_window.define_method(method(:close_status_window), :close_status_window) @status_window.define_method(method(:open_status_window), :open_status_window) @status_window.define_method(method(:select_status_window), :select_status_window) @status_window.define_method(method(:update_status_window), :update_status_window) @status_window.define_method(method(:dispose_status_window), :dispose_status_window) end #-------------------------------------------------------------------------- # ○ ステータスウィンドウがリフレッシュされた時の処理 #-------------------------------------------------------------------------- def refresh_statsu_window end #-------------------------------------------------------------------------- # ○ ステータスウィンドウがクローズされた時の処理 #-------------------------------------------------------------------------- def close_status_window end #-------------------------------------------------------------------------- # ○ ステータスウィンドウがオープンされた時の処理 #-------------------------------------------------------------------------- def open_status_window end #-------------------------------------------------------------------------- # ○ ステータスウィンドウがセレクトされた時の処理 #-------------------------------------------------------------------------- def select_status_window(index) end #-------------------------------------------------------------------------- # ○ ステータスウィンドウが更新された時の処理 #-------------------------------------------------------------------------- def update_status_window end #-------------------------------------------------------------------------- # ○ ステータスウィンドウが解放された時の処理 #-------------------------------------------------------------------------- def dispose_status_window end #-------------------------------------------------------------------------- # ☆ 情報表示ビューポートの作成 #-------------------------------------------------------------------------- alias a1_battle_common_sb_create_info_viewport create_info_viewport def create_info_viewport a1_battle_common_sb_create_info_viewport post_create_info_viewport end #-------------------------------------------------------------------------- # ○ 情報表示ビューポート作成の後処理 #-------------------------------------------------------------------------- def post_create_info_viewport end #-------------------------------------------------------------------------- # ☆ スキルウィンドウの作成 #-------------------------------------------------------------------------- alias a1_battle_common_sb_create_skill_window create_skill_window def create_skill_window a1_battle_common_sb_create_skill_window post_create_skill_window define_skill_window_method end #-------------------------------------------------------------------------- # ○ スキルウィンドウ作成の後処理 #-------------------------------------------------------------------------- def post_create_skill_window end #-------------------------------------------------------------------------- # ○ スキルウィンドウメソッドの定義 #-------------------------------------------------------------------------- def define_skill_window_method @skill_window.define_method(method(:skill_item_window_show), :skill_item_window_show) @skill_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide) end #-------------------------------------------------------------------------- # ☆ アイテムウィンドウの作成 #-------------------------------------------------------------------------- alias a1_battle_common_sb_create_item_window create_item_window def create_item_window a1_battle_common_sb_create_item_window post_create_item_window define_item_window_method end #-------------------------------------------------------------------------- # ○ アイテムウィンドウ作成の後処理 #-------------------------------------------------------------------------- def post_create_item_window end #-------------------------------------------------------------------------- # ○ アイテムウィンドウメソッドの定義 #-------------------------------------------------------------------------- def define_item_window_method @item_window.define_method(method(:skill_item_window_show), :skill_item_window_show) @item_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide) end #-------------------------------------------------------------------------- # ○ スキル/アイテムウィンドウが表示された時の処理 #-------------------------------------------------------------------------- def skill_item_window_show end #-------------------------------------------------------------------------- # ○ スキル/アイテムウィンドウが非表示になった時の処理 #-------------------------------------------------------------------------- def skill_item_window_hide end #-------------------------------------------------------------------------- # ☆ パーティコマンドウィンドウの作成 #-------------------------------------------------------------------------- alias a1_battle_common_sb_create_party_command_window create_party_command_window def create_party_command_window a1_battle_common_sb_create_party_command_window post_create_party_command_window define_party_command_window_method define_party_command_window_handle end #-------------------------------------------------------------------------- # ○ パーティコマンドウィンドウ作成の後処理 #-------------------------------------------------------------------------- def post_create_party_command_window end #-------------------------------------------------------------------------- # ○ パーティコマンドウィンドウメソッドの定義 #-------------------------------------------------------------------------- def define_party_command_window_method end #-------------------------------------------------------------------------- # ○ パーティコマンドウィンドウハンドルの定義 #-------------------------------------------------------------------------- def define_party_command_window_handle end #-------------------------------------------------------------------------- # ☆ アクターウィンドウの作成 #-------------------------------------------------------------------------- alias a1_battle_common_sb_create_actor_window create_actor_window def create_actor_window a1_battle_common_sb_create_actor_window post_create_actor_window define_actor_window_method end #-------------------------------------------------------------------------- # ○ アクターウィンドウ作成の後処理 #-------------------------------------------------------------------------- def post_create_actor_window end #-------------------------------------------------------------------------- # ○ アクターウィンドウメソッドの定義 #-------------------------------------------------------------------------- def define_actor_window_method @actor_window.define_method(method(:select_actor), :select_actor) @actor_window.define_method(method(:select_actor_end), :select_actor_end) end #-------------------------------------------------------------------------- # ○ アクターウィンドウをセレクトした時の処理 #-------------------------------------------------------------------------- def select_actor(index) end #-------------------------------------------------------------------------- # ○ アクターウィンドウをセレクト終了した時の処理 #-------------------------------------------------------------------------- def select_actor_end end #-------------------------------------------------------------------------- # ☆ 敵キャラウィンドウの作成 #-------------------------------------------------------------------------- alias a1_battle_common_sb_create_enemy_window create_enemy_window def create_enemy_window a1_battle_common_sb_create_enemy_window post_create_enemy_window define_enemy_window_method end #-------------------------------------------------------------------------- # ○ 敵キャラウィンドウ作成の後処理 #-------------------------------------------------------------------------- def post_create_enemy_window end #-------------------------------------------------------------------------- # ○ 敵キャラウィンドウメソッドの定義 #-------------------------------------------------------------------------- def define_enemy_window_method @enemy_window.define_method(method(:select_enemy), :select_enemy) @enemy_window.define_method(method(:select_enemy_end) ,:select_enemy_end) end #-------------------------------------------------------------------------- # ○ 敵キャラウィンドウをセレクトした時の処理 #-------------------------------------------------------------------------- def select_enemy(index) end #-------------------------------------------------------------------------- # ○ 敵キャラウィンドウをセレクト終了した時の処理 #-------------------------------------------------------------------------- def select_enemy_end end #-------------------------------------------------------------------------- # ☆ アクターコマンドウィンドウの作成 #-------------------------------------------------------------------------- alias a1_battle_common_sb_start_create_actor_command_window create_actor_command_window def create_actor_command_window a1_battle_common_sb_start_create_actor_command_window post_create_actor_command_window define_actor_command_handle define_actor_command_window end #-------------------------------------------------------------------------- # ○ アクターコマンドウィンドウ作成の後処理 #-------------------------------------------------------------------------- def post_create_actor_command_window end #-------------------------------------------------------------------------- # ○ アクターコマンドウィンドウメソッドの定義 #-------------------------------------------------------------------------- def define_actor_command_window @actor_command_window.define_method(method(:actor_command_open), :actor_command_open) @actor_command_window.define_method(method(:actor_command_close), :actor_command_close) @actor_command_window.define_method(method(:actor_command_setup), :actor_command_setup) end #-------------------------------------------------------------------------- # ○ アクターコマンドウィンドウハンドルの定義 #-------------------------------------------------------------------------- def define_actor_command_handle end #-------------------------------------------------------------------------- # ○ アクターコマンドウィンドウがオープンした時の処理 #-------------------------------------------------------------------------- def actor_command_open end #-------------------------------------------------------------------------- # ○ アクターコマンドウィンドウがクローズした時の処理 #-------------------------------------------------------------------------- def actor_command_close end #-------------------------------------------------------------------------- # ○ アクターコマンドウィンドウのセットアップ時の処理 #-------------------------------------------------------------------------- def actor_command_setup(actor) end #-------------------------------------------------------------------------- # ☆ パーティコマンド選択の開始 #-------------------------------------------------------------------------- alias a1_battle_common_sb_start_party_command_selection start_party_command_selection def start_party_command_selection prev_start_party_command_selection a1_battle_common_sb_start_party_command_selection post_start_party_command_selection end #-------------------------------------------------------------------------- # ○ パーティコマンド選択の開始の前処理 #-------------------------------------------------------------------------- def prev_start_party_command_selection end #-------------------------------------------------------------------------- # ○ パーティコマンド選択の開始の後処理 #-------------------------------------------------------------------------- def post_start_party_command_selection end #-------------------------------------------------------------------------- # ☆ 次のコマンド入力へ #-------------------------------------------------------------------------- alias a1_battle_common_sb_next_command next_command def next_command prev_next_command a1_battle_common_sb_next_command post_next_command end #-------------------------------------------------------------------------- # ○ 次のコマンド入力への前処理 #-------------------------------------------------------------------------- def prev_next_command end #-------------------------------------------------------------------------- # ○ 次のコマンド入力への後処理 #-------------------------------------------------------------------------- def post_next_command end #-------------------------------------------------------------------------- # ☆ 前のコマンド入力へ #-------------------------------------------------------------------------- alias a1_battle_common_sb_prior_command prior_command def prior_command prev_prior_command a1_battle_common_sb_prior_command post_prior_command end #-------------------------------------------------------------------------- # ○ 前のコマンド入力への前処理 #-------------------------------------------------------------------------- def prev_prior_command end #-------------------------------------------------------------------------- # ○ 前のコマンド入力への後処理 #-------------------------------------------------------------------------- def post_prior_command end #-------------------------------------------------------------------------- # ☆ ターン開始 #-------------------------------------------------------------------------- alias a1_battle_common_sb_turn_start turn_start def turn_start prev_turn_start a1_battle_common_sb_turn_start post_turn_start end #-------------------------------------------------------------------------- # ○ ターン開始の前処理 #-------------------------------------------------------------------------- def prev_turn_start end #-------------------------------------------------------------------------- # ○ ターン開始の後処理 #-------------------------------------------------------------------------- def post_turn_start end #-------------------------------------------------------------------------- # ☆ ターン終了 #-------------------------------------------------------------------------- alias a1_battle_common_sb_turn_end turn_end def turn_end prev_turn_end a1_battle_common_sb_turn_end post_turn_end end #-------------------------------------------------------------------------- # ○ ターン終了の前処理 #-------------------------------------------------------------------------- def prev_turn_end end #-------------------------------------------------------------------------- # ○ ターン終了の後処理 #-------------------------------------------------------------------------- def post_turn_end end #-------------------------------------------------------------------------- # ○ ウィンドウが閉じるまでウェイト #-------------------------------------------------------------------------- def wait_fot_window_close(window) update_basic while window.close? end #-------------------------------------------------------------------------- # ○ アクターのバトルメンバー取得 #-------------------------------------------------------------------------- def battle_members @party_battle_members ||= $game_party.battle_members return @party_battle_members end #-------------------------------------------------------------------------- # ○ バトルメンバーの追加の前処理 #-------------------------------------------------------------------------- def prev_add_battler(members) end #-------------------------------------------------------------------------- # ○ バトルメンバーの追加後の処理 #-------------------------------------------------------------------------- def post_add_battler(member) @party_battle_members = $game_party.battle_members end #-------------------------------------------------------------------------- # ○ バトルメンバー削除の前処理 #-------------------------------------------------------------------------- def prev_remove_battler(member) end #-------------------------------------------------------------------------- # ○ バトルメンバーの削除後の処理 #-------------------------------------------------------------------------- def post_remove_battler @party_battle_members = $game_party.battle_members end #-------------------------------------------------------------------------- # ☆ 戦闘行動の実行 #-------------------------------------------------------------------------- alias a1_battle_common_sb_execute_action execute_action def execute_action prev_execute_action a1_battle_common_sb_execute_action post_execute_action end #-------------------------------------------------------------------------- # ○ 戦闘行動の実行の前処理 #-------------------------------------------------------------------------- def prev_execute_action @subject.current_action.pre_make_targets end #-------------------------------------------------------------------------- # ○ 戦闘行動の実行の後処理 #-------------------------------------------------------------------------- def post_execute_action @subject.current_action.clear_targets if @subject.current_action end #-------------------------------------------------------------------------- # ☆ スキル/アイテムの使用 #-------------------------------------------------------------------------- alias a1_battle_common_sb_use_item use_item def use_item prev_use_item a1_battle_common_sb_use_item post_use_item end #-------------------------------------------------------------------------- # ○ スキル/アイテムの使用の前処理 #-------------------------------------------------------------------------- def prev_use_item end #-------------------------------------------------------------------------- # ○ スキル/アイテムの使用の後処理 #-------------------------------------------------------------------------- def post_use_item end #-------------------------------------------------------------------------- # ○ 勝利の処理 #-------------------------------------------------------------------------- def process_victory end #-------------------------------------------------------------------------- # ○ 戦闘終了 #-------------------------------------------------------------------------- def battle_end(result) $game_party.all_members.each {|member| init_member_battle_end(member) } end #-------------------------------------------------------------------------- # ○ 戦闘終了時のメンバー初期化 #-------------------------------------------------------------------------- def init_member_battle_end(member) member.current_weapon = nil member.current_main = nil end end end