#=========================================================================== # ◆ A1 Scripts ◆ # 個別バトルステータスウィンドウ(RGSS3) # # バージョン : 2.11 (2012/01/24) # 作者 : A1 # URL     : http://a1tktk.web.fc2.com/ #--------------------------------------------------------------------------- # 機能: # ・おれは「個別バトルステータスウィンドウ」だけを作っていたと思ったら #  いつの間にかバトル画面全部を作っていた # #  な… 何を言ってるのか わからねーと思うが # おれも何をしてたのかわからなかった… # # 頭がどうにかなりそうだった… # # ついでだとかヒマだっただとか # そんなチャチなもんじゃあ 断じてねえ # # もっと恐ろしいものの片鱗を味わったぜ… #--------------------------------------------------------------------------- # 更新履歴   :2012/01/10 Ver1.00 リリース # :2012/01/10 Ver1.10 敵選択の不具合を修正 # :2012/01/10 Ver1.10 顔グラフィック位置の不具合を修正 # :2012/01/10 Ver1.10 顔グラフィック切り替えの際、一瞬カクつく不具合を修正 # :2012/01/16 Ver1.11 二回行動の際顔グラフィックが1段階上にせりあがる不具合を修正 # :2012/01/17 Ver1.20 陣形対応 # :2012/01/17 Ver1.20 戦闘中入れ替え対応 # :2012/01/19 Ver2.00 A1バトル共通スクリプト対応 # :2012/01/21 Ver2.10 ウィンドウのフォントサイズ調整できるようにしました # :2012/01/24 Ver2.11 フェイスステータスウィンドウを使用しない際の不具合を修正 #--------------------------------------------------------------------------- # 設置場所 # A1バトル共通スクリプト以下 # (リザルトウィンドウ以下) # (ダメージポップアップ以下) # (戦闘中入れ替えスクリプト以下) # # 必要スクリプト # A1バトル共通スクリプト #--------------------------------------------------------------------------- # 使い方 # ■ 設定項目 に設定します # # ※顔グラフィックモード false 時 # データベース「アクター」のメモ欄にバトラーグラフィックを設定します # # <バトラー filename> # # 顔グラフィックの代わりに、設定したピクチャを使用します # インポート先は「Picture」ディレクトリになります #============================================================================== $imported ||= {} if $imported["A1_BattleCommonScript"] $imported["A1_PersonalBattleStatus"] = true old_common_script("個別バトルステータスウィンドウ", "3.90") if common_version < 3.90 #============================================================================== # ■ 設定項目 #============================================================================== module A1_System::PersonalBattleStatusConfig #-------------------------------------------------------------------------- # 顔グラフィックモード #-------------------------------------------------------------------------- FACE_MODE = true #-------------------------------------------------------------------------- # ウィンドウのフォントサイズ #-------------------------------------------------------------------------- FONT_SIZE = 18 end #============================================================================== # ■ ポップアップダメージインポート時処理 #============================================================================== if $imported["A1_DamagePopUp"] #============================================================================== # ■ Window_BattleLog #------------------------------------------------------------------------------ #  戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド # ウとして扱います。 #============================================================================== class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ★ ポップアップの位置取得・アクター #-------------------------------------------------------------------------- def popup_pos_actor(target) [target.screen_x ,target.screen_y - target.sprite_height / 2] end end #============================================================================== # ■ ポップアップダメージ非インポート時処理 #============================================================================== else #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ☆ 開始処理 #-------------------------------------------------------------------------- alias a1_damege_popup_sb_start start def start a1_damege_popup_sb_start setup_actor_index end #-------------------------------------------------------------------------- # ○ アクターインデックスの割り当て #-------------------------------------------------------------------------- def setup_actor_index $game_party.battle_members.each_with_index {|actor, i| actor.index = i } end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors) # の内部で使用され、Game_Party クラス($game_party)からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :index #-------------------------------------------------------------------------- # ☆ セットアップ #-------------------------------------------------------------------------- alias a1_damege_popup_setup setup def setup(actor_id) a1_damege_popup_setup(actor_id) @index = nil end end;end #============================================================================== # ■ RPG::Actor #============================================================================== class RPG::Actor < RPG::BaseItem #-------------------------------------------------------------------------- # ○ バトラー名 #-------------------------------------------------------------------------- def battler_name @battler_name ||= $a1_common.note_data_one(self.note, "バトラー", "") return @battler_name end end #============================================================================== # ■ BattleManager #------------------------------------------------------------------------------ #  戦闘の進行を管理するモジュールです。 #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ○ エイリアス用特異メソッド #-------------------------------------------------------------------------- class << self alias :a1_psw_bm_turn_end :turn_end alias :a1_psw_bm_turn_start :turn_start end #-------------------------------------------------------------------------- # ☆ ターン開始 #-------------------------------------------------------------------------- def self.turn_start @regenerate_actor = [] a1_psw_bm_turn_start end #-------------------------------------------------------------------------- # ☆ ターン終了 #-------------------------------------------------------------------------- def self.turn_end call_method(:show_regenerate_actor, @regenerate_actor) unless @regenerate_actor.empty? a1_psw_bm_turn_end end #-------------------------------------------------------------------------- # ○ 自動回復したアクターの取得 #-------------------------------------------------------------------------- def self.regenerate_actor @regenerate_actor end end #============================================================================== # ■ Window_BattleActors #============================================================================== class Window_BattleActors < Window_Base #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- FACE_MODE = A1_System::PersonalBattleStatusConfig::FACE_MODE FONT_SIZE = A1_System::PersonalBattleStatusConfig::FONT_SIZE #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(index, actor) @actor = actor @states = [] super(0, 0, 0, 0) self.visible = false self.opacity = 0 end #-------------------------------------------------------------------------- # ○ ウィンドウ位置のセット #-------------------------------------------------------------------------- def setup_window_pos(index) width = Graphics.width / 4 width = Graphics.width / $game_party.battle_members.size if $game_party.battle_members.size > 4 @line_num = $data_system.opt_display_tp ? 5 : 4 height = fitting_height(@line_num) self.x = width * index self.y = Graphics.height - height self.width = width self.height = height + 24 create_contents self.contents.font.size = FONT_SIZE @target_y = self.y @org_y = self.y refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_info end #-------------------------------------------------------------------------- # ○ 情報の描画 #-------------------------------------------------------------------------- def draw_info draw_background(contents.rect) draw_face(@actor.face_name, @actor.face_index, (self.contents.width - 96) / 2, 0, false) if FACE_MODE draw_actor_icons(@actor, 4, line_height * 0, contents.width) draw_text(0, draw_y(1) - 8, contents.width, line_height, @actor.name, 1) draw_actor_hp(@actor, 4, draw_y(2), contents.width) draw_actor_mp(@actor, 4, draw_y(3), contents.width) draw_actor_tp(@actor, 4, draw_y(4), contents.width) if $data_system.opt_display_tp end #-------------------------------------------------------------------------- # ○ 描画するy座標 #-------------------------------------------------------------------------- def draw_y(index) self.height - (line_height - 6) * (@line_num - index) - 42 end #-------------------------------------------------------------------------- # ○ 1行の高さ #-------------------------------------------------------------------------- def line_height return 20 end #-------------------------------------------------------------------------- # ○ 上に移動 #-------------------------------------------------------------------------- def move_up @target_y = @org_y - 24 end #-------------------------------------------------------------------------- # ○ 戻る #-------------------------------------------------------------------------- def move_return @target_y = @org_y end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update super self.y -= 6 if @target_y < self.y self.y += 6 if @target_y > self.y end #-------------------------------------------------------------------------- # ○ 顔グラフィックの描画 #-------------------------------------------------------------------------- def draw_face(face_name, face_index, x, y, enabled = true) draw_face_no_dispose(face_name, face_index, x, y, enabled) end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- FACE_MODE = A1_System::PersonalBattleStatusConfig::FACE_MODE #-------------------------------------------------------------------------- # ☆ バトルマネージャメソッドの定義 #-------------------------------------------------------------------------- alias a1_psw_sb_define_battle_manager_method define_battle_manager_method def define_battle_manager_method a1_psw_sb_define_battle_manager_method BattleManager.define_method(method(:show_regenerate_actor), :show_regenerate_actor) end #-------------------------------------------------------------------------- # ☆ 全ウィンドウの作成 #-------------------------------------------------------------------------- alias a1_psw_sb_create_all_windows create_all_windows def create_all_windows a1_psw_sb_create_all_windows create_name_help_window end #-------------------------------------------------------------------------- # ☆ ステータスウィンドウ作成の後処理 #-------------------------------------------------------------------------- alias a1_psw_sb_post_create_status_window post_create_status_window def post_create_status_window a1_psw_sb_post_create_status_window create_status_windows a1_psw_sb_post_create_status_window @status_window.visible = false @status_window.y = @status_window_y end #-------------------------------------------------------------------------- # ○ 名前表示用ヘルプウィンドウの作成 #-------------------------------------------------------------------------- def create_name_help_window @name_help_window = Window_Help.new @name_help_window.openness = 0 @name_help_window.visible = true @actor_window.help_window = @name_help_window @enemy_window.help_window = @name_help_window end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウの作成 #-------------------------------------------------------------------------- def create_status_windows @status_windows = [] @status_window_height = 0 battle_members.each_with_index {|actor, i| setup_status_windows(i, actor) } end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウのセットアップ #-------------------------------------------------------------------------- def setup_status_windows(index, actor) @status_windows[index] = Window_BattleActors.new(index, actor) @status_windows[index].z = 15 setup_status_windows_pos(index, actor) end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウとアクターの位置をセットアップ #-------------------------------------------------------------------------- def setup_status_windows_pos(index, actor) @status_windows[index].setup_window_pos(index) setup_actor_battler(index, actor) @status_window_height = @status_windows[index].height @status_window_y = @status_windows[index].y end #-------------------------------------------------------------------------- # ○ アクター位置のセットアップ #-------------------------------------------------------------------------- def setup_actor_battler(index, actor) actor.screen_x = @status_windows[index].x + @status_windows[index].width / 2 actor.screen_z = 10 return setup_actor_sprite(actor, index) if actor.use_sprite && !FACE_MODE return setup_empty_sprite(actor, index) end #-------------------------------------------------------------------------- # ○ アクタースプライトのセットアップ #-------------------------------------------------------------------------- def setup_actor_sprite(actor, index) actor.screen_y = Graphics.height actor.visible = false end #-------------------------------------------------------------------------- # ○ 空のダミースプライトのセットアップ #-------------------------------------------------------------------------- def setup_empty_sprite(actor, index) actor.screen_y = @status_windows[index].y + @status_windows[index].height / 2 actor.use_sprite = true sprite = @spriteset.actor_sprite[index] height = (Graphics.height - @status_windows[index].y) / 2 sprite.setup_empty_actor_bitmap(@status_windows[index].width, height) end #-------------------------------------------------------------------------- # ☆ 情報表示ビューポートの作成 #-------------------------------------------------------------------------- alias a1_psw_sb_create_info_viewport create_info_viewport def create_info_viewport a1_psw_sb_create_info_viewport @info_viewport.rect.y = Graphics.height - (@status_window.height + @status_window_height) end #-------------------------------------------------------------------------- # ☆ ステータスウィンドウがリフレッシュされた時の処理 #-------------------------------------------------------------------------- alias a1_psw_sb_refresh_statsu_window refresh_statsu_window def refresh_statsu_window a1_psw_sb_refresh_statsu_window refresh_status_windows end #-------------------------------------------------------------------------- # ☆ スキルウィンドウ作成の後処理 #-------------------------------------------------------------------------- alias a1_psw_sb_post_create_skill_window post_create_skill_window def post_create_skill_window a1_psw_sb_post_create_skill_window @skill_window.resize_height(@status_window_y) end #-------------------------------------------------------------------------- # ☆ アイテムウィンドウ作成の後処理 #-------------------------------------------------------------------------- alias a1_psw_sb_post_create_item_window post_create_item_window def post_create_item_window a1_psw_sb_post_create_item_window @item_window.resize_height(@status_window_y) end #-------------------------------------------------------------------------- # ☆ パーティコマンド選択の開始の前処理 #-------------------------------------------------------------------------- alias a1_psw_sb_prev_start_party_command_selection prev_start_party_command_selection def prev_start_party_command_selection battle_members.each {|actor| enable_open_status(actor.index) } a1_psw_sb_prev_start_party_command_selection end #-------------------------------------------------------------------------- # ☆ コマンド[戦う] #-------------------------------------------------------------------------- alias a1_psw_sb_prev_command_fight command_fight def command_fight battle_members.each {|actor| disable_open_status(actor.index) } a1_psw_sb_prev_command_fight end #-------------------------------------------------------------------------- # ☆ コマンド[逃げる] #-------------------------------------------------------------------------- alias a1_psw_sb_prev_command_escape command_escape def command_escape battle_members.each {|actor| disable_open_status(actor.index) } a1_psw_sb_prev_command_escape end #-------------------------------------------------------------------------- # ☆ コマンド[スキル] #-------------------------------------------------------------------------- alias a1_psw_sb_command_skill command_skill def command_skill a1_psw_sb_command_skill @actor_command_window.close end #-------------------------------------------------------------------------- # ☆ コマンド[アイテム] #-------------------------------------------------------------------------- alias a1_psw_sb_command_item command_item def command_item a1_psw_sb_command_item @actor_command_window.close end #-------------------------------------------------------------------------- # ☆ アクター選択の開始 #-------------------------------------------------------------------------- alias a1_psw_sb_select_actor_selection select_actor_selection def select_actor_selection @skill_window.hide @item_window.hide a1_psw_sb_select_actor_selection @actor_window.visible = false end #-------------------------------------------------------------------------- # ☆ 敵キャラ選択の開始 #-------------------------------------------------------------------------- alias a1_psw_sb_select_enemy_selection select_enemy_selection def select_enemy_selection @skill_window.hide @item_window.hide a1_psw_sb_select_enemy_selection @enemy_window.visible = false end #-------------------------------------------------------------------------- # ☆ ターン開始の前処理 #-------------------------------------------------------------------------- alias a1_psw_sb_prev_turn_start prev_turn_start def prev_turn_start close_status_windows a1_psw_sb_prev_turn_start @face_status_window.close if $imported["A1_FaceStatusWindow"] end #-------------------------------------------------------------------------- # ☆ ターン開始の後処理 #-------------------------------------------------------------------------- alias a1_psw_sb_post_turn_start post_turn_start def post_turn_start battle_members.each {|actor| disable_status_window(actor) } end #-------------------------------------------------------------------------- # ☆ 戦闘行動終了時の処理 #-------------------------------------------------------------------------- alias a1_psw_sb_process_action_end process_action_end def process_action_end close_status_windows diseble_close_status(@subject.index) if @subject.actor? a1_psw_sb_process_action_end end #-------------------------------------------------------------------------- # ☆ 戦闘行動の実行 #-------------------------------------------------------------------------- alias a1_psw_sb_execute_action execute_action def execute_action close_status_windows enable_open_status(@subject.index) if @subject.actor? a1_psw_sb_execute_action end #-------------------------------------------------------------------------- # ☆ アニメーションの表示 # targets : 対象者の配列 # animation_id : アニメーション ID(-1: 通常攻撃と同じ) #-------------------------------------------------------------------------- alias a1_psw_sb_show_animation show_animation def show_animation(targets, animation_id) targets.each {|target| on_target_window_open(target) } a1_psw_sb_show_animation(targets, animation_id) end #-------------------------------------------------------------------------- # ○ ターゲットされた個別ステータスウィンドウをオープンする #-------------------------------------------------------------------------- def on_target_window_open(target) disable_open_status(target.index) if target.actor? && target != @subject end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウをクローズして非選択状態にする #-------------------------------------------------------------------------- def diseble_close_status(index) @status_windows[index].visible = false battle_members[index].visible = false battle_members[index].opacity = 128 end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウを非選択状態でオープン #-------------------------------------------------------------------------- def disable_open_status(index) @status_windows[index].visible = true battle_members[index].visible = true battle_members[index].opacity = 128 end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウを選択状態でオープン #-------------------------------------------------------------------------- def enable_open_status(index) @status_windows[index].visible = true battle_members[index].visible = true battle_members[index].opacity = 255 end #-------------------------------------------------------------------------- # ○ 自動回復したアクターのウィンドウをオープン #-------------------------------------------------------------------------- def show_regenerate_actor(actors_index) actors_index.each {|index| enable_open_status(index) } end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウのクローズ #-------------------------------------------------------------------------- def close_status_windows battle_members.each_with_index {|actor, i| actor_visible(false, i, actor) } end #-------------------------------------------------------------------------- # ○ 可視状態設定してウィンドウ位置を戻す #-------------------------------------------------------------------------- def actor_visible(flag, i, actor) actor.visible = flag; @status_windows[i].visible = flag return_window(actor) end #-------------------------------------------------------------------------- # ☆ ステータスウィンドウが更新された時の処理 #-------------------------------------------------------------------------- alias a1_psw_sb_update_status_window update_status_window def update_status_window a1_psw_sb_update_status_window @status_windows.each {|window| window.update } end #-------------------------------------------------------------------------- # ☆ ステータスウィンドウが解放された時の処理 #-------------------------------------------------------------------------- alias a1_psw_sb_dispose_status_window dispose_status_window def dispose_status_window a1_psw_sb_dispose_status_window @status_windows.each {|window| window.dispose } end #-------------------------------------------------------------------------- # ☆ 次のコマンド入力への前処理 #-------------------------------------------------------------------------- alias a1_psw_sb_prev_next_command prev_next_command def prev_next_command a1_psw_sb_prev_next_command disable_status_window(BattleManager.actor) if BattleManager.actor end #-------------------------------------------------------------------------- # ☆ 次のコマンド入力への後処理 #-------------------------------------------------------------------------- alias a1_psw_sb_post_next_command post_next_command def post_next_command a1_psw_sb_post_next_command move_up_status_window(BattleManager.actor) if BattleManager.actor end #-------------------------------------------------------------------------- # ○ 前のコマンド入力への前処理 #-------------------------------------------------------------------------- alias a1_psw_sb_prev_prior_command prev_prior_command def prev_prior_command a1_psw_sb_prev_prior_command disable_status_window(BattleManager.actor) if BattleManager.actor end #-------------------------------------------------------------------------- # ☆ 前のコマンド入力への後処理 #-------------------------------------------------------------------------- alias a1_psw_sb_post_prior_command post_prior_command def post_prior_command a1_psw_sb_post_prior_command move_up_status_window(BattleManager.actor) if BattleManager.actor end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウを非選択状態にする #-------------------------------------------------------------------------- def disable_status_window(actor) actor.opacity = 128 return_window(actor) end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウを選択状態にする #-------------------------------------------------------------------------- def move_up_status_window(actor) actor.opacity = 255 @status_windows[actor.index].move_up if FACE_MODE || actor.battler_name.empty? end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウを定位置に戻す #-------------------------------------------------------------------------- def return_window(actor) @status_windows[actor.index].move_return if FACE_MODE || actor.battler_name.empty? end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウをリフレッシュ #-------------------------------------------------------------------------- def refresh_status_windows @status_windows.each {|window| window.refresh } end #-------------------------------------------------------------------------- # ○ アクターの選択 #-------------------------------------------------------------------------- def select_actor(index) @spriteset.cursor.target = battle_members[index] end #-------------------------------------------------------------------------- # ○ アクターの選択の終了 #-------------------------------------------------------------------------- def select_actor_end @spriteset.cursor.target = nil end #-------------------------------------------------------------------------- # ○ 敵の選択 #-------------------------------------------------------------------------- def select_enemy(index) @spriteset.cursor.target = @enemy_window.enemy end #-------------------------------------------------------------------------- # ○ 敵の選択の終了 #-------------------------------------------------------------------------- def select_enemy_end @spriteset.cursor.target = nil end #-------------------------------------------------------------------------- # ○ バトラースプライトの変更 #-------------------------------------------------------------------------- def change_battler_sprite(member) @spriteset.actor_sprite[member.index] ||= @spriteset.add_actor_sprite(member.index, member) @spriteset.actor_sprite[member.index].battler = member end #-------------------------------------------------------------------------- # ☆ バトルメンバー追加の後処理 #-------------------------------------------------------------------------- alias a1_psw_sb_post_add_battler post_add_battler def post_add_battler(member) a1_psw_sb_post_add_battler(member) battle_members.each {|member| recreate_status_windows(member) } end #-------------------------------------------------------------------------- # ○ 個別ステータスウィンドウを再作成する #-------------------------------------------------------------------------- def recreate_status_windows(member) @status_windows[member.index].dispose if @status_windows[member.index] setup_status_windows(member.index, member) change_battler_sprite(member) end #-------------------------------------------------------------------------- # ☆ バトルメンバー削除の前処理 #-------------------------------------------------------------------------- alias a1_psw_sb_prev_remove_battler prev_remove_battler def prev_remove_battler(member) a1_psw_sb_prev_remove_battler(member) delete_actor_sprite(member.index) end #-------------------------------------------------------------------------- # ○ 削除するメンバーの個別バトルステータスウィンドウとスプライトを解放 #-------------------------------------------------------------------------- def delete_actor_sprite(index) @spriteset.actor_sprite[index].battler.battler_name = "" @status_windows[index].dispose @status_windows.delete_at(index) end #============================================================================== # ■ フェイスステータスウィンドウ対応処理 #============================================================================== if $imported["A1_FaceStatusWindow"] #-------------------------------------------------------------------------- # ☆ 個人ステータスウィンドウのアクター設定(エイリアスを取って潰す) #-------------------------------------------------------------------------- alias a1_psw_sb_setup_personal_status_actor setup_personal_status_actor def setup_personal_status_actor end;end #============================================================================== # ■ 戦闘中入れ替え対応処理 #============================================================================== if $imported["A1_ChangeMember"] #-------------------------------------------------------------------------- # ○ 入れ替え #-------------------------------------------------------------------------- alias a1_psw_command_member_change command_member_change def command_member_change battle_members.each {|actor| close_status_windows } a1_psw_command_member_change end #-------------------------------------------------------------------------- # ☆ メンバーチェンジ[キャンセル] #-------------------------------------------------------------------------- alias a1_psw_on_member_change_cancel on_member_change_cancel def on_member_change_cancel a1_psw_on_member_change_cancel battle_members.each {|member| member_change_refresh(member) } end #-------------------------------------------------------------------------- # ○ メンバーチェンジリフレッシュ #-------------------------------------------------------------------------- def member_change_refresh(member) recreate_status_windows(member) enable_open_status(member.index) end;end end #============================================================================== # ■ Sprite_BattleCursor #============================================================================== class Sprite_BattleCursor < Sprite_Base #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- FACE_MODE = A1_System::PersonalBattleStatusConfig::FACE_MODE FONT_NAME = "VL-Gothic-Regular" FONT_SIZE = 32 DEFAULT_COLOR = Color.new(255,0,255) #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :target #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(color = DEFAULT_COLOR) super(nil) @color = color create_bitmap self.visible = false self.z = 10 @target = nil @plus_x = 0 @plus_y = 0 end #-------------------------------------------------------------------------- # ○ ビットマップ作成 #-------------------------------------------------------------------------- def create_bitmap text = "▼" # 計算用ダミービットマップ bitmap = Cache.system("") bitmap.font.name = FONT_NAME bitmap.font.size = FONT_SIZE tw = bitmap.text_size(text).width + 8 # ビットマップ作成 bitmap = Bitmap.new(tw, (bitmap.font.size + 4) * text.size * 1.5) bitmap.font.name = FONT_NAME bitmap.font.size = FONT_SIZE bitmap.font.color = @color bitmap.draw_text_f(0, 0, bitmap.width, bitmap.height, text, 2, Color.new(0,0,0)) # スプライト設定 self.bitmap = bitmap self.ox = bitmap.width / 2 self.oy = bitmap.height / 2 end #-------------------------------------------------------------------------- # ○ x座標補正値の設定 #-------------------------------------------------------------------------- def plus_x=(x) @plus_x = x end #-------------------------------------------------------------------------- # ○ y座標補正値の設定 #-------------------------------------------------------------------------- def plus_y=(y) @plus_y = y end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update self.visible = @target ? true : false return unless @target super self.x = @target.screen_x + @plus_x self.y = @target.screen_y - @target.battler_height + @plus_y self.y = @target.screen_y - 96 if @target.actor? && (FACE_MODE || @target.battler_name.empty?) end end #============================================================================== # ■ Spriteset_Battle #------------------------------------------------------------------------------ #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ # スの内部で使用されます。 #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_psw_spsb_initialize initialize def initialize create_cursor_sprite a1_psw_spsb_initialize end #-------------------------------------------------------------------------- # ○ カーソルスプライトの作成 #-------------------------------------------------------------------------- def create_cursor_sprite @cursor_sprite = Sprite_BattleCursor.new end #-------------------------------------------------------------------------- # ○ アクタースプライト #-------------------------------------------------------------------------- def actor_sprite return @actor_sprites end #-------------------------------------------------------------------------- # ☆ フレーム更新 #-------------------------------------------------------------------------- alias a1_psw_spsb_update update def update a1_psw_spsb_update update_cursor end #-------------------------------------------------------------------------- # ○ カーソルスプライトの更新 #-------------------------------------------------------------------------- def update_cursor @cursor_sprite.update end #-------------------------------------------------------------------------- # ○ カーソルスプライトの取得 #-------------------------------------------------------------------------- def cursor @cursor_sprite end #-------------------------------------------------------------------------- # ★ アクタースプライトの作成 #-------------------------------------------------------------------------- def create_actors @actor_sprites = [] $game_party.battle_members.each {|actor| @actor_sprites.push(Sprite_Battler.new(@viewport1, actor)) } end #-------------------------------------------------------------------------- # ○ カーソルの解放 #-------------------------------------------------------------------------- def add_actor_sprite(index, actor) @actor_sprites[index] = Sprite_Battler.new(@viewport1, actor) end #-------------------------------------------------------------------------- # ★ アクタースプライトの更新 #-------------------------------------------------------------------------- def update_actors @actor_sprites.each {|sprite| sprite.update } end #-------------------------------------------------------------------------- # ☆ 解放 #-------------------------------------------------------------------------- alias a1_psw_spsb_dispose dispose def dispose a1_psw_spsb_dispose dispose_cursor end #-------------------------------------------------------------------------- # ○ カーソルの解放 #-------------------------------------------------------------------------- def dispose_cursor @cursor_sprite.dispose end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。 #============================================================================== class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # ○ バトラーの高さを取得 #-------------------------------------------------------------------------- def battler_height @battler_height ||= 0 return @battler_height end #-------------------------------------------------------------------------- # ○ バトラーの高さを設定 #-------------------------------------------------------------------------- def battler_height=(height) @battler_height = height end #============================================================================== # ■ ダメージポップアップ対応処理 #============================================================================== if $imported["A1_DamagePopUp"] #-------------------------------------------------------------------------- # ○ ポップアップのセットアップ #-------------------------------------------------------------------------- alias a1_psw_gbt_setup_popup setup_popup def setup_popup(kind) BattleManager.regenerate_actor.push(self.index) unless BattleManager.regenerate_actor.include?(self.index) a1_psw_gbt_setup_popup(kind) end;end end #============================================================================== # ■ Sprite_Battler #------------------------------------------------------------------------------ #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、 # スプライトの状態を自動的に変化させます。 #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_psw_spb_initialize initialize def initialize(viewport, battler = nil) a1_psw_spb_initialize(viewport, battler) setup_battler_info end #-------------------------------------------------------------------------- # ○ バトラー情報のセットアップ #-------------------------------------------------------------------------- def setup_battler_info return unless @battler @battler.battler_height = self.height end #-------------------------------------------------------------------------- # ☆ 転送元ビットマップの更新 #-------------------------------------------------------------------------- alias a1_psw_spb_update_bitmap update_bitmap def update_bitmap return update_bitmap_actor if @battler.actor? a1_psw_spb_update_bitmap end #-------------------------------------------------------------------------- # ○ アクター用転送元ビットマップの更新 #-------------------------------------------------------------------------- def update_bitmap_actor self.opacity = @battler.opacity self.visible = @battler.visible return unless update_bitmap? return self.bitmap = nil if @battler.battler_name.empty? new_bitmap = Cache.picture(@battler.battler_name) @prev_battler_name = @battler.battler_name self.bitmap = new_bitmap @battler.sprite_height = self.bitmap.height setup_battler_info end #-------------------------------------------------------------------------- # ○ アクターのビットマップをアップデートするか判断 #-------------------------------------------------------------------------- def update_bitmap? return false if @battler.battler_name == @prev_battler_name return false if @battler.battler_name.empty? return true end #-------------------------------------------------------------------------- # ☆ 可視状態の初期化 #-------------------------------------------------------------------------- alias a1_psw_spb_init_visibility init_visibility def init_visibility a1_psw_spb_init_visibility setup_battler_info end #-------------------------------------------------------------------------- # ○ アクターの空Bitmapのセットアップ #-------------------------------------------------------------------------- def setup_empty_actor_bitmap(width, height) self.bitmap = Bitmap.new(width, height) end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors) # の内部で使用され、Game_Party クラス($game_party)からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- FACE_MODE = A1_System::PersonalBattleStatusConfig::FACE_MODE #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :screen_x attr_accessor :screen_y attr_accessor :screen_z attr_accessor :opacity attr_accessor :visible attr_accessor :use_sprite attr_accessor :sprite_height attr_accessor :battler_name #-------------------------------------------------------------------------- # ☆ セットアップ #-------------------------------------------------------------------------- alias a1_psw_setup setup 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 = FACE_MODE ? "" : actor.battler_name @use_sprite = @battler_name.empty? ? false : true end #-------------------------------------------------------------------------- # ★ スプライトを使うか? #-------------------------------------------------------------------------- def use_sprite? @use_sprite end end #============================================================================== # ■ Window_BattleEnemy #------------------------------------------------------------------------------ #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。 #============================================================================== class Window_BattleEnemy < Window_Selectable #-------------------------------------------------------------------------- # ☆ ウィンドウの非表示 #-------------------------------------------------------------------------- alias a1_psw_wbe_hide hide def hide @help_window.close a1_psw_wbe_hide end #-------------------------------------------------------------------------- # ○ カーソルの移動処理 #-------------------------------------------------------------------------- def process_cursor_move return unless cursor_movable? last_index = @index cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN) cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP) cursor_down (Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT) cursor_up (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT) Sound.play_cursor if @index != last_index end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.draw_center_text(enemy.name) end #-------------------------------------------------------------------------- # ○ ヘルプウィンドウの設定 #-------------------------------------------------------------------------- def help_window=(window) @help_window = window @help_window.height = fitting_height(1) @help_window.create_contents end #-------------------------------------------------------------------------- # ○ ウィンドウのアクティブ化 #-------------------------------------------------------------------------- def activate @help_window.open super end #-------------------------------------------------------------------------- # ★ 桁数の取得 #-------------------------------------------------------------------------- def col_max return 1 end end #============================================================================== # ■ Window_BattleActor #------------------------------------------------------------------------------ #  バトル画面で、行動対象のアクターを選択するウィンドウです。 #============================================================================== class Window_BattleActor < Window_BattleStatus #-------------------------------------------------------------------------- # ☆ ウィンドウの非表示 #-------------------------------------------------------------------------- alias a1_psw_wba_hide hide def hide @help_window.close a1_psw_wba_hide end #-------------------------------------------------------------------------- # ○ カーソルの移動処理 #-------------------------------------------------------------------------- def process_cursor_move return unless cursor_movable? last_index = @index cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN) cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP) cursor_down (Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT) cursor_up (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT) Sound.play_cursor if @index != last_index end #-------------------------------------------------------------------------- # ○ アクターオブジェクト取得 #-------------------------------------------------------------------------- def actor $game_party.battle_members[@index] end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.draw_center_text(actor.name) end #-------------------------------------------------------------------------- # ○ ヘルプウィンドウの設定 #-------------------------------------------------------------------------- def help_window=(window) @help_window = window @help_window.height = fitting_height(1) @help_window.create_contents end #-------------------------------------------------------------------------- # ○ ウィンドウのアクティブ化 #-------------------------------------------------------------------------- def activate @help_window.open super end end end