#=========================================================================== # ◆ A1 Scripts ◆ # サイドビューバトル基本スクリプト(RGSS3) # # バージョン : 2.40 (2012/01/26) # 作者 : A1 # URL     : http://a1tktk.web.fc2.com/ #--------------------------------------------------------------------------- # 機能: # ・パトラッシュ・・・僕はもう疲れたよ・・・ #--------------------------------------------------------------------------- # 更新履歴   :2012/01/16 Ver1.00 リリース #    :2012/01/17 Ver1.10 同時アクションの見直し #    :2012/01/17 Ver1.10 防御待機追加 #    :2012/01/17 Ver1.10 陣形対応 # :2012/01/17 Ver1.10 戦闘中入れ替え対応 # :2012/01/18 Ver2.00 A1バトル共通スクリプト対応 # :2012/01/18 Ver2.00 「逃げる」対応 # :2012/01/18 Ver2.00 「身代わり」対応 # :2012/01/18 Ver2.00 「反撃」「反射」対応 # :2012/01/19 Ver2.10 パーティ加入/脱退対応 # :2012/01/19 Ver2.10 イベントコマンド「注釈」からアクション発動実装 # :2012/01/21 Ver2.20 全体通常攻撃対応 # :2012/01/21 Ver2.20 装備拡張対応 # :2012/01/24 Ver2.30 スキル拡張対応 # :2012/01/24 Ver2.30 左利きの場合、左から攻撃するように変更 # :2012/01/26 Ver2.40 スキル拡張の新機能対応 #--------------------------------------------------------------------------- # 設置場所 # サイドビューバトルアクション設定以下 # # 必要スクリプト # サイドビューバトルアクション設定 #--------------------------------------------------------------------------- # 使い方 # ■ サイドビューアクション設定 に設定します # # バトル用イベントコマンド「注釈」に記述します # # 加入アクション アクション名 # 脱退アクション アクション名 # # 次にメンバーが加入/脱退した時に行うアクションを指定します # # アクション実行 index|アクター名 アクション名 # # 戦闘時のIndexか、アクター名を指定して # 指定したアクションを実行します # # 戦闘行動を伴うもの(攻撃など)は動作保証外です #============================================================================== $imported ||= {} if $imported["A1_SideViewBattleConfig"] $imported["A1_SideViewBattle"] = true old_common_script("サイドビューバトル", "4.20") if common_version < 4.20 #============================================================================== # ■ A1_System::SideViewAction #============================================================================== class A1_System::SideViewAction #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :action_list attr_reader :action_params attr_reader :action_symbol attr_reader :weapon_action attr_reader :character_action attr_reader :state_actions attr_reader :condition_list attr_reader :picture_params #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @action_list = A1_System::SideViewActionConfig::ACTION_LIST @action_symbol = A1_System::SideViewActionConfig::ACTION_SYMBOL @picture_action = A1_System::SideViewActionConfig::PICTURE_ACTION @weapon_action = A1_System::SideViewActionConfig::WEAPN_ACTION @character_action = A1_System::SideViewActionConfig::CHARACTER_ACTION @action_params = A1_System::SideViewActionConfig::ACTION_PARAMS @state_actions = A1_System::SideViewActionConfig::STATE_ACTIONS @condition_list = A1_System::SideViewActionConfig::CONDITION_LIST @picture_params = A1_System::SideViewActionConfig::PICTURE_PARAMS @action_cache = {} end #-------------------------------------------------------------------------- # ○ ピクチャアクション #-------------------------------------------------------------------------- def picture_action(kind) key = "picture_#{kind}" @action_cache[key] ||= A1_System::SpriteAction.new(@picture_action[kind]) return @action_cache[key] end end #============================================================================== # ■ A1_System::SpriteAction #============================================================================== class A1_System::SpriteAction #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :st_x attr_reader :st_y attr_reader :st_angle attr_reader :st_zoom_x attr_reader :st_zoom_y attr_reader :st_tone attr_reader :st_opacity attr_reader :ed_x attr_reader :ed_y attr_reader :ed_angle attr_reader :ed_zoom_x attr_reader :ed_zoom_y attr_reader :ed_tone attr_reader :ed_opacity attr_reader :duration attr_reader :erase #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(info) action_start = info[0] action_end = info[1] @duration = info[2] @erase = info[3] @st_x = action_start[0] @st_y = action_start[1] @st_angle = action_start[2] @st_zoom_x = action_start[3] @st_zoom_y = action_start[4] @st_tone = action_start[5] @st_opacity = action_start[6] @ed_x = action_end[0] @ed_y = action_end[1] @ed_angle = action_end[2] @ed_zoom_x = action_end[3] @ed_zoom_y = action_end[4] @ed_tone = action_end[5] @ed_opacity = action_end[6] end end #============================================================================== # ■ RPG::Troop::Member #============================================================================== class RPG::Troop::Member #-------------------------------------------------------------------------- # ○ x座標 #-------------------------------------------------------------------------- def y return @y + A1_System::SideViewActionConfig::TROOP_COMP_Y end end #============================================================================== # ■ RPG::Weapon #============================================================================== class RPG::Weapon < RPG::EquipItem #-------------------------------------------------------------------------- # ○ サイドビューアイコン #-------------------------------------------------------------------------- def sv_icon @sv_icon ||= $a1_common.note_data_one(self.note, "SVアイコン", -1).to_i return @sv_icon end end #============================================================================== # ■ RPG::Actor #============================================================================== class RPG::Actor < RPG::BaseItem #-------------------------------------------------------------------------- # ○ マルチキャラクター #-------------------------------------------------------------------------- def multi_character(kind) @multi_character ||= {} @multi_character[kind] ||= $a1_common.note_data_array_str(self.note, kind, [@character_name, @character_index]) return @multi_character[kind] end #-------------------------------------------------------------------------- # ○ バトラーピクチャ #-------------------------------------------------------------------------- def battler_picture @battler_picture ||= $a1_common.note_data_one(self.note, "バトラー", "") return @battler_picture end end #============================================================================== # ■ RPG::Enemy #============================================================================== class RPG::Enemy < RPG::BaseItem #-------------------------------------------------------------------------- # ○ バトラーピクチャ #-------------------------------------------------------------------------- def battler_picture @battler_picture ||= $a1_common.note_data_one(self.note, "バトラー", "") return @battler_picture end end #============================================================================== # ■ Game_Enemy #------------------------------------------------------------------------------ #  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の # 内部で使用されます。 #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_side_view_ge_initialize initialize def initialize(index, enemy_id) a1_side_view_ge_initialize(index, enemy_id) @battler_picture = enemy.battler_picture end #-------------------------------------------------------------------------- # ○ 標準位置を設定 #-------------------------------------------------------------------------- def set_standard_pos @standard_x = @screen_x @standard_y = @screen_y end #-------------------------------------------------------------------------- # ○ 通常攻撃 アニメーション ID の取得 #-------------------------------------------------------------------------- def atk_animation_id1 if dual_wield? return weapons[0].animation_id if weapons[0] return weapons[1] ? 0 : 1 else return weapons[0] ? weapons[0].animation_id : 1 end end #-------------------------------------------------------------------------- # ○ 通常攻撃 アニメーション ID の取得(二刀流:武器2) #-------------------------------------------------------------------------- def atk_animation_id2 if dual_wield? return weapons[1] ? weapons[1].animation_id : 0 else return 0 end end #-------------------------------------------------------------------------- # ★ 通常能力値の加算値取得 #-------------------------------------------------------------------------- def param_plus(param_id) super end end #============================================================================== # ■ RPG::UsableItem #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # ○ アクション #-------------------------------------------------------------------------- def sv_action @sv_action = $a1_common.note_data_one(self.note, "SVアクション", "") return @sv_action end end #============================================================================== # ■ BattleManager #------------------------------------------------------------------------------ #  戦闘の進行を管理するモジュールです。 #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ○ エイリアス用特異メソッド #-------------------------------------------------------------------------- class << self alias :a1_side_view_bm_battle_start :battle_start alias :a1_side_view_bm_play_battle_end_me :play_battle_end_me alias :a1_side_view_bm_process_escape :process_escape end #-------------------------------------------------------------------------- # ☆ 戦闘開始 #-------------------------------------------------------------------------- def self.battle_start call_method(:move_start_pos) a1_side_view_bm_battle_start end #-------------------------------------------------------------------------- # ○ サイドビューアクション取得 #-------------------------------------------------------------------------- def self.side_view_actions @side_view_actions ||= A1_System::SideViewAction.new return @side_view_actions end #-------------------------------------------------------------------------- # ○ 移動先ターゲットの設定 #-------------------------------------------------------------------------- def self.move_target=(target) @move_target = target end #-------------------------------------------------------------------------- # ○ 移動先ターゲットの取得 #-------------------------------------------------------------------------- def self.move_target @move_target end #-------------------------------------------------------------------------- # ○ 全ターゲットの設定 #-------------------------------------------------------------------------- def self.all_targets=(targets) @all_targets = targets end #-------------------------------------------------------------------------- # ○ 全ターゲットの取得 #-------------------------------------------------------------------------- def self.all_targets @all_targets end #-------------------------------------------------------------------------- # ○ アクションウェイトの設定 #-------------------------------------------------------------------------- def self.action_wait_skip=(flag) @action_wait_skip = flag end #-------------------------------------------------------------------------- # ○ アクションウェイトの取得 #-------------------------------------------------------------------------- def self.action_wait_skip @action_wait_skip end #-------------------------------------------------------------------------- # ☆ 戦闘終了 ME の演奏 #-------------------------------------------------------------------------- def self.play_battle_end_me a1_side_view_bm_play_battle_end_me call_method(:victory_action) end #-------------------------------------------------------------------------- # ☆ 逃走の処理 #-------------------------------------------------------------------------- def self.process_escape success = a1_side_view_bm_process_escape call_method(:escape_failure) unless success return success end end #============================================================================== # ■ Window_BattleActors #============================================================================== class Window_BattleActors < Window_Base #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- WINDOW_POS = A1_System::SideViewActionConfig::WINDOW_POS #-------------------------------------------------------------------------- # ★ ウィンドウ位置のセット(個別バトルステータスウィンドウの再定義) #-------------------------------------------------------------------------- def setup_window_pos(index) width = 68 + (FONT_SIZE - 18) * 4 @line_num = 3 height = fitting_height(@line_num) pos = window_pos(index) self.x = pos[0] self.y = pos[1] self.width = width self.height = height create_contents self.contents.font.size = FONT_SIZE @state_icon_window.dispose if @state_icon_window @state_icon_window = Window_StateIcons.new(self.x + 48, self.y + line_height + 8) @target_y = self.y @org_y = self.y refresh end #-------------------------------------------------------------------------- # ○ ウィンドウ位置の取得 #-------------------------------------------------------------------------- def window_pos(index) WINDOW_POS[index] end #-------------------------------------------------------------------------- # ○ 情報の描画 #-------------------------------------------------------------------------- def draw_info draw_actor_hp(@actor, 0, draw_y(0), 44+ (FONT_SIZE - 18) * 4) draw_actor_mp(@actor, 0, draw_y(1), 44+ (FONT_SIZE - 18) * 4) draw_actor_tp(@actor, 0, draw_y(2), 44+ (FONT_SIZE - 18) * 4) @state_icon_window.state_icons = (@actor.state_icons + @actor.buff_icons) end #-------------------------------------------------------------------------- # ○ 描画するy座標 #-------------------------------------------------------------------------- def draw_y(index) (line_height - 8) * index end #-------------------------------------------------------------------------- # ○ 1行の高さ #-------------------------------------------------------------------------- def line_height return 24 end #-------------------------------------------------------------------------- # ○ ステートおよび強化/弱体のアイコンを描画 #-------------------------------------------------------------------------- def draw_actor_icons(actor, x, y, width = 96) icons = (actor.state_icons + actor.buff_icons)[0, width / 24] icons.each_with_index {|n, i| draw_icon(n, x, y - 24 * i) } end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super update_state_icons end #-------------------------------------------------------------------------- # ○ 解放 #-------------------------------------------------------------------------- def dispose @state_icon_window.dispose super end #-------------------------------------------------------------------------- # ○ ステートアイコンの更新 #-------------------------------------------------------------------------- def update_state_icons @state_icon_window.update end #-------------------------------------------------------------------------- # ○ 可視状態の変更 #-------------------------------------------------------------------------- def visible=(flag) super @state_icon_window.visible = flag if @state_icon_window end end #============================================================================== # ■ Window_StateIcons #============================================================================== class Window_StateIcons < Window_Base #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- MOVE_COUNT = 24 DRAW_COUNT = 60 #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x ,y) @state_icons = [] @draw_count = 0 @move_count = 0 @icon_draw = false @icon_index = 0 super(x, y, 48, 48) skin = Cache.system("Window").clone skin.clear_rect(80, 16, 32, 32) self.windowskin = skin self.opacity = 0 end #-------------------------------------------------------------------------- # ○ ステートアイコンの設定 #-------------------------------------------------------------------------- def state_icons=(icons) return if @state_icons == icons @state_icons = icons clear draw_icon(@state_icons[0], 0, 0) if !@icon_draw && @state_icons.size > 0 @draw_count = DRAW_COUNT if @state_icons.size > 1 end #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- def clear contents.clear @icon_draw = false if @state_icons.size == 0 @icon_index = @state_icons.size - 1 if @icon_index >= @state_icons.size @draw_count = 0 if @state_icons.size <= 1 @move_count = 0 if @state_icons.size <= 1 end #-------------------------------------------------------------------------- # ○ ステートアイコンの描画 #-------------------------------------------------------------------------- def draw_state_icon(icon_index, x, y) draw_icon(icon_index, x, y) @icon_draw = true end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super update_state_icons if @draw_count > 0 update_sprite_move if @move_count > 0 end #-------------------------------------------------------------------------- # ○ ステートアイコン移動の更新 #-------------------------------------------------------------------------- def update_sprite_move @move_count -= 1 self.ox += 1 return if @move_count > 0 contents.clear_rect(0, 0, 24, 24) draw_icon(@state_icons[@icon_index], 0, 0) self.ox = 0 @draw_count = DRAW_COUNT end #-------------------------------------------------------------------------- # ○ ステートアイコンの更新 #-------------------------------------------------------------------------- def update_state_icons @draw_count -= 1 return if @draw_count > 0 @icon_index += 1 @icon_index = 0 if @icon_index == @state_icons.size contents.clear_rect(24, 0, 24, 24) draw_icon(@state_icons[@icon_index], 24, 0) @move_count = MOVE_COUNT end #-------------------------------------------------------------------------- # ○ ウィンドウ内容の幅を計算 #-------------------------------------------------------------------------- def contents_width return 48 end end #============================================================================== # ■ Window_NameActor #============================================================================== class Window_NameActor < Window_Base #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(main_window) @text = "" @main_window = main_window super(0, @main_window.y, 0, fitting_height(1)) self.openness = 0 end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_text(0, 0, contents.width, line_height, @text, 1) end #-------------------------------------------------------------------------- # ○ テキストの設定 #-------------------------------------------------------------------------- def text=(str) @text = str self.width = $a1_common.text_width(contents.font, @text) + standard_padding * 2 self.x = @main_window.x - self.width create_contents refresh end end #============================================================================== # ■ Window_BattleLog #------------------------------------------------------------------------------ #  戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド # ウとして扱います。 #============================================================================== class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ☆ ウェイト #-------------------------------------------------------------------------- alias a1_side_view_sbl_wait wait def wait a1_side_view_sbl_wait unless @skip_wait_for_action end #-------------------------------------------------------------------------- # ☆ HP ダメージ表示 #-------------------------------------------------------------------------- alias a1_side_view_sbl_display_hp_damage display_hp_damage def display_hp_damage(target, item) @skip_wait_for_action = true if target.hp <= 0 || target.actor? a1_side_view_sbl_display_hp_damage(target, item) proc_damage_action(target) if target.actor? @counter = false @skip_wait_for_action = false end #-------------------------------------------------------------------------- # ○ 身代わりアクション #-------------------------------------------------------------------------- def substitute_action(kind) @substitute.proc_action("身代わりダメージ") if kind == "ダメージ" @substitute.proc_action("身代わり回避") if kind == "回避" @substitute.substitute_target = nil if @substitute @substitute = nil end #-------------------------------------------------------------------------- # ○ ダメージアクションの実行 #-------------------------------------------------------------------------- def proc_damage_action(target) return if target.result.hp_damage == 0 return target.proc_action("回復アクション") if target.result.hp_damage < 0 return target.proc_action("カウンターダメージ") if @counter return substitute_action("ダメージ") if @substitute target.proc_action("ダメージアクション") end #-------------------------------------------------------------------------- # ☆ 反撃の表示 #-------------------------------------------------------------------------- alias a1_side_view_sbl_display_counter display_counter def display_counter(target, item) @counter = true a1_side_view_sbl_display_counter(target, item) end #-------------------------------------------------------------------------- # ☆ 反射の表示 #-------------------------------------------------------------------------- alias a1_side_view_sbl_display_reflection display_reflection def display_reflection(target, item) @counter = true a1_side_view_sbl_display_reflection(target, item) end #-------------------------------------------------------------------------- # ☆ 身代わりの表示 #-------------------------------------------------------------------------- alias a1_side_view_sbl_display_substitute display_substitute def display_substitute(substitute, target) substitute.substitute_target = target.index target.proc_action("身代わられ動作") if target.actor? substitute.proc_action("身代わり動作") if target.actor? @substitute = substitute a1_side_view_sbl_display_substitute(substitute, target) end #-------------------------------------------------------------------------- # ☆ ステート付加の表示 #-------------------------------------------------------------------------- alias a1_side_view_sbl_display_added_states display_added_states def display_added_states(target) a1_side_view_sbl_display_added_states(target) target.proc_action("状態変化アクション") end #-------------------------------------------------------------------------- # ☆ ステート解除の表示 #-------------------------------------------------------------------------- alias a1_side_view_sbl_display_removed_states display_removed_states def display_removed_states(target) a1_side_view_sbl_display_removed_states(target) target.proc_action("状態変化アクション") end #-------------------------------------------------------------------------- # ☆ ミスの表示 #-------------------------------------------------------------------------- alias a1_side_view_sbl_display_miss display_miss def display_miss(target, item) @skip_wait_for_action = true a1_side_view_sbl_display_miss(target, item) proc_evasion_action(target) @skip_wait_for_action = false end #-------------------------------------------------------------------------- # ☆ 回避の表示 #-------------------------------------------------------------------------- alias a1_side_view_sbl_display_evasion display_evasion def display_evasion(target, item) @skip_wait_for_action = true a1_side_view_sbl_display_evasion(target, item) proc_evasion_action(target) @skip_wait_for_action = false end #-------------------------------------------------------------------------- # ○ 回避アクションの実行 #-------------------------------------------------------------------------- def proc_evasion_action(target) return substitute_action("回避") if @substitute target.proc_action("回避アクション") if target.actor? target.proc_action("敵回避アクション") unless target.actor? end end #============================================================================== # ■ Window_BattleActor #------------------------------------------------------------------------------ #  バトル画面で、行動対象のアクターを選択するウィンドウです。 #============================================================================== class Window_BattleActor < Window_BattleStatus #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- alias a1_wide_view_wba_update_help update_help def update_help @help_window.width = $a1_common.text_width(@help_window.contents.font, actor.name) + standard_padding * 2 @help_window.x = actor.screen_x - @help_window.width - 48 @help_window.y = actor.screen_y - 64 @help_window.create_contents a1_wide_view_wba_update_help end end #============================================================================== # ■ Window_BattleEnemy #------------------------------------------------------------------------------ #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。 #============================================================================== class Window_BattleEnemy < Window_Selectable #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- alias a1_wide_view_wbe_update_help update_help def update_help @help_window.width = $a1_common.text_width(@help_window.contents.font, enemy.name) + standard_padding * 2 @help_window.x = [enemy.screen_x - @help_window.width, 0].max @help_window.y = enemy.screen_y @help_window.create_contents a1_wide_view_wbe_update_help end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- INTT_POS = A1_System::SideViewActionConfig::INTT_POS #-------------------------------------------------------------------------- # ○ エイリアス #-------------------------------------------------------------------------- alias a1_side_view_sb_execute_action execute_action alias a1_side_view_sb_use_item use_item alias a1_side_view_sb_show_animation show_animation #-------------------------------------------------------------------------- # ☆ バトルマネージャメソッドのセットアップ #-------------------------------------------------------------------------- alias a1_side_view_sb_define_battle_manager_method define_battle_manager_method def define_battle_manager_method a1_side_view_sb_define_battle_manager_method BattleManager.define_method(method(:a1_side_view_sb_use_item), :use_item) BattleManager.define_method(method(:a1_side_view_sb_execute_action), :execute_action) BattleManager.define_method(method(:wait_for_move), :wait_for_move) BattleManager.define_method(method(:action_icon), :action_icon) BattleManager.define_method(method(:a1_side_view_sb_show_animation), :show_animation) BattleManager.define_method(method(:move_start_pos), :move_start_pos) BattleManager.define_method(method(:set_wait_collapse), :set_wait_collapse) BattleManager.define_method(method(:victory_action), :victory_action) BattleManager.define_method(method(:invoke_item), :invoke_item) BattleManager.define_method(method(:escape_failure), :escape_failure) BattleManager.define_method(method(:setup_actor_battler), :setup_actor_battler) BattleManager.define_method(method(:setup_status_windows), :setup_status_windows) BattleManager.define_method(method(:change_battler_sprite), :change_battler_sprite) BattleManager.define_method(method(:proc_event_action), :proc_event_action) end #-------------------------------------------------------------------------- # ☆ 全ウィンドウの作成 #-------------------------------------------------------------------------- alias a1_side_view_sb_create_all_windows create_all_windows def create_all_windows a1_side_view_sb_create_all_windows create_actor_name_window end #-------------------------------------------------------------------------- # ☆ スキルウィンドウ作成の後処理 #-------------------------------------------------------------------------- alias a1_side_view_post_create_skill_window post_create_skill_window def post_create_skill_window a1_side_view_post_create_skill_window @skill_window.resize_height(Graphics.height - 120) end #-------------------------------------------------------------------------- # ○ アイテムウィンドウ作成の後処理 #-------------------------------------------------------------------------- alias a1_side_view_post_create_item_window post_create_item_window def post_create_item_window @item_window.resize_height(Graphics.height - 120) end #-------------------------------------------------------------------------- # ○ スキル/アイテムウィンドウが表示された時の処理 #-------------------------------------------------------------------------- alias a1_side_view_skill_item_window_show skill_item_window_show def skill_item_window_show a1_side_view_skill_item_window_show @face_status_window.open end #-------------------------------------------------------------------------- # ○ スキル/アイテムウィンドウが非表示になった時の処理 #-------------------------------------------------------------------------- alias a1_side_view_skill_item_window_hide skill_item_window_hide def skill_item_window_hide @face_status_window.close end #-------------------------------------------------------------------------- # ○ アクターネームウィンドウ作成 #-------------------------------------------------------------------------- def create_actor_name_window @actor_name_window = Window_NameActor.new(@actor_command_window) end #-------------------------------------------------------------------------- # ☆ アクターコマンドウィンドウがオープンした時の処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_actor_command_open actor_command_open def actor_command_open a1_side_view_sb_actor_command_open @actor_name_window.open end #-------------------------------------------------------------------------- # ☆ アクターコマンドウィンドウがクローズした時の処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_actor_command_close actor_command_close def actor_command_close a1_side_view_sb_actor_command_close @actor_name_window.close end #-------------------------------------------------------------------------- # ☆ アクターコマンドウィンドウのセットアップ時の処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_actor_command_setup actor_command_setup def actor_command_setup(actor) a1_side_view_sb_actor_command_setup(actor) @actor_name_window.text = actor.name end #-------------------------------------------------------------------------- # ○ 移動完了待ち #-------------------------------------------------------------------------- def wait_for_move update_basic end #-------------------------------------------------------------------------- # ☆ メッセージウィンドウの作成 #-------------------------------------------------------------------------- alias a1_side_view_sb_create_message_window create_message_window def create_message_window a1_side_view_sb_create_message_window $game_message.position = 0 end #-------------------------------------------------------------------------- # ○ 戦闘開始の登場 #-------------------------------------------------------------------------- def move_start_pos battle_members.each {|actor| actor.proc_action("戦闘開始の登場") } end #-------------------------------------------------------------------------- # ○ アクターの初期位置 #-------------------------------------------------------------------------- def members_init_pos(index) INTT_POS[index] end #-------------------------------------------------------------------------- # ★ アクター位置のセットアップ(個別バトルステータスウィンドウの再定義) #-------------------------------------------------------------------------- def setup_actor_battler(index, actor) pos = members_init_pos(index) pos = actor.members_standard_pos(index) if actor.hp <= 0 setup_actor_screen_pos(actor, pos) actor.init_x = pos[0] actor.init_y = pos[1] actor.screen_z = 50 actor.target_x = actor.screen_x actor.target_y = actor.screen_y actor.setup_standard_pos(index) actor.visible = true end #-------------------------------------------------------------------------- # ○ アクターの画面位置を設定 #-------------------------------------------------------------------------- def setup_actor_screen_pos(actor, pos) actor.screen_x = pos[0] actor.screen_y = pos[1] end #-------------------------------------------------------------------------- # ☆ 次のコマンド入力への前処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_prev_next_command prev_next_command def prev_next_command BattleManager.actor.proc_action("コマンド選択終了") if BattleManager.actor a1_side_view_sb_prev_next_command end #-------------------------------------------------------------------------- # ☆ 次のコマンド入力への後処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_post_next_command post_next_command def post_next_command a1_side_view_sb_post_next_command BattleManager.actor.proc_action("コマンド選択開始") if BattleManager.actor end #-------------------------------------------------------------------------- # ○ 前のコマンド入力への前処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_prev_prior_command prev_prior_command def prev_prior_command BattleManager.actor.proc_action("コマンド選択終了") if BattleManager.actor a1_side_view_sb_prev_prior_command end #-------------------------------------------------------------------------- # ☆ 前のコマンド入力への後処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_post_prior_command post_prior_command def post_prior_command a1_side_view_sb_post_prior_command BattleManager.actor.proc_action("コマンド選択開始") if BattleManager.actor end #-------------------------------------------------------------------------- # ○ 同時アクションを実行するメンバーを取得 #-------------------------------------------------------------------------- def alive_index battle_members.each {|member| return member.index if member.alive?} end #-------------------------------------------------------------------------- # ○ 勝利アクション #-------------------------------------------------------------------------- def victory_action @victory_action = true battle_members[alive_index].proc_action("勝利アクション") end #-------------------------------------------------------------------------- # ☆ コマンド[逃げる] #-------------------------------------------------------------------------- alias a1_side_view_sb_command_escape command_escape def command_escape battle_members[alive_index].proc_action("逃げる") a1_side_view_sb_command_escape end #-------------------------------------------------------------------------- # ○ 逃げる失敗 #-------------------------------------------------------------------------- def escape_failure battle_members[0].proc_action("逃げる失敗") end #-------------------------------------------------------------------------- # ☆ パーティコマンドウィンドウ作成の後処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_post_create_party_command_window post_create_party_command_window def post_create_party_command_window @party_command_window.viewport = nil @party_command_window.x = Graphics.width - @party_command_window.width @party_command_window.y = 0 end #-------------------------------------------------------------------------- # ○ アクターウィンドウ作成の後処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_post_create_actor_window post_create_actor_window def post_create_actor_window a1_side_view_sb_post_create_actor_window @actor_command_window.viewport = nil @actor_command_window.x = Graphics.width - @actor_command_window.width @actor_command_window.y = 0 end #-------------------------------------------------------------------------- # ☆ 敵キャラ選択の開始 #-------------------------------------------------------------------------- alias a1_side_view_sb_select_enemy_selection select_enemy_selection def select_enemy_selection a1_side_view_sb_select_enemy_selection @actor_command_window.close end #-------------------------------------------------------------------------- # ☆ コラプス処理保留の設定 #-------------------------------------------------------------------------- alias a1_side_view_sb_set_wait_collapse set_wait_collapse def set_wait_collapse(targets, flag, sv_flag = true) return if !flag && sv_flag a1_side_view_sb_set_wait_collapse(targets, flag) end #-------------------------------------------------------------------------- # ☆ 戦闘行動の実行 #-------------------------------------------------------------------------- def execute_action @subject.execute_action end #-------------------------------------------------------------------------- # ☆ スキル/アイテムの使用 #-------------------------------------------------------------------------- def use_item @subject.battler_use_item end #-------------------------------------------------------------------------- # ★ 攻撃アニメーションの表示 #-------------------------------------------------------------------------- def show_attack_animation(targets) show_normal_animation(targets, @subject.atk_animation_id1, false) end #-------------------------------------------------------------------------- # ○ アクションアイコン #-------------------------------------------------------------------------- def action_icon(icon_index, action_info = nil, battler = nil) return @spriteset.erase_icon(icon_index) unless action_info @spriteset.setup_action_icon(action_info, icon_index, battler) end #-------------------------------------------------------------------------- # ☆ ウェイト #-------------------------------------------------------------------------- alias a1_side_view_sb_wait wait def wait(duration) a1_side_view_sb_wait(duration) unless action_wait_skip end #-------------------------------------------------------------------------- # ☆ 短時間ウェイト(早送り無効) #-------------------------------------------------------------------------- alias a1_side_view_sb_abs_wait_short abs_wait_short def abs_wait_short a1_side_view_sb_abs_wait_short unless action_wait_skip end #-------------------------------------------------------------------------- # ☆ アニメーション表示が終わるまでウェイト #-------------------------------------------------------------------------- alias a1_side_view_sb_wait_for_animation wait_for_animation def wait_for_animation a1_side_view_sb_wait_for_animation unless action_wait_skip end #-------------------------------------------------------------------------- # ○ アクションのウェイト #-------------------------------------------------------------------------- def action_wait_skip BattleManager.action_wait_skip end #-------------------------------------------------------------------------- # ☆ 個別ステータスウィンドウを再作成する #-------------------------------------------------------------------------- alias a1_side_view_sb_recreate_status_windows recreate_status_windows def recreate_status_windows(member) a1_side_view_sb_recreate_status_windows(member) return add_party_action(member) if member.index == $game_party.new_index setup_actor_screen_pos(member, member.members_standard_pos(member.index)) end #-------------------------------------------------------------------------- # ○ パーティ加入時のアクション #-------------------------------------------------------------------------- def add_party_action(member) member.proc_action($game_temp.add_party_action) if $game_temp.add_party_action $game_temp.add_party_action = nil end #-------------------------------------------------------------------------- # ☆ アクターを外す前処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_prev_remove_battler prev_remove_battler def prev_remove_battler(member) member.proc_action($game_temp.remove_party_action) if $game_temp.remove_party_action a1_side_view_sb_prev_remove_battler(member) $game_temp.remove_party_action = nil end #-------------------------------------------------------------------------- # ○ イベントアクション実行 #-------------------------------------------------------------------------- def proc_event_action(member, action) member.proc_action(action) end #============================================================================== # ■ パッシブスキル/スキルレベル対応処理 #============================================================================== if $imported["A1_PassiveSkill"] #-------------------------------------------------------------------------- # ☆ 戦闘行動の実行の前処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_prev_execute_action prev_execute_action def prev_execute_action a1_side_view_sb_prev_execute_action @original_current_weapon = @subject.current_weapon end #-------------------------------------------------------------------------- # ☆ スキル/アイテムの使用の前処理 #-------------------------------------------------------------------------- alias a1_side_view_sb_prev_use_item prev_use_item def prev_use_item @subject.current_action.set_skill(@original_action_item.id) if @original_action_item.is_a?(RPG::Skill) && change_current_weapon? a1_side_view_sb_prev_use_item end #-------------------------------------------------------------------------- # ○ 使用武器が変わった? #-------------------------------------------------------------------------- def change_current_weapon? @original_current_weapon != @subject.current_weapon end #-------------------------------------------------------------------------- # ☆ 通常攻撃がスキルに変化する条件のチェック #-------------------------------------------------------------------------- alias a1_side_view_sb_skill_change_condition skill_change_condition def skill_change_condition(passive, skill_id) return false if @subject.actor? && !@subject.skill_change_condition a1_side_view_sb_skill_change_condition(passive, skill_id) end #-------------------------------------------------------------------------- # ☆ スキル/アイテムの使用後の追加発動スキル #-------------------------------------------------------------------------- alias a1_side_view_sb_use_after_next_skill use_after_next_skill def use_after_next_skill(item) return false if @subject.actor? && !@subject.skill_change_condition a1_side_view_sb_use_after_next_skill(item) end #-------------------------------------------------------------------------- # ☆ コンボスキルの実行 #-------------------------------------------------------------------------- alias a1_side_view_sb_next_combo next_combo def next_combo(skill) @subject.start_combo a1_side_view_sb_next_combo(skill) end;end #============================================================================== # ■ 消耗品装備対応処理 #============================================================================== if $imported["A1_ConsumerEquip"] && $imported["A1_PassiveSkill"] #-------------------------------------------------------------------------- # ☆ 戦闘行動の実行の前処理 #-------------------------------------------------------------------------- def prev_execute_action a1_side_view_sb_prev_execute_action @original_current_weapon = @subject.current_weapon @original_current_main = @subject.current_main end #-------------------------------------------------------------------------- # ○ 使用武器が変わった? #-------------------------------------------------------------------------- def change_current_weapon? @original_current_weapon != @subject.current_weapon || @original_current_main != @subject.current_main end;end #============================================================================== # ■ 戦闘中入れ替え対応処理 #============================================================================== if $imported["A1_ChangeMember"] #-------------------------------------------------------------------------- # ☆ メンバーチェンジ[キャンセル] #-------------------------------------------------------------------------- alias a1_side_view_on_member_change_cancel on_member_change_cancel def on_member_change_cancel @window_member_change.close change_diss_members.each{|member| @prev_battle_members[member.index].proc_action("初期位置にジャンプ") } wait(30) unless change_diss_members.empty? a1_side_view_on_member_change_cancel change_diss_members.each {|member| return_for_change_member(member) } end #-------------------------------------------------------------------------- # ○ 入れ替えメンバー向け初期位置設定 #-------------------------------------------------------------------------- def return_for_change_member(member) pos = members_init_pos(member.index) member.init_x = pos[0] member.init_y = pos[1] member.screen_x = pos[0] member.screen_y = pos[1] member.proc_action("戦闘開始の登場") end;end end #============================================================================== # ■ Spriteset_Battle #------------------------------------------------------------------------------ #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ # スの内部で使用されます。 #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_side_view_ssb_initialize initialize def initialize create_action_icon a1_side_view_ssb_initialize end #-------------------------------------------------------------------------- # ○ アクションアイコンの作成 #-------------------------------------------------------------------------- def create_action_icon @action_icons = {} end #-------------------------------------------------------------------------- # ○ アクションアイコンのセットアップ #-------------------------------------------------------------------------- def setup_action_icon(action_info, icon_index, battler) @action_icons[icon_index] ||= Sprite_ActionIcon.new(@viewport1, icon_index) @action_icons[icon_index].setup_action(action_info, battler) end #-------------------------------------------------------------------------- # ○ アクションアイコンのセットアップ #-------------------------------------------------------------------------- def erase_icon(icon_index) @action_icons[icon_index].visible = false if @action_icons[icon_index] end #-------------------------------------------------------------------------- # ☆ フレーム更新 #-------------------------------------------------------------------------- alias a1_side_view_ssb_update update def update a1_side_view_ssb_update update_action_icon end #-------------------------------------------------------------------------- # ☆ 解放 #-------------------------------------------------------------------------- alias a1_side_view_ssb_dispose dispose def dispose dispose_action_icon a1_side_view_ssb_dispose end #-------------------------------------------------------------------------- # ○ アクションアイコンの更新 #-------------------------------------------------------------------------- def update_action_icon @action_icons.values.each {|icon| icon.update } end #-------------------------------------------------------------------------- # ○ アクションアイコンの解放 #-------------------------------------------------------------------------- def dispose_action_icon @action_icons.values.each {|icon| icon.dispose } end end #============================================================================== # ■ Sprite_ActionIcon #============================================================================== class Sprite_ActionIcon < Sprite #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(viewport, icon_index) super(viewport) setup_icon(icon_index) end #-------------------------------------------------------------------------- # ○ アイコンのセットアップ #-------------------------------------------------------------------------- def setup_icon(icon_index) self.bitmap = Bitmap.new(24, 24) icon_bitmap = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) self.bitmap.blt(0, 0, icon_bitmap, rect, 255) self.ox = self.bitmap.width / 2 self.oy = self.bitmap.height / 2 self.visible = false end #-------------------------------------------------------------------------- # ○ アクションのセットアップ #-------------------------------------------------------------------------- def setup_action(action_info, battler) @battler = battler @action_info = action_info @duration = action_info.duration self.x = @battler.screen_x + action_info.st_x self.y = @battler.screen_y + action_info.st_y self.z = @battler.screen_z - 10 self.angle = action_info.st_angle self.opacity = action_info.st_opacity self.zoom_x = action_info.st_zoom_x / 100.0 self.zoom_y = action_info.st_zoom_y / 100.0 self.tone = action_info.st_tone ? action_info.st_tone : Tone.new(0, 0, 0) @x_plus = (action_info.ed_x - action_info.st_x) / @duration.to_f @y_plus = (action_info.ed_y - action_info.st_y) / @duration.to_f @angle_plus = action_info.ed_angle / @duration.to_f @opacity_plus = (action_info.ed_opacity - action_info.st_opacity) / @duration.to_f @zoom_x_plus = (action_info.ed_zoom_x - action_info.st_zoom_x) / @duration.to_f @zoom_y_plus = (action_info.ed_zoom_y - action_info.st_zoom_y) / @duration.to_f @tone_r_plus = 0 @tone_g_plus = 0 @tone_b_plus = 0 @tone_gr_plus = 0 setup_tone_plus(action_info.st_tone, action_info.ed_tone) self.visible = true end #-------------------------------------------------------------------------- # ○ トーンの差分セットアップ #-------------------------------------------------------------------------- def setup_tone_plus(st_tone, ed_tone) return unless st_tone && ed_tone @tone_r_plus = ed_tone[0] - st_tone[0] / @duration.to_f @tone_g_plus = ed_tone[1] - st_tone[1] / @duration.to_f @tone_b_plus = ed_tone[2] - st_tone[2] / @duration.to_f @tone_gr_plus = ed_tone[3] - st_tone[3] / @duration.to_f if st_tone[3] && ed_tone[3] end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update return unless @battler @duration -= 1 super update_position update_zoom update_other clear if @duration == 0 end #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- def clear self.visible = false if @action_info.erase @battler = nil @action_info = nil end #-------------------------------------------------------------------------- # ○ 位置の更新 #-------------------------------------------------------------------------- def update_position self.x += @x_plus self.y += @y_plus end #-------------------------------------------------------------------------- # ○ 拡大率の更新 #-------------------------------------------------------------------------- def update_zoom self.zoom_x += @zoom_x_plus / 100.0 self.zoom_y += @zoom_y_plus / 100.0 end #-------------------------------------------------------------------------- # ○ その他の更新 #-------------------------------------------------------------------------- def update_other self.opacity += @opacity_plus self.angle += @angle_plus self.tone.red += @tone_r_plus self.tone.green += @tone_g_plus self.tone.blue += @tone_b_plus self.tone.gray += @tone_gr_plus end end #============================================================================== # ■ Sprite_Battler #------------------------------------------------------------------------------ #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、 # スプライトの状態を自動的に変化させます。 #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_side_view_sb_initialize initialize def initialize(viewport, battler = nil) @balloon_duration = 0 a1_side_view_sb_initialize(viewport, battler) end #-------------------------------------------------------------------------- # ☆ 新しいエフェクトの設定 #-------------------------------------------------------------------------- alias a1_side_view_sb_setup_new_effect setup_new_effect def setup_new_effect a1_side_view_sb_setup_new_effect if !@balloon_sprite && @battler.balloon_id > 0 @balloon_id = @battler.balloon_id start_balloon end end #-------------------------------------------------------------------------- # ☆ バトラー情報のセットアップ #-------------------------------------------------------------------------- alias a1_side_view_sb_setup_battler_info setup_battler_info def setup_battler_info clear a1_side_view_sb_setup_battler_info return unless @battler set_character_bitmap if @battler.actor? end #-------------------------------------------------------------------------- # ☆ 位置の更新 #-------------------------------------------------------------------------- alias a1_side_view_sb_update_position update_position def update_position a1_side_view_sb_update_position update_battler_move update_battler_action update_balloon end #-------------------------------------------------------------------------- # ○ バトラーアクションの更新 #-------------------------------------------------------------------------- def update_battler_action setup_action(@battler.battler_action) if @battler.battler_action && !@action_info return unless @action_info @duration -= 1 if @duration && @duration > 0 update_zoom update_other clear if @duration == 0 end #-------------------------------------------------------------------------- # ★ アクター用転送元ビットマップの更新(個別バトルステータスウィンドウの再定義) #-------------------------------------------------------------------------- def update_bitmap_actor update_src_rect return unless change_graphic? setup_battler_info update_src_rect end #-------------------------------------------------------------------------- # ○ グラフィック変更? #-------------------------------------------------------------------------- def change_graphic? @now_battler_name != @battler.battler_name || @now_battler_index != @battler.battler_index end #-------------------------------------------------------------------------- # ○ バトラー移動の更新 #-------------------------------------------------------------------------- def update_battler_move @battler.update_battler_move end #-------------------------------------------------------------------------- # ○ キャラクターのビットマップを設定 #-------------------------------------------------------------------------- def set_character_bitmap self.bitmap = Cache.character(@battler.battler_name) sign = @battler.battler_name[/^[\!\$]./] if sign && sign.include?('$') @cw = bitmap.width / 3 @ch = bitmap.height / 4 else @cw = bitmap.width / 12 @ch = bitmap.height / 8 end self.ox = @cw / 2 self.oy = @ch @now_battler_name = @battler.battler_name @now_battler_index = @battler.battler_index @battler.sprite_height = @ch end #-------------------------------------------------------------------------- # ○ 転送元矩形の更新 #-------------------------------------------------------------------------- def update_src_rect @battler.update_pattern index = @battler.battler_index pattern = @battler.pattern < 3 ? @battler.pattern : 1 sx = (index % 4 * 3 + pattern) * @cw sy = (index / 4 * 4 + (@battler.direction - 2) / 2) * @ch self.src_rect.set(sx, sy, @cw, @ch) end #-------------------------------------------------------------------------- # ☆ 原点の更新 #-------------------------------------------------------------------------- alias a1_side_view_spb_update_origin update_origin def update_origin a1_side_view_spb_update_origin unless @battler.actor? end #-------------------------------------------------------------------------- # ☆ 通常の設定に戻す #-------------------------------------------------------------------------- alias a1_side_view_spb_revert_to_normal revert_to_normal def revert_to_normal a1_side_view_spb_revert_to_normal unless @battler.actor? end #-------------------------------------------------------------------------- # ○ アクションのセットアップ #-------------------------------------------------------------------------- def setup_action(action_info) @action_info = action_info @duration = action_info.duration self.angle = action_info.st_angle self.opacity = action_info.st_opacity self.zoom_x = action_info.st_zoom_x / 100.0 self.zoom_y = action_info.st_zoom_y / 100.0 self.tone = action_info.st_tone ? action_info.st_tone : Tone.new(0, 0, 0) @angle_plus = action_info.ed_angle / @duration.to_f @opacity_plus = (action_info.ed_opacity - action_info.st_opacity) / @duration.to_f @zoom_x_plus = (action_info.ed_zoom_x - action_info.st_zoom_x) / @duration.to_f @zoom_y_plus = (action_info.ed_zoom_y - action_info.st_zoom_y) / @duration.to_f @tone_r_plus = 0 @tone_g_plus = 0 @tone_b_plus = 0 @tone_gr_plus = 0 setup_tone_plus(action_info.st_tone, action_info.ed_tone) self.visible = true end #-------------------------------------------------------------------------- # ○ トーンの差分セットアップ #-------------------------------------------------------------------------- def setup_tone_plus(st_tone, ed_tone) return unless @action_info return unless st_tone && ed_tone @tone_r_plus = ed_tone[0] - st_tone[0] / @duration.to_f @tone_g_plus = ed_tone[1] - st_tone[1] / @duration.to_f @tone_b_plus = ed_tone[2] - st_tone[2] / @duration.to_f @tone_gr_plus = ed_tone[3] - st_tone[3] / @duration.to_f if st_tone[3] && ed_tone[3] end #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- def clear return unless @action_info self.visible = false if @action_info.erase @action_info = nil @battler.battler_action = nil @angle_plus = 0 @opacity_plus = 0 @zoom_x_plus = 0 @zoom_y_plus = 0 @tone_r_plus = 0 @tone_g_plus = 0 @tone_b_plus = 0 @tone_gr_plus = 0 end #-------------------------------------------------------------------------- # ○ 拡大率の更新 #-------------------------------------------------------------------------- def update_zoom return unless @action_info self.zoom_x += @zoom_x_plus / 100.0 self.zoom_y += @zoom_y_plus / 100.0 end #-------------------------------------------------------------------------- # ○ その他の更新 #-------------------------------------------------------------------------- def update_other return unless @action_info self.opacity += @opacity_plus self.angle += @angle_plus self.tone.red += @tone_r_plus self.tone.green += @tone_g_plus self.tone.blue += @tone_b_plus self.tone.gray += @tone_gr_plus end #-------------------------------------------------------------------------- # ○ フキダシアイコン表示の開始 #-------------------------------------------------------------------------- def start_balloon dispose_balloon @balloon_sprite = ::Sprite.new(viewport) set_balloon_duration @balloon_sprite.bitmap = Cache.system("Balloon") @balloon_sprite.ox = 16 @balloon_sprite.oy = 32 update_balloon end #-------------------------------------------------------------------------- # ○ フキダシアイコンの時間設定 #-------------------------------------------------------------------------- def set_balloon_duration @balloon_duration = 8 * balloon_speed + balloon_wait end #-------------------------------------------------------------------------- # ○ フキダシアイコンの解放 #-------------------------------------------------------------------------- def dispose_balloon if @balloon_sprite @balloon_sprite.dispose @balloon_sprite = nil end end #-------------------------------------------------------------------------- # ○ フキダシアイコンの更新 #-------------------------------------------------------------------------- def update_balloon if @balloon_duration > 0 @balloon_duration -= 1 if @balloon_duration > 0 @balloon_sprite.x = x @balloon_sprite.y = y - height @balloon_sprite.z = z + 200 sx = balloon_frame_index * 32 sy = (@balloon_id - 1) * 32 @balloon_sprite.src_rect.set(sx, sy, 32, 32) else set_balloon_duration end end_balloon if @battler.balloon_id == 0 end end #-------------------------------------------------------------------------- # ○ フキダシアイコンの終了 #-------------------------------------------------------------------------- def end_balloon dispose_balloon @balloon_duration = 0 @battler.balloon_id = 0 end #-------------------------------------------------------------------------- # ○ フキダシアイコンの表示速度 #-------------------------------------------------------------------------- def balloon_speed return 8 end #-------------------------------------------------------------------------- # ○ フキダシ最終フレームのウェイト時間 #-------------------------------------------------------------------------- def balloon_wait return 12 end #-------------------------------------------------------------------------- # ○ フキダシアイコンのフレーム番号 #-------------------------------------------------------------------------- def balloon_frame_index return 7 - [(@balloon_duration - balloon_wait) / balloon_speed, 0].max end #-------------------------------------------------------------------------- # ☆ エフェクトの開始 #-------------------------------------------------------------------------- alias a1_side_view_spb_start_effect start_effect def start_effect(effect_type) return revert_to_normal if @battler.actor? && effect_type == :collapse a1_side_view_spb_start_effect(effect_type) end end #============================================================================== # ■ Game_Unit #------------------------------------------------------------------------------ #  ユニットを扱うクラスです。このクラスは Game_Party クラスと Game_Troop クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Unit #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :parallel_action_members #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_side_view_gu_initialize initialize def initialize a1_side_view_gu_initialize @parallel_action_members = [] end end #============================================================================== # ■ Game_Party #------------------------------------------------------------------------------ #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ # スのインスタンスは $game_party で参照されます。 #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ○ 生存している戦闘メンバーの配列取得 #-------------------------------------------------------------------------- def alive_battle_members battle_members.select {|member| member.alive? } end #-------------------------------------------------------------------------- # ○ 同時アクションのメンバーを設定 #-------------------------------------------------------------------------- def parallel_action_alive_members battle_members.select {|member| member.alive? && @parallel_action_members.include?(member.index) } end end #============================================================================== # ■ Game_Troop #------------------------------------------------------------------------------ #  敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も # 行います。このクラスのインスタンスは $game_troop で参照されます。 #============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ☆ セットアップ #-------------------------------------------------------------------------- alias a1_side_view_gtp_setup setup def setup(troop_id) a1_side_view_gtp_setup(troop_id) @enemies.each {|enemy| enemy.set_standard_pos } end #-------------------------------------------------------------------------- # ○ 同時アクションのメンバーを設定 #-------------------------------------------------------------------------- def parallel_action_alive_members members.select {|member| member.alive? && @parallel_action_members.include?(member.index) } end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors) # の内部で使用され、Game_Party クラス($game_party)からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- PATTERN_COUNT = 20 STANDARD_POS = A1_System::SideViewActionConfig::STANDARD_POS #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :pattern attr_accessor :pattern_fix attr_accessor :pre_pattern_fix attr_accessor :direction attr_accessor :battler_index #-------------------------------------------------------------------------- # ★ セットアップ(個別バトルステータスウィンドウの再定義) #-------------------------------------------------------------------------- def setup(actor_id) a1_psw_setup(actor_id) @screen_x = 0 @screen_y = 0 @screen_z = 0 @opacity = 255 @visible = true @sprite_height = 0 @battler_name = actor.character_name @use_sprite = @battler_name.empty? ? false : true @pattern = 1 @pattern_fix = -1 @pre_pattern_fix = -1 @direction = 4 @target_x = @screen_x @target_y = @screen_y @distance_x = 0.0 @distance_y = 0.0 @pattern_count = PATTERN_COUNT @pattern_plus = 1 @battler_index = @character_index @battler_picture = actor.battler_picture end #-------------------------------------------------------------------------- # ○ 歩行パターンの更新 #-------------------------------------------------------------------------- def update_pattern return @pattern = @pattern_fix if @pattern_fix >= 0 @pattern_count -= 1 change_pattern if @pattern_count == 0 end #-------------------------------------------------------------------------- # ○ 歩行パターンの変更 #-------------------------------------------------------------------------- def change_pattern @pattern += @pattern_plus @pattern_plus = -1 if @pattern_plus > 0 && @pattern == 2 @pattern_plus = 1 if @pattern_plus < 0 && @pattern == 0 @pattern_count = PATTERN_COUNT end #-------------------------------------------------------------------------- # ○ 定位置を取得 #-------------------------------------------------------------------------- def members_standard_pos(index) STANDARD_POS[index] end #-------------------------------------------------------------------------- # ○ 定位置をセット #-------------------------------------------------------------------------- def setup_standard_pos(index) pos = members_standard_pos(index) @standard_x = pos[0] @standard_y = pos[1] end #-------------------------------------------------------------------------- # ★ ダメージ効果の実行 #-------------------------------------------------------------------------- def perform_damage_effect Sound.play_actor_damage end #-------------------------------------------------------------------------- # ☆ 通常能力値の加算値取得 #-------------------------------------------------------------------------- alias a1_side_view_ga_param_plus param_plus def param_plus(param_id) ret = a1_side_view_ga_param_plus(param_id) return ret if param_id != 2 return ret - no_current_weapon_atk end #-------------------------------------------------------------------------- # ○ 使用中の武器でない武器の攻撃力を取得 #-------------------------------------------------------------------------- def no_current_weapon_atk return 0 unless no_calc_weapon_atk? return calc_no_current_weapon_atk(no_current_weapon) end #-------------------------------------------------------------------------- # ○ 使用中の武器でない武器を取得 #-------------------------------------------------------------------------- def no_current_weapon (weapons - [@current_weapon])[0] end #-------------------------------------------------------------------------- # ○ 使用中の武器でない武器の攻撃力を計算 #-------------------------------------------------------------------------- def calc_no_current_weapon_atk(weapon) weapon.params[2] end #-------------------------------------------------------------------------- # ○ 使用中の武器でない武器の攻撃力を計算しない? #-------------------------------------------------------------------------- def no_calc_weapon_atk? weapons && @current_weapon && $game_party.in_battle && two_sword_style? end #-------------------------------------------------------------------------- # ○ 通常攻撃が他のスキルに変化する条件 #-------------------------------------------------------------------------- def skill_change_condition return true unless two_sword_style? weapons.index(no_current_weapon) == 1 end #============================================================================== # ■ 消耗品装備対応処理 #============================================================================== if $imported["A1_ConsumerEquip"] #-------------------------------------------------------------------------- # ○ 使用中のメイン武器 #-------------------------------------------------------------------------- def current_main @current_main end #-------------------------------------------------------------------------- # ○ 通常攻撃が他のスキルに変化する条件 #-------------------------------------------------------------------------- def skill_change_condition return true unless two_sword_style? no_current_index = weapons.index(no_current_weapon) return no_current_index == 0 if dominant_hand == "左" no_current_index == 1 end #-------------------------------------------------------------------------- # ☆ 通常能力値の基本値取得 #-------------------------------------------------------------------------- alias a1_side_view_ga_param_base param_base def param_base(param_id) ret = a1_side_view_ga_param_base(param_id) return ret if param_id != 2 return ret unless no_calc_weapon_atk? no_current_index = weapons.index(no_current_weapon) basic = a1_ex_equip_ga_param_base(param_id) no_current_index = no_current_index == 1 ? 0 : 1 if dominant_hand == "左" no_current_index = 1 if dominant_hand == "両" return (ret - basic * DUAL_BASIC_RATE * dual_wirld_rate[no_current_index]).round.to_i end #-------------------------------------------------------------------------- # ○ 使用中の武器でない武器を取得 #-------------------------------------------------------------------------- def no_current_weapon (weapons - [@current_weapon] - [@current_main])[0] end #-------------------------------------------------------------------------- # ○ 使用中の武器でない武器の攻撃力を計算 #-------------------------------------------------------------------------- alias a1_side_view_for_consumer_equip_ga_calc_no_current_weapon_atk calc_no_current_weapon_atk def calc_no_current_weapon_atk(weapon) w_atk = a1_side_view_for_consumer_equip_ga_calc_no_current_weapon_atk(weapon) no_current_index = weapons.index(weapon) return (w_atk * dual_wirld_rate[no_current_index]).round.to_i end;end #============================================================================== # ■ パッシブスキル/スキルレベル対応処理 #============================================================================== if $imported["A1_PassiveSkill"] #-------------------------------------------------------------------------- # ○ 使用中の武器でない武器の攻撃力を計算 #-------------------------------------------------------------------------- alias a1_side_view_for_passive_skill_ga_calc_no_current_weapon_atk calc_no_current_weapon_atk def calc_no_current_weapon_atk(weapon) w_atk = a1_side_view_for_passive_skill_ga_calc_no_current_weapon_atk(weapon) return w_atk if @current_weapon.wtype_id == weapon.wtype_id return w_atk + params_equip_passive(weapon, 2) end;end end #============================================================================== # ■ Sprite_BattleCursor #============================================================================== class Sprite_BattleCursor < Sprite_Base #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_side_view_sbc_initialize initialize def initialize(color = DEFAULT_COLOR) a1_side_view_sbc_initialize(color) @angle = 0 @set_angle = 0 end #-------------------------------------------------------------------------- # ★ フレーム更新 #-------------------------------------------------------------------------- def update self.visible = @target ? true : false return unless @target super update_for_actor if @target.actor? update_for_enemy unless @target.actor? set_angle if @set_angle != @angle end #-------------------------------------------------------------------------- # ○ 回転角度のセット #-------------------------------------------------------------------------- def set_angle self.angle = @set_angle @angle = @set_angle end #-------------------------------------------------------------------------- # ○ エネミー用フレーム更新 #-------------------------------------------------------------------------- def update_for_enemy self.x = @target.screen_x + @plus_x self.y = @target.screen_y - @target.battler_height + @plus_y @set_angle = 0 end #-------------------------------------------------------------------------- # ○ アクター用フレーム更新 #-------------------------------------------------------------------------- def update_for_actor self.x = @target.screen_x - 32 + @plus_x self.y = @target.screen_y - 16 + @plus_y @set_angle = 90 end end #============================================================================== # ■ Sprite_Base #------------------------------------------------------------------------------ #  アニメーションの表示処理を追加したスプライトのクラスです。 #============================================================================== class Sprite_Base < Sprite #-------------------------------------------------------------------------- # ☆ アニメーションの開始 #-------------------------------------------------------------------------- alias a1_side_view_sb_start_animation start_animation def start_animation(animation, mirror = false) clone_animation = animation.clone clone_animation.position = $game_temp.force_animation_position if $game_temp.force_animation_position a1_side_view_sb_start_animation(clone_animation, mirror) end end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :force_animation_position #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_side_view_gt_initialize initialize def initialize a1_side_view_gt_initialize @force_animation_position = nil end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。 #============================================================================== class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- TSS_TP_RATE = A1_System::SideViewActionConfig::TSS_TP_RATE DIRECTION_SET = {"下" => 2, "左" => 4, "右" => 6, "上" => 8} STATE_LIST = A1_System::SideViewActionConfig::STATE_LIST #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :target_x attr_accessor :target_y attr_accessor :distance_x attr_accessor :distance_y attr_accessor :standard_x attr_accessor :standard_y attr_accessor :move_count attr_accessor :move_duration attr_accessor :pre_move_x attr_accessor :pre_move_y attr_accessor :battler_action attr_accessor :balloon_id attr_accessor :wait_collapse attr_accessor :reserve_wait attr_accessor :parallel_action attr_accessor :parallel_members attr_accessor :init_x attr_accessor :init_y attr_accessor :substitute_target #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_side_view_sb_initialize initialize def initialize @jump_peak = 0 @move_count = 0 @move_duration = 0 @c_action_count = 0 @c_action_index = 0 @c_action_list = nil @c_action_loop = false @battler_action = nil @direction = 4 @break_action = false @force_break = false @balloon_id = 0 @continue = true @wait_collapse = false @next_action = false @repeat_count = [] @next_repeat_count = [] @action_depth = 0 @reserve_wait = 0 @parallel_action = false @proc_reserve_wait = false @parallel_members = [] @init_x = 0 @init_y = 0 @substitute_target = nil a1_side_view_sb_initialize end #-------------------------------------------------------------------------- # ○ パラメータの初期化 #-------------------------------------------------------------------------- def init_params @action_depth = 0 @repeat_count = [] @next_repeat_count = [] end #-------------------------------------------------------------------------- # ○ 戦闘行動の実行 #-------------------------------------------------------------------------- def execute_action @collapse_flag = true @return_flag = false @screen_z += 100 if @screen_z set_current_weapon BattleManager.call_method(:execute_action) @screen_z -= 100 if @screen_z end #-------------------------------------------------------------------------- # ○ スキル/アイテムの使用 #-------------------------------------------------------------------------- def battler_use_item @next_action = false init_params item = current_action.item targets = current_action.pre_make_targets.compact BattleManager.move_target = targets[0] BattleManager.all_targets = targets BattleManager.call_method(:set_wait_collapse, targets, true) proc_item_action(item, targets) battler_use_item if @next_action end #-------------------------------------------------------------------------- # ○ スキル/アイテム使用時のアクション実行 #-------------------------------------------------------------------------- def proc_item_action(item, targets) action_key = item.sv_action action_key = get_action(item) if action_key.empty? proc_action(action_key) @break_action = false @force_break = false end #-------------------------------------------------------------------------- # ○ アクションの実行 #-------------------------------------------------------------------------- def proc_action(action_key, members = nil) actions = BattleManager.side_view_actions.action_list[action_key] actions.each {|action| conv_action_members(action, members) break if @break_action || @force_break @repeat_count[@action_depth] = @next_repeat_count[@action_depth] } return_standard_pos(members) unless @next_action BattleManager.action_wait_skip = false end #-------------------------------------------------------------------------- # ○ 定位置に戻る #-------------------------------------------------------------------------- def return_standard_pos(members) end_combo return unless @break_action && @action_depth == 0 conv_action_members("コラプス[許可]", members) conv_action_members("移動[定位置[10, wait]]", members) end #-------------------------------------------------------------------------- # ○ 使用武器のセット #-------------------------------------------------------------------------- def set_current_weapon @current_weapon = weapons[0] end #-------------------------------------------------------------------------- # ○ アクションの変換とメソッドのコール #-------------------------------------------------------------------------- def conv_action_members(action, members, i = 0) @parallel_action = false return conv_action(action) unless members num = alive_members_num(members) members.each {|member| next unless member.alive?; parallel_action_proc(member, action, i, num); i+= 1 } $game_party.parallel_action_members = [] if self.actor? $game_troop.parallel_action_members = [] if self.enemy? end #-------------------------------------------------------------------------- # ○ 同時アクションメンバーの生存メンバー数を取得 #-------------------------------------------------------------------------- def alive_members_num(members) return actor_alive_members_num(members) if self.actor? return enemy_alive_members_num(members) end #-------------------------------------------------------------------------- # ○ 同時アクションメンバーの生存メンバー数を取得(アクター) #-------------------------------------------------------------------------- def actor_alive_members_num(members) members.each {|member| $game_party.parallel_action_members.push(member.index) } return $game_party.parallel_action_alive_members.size - 1 end #-------------------------------------------------------------------------- # ○ 同時アクションメンバーの生存メンバー数を取得(エネミー) #-------------------------------------------------------------------------- def enemy_alive_members_num(members) members.each {|member| $game_troop.parallel_action_members.push(member.index) } return $game_troop.parallel_action_alive_members.size - 1 end #-------------------------------------------------------------------------- # ○ ダメージの実行 #-------------------------------------------------------------------------- def proc_damage(params) action_targets.each {|target| BattleManager.call_method(:invoke_item, target, current_action.item) } end #-------------------------------------------------------------------------- # ○ 使用武器 #-------------------------------------------------------------------------- def use_weapon_pos(params) next_use_weapon = params[0] == "左" && weapons[1] ? weapons[1] : weapons[0] change_weapon_and_target(next_use_weapon) end #-------------------------------------------------------------------------- # ○ 使用武器変更とターゲットの再設定 #-------------------------------------------------------------------------- def change_weapon_and_target(next_use_weapon) BattleManager.call_method(:action_icon, @current_weapon.icon_index) if self.actor? @current_weapon = next_use_weapon BattleManager.all_targets = current_action.pre_make_targets.compact end #-------------------------------------------------------------------------- # ○ ターゲットの取得 #-------------------------------------------------------------------------- def action_targets BattleManager.all_targets end #-------------------------------------------------------------------------- # ○ 同時アクションの実行 #-------------------------------------------------------------------------- def parallel_action_proc(member, action, index, alive_members_num) member.parallel_action = true member.conv_action(action) wait_for_action(member.reserve_wait.to_i) if member.reserve_wait > 0 && index == alive_members_num member.reserve_wait = 0 if member member.parallel_action = false end #-------------------------------------------------------------------------- # ○ アクションの変換とメソッドのコール #-------------------------------------------------------------------------- def conv_action(action) @next_repeat_count[@action_depth] = 0 return @continue = true unless @continue BattleManager.action_wait_skip = false return wait_for_action(action) if action.is_a?(Integer) p_action = action.gsub(/\[(.+)\]/, "") call_action_method(p_action, $1) proc_repeat(action) if @repeat_count[@action_depth] && @repeat_count[@action_depth] > 0 end #-------------------------------------------------------------------------- # ○ ウェイト #-------------------------------------------------------------------------- def wait_for_action(duration) BattleManager.call_method(:wait, duration) end #-------------------------------------------------------------------------- # ○ アクションの中断 #-------------------------------------------------------------------------- def break_action(params) @break_action = true end #-------------------------------------------------------------------------- # ○ リピートの実行 #-------------------------------------------------------------------------- def proc_repeat(action) @repeat_count[@action_depth] -= 1 conv_action(action) end #-------------------------------------------------------------------------- # ○ 繰り返し #-------------------------------------------------------------------------- def repeat_action(params) @next_repeat_count[@action_depth] = params[0].to_i - 1 end #-------------------------------------------------------------------------- # ○ 条件 #-------------------------------------------------------------------------- def next_condition(params) ret = check_condition(params[0]) @continue = params[1] == "not" ? !ret : ret end #-------------------------------------------------------------------------- # ○ 同時 #-------------------------------------------------------------------------- def parallel_action(params) members = parallel_all_members members = parallel_index_members(members, $1) if params[1] =~ /Index\[(.*?)\]/ members = parallel_name_members(members, $1) if params[1] =~ /名前\[(.*?)\]/ proc_parallel_action(members, params[0]) end #-------------------------------------------------------------------------- # ○ 名前指定同時のメンバー取得 #-------------------------------------------------------------------------- def parallel_name_members(members, param, ret = []) return members unless self.actor? names = $a1_common.split_array(param) names.each {|name| members.each {|member| ret.push(member) if member.name == name }} return ret end #-------------------------------------------------------------------------- # ○ Index指定同時のメンバー取得 #-------------------------------------------------------------------------- def parallel_index_members(members, param, ret = []) indexs = $a1_common.split_array(param) indexs.each {|index| ret.push(members[index.to_i]) } return ret end #-------------------------------------------------------------------------- # ○ 全員同時のメンバー取得 #-------------------------------------------------------------------------- def parallel_all_members return $game_party.battle_members if self.actor? return $game_troop.members unless self.actor? end #-------------------------------------------------------------------------- # ○ 同時アクション実行 #-------------------------------------------------------------------------- def proc_parallel_action(members, action_key) proc_action(action_key, members) end #-------------------------------------------------------------------------- # ○ コンボ開始 #-------------------------------------------------------------------------- def start_combo @commbo = true @next_action = true end #-------------------------------------------------------------------------- # ○ コンボ終了 #-------------------------------------------------------------------------- def end_combo @commbo = false end #-------------------------------------------------------------------------- # ○ 派生 #-------------------------------------------------------------------------- def next_action(params) return setup_next_skill($1.to_i) if params[0] =~ /スキル\[(\d+)\]/ return setup_next_item($1.to_i) if params[0] =~ /アイテム\[(\d+)\]/ @action_depth += 1 proc_action(params[0]) @action_depth -= 1 if @action_depth > 0 end #-------------------------------------------------------------------------- # ○ 派生スキルのセット #-------------------------------------------------------------------------- def setup_next_skill(skill_id) current_action.set_skill(skill_id) @break_action = true @next_action = true end #-------------------------------------------------------------------------- # ○ 派生アイテムのセット #-------------------------------------------------------------------------- def setup_next_item(item_id) current_action.set_item(item_id) @break_action = true @next_action = true end #-------------------------------------------------------------------------- # ○ メソッドのコール #-------------------------------------------------------------------------- def call_action_method(action, param) param = conv_action_params(param) if param params = $a1_common.split_array(param) if param method(BattleManager.side_view_actions.action_symbol[action]).call(params) end #-------------------------------------------------------------------------- # ○ スクリプトのコンバート(配列から) #-------------------------------------------------------------------------- def convert_script_array(params, ret = []) params.each {|param| ret.push(convert_script(param)) } return ret end #-------------------------------------------------------------------------- # ○ スクリプトのコンバート #-------------------------------------------------------------------------- def convert_script(param) return param unless param.is_a?(String) loop { param = param.sub(/(.+?)<\/s>/i) { eval($1) }; break unless $1 } return param end #-------------------------------------------------------------------------- # ○ アクションパラメータのコンバート #-------------------------------------------------------------------------- def conv_action_params(param) param = convert_script(param) loop { param = param.sub(/(.+?)<\/s>/i) { eval($1) }; break unless $1 } param = param.sub(/\{(.*?)\}/) { BattleManager.side_view_actions.action_params[$1] } return param unless $1 conv_data = BattleManager.side_view_actions.action_params[$1] return conv_data unless conv_data.is_a?(String) param = conv_action_params(param) if $1 return param end #-------------------------------------------------------------------------- # ○ スキル/アイテムのアクションを取得 #-------------------------------------------------------------------------- def get_action(item) return get_item_action if item.is_a?(RPG::Item) get_skill_action(item) end #-------------------------------------------------------------------------- # ○ アイテムのアクションを取得 #-------------------------------------------------------------------------- def get_item_action return "汎用アイテム使用" end #-------------------------------------------------------------------------- # ○ スキルのアクションを取得 #-------------------------------------------------------------------------- def get_skill_action(item) return "防御" if item.id == 2 return "汎用スキル使用" if item.damage.element_id >= 0 action_key = @current_weapon.sv_action if @current_weapon return "通常攻撃" if !action_key || action_key.empty? return action_key end #-------------------------------------------------------------------------- # ○ 実行 #-------------------------------------------------------------------------- def proc_use_item(params) BattleManager.action_wait_skip = true if params && params[0] == "skip" BattleManager.call_method(:use_item) end #-------------------------------------------------------------------------- # ○ 移動 #-------------------------------------------------------------------------- def move_pos(params) return if @commbo @jump = (params[1] == "ジャンプ") return move_standard_pos($a1_common.split_array($1)) if params[0] =~ /定位置\[(.*?)\]/ return move_leftstep($a1_common.split_array($1)) if params[0] =~ /前進\[(.*?)\]/ return move_rightstep($a1_common.split_array($1)) if params[0] =~ /後退\[(.*?)\]/ return move_to_target($a1_common.split_array($1)) if params[0] =~ /対象\[(.*?)\]/ return move_to_center($a1_common.split_array($1)) if params[0] =~ /敵中心\[(.*?)\]/ return rel_move($a1_common.split_array($1)) if params[0] =~ /相対\[(.*?)\]/ return abs_move($a1_common.split_array($1)) if params[0] =~ /絶対\[(.*?)\]/ return move_init_pos($a1_common.split_array($1)) if params[0] =~ /初期位置\[(.*?)\]/ return move_substitute($a1_common.split_array($1)) if params[0] =~ /身代わり\[(.*?)\]/ end #-------------------------------------------------------------------------- # ○ 身代わり先に移動 #-------------------------------------------------------------------------- def move_substitute(params) substitute_target = $game_party.battle_members[@substitute_target] x = substitute_target.screen_x - 32 y = substitute_target.screen_y move_to_pos(params[0].to_f, x, y) wait_for_move if params[1] == "wait" end #-------------------------------------------------------------------------- # ○ 敵中心に移動 #-------------------------------------------------------------------------- def move_to_center(params) return move_to_target(params) unless self.actor? move_to_pos(params[0].to_f, Graphics.width / 3, Graphics.height / 3 * 2) wait_for_move if params[1] == "wait" end #-------------------------------------------------------------------------- # ○ 初期位置に戻る #-------------------------------------------------------------------------- def move_init_pos(params) move_to_pos(params[0].to_f, @init_x, @init_y) wait_for_move if params[1] == "wait" end #-------------------------------------------------------------------------- # ○ 定位置に戻る #-------------------------------------------------------------------------- def move_standard_pos(params) return if @screen_x == @standard_x && @screen_y == @standard_y BattleManager.call_method(:action_icon, @current_weapon.icon_index) if self.actor? && @current_weapon move_to_pos(params[0].to_f, @standard_x, @standard_y) wait_for_move if params[1] == "wait" end #-------------------------------------------------------------------------- # ○ ターゲット前まで移動 #-------------------------------------------------------------------------- def move_to_target(params) target = BattleManager.move_target move_to_pos(params[0].to_f, post_target_x(target.screen_x), target.screen_y) wait_for_move if params[1] == "wait" end #-------------------------------------------------------------------------- # ○ ターゲットの前を取得 #-------------------------------------------------------------------------- def post_target_x(target_screen_x) return target_screen_x + 64 if self.actor? return target_screen_x - 64 end #-------------------------------------------------------------------------- # ○ 指定位置まで移動 #-------------------------------------------------------------------------- def move_to_pos(duration, target_x, target_y) @move_count = 0 @move_duration = duration @pre_move_x = @screen_x @pre_move_y = @screen_y @target_x = @screen_x + (target_x - @screen_x) @distance_x = (target_x - @screen_x) / duration @target_y = @screen_y + (target_y - @screen_y) @distance_y = (target_y - @screen_y) / duration end #-------------------------------------------------------------------------- # ○ 左に1歩移動 #-------------------------------------------------------------------------- def move_leftstep(params) plus = self.actor? ? -32 : 32 move_to_pos(params[0].to_f, @standard_x + plus, @standard_y) wait_for_move if params[1] == "wait" end #-------------------------------------------------------------------------- # ○ 右に1歩移動 #-------------------------------------------------------------------------- def move_rightstep(params) plus = self.actor? ? 32 : -32 move_to_pos(params[0].to_f, @standard_x + plus, @standard_y) wait_for_move if params[1] == "wait" end #-------------------------------------------------------------------------- # ○ 相対移動 #-------------------------------------------------------------------------- def rel_move(params) target_x = @screen_x + params[0].to_i target_y = @screen_y + params[1].to_i move_to_pos(params[2].to_f, target_x, target_y) wait_for_move if params[3] == "wait" end #-------------------------------------------------------------------------- # ○ 絶対移動 #-------------------------------------------------------------------------- def abs_move(params) move_to_pos(params[2].to_f, params[0].to_i, params[1].to_i) wait_for_move if params[3] == "wait" end #-------------------------------------------------------------------------- # ○ 直立 #-------------------------------------------------------------------------- def set_pattern_fix(params) return @pre_pattern_fix = 1 if params && params[0] == "予約" return release_ptattern_fix if params && params[0] == "解除" @pattern_fix = 1 end #-------------------------------------------------------------------------- # ○ 直立解除 #-------------------------------------------------------------------------- def release_ptattern_fix @pre_pattern_fix = -1 @pattern_fix = -1 end #-------------------------------------------------------------------------- # ○ 移動が終わるまでウェイト #-------------------------------------------------------------------------- def wait_for_move return @reserve_wait = @move_duration if @parallel_action BattleManager.call_method(:wait_for_move) while move_now? end #-------------------------------------------------------------------------- # ○ 移動中? #-------------------------------------------------------------------------- def move_now? @move_duration > 0 end #-------------------------------------------------------------------------- # ○ 武器動作 #-------------------------------------------------------------------------- def weapon_action(params) return unless self.actor? sv_action = BattleManager.side_view_actions w_action = sv_action.weapon_action[params[0]] p_action = sv_action.picture_action(w_action[0]) p_action = conv_action_params(p_action) if p_action.is_a?(String) character_action([w_action[1]]) if w_action[1] use_icon = @current_weapon.sv_icon >= 0 ? @current_weapon.sv_icon : @current_weapon.icon_index BattleManager.call_method(:action_icon, use_icon, p_action, self) end #-------------------------------------------------------------------------- # ○ ステート動作 #-------------------------------------------------------------------------- def state_action(params) return unless self.actor? param = params[0] if params action_name = now_state(param) action_name = wait_type if action_name == "待機" action_list = BattleManager.side_view_actions.state_actions[action_name] character_action([action_list[0]]) @force_break = action_list[1] @balloon_id = action_list[2] end #-------------------------------------------------------------------------- # ○ 表示するステート取得 #-------------------------------------------------------------------------- def now_state(now_state) states.each {|state| return state.name if STATE_LIST.include?(state.name)} return "防御待機" if guard? now_state ? now_state : "通常" end #-------------------------------------------------------------------------- # ○ 待機タイプ取得 #-------------------------------------------------------------------------- def wait_type return "通常待機" unless current_action return "通常待機" unless current_action.item.is_a?(RPG::Skill) return "通常待機" if current_action.item.stype_id == 0 return "#{$data_system.skill_types[current_action.item.stype_id]}待機" end #-------------------------------------------------------------------------- # ○ キャラクター動作 #-------------------------------------------------------------------------- def character_action(params) return unless self.actor? c_action = BattleManager.side_view_actions.character_action[params[0]] proc_character_action(c_action) end #-------------------------------------------------------------------------- # ○ キャラクター動作の実行 #-------------------------------------------------------------------------- def proc_character_action(c_action) @c_action_loop = c_action[1] @c_action_list = c_action[0] @c_action_list = conv_action_params(@c_action_list) if @c_action_list.is_a?(String) @c_action_index = 0 setup_action_battler(c_action[2]) if c_action[2] end #-------------------------------------------------------------------------- # ○ キャラクター動作の更新 #-------------------------------------------------------------------------- def update_character_action return unless @c_action_list return @c_action_count -= 1 if @c_action_count > 0 action = @c_action_list[@c_action_index] @c_action_index += 1 @c_action_index = 0 if !@c_action_list[@c_action_index] && @c_action_loop @c_action_list = nil if !@c_action_list[@c_action_index] && !@c_action_loop return @c_action_count = action if action.is_a?(Integer) return unless action conv_action(action) end #-------------------------------------------------------------------------- # ○ バトラーアクションの設定 #-------------------------------------------------------------------------- def setup_action_battler(action_name) sv_action = BattleManager.side_view_actions @battler_action = sv_action.picture_action(action_name) @battler_action = conv_action_params(@battler_action) if @battler_action.is_a?(String) @x_plus = (@battler_action.ed_x - @battler_action.st_x) / @battler_action.duration.to_f @y_plus = (@battler_action.ed_y - @battler_action.st_y) / @battler_action.duration.to_f @pre_move_x = @screen_x @pre_move_y = @screen_y update_action_pos end #-------------------------------------------------------------------------- # ○ アニメ #-------------------------------------------------------------------------- def proc_animation(params) BattleManager.action_wait_skip = true if params[1] == "skip" animation_id = params[0].to_i BattleManager.call_method(:show_animation, animation_targets(params), animation_id) end #-------------------------------------------------------------------------- # ○ アニメのターゲットと位置を取得 #-------------------------------------------------------------------------- def animation_targets(params) targets = action_targets if params[1] == "対象" || params[1] == "画面" targets = [self] if params[1] == "自身" $game_temp.force_animation_position = 1 if params[1] == "対象" || params[1] == "自身" $game_temp.force_animation_position = 3 if params[1] == "画面" return targets end #-------------------------------------------------------------------------- # ○ 向き #-------------------------------------------------------------------------- def change_direction(params) return unless self.actor? @direction = DIRECTION_SET[params[0]] if params[0] @pattern = params[1].to_i if params[1] end #-------------------------------------------------------------------------- # ○ ジャンプの高さを計算 #-------------------------------------------------------------------------- def jump_height return 0 unless @jump jump_peak = @move_duration / 2 (jump_peak * jump_peak - (@move_count - jump_peak).abs ** 2) / 2 end #-------------------------------------------------------------------------- # ○ バトラー移動の更新 #-------------------------------------------------------------------------- def update_battler_move update_character_action if self.actor? update_action_pos if @battler_action return unless @distance_x && @distance_y return if @move_duration == 0 @screen_x = @pre_move_x + @distance_x * @move_count @screen_y = @pre_move_y + @distance_y * @move_count - jump_height @move_count += 1 move_end if @move_count > @move_duration + 1 return unless self.actor? @pattern_fix = @pre_pattern_fix if @distance_x == 0 && @distance_y == 0 end #-------------------------------------------------------------------------- # ○ バトラーアクション時の位置更新 #-------------------------------------------------------------------------- def update_action_pos @screen_x = @pre_move_x + @battler_action.st_x + @x_plus @screen_y = @pre_move_y + @battler_action.st_y + @y_plus end #-------------------------------------------------------------------------- # ○ 移動の完了 #-------------------------------------------------------------------------- def move_end move_end_x move_end_y @jump = false @move_duration = 0 end #-------------------------------------------------------------------------- # ○ x座標移動の完了 #-------------------------------------------------------------------------- def move_end_x @screen_x = @target_x @distance_x = 0 end #-------------------------------------------------------------------------- # ○ y座標移動の完了 #-------------------------------------------------------------------------- def move_end_y @screen_y = @target_y @distance_y = 0 end #-------------------------------------------------------------------------- # ○ グラフィック変更 #-------------------------------------------------------------------------- def change_graphic(params) return unless self.actor? c_info = actor.multi_character(params[0]) @battler_name = c_info[0] @battler_index = c_info[1] @direction = DIRECTION_SET[params[1]] if params[1] @pattern = params[2] ? params[2].to_i : 1 @pattern_fix = @pattern if params[3] == "固定" end #-------------------------------------------------------------------------- # ○ コラプス許可の設定 #-------------------------------------------------------------------------- def set_collapse(params) return unless @collapse_flag @collapse_flag = params[0] == "許可" ? false : true BattleManager.call_method(:set_wait_collapse, action_targets, @collapse_flag, @collapse_flag) end #-------------------------------------------------------------------------- # ○ アイテム/スキル使用可能チェック #-------------------------------------------------------------------------- def item_usable?(kind, id) return usable?($data_skills[id]) if kind == "スキル" return $game_party.usable?($data_items[id]) if kind == "アイテム" && self.actor? end #-------------------------------------------------------------------------- # ○ ピクチャ #-------------------------------------------------------------------------- def picture_action(params) return unless params return show_picture($1) if params[0] =~ /表示\[(.+)\]/ return move_picture($1) if params[0] =~ /移動\[(.+)\]/ return rotate_picture($1) if params[0] =~ /回転\[(.+)\]/ return tone_change_picture($1) if params[0] =~ /色調\[(.+)\]/ return erase_picture($1.to_i) if params[0] =~ /消去\[(\d+)\]/ end #-------------------------------------------------------------------------- # ○ ピクチャの表示 #-------------------------------------------------------------------------- def show_picture(param_name) params = BattleManager.side_view_actions.picture_params[param_name] params = convert_script_array(params) pic_name = params[1] == "バトラー" ? @battler_picture : params[1] return if pic_name.empty? picture = $game_troop.screen.pictures[params[0].to_i] name = pic_name origin = params[2] == "左上" ? 0 : 1 x = params[3].to_i y = params[4].to_i zoom_x = params[5].to_i zoom_y = params[6].to_i opacity = params[7].to_i blend_type = params[8].to_i picture.show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type) end #-------------------------------------------------------------------------- # ○ ピクチャの移動 #-------------------------------------------------------------------------- def move_picture(param_name) params = BattleManager.side_view_actions.picture_params[param_name] params = convert_script_array(params) picture = $game_troop.screen.pictures[params[0].to_i] origin = params[1] == "左上" ? 0 : 1 x = params[2].to_i y = params[3].to_i zoom_x = params[4].to_i zoom_y = params[5].to_i opacity = params[6].to_i blend_type = params[7].to_i duration = params[8].to_i picture.move(origin, x, y, zoom_x, zoom_y, opacity, blend_type, duration) end #-------------------------------------------------------------------------- # ○ ピクチャの回転 #-------------------------------------------------------------------------- def rotate_picture(param_name) params = BattleManager.side_view_actions.picture_params[param_name] params = convert_script_array(params) $game_troop.screen.pictures[params[0].to_i].rotate(params[1].to_i) end #-------------------------------------------------------------------------- # ○ ピクチャの色調変更 #-------------------------------------------------------------------------- def tone_change_picture(param_name) params = BattleManager.side_view_actions.picture_params[param_name] params = convert_script_array(params) picture = $game_troop.screen.pictures[params[0].to_i] r = params[1].to_i g = params[2].to_i b = params[3].to_i gr = params[4].to_i if params[4] tone = Tone.new(r, g, b, gr) if params[4] tone = Tone.new(r, g, b) unless params[4] picture.start_tone_change(tone, params[5].to_i) end #-------------------------------------------------------------------------- # ○ ピクチャの消去 #-------------------------------------------------------------------------- def erase_picture(pic_no) $game_troop.screen.pictures[pic_no].erase end #-------------------------------------------------------------------------- # ★ スキル/アイテムの使用者側への効果 #-------------------------------------------------------------------------- def item_user_effect(user, item) gain = user.two_sword_style? ? item.tp_gain * TSS_TP_RATE : item.tp_gain user.tp += gain.round * user.tcr end #-------------------------------------------------------------------------- # ○ ターゲットの生存チェック #-------------------------------------------------------------------------- def target_alive_check action_targets.each {|target| return true if target.hp > 0 } return false end #-------------------------------------------------------------------------- # ○ 条件のチェック #-------------------------------------------------------------------------- def check_condition(condition) return two_sword_style? if condition == "二刀流" return item_usable?($1, $2.to_i) if condition =~ /(\S+)使用可\[(\d+)\]/ return target_alive_check if condition == "対象生存" return hp > 0 if condition == "自身生存" return @substitute_target if condition == "身代わり" list = BattleManager.side_view_actions.condition_list return eval($1) if list[condition] =~ /(.+?)<\/s>/ return true end #-------------------------------------------------------------------------- # ○ オーディオアクション #-------------------------------------------------------------------------- def audio_action(params) return audio_se(params[1], $1, $2.to_i, $3.to_i) if params[0] =~ /SE\[(\S+)[,](\d+)[,](\d+)\]/ return audio_me(params[1], $1, $2.to_i, $3.to_i) if params[0] =~ /ME\[(\S+)[,](\d+)[,](\d+)\]/ return audio_bgs(params[1], $1, $2.to_i, $3.to_i) if params[0] =~ /BGS\[(\S+)[,](\d+)[,](\d+)\]/ return audio_bgm_fede($1, $2.to_i, $3.to_i) if params[0] =~ /BGM\[フェード(\S+?)[,](\d+)[,]?(\d+)?\]/ return audio_bgm(params[1], $1, $2.to_i, $3.to_i) if params[0] =~ /BGM\[(\S+)[,](\d+)[,](\d+)\]/ end #-------------------------------------------------------------------------- # ○ SEの演奏/停止 #-------------------------------------------------------------------------- def audio_se(kind, name, volume, pitch) return RPG::SE.stop if kind == "停止" RPG::SE.new(name, volume, pitch).play end #-------------------------------------------------------------------------- # ○ MEの演奏/停止 #-------------------------------------------------------------------------- def audio_me(kind, name, volume, pitch) return RPG::ME.stop if kind == "停止" RPG::ME.new(name, volume, pitch).play end #-------------------------------------------------------------------------- # ○ BGSの演奏/停止 #-------------------------------------------------------------------------- def audio_bgs(kind, name, volume, pitch) return RPG::BGS.stop if kind == "停止" RPG::BGS.new(name, volume, pitch).play end #-------------------------------------------------------------------------- # ○ BGMの演奏/停止 #-------------------------------------------------------------------------- def audio_bgm(kind, name, volume, pitch) return RPG::BGM.stop if kind == "停止" RPG::BGM.new(name, volume, pitch).play end #-------------------------------------------------------------------------- # ○ BGMのフェードイン/フェードアウト #-------------------------------------------------------------------------- def audio_bgm_fede(kind, param1, param2) return RPG::BGM.fade(param1) if kind == "アウト" audio_class = A1_System::AudioFile.new(RPG::BGM.last, param1, param2) $a1_common.fadein_bgm = audio_class end #-------------------------------------------------------------------------- # ○ BGSのフェードイン/フェードアウト #-------------------------------------------------------------------------- def audio_bgs_fede(kind, param1, param2) return RPG::BGS.fade(param1) if kind == "アウト" audio_class = A1_System::AudioFile.new(RPG::BGS.last, param1, param2) $a1_common.fadein_bgs = audio_class end #============================================================================== # ■ 消耗品装備対応処理 #============================================================================== if $imported["A1_ConsumerEquip"] #-------------------------------------------------------------------------- # ○ 使用武器 #-------------------------------------------------------------------------- def use_weapon_pos(params) next_weapon = next_use_weapon(params) change_weapon_and_target(next_weapon) end #-------------------------------------------------------------------------- # ○ 次に使う武器を取得 #-------------------------------------------------------------------------- def next_use_weapon(params) return chenge_consumer_main(params) if use_consumer? return dominant_hand == "左" && two_sword_style? ? weapons[0] : weapons[1] if params[0] == "左" return dominant_hand == "左" && two_sword_style? ? weapons[1] : weapons[0] return weapons[0] end #-------------------------------------------------------------------------- # ○ 消耗品を使う武器のメインを変更 #-------------------------------------------------------------------------- def chenge_consumer_main(params) @current_main = dominant_hand == "左" && two_sword_style? ? weapons[0] : weapons[1] if params[0] == "左" @current_main = dominant_hand == "左" && two_sword_style? ? weapons[1] : weapons[0] if params[0] != "左" return consumer_equip[0] end #-------------------------------------------------------------------------- # ○ 主武器 #-------------------------------------------------------------------------- def main_weapon return weapons[0] unless self.actor? dominant_hand == "左" && two_sword_style? ? weapons[1] : weapons[0] end #-------------------------------------------------------------------------- # ○ 使用武器のセット #-------------------------------------------------------------------------- def set_current_weapon main = main_weapon @current_weapon = main return if !self.actor? return if !use_consumer? @current_main = main @current_weapon = consumer_equip[0] end;end #============================================================================== # ■ 全体通常攻撃対応処理 #============================================================================== if $imported["A1_WideNomalAttack"] #-------------------------------------------------------------------------- # ★ 全体攻撃武器?(全体通常攻撃の再定義) #-------------------------------------------------------------------------- def wide_attack_weapon?(any) return @current_weapon.wide_attack if @current_weapon && any return weapons.all? {|weapon| next unless weapon; weapon.wide_attack } end;end end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :remove_party_action attr_accessor :add_party_action #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_side_view_gtp_initialize initialize def initialize a1_side_view_gtp_initialize @remove_party_action = nil @add_party_action = nil end end #============================================================================== # ■ A1_System::CommonModule #============================================================================== class A1_System::CommonModule #-------------------------------------------------------------------------- # ☆ 注釈コマンド定義 #-------------------------------------------------------------------------- alias a1_side_view_define_command define_command def define_command a1_side_view_define_command @cmd_108["脱退アクション"] = :remove_party_action @cmd_108["加入アクション"] = :add_party_action @cmd_108["アクション実行"] = :proc_event_action end end #============================================================================== # ■ Game_Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、 # Game_Troop クラス、Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ○ 脱退アクション #-------------------------------------------------------------------------- def remove_party_action(params) return unless $game_party.in_battle $game_temp.remove_party_action = params[0] end #-------------------------------------------------------------------------- # ○ 加入アクション #-------------------------------------------------------------------------- def add_party_action(params) return unless $game_party.in_battle $game_temp.add_party_action = params[0] end #-------------------------------------------------------------------------- # ○ アクション実行 #-------------------------------------------------------------------------- def proc_event_action(params) return unless $game_party.in_battle member = params[0] =~ /([0-9]+)/ ? $game_party.battle_members[$1.to_i] : search_battle_members(params[0]) return unless member BattleManager.call_method(:proc_event_action, member, params[1]) end #-------------------------------------------------------------------------- # ○ バトルメンバーの名前から検索 #-------------------------------------------------------------------------- def search_battle_members(name) $game_party.battle_members.each {|member| return member if member.name == name } end end end