#=========================================================================== # ◆ A1 Scripts ◆ # ダメージポップアップ(RGSS3) # # バージョン : 2.30 (2020/07/09) # 作者 : A1 # URL     : http://a1tktk.web.fc2.com/ #--------------------------------------------------------------------------- # 機能: # ・バトル中のダメージなどをポップアップ表示します #--------------------------------------------------------------------------- # 更新履歴   :2012/01/10 Ver1.00 リリース # :2012/01/10 Ver1.10 個別バトルステータスウィンドウ対応 # :2012/01/12 Ver1.11 MP/TPダメージの表示不具合を修正 # :2012/01/12 Ver1.11 スプライトの位置調整 # :2012/01/18 Ver2.00 スリップダメージ対応 # :2012/01/18 Ver2.00 A1バトル共通スクリプト対応 # :2012/01/24 Ver2.10 「その他の種別」対応 # :2012/01/26 Ver2.20 回復アイテムでポップアップする機能追加 # :2020/07/09 Ver2.30 合計ダメージポップアップに対応 # :2020/07/09 Ver2.30 「防御」「パリィ」に対応 #--------------------------------------------------------------------------- # 設置場所 # A1バトル共通スクリプト以下 # # 必要スクリプト # A1バトル共通スクリプト #--------------------------------------------------------------------------- # 使い方 # ■ 設定項目 に設定します # # データベース「ステート」のメモ欄、表示名の設定をします # # <表示名 name> # ステートが付与/解除された時に、name がポップアップします # # ※本来の付与/解除時のメッセージが設定されていないステートは #  付与/解除時にポップアップしません #  ポップアップさせたい場合、何かしら(あああ など)設定 #============================================================================== $imported ||= {} if $imported["A1_BattleCommonScript"] $imported["A1_DamagePopUp"] = true old_common_script("ダメージポップアップ", "3.90") if common_version < 3.90 #============================================================================== # ■ 設定項目 #============================================================================== module A1_System::DamagePopUpConfig #-------------------------------------------------------------------------- # ヘルプモード # true にすると、行動表示がFF風になります #-------------------------------------------------------------------------- HELP_MODE = true #-------------------------------------------------------------------------- # ヘルプモード・アクターの通常攻撃時に名前を表示するか? #-------------------------------------------------------------------------- SHOW_ACTOR_NAME = true #-------------------------------------------------------------------------- # ポップアップのフォント #-------------------------------------------------------------------------- FONT_NAME = "Arial Black" #-------------------------------------------------------------------------- # ポップアップのフォントサイズ #-------------------------------------------------------------------------- FONT_SIZE = 32 #-------------------------------------------------------------------------- # 合計ダメージポップアップのフォントサイズ #-------------------------------------------------------------------------- FONT_SIZE_TOTAL = 48 end #============================================================================== # ■ BattleManager #------------------------------------------------------------------------------ #  戦闘の進行を管理するモジュールです。 #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ○ ポップアップダメージメソッドの設定 #-------------------------------------------------------------------------- def self.method_popup_damege=(method) @method_popup_damege = method end #-------------------------------------------------------------------------- # ○ ポップアップダメージメソッドの取得 #-------------------------------------------------------------------------- def self.method_popup_damege @method_popup_damege end end #============================================================================== # ■ RPG::BaseItem #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # ○ ポップアップウェイト #-------------------------------------------------------------------------- def popup_wait_frame @popup_wait_frame ||= $a1_common.note_data_one_value(self.note, "ポップアップウェイト", 15) return @popup_wait_frame end end #============================================================================== # ■ RPG::State #============================================================================== class RPG::State < RPG::BaseItem #-------------------------------------------------------------------------- # ○ ステートの表示名 #-------------------------------------------------------------------------- def display_name @display_name ||= $a1_common.note_data_one(self.note, "表示名", "") return @display_name end #-------------------------------------------------------------------------- # ○ Goodステート #-------------------------------------------------------------------------- def good_state @good_state = $a1_common.note_data(self.note, "Goodステート") if @good_state == nil return @good_state end end #============================================================================== # ■ Sprite_DamagePop #============================================================================== class Sprite_DamagePop #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- FONT = A1_System::DamagePopUpConfig::FONT_NAME FONT_SIZE = A1_System::DamagePopUpConfig::FONT_SIZE FONT_SIZE_TOTAL = A1_System::DamagePopUpConfig::FONT_SIZE_TOTAL # 通常 中の色 / 縁の色 COLOR0 = [Color.new(255,255,255), Color.new(16,16,16)] # 回復 COLOR1 = [Color.new(128,255,192), Color.new(16,16,16)] # MPダメージ COLOR2 = [Color.new(255,128,224), Color.new(16,16,16)] # クリティカル COLOR3 = [Color.new(255,224,128), Color.new(192,0,0)] # 合計ダメージ COLOR4 = [Color.new(255,255,0), Color.new(16,16,16)] NOML = 0 MISS = 1 EVAD = 2 FAIL = 3 CRIT = 4 HPDR = 5 MPDR = 6 MPDA = 7 MPRE = 8 TPDA = 9 TPRE = 10 RFLC = 11 ADST = 12 RMST = 13 GARD = 20 PARY = 21 IGNORE_PHYSICAL = 22 TOTAL = 23 TEXTS = { NOML => "", # 通常ダメージ/回復 MISS => "Miss!", # ミス EVAD => "Evaded!", # 回避 FAIL => "Failed!", # 失敗 CRIT => "Critical!", # クリティカル HPDR => "HP-Drain", # HPドレイン MPDR => "MP-Drain", # MPドレイン MPDA => "MP-Damage", # MPダメージ MPRE => "MP-Recovery", # MP回復 TPDA => "SP-Damage", # TPダメージ TPRE => "SP-Recovery", # TP回復 RFLC => "Reflection!", # 反射 GARD => "Guard!", # 防御 PARY => "Parring!", # パリィ IGNORE_PHYSICAL => "Ignore-Physical!" # 物理攻撃無効 } #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :x attr_accessor :y attr_accessor :flame_count attr_accessor :sprite #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, flame_count, damage, kind = NOML, msg = nil, font = FONT, flg = 0) font = FONT unless font @flame_count = flame_count @sprite = Sprite.new @sprite.x = x @sprite.y = y @sprite.z = 200 bitmap = create_bitmap(damage, kind, msg, font, flg) set_sprite(bitmap) @rx = @sprite.x @lrmove = (-2 * 10 + rand((40)+1))/10.0 @jump = 5.0 @yuka = @sprite.y + 12 @bound = 5 @count = 0 end #-------------------------------------------------------------------------- # ○ ビットマップの作成 #-------------------------------------------------------------------------- def create_bitmap(damage, kind, msg, font, flg = 0) texts = [] case kind when NOML if damage < 0; color = COLOR1; damage = damage.abs else; color = COLOR0; end texts = [damage.to_s] when MISS; texts = [TEXTS[MISS]]; color = COLOR0 when EVAD; texts = [TEXTS[EVAD]]; color = COLOR0 when FAIL; texts = [TEXTS[FAIL]]; color = COLOR0 when CRIT; texts = [TEXTS[CRIT], damage.to_s]; color = COLOR3 when HPDR; texts = [TEXTS[HPDR], damage.to_s]; color = COLOR0 when MPDR; texts = [TEXTS[MPDR], damage.to_s]; color = COLOR0 when MPDA; texts = [TEXTS[MPDA], damage.to_s]; color = COLOR2 when MPRE; texts = [TEXTS[MPRE], damage.to_s]; color = COLOR1 when TPDA; texts = [TEXTS[TPDA], damage.to_s]; color = COLOR2 when TPRE; texts = [TEXTS[TPRE], damage.to_s]; color = COLOR1 when RFLC; texts = [TEXTS[RFLC]]; color = COLOR0 when GARD; texts = [TEXTS[GARD]]; color = COLOR0 when PARY; texts = [TEXTS[PARY]]; color = COLOR0 when ADST; texts = [msg]; color = flg == 0 ? COLOR2 : COLOR1 when RMST; texts = [msg]; color = flg == 0 ? COLOR1 : COLOR2 when IGNORE_PHYSICAL; texts = [TEXTS[IGNORE_PHYSICAL]]; color = COLOR0 when TOTAL; texts = [damage.to_s]; color = COLOR4 else texts = other_kind_texts(damage, kind, msg) color = other_kind_color(kind) end # 計算用ダミービットマップ bitmap = Cache.system("") bitmap.font.name = font bitmap.font.size = kind == TOTAL ? FONT_SIZE_TOTAL : FONT_SIZE tw = bitmap.text_size(texts[0]).width + 8 # ビットマップ作成 bitmap = Bitmap.new(tw, (bitmap.font.size + 4) * texts.size * 1.5 ) bitmap.font.name = font bitmap.font.size = kind == TOTAL ? FONT_SIZE_TOTAL : FONT_SIZE bitmap.font.color = color[0] (0...texts.size).each {|i| bitmap.draw_text_f(0, bitmap.font.size * i, bitmap.width, bitmap.height, texts[i], 2, color[1])} return bitmap end #-------------------------------------------------------------------------- # ○ スプライト設定 #-------------------------------------------------------------------------- def set_sprite(bitmap) @sprite.bitmap = bitmap @sprite.ox = bitmap.width / 2 @sprite.oy = bitmap.height / 2 end #-------------------------------------------------------------------------- # ○ その他種別のテキスト #-------------------------------------------------------------------------- def other_kind_texts(damage, kind, msg) end #-------------------------------------------------------------------------- # ○ その他種別のカラー #-------------------------------------------------------------------------- def other_kind_color(kind) end #-------------------------------------------------------------------------- # ○ フレーム更新 #-------------------------------------------------------------------------- def update return if @flame_count == 0 update_jump @flame_count -= 1 dispose if @flame_count == 0 end #-------------------------------------------------------------------------- # ○ ポップアップジャンプの更新 #-------------------------------------------------------------------------- def update_jump @sprite.x = @rx;@rx += @lrmove @sprite.y -= @jump @jump -= 0.5 if @sprite.y >= @yuka @sprite.y = @yuka if @bound > 0 @jump = -@jump / 3 * 2 @jump -= 1 @jump = @lrmove = 0 if @jump.truncate <= 1 @bound -= 1 else @jump = @lrmove = 0 end end # 横バウンド if @rx - @sprite.ox <= 0 @rx = @sprite.ox + 1 @lrmove = -@lrmove elsif @rx + @sprite.ox >= Graphics.width @rx = Graphics.width - @sprite.ox - 1 @lrmove = -@lrmove end # 更新カウント加算 @count += 1 end #-------------------------------------------------------------------------- # ○ 解放 #-------------------------------------------------------------------------- def dispose @sprite.bitmap.dispose @sprite.dispose end end #============================================================================== # ■ Window_BattleLog #------------------------------------------------------------------------------ #  戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド # ウとして扱います。 #============================================================================== class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- HELP_MODE = A1_System::DamagePopUpConfig::HELP_MODE SHOW_ACTOR_NAME = A1_System::DamagePopUpConfig::SHOW_ACTOR_NAME #-------------------------------------------------------------------------- # ☆ オブジェクト初期化 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_initialize initialize def initialize @damage_popups = [] @popup_index = 0 a1_damege_popup_wbl_initialize setup_help_mode if HELP_MODE end #-------------------------------------------------------------------------- # ○ ヘルプモードのセットアップ #-------------------------------------------------------------------------- def setup_help_mode self.opacity = 255 self.openness = 0 @back_sprite.visible = false end #-------------------------------------------------------------------------- # ☆ 背景の不透明度を取得 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_back_opacity back_opacity def back_opacity return HELP_MODE ? 0 : a1_damege_popup_wbl_back_opacity end #-------------------------------------------------------------------------- # ☆ 最大行数の取得 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_max_line_number max_line_number def max_line_number return 1 if HELP_MODE a1_damege_popup_wbl_max_line_number end #-------------------------------------------------------------------------- # ○ ダメージのポップアップ #-------------------------------------------------------------------------- def pop_damage(target, kind, msg = nil, font = nil, flg = 0) damage = get_show_damage(target, kind) pos = popup_pos_enemy(target) if target.enemy? pos = popup_pos_actor(target) if target.actor? return unless pos create_dameg_pop(pos[0], pos[1], 60, damage, kind, msg, font, flg) refresh_status popup_wait(5) end #-------------------------------------------------------------------------- # ○ ポップアップの作成 #-------------------------------------------------------------------------- def create_dameg_pop(x, y, flame_count, damage, kind, msg, font, flg) damage_sprite = Sprite_DamagePop.new(x, y, flame_count, damage, kind, msg, font, flg) @damage_popups.push(damage_sprite) end #-------------------------------------------------------------------------- # ○ 種別のダメージを取得 #-------------------------------------------------------------------------- def get_show_damage(target, kind) return target.result.mp_damage.abs if kind == Sprite_DamagePop::MPDA || kind == Sprite_DamagePop::MPRE return target.result.tp_damage.abs if kind == Sprite_DamagePop::TPDA || kind == Sprite_DamagePop::TPRE return target.result.hp_damage end #-------------------------------------------------------------------------- # ○ ポップアップの位置取得・アクター #-------------------------------------------------------------------------- def popup_pos_actor(target) y = Graphics.height - fitting_height(4) + target.index * line_height + standard_padding return [Graphics.width / 2, y] end #-------------------------------------------------------------------------- # ○ ポップアップの位置取得・敵 #-------------------------------------------------------------------------- def popup_pos_enemy(target) [target.screen_x ,target.screen_y] end #-------------------------------------------------------------------------- # ○ ポップダメージの更新 #-------------------------------------------------------------------------- def update_pop @damage_popups.each_with_index {|popup, i| update_popup_damege(popup, i) } end #-------------------------------------------------------------------------- # ○ ポップダメージの更新 #-------------------------------------------------------------------------- def update_popup_damege(popup, i) return unless popup popup.update @damage_popups.delete_at(i) if popup.sprite.disposed? end #-------------------------------------------------------------------------- # ☆ 解放 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_dispose dispose def dispose a1_damege_popup_wbl_dispose dispose_popup end #-------------------------------------------------------------------------- # ○ ポップアップの解放 #-------------------------------------------------------------------------- def dispose_popup @damage_popups.each {|popup| popup.dispose } end #-------------------------------------------------------------------------- # ☆ クリア #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_clear clear def clear a1_damege_popup_wbl_clear close if HELP_MODE end #-------------------------------------------------------------------------- # ☆ リフレッシュ #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_refresh refresh def refresh return if HELP_MODE a1_damege_popup_wbl_refresh end #-------------------------------------------------------------------------- # ☆ 反射の表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_reflection display_reflection def display_reflection(target, item) a1_damege_popup_wbl_display_reflection(target, item) pop_damage(target, Sprite_DamagePop::RFLC) end #-------------------------------------------------------------------------- # ☆ スキル/アイテム使用の表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_use_item display_use_item def display_use_item(subject, item) draw_skill_action(subject, item) if HELP_MODE a1_damege_popup_wbl_display_use_item(subject, item) end #-------------------------------------------------------------------------- # ○ スキルアクションの表示 #-------------------------------------------------------------------------- def draw_skill_action(subject, item) self.contents.clear return draw_help(subject.name) if show_name?(subject, item) return draw_help(item.name) if show_item?(item) end #-------------------------------------------------------------------------- # ○ 名前を表示する? #-------------------------------------------------------------------------- def show_name?(subject, item) return false unless item.is_a?(RPG::Skill) return false if item.id != 1 return true if subject.enemy? return true if subject.actor? && SHOW_ACTOR_NAME end #-------------------------------------------------------------------------- # ○ スキル/アイテム名を表示する? #-------------------------------------------------------------------------- def show_item?(item) return true unless item.is_a?(RPG::Skill) return true if item.id != 1 return false end #-------------------------------------------------------------------------- # ○ ヘルプモードの文章表示 #-------------------------------------------------------------------------- def draw_help(text) draw_text(0, 0, self.contents.width, line_height, text, 1) open end #-------------------------------------------------------------------------- # ☆ ミスの表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_miss display_miss def display_miss(target, item) a1_damege_popup_wbl_display_miss(target, item) pop_damage(target, Sprite_DamagePop::MISS) end #-------------------------------------------------------------------------- # ☆ 回避の表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_evasion display_evasion def display_evasion(target, item) a1_damege_popup_wbl_display_evasion(target, item) pop_damage(target, Sprite_DamagePop::EVAD) end #-------------------------------------------------------------------------- # ☆ クリティカルヒットの表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_critical display_critical def display_critical(target, item) @wait_skip_continue = HELP_MODE a1_damege_popup_wbl_display_critical(target, item) @wait_skip_continue = false end #-------------------------------------------------------------------------- # ☆ HP ダメージ表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_hp_damage display_hp_damage def display_hp_damage(target, item) return if !item.damage.to_hp? && target.result.hp_damage == 0 kind = Sprite_DamagePop::NOML kind = Sprite_DamagePop::CRIT if target.result.critical kind = Sprite_DamagePop::FAIL if target.result.hit? && !target.result.success a1_damege_popup_wbl_display_hp_damage(target, item) pop_damage(target, kind) end #-------------------------------------------------------------------------- # ☆ MP ダメージ表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_mp_damage display_mp_damage def display_mp_damage(target, item) return if target.dead? || target.result.mp_damage == 0 a1_damege_popup_wbl_display_mp_damage(target, item) pop_damage(target, Sprite_DamagePop::MPDA) if target.result.mp_damage > 0 pop_damage(target, Sprite_DamagePop::MPRE) if target.result.mp_damage < 0 end #-------------------------------------------------------------------------- # ☆ TP ダメージ表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_tp_damage display_tp_damage def display_tp_damage(target, item) return if target.dead? || target.result.tp_damage == 0 a1_damege_popup_wbl_display_tp_damage(target, item) pop_damage(target, Sprite_DamagePop::TPDA) if target.result.tp_damage > 0 pop_damage(target, Sprite_DamagePop::TPRE) if target.result.tp_damage < 0 end #-------------------------------------------------------------------------- # ☆ ステート付加/解除の表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_changed_states display_changed_states def display_changed_states(target) @change_state_target = target @wait_skip_continue = HELP_MODE a1_damege_popup_wbl_display_changed_states(target) @wait_skip_continue = false end #-------------------------------------------------------------------------- # ☆ ステート付加の表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_added_states display_added_states def display_added_states(target) @add_status = [] target.result.added_state_objects.each {|state| @add_status.push(state)} a1_damege_popup_wbl_display_added_states(target) @add_status = nil @popup_index = 0 end #-------------------------------------------------------------------------- # ☆ 最下行の文章の取得 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_last_text last_text def last_text return "" if HELP_MODE return a1_damege_popup_wbl_last_text end #-------------------------------------------------------------------------- # ☆ ステート解除の表示 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_display_removed_states display_removed_states def display_removed_states(target) @remove_status = [] target.result.removed_state_objects.each {|state| @remove_status.push(state)} a1_damege_popup_wbl_display_removed_states(target) @remove_status = nil @popup_index = 0 end #-------------------------------------------------------------------------- # ○ ステート追加のポップアップ #-------------------------------------------------------------------------- def popup_add_status(state) @popup_index += 1 return if state.display_name.empty? @method_wait.call(15) if @method_wait && @popup_index > 1 pop_damage(@change_state_target, Sprite_DamagePop::ADST, state.display_name, nil, state.good_state ? 1 : 0) end #-------------------------------------------------------------------------- # ○ ステート解除のポップアップ #-------------------------------------------------------------------------- def popup_remove_status(state) @popup_index += 1 return if state.display_name.empty? @method_wait.call(15) if @method_wait && @popup_index > 1 pop_damage(@change_state_target, Sprite_DamagePop::RMST, state.display_name, nil, state.good_state ? 1 : 0) end #-------------------------------------------------------------------------- # ○ ポップアップウェイト #-------------------------------------------------------------------------- def popup_wait(num = popup_wait_frame) @method_wait.call(num) if @method_wait end #-------------------------------------------------------------------------- # ○ ポップアップウェイトフレーム #-------------------------------------------------------------------------- def popup_wait_frame @popup_wait_frame ||= 15 @popup_wait_frame end #-------------------------------------------------------------------------- # ○ ポップアップウェイトフレーム #-------------------------------------------------------------------------- def popup_wait_frame=(value) @popup_wait_frame = value end #-------------------------------------------------------------------------- # ☆ 文章の追加 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_add_text add_text def add_text(text) a1_damege_popup_wbl_add_text(text) unless HELP_MODE end #-------------------------------------------------------------------------- # ☆ 文章の置き換え # 最下行を別の文章に置き換える。 #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_replace_text replace_text def replace_text(text) popup_add_status(@add_status[@popup_index]) if @add_status popup_remove_status(@remove_status[@popup_index]) if @remove_status a1_damege_popup_wbl_replace_text(text) unless HELP_MODE end #-------------------------------------------------------------------------- # ☆ ウェイト #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_wait wait def wait a1_damege_popup_wbl_wait unless @wait_skip_continue end #-------------------------------------------------------------------------- # ☆ エフェクト実行が終わるまでウェイト #-------------------------------------------------------------------------- alias a1_damege_popup_wbl_wait_for_effect wait_for_effect def wait_for_effect a1_damege_popup_wbl_wait_for_effect unless @wait_skip_continue end #-------------------------------------------------------------------------- # ○ ステータスウィンドウの情報を更新メソッド #-------------------------------------------------------------------------- def method_refresh_status=(method) @method_refresh_status = method end #-------------------------------------------------------------------------- # ○ ステータスウィンドウの情報を更新 #-------------------------------------------------------------------------- def refresh_status @method_refresh_status.call if @method_refresh_status end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ☆ バトルマネージャメソッドの定義 #-------------------------------------------------------------------------- alias a1_damege_popup_sb_define_battle_manager_method define_battle_manager_method def define_battle_manager_method a1_damege_popup_sb_define_battle_manager_method BattleManager.define_method(method(:popup_damege), :popup_damege) end #-------------------------------------------------------------------------- # ☆ スプライトセットの作成 #-------------------------------------------------------------------------- alias a1_damege_popup_sb_create_spriteset create_spriteset def create_spriteset a1_damege_popup_sb_create_spriteset @spriteset.method_update_damage_popup = method(:update_damage_popup) end #-------------------------------------------------------------------------- # ☆ ログウィンドウの作成 #-------------------------------------------------------------------------- alias a1_damege_popup_sb_create_log_window create_log_window def create_log_window a1_damege_popup_sb_create_log_window @log_window.method_refresh_status = method(:refresh_status) end #-------------------------------------------------------------------------- # ○ ポップアップダメージの更新 #-------------------------------------------------------------------------- def update_damage_popup @log_window.update_pop end #-------------------------------------------------------------------------- # ○ ポップアップダメージ表示 #-------------------------------------------------------------------------- def popup_damege(target, kind) @log_window.pop_damage(target, kind) end end #============================================================================== # ■ Spriteset_Battle #------------------------------------------------------------------------------ #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ # スの内部で使用されます。 #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ☆ フレーム更新 #-------------------------------------------------------------------------- alias a1_damege_popup_spsb_update update def update a1_damege_popup_spsb_update update_damage_popup end #-------------------------------------------------------------------------- # ○ ポップアップダメージの更新メソッドの設定 #-------------------------------------------------------------------------- def method_update_damage_popup=(method) @method_update_damage_popup = method end #-------------------------------------------------------------------------- # ○ ポップアップダメージの更新 #-------------------------------------------------------------------------- def update_damage_popup @method_update_damage_popup.call if @method_update_damage_popup end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。 #============================================================================== class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # ☆ HP の再生 #-------------------------------------------------------------------------- alias a1_damege_popup_gbt_regenerate_hp regenerate_hp def regenerate_hp a1_damege_popup_gbt_regenerate_hp setup_popup(Sprite_DamagePop::NOML) if @result.hp_damage.abs > 0 end #-------------------------------------------------------------------------- # ☆ MP の再生 #-------------------------------------------------------------------------- alias a1_damege_popup_gbt_regenerate_mp regenerate_mp def regenerate_mp a1_damege_popup_gbt_regenerate_mp setup_popup(Sprite_DamagePop::MPDA) if @result.mp_damage > 0 setup_popup(Sprite_DamagePop::MPRE) if @result.mp_damage < 0 end #-------------------------------------------------------------------------- # ☆ TP の再生 #-------------------------------------------------------------------------- alias a1_damege_popup_gbt_regenerate_tp regenerate_tp def regenerate_tp prev_tp = self.tp a1_damege_popup_gbt_regenerate_tp @result.tp_damage = (prev_tp - self.tp).to_i setup_popup(Sprite_DamagePop::TPDA) if @result.tp_damage > 0 setup_popup(Sprite_DamagePop::TPRE) if @result.tp_damage < 0 end #-------------------------------------------------------------------------- # ○ ポップアップのセットアップ #-------------------------------------------------------------------------- def setup_popup(kind) BattleManager.call_method(:popup_damege, self, kind) BattleManager.turn_end_wait = 60 end end end