Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  2. #
  3. # Hệ Thống Chiến Đấu MARU Và LNX11a_XP
  4. #
  5. #★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  6.  
  7. module MARU__attack_command
  8.  
  9.   #設定項目
  10.  
  11.   ATTACK_BOTTAN = :X                      #Nút Đánh
  12.   WINDOW_OPEN  = true                     # Nên Để True
  13.   WINDOW_TEXT  = "X (Nhấn Nút A): Tấn Công Hết" #Lời Ghi chú
  14.   TARGET_TYPE  = false                    # Nếu Để true thì tấn công ngẫu nhiên
  15.  
  16.   #設定終わり
  17.  
  18. end  
  19.  
  20. #==============================================================================
  21. # ■ Window_PartyCommand
  22. #------------------------------------------------------------------------------
  23. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  24. #==============================================================================
  25. class Window_PartyCommand < Window_Command
  26.   #--------------------------------------------------------------------------
  27.   # ● 決定やキャンセルなどのハンドリング処理
  28.   #--------------------------------------------------------------------------
  29.   alias ma__process_handling process_handling
  30.   def process_handling
  31.     return unless open? && active
  32.     ma__process_handling
  33.     return process_a if handle?(:X) && Input.trigger?(MARU__attack_command::ATTACK_BOTTAN)
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● Aが押されたときの処理
  37.   #--------------------------------------------------------------------------
  38.   def process_a
  39.     Sound.play_ok
  40.     Input.update
  41.     deactivate
  42.     call_handler(:X)
  43.   end
  44. end
  45.  
  46. #==============================================================================
  47. # ■ Scene_Battle
  48. #------------------------------------------------------------------------------
  49. #  バトル画面の処理を行うクラスです。
  50. #==============================================================================
  51.  
  52. class Scene_Battle < Scene_Base
  53.   #--------------------------------------------------------------------------
  54.   # ● パーティコマンドウィンドウの作成
  55.   #--------------------------------------------------------------------------
  56.   alias ma__create_party_command_window create_party_command_window
  57.   def create_party_command_window
  58.     ma__create_party_command_window
  59.     @party_command_window.set_handler(:X,      method(:command_attack_all))
  60.     if MARU__attack_command::WINDOW_OPEN
  61.     @help_bot_window = Window_ABD.new(0,Graphics.height-@party_command_window.height-320,250,48,@party_command_window)
  62.     end
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● コマンド[一斉攻撃]
  66.   #--------------------------------------------------------------------------
  67.   def command_attack_all
  68.     #@help_bot_window.hide if MARU__attack_command::WINDOW_OPEN
  69.     x = $game_party.battle_members.size
  70.     x.times{|i|
  71.     next unless $game_party.members[i].attack_usable?
  72.     $game_party.members[i].make_actions
  73.     $game_party.members[i].actions.size.times {|n|
  74.     $game_party.members[i].actions[n].set_attack
  75.     $game_party.members[i].actions[n].target_index = 0 unless MARU__attack_command::TARGET_TYPE
  76.     }}
  77.     turn_start
  78.   end
  79. end
  80. class Window_ABD < Window_Base
  81.   #--------------------------------------------------------------------------
  82.   # ● オブジェクト初期化
  83.   #-------------------------------------------------------------------------
  84.   def initialize(x, y, width, height,window)
  85.     super(x, y, width, height)
  86.     draw_text(0,0,232,24,MARU__attack_command::WINDOW_TEXT,1)
  87.     @pt_window = window
  88.     self.openness = 0
  89.   end
  90.   def update
  91.     super
  92.     self.openness = @pt_window.openness == 255 ? 255 : 0
  93.   end
  94. end
  95. #==============================================================================
  96. # ★ RGSS3-Extension
  97. # LNX11a_XPスタイルバトル
  98. #  戦闘画面をRPGツクールXP準拠のものに変更します。
  99. #
  100. #  version   : 1.10 (12/11/18)
  101. #  author    : ももまる
  102. #  reference : http://peachround.blog.fc2.com/blog-entry-9.html
  103. #
  104. #==============================================================================
  105.  
  106. #==============================================================================
  107. # ■ LNXスクリプト導入情報
  108. #==============================================================================
  109. $lnx_include = {} if $lnx_include == nil
  110. $lnx_include[:lnx11a] = 110 # version
  111. p "OK:LNX11a_XPスタイルバトル"
  112.  
  113. module LNX11
  114.   #--------------------------------------------------------------------------
  115.   # ● 正規表現
  116.   #--------------------------------------------------------------------------
  117.   # アクター:バトラーグラフィック = "ファイル名"
  118.   RE_BATTLER = /(?:バトラーグラフィック|battler_graphic)\s*=\s*"([^"]*)"/i
  119.  # アイテム/スキル:使用時アニメ = アニメーションID
  120.  RE_USE_ANIMATION = /(?:使用時アニメ|use_animation)\s*=\s*(\d+)/i
  121.  # アイテム/スキル:ヘルプ説明 = "説明文"
  122.  RE_SHORT_DESCRIPTION =/(?:ヘルプ説明|short_description)\s*=\s*"([^"]*)"/i
  123.   # アイテム/スキル:ヘルプ非表示
  124.   RE_USABLEITEM_NO_DISPLAY = /(?:ヘルプ非表示|no_display)/i
  125.   # アイテム/スキル:使用時追加ウェイト = duration
  126.   RE_DISPLAY_WAIT = /(?:使用時追加ウェイト|display_wait)\s*=\s*(\d+)/i
  127.   # アイテム/スキル:終了時追加ウェイト = duration
  128.   RE_END_WAIT = /(?:終了時追加ウェイト|end_wait)\s*=\s*(\d+)/i
  129.   # 敵キャラ:通常攻撃アニメ = アニメーションID
  130.   RE_ATK_ANIMATION = /(?:通常攻撃アニメ|atk_animation)\s*=\s*(\d+)/i
  131.   # ステート:ステートアニメ = アニメーションID
  132.   RE_STATE_ANIMATION = /(?:ステートアニメ|state_animation)\s*=\s*(\d+)/i
  133.   # ステート:ポップアップ表示名 = "表示名"
  134.   RE_STATE_DISPLAY = /(?:ポップアップ表示名|display_name)\s*=\s*"([^"]*)"/i
  135.  # ステート:ポップアップ非表示
  136.  RE_STATE_NO_DISPLAY = /(?:ポップアップ非表示|no_display)/i
  137.  # ステート:付加ポップアップ非表示
  138.  RE_STATE_ADD_NO_DISPLAY = /(?:付加ポップアップ非表示|add_no_display)/i
  139.  # ステート:解除ポップアップ非表示
  140.  RE_STATE_REM_NO_DISPLAY = /(?:解除ポップアップ非表示|remove_no_display)/i
  141.  # ステート:有利なステート
  142.  RE_STATE_ADVANTAGE = /(?:有利なステート|advantage_state)/i
  143.  # ステート:ポップアップタイプ = type_id
  144.  RE_STATE_TYPE = /(?:ポップアップタイプ|popup_type)\s*=\s*(\d+)/i
  145.  # ステート:付加ポップアップタイプ = type_id
  146.  RE_STATE_ADD_TYPE = /(?:付加ポップアップタイプ|add_popup_type)\s*=\s*(\d+)/i
  147.  # ステート:解除ポップアップタイプ = type_id
  148.  RE_STATE_REM_TYPE =/(?:解除ポップアップタイプ|remove_popup_type)\s*=\s*(\d+)/i
  149.  # ステート:修飾文字非表示
  150.  RE_STATE_NO_DECORATION = /(?:修飾文字非表示|no_decoration)/i
  151.  # ステート:付加修飾文字非表示
  152.  RE_STATE_ADD_NO_DECORATION = /(?:付加修飾文字非表示|add_no_decoration)/i
  153.  # ステート:解除修飾文字非表示
  154.  RE_STATE_REM_NO_DECORATION = /(?:解除修飾文字非表示|remove_no_decoration)/i
  155.  # <<ver1.10>>
  156.  # ステート:付加ポップアップ表示名 = "表示名"
  157.  RE_STATE_ADD_DISPLAY =
  158.  /(?:付加ポップアップ表示名|add_display_name)\s*=\s*"([^"]*)"/i
  159.   # ステート:解除ポップアップ表示名 = "表示名"
  160.   RE_STATE_REM_DISPLAY =
  161.   /(?:解除ポップアップ表示名|remove_display_name)\s*=\s*"([^"]*)"/i
  162.  #--------------------------------------------------------------------------
  163.  # ● バトルステータス更新
  164.  #--------------------------------------------------------------------------
  165.  # LNX11.バトルステータス更新
  166.  def self.battle_status_refresh
  167.    $game_temp.battle_status_refresh
  168.  end
  169.  def self.バトルステータス更新
  170.    self.battle_status_refresh
  171.  end  
  172.  #--------------------------------------------------------------------------
  173.  # ● アクターエリア表示/非表示
  174.  #--------------------------------------------------------------------------
  175.  # LNX11.アクターエリア表示
  176.  def self.actor_area_show
  177.    self.actor_show
  178.    self.status_show
  179.    self.actor_bg_show
  180.  end
  181.  def self.アクターエリア表示
  182.    self.actor_area_show
  183.  end
  184.  # LNX11.アクターエリア非表示
  185.  def self.actor_area_hide
  186.    self.actor_hide
  187.    self.status_hide
  188.    self.actor_bg_hide
  189.  end
  190.  def self.アクターエリア非表示
  191.    self.actor_area_hide
  192.  end
  193.  #--------------------------------------------------------------------------
  194.  # ● アクター表示/非表示
  195.  #--------------------------------------------------------------------------
  196.  # LNX11.アクター表示
  197.  def self.actor_show
  198.    $game_party.actor_invisible = false
  199.  end
  200.  def self.アクター表示
  201.    self.actor_show
  202.  end
  203.  # LNX11.アクター非表示
  204.  def self.actor_hide
  205.    $game_party.actor_invisible = true
  206.  end
  207.  def self.アクター非表示
  208.    self.actor_hide
  209.  end
  210.  #--------------------------------------------------------------------------
  211.  # ● バトルステータス表示/非表示
  212.  #--------------------------------------------------------------------------
  213.  # LNX11.バトルステータス表示
  214.  def self.status_show
  215.    $game_party.status_invisible = false
  216.    self.battle_status_refresh
  217.  end
  218.  def self.バトルステータス表示
  219.    self.status_show
  220.  end
  221.  # LNX11.バトルステータス非表示
  222.  def self.status_hide
  223.    $game_party.status_invisible = true
  224.    self.battle_status_refresh
  225.  end
  226.  def self.バトルステータス非表示
  227.    self.status_hide
  228.  end
  229.  #--------------------------------------------------------------------------
  230.  # ● アクター背景表示/非表示
  231.  #--------------------------------------------------------------------------
  232.  # LNX11.アクター背景表示
  233.  def self.actor_bg_show
  234.    $game_party.actor_bg_invisible = false
  235.  end
  236.  def self.アクター背景表示
  237.    self.actor_bg_show
  238.  end
  239.  # LNX11.アクター背景非表示
  240.  def self.actor_bg_hide
  241.    $game_party.actor_bg_invisible = true
  242.  end
  243.  def self.アクター背景非表示
  244.    self.actor_bg_hide
  245.  end  
  246.  #--------------------------------------------------------------------------
  247.  # ● バトラーグラフィックのスクリプト指定
  248.  #--------------------------------------------------------------------------
  249.  # LNX11.バトラーグラフィック(id, filename)
  250.  def self.battler_graphic(id ,filename)
  251.    if id.is_a?(Numeric) && filename.is_a?(String)
  252.      p "LNX11a:バトラーグラフィックを変更しました:ID#{id} #{filename}"
  253.       $game_actors[id].battler_graphic_name = filename
  254.     else
  255.       errormes =  "LNX11a:バトラーグラフィック指定の引数が正しくありません。"
  256.       p errormes, "LNX11a:バトラーグラフィックの指定は行われませんでした。"
  257.       msgbox errormes
  258.     end
  259.   end
  260.   def self.バトラーグラフィック(id ,filename)
  261.     self.battler_graphic(id ,filename)
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 任意のポップアップを生成
  265.   #--------------------------------------------------------------------------
  266.   # LNX11.ポップアップ(battler, popup, type, color, deco)
  267.   def self.make_popup(battler, popup, type = 0, color = :hp_damage, deco = nil)
  268.     return unless $game_party.in_battle
  269.     target = self.battler_search(battler)
  270.     unless target.is_a?(Game_Battler)
  271.       p "LNX11a:任意のポップアップの生成に失敗しました。バトラー指定が"
  272.       p "LNX11a:間違っているか、バトラーが存在していない可能性があります。"
  273.       return
  274.     end
  275.     $game_temp.popup_data.popup_custom(target, popup, type, color, deco)  
  276.   end
  277.   def self.ポップアップ(battler, popup, type=0, color=:hp_damage, deco=nil)
  278.     self.make_popup(battler, popup, type, color, deco)
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● バトラー指定
  282.   #--------------------------------------------------------------------------
  283.   def self.battler_search(val)
  284.     if val.is_a?(String)
  285.       # 名前指定
  286.       a = ($game_party.members + $game_troop.members).find {|b| b.name == val }
  287.       return a
  288.     elsif val.is_a?(Array)
  289.       # インデックス指定
  290.       case val[0]
  291.       when :actor ; return $game_party.members[val[1]]
  292.       when :enemy ; return $game_troop.members[val[1]]
  293.       else        ; return nil
  294.       end
  295.     else
  296.       # オブジェクト
  297.       return val
  298.     end
  299.  
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● バトルログプッシュ
  303.   #--------------------------------------------------------------------------
  304.   # LNX11.バトルログ(text)
  305.   def self.battle_log_push(text)
  306.     return unless $game_party.in_battle
  307.     case BATTLELOG_TYPE
  308.     when 0..1 # バトルログ
  309.       BattleManager.log_window.add_text(text)
  310.     when 2 # 簡易ヘルプ表示
  311.       BattleManager.helpdisplay_set(text, 0)
  312.     end
  313.   end
  314.   def self.バトルログ(text)
  315.     self.battle_log_push(text)
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● バトルログ消去
  319.   #--------------------------------------------------------------------------
  320.   # LNX11.バトルログ消去
  321.   def self.battle_log_clear
  322.     return unless $game_party.in_battle
  323.     case BATTLELOG_TYPE
  324.     when 0 # バトルログ
  325.       BattleManager.log_window.clear
  326.     when 1 # 蓄積型
  327.       BattleManager.log_window.clear
  328.       $game_temp.battlelog_clear = true
  329.       self.battle_wait(1)
  330.     when 2 # 簡易ヘルプ
  331.       BattleManager.helpdisplay_clear(0)
  332.     end
  333.   end
  334.   def self.バトルログ消去
  335.     self.battle_log_clear
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● バトルウェイト
  339.   #--------------------------------------------------------------------------
  340.   # LNX11.バトルウェイト(duration)
  341.   def self.battle_wait(duration)
  342.     return unless $game_party.in_battle
  343.     BattleManager.log_window.abs_wait(duration)
  344.   end
  345.   def self.バトルウェイト(duration)
  346.     self.battle_wait(duration)
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 設定値
  350.   #  ※ 設定を変更する場合、LNX11aconf を使用してください。
  351.   #--------------------------------------------------------------------------
  352.   # <<ver1.00>>
  353.   if !$lnx_include[:lnx11aconf] ||
  354.      $lnx_include[:lnx11aconf] && $lnx_include[:lnx11aconf] < 100
  355.   DEFAULT_BATTLER_GRAPHIC = 0
  356.   DEFAULT_BG_COLOR        = [Color.new(0, 0, 0, 0), Color.new(0, 0, 0, 0)]
  357.   ACTOR_SCREEN_TONE       = false
  358.   TP_POPUP_TYPE           = 1
  359.   INDEXZERO_NO_POPUP      = true
  360.   ACTOR_BACKGROUND        = 2
  361.   ACTOR_BACKGROUND_HEIGHT = 112
  362.   ACTOR_BG_GRADIENT_COLOR = [Color.new(0, 0, 0, 96), Color.new(0, 0, 0, 224)]
  363.   BATTLELOG_TYPE  =  1
  364.   STORAGE_LINE_NUMBER     = 6
  365.   STORAGE_LINE_HEIGHT     = 20
  366.   STORAGE_UP_MESSAGE_TIME = 90
  367.   STORAGE_TURNEND_CLEAR   = true
  368.   STORAGE_OFFSET = {:x => 0, :y => 6}
  369.   STORAGE_FONT   = {:size => 20, :out_color => Color.new(0, 0, 0, 192)}
  370.   STORAGE_GRADIENT_COLOR = [Color.new(0, 0, 0, 128), Color.new(0, 0, 0, 0)]
  371.   POPUP_ADD_WAIT          = 6
  372.   HELPDISPLAY_TYPE        = 1
  373.   HELPDISPLAT_WAIT        = 20
  374.   HELPDISPLAT_END_WAIT    = 24
  375.   HELPDISPLAY_DESCRIPTION = {:size => 20, :delimiter => " "}
  376.   MESSAGE_TYPE  =  2
  377.   MESSAGE_WINDOW_BACKGROUND  = 1
  378.   MESSAGE_WINDOW_POSITION    = 0
  379.   MESSAGE_WAIT = {:battle_start => [120, false], :victory   => [ 60, false],
  380.                   :defeat       => [120, false], :escape    => [120, false],
  381.                   :drop_item    => [ 60,  true], :levelup   => [ 60,  true]}
  382.   MESSAGE_WINDOW_ENEMY_NAMES = false
  383.   LEVELUP_SE  = RPG::SE.new("Up4", 90, 100)
  384.   DROPITEM_SE = RPG::SE.new("Item3", 80, 125)
  385.   ACTOR_CENTERING  =  true
  386.   ACTOR_SPACING_ADJUST = 32
  387.   ACTOR_OFFSET  = {:x => -16, :y => 0}
  388.   ACTOR_PADDING = {:side => 4, :bottom => 8}
  389.   SCREEN_ANIMATION_OFFSET = 128
  390.   STATUS_OFFSET = {:x => 64, :y => -12}
  391.   STATUS_SIDE_PADDING   = 6
  392.   STATUS_WIDTH          = 72
  393.   STATUS_AUTOADJUST     = true
  394.   STATUS_LINE_HEIGHT    = 22
  395.   STATUS_NAME_SIZE      = 20
  396.   STATUS_PARAM_SIZE     = 23
  397.   STATUS_GAUGE_OPACITY  = 192
  398.   ACTOR_COMMAND_NOSCROLL   = true
  399.   ACTOR_COMMAND_HORIZON    = false
  400.   ACTOR_COMMAND_ALIGNMENT  = 0
  401.   ACTOR_COMMAND_WIDTH      = 128
  402.   ACTOR_COMMAND_POSITION   = 0
  403.   ACTOR_COMMAND_Y_POSITION = 0
  404.   ACTOR_COMMAND_OFFSET  = {:x => 0, :y => -16}
  405.   PARTY_COMMAND_HORIZON   = true
  406.   PARTY_COMMAND_ALIGNMENT = 1
  407.   PARTY_COMMAND_WIDTH     = Graphics.width
  408.   PARTY_COMMAND_XY        = {:x => 0, :y => 0}
  409.   CURSOR_NAME       = ""
  410.   CURSOR_TONE     = Tone.new(-34, 0, 68)
  411.   CURSOR_ANI_SPEED  = 3
  412.   CURSOR_SPEED      = 3
  413.   CURSOR_BLINK      = true
  414.   CURSOR_MINMAX     = {:min => 48, :max => Graphics.height}
  415.   CURSOR_OFFSET     = {:x => 0, :y => 0}
  416.   HELP_ACTOR_PARAM = {:hp => true ,:mp => true ,:tp => true ,:state => true }
  417.   HELP_ENEMY_PARAM = {:hp => false,:mp => false,:tp => false,:state => true }
  418.   HELP_PARAM_WIDTH    = 72
  419.   RANDOMSCOPE_DISPLAY = 1
  420.   ACTOR_POPUP_POSITION   = 3
  421.   ENEMY_POPUP_POSITION   = 1
  422.   LEVELUP_POPUP_POSITION = 3
  423.   ACTOR_POPUP_Y     =  -100
  424.   LEVELUP_POPUP_Y   =  -112
  425.   NUMBER_FONT   =  ["Arial Black", "VL Gothic"]
  426.   TEXT_FONT     =  ["Arial Black", "VL Gothic"]
  427.   TEXT_FONT_MCS =  ["VL Gothic"]
  428.   LARGE_NUMBER  =  {:fontsize => 38, :spacing => -4, :line_height => 26}
  429.   SMALL_NUMBER  =  {:fontsize => 28, :spacing => -4, :line_height => 20}
  430.   TEXT_SIZERATE     = {:normal => 0.8, :left_right => 0.7, :top_bottom => 0.6}
  431.   TEXT_SIZERATE_MCS = 0.9
  432.   DECORATION_NUMBER = {
  433.   :critical    => ["CRITICAL", 8], :weakness    => ["WEAKNESS", 8],
  434.   :resist      => ["RESIST"  , 8], :mp_damage   => ["\mp"     , 4],
  435.   :mp_plus     => ["\mp+"    , 4], :mp_minus    => ["\mp-"    , 4],
  436.   :tp_plus     => ["\tp+"    , 4], :tp_minus    => ["\tp-"    , 4]}
  437.   DECORATION_TEXT = {
  438.   :add_state   => "+%s",      :rem_state   => "-%s",
  439.   :add_buff    => "%s UP",    :add_debuff  => "%s DOWN",
  440.   :rem_buff    => "-%s Buff"}
  441.   POPUP_VOCAB = {
  442.   :miss        => "MISS!",      :counter     => "Counter",
  443.   :reflection  => "Reflection", :substitute  => "Substitute",
  444.   :levelup     => "LEVELUP!"}
  445.   POPUP_VOCAB_PARAMS = [
  446.   "MAX\hp","MAX\mp","ATK","DEF","MATK","MDEF","AGI","LUCK"]
  447.   POPUP_COLOR = {
  448.   :hp_damage     => [Color.new(255, 255, 255), Color.new(  0,   0,   0)],
  449.   :critical      => [Color.new(255, 255,  80), Color.new(224,  32,   0)],
  450.   :weakness      => [Color.new(255, 255, 255), Color.new(  0,  56, 144)],
  451.   :resist        => [Color.new(232, 224, 216), Color.new( 56,  48,  40)],
  452.   :hp_recovery   => [Color.new( 96, 255, 128), Color.new(  0,  64,  32)],
  453.   :mp_damage     => [Color.new(248,  80, 172), Color.new( 48,   0,  32)],
  454.   :mp_recovery   => [Color.new(160, 240, 255), Color.new( 32,  48, 144)],
  455.   :tp_damage     => [Color.new(248, 240,  64), Color.new(  0,  80,  40)],
  456.   :add_state     => [Color.new(255, 255, 255), Color.new(  0,  56, 144)],
  457.   :rem_state     => [Color.new(224, 232, 240), Color.new( 32,  64, 128, 128)],
  458.   :add_badstate  => [Color.new(255, 255, 255), Color.new(  0,   0,   0)],
  459.   :rem_badstate  => [Color.new(224, 224, 224), Color.new( 32,  32,  32, 128)],
  460.   :add_buff      => [Color.new(255, 255, 192), Color.new( 96,  64,   0)],
  461.   :add_debuff    => [Color.new(200, 224, 232), Color.new( 40,  48,  56)],
  462.   :rem_buff      => [Color.new(224, 224, 224), Color.new( 32,  32,  32, 128)],
  463.   :counter       => [Color.new(255, 255, 224), Color.new(128,  96,   0)],
  464.   :reflection    => [Color.new(224, 255, 255), Color.new(  0,  96, 128)],
  465.   :substitute    => [Color.new(224, 255, 224), Color.new(  0, 128,  64)],
  466.   :levelup       => [Color.new(255, 255, 255), Color.new(  0,   0,   0)],
  467.   }
  468.   POPUP_TYPE = {
  469.   :miss          =>   0,:hp_damage     =>   0,:hp_slipdamage =>   1,
  470.   :hp_recovery   =>   0,:hp_regenerate =>   1,:hp_drain      =>   0,
  471.   :hp_drainrecv  =>   0,:mp_damage     =>   0,:mp_slipdamage =>   1,
  472.   :mp_recovery   =>   0,:mp_regenerate =>   1,:mp_drain      =>   0,
  473.   :mp_drainrecv  =>   0,:mp_paycost    =>  -1,:tp_damage     =>   1,
  474.   :tp_charge     =>  -1,:tp_gain       =>   7,:tp_regenerate =>   1,
  475.   :tp_paycost    =>  -1,:add_state     =>   2,:rem_state     =>   2,
  476.   :add_badstate  =>   2,:rem_badstate  =>   2,:add_debuff    =>   3,
  477.   :rem_buff      =>   3,:counter       =>   6,:reflection    =>   6,
  478.   :substitute    =>   4,}
  479.   LARGE_MOVEMENT = {
  480.   :inirate    => 6.4,  :gravity      => 0.68,  :side_scatter => 1.2,
  481.   :ref_height =>  32,  :ref_factor   => 0.60,  :ref_count    =>   2,
  482.                        :duration     =>   40,  :fadeout      =>  20 }
  483.   SMALL_MOVEMENT = {
  484.   :inirate    => 4.4,  :gravity      => 0.60,  :side_scatter => 0.0,
  485.   :ref_height =>  12,  :ref_factor   => 0.70,  :ref_count    =>   0,
  486.                        :duration     =>   60,  :fadeout      =>  16 }
  487.   RISE_MOVEMENT     = {:rising_speed => 0.75,  :line_spacing => 0.9,
  488.                        :duration     =>   40,  :fadeout      =>   8 }
  489.   SLIDE_MOVEMENT    = {:x_speed      =>    2,  :line_spacing => 0.9,
  490.                        :duration     =>   50,  :fadeout      =>  32 }
  491.   OVERLAY_MOVEMENT  = {:duration     =>   36,  :fadeout      =>  32 }
  492.   FIX_TARGET_CHECKE     = true
  493.   GUARD_TARGET_CHECKE   = true
  494.   SMART_TARGET_SELECT   = true
  495.   LAST_TARGET           = true
  496.   LAST_PARTY_COMMAND    = true
  497.   LAST_ACTOR_COMMAND    = true
  498.   TROOP_X_SORT          = true
  499.   PARTY_COMMAND_SKIP    = true
  500.   FITTING_LIST          = true
  501.   ENHANCED_WHITEN       = true
  502.   DISABLED_DAMAGE_SHAKE = true
  503.   TROOP_X_SCREEN_FIX    = true
  504.   TROOP_Y_OFFSET        = 0
  505.   end
  506.   # <<ver1.10>>
  507.   if !$lnx_include[:lnx11aconf] ||
  508.     $lnx_include[:lnx11aconf] && $lnx_include[:lnx11aconf] < 110
  509.   LARGE_NUMBER_NAME = ""
  510.   SMALL_NUMBER_NAME = ""
  511.   LARGE_BUFFS_NAME  = ""
  512.   SMALL_BUFFS_NAME  = ""
  513.   end
  514. end
  515.  
  516. #==============================================================================
  517. # ■ [追加]:Popup_Data
  518. #------------------------------------------------------------------------------
  519. #  戦闘中のポップアップをまとめて扱うクラス。ポップアップスプライトの
  520. # initialize 時に自身を参照させて、ポップアップ内容を定義する際にも使います。
  521. #==============================================================================
  522.  
  523. class Popup_Data
  524.   #--------------------------------------------------------------------------
  525.   # ● クラス変数
  526.   #--------------------------------------------------------------------------
  527.   @@make_methods = {} # ポップアップ作成メソッドのハッシュ
  528.   #--------------------------------------------------------------------------
  529.   # ● 定数(ポップアップのタイプID)
  530.   #--------------------------------------------------------------------------
  531.   SPRING_LARGE  = 0
  532.   SPRING_SMALL  = 1
  533.   RISING_LARGE  = 2
  534.   RISING_SMALL  = 3
  535.   SLIDING_LARGE = 4
  536.   SLIDING_SMALL = 5
  537.   OVERLAY_LARGE = 6
  538.   OVERLAY_SMALL = 7
  539.   LEVELUP       = :levelup
  540.   #--------------------------------------------------------------------------
  541.   # ● 公開インスタンス変数
  542.   #--------------------------------------------------------------------------
  543.   attr_accessor :type       # ポップアップのタイプ
  544.   attr_accessor :popup      # 表示する内容
  545.   attr_accessor :popup_size # ポップアップの大きさ
  546.   attr_accessor :color      # 色
  547.   attr_accessor :deco       # 修飾文字
  548.   attr_accessor :battler    # ポップアップするバトラー
  549.   attr_accessor :delay      # 表示開始までの時間
  550.   attr_accessor :viewport   # ビューポート
  551.   attr_accessor :popup_wait # ポップアップウェイト
  552.   attr_accessor :buff_data  # 能力強化/弱体 <<ver1.10>>
  553.   #--------------------------------------------------------------------------
  554.   # ● オブジェクト初期化
  555.   #--------------------------------------------------------------------------
  556.   def initialize
  557.     @sprites = []
  558.     @viewport = Viewport.new
  559.     @viewport.z = 120 # ポップアップの Z 座標
  560.     spb = Sprite_PopupBase.new
  561.     spb.create_number
  562.     spb.dispose
  563.     set_methods
  564.     refresh
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # ● ポップアップ生成メソッドの登録
  568.   #--------------------------------------------------------------------------
  569.   def set_methods
  570.     @@make_methods[SPRING_LARGE]  = method(:makeup_spring_large)
  571.     @@make_methods[SPRING_SMALL]  = method(:makeup_spring_small)
  572.     @@make_methods[RISING_LARGE]  = method(:makeup_rising_large)
  573.     @@make_methods[RISING_SMALL]  = method(:makeup_rising_small)
  574.     @@make_methods[SLIDING_LARGE] = method(:makeup_sliding_large)
  575.     @@make_methods[SLIDING_SMALL] = method(:makeup_sliding_small)
  576.     @@make_methods[OVERLAY_LARGE] = method(:makeup_overlay_large)
  577.     @@make_methods[OVERLAY_SMALL] = method(:makeup_overlay_small)
  578.     @@make_methods[LEVELUP]       = method(:makeup_levelup)
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # ● スプライト解放
  582.   #--------------------------------------------------------------------------
  583.   def dispose
  584.     @sprites.each {|sprite| sprite.dispose}
  585.     @viewport.dispose
  586.   end
  587.   #--------------------------------------------------------------------------
  588.   # ● フレーム更新
  589.   #--------------------------------------------------------------------------
  590.   def update
  591.     @sprites.each do |sprite|
  592.       sprite.update
  593.       @sprites.delete(sprite) if sprite.disposed?
  594.     end
  595.   end
  596.   #--------------------------------------------------------------------------
  597.   # ● リフレッシュ
  598.   #--------------------------------------------------------------------------
  599.   def refresh
  600.     @type  = 0
  601.     @popup = nil
  602.     @popup_size = :large
  603.     @color = :hp_damage
  604.     @deco = ["", -1] # [テキスト, テキストの位置]
  605.     @battler = nil
  606.     @delay = 0
  607.     @popup_wait = false
  608.     # <<ver1.10>> 能力強化/弱体ポップアップを画像で表示する際に利用
  609.     @buff_data = [-1, -1] # [能力, 強化or弱体or解除]
  610.   end
  611.   #--------------------------------------------------------------------------
  612.   # ● ポップアップを生成
  613.   #--------------------------------------------------------------------------
  614.   def makeup
  615.     if @@make_methods[@type]
  616.       @@make_methods[@type].call
  617.       @popup_wait = true
  618.     end
  619.   end
  620.   #--------------------------------------------------------------------------
  621.   # ● ポップアップウェイト
  622.   #  バトルログタイプが [2:ヘルプ表示] の場合のみ実行されます。
  623.   #--------------------------------------------------------------------------
  624.   def add_wait
  625.     return if LNX11::BATTLELOG_TYPE != 2 || !@popup_wait
  626.     LNX11::POPUP_ADD_WAIT.times {BattleManager.log_window.abs_wait(1)}
  627.     @popup_wait = false
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● ポップアップ生成メソッド
  631.   #  これらのメソッドを @@make_methods に登録して呼び出します。
  632.   # これはポップアップタイプの拡張を容易にするための仕様です。
  633.   #--------------------------------------------------------------------------
  634.   def makeup_spring_large
  635.     # @type   0 : 跳ねるポップアップ(大)
  636.     @popup_size = :large
  637.     @sprites.push(Sprite_PopupSpring.new(self))
  638.   end
  639.   def makeup_spring_small
  640.     # @type   1 : 跳ねるポップアップ(小)
  641.     @popup_size = :small
  642.     @delay = @battler.popup_delay[1]
  643.     @sprites.push(Sprite_PopupSpring.new(self))
  644.   end
  645.   def makeup_rising_large
  646.     # @type   2 : ゆっくり上昇(大)
  647.     @popup_size = :large
  648.     @delay = @battler.popup_delay[2]
  649.     @sprites.push(Sprite_PopupRising.new(self))
  650.   end
  651.   def makeup_rising_small
  652.     # @type   3 : ゆっくり上昇(小)
  653.     @popup_size = :small      
  654.     @delay = @battler.popup_delay[2]
  655.     @sprites.push(Sprite_PopupRising.new(self))
  656.   end
  657.   def makeup_sliding_large
  658.     # @type   4 : スライド(大)
  659.     @popup_size = :large
  660.     @delay = @battler.popup_delay[3]
  661.     @sprites.push(Sprite_PopupSliding.new(self))
  662.   end
  663.   def makeup_sliding_small
  664.     # @type   5 : スライド(小)
  665.     @popup_size = :small
  666.     @delay = @battler.popup_delay[3]
  667.     @sprites.push(Sprite_PopupSliding.new(self))      
  668.   end
  669.   def makeup_overlay_large
  670.     # @type   6 : オーバーレイ(大)
  671.     @popup_size = :large
  672.     @sprites.push(Sprite_PopupOverlay.new(self))
  673.   end
  674.   def makeup_overlay_small
  675.     # @type   7 : オーバーレイ(小)
  676.     @popup_size = :small
  677.     @sprites.push(Sprite_PopupOverlay.new(self))
  678.   end
  679.   def makeup_levelup
  680.     # @type :levelup : レベルアップ
  681.     @battler.popup_delay[3] = 0
  682.     @popup_size = :large
  683.     @sprites.push(Sprite_PopupLevelUp.new(self))
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # ● TP のポップアップが有効か?
  687.   #--------------------------------------------------------------------------
  688.   def tp_popup_enabled?(target)
  689.     return false if !$data_system.opt_display_tp
  690.     return true  if LNX11::TP_POPUP_TYPE == 0 # すべてポップアップ
  691.     return true  if LNX11::TP_POPUP_TYPE == 1 && target.actor? # アクターのみ
  692.     false # ポップアップしない
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 任意のポップアップ
  696.   #--------------------------------------------------------------------------
  697.   def popup_custom(target, popup, type = 0, color = :hp_damage, deco = nil)
  698.     refresh
  699.     @battler = target
  700.     @popup = popup
  701.     type = LNX11::POPUP_TYPE[type] if type.is_a?(Symbol)
  702.     @type = type
  703.     @color = color
  704.     @deco = LNX11::DECORATION_NUMBER[deco] if deco.is_a?(Symbol)
  705.     # ポップアップ作成
  706.     makeup
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # ● レベルアップのポップアップ
  710.   #--------------------------------------------------------------------------
  711.   def popup_levelup(target)
  712.     # 戦闘に参加している場合のみポップアップ
  713.     return unless $game_party.battle_members.include?(target)
  714.     refresh
  715.     @type = :levelup
  716.     @battler = target
  717.     @popup = LNX11::POPUP_VOCAB[:levelup]
  718.     @color = :levelup
  719.     # ポップアップ作成
  720.     makeup
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # ● 単一テキストのポップアップ
  724.   #--------------------------------------------------------------------------
  725.   def popup_text(target, type)
  726.     refresh
  727.     @type = LNX11::POPUP_TYPE[type]
  728.     @battler = target
  729.     @popup = LNX11::POPUP_VOCAB[type]
  730.     @color = type
  731.     # ポップアップ作成
  732.     makeup
  733.   end
  734.   #--------------------------------------------------------------------------
  735.   # ● ミスのポップアップ
  736.   #--------------------------------------------------------------------------
  737.   def popup_miss(target, item)
  738.     refresh
  739.     @type = LNX11::POPUP_TYPE[:miss]
  740.     @battler = target
  741.     @popup = LNX11::POPUP_VOCAB[:miss]
  742.     @color = :hp_damage
  743.     # ポップアップ作成
  744.     makeup
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ● HP ダメージポップアップ
  748.   #--------------------------------------------------------------------------
  749.   def popup_hp_damage(target, item)
  750.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  751.     refresh
  752.     @popup = target.result.hp_damage
  753.     @battler = target
  754.     if target.result.hp_drain > 0
  755.       # 被吸収
  756.       @type = LNX11::POPUP_TYPE[:hp_drain]
  757.       # 弱点/耐性
  758.       if target.result.element_rate > 1
  759.         @deco = LNX11::DECORATION_NUMBER[:weakness]
  760.         @color = :weakness
  761.       elsif target.result.element_rate < 1
  762.         @deco = LNX11::DECORATION_NUMBER[:resist]
  763.         @color = :resist
  764.       else
  765.         @color = :hp_damage
  766.       end
  767.     elsif target.result.hp_damage > 0
  768.       # ダメージ
  769.       @type = LNX11::POPUP_TYPE[:hp_damage]
  770.       @color = :hp_damage
  771.       if target.result.critical
  772.         # クリティカル
  773.         @deco = LNX11::DECORATION_NUMBER[:critical]
  774.         @color = :critical
  775.       end
  776.       # 弱点/耐性
  777.       if target.result.element_rate > 1
  778.         @deco = LNX11::DECORATION_NUMBER[:weakness]
  779.         @color = :weakness if @color != :critical
  780.       elsif target.result.element_rate < 1
  781.         @deco = LNX11::DECORATION_NUMBER[:resist]
  782.         @color = :resist if @color != :critical
  783.       end
  784.     elsif target.result.hp_damage < 0
  785.       # 回復
  786.       @type = LNX11::POPUP_TYPE[:hp_recovery]
  787.       @color = :hp_recovery
  788.     else
  789.       # 0 ダメージ
  790.       @type = LNX11::POPUP_TYPE[:hp_damage]
  791.       @color = :hp_damage
  792.     end
  793.     # ポップアップ作成
  794.     makeup
  795.   end
  796.   #--------------------------------------------------------------------------
  797.   # ● MP ダメージポップアップ
  798.   #--------------------------------------------------------------------------
  799.   def popup_mp_damage(target, item)
  800.     return if target.dead? || target.result.mp_damage == 0
  801.     refresh
  802.     @popup = target.result.mp_damage
  803.     @battler = target
  804.     @deco = LNX11::DECORATION_NUMBER[:mp_damage]
  805.     if target.result.mp_drain > 0
  806.       # 被吸収
  807.       @type = LNX11::POPUP_TYPE[:mp_drain]
  808.       @color = :mp_damage
  809.     elsif target.result.mp_damage > 0
  810.       # ダメージ
  811.       @type = LNX11::POPUP_TYPE[:mp_damage]
  812.       @color = :mp_damage
  813.     elsif target.result.mp_damage < 0
  814.       # 回復
  815.       @type = LNX11::POPUP_TYPE[:mp_recovery]
  816.       @color = :mp_recovery
  817.     end
  818.     # ポップアップ作成
  819.     makeup
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ● TP ダメージポップアップ
  823.   #--------------------------------------------------------------------------
  824.   def popup_tp_damage(target, item)
  825.     return unless tp_popup_enabled?(target)
  826.     return if target.dead? || target.result.tp_damage == 0
  827.     refresh
  828.     @popup = target.result.tp_damage
  829.     @battler = target
  830.     deco = target.result.tp_damage > 0 ? :tp_minus : :tp_plus
  831.     @deco = LNX11::DECORATION_NUMBER[deco]
  832.     @type = LNX11::POPUP_TYPE[:tp_damage]
  833.     @color = :tp_damage
  834.     # ポップアップ作成
  835.     makeup
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ● HP 吸収回復
  839.   #--------------------------------------------------------------------------
  840.   def popup_hp_drain(target, hp_drain)
  841.     return if hp_drain == 0
  842.     refresh
  843.     @popup = hp_drain
  844.     @battler = target
  845.     @type = LNX11::POPUP_TYPE[:hp_drainrecv]
  846.     @color = :hp_recovery
  847.     # ポップアップ作成
  848.     makeup
  849.   end
  850.   #--------------------------------------------------------------------------
  851.   # ● MP 吸収回復
  852.   #--------------------------------------------------------------------------
  853.   def popup_mp_drain(target, mp_drain)
  854.     return if mp_drain == 0
  855.     refresh
  856.     @popup = mp_drain
  857.     @battler = target
  858.     @deco = LNX11::DECORATION_NUMBER[:mp_damage]
  859.     @type = LNX11::POPUP_TYPE[:mp_drainrecv]
  860.     @color = :mp_recovery
  861.     # ポップアップ作成
  862.     makeup
  863.   end
  864.   #--------------------------------------------------------------------------
  865.   # ● ステート付加のポップアップ
  866.   #--------------------------------------------------------------------------
  867.   def popup_added_states(target)
  868.     refresh
  869.     @battler = target
  870.     target.result.added_state_objects.each do |state|
  871.       next if state.id == target.death_state_id
  872.       next if state.icon_index == 0 && LNX11::INDEXZERO_NO_POPUP
  873.       next if state.add_no_display?      
  874.       if state.add_no_decoration?
  875.         @popup = state.add_display_name
  876.       else
  877.         @popup = sprintf(LNX11::DECORATION_TEXT[:add_state],
  878.                          state.add_display_name)
  879.       end
  880.       type = state.advantage? ? :add_state : :add_badstate
  881.       if state.add_popup_type
  882.         @type = state.add_popup_type
  883.       else
  884.         @type = LNX11::POPUP_TYPE[type]
  885.       end
  886.       @color = type
  887.       # ポップアップ作成
  888.       makeup
  889.     end
  890.   end
  891.   #--------------------------------------------------------------------------
  892.   # ● ステート解除のポップアップ
  893.   #--------------------------------------------------------------------------
  894.   def popup_removed_states(target)
  895.     refresh
  896.     @type = LNX11::POPUP_TYPE[:rem_badstate]
  897.     @battler = target
  898.     target.result.removed_state_objects.each do |state|
  899.       next if state.id == target.death_state_id
  900.       next if state.icon_index == 0 && LNX11::INDEXZERO_NO_POPUP
  901.       next if state.remove_no_display?
  902.       if state.remove_no_decoration?
  903.         @popup = state.remove_display_name
  904.       else
  905.         @popup = sprintf(LNX11::DECORATION_TEXT[:rem_state],
  906.                          state.remove_display_name)
  907.       end
  908.       type = state.advantage? ? :rem_state : :rem_badstate
  909.       if state.remove_popup_type
  910.         @type = state.remove_popup_type
  911.       else
  912.         @type = LNX11::POPUP_TYPE[type]
  913.       end
  914.       @color = type
  915.       # ポップアップ作成
  916.       makeup
  917.     end
  918.   end
  919.   #--------------------------------------------------------------------------
  920.   # ● 能力強化/弱体のポップアップ
  921.   #--------------------------------------------------------------------------
  922.   def popup_buffs(target, buffs, fmt)
  923.     return if buffs.empty?
  924.     refresh
  925.     @battler = target
  926.     case fmt
  927.     when Vocab::BuffAdd
  928.       buffdeco = LNX11::DECORATION_TEXT[:add_buff]
  929.       @type = LNX11::POPUP_TYPE[:add_buff]
  930.       @color = :add_buff
  931.       @buff_data[1] = 0
  932.     when Vocab::DebuffAdd
  933.       buffdeco = LNX11::DECORATION_TEXT[:add_debuff]
  934.       @type = LNX11::POPUP_TYPE[:add_debuff]
  935.       @color = :add_debuff
  936.       @buff_data[1] = 1
  937.     when Vocab::BuffRemove
  938.       buffdeco = LNX11::DECORATION_TEXT[:rem_buff]
  939.       @type = LNX11::POPUP_TYPE[:rem_buff]
  940.       @color = :rem_buff
  941.       @buff_data[1] = 2
  942.     end
  943.     buffs.each do |param_id|
  944.       @popup = sprintf(buffdeco, LNX11::POPUP_VOCAB_PARAMS[param_id])
  945.       @buff_data[0] = param_id
  946.       # ポップアップ作成
  947.       makeup
  948.       @popup_wait = false
  949.     end
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # ● HP 再生
  953.   #--------------------------------------------------------------------------
  954.   def popup_regenerate_hp(target, hp_damage, paycost = false)
  955.     return if hp_damage == 0
  956.     refresh
  957.     @popup = hp_damage
  958.     @battler = target
  959.     if hp_damage > 0
  960.       # ダメージ
  961.       @type = LNX11::POPUP_TYPE[:hp_slipdamage]
  962.       @color = :hp_damage
  963.     elsif hp_damage < 0
  964.       # 回復
  965.       @type = LNX11::POPUP_TYPE[:hp_regenerate]
  966.       @color = :hp_recovery
  967.     end
  968.     # ポップアップ作成
  969.     makeup
  970.   end
  971.   #--------------------------------------------------------------------------
  972.   # ● MP 再生
  973.   #--------------------------------------------------------------------------
  974.   def popup_regenerate_mp(target, mp_damage, paycost = false)
  975.     return if mp_damage == 0
  976.     refresh
  977.     @popup = mp_damage
  978.     @battler = target
  979.     @deco = LNX11::DECORATION_NUMBER[mp_damage > 0 ? :mp_minus : :mp_plus]
  980.     if mp_damage > 0
  981.       # ダメージ
  982.       @type = LNX11::POPUP_TYPE[paycost ? :mp_paycost : :mp_slipdamage]
  983.       @color = :mp_damage
  984.     elsif mp_damage < 0
  985.       # 回復
  986.       @type = LNX11::POPUP_TYPE[paycost ? :mp_paycost : :mp_regenerate]
  987.       @color = :mp_recovery
  988.     end
  989.     # ポップアップ作成
  990.     makeup
  991.   end
  992.   #--------------------------------------------------------------------------
  993.   # ● TP 再生
  994.   #--------------------------------------------------------------------------
  995.   def popup_regenerate_tp(target, tp_damage, paycost = false)
  996.     return unless tp_popup_enabled?(target)
  997.     return if tp_damage == 0
  998.     refresh
  999.     @popup = tp_damage
  1000.     @battler = target
  1001.     @deco = LNX11::DECORATION_NUMBER[tp_damage > 0 ? :tp_minus : :tp_plus]
  1002.     @type = LNX11::POPUP_TYPE[paycost ? :tp_paycost : :tp_regenerate]
  1003.     @color = :tp_damage
  1004.     # ポップアップ作成
  1005.     makeup
  1006.   end
  1007.   #--------------------------------------------------------------------------
  1008.   # ● TP チャージ
  1009.   #--------------------------------------------------------------------------
  1010.   def popup_tp_charge(target, tp_damage)
  1011.     return unless tp_popup_enabled?(target)
  1012.     return if tp_damage == 0
  1013.     refresh
  1014.     @popup = tp_damage
  1015.     @battler = target
  1016.     @deco = LNX11::DECORATION_NUMBER[tp_damage > 0 ? :tp_minus : :tp_plus]
  1017.     @type = LNX11::POPUP_TYPE[:tp_charge]
  1018.     @color = :tp_damage
  1019.     # ポップアップ作成
  1020.     makeup
  1021.   end
  1022.   #--------------------------------------------------------------------------
  1023.   # ● TP 得
  1024.   #--------------------------------------------------------------------------
  1025.   def popup_tp_gain(target, tp_damage)
  1026.     return unless tp_popup_enabled?(target)
  1027.     return if tp_damage == 0
  1028.     refresh
  1029.     @popup = tp_damage
  1030.     @battler = target
  1031.     @deco = LNX11::DECORATION_NUMBER[tp_damage > 0 ? :tp_minus : :tp_plus]
  1032.     @type = LNX11::POPUP_TYPE[:tp_gain]
  1033.     @color = :tp_damage
  1034.     # ポップアップ作成
  1035.     makeup
  1036.   end
  1037. end
  1038.  
  1039. #==============================================================================
  1040. # ■ [追加]:Sprite_PopupBase
  1041. #------------------------------------------------------------------------------
  1042. #  戦闘中のダメージ表示等をポップアップ表示するためのスプライトの
  1043. # スーパークラス。サブクラスで細かい動きを定義します。
  1044. #==============================================================================
  1045.  
  1046. class Sprite_PopupBase < Sprite
  1047.   #--------------------------------------------------------------------------
  1048.   # ● クラス変数
  1049.   #--------------------------------------------------------------------------
  1050.   @@cache_number = []
  1051.   @@cache_text   = {}
  1052.   @@w = []
  1053.   @@h = []
  1054.   @@priority = 0
  1055.   @@count    = 0
  1056.   @@buf_bitmap = nil
  1057.   #--------------------------------------------------------------------------
  1058.   # ● 定数
  1059.   #--------------------------------------------------------------------------
  1060.   NUMBER_COLOR_SIZE = 8
  1061.   NUMBERS    = [0,1,2,3,4,5,6,7,8,9]
  1062.   COLOR_KEYS = LNX11::POPUP_COLOR.keys
  1063.   #--------------------------------------------------------------------------
  1064.   # ● オブジェクト初期化
  1065.   #     data : ポップアップデータ
  1066.   #--------------------------------------------------------------------------
  1067.   def initialize(data = nil)
  1068.     return if data == nil
  1069.     # ポップアップデータを適用
  1070.     super(data.viewport)
  1071.     @battler = data.battler # ポップアップを表示するバトラー
  1072.     @delay   = data.delay   # ディレイ(遅延) ※サブクラスによって扱いが違います
  1073.     @popup_size = data.popup_size # ポップアップの大きさ 大/小
  1074.     # 基本設定
  1075.     @duration = 60  # 消え始める時間
  1076.     @fadeout  = 16  # 消える速さ
  1077.     @rx = ry  = 0   # XY座標
  1078.     # Z座標
  1079.     @rz = base_z * 128 + priority
  1080.     popup_add
  1081.     self.visible = false
  1082.     # ポップアップデータからビットマップを作成
  1083.     if data.popup.is_a?(Numeric)
  1084.       # ダメージ値
  1085.       self.bitmap = number(data.popup, data.color, data.popup_size, data.deco)
  1086.     elsif data.popup.is_a?(String)
  1087.       # テキスト
  1088.       self.bitmap = text(data.popup, data.color,
  1089.                          data.popup_size, data.buff_data)
  1090.     end
  1091.     # 位置設定
  1092.     self.ox = self.width  / 2
  1093.     self.oy = self.height / 2
  1094.     set_position
  1095.     start
  1096.   end
  1097.   #--------------------------------------------------------------------------
  1098.   # ● 解放
  1099.   #--------------------------------------------------------------------------
  1100.   def dispose
  1101.     popup_remove
  1102.     terminate
  1103.     self.bitmap.dispose if self.bitmap
  1104.     super
  1105.   end
  1106.   #--------------------------------------------------------------------------
  1107.   # ● フレーム更新
  1108.   #--------------------------------------------------------------------------
  1109.   def update
  1110.     return if delay?
  1111.     update_popup
  1112.     update_xy
  1113.     @duration -= 1
  1114.     self.opacity -= @fadeout if @duration <= 0
  1115.     dispose if self.opacity == 0
  1116.   end
  1117.   #--------------------------------------------------------------------------
  1118.   # ● 開始処理(サブクラスで定義)
  1119.   #--------------------------------------------------------------------------
  1120.   def start
  1121.   end
  1122.   #--------------------------------------------------------------------------
  1123.   # ● 終了処理(サブクラスで定義)
  1124.   #--------------------------------------------------------------------------
  1125.   def terminate
  1126.   end
  1127.   #--------------------------------------------------------------------------
  1128.   # ● フレーム更新(サブクラスで定義)
  1129.   #--------------------------------------------------------------------------
  1130.   def update_popup
  1131.   end
  1132.   #--------------------------------------------------------------------------
  1133.   # ● ポップアップ Z 座標
  1134.   #--------------------------------------------------------------------------
  1135.   def base_z
  1136.     0
  1137.   end
  1138.   #--------------------------------------------------------------------------
  1139.   # ● ポップアップのプライオリティを返す
  1140.   #  同一Z座標のポップアップで、後から生成されたものが手前に表示されるように
  1141.   # Z座標の修正値をクラス変数で管理しています。
  1142.   #--------------------------------------------------------------------------
  1143.   def priority
  1144.     @@priority * 2
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # ● ポップアップ追加
  1148.   #--------------------------------------------------------------------------
  1149.   def popup_add
  1150.     @@priority += 1
  1151.     @@count += 1
  1152.   end
  1153.   #--------------------------------------------------------------------------
  1154.   # ● ポップアップ消去
  1155.   #--------------------------------------------------------------------------
  1156.   def popup_remove
  1157.     @@count -= 1
  1158.     @@priority = 0 if @@count <= 0
  1159.   end
  1160.  
  1161.   #--------------------------------------------------------------------------
  1162.   # ● ディレイが残っている?
  1163.   #  サブクラスの update メソッドで使用します。
  1164.   #--------------------------------------------------------------------------
  1165.   def delay?
  1166.     @delay -= 1
  1167.     self.visible = (@delay <= 0)
  1168.     !self.visible
  1169.   end
  1170.   #--------------------------------------------------------------------------
  1171.   # ● 座標更新
  1172.   #--------------------------------------------------------------------------
  1173.   def update_xy
  1174.     self.x = @rx
  1175.     self.y = @ry
  1176.     self.z = @rz
  1177.   end
  1178.   #--------------------------------------------------------------------------
  1179.   # ● ポップアップ位置の設定
  1180.   #--------------------------------------------------------------------------
  1181.   def set_position
  1182.     @rx = @battler.screen_x
  1183.     if @battler.actor?
  1184.       pos = LNX11::ACTOR_POPUP_POSITION
  1185.     else
  1186.       pos = [LNX11::ENEMY_POPUP_POSITION, 2].min
  1187.     end
  1188.     case pos
  1189.     when 0 ; @ry = @battler.screen_y        # 足元
  1190.     when 1 ; @ry = @battler.screen_y_center # 中心
  1191.     when 2 ; @ry = @battler.screen_y_top    # 頭上
  1192.     when 3 ; @ry = Graphics.height + LNX11::ACTOR_POPUP_Y # Y座標統一(アクター)
  1193.     end
  1194.   end
  1195.   #--------------------------------------------------------------------------
  1196.   # ● 描画するテキストの矩形を取得
  1197.   #--------------------------------------------------------------------------
  1198.   def text_size(str, name, size, bold = false)
  1199.     @@buf_bitmap = Bitmap.new(4, 4) if !@@buf_bitmap || @@buf_bitmap.disposed?
  1200.     @@buf_bitmap.font.name = name
  1201.     @@buf_bitmap.font.size = size
  1202.     @@buf_bitmap.font.bold = bold
  1203.     return @@buf_bitmap.text_size(str)
  1204.   end
  1205.   #--------------------------------------------------------------------------
  1206.   # ● 数字ビットマップの取得
  1207.   #--------------------------------------------------------------------------
  1208.   def bitmap_number(size = :large)
  1209.     return @@cache_number[size == :large ? 0 : 1]
  1210.   end
  1211.   #--------------------------------------------------------------------------
  1212.   # ● 数字ビットマップキャッシュの作成
  1213.   #--------------------------------------------------------------------------
  1214.   def create_number
  1215.     return if @@cache_number[0] && !@@cache_number[0].disposed?
  1216.     n_index = NUMBER_COLOR_SIZE
  1217.     @@cache_number.clear
  1218.     colors = LNX11::POPUP_COLOR.values # 色
  1219.     name = LNX11::NUMBER_FONT
  1220.     # 大・小の 2 パターンを作成する(ループ)
  1221.     [LNX11::LARGE_NUMBER, LNX11::SMALL_NUMBER].each_with_index do |n_size, i|
  1222.       next if get_number(i)
  1223.       size = n_size[:fontsize]
  1224.       # 数字の幅・高さ
  1225.       w = NUMBERS.collect{|n| text_size(n.to_s, name, size).width}.max + 4
  1226.       nh = NUMBERS.collect{|n| text_size(n.to_s, name, size).height}.max
  1227.       h = n_size[:line_height]
  1228.       @@w[i] = w
  1229.       @@h[i] = h
  1230.       # ビットマップ作成
  1231.       bitmap = Bitmap.new(w * NUMBERS.size, h * [colors.size, n_index].min)
  1232.       bitmap.font.name = LNX11::NUMBER_FONT
  1233.       bitmap.font.size = n_size[:fontsize]
  1234.       y = ((h - nh) / 2) - 1
  1235.       # 色ごとに分けて描画する(ループ)
  1236.       n_index.times do |col|
  1237.         # 色を変更
  1238.         bitmap.font.color.set(colors[col][0])
  1239.         bitmap.font.out_color.set(colors[col][1])
  1240.         # 文字ごとに分けて描画(ループ)
  1241.         NUMBERS.size.times do |num|
  1242.           bitmap.draw_text(num * w, (col * h) + y, w, nh, NUMBERS[num], 2)
  1243.         end
  1244.       end
  1245.       @@cache_number.push(bitmap)
  1246.     end
  1247.     p "LNX11a:数字ビットマップのキャッシュを作成しました。"
  1248.     # 数字ビットマップを表示する(テスト用)
  1249.     # s = Sprite.new
  1250.     # s.z = 1000000
  1251.     # s.bitmap = @@cache_number[1] # 0 or 1
  1252.     # loop do Graphics.update end
  1253.   end
  1254.   #--------------------------------------------------------------------------
  1255.   # ● 数字ビットマップの取得
  1256.   #--------------------------------------------------------------------------
  1257.   def get_number(i)
  1258.     case i
  1259.     when 0 # 大
  1260.       return false if LNX11::LARGE_NUMBER_NAME.empty?
  1261.       bitmap = Cache.system(LNX11::LARGE_NUMBER_NAME)
  1262.     when 1 # 小
  1263.       return false if LNX11::SMALL_NUMBER_NAME.empty?
  1264.       bitmap = Cache.system(LNX11::SMALL_NUMBER_NAME)
  1265.     end
  1266.     @@cache_number.push(bitmap)
  1267.     @@w[i] = bitmap.width / NUMBERS.size
  1268.     @@h[i] = bitmap.height / NUMBER_COLOR_SIZE
  1269.     true
  1270.   end
  1271.   #--------------------------------------------------------------------------
  1272.   # ● ダメージ数を描画したビットマップの取得
  1273.   #--------------------------------------------------------------------------
  1274.   def number(num, color, size = :large, deco = nil)
  1275.     # 数値を文字列の配列にする
  1276.     numbers = (num.abs.to_s).split(//)
  1277.     # 色番号を取得
  1278.     color_index = COLOR_KEYS.index(color)
  1279.     # ポップアップサイズを設定
  1280.     n_bitmap = bitmap_number(size)
  1281.     if size == :large
  1282.       n_size = LNX11::LARGE_NUMBER
  1283.       i = 0
  1284.     else
  1285.       n_size = LNX11::SMALL_NUMBER
  1286.       i = 1
  1287.     end
  1288.     spacing = n_size[:spacing]
  1289.     w = @@w[i]
  1290.     h = @@h[i]
  1291.     # ダメージ値のビットマップサイズ
  1292.     @bw = w * numbers.size + spacing * (numbers.size - 1)
  1293.     @bh = h
  1294.     # 修飾文字の描画
  1295.     @offset_x = @offset_y = 0
  1296.     text_bitmap = deco_text(deco,color,n_size[:fontsize]) if deco[1] >= 0
  1297.     # ビットマップを作成
  1298.     bitmap = Bitmap.new(@bw, @bh)
  1299.     # 塗りつぶし(テスト用)
  1300.     # bitmap.fill_rect(bitmap.rect, Color.new(0,0,0,128))
  1301.     # ダメージ値を描画
  1302.     rect = Rect.new(0, h * color_index, w, h)
  1303.     numbers.size.times do |n|
  1304.       rect.x = numbers[n].to_i * w
  1305.       bitmap.blt(w * n + spacing * n + @offset_x, @offset_y, n_bitmap, rect)
  1306.     end
  1307.     # 修飾文字の描画をコールバック
  1308.     @decoblt.call(bitmap) if @decoblt
  1309.     @decoblt = nil
  1310.     # ビットマップを返す
  1311.     bitmap
  1312.   end
  1313.   #--------------------------------------------------------------------------
  1314.   # ● 修飾文字の描画
  1315.   #--------------------------------------------------------------------------
  1316.   def deco_text(deco, color, sizerate)
  1317.     # 元の幅・高さ
  1318.     ow = @bw
  1319.     oh = @bh
  1320.     case deco[1]    
  1321.     when 2 # ダメージ値の下
  1322.       # テキストのビットマップを取得
  1323.       size = decosize(deco[0], sizerate, :top_bottom)
  1324.       text_bitmap = text(deco[0], color, size)
  1325.       # テキストの幅・高さ
  1326.       tw = text_bitmap.width
  1327.       th = text_bitmap.height * 0.8
  1328.       # 最終的なビットマップのサイズ
  1329.       @bw = [@bw, tw].max
  1330.       @bh += th
  1331.       # ダメージ値の描画位置の修正
  1332.       @offset_x = (@bw - ow) / 2
  1333.       @offset_y = 0
  1334.       # 修飾文字の描画位置を設定
  1335.       x = (@bw - tw) / 2
  1336.       y = oh * 0.8
  1337.     when 4 # ダメージ値の左
  1338.       # テキストのビットマップを取得
  1339.       size = decosize(deco[0], sizerate, :left_right)
  1340.       text_bitmap = text(deco[0], color, size)
  1341.       # テキストの幅・高さ
  1342.       tw = text_bitmap.width
  1343.       th = text_bitmap.height
  1344.       # 最終的なビットマップのサイズ
  1345.       @bw += tw
  1346.       @bh = [@bh, th].max
  1347.       # ダメージ値の描画位置の修正
  1348.       @offset_x = tw
  1349.       @offset_y = (@bh - oh) / 2
  1350.       # 修飾文字の描画位置を設定
  1351.       x = 2
  1352.       y = (@bh - th) / 2
  1353.     when 6 # ダメージ値の右
  1354.       # テキストのビットマップを取得
  1355.       size = decosize(deco[0], sizerate, :left_right)
  1356.       text_bitmap = text(deco[0], color, size)
  1357.       # テキストの幅・高さ
  1358.       tw = text_bitmap.width
  1359.       th = text_bitmap.height
  1360.       # 最終的なビットマップのサイズ
  1361.       @bw += tw
  1362.       @bh = [@bh, th].max
  1363.       # ダメージ値の描画位置の修正
  1364.       @offset_x = 0
  1365.       @offset_y = (@bh - oh) / 2
  1366.       # 修飾文字の描画位置を設定
  1367.       x = ow
  1368.       y = (@bh - th) / 2
  1369.     when 8 # ダメージ値の上
  1370.       # テキストのビットマップを取得
  1371.       size = decosize(deco[0], sizerate, :top_bottom)
  1372.       text_bitmap = text(deco[0], color, size)
  1373.       # テキストの幅・高さ
  1374.       tw = text_bitmap.width
  1375.       th = text_bitmap.height * 0.8
  1376.       # 最終的なビットマップのサイズ
  1377.       @bw = [@bw, tw].max
  1378.       @bh += th
  1379.       # ダメージ値の描画位置の修正
  1380.       @offset_x = (@bw - ow) / 2
  1381.       @offset_y = @bh - oh
  1382.       # 修飾文字の描画位置を設定
  1383.       x = (@bw - tw) / 2
  1384.       y = 0
  1385.     end
  1386.     # 修飾文字の描画(コールバック)
  1387.     @decoblt = Proc.new {|bitmap|
  1388.     bitmap.blt(x, y, text_bitmap, text_bitmap.rect)
  1389.     text_bitmap.dispose}
  1390.     return text_bitmap
  1391.   end
  1392.   #--------------------------------------------------------------------------
  1393.   # ● 修飾文字のサイズ
  1394.   #--------------------------------------------------------------------------
  1395.   def decosize(text, size, pos)
  1396.     if text.length != text.bytesize
  1397.       return size * LNX11::TEXT_SIZERATE[pos] * LNX11::TEXT_SIZERATE_MCS
  1398.     else
  1399.       return size * LNX11::TEXT_SIZERATE[pos]
  1400.     end
  1401.   end
  1402.   #--------------------------------------------------------------------------
  1403.   # ● テキストを描画したビットマップの取得
  1404.   #  ステートやダメージ値の修飾文字の描画に使用します。
  1405.   #--------------------------------------------------------------------------
  1406.   def text(text, color, size = :large, buff_data = [-1, -1])
  1407.     # キャッシュがあればそれを返す(無ければ作成)
  1408.     key = text + color.to_s + size.to_s
  1409.     if @@cache_text[key] && !@@cache_text[key].disposed?
  1410.       return @@cache_text[key].clone
  1411.     end
  1412.     # 用語の置き換え
  1413.     text.gsub!("\hp") { Vocab::hp_a } if text.include?("\hp")
  1414.     text.gsub!("\mp") { Vocab::mp_a } if text.include?("\mp")
  1415.     text.gsub!("\tp") { Vocab::tp_a } if text.include?("\tp")
  1416.     # <<ver1.10>> テキストの頭に _ があれば対応する画像ファイルを参照する
  1417.     if text[/^[\_]./]
  1418.       bitmap = get_text_bitmap(text, color, size)
  1419.       # キャッシュに保存
  1420.       @@cache_text[key] = bitmap
  1421.       # ビットマップを返す
  1422.       return bitmap.clone
  1423.     end
  1424.     # <<ver1.10>>
  1425.     # 能力強化/弱体のポップアップで、ファイル名が指定されていればそれを返す
  1426.     if buff_data[0] >= 0 &&
  1427.       (size == :large && !LNX11::LARGE_BUFFS_NAME.empty?) ||
  1428.       (size == :small && !LNX11::SMALL_BUFFS_NAME.empty?)
  1429.       bitmap = get_buff_bitmap(buff_data, size)
  1430.       # キャッシュに保存
  1431.       @@cache_text[key] = bitmap
  1432.       # ビットマップを返す
  1433.       return bitmap.clone
  1434.     end
  1435.     # テキストにマルチバイト文字があれば日本語用フォントを使う
  1436.     if text.length != text.bytesize
  1437.       fontname = LNX11::TEXT_FONT_MCS
  1438.       sizerate = LNX11::TEXT_SIZERATE[:normal] * LNX11::TEXT_SIZERATE_MCS
  1439.     else
  1440.       fontname = LNX11::TEXT_FONT
  1441.       sizerate = LNX11::TEXT_SIZERATE[:normal]
  1442.     end
  1443.     # ポップアップサイズを設定
  1444.     case size
  1445.     when :large ; fontsize = LNX11::LARGE_NUMBER[:fontsize] * sizerate
  1446.     when :small ; fontsize = LNX11::SMALL_NUMBER[:fontsize] * sizerate
  1447.     else        ; fontsize = size
  1448.     end
  1449.     # テキストサイズ計算
  1450.     rect = text_size(text, fontname, fontsize)
  1451.     rect.width += 2
  1452.     # ビットマップを作成
  1453.     bitmap = Bitmap.new(rect.width, rect.height)
  1454.     # 塗りつぶし(テスト用)
  1455.     # bitmap.fill_rect(bitmap.rect, Color.new(0,0,0,128))
  1456.     # フォント設定
  1457.     bitmap.font.name = fontname
  1458.     bitmap.font.size = fontsize
  1459.     bitmap.font.color.set(LNX11::POPUP_COLOR[color][0])
  1460.     bitmap.font.out_color.set(LNX11::POPUP_COLOR[color][1])
  1461.     # テキスト描画
  1462.     bitmap.draw_text(rect, text, 1)
  1463.     # キャッシュに保存
  1464.     @@cache_text[key] = bitmap
  1465.     # ビットマップを返す
  1466.     bitmap.clone
  1467.   end
  1468.   #--------------------------------------------------------------------------
  1469.   # ● 能力強化/弱体ビットマップの取得 <<ver1.10>>
  1470.   #--------------------------------------------------------------------------
  1471.   def get_buff_bitmap(buff_data, size)
  1472.     case size
  1473.     when :large ; src_bitmap = Cache.system(LNX11::LARGE_BUFFS_NAME)
  1474.     when :small ; src_bitmap = Cache.system(LNX11::SMALL_BUFFS_NAME)
  1475.     end
  1476.     src_rect = Rect.new
  1477.     src_rect.width  = src_bitmap.width  / 2
  1478.     src_rect.height = src_bitmap.height / 12
  1479.     src_rect.x = (buff_data[0] / 4) * src_rect.width
  1480.     src_rect.y = (buff_data[0] % 4) * src_rect.height * 3 +
  1481.                   buff_data[1] * src_rect.height
  1482.     bitmap = Bitmap.new(src_rect.width, src_rect.height)
  1483.     bitmap.blt(0, 0, src_bitmap, src_rect)
  1484.     bitmap
  1485.   end
  1486.   #--------------------------------------------------------------------------
  1487.   # ● テキストビットマップの取得 <<ver1.10>>
  1488.   #--------------------------------------------------------------------------
  1489.   def get_text_bitmap(text, color, size)
  1490.     # クリティカルカラーかつ、弱点/耐性なら参照するビットマップを変更
  1491.     if LNX11::POPUP_COLOR[color] == LNX11::POPUP_COLOR[:critical] &&
  1492.       (text == LNX11::DECORATION_NUMBER[:weakness][0] ||
  1493.        text == LNX11::DECORATION_NUMBER[:resist][0])
  1494.       # ファイル名に _critcolor を加える
  1495.       text += "_critcolor"
  1496.     end
  1497.     # MPダメージ/回復(符号なし)なら参照するビットマップを変更
  1498.     if text == LNX11::DECORATION_NUMBER[:mp_damage][0]
  1499.       # カラーに応じてファイル名を変更
  1500.       case LNX11::POPUP_COLOR[color]
  1501.       when LNX11::POPUP_COLOR[:mp_damage]   ; text += "_damage"
  1502.       when LNX11::POPUP_COLOR[:mp_recovery] ; text += "_recovery"
  1503.       end
  1504.     end
  1505.     # popup_xxxxxx_(large or small)
  1506.     Cache.system("popup" + text + (size == :large ? "_large" : "_small"))
  1507.   end
  1508. end
  1509.  
  1510. #==============================================================================
  1511. # ■ [追加]:Sprite_PopupSpring
  1512. #------------------------------------------------------------------------------
  1513. #  通常の跳ねるポップアップ。
  1514. #==============================================================================
  1515.  
  1516. class Sprite_PopupSpring < Sprite_PopupBase
  1517.   #--------------------------------------------------------------------------
  1518.   # ● ポップアップ Z 座標
  1519.   #--------------------------------------------------------------------------
  1520.   def base_z
  1521.     14
  1522.   end
  1523.   #--------------------------------------------------------------------------
  1524.   # ● 開始処理
  1525.   #--------------------------------------------------------------------------
  1526.   def start
  1527.     # 動き設定
  1528.     set_movement
  1529.     # ディレイ設定 同じタイプのポップアップが重ならないようにする
  1530.     if @popup_size == :small
  1531.       self.oy -= @battler.popup_delay[1]
  1532.       @delay_clear = (@delay == 0)
  1533.       dy = self.bitmap.height * 0.8
  1534.       @battler.popup_delay[1] += dy
  1535.       @delay = 0
  1536.     end
  1537.   end
  1538.   #--------------------------------------------------------------------------
  1539.   # ● 終了処理
  1540.   #--------------------------------------------------------------------------  
  1541.   def terminate
  1542.     # 一番上のポップアップなら、ディレイを初期化する
  1543.     @battler.popup_delay[1] = 0 if @delay_clear
  1544.   end
  1545.   #--------------------------------------------------------------------------
  1546.   # ● 投射運動の設定
  1547.   #--------------------------------------------------------------------------
  1548.   def set_movement
  1549.     if @popup_size == :large
  1550.       movement = LNX11::LARGE_MOVEMENT
  1551.     else
  1552.       movement = LNX11::SMALL_MOVEMENT
  1553.     end
  1554.     @fall       = -movement[:inirate]
  1555.     @gravity    =  movement[:gravity]
  1556.     @side       =  movement[:side_scatter] * rand(0) * (rand(2) == 0 ? -1 : 1)
  1557.     @ref_move   =  movement[:ref_height]
  1558.     @ref_factor =  movement[:ref_factor]
  1559.     @ref_count  =  movement[:ref_count]
  1560.     @duration   =  movement[:duration]
  1561.     @fadeout    =  movement[:fadeout]
  1562.   end
  1563.   #--------------------------------------------------------------------------
  1564.   # ● フレーム更新
  1565.   #--------------------------------------------------------------------------
  1566.   def update_popup
  1567.     update_freefall
  1568.   end
  1569.   #--------------------------------------------------------------------------
  1570.   # ● 投射運動の更新
  1571.   #--------------------------------------------------------------------------
  1572.   def update_freefall
  1573.     if @ref_count >= 0
  1574.       # X:左右移動
  1575.       @rx += @side
  1576.       # Y:自由落下
  1577.       @ry += @fall
  1578.       @ref_move -= @fall
  1579.       @fall += @gravity
  1580.       # 跳ね返り
  1581.       if @ref_move <= 0 && @fall >= 0
  1582.         @ref_count -= 1
  1583.         @fall = -@fall * @ref_factor
  1584.       end      
  1585.     end
  1586.   end
  1587. end
  1588.  
  1589. #==============================================================================
  1590. # ■ [追加]:Sprite_PopupRising
  1591. #------------------------------------------------------------------------------
  1592. #  少しずつ上昇するポップアップ。
  1593. #==============================================================================
  1594.  
  1595. class Sprite_PopupRising < Sprite_PopupBase
  1596.   #--------------------------------------------------------------------------
  1597.   # ● ポップアップ Z 座標
  1598.   #--------------------------------------------------------------------------
  1599.   def base_z
  1600.     6
  1601.   end
  1602.   #--------------------------------------------------------------------------
  1603.   # ● 開始処理
  1604.   #--------------------------------------------------------------------------
  1605.   def start
  1606.     # 動き設定
  1607.     set_movement
  1608.     self.opacity = 0
  1609.     d = self.bitmap.height * LNX11::RISE_MOVEMENT[:line_spacing]
  1610.     @delay_count = d / @rising_speed
  1611.     @battler.popup_delay[2] += @delay_count
  1612.   end
  1613.   #--------------------------------------------------------------------------
  1614.   # ● 動きの設定
  1615.   #--------------------------------------------------------------------------
  1616.   def set_movement
  1617.     @rising_speed = LNX11::RISE_MOVEMENT[:rising_speed]
  1618.     @duration = LNX11::RISE_MOVEMENT[:duration]
  1619.     @fadeout  = LNX11::RISE_MOVEMENT[:fadeout]
  1620.   end
  1621.   #--------------------------------------------------------------------------
  1622.   # ● フレーム更新
  1623.   #--------------------------------------------------------------------------
  1624.   def update_popup
  1625.     @delay_count -= 1
  1626.     @battler.popup_delay[2] -= 1 if @delay_count >= 0
  1627.     @ry -= @rising_speed # すこしずつ上昇
  1628.     self.opacity += 32 if @duration > 0
  1629.   end
  1630. end
  1631.  
  1632. #==============================================================================
  1633. # ■ [追加]:Sprite_PopupSliding
  1634. #------------------------------------------------------------------------------
  1635. #  スライド表示するポップアップ。
  1636. #==============================================================================
  1637.  
  1638. class Sprite_PopupSliding < Sprite_PopupBase
  1639.   #--------------------------------------------------------------------------
  1640.   # ● ポップアップ Z 座標
  1641.   #--------------------------------------------------------------------------
  1642.   def base_z
  1643.     8
  1644.   end
  1645.   #--------------------------------------------------------------------------
  1646.   # ● 開始処理
  1647.   #--------------------------------------------------------------------------
  1648.   def start
  1649.     # 動き設定
  1650.     set_movement
  1651.     d = self.bitmap.height * LNX11::SLIDE_MOVEMENT[:line_spacing]
  1652.     self.oy += @delay + d / 2 if @delay > 0
  1653.     self.opacity = 0
  1654.     # ディレイ設定 同じタイプのポップアップが重ならないようにする
  1655.     @delay_clear = (@delay == 0)
  1656.     @battler.popup_delay[3] += (@delay <= 0 ? d / 2 : d)
  1657.     @delay = 0
  1658.   end
  1659.   #--------------------------------------------------------------------------
  1660.   # ● 終了処理
  1661.   #--------------------------------------------------------------------------  
  1662.   def terminate
  1663.     # 一番下のポップアップなら、ディレイを初期化する
  1664.     @battler.popup_delay[3] = 0 if @delay_clear
  1665.   end
  1666.   #--------------------------------------------------------------------------
  1667.   # ● 動きの設定
  1668.   #--------------------------------------------------------------------------
  1669.   def set_movement
  1670.     @x_speed  = LNX11::SLIDE_MOVEMENT[:x_speed]
  1671.     @duration = LNX11::SLIDE_MOVEMENT[:duration]
  1672.     @fadeout  = LNX11::SLIDE_MOVEMENT[:fadeout]
  1673.     # フェードインのスライド分だけ X を移動
  1674.     @rx -= @x_speed * 255.0 / @fadeout
  1675.   end
  1676.   #--------------------------------------------------------------------------
  1677.   # ● フレーム更新
  1678.   #--------------------------------------------------------------------------
  1679.   def update_popup
  1680.     @rx += @x_speed if opacity != 255 # スライド
  1681.     self.opacity += @fadeout if @duration > 0
  1682.   end
  1683. end
  1684.  
  1685. #==============================================================================
  1686. # ■ [追加]:Sprite_PopupOverlay
  1687. #------------------------------------------------------------------------------
  1688. #  オーバーレイポップアップ。自身の複製を加算合成で重ね合わせます。
  1689. #==============================================================================
  1690.  
  1691. class Sprite_PopupOverlay < Sprite_PopupBase
  1692.   #--------------------------------------------------------------------------
  1693.   # ● ポップアップ Z 座標
  1694.   #--------------------------------------------------------------------------
  1695.   def base_z
  1696.     10
  1697.   end
  1698.   #--------------------------------------------------------------------------
  1699.   # ● 開始処理
  1700.   #--------------------------------------------------------------------------
  1701.   def start
  1702.     @duration = LNX11::OVERLAY_MOVEMENT[:duration]
  1703.     @fadeout  = LNX11::OVERLAY_MOVEMENT[:fadeout]
  1704.     # オーバーレイの作成
  1705.     create_overlay
  1706.   end
  1707.   #--------------------------------------------------------------------------
  1708.   # ● 終了処理
  1709.   #--------------------------------------------------------------------------
  1710.   def terminate
  1711.     @overlay.dispose
  1712.     @overlay = nil
  1713.   end
  1714.   #--------------------------------------------------------------------------
  1715.   # ● オーバーレイ(複製)の作成
  1716.   #--------------------------------------------------------------------------
  1717.   def create_overlay
  1718.     @overlay = Sprite.new
  1719.     @overlay.bitmap   = self.bitmap
  1720.     @overlay.viewport = self.viewport
  1721.     @overlay.ox = self.ox
  1722.     @overlay.oy = self.oy
  1723.     @overlay.visible = false
  1724.     @overlay.blend_type = 1
  1725.   end
  1726.   #--------------------------------------------------------------------------
  1727.   # ● フレーム更新
  1728.   #--------------------------------------------------------------------------
  1729.   def update_popup
  1730.     self.opacity += @fadeout * 2 if @duration > 0
  1731.   end
  1732.   #--------------------------------------------------------------------------
  1733.   # ● フレーム更新
  1734.   #--------------------------------------------------------------------------
  1735.   def update
  1736.     super
  1737.     update_overlay
  1738.   end
  1739.   #--------------------------------------------------------------------------
  1740.   # ● オーバーレイの更新
  1741.   #--------------------------------------------------------------------------
  1742.   def update_overlay
  1743.     return if self.disposed? || @overlay.opacity == 0
  1744.     @overlay.x = self.x
  1745.     @overlay.y = self.y
  1746.     @overlay.z = self.z
  1747.     # 拡大・消去
  1748.     @overlay.zoom_x += 0.16
  1749.     @overlay.zoom_y += 0.12
  1750.     @overlay.opacity -= 20
  1751.     @overlay.visible = (@overlay.opacity != 0)
  1752.   end
  1753. end
  1754.  
  1755. #==============================================================================
  1756. # ■ [追加]:Sprite_PopupLevelUp
  1757. #------------------------------------------------------------------------------
  1758. #  レベルアップのポップアップ。スライドポップアップを継承しています。
  1759. #==============================================================================
  1760.  
  1761. class Sprite_PopupLevelUp < Sprite_PopupSliding
  1762.   #--------------------------------------------------------------------------
  1763.   # ● ポップアップ Z 座標
  1764.   #--------------------------------------------------------------------------
  1765.   def base_z
  1766.     32
  1767.   end
  1768.   #--------------------------------------------------------------------------
  1769.   # ● ポップアップ位置の設定
  1770.   #--------------------------------------------------------------------------
  1771.   def set_position
  1772.     @rx = @battler.screen_x - LNX11::ACTOR_OFFSET[:x]
  1773.     case LNX11::LEVELUP_POPUP_POSITION
  1774.     when 0 ; @ry = @battler.screen_y        # 足元
  1775.     when 1 ; @ry = @battler.screen_y_center # 中心
  1776.     when 2 ; @ry = @battler.screen_y_top    # 頭上
  1777.     when 3 ; @ry = Graphics.height + LNX11::LEVELUP_POPUP_Y # Y座標統一
  1778.     end
  1779.   end
  1780.   #--------------------------------------------------------------------------
  1781.   # ● フレーム更新
  1782.   #--------------------------------------------------------------------------
  1783.   def update_popup
  1784.     super
  1785.     # リザルト中なら自動的に消去しない
  1786.     @duration += 1 if $game_troop.all_dead? || $game_message.busy?
  1787.   end
  1788. end
  1789.  
  1790. #==============================================================================
  1791. # ■ Bitmap
  1792. #==============================================================================
  1793.  
  1794. class Bitmap
  1795.   #--------------------------------------------------------------------------
  1796.   # ● [追加]:カーソル用三角形の描画
  1797.   #--------------------------------------------------------------------------
  1798.   def lnx_cursor_triangle(size, color, oy = 0, grad = 1)
  1799.     color = color.clone
  1800.     x = (self.width - size) / 2
  1801.     y = (self.height - size) / 2 + oy
  1802.     rect = Rect.new(x, y, size, 1)
  1803.     count = size / 2
  1804.     minus = 128 / count / 2
  1805.     count.times do
  1806.       clear_rect(rect)
  1807.       fill_rect(rect, color)
  1808.       color.red   = [color.red   - minus * grad, 0].max
  1809.       color.green = [color.green - minus * grad, 0].max
  1810.       color.blue  = [color.blue  - minus * grad, 0].max
  1811.       rect.y += rect.height
  1812.       clear_rect(rect)
  1813.       fill_rect(rect, color)
  1814.       color.red   = [color.red   - minus * grad, 0].max
  1815.       color.green = [color.green - minus * grad, 0].max
  1816.       color.blue  = [color.blue  - minus * grad, 0].max
  1817.       rect.x += 1
  1818.       rect.y += rect.height
  1819.       rect.width -= 2
  1820.     end
  1821.   end
  1822. end
  1823.  
  1824. #==============================================================================
  1825. # ■ [追加]:Sprite_TargetCursor
  1826. #------------------------------------------------------------------------------
  1827. #  対象選択されているバトラーや行動選択中のアクターを示すアローカーソルです。
  1828. #==============================================================================
  1829. class Sprite_TargetCursor < Sprite
  1830.   #--------------------------------------------------------------------------
  1831.   # ● クラス変数
  1832.   #--------------------------------------------------------------------------
  1833.   @@cursor_cache = nil
  1834.   #--------------------------------------------------------------------------
  1835.   # ● 公開インスタンス変数
  1836.   #--------------------------------------------------------------------------
  1837.   attr_accessor :battler     # バトラー
  1838.   attr_accessor :blink       # 点滅(対象の選択中)
  1839.   #--------------------------------------------------------------------------
  1840.   # ● オブジェクト初期化
  1841.   #--------------------------------------------------------------------------
  1842.   def initialize(viewport = nil)
  1843.     super(viewport)
  1844.     @wait = LNX11::CURSOR_ANI_SPEED
  1845.     @speed = [LNX11::CURSOR_SPEED, 1].max
  1846.     @battler = nil
  1847.     @sub_cursor = []
  1848.     @blink = false
  1849.     self.bitmap = cursor_bitmap
  1850.     partition = self.bitmap.width / self.height
  1851.     self.src_rect.set(0, 0, self.width / partition, self.height)
  1852.     self.ox = self.width / 2
  1853.     self.oy = self.height / 2
  1854.     self.x = @rx = @tx = 0
  1855.     self.y = @ry = @ty = 0
  1856.     self.z = 98
  1857.     self.visible = false
  1858.   end
  1859.   #--------------------------------------------------------------------------
  1860.   # ● 解放
  1861.   #--------------------------------------------------------------------------  
  1862.   def dispose
  1863.     dispose_subcursor
  1864.     super
  1865.   end
  1866.   #--------------------------------------------------------------------------
  1867.   # ● サブカーソル作成
  1868.   #  メンバー全体にカーソルを表示するために複数のカーソルを作成します。
  1869.   #--------------------------------------------------------------------------  
  1870.   def create_subcursor(members)
  1871.     return unless @sub_cursor.empty?
  1872.     members.each_with_index do |battler, i|
  1873.       @sub_cursor[i] = Sprite_TargetCursor.new(self.viewport)
  1874.       @sub_cursor[i].set(@rx, @ry)
  1875.       @sub_cursor[i].set(battler, true)
  1876.     end
  1877.   end
  1878.   #--------------------------------------------------------------------------
  1879.   # ● サブカーソル解放
  1880.   #--------------------------------------------------------------------------  
  1881.   def dispose_subcursor
  1882.     @sub_cursor.each {|sprite| sprite.dispose }
  1883.     @sub_cursor = []
  1884.   end
  1885.   #--------------------------------------------------------------------------
  1886.   # ● サブカーソル更新
  1887.   #--------------------------------------------------------------------------  
  1888.   def update_subcursor
  1889.     @sub_cursor.each {|sprite| sprite.update }
  1890.   end
  1891.   #--------------------------------------------------------------------------
  1892.   # ● ビットマップの設定
  1893.   #--------------------------------------------------------------------------
  1894.   def cursor_bitmap
  1895.     if !LNX11::CURSOR_NAME.empty?
  1896.       return Cache.system(LNX11::CURSOR_NAME)
  1897.     else
  1898.       # カーソルファイル名が指定されていなければRGSS側で生成
  1899.       return @@cursor_cache if @@cursor_cache && !@@cursor_cache.disposed?
  1900.       @@cursor_cache = Bitmap.new(32, 32)
  1901.       color = Color.new(0, 0, 0)
  1902.       @@cursor_cache.lnx_cursor_triangle(26, color, 2)
  1903.       2.times {@@cursor_cache.blur}
  1904.       color.set(255, 255, 255)
  1905.       @@cursor_cache.lnx_cursor_triangle(24, color, 1, 0.5)
  1906.       tone = LNX11::CURSOR_TONE ? LNX11::CURSOR_TONE : $game_system.window_tone
  1907.       r = 118 + tone.red
  1908.       g = 118 + tone.green
  1909.       b = 118 + tone.blue
  1910.       color.set(r, g, b, 232)
  1911.       @@cursor_cache.lnx_cursor_triangle(20, color,  0)
  1912.       @@cursor_cache.lnx_cursor_triangle(20, color,  1)
  1913.       p "LNX11a:カーソルビットマップを作成しました。"
  1914.       return @@cursor_cache
  1915.     end
  1916.   end
  1917.   #--------------------------------------------------------------------------
  1918.   # ● カーソルの表示
  1919.   #--------------------------------------------------------------------------
  1920.   def show
  1921.     self.x = @rx = @tx
  1922.     self.y = @ry = @ty
  1923.     self.visible = true
  1924.   end
  1925.   #--------------------------------------------------------------------------
  1926.   # ● カーソルの非表示
  1927.   #--------------------------------------------------------------------------
  1928.   def hide
  1929.     dispose_subcursor
  1930.     @battler = nil
  1931.     self.visible = false
  1932.   end
  1933.   #--------------------------------------------------------------------------
  1934.   # ● 移動平均
  1935.   #--------------------------------------------------------------------------
  1936.   def sma(a, b, p)
  1937.     # a = 目標位置 b = 現在地
  1938.     return a if a == b || (a - b).abs < 0.3 || p == 1
  1939.     result = ((a + b * (p.to_f - 1)) / p.to_f)
  1940.     return (a - result).abs <= 1.0 ? (b < a ? b + 0.3 : b - 0.3) : result
  1941.   end
  1942.   #--------------------------------------------------------------------------
  1943.   # ● フレーム更新
  1944.   #--------------------------------------------------------------------------
  1945.   def update
  1946.     update_subcursor
  1947.     self.opacity = @sub_cursor.empty? ? 255 : 0
  1948.     return if !visible || !@sub_cursor.empty?
  1949.     super
  1950.     # 点滅
  1951.     if LNX11::CURSOR_BLINK
  1952.       self.blend_type = @blink && Graphics.frame_count / 3 % 2 == 0 ? 1 : 0
  1953.     end
  1954.     # アニメーションを進める
  1955.     @wait -= 1
  1956.     if @wait <= 0
  1957.       @wait += LNX11::CURSOR_ANI_SPEED
  1958.       self.src_rect.x += self.width
  1959.       self.src_rect.x = 0 if self.src_rect.x >= self.bitmap.width
  1960.     end
  1961.     # カーソルの座標を更新
  1962.     set_xy if @battler && @sub_cursor.empty?
  1963.     self.x = @rx = sma(@tx, @rx, @speed)
  1964.     self.y = @ry = sma(@ty, @ry, @speed)
  1965.   end
  1966.   #--------------------------------------------------------------------------
  1967.   # ● カーソル位置の設定
  1968.   #--------------------------------------------------------------------------
  1969.   def set(*args)
  1970.     if args[0].is_a?(Numeric)
  1971.       # 引数一つ目が数値なら、XY指定
  1972.       @battler = nil
  1973.       set_xy(args[0], args[1])
  1974.       @blink = args[2] ? args[2] : false
  1975.     else
  1976.       # バトラーorシンボル指定
  1977.       if @battler != args[0]
  1978.         @battler = args[0]
  1979.         dispose_subcursor
  1980.         case args[0]
  1981.         when :party        ; create_subcursor($game_party.members)
  1982.         when :troop        ; create_subcursor($game_troop.alive_members)
  1983.         when :troop_random ; create_subcursor($game_troop.alive_members)
  1984.         else ; args[0] ? set_xy : hide
  1985.         end
  1986.       end
  1987.       @blink = args[1] ? args[1] : false
  1988.     end
  1989.     # スピードが1かカーソルが非表示なら表示に変える
  1990.     show if @sub_cursor.empty? && (@speed == 1 || !visible)
  1991.   end
  1992.   #--------------------------------------------------------------------------
  1993.   # ● カーソル位置をバトラーの位置に設定
  1994.   #--------------------------------------------------------------------------
  1995.   def set_xy(x = nil, y = nil)
  1996.     if x
  1997.       # 直接指定
  1998.       x += LNX11::CURSOR_OFFSET[:x]
  1999.       y += LNX11::CURSOR_OFFSET[:y]
  2000.     else
  2001.       # バトラーの座標
  2002.       x = @battler.screen_x + LNX11::CURSOR_OFFSET[:x]
  2003.       y = @battler.screen_y_top + LNX11::CURSOR_OFFSET[:y]
  2004.     end
  2005.     @tx = x
  2006.     minmax = LNX11::CURSOR_MINMAX
  2007.     @ty = [[y, minmax[:min] + self.oy].max, minmax[:max]].min
  2008.   end
  2009. end
  2010.  
  2011. #==============================================================================
  2012. # ■ [追加]:Sprite_OneLine_BattleLog
  2013. #------------------------------------------------------------------------------
  2014. #  バトルログを動的に表示するスプライトです。単体では1行しか表示できませんが、
  2015. # 複数同時に扱うことで複数行の表示を実装しています。
  2016. #==============================================================================
  2017.  
  2018. class Sprite_OneLine_BattleLog < Sprite
  2019.   @@grad_cache = nil
  2020.   #--------------------------------------------------------------------------
  2021.   # ● 公開インスタンス変数
  2022.   #--------------------------------------------------------------------------
  2023.   attr_accessor   :position # 表示位置(行)
  2024.   #--------------------------------------------------------------------------
  2025.   # ● オブジェクト初期化
  2026.   #--------------------------------------------------------------------------
  2027.   def initialize(width, height, max_line_number)
  2028.     super(nil)
  2029.     @rx = @ry = 0
  2030.     @line_height = height
  2031.     @max_line_number = max_line_number
  2032.     @position = -1
  2033.     @visible = true
  2034.     self.ox = -LNX11::STORAGE_OFFSET[:x]
  2035.     self.oy = -LNX11::STORAGE_OFFSET[:y]
  2036.     self.opacity = 0
  2037.     self.z = 96
  2038.     self.bitmap = Bitmap.new(width * 0.75, height)
  2039.   end
  2040.   #--------------------------------------------------------------------------
  2041.   # ● 解放
  2042.   #--------------------------------------------------------------------------  
  2043.   def dispose
  2044.     self.bitmap.dispose
  2045.     super
  2046.   end
  2047.   #--------------------------------------------------------------------------
  2048.   # ● スプライトの表示
  2049.   #--------------------------------------------------------------------------  
  2050.   def show
  2051.     @visible = true
  2052.   end
  2053.   #--------------------------------------------------------------------------
  2054.   # ● スプライトの非表示
  2055.   #--------------------------------------------------------------------------  
  2056.   def hide
  2057.     @visible = false
  2058.     @position = -1
  2059.   end
  2060.   #--------------------------------------------------------------------------
  2061.   # ● 表示しているか?
  2062.   #--------------------------------------------------------------------------  
  2063.   def visible?
  2064.     @visible
  2065.   end
  2066.   #--------------------------------------------------------------------------
  2067.   # ● フレーム更新
  2068.   #--------------------------------------------------------------------------
  2069.   def update
  2070.     return if self.opacity == 0
  2071.     self.opacity += @visible && @position >= 0 ? 24 : -24
  2072.     self.visible = self.opacity > 0
  2073.     return unless @visible # 不可視状態なら座標を更新しない
  2074.     @ry = (target_y + (@ry * 5)) / 6.0 if target_y < @ry
  2075.     @rx += 2 if @rx < 0
  2076.     self.x = @rx
  2077.     self.y = @ry
  2078.   end
  2079.   #--------------------------------------------------------------------------
  2080.   # ● テキストの描画
  2081.   #  自身が持つ Bitmap で描画するのではなく、Window の contents から
  2082.   # コピーします(Sprite からでは Window_Base#draw_text_ex が扱えないため)。
  2083.   #--------------------------------------------------------------------------
  2084.   def set_text(window, position)
  2085.     self.bitmap.clear
  2086.     # 横グラデーション
  2087.     if @@grad_cache && !@@grad_cache.disposed?
  2088.       self.bitmap.blt(0, 0, @@grad_cache, self.bitmap.rect)
  2089.     else
  2090.       color = LNX11::STORAGE_GRADIENT_COLOR
  2091.       fillrect = self.bitmap.rect
  2092.       fillrect.width /= 2
  2093.       self.bitmap.gradient_fill_rect(fillrect, color[0], color[1])
  2094.       @@grad_cache = self.bitmap.clone
  2095.     end
  2096.     # contents からコピー
  2097.     self.bitmap.blt(4, 0, window.contents, self.bitmap.rect)
  2098.     self.opacity = 1
  2099.     @rx = -8
  2100.     @position = position
  2101.     @ry = target_y
  2102.   end
  2103.   #--------------------------------------------------------------------------
  2104.   # ● 位置の繰り上げ
  2105.   #--------------------------------------------------------------------------
  2106.   def up_position
  2107.     @position -= 1
  2108.   end
  2109.   #--------------------------------------------------------------------------
  2110.   # ● メッセージが空か?(表示待ち)
  2111.   #--------------------------------------------------------------------------
  2112.   def mes_empty?
  2113.     @position < 0
  2114.   end
  2115.   #--------------------------------------------------------------------------
  2116.   # ● 移動するべき Y 座標
  2117.   #--------------------------------------------------------------------------
  2118.   def target_y
  2119.     @position * @line_height
  2120.   end
  2121. end
  2122.  
  2123. #==============================================================================
  2124. # ■ Window_BattleLog
  2125. #------------------------------------------------------------------------------
  2126. #  戦闘の進行を実況表示するウィンドウです。
  2127. #==============================================================================
  2128.  
  2129. class Window_BattleLog < Window_Selectable
  2130.   #--------------------------------------------------------------------------
  2131.   # ● [エイリアス]:オブジェクト初期化
  2132.   #--------------------------------------------------------------------------
  2133.   alias :lnx11a_initialize :initialize
  2134.   def initialize
  2135.     lnx11a_initialize
  2136.     # バトルログタイプが 1 以上なら非表示にする
  2137.     @storage_number = 0
  2138.     hide if LNX11::BATTLELOG_TYPE >= 1
  2139.     BattleManager.log_window = self
  2140.   end
  2141.   #--------------------------------------------------------------------------
  2142.   # ● [追加]:文章の配列のクリア
  2143.   #--------------------------------------------------------------------------
  2144.   def lines_clear
  2145.     @lines.clear if LNX11::BATTLELOG_TYPE == 1
  2146.   end
  2147.   #--------------------------------------------------------------------------
  2148.   # ● [追加]:指定ウェイト
  2149.   #--------------------------------------------------------------------------
  2150.   def abs_wait(wait)
  2151.     @method_wait.call(wait) if @method_wait
  2152.   end
  2153.   #--------------------------------------------------------------------------
  2154.   # ● [再定義]:メッセージ速度の取得
  2155.   #--------------------------------------------------------------------------
  2156.   def message_speed
  2157.     return 20
  2158.   end
  2159.   #--------------------------------------------------------------------------
  2160.   # ● [再定義]:エフェクト実行が終わるまでウェイト
  2161.   #--------------------------------------------------------------------------
  2162.   def wait_for_effect
  2163.     return if LNX11::BATTLELOG_TYPE > 0
  2164.     @method_wait_for_effect.call if @method_wait_for_effect
  2165.   end
  2166.   #--------------------------------------------------------------------------
  2167.   # ● [追加]:アニメーションのウェイト用メソッドの設定
  2168.   #--------------------------------------------------------------------------
  2169.   def method_wait_for_animation=(method)
  2170.     @method_wait_for_animation = method
  2171.   end
  2172.   #--------------------------------------------------------------------------
  2173.   # ● [追加]:アニメーション再生が終わるまでウェイト
  2174.   #--------------------------------------------------------------------------
  2175.   def wait_for_animation
  2176.     @method_wait_for_animation.call if @method_wait_for_animation
  2177.   end
  2178.  
  2179.   #--------------------------------------------------------------------------
  2180.   # ● [エイリアス]:ウィンドウ高さの取得
  2181.   #--------------------------------------------------------------------------
  2182.   alias :lnx11a_window_height :window_height
  2183.   def window_height
  2184.     LNX11::BATTLELOG_TYPE == 1 ? fitting_height(1) : lnx11a_window_height
  2185.   end
  2186.   #--------------------------------------------------------------------------
  2187.   # ● [エイリアス]:最大行数の取得
  2188.   #--------------------------------------------------------------------------
  2189.   alias :lnx11a_max_line_number :max_line_number
  2190.   def max_line_number
  2191.     num = LNX11::STORAGE_LINE_NUMBER
  2192.     LNX11::BATTLELOG_TYPE == 1 ? num : lnx11a_max_line_number
  2193.   end
  2194.   #--------------------------------------------------------------------------
  2195.   # ● [オーバーライド]:行の高さを取得
  2196.   #--------------------------------------------------------------------------
  2197.   def line_height
  2198.     LNX11::BATTLELOG_TYPE == 1 ? LNX11::STORAGE_LINE_HEIGHT : super
  2199.   end
  2200.   #--------------------------------------------------------------------------
  2201.   # ● [オーバーライド]:フォント設定のリセット
  2202.   #--------------------------------------------------------------------------
  2203.   def reset_font_settings
  2204.     super
  2205.     return unless LNX11::BATTLELOG_TYPE == 1
  2206.     contents.font.size = LNX11::STORAGE_FONT[:size]
  2207.     contents.font.out_color.set(LNX11::STORAGE_FONT[:out_color])
  2208.   end
  2209.   #--------------------------------------------------------------------------
  2210.   # ● [エイリアス]:データ行数の取得
  2211.   #--------------------------------------------------------------------------
  2212.   alias :lnx11a_line_number :line_number
  2213.   def line_number
  2214.     return 0 if LNX11::BATTLELOG_TYPE == 2
  2215.     LNX11::BATTLELOG_TYPE == 1 ? @storage_number : lnx11a_line_number
  2216.   end
  2217.   #--------------------------------------------------------------------------
  2218.   # ● [再定義]:背景スプライトの作成
  2219.   #--------------------------------------------------------------------------
  2220.   alias :lnx11a_create_back_sprite :create_back_sprite
  2221.   def create_back_sprite
  2222.     if LNX11::BATTLELOG_TYPE == 1
  2223.       # 蓄積型
  2224.       create_message_sprite
  2225.     else
  2226.       # 背景
  2227.       lnx11a_create_back_sprite
  2228.     end
  2229.   end
  2230.   #--------------------------------------------------------------------------
  2231.   # ● [再定義]:背景スプライトの解放
  2232.   #--------------------------------------------------------------------------
  2233.   alias :lnx11a_dispose_back_sprite :dispose_back_sprite
  2234.   def dispose_back_sprite
  2235.     if LNX11::BATTLELOG_TYPE == 1
  2236.       # 蓄積型
  2237.       dispose_message_sprite
  2238.     else
  2239.       # 背景
  2240.       lnx11a_dispose_back_sprite
  2241.     end
  2242.   end
  2243.   #--------------------------------------------------------------------------
  2244.   # ● [追加]:メッセージスプライトの作成
  2245.   #--------------------------------------------------------------------------
  2246.   def create_message_sprite
  2247.     # メッセージスプライト 行数分だけ作成する
  2248.     @mes_position = 0 # 次にメッセージを表示させる位置
  2249.     @mesup_count = LNX11::STORAGE_UP_MESSAGE_TIME # ログが進行するまでの時間
  2250.     @mes_sprites = Array.new(max_line_number + 1) {
  2251.     Sprite_OneLine_BattleLog.new(self.width, line_height, max_line_number)}    
  2252.   end
  2253.   #--------------------------------------------------------------------------
  2254.   # ● [追加]:メッセージスプライトの解放
  2255.   #--------------------------------------------------------------------------
  2256.   def dispose_message_sprite
  2257.     @mes_sprites.each {|sprite| sprite.dispose }
  2258.   end
  2259.   #--------------------------------------------------------------------------
  2260.   # ● [追加]:メッセージスプライトを表示
  2261.   #--------------------------------------------------------------------------
  2262.   def show_message_sprite
  2263.     @mes_sprites.each {|sprite| sprite.show }
  2264.   end
  2265.   #--------------------------------------------------------------------------
  2266.   # ● [追加]:メッセージスプライトを非表示
  2267.   #--------------------------------------------------------------------------
  2268.   def hide_message_sprite
  2269.     @mes_sprites.each {|sprite| sprite.hide }
  2270.     @mes_position = 0
  2271.   end
  2272.   #--------------------------------------------------------------------------
  2273.   # ● [追加]:メッセージスプライトを一つ進める
  2274.   #--------------------------------------------------------------------------
  2275.   def up_message_sprite
  2276.     @mes_sprites.each {|sprite| sprite.up_position }
  2277.   end
  2278.   #--------------------------------------------------------------------------
  2279.   # ● [追加]:空のメッセージスプライトを返す
  2280.   #--------------------------------------------------------------------------
  2281.   def empty_message_sprite
  2282.     @mes_sprites.each {|sprite| return sprite if sprite.mes_empty? }
  2283.     @mes_sprites[0]
  2284.   end
  2285.   #--------------------------------------------------------------------------
  2286.   # ● [追加]:メッセージスプライトの更新
  2287.   #--------------------------------------------------------------------------
  2288.   def update_message_sprite
  2289.     # バトルログ消去フラグが有効
  2290.     if $game_temp.battlelog_clear
  2291.       $game_temp.battlelog_clear = false
  2292.       # スプライトが表示されていれば非表示にする
  2293.       if @mes_sprites[0].visible?
  2294.         hide_message_sprite
  2295.         lines_clear
  2296.       end
  2297.     end
  2298.     # ログの自動進行
  2299.     @mesup_count -= 1
  2300.     if @mesup_count <= 0 && @mes_position > 0
  2301.       up_message_sprite
  2302.       @mes_position -= 1
  2303.       @mesup_count = LNX11::STORAGE_UP_MESSAGE_TIME
  2304.     end
  2305.     @mes_sprites.each {|sprite| sprite.update }
  2306.   end
  2307.   #--------------------------------------------------------------------------
  2308.   # ● [追加]:メッセージスプライトのリフレッシュ
  2309.   #--------------------------------------------------------------------------
  2310.   def refresh_message_sprite
  2311.     # 文章が無ければ何もしない
  2312.     return if @lines.empty?
  2313.     # スプライトを表示する
  2314.     show_message_sprite unless @mes_sprites[0].visible?
  2315.     # 文章の描画
  2316.     contents.clear
  2317.     @lines[0] = last_text
  2318.     return if @lines[0].empty?
  2319.     draw_line(0)
  2320.     @storage_number += 1
  2321.     # ウィンドウの内容をスプライトにコピー
  2322.     empty_message_sprite.set_text(self, @mes_position)
  2323.     # スプライト位置の変動    
  2324.     if @mes_position < max_line_number
  2325.       @mes_position += 1
  2326.     elsif @mesup_count > 0
  2327.       up_message_sprite
  2328.     end
  2329.     @mesup_count = (LNX11::STORAGE_UP_MESSAGE_TIME * 1.5).truncate
  2330.   end  
  2331.   #--------------------------------------------------------------------------
  2332.   # ● [オーバーライド]:フレーム更新
  2333.   #--------------------------------------------------------------------------
  2334.   def update
  2335.     super
  2336.     update_message_sprite if LNX11::BATTLELOG_TYPE == 1
  2337.   end
  2338.   #--------------------------------------------------------------------------
  2339.   # ● [エイリアス]:リフレッシュ
  2340.   #--------------------------------------------------------------------------
  2341.   alias :lnx11a_refresh :refresh
  2342.   def refresh
  2343.     return if LNX11::BATTLELOG_TYPE == 2
  2344.     LNX11::BATTLELOG_TYPE == 1 ? refresh_message_sprite : lnx11a_refresh
  2345.   end
  2346.   #--------------------------------------------------------------------------
  2347.   # ● [エイリアス]:クリア
  2348.   #--------------------------------------------------------------------------
  2349.   alias :lnx11a_clear :clear
  2350.   def clear
  2351.     return if LNX11::BATTLELOG_TYPE == 2
  2352.     LNX11::BATTLELOG_TYPE == 1 ? @storage_number = 0 : lnx11a_clear
  2353.   end
  2354.   #--------------------------------------------------------------------------
  2355.   # ● [エイリアス]:一行戻る
  2356.   #--------------------------------------------------------------------------
  2357.   alias :lnx11a_back_one :back_one
  2358.   def back_one
  2359.     if LNX11::BATTLELOG_TYPE == 1
  2360.       # 蓄積型
  2361.       @storage_number = [@storage_number - 1, 0].max
  2362.     else
  2363.       # 通常
  2364.       lnx11a_back_one
  2365.     end
  2366.   end
  2367.   #--------------------------------------------------------------------------
  2368.   # ● [エイリアス]:指定した行に戻る
  2369.   #--------------------------------------------------------------------------
  2370.   alias :lnx11a_back_to :back_to
  2371.   def back_to(line_number)
  2372.     if LNX11::BATTLELOG_TYPE == 1
  2373.       # 蓄積型
  2374.       @storage_number -= 1 while @storage_number > line_number
  2375.     else
  2376.       # 通常
  2377.       lnx11a_back_to(line_number)
  2378.     end
  2379.   end
  2380.   #--------------------------------------------------------------------------
  2381.   # ● [エイリアス]:ウェイト
  2382.   #--------------------------------------------------------------------------
  2383.   alias :lnx11a_wait :wait
  2384.   def wait
  2385.     return if LNX11::BATTLELOG_TYPE == 2
  2386.     # 元のメソッドを呼ぶ
  2387.     lnx11a_wait
  2388.   end
  2389.   #--------------------------------------------------------------------------
  2390.   # ● [エイリアス]:スキル/アイテム使用の表示
  2391.   #  使用時アニメーションの処理を追加します。
  2392.   #--------------------------------------------------------------------------
  2393.   alias :lnx11a_display_use_item :display_use_item
  2394.   def display_use_item(subject, item)
  2395.     if item.use_animation > 0
  2396.       # 使用時アニメーションが設定されていれば再生
  2397.       subject.animation_id = item.use_animation
  2398.       subject.animation_mirror = false
  2399.     end
  2400.     # 元のメソッドを呼ぶ
  2401.     lnx11a_display_use_item(subject, item)
  2402.     # アニメーションのウェイト
  2403.     wait_for_animation if item.use_animation > 0
  2404.   end
  2405.   #--------------------------------------------------------------------------
  2406.   # ● [追加]:ポップアップデータの取得
  2407.   #--------------------------------------------------------------------------
  2408.   def popup_data
  2409.     $game_temp.popup_data
  2410.   end
  2411.   #--------------------------------------------------------------------------
  2412.   # ● [エイリアス]:反撃の表示
  2413.   #--------------------------------------------------------------------------
  2414.   alias :lnx11a_display_counter :display_counter
  2415.   def display_counter(target, item)
  2416.     # ポップアップ
  2417.     popup_data.popup_text(target, :counter)
  2418.     # 元のメソッドを呼ぶ
  2419.     lnx11a_display_counter(target, item)
  2420.     # ポップアップウェイト
  2421.     popup_data.add_wait
  2422.   end
  2423.   #--------------------------------------------------------------------------
  2424.   # ● [エイリアス]:反射の表示
  2425.   #--------------------------------------------------------------------------
  2426.   alias :lnx11a_display_reflection :display_reflection
  2427.   def display_reflection(target, item)
  2428.     # ポップアップ
  2429.     popup_data.popup_text(target, :reflection)
  2430.     # 元のメソッドを呼ぶ
  2431.     lnx11a_display_reflection(target, item)
  2432.     # ポップアップウェイト
  2433.     popup_data.add_wait
  2434.   end
  2435.   #--------------------------------------------------------------------------
  2436.   # ● [エイリアス]:身代わりの表示
  2437.   #--------------------------------------------------------------------------
  2438.   alias :lnx11a_display_substitute :display_substitute
  2439.   def display_substitute(substitute, target)
  2440.     # ポップアップ
  2441.     popup_data.popup_text(substitute, :substitute)
  2442.     # 元のメソッドを呼ぶ
  2443.     lnx11a_display_substitute(substitute, target)
  2444.     # ポップアップウェイト
  2445.     popup_data.add_wait
  2446.   end
  2447.   #--------------------------------------------------------------------------
  2448.   # ● [エイリアス]:失敗の表示
  2449.   #--------------------------------------------------------------------------
  2450.   alias :lnx11a_display_failure :display_failure
  2451.   def display_failure(target, item)
  2452.     if target.result.hit? && !target.result.success
  2453.       # ポップアップ (ミスと同じ扱いにする)
  2454.       popup_data.popup_miss(target, item)
  2455.     end
  2456.     # 元のメソッドを呼ぶ
  2457.     lnx11a_display_failure(target, item)
  2458.     # ポップアップウェイト
  2459.     popup_data.add_wait
  2460.   end
  2461.   #--------------------------------------------------------------------------
  2462.   # ● [エイリアス]:ミスの表示
  2463.   #--------------------------------------------------------------------------
  2464.   alias :lnx11a_display_miss :display_miss
  2465.   def display_miss(target, item)
  2466.     # ポップアップ
  2467.     popup_data.popup_miss(target, item)
  2468.     # 元のメソッドを呼ぶ    
  2469.     lnx11a_display_miss(target, item)
  2470.     # ポップアップウェイト
  2471.     popup_data.add_wait
  2472.   end
  2473.   #--------------------------------------------------------------------------
  2474.   # ● [エイリアス]:回避の表示
  2475.   #--------------------------------------------------------------------------
  2476.   alias :lnx11a_display_evasion :display_evasion
  2477.   def display_evasion(target, item)
  2478.     # ポップアップ (ミスと同じ扱いにする)
  2479.     popup_data.popup_miss(target, item)
  2480.     # 元のメソッドを呼ぶ    
  2481.     lnx11a_display_evasion(target, item)
  2482.     # ポップアップウェイト
  2483.     popup_data.add_wait
  2484.   end
  2485.   #--------------------------------------------------------------------------
  2486.   # ● [エイリアス]:HP ダメージ表示
  2487.   #--------------------------------------------------------------------------
  2488.   alias :lnx11a_display_hp_damage :display_hp_damage
  2489.   def display_hp_damage(target, item)
  2490.     # ポップアップ
  2491.     popup_data.popup_hp_damage(target, item)
  2492.     # 元のメソッドを呼ぶ
  2493.     lnx11a_display_hp_damage(target, item)
  2494.     # ポップアップウェイト
  2495.     popup_data.add_wait
  2496.   end
  2497.   #--------------------------------------------------------------------------
  2498.   # ● [エイリアス]:MP ダメージ表示
  2499.   #--------------------------------------------------------------------------
  2500.   alias :lnx11a_display_mp_damage :display_mp_damage
  2501.   def display_mp_damage(target, item)
  2502.     # ポップアップ
  2503.     popup_data.popup_mp_damage(target, item)
  2504.     # 元のメソッドを呼ぶ
  2505.     lnx11a_display_mp_damage(target, item)
  2506.     # ポップアップウェイト
  2507.     popup_data.add_wait
  2508.   end
  2509.   #--------------------------------------------------------------------------
  2510.   # ● [エイリアス]:TP ダメージ表示
  2511.   #--------------------------------------------------------------------------
  2512.   alias :lnx11a_display_tp_damage :display_tp_damage
  2513.   def display_tp_damage(target, item)
  2514.     # ポップアップ
  2515.     popup_data.popup_tp_damage(target, item)
  2516.     # 元のメソッドを呼ぶ
  2517.     lnx11a_display_tp_damage(target, item)
  2518.     # ポップアップウェイト
  2519.     popup_data.add_wait
  2520.   end
  2521.   #--------------------------------------------------------------------------
  2522.   # ● [エイリアス]:ステート付加の表示
  2523.   #--------------------------------------------------------------------------
  2524.   alias :lnx11a_display_added_states :display_added_states
  2525.   def display_added_states(target)
  2526.     # ポップアップ
  2527.     popup_data.popup_added_states(target)
  2528.     # 元のメソッドを呼ぶ
  2529.     lnx11a_display_added_states(target)
  2530.   end
  2531.   #--------------------------------------------------------------------------
  2532.   # ● [エイリアス]:ステート解除の表示
  2533.   #--------------------------------------------------------------------------
  2534.   alias :lnx11a_display_removed_states :display_removed_states
  2535.   def display_removed_states(target)
  2536.     # ポップアップ
  2537.     popup_data.popup_removed_states(target)
  2538.     # 元のメソッドを呼ぶ
  2539.     lnx11a_display_removed_states(target)
  2540.   end
  2541.   #--------------------------------------------------------------------------
  2542.   # ● [エイリアス]:能力強化/弱体の表示(個別)
  2543.   #--------------------------------------------------------------------------
  2544.   alias :lnx11a_display_buffs :display_buffs
  2545.   def display_buffs(target, buffs, fmt)
  2546.     # ポップアップ
  2547.     popup_data.popup_buffs(target, buffs, fmt)
  2548.     # 元のメソッドを呼ぶ
  2549.     lnx11a_display_buffs(target, buffs, fmt)
  2550.   end
  2551. end
  2552.  
  2553. #==============================================================================
  2554. # ■ RPG::BaseItem
  2555. #------------------------------------------------------------------------------
  2556. #  アクター、職業、スキル、アイテム、武器、防具、敵キャラ、およびステートの
  2557. # スーパークラス。
  2558. #==============================================================================
  2559.  
  2560. class RPG::BaseItem  
  2561.   #--------------------------------------------------------------------------
  2562.   # ● [追加]:バトラーグラフィックファイル名を取得
  2563.   #--------------------------------------------------------------------------
  2564.   def default_battler_graphic
  2565.     # キャッシュがある場合、それを返す
  2566.     return @default_battler_graphic if @default_battler_graphic
  2567.     # メモ取得
  2568.     re = LNX11::RE_BATTLER =~ note
  2569.     @default_battler_graphic = re ? $1 : ""
  2570.   end
  2571.   #--------------------------------------------------------------------------
  2572.   # ● [追加]:敵キャラの通常攻撃アニメの取得
  2573.   #--------------------------------------------------------------------------
  2574.   def atk_animation
  2575.     # キャッシュがある場合、それを返す
  2576.     return @atk_animation if @atk_animation
  2577.     # メモ取得
  2578.     re = LNX11::RE_ATK_ANIMATION =~ note
  2579.     @atk_animation = re ? $1.to_i : 1
  2580.   end
  2581. end
  2582.  
  2583. #==============================================================================
  2584. # ■ RPG::UsableItem
  2585. #------------------------------------------------------------------------------
  2586. #  スキルとアイテムのスーパークラス。
  2587. #==============================================================================
  2588. class RPG::UsableItem < RPG::BaseItem
  2589.   #--------------------------------------------------------------------------
  2590.   # ● [エイリアス]:対象の選択操作が必要か否かを取得
  2591.   #--------------------------------------------------------------------------
  2592.   alias :lnx11a_need_selection? :need_selection?
  2593.   def need_selection?
  2594.     LNX11::FIX_TARGET_CHECKE && scope > 0 ? true : lnx11a_need_selection?
  2595.   end
  2596.   #--------------------------------------------------------------------------
  2597.   # ● [追加]:使用時アニメの取得
  2598.   #--------------------------------------------------------------------------
  2599.   def use_animation
  2600.     # キャッシュがある場合、それを返す
  2601.     return @use_animation if @use_animation
  2602.     # メモ取得
  2603.     re = LNX11::RE_USE_ANIMATION =~ note
  2604.     @use_animation = re ? $1.to_i : 0
  2605.   end
  2606.   #--------------------------------------------------------------------------
  2607.   # ● [追加]:簡易ヘルプ非表示の取得
  2608.   #--------------------------------------------------------------------------
  2609.   def no_display
  2610.     # キャッシュがある場合、それを返す
  2611.     return @no_display if @no_display
  2612.     # メモ取得
  2613.     re = LNX11::RE_USABLEITEM_NO_DISPLAY =~ note
  2614.     @no_display = re ? true : false
  2615.   end
  2616.   #--------------------------------------------------------------------------
  2617.   # ● [追加]:使用時追加ウェイトの取得
  2618.   #--------------------------------------------------------------------------
  2619.   def display_wait
  2620.     # キャッシュがある場合、それを返す
  2621.     return @display_wait if @display_wait
  2622.     # メモ取得
  2623.     re = LNX11::RE_DISPLAY_WAIT =~ note
  2624.     @display_wait = re ? $1.to_i : LNX11::HELPDISPLAT_WAIT
  2625.   end
  2626.   #--------------------------------------------------------------------------
  2627.   # ● [追加]:終了時追加ウェイトの取得
  2628.   #--------------------------------------------------------------------------
  2629.   def end_wait
  2630.     # キャッシュがある場合、それを返す
  2631.     return @end_wait if @end_wait
  2632.     # メモ取得
  2633.     re = LNX11::RE_END_WAIT =~ note
  2634.     @end_wait = re ? $1.to_i : LNX11::HELPDISPLAT_END_WAIT
  2635.   end
  2636.   #--------------------------------------------------------------------------
  2637.   # ● [追加]:簡易ヘルプ説明を取得
  2638.   #--------------------------------------------------------------------------
  2639.   def short_description
  2640.     # キャッシュがある場合、それを返す
  2641.     return @short_description if @short_description
  2642.     # メモ取得
  2643.     re = LNX11::RE_SHORT_DESCRIPTION =~ note
  2644.     @short_description = re ? $1 : ""
  2645.   end
  2646. end
  2647.  
  2648. #==============================================================================
  2649. # ■ RPG::State
  2650. #------------------------------------------------------------------------------
  2651. #  ステートのデータクラス。
  2652. #==============================================================================
  2653.  
  2654. class RPG::State < RPG::BaseItem
  2655.   #--------------------------------------------------------------------------
  2656.   # ● [追加]:ステートアニメの取得
  2657.   #--------------------------------------------------------------------------
  2658.   def state_animation
  2659.     # キャッシュがある場合、それを返す
  2660.     return @state_animation if @state_animation
  2661.     # メモ取得
  2662.     re = LNX11::RE_STATE_ANIMATION =~ note
  2663.     @state_animation = re ? $1.to_i : 0
  2664.   end
  2665.   #--------------------------------------------------------------------------
  2666.   # ● [追加]:ポップアップ表示名の取得
  2667.   # <<ver1.10>>
  2668.   #  このメソッドは付加/解除ポップアップ表示名が設定されていない場合のみ
  2669.   # 呼び出されるようになりました。
  2670.   #--------------------------------------------------------------------------
  2671.   def display_name
  2672.     # キャッシュがある場合、それを返す
  2673.     return @display_name if @display_name
  2674.     # メモ取得
  2675.     re = LNX11::RE_STATE_DISPLAY =~ note
  2676.     @display_name = re ? $1 : name
  2677.   end
  2678.   #--------------------------------------------------------------------------
  2679.   # ● [追加]:付加ポップアップ表示名の取得 <<ver1.10>>
  2680.   #--------------------------------------------------------------------------
  2681.   def add_display_name
  2682.     # キャッシュがある場合、それを返す
  2683.     return @add_display_name if @add_display_name
  2684.     # メモ取得
  2685.     re = LNX11::RE_STATE_ADD_DISPLAY =~ note
  2686.     @add_display_name = re ? $1 : display_name
  2687.   end
  2688.   #--------------------------------------------------------------------------
  2689.   # ● [追加]:解除ポップアップ表示名の取得 <<ver1.10>>
  2690.   #--------------------------------------------------------------------------
  2691.   def remove_display_name
  2692.     # キャッシュがある場合、それを返す
  2693.     return @remove_display_name if @remove_display_name
  2694.     # メモ取得
  2695.     re = LNX11::RE_STATE_REM_DISPLAY =~ note
  2696.     @remove_display_name = re ? $1 : display_name
  2697.   end
  2698.   #--------------------------------------------------------------------------
  2699.   # ● [追加]:ポップアップ非表示の取得
  2700.   #--------------------------------------------------------------------------
  2701.   def no_display?
  2702.     # キャッシュがある場合、それを返す
  2703.     return @no_display if @no_display
  2704.     # 付加/解除のどちらかで設定されていれば無視する
  2705.     if LNX11::RE_STATE_ADD_NO_DISPLAY =~ note ||
  2706.        LNX11::RE_STATE_REM_NO_DISPLAY =~ note
  2707.       return @no_display = false
  2708.     end
  2709.     # メモ取得
  2710.     re = LNX11::RE_STATE_NO_DISPLAY =~ note
  2711.     @no_display = re ? true : false
  2712.   end
  2713.   #--------------------------------------------------------------------------
  2714.   # ● [追加]:付加ポップアップ非表示の取得
  2715.   #--------------------------------------------------------------------------
  2716.   def add_no_display?
  2717.     return true if no_display?
  2718.     # キャッシュがある場合、それを返す
  2719.     return @add_no_display if @add_no_display
  2720.     # メモ取得
  2721.     re = LNX11::RE_STATE_ADD_NO_DISPLAY =~ note
  2722.     @add_no_display = re ? true : false
  2723.   end
  2724.   #--------------------------------------------------------------------------
  2725.   # ● [追加]:解除ポップアップ非表示の取得
  2726.   #--------------------------------------------------------------------------
  2727.   def remove_no_display?
  2728.     return true if no_display?
  2729.     # キャッシュがある場合、それを返す
  2730.     return @remove_no_display if @remove_no_display
  2731.     # メモ取得
  2732.     re = LNX11::RE_STATE_REM_NO_DISPLAY =~ note
  2733.     @remove_no_display = re ? true : false
  2734.   end
  2735.   #--------------------------------------------------------------------------
  2736.   # ● [追加]:有利なステートの取得
  2737.   #--------------------------------------------------------------------------
  2738.   def advantage?
  2739.     # キャッシュがある場合、それを返す
  2740.     return @advantage if @advantage
  2741.     # メモ取得
  2742.     re = LNX11::RE_STATE_ADVANTAGE =~ note
  2743.     @advantage = re ? true : false
  2744.   end
  2745.   #--------------------------------------------------------------------------
  2746.   # ● [追加]:ポップアップタイプの取得
  2747.   #--------------------------------------------------------------------------
  2748.   def popup_type
  2749.     # キャッシュがある場合、それを返す
  2750.     return @popup_type if @popup_type != nil
  2751.     # 付加/解除のどちらかで設定されていれば無視する
  2752.     if LNX11::RE_STATE_ADD_TYPE =~ note ||
  2753.        LNX11::RE_STATE_REM_TYPE =~ note
  2754.       return @popup_type = false
  2755.     end
  2756.     # メモ取得
  2757.     re = LNX11::RE_STATE_TYPE =~ note
  2758.     @popup_type = re ? $1.to_i : false
  2759.   end
  2760.   #--------------------------------------------------------------------------
  2761.   # ● [追加]:付加ポップアップタイプの取得
  2762.   #--------------------------------------------------------------------------
  2763.   def add_popup_type
  2764.     return popup_type if popup_type
  2765.     # キャッシュがある場合、それを返す
  2766.     return @add_popup_type if @add_popup_type != nil
  2767.     # メモ取得
  2768.     re = LNX11::RE_STATE_ADD_TYPE =~ note
  2769.     @add_popup_type = re ? $1.to_i : false
  2770.   end
  2771.   #--------------------------------------------------------------------------
  2772.   # ● [追加]:解除ポップアップタイプの取得
  2773.   #--------------------------------------------------------------------------
  2774.   def remove_popup_type
  2775.     return popup_type if popup_type
  2776.     # キャッシュがある場合、それを返す
  2777.     return @remove_popup_type if @remove_popup_type != nil
  2778.     # メモ取得
  2779.     re = LNX11::RE_STATE_REM_TYPE =~ note
  2780.     @remove_popup_type = re ? $1.to_i : false
  2781.   end
  2782.   #--------------------------------------------------------------------------
  2783.   # ● [追加]:修飾文字非表示の取得
  2784.   #--------------------------------------------------------------------------
  2785.   def no_decoration?
  2786.     # キャッシュがある場合、それを返す
  2787.     return @no_decoration if @no_decoration
  2788.     # 付加/解除のどちらかで設定されていれば無視する
  2789.     if LNX11::RE_STATE_ADD_NO_DECORATION =~ note ||
  2790.        LNX11::RE_STATE_REM_NO_DECORATION =~ note
  2791.       return @no_decoration = false
  2792.     end
  2793.     # メモ取得
  2794.     re = LNX11::RE_STATE_NO_DECORATION =~ note
  2795.     @no_decoration = re ? true : false
  2796.   end
  2797.   #--------------------------------------------------------------------------
  2798.   # ● [追加]:付加修飾文字非表示の取得
  2799.   #--------------------------------------------------------------------------
  2800.   def add_no_decoration?
  2801.     return true if no_decoration?
  2802.     # キャッシュがある場合、それを返す
  2803.     return @add_no_decoration if @add_no_decoration
  2804.     # メモ取得
  2805.     re = LNX11::RE_STATE_ADD_NO_DECORATION =~ note
  2806.     @add_no_decoration = re ? true : false
  2807.   end
  2808.   #--------------------------------------------------------------------------
  2809.   # ● [追加]:解除修飾文字非表示の取得
  2810.   #--------------------------------------------------------------------------
  2811.   def remove_no_decoration?
  2812.     return true if no_decoration?
  2813.     # キャッシュがある場合、それを返す
  2814.     return @remove_no_decoration if @remove_no_decoration
  2815.     # メモ取得
  2816.     re = LNX11::RE_STATE_REM_NO_DECORATION =~ note
  2817.     @remove_no_decoration = re ? true : false
  2818.   end
  2819. end
  2820.  
  2821. #==============================================================================
  2822. # ■ BattleManager
  2823. #------------------------------------------------------------------------------
  2824. #  戦闘の進行を管理するモジュールです。
  2825. #==============================================================================
  2826.  
  2827. class << BattleManager
  2828.   #--------------------------------------------------------------------------
  2829.   # ● [追加]:公開インスタンス変数
  2830.   #--------------------------------------------------------------------------
  2831.   attr_reader   :preemptive             # 先制攻撃フラグ
  2832.   attr_reader   :surprise               # 不意打ちフラグ
  2833.   attr_accessor :log_window             # バトルログウィンドウ
  2834.   attr_accessor :update_for_wait_method # ウェイト中のフレーム更新
  2835.   attr_accessor :helpdisplay_set_method        # 簡易ヘルプ表示
  2836.   attr_accessor :helpdisplay_clear_method      # 簡易ヘルプ消去
  2837.   attr_accessor :helpdisplay_wait_short_method # 簡易ヘルプ・短時間ウェイト
  2838.   #--------------------------------------------------------------------------
  2839.   # ● [追加]:簡易ヘルプ表示
  2840.   #--------------------------------------------------------------------------
  2841.   def helpdisplay_set(*args)
  2842.     @helpdisplay_set_method.call(*args) if @helpdisplay_set_method
  2843.   end
  2844.   #--------------------------------------------------------------------------
  2845.   # ● [追加]:簡易ヘルプ消去
  2846.   #--------------------------------------------------------------------------
  2847.   def helpdisplay_clear(*args)
  2848.     @helpdisplay_clear_method.call(*args) if @helpdisplay_clear_method
  2849.   end
  2850.   #--------------------------------------------------------------------------
  2851.   # ● [追加]:簡易ヘルプ・短時間ウェイト
  2852.   #--------------------------------------------------------------------------
  2853.   def helpdisplay_wait_short
  2854.     @helpdisplay_wait_short_method.call if @helpdisplay_wait_short_method
  2855.   end
  2856.   #--------------------------------------------------------------------------
  2857.   # ● [追加]:キー入力待ち
  2858.   #--------------------------------------------------------------------------
  2859.   def helpdisplay_wait_input
  2860.     return if $game_message.helpdisplay_texts.empty?
  2861.     return if LNX11::MESSAGE_TYPE == 0
  2862.     return if !@helpdisplay_wait_input || !@update_for_wait_method
  2863.     update_for_wait_method.call while !Input.press?(:B) && !Input.press?(:C)
  2864.   end
  2865.   #--------------------------------------------------------------------------
  2866.   # ● [追加]:メッセージ進行の SE 再生
  2867.   #--------------------------------------------------------------------------
  2868.   def messagedisplay_se_play
  2869.     return if !@helpdisplay_se
  2870.     @helpdisplay_se.play  
  2871.     @helpdisplay_se = nil if @helpdisplay_se == LNX11::LEVELUP_SE
  2872.   end
  2873.   #--------------------------------------------------------------------------
  2874.   # ● [追加]:メッセージ進行
  2875.   #--------------------------------------------------------------------------
  2876.   def process_messagedisplay(wait)
  2877.     return if $game_message.helpdisplay_texts.empty?
  2878.     return if LNX11::MESSAGE_TYPE == 0
  2879.     $game_temp.battlelog_clear = true
  2880.     BattleManager.log_window.update
  2881.     if LNX11::BATTLELOG_TYPE == 2 || LNX11::MESSAGE_TYPE == 2
  2882.       # 簡易ヘルプ
  2883.       $game_message.helpdisplay_texts.each do |text|
  2884.         helpdisplay_wait_short
  2885.         messagedisplay_se_play
  2886.         helpdisplay_set(text, wait)
  2887.         helpdisplay_wait_input
  2888.       end
  2889.       helpdisplay_clear
  2890.     elsif LNX11::BATTLELOG_TYPE == 0
  2891.       # VXAceデフォルト
  2892.       BattleManager.log_window.clear
  2893.       $game_message.helpdisplay_texts.each do |text|
  2894.         messagedisplay_se_play
  2895.         BattleManager.log_window.add_text(text)
  2896.         BattleManager.log_window.abs_wait(wait)
  2897.         helpdisplay_wait_input
  2898.         max = BattleManager.log_window.max_line_number
  2899.         # 表示がいっぱいになったら消去
  2900.         if BattleManager.log_window.line_number >= max
  2901.           BattleManager.log_window.clear
  2902.         end
  2903.       end
  2904.       BattleManager.log_window.clear
  2905.     elsif LNX11::BATTLELOG_TYPE == 1
  2906.       # 蓄積型
  2907.       $game_message.helpdisplay_texts.each do |text|
  2908.         messagedisplay_se_play
  2909.         BattleManager.log_window.add_text(text)
  2910.         BattleManager.log_window.abs_wait(wait)
  2911.         helpdisplay_wait_input
  2912.       end
  2913.       $game_temp.battlelog_clear = true
  2914.       BattleManager.log_window.update
  2915.     end
  2916.     $game_message.helpdisplay_texts.clear
  2917.   end
  2918.   #--------------------------------------------------------------------------
  2919.   # ● [エイリアス]:メッセージ表示が終わるまでウェイト
  2920.   #--------------------------------------------------------------------------
  2921.   alias :lnx11a_wait_for_message :wait_for_message
  2922.   def wait_for_message
  2923.     # 簡易ヘルプ表示
  2924.     process_messagedisplay(@helpdisplay_wait ? @helpdisplay_wait : 60)
  2925.     return if $game_message.texts.empty?
  2926.     # 元のメソッドを呼ぶ
  2927.     lnx11a_wait_for_message
  2928.   end  
  2929.   #--------------------------------------------------------------------------
  2930.   # ● [エイリアス]:戦闘開始
  2931.   #--------------------------------------------------------------------------
  2932.   alias :lnx11a_battle_start :battle_start
  2933.   def battle_start    
  2934.     @helpdisplay_wait = LNX11::MESSAGE_WAIT[:battle_start][0]
  2935.     @helpdisplay_wait_input = LNX11::MESSAGE_WAIT[:battle_start][1]
  2936.     # メッセージウィンドウへのテキスト追加を禁止する
  2937.     $game_message.add_disabled
  2938.     # 元のメソッドを呼ぶ
  2939.     lnx11a_battle_start
  2940.     # メッセージウィンドウへのテキスト追加を許可する
  2941.     $game_message.add_enabled
  2942.     @helpdisplay_wait = nil
  2943.     @helpdisplay_wait_input = nil
  2944.   end
  2945.   #--------------------------------------------------------------------------
  2946.   # ● [エイリアス]:勝利の処理
  2947.   #--------------------------------------------------------------------------
  2948.   alias :lnx11a_process_victory :process_victory
  2949.   def process_victory
  2950.     @helpdisplay_wait = LNX11::MESSAGE_WAIT[:victory][0]
  2951.     @helpdisplay_wait_input = LNX11::MESSAGE_WAIT[:victory][1]
  2952.     # メッセージウィンドウへのテキスト追加を禁止する
  2953.     $game_message.add_disabled
  2954.     # 元のメソッドを呼ぶ
  2955.     success = lnx11a_process_victory
  2956.     # メッセージウィンドウへのテキスト追加を許可する
  2957.     $game_message.add_enabled
  2958.     @helpdisplay_wait = nil
  2959.     @helpdisplay_wait_input = nil
  2960.     return success
  2961.   end
  2962.   #--------------------------------------------------------------------------
  2963.   # ● [エイリアス]:逃走の処理
  2964.   #--------------------------------------------------------------------------
  2965.   alias :lnx11a_process_escape :process_escape
  2966.   def process_escape
  2967.     @helpdisplay_wait = LNX11::MESSAGE_WAIT[:escape][0]
  2968.     @helpdisplay_wait_input = LNX11::MESSAGE_WAIT[:escape][1]
  2969.     # メッセージウィンドウへのテキスト追加を禁止する
  2970.     $game_message.add_disabled
  2971.     # 元のメソッドを呼ぶ
  2972.     success = lnx11a_process_escape
  2973.     # メッセージウィンドウへのテキスト追加を許可する
  2974.     $game_message.add_enabled
  2975.     @helpdisplay_wait = nil
  2976.     @helpdisplay_wait_input = nil
  2977.     return success
  2978.   end
  2979.   #--------------------------------------------------------------------------
  2980.   # ● [エイリアス]:敗北の処理
  2981.   #--------------------------------------------------------------------------
  2982.   alias :lnx11a_process_defeat :process_defeat
  2983.   def process_defeat
  2984.     @helpdisplay_wait = LNX11::MESSAGE_WAIT[:defeat][0]
  2985.     @helpdisplay_wait_input = LNX11::MESSAGE_WAIT[:defeat][1]
  2986.     # メッセージウィンドウへのテキスト追加を禁止する
  2987.     $game_message.add_disabled
  2988.     # 元のメソッドを呼ぶ
  2989.     success = lnx11a_process_defeat
  2990.     # メッセージウィンドウへのテキスト追加を許可する
  2991.     $game_message.add_enabled
  2992.     @helpdisplay_wait = nil
  2993.     @helpdisplay_wait_input = nil
  2994.     return success
  2995.   end
  2996.   #--------------------------------------------------------------------------
  2997.   # ● [エイリアス]:ドロップアイテムの獲得と表示
  2998.   #--------------------------------------------------------------------------
  2999.   alias :lnx11a_gain_drop_items :gain_drop_items
  3000.   def gain_drop_items
  3001.     helpdisplay_clear
  3002.     @helpdisplay_wait = LNX11::MESSAGE_WAIT[:drop_item][0]
  3003.     @helpdisplay_wait_input = LNX11::MESSAGE_WAIT[:drop_item][1]
  3004.     @helpdisplay_se = LNX11::DROPITEM_SE
  3005.     # 元のメソッドを呼ぶ
  3006.     lnx11a_gain_drop_items
  3007.     @helpdisplay_wait = nil
  3008.     @helpdisplay_wait_input = nil
  3009.     @helpdisplay_se = nil
  3010.   end
  3011.   #--------------------------------------------------------------------------
  3012.   # ● [再定義]:経験値の獲得とレベルアップの表示
  3013.   #--------------------------------------------------------------------------
  3014.   def gain_exp
  3015.     @helpdisplay_wait = LNX11::MESSAGE_WAIT[:levelup][0]
  3016.     @helpdisplay_wait_input = LNX11::MESSAGE_WAIT[:levelup][1]
  3017.     $game_party.all_members.each do |actor|
  3018.       @helpdisplay_se = LNX11::LEVELUP_SE
  3019.       actor.gain_exp($game_troop.exp_total)
  3020.       # レベルアップ毎にメッセージ表示ウェイト
  3021.       wait_for_message
  3022.     end
  3023.     @helpdisplay_wait = nil
  3024.     @helpdisplay_wait_input = nil
  3025.     @helpdisplay_se = nil
  3026.   end
  3027. end
  3028.  
  3029. #==============================================================================
  3030. # ■ Game_Temp
  3031. #------------------------------------------------------------------------------
  3032. #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン
  3033. # スタンスは $game_temp で参照されます。
  3034. #==============================================================================
  3035.  
  3036. class Game_Temp
  3037.   #--------------------------------------------------------------------------
  3038.   # ● [追加]:公開インスタンス変数
  3039.   #--------------------------------------------------------------------------
  3040.   attr_accessor :popup_data            # ポップアップスプライト
  3041.   attr_accessor :actor_battler_graphic # アクターのバトラーグラフィック
  3042.   attr_accessor :battlelog_clear       # バトルログ消去フラグ
  3043.   attr_accessor :target_cursor_sprite  # ターゲットカーソルスプライト
  3044.   attr_accessor :last_target_cursor    # 対象選択のカーソル記憶
  3045.   #--------------------------------------------------------------------------
  3046.   # ● [エイリアス]:オブジェクト初期化
  3047.   #--------------------------------------------------------------------------
  3048.   alias :lnx11a_initialize :initialize
  3049.   def initialize
  3050.     # 元のメソッドを呼ぶ
  3051.     lnx11a_initialize
  3052.     # 追加
  3053.     @popup_data = nil
  3054.     @actor_battler_graphic = []
  3055.     @battlelog_clear = false
  3056.     @battle_status_refresh = nil
  3057.     @target_cursor_sprite = nil
  3058.     clear_last_target_cursor
  3059.   end
  3060.   #--------------------------------------------------------------------------
  3061.   # ● [追加]:バトルステータス更新メソッドの設定
  3062.   #--------------------------------------------------------------------------
  3063.   def method_battle_status_refresh=(method)
  3064.     @battle_status_refresh = method
  3065.   end
  3066.   #--------------------------------------------------------------------------
  3067.   # ● [追加]:バトルステータス更新
  3068.   #--------------------------------------------------------------------------
  3069.   def battle_status_refresh
  3070.     return unless $game_party.in_battle
  3071.     @battle_status_refresh.call if @battle_status_refresh
  3072.   end
  3073.   #--------------------------------------------------------------------------
  3074.   # ● [追加]:対象選択のカーソル記憶をクリア
  3075.   #--------------------------------------------------------------------------
  3076.   def clear_last_target_cursor
  3077.     @last_target_cursor = {:actor => nil, :enemy => nil}
  3078.   end
  3079. end
  3080.  
  3081. #==============================================================================
  3082. # ■ Game_Action
  3083. #------------------------------------------------------------------------------
  3084. #  戦闘行動を扱うクラスです。
  3085. #==============================================================================
  3086.  
  3087. class Game_Action
  3088.   #--------------------------------------------------------------------------
  3089.   # ● [エイリアス]:ターゲットの配列作成
  3090.   #--------------------------------------------------------------------------
  3091.   alias :lnx11a_make_targets :make_targets
  3092.   def make_targets    
  3093.     if LNX11::TROOP_X_SORT
  3094.       # 元のメソッドを呼んでソート
  3095.       return lnx11a_make_targets.sort {|a,b| a.screen_x <=> b.screen_x}
  3096.     else
  3097.       return lnx11a_make_targets
  3098.     end
  3099.   end
  3100. end
  3101.  
  3102. #==============================================================================
  3103. # ■ Game_ActionResult
  3104. #------------------------------------------------------------------------------
  3105. #  戦闘行動の結果を扱うクラスです。属性に関する結果を追加します。
  3106. #==============================================================================
  3107.  
  3108. class Game_ActionResult
  3109.   #--------------------------------------------------------------------------
  3110.   # ● 公開インスタンス変数
  3111.   #--------------------------------------------------------------------------
  3112.   attr_accessor :element_rate               # 属性修正値
  3113.   #--------------------------------------------------------------------------
  3114.   # ● ダメージ値のクリア
  3115.   #--------------------------------------------------------------------------
  3116.   alias :lnx11a_clear_damage_values :clear_damage_values
  3117.   def clear_damage_values
  3118.     # 元のメソッドを呼ぶ
  3119.     lnx11a_clear_damage_values
  3120.     # 属性修正値をクリア
  3121.     @element_rate = 1.0
  3122.   end
  3123.   #--------------------------------------------------------------------------
  3124.   # ● [追加]:属性修正値の取得
  3125.   #--------------------------------------------------------------------------
  3126.   def element_rate
  3127.     return @element_rate if @element_rate
  3128.     @element_rate = 1.0
  3129.   end
  3130. end
  3131.  
  3132. #==============================================================================
  3133. # ■ Game_BattlerBase
  3134. #------------------------------------------------------------------------------
  3135. #  バトラーを扱う基本のクラスです。
  3136. #==============================================================================
  3137.  
  3138. class Game_BattlerBase
  3139.   #--------------------------------------------------------------------------
  3140.   # ● [追加]:ポップアップデータの取得
  3141.   #--------------------------------------------------------------------------
  3142.   def popup_data
  3143.     $game_temp.popup_data
  3144.   end
  3145.   #--------------------------------------------------------------------------
  3146.   # ● [エイリアス]:スキル使用コストの支払い
  3147.   #--------------------------------------------------------------------------
  3148.   alias :lnx11a_pay_skill_cost :pay_skill_cost
  3149.   def pay_skill_cost(skill)
  3150.     rmp = self.mp
  3151.     rtp = self.tp
  3152.     # 元のメソッドを呼ぶ    
  3153.     lnx11a_pay_skill_cost(skill)
  3154.     return unless $game_party.in_battle
  3155.     # ポップアップ
  3156.     popup_data.popup_regenerate_mp(self, (rmp - self.mp).truncate, true)
  3157.     popup_data.popup_regenerate_tp(self, (rtp - self.tp).truncate, true)
  3158.   end
  3159. end
  3160.  
  3161. #==============================================================================
  3162. # ■ Game_Battler
  3163. #------------------------------------------------------------------------------
  3164. #  スプライトに関するメソッドを追加したバトラーのクラスです。
  3165. #==============================================================================
  3166.  
  3167. class Game_Battler < Game_BattlerBase
  3168.   #--------------------------------------------------------------------------
  3169.   # ● 公開インスタンス変数
  3170.   #--------------------------------------------------------------------------
  3171.   attr_accessor :loop_animation_id     # ループアニメーション ID
  3172.   attr_accessor :loop_animation_mirror # ループアニメーション 左右反転フラグ
  3173.   #--------------------------------------------------------------------------
  3174.   # ● [エイリアス]:スプライトのエフェクトをクリア
  3175.   #--------------------------------------------------------------------------
  3176.   alias :lnx11a_clear_sprite_effects :clear_sprite_effects
  3177.   def clear_sprite_effects
  3178.     # 元のメソッドを呼ぶ
  3179.     lnx11a_clear_sprite_effects
  3180.     @loop_animation_id = 0
  3181.     @loop_animation_mirror = false
  3182.   end
  3183.   #--------------------------------------------------------------------------
  3184.   # ● [追加]:ステートのループアニメーションの設定
  3185.   #--------------------------------------------------------------------------
  3186.   def set_state_animation
  3187.     # 表示優先度が高いステートを優先
  3188.     sort_states
  3189.     anime = @states.collect {|id| $data_states[id].state_animation }
  3190.     anime.delete(0)
  3191.     @loop_animation_id = anime[0] ? anime[0] : 0
  3192.   end
  3193.   #--------------------------------------------------------------------------
  3194.   # ● [エイリアス]:ステート情報をクリア
  3195.   #--------------------------------------------------------------------------
  3196.   alias :lnx11a_clear_states :clear_states
  3197.   def clear_states
  3198.     # 元のメソッドを呼ぶ
  3199.     lnx11a_clear_states
  3200.     # ステートアニメ設定
  3201.     set_state_animation
  3202.   end
  3203.   #--------------------------------------------------------------------------
  3204.   # ● [エイリアス]:ステートの付加
  3205.   #--------------------------------------------------------------------------
  3206.   alias :lnx11a_add_state :add_state
  3207.   def add_state(state_id)
  3208.     # 元のメソッドを呼ぶ
  3209.     lnx11a_add_state(state_id)
  3210.     # ステートアニメ設定
  3211.     set_state_animation
  3212.   end
  3213.   #--------------------------------------------------------------------------
  3214.   # ● [エイリアス]:ステートの解除
  3215.   #--------------------------------------------------------------------------
  3216.   alias :lnx11a_remove_state :remove_state
  3217.   def remove_state(state_id)
  3218.     # 元のメソッドを呼ぶ
  3219.     lnx11a_remove_state(state_id)
  3220.     # ステートアニメ設定
  3221.     set_state_animation
  3222.   end
  3223.   #--------------------------------------------------------------------------
  3224.   # ● [追加]:ポップアップディレイの取得
  3225.   #--------------------------------------------------------------------------
  3226.   def popup_delay
  3227.     return @popup_delay if @popup_delay
  3228.     popup_delay_clear
  3229.   end
  3230.   #--------------------------------------------------------------------------
  3231.   # ● [追加]:ポップアップディレイの設定
  3232.   #--------------------------------------------------------------------------
  3233.   def popup_delay=(delay)
  3234.     @popup_delay = delay
  3235.   end
  3236.   #--------------------------------------------------------------------------
  3237.   # ● [追加]:ポップアップディレイの設定
  3238.   #--------------------------------------------------------------------------
  3239.   def popup_delay_clear
  3240.     @popup_delay = Array.new(16) { 0 }
  3241.   end
  3242.   #--------------------------------------------------------------------------
  3243.   # ● [エイリアス]:スキル/アイテムの属性修正値を取得
  3244.   #  弱点/耐性の判定を追加します。
  3245.   #--------------------------------------------------------------------------
  3246.   alias :lnx11a_item_element_rate :item_element_rate
  3247.   def item_element_rate(user, item)
  3248.     # 元のメソッドを呼ぶ
  3249.     rate = lnx11a_item_element_rate(user, item)
  3250.     return rate unless $game_party.in_battle
  3251.     # レートを結果に保存する
  3252.     @result.element_rate = rate
  3253.     rate
  3254.   end
  3255.   #--------------------------------------------------------------------------
  3256.   # ● [エイリアス]:ダメージの処理
  3257.   #  吸収による回復のポップアップを生成します。
  3258.   #--------------------------------------------------------------------------
  3259.   alias :lnx11a_execute_damage :execute_damage
  3260.   def execute_damage(user)
  3261.     # 元のメソッドを呼ぶ
  3262.     lnx11a_execute_damage(user)
  3263.     return unless $game_party.in_battle
  3264.     # ポップアップ
  3265.     popup_data.popup_hp_drain(user, @result.hp_drain)
  3266.     popup_data.popup_mp_drain(user, @result.mp_drain)
  3267.   end
  3268.   #--------------------------------------------------------------------------
  3269.   # ● [エイリアス]:HP の再生
  3270.   #--------------------------------------------------------------------------
  3271.   alias :lnx11a_regenerate_hp :regenerate_hp
  3272.   def regenerate_hp
  3273.     # 元のメソッドを呼ぶ
  3274.     lnx11a_regenerate_hp
  3275.     return unless $game_party.in_battle
  3276.     # ポップアップ
  3277.     popup_data.popup_regenerate_hp(self, @result.hp_damage)
  3278.   end
  3279.   #--------------------------------------------------------------------------
  3280.   # ● [エイリアス]:MP の再生
  3281.   #--------------------------------------------------------------------------
  3282.   alias :lnx11a_regenerate_mp :regenerate_mp
  3283.   def regenerate_mp
  3284.     # 元のメソッドを呼ぶ
  3285.     lnx11a_regenerate_mp
  3286.     return unless $game_party.in_battle
  3287.     # ポップアップ
  3288.     popup_data.popup_regenerate_mp(self, @result.mp_damage)
  3289.   end
  3290.   #--------------------------------------------------------------------------
  3291.   # ● [エイリアス]:TP の再生
  3292.   #--------------------------------------------------------------------------
  3293.   alias :lnx11a_regenerate_tp :regenerate_tp
  3294.   def regenerate_tp
  3295.     rtp = self.tp.to_i
  3296.     # 元のメソッドを呼ぶ
  3297.     lnx11a_regenerate_tp
  3298.     return unless $game_party.in_battle
  3299.     # ポップアップ
  3300.     popup_data.popup_regenerate_tp(self, rtp - self.tp.to_i)
  3301.   end
  3302.   #--------------------------------------------------------------------------
  3303.   # ● 被ダメージによる TP チャージ
  3304.   #--------------------------------------------------------------------------
  3305.   alias :lnx11a_charge_tp_by_damage :charge_tp_by_damage
  3306.   def charge_tp_by_damage(damage_rate)
  3307.     rtp = self.tp.to_i
  3308.     # 元のメソッドを呼ぶ
  3309.     lnx11a_charge_tp_by_damage(damage_rate)
  3310.     return unless $game_party.in_battle
  3311.     # ポップアップ
  3312.     popup_data.popup_tp_charge(self, rtp - self.tp.to_i)
  3313.   end
  3314.   #--------------------------------------------------------------------------
  3315.   # ● [エイリアス]:スキル/アイテムの使用者側への効果(TP 得)
  3316.   #--------------------------------------------------------------------------
  3317.   alias :lnx11a_item_user_effect :item_user_effect
  3318.   def item_user_effect(user, item)
  3319.     rtp = user.tp.to_i
  3320.     # 元のメソッドを呼ぶ
  3321.     lnx11a_item_user_effect(user, item)
  3322.     return unless $game_party.in_battle
  3323.     # ポップアップ
  3324.     popup_data.popup_tp_gain(user, rtp - user.tp.to_i)
  3325.   end
  3326.   #--------------------------------------------------------------------------
  3327.   # ● [追加]:高さの取得
  3328.   #--------------------------------------------------------------------------
  3329.   def bitmap_height
  3330.     return @bitmap_height if @bitmap_height
  3331.     @bitmap_height = 0
  3332.   end
  3333.   #--------------------------------------------------------------------------
  3334.   # ● [追加]:高さの設定
  3335.   #--------------------------------------------------------------------------
  3336.   def bitmap_height=(y)
  3337.     @bitmap_height = y
  3338.   end
  3339.   #--------------------------------------------------------------------------
  3340.   # ● [追加]:バトル画面 Y 座標(頭上)の取得
  3341.   #--------------------------------------------------------------------------
  3342.   def screen_y_top
  3343.     screen_y - @bitmap_height
  3344.   end
  3345.   #--------------------------------------------------------------------------
  3346.   # ● [追加]:バトル画面 Y 座標(中心)の取得
  3347.   #--------------------------------------------------------------------------
  3348.   def screen_y_center
  3349.     screen_y - @bitmap_height / 2
  3350.   end
  3351. end
  3352.  
  3353. #==============================================================================
  3354. # ■ Game_Actor
  3355. #------------------------------------------------------------------------------
  3356. #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
  3357. # の内部で使用され、Game_Party クラス($game_party)からも参照されます。
  3358. #==============================================================================
  3359.  
  3360. class Game_Actor < Game_Battler
  3361.   #--------------------------------------------------------------------------
  3362.   # ● [追加]:公開インスタンス変数
  3363.   #--------------------------------------------------------------------------
  3364.   attr_accessor :battler_graphic_name    # 後指定のバトラーグラフィック
  3365.   attr_accessor :refresh_battler_graphic # バトラーグラフィックの更新フラグ
  3366.   attr_accessor :screen_x                # バトル画面 X 座標
  3367.   attr_accessor :screen_y                # バトル画面 Y 座標
  3368.   attr_accessor :last_actor_command      # 最後に選択したコマンド
  3369.   #--------------------------------------------------------------------------
  3370.   # ● [再定義]:スプライトを使うか?
  3371.   #--------------------------------------------------------------------------
  3372.   def use_sprite?
  3373.     return true # 使う
  3374.   end
  3375.   #--------------------------------------------------------------------------
  3376.   # ● [追加]:バトル画面 Z 座標の取得
  3377.   #--------------------------------------------------------------------------
  3378.   def screen_z
  3379.     return $game_party.members_screen_z[0] if index == nil
  3380.     return $game_party.members_screen_z[index] # Game_EnemyのZ座標は100
  3381.   end
  3382.   #--------------------------------------------------------------------------
  3383.   # ● [エイリアス]:ダメージ効果の実行
  3384.   #--------------------------------------------------------------------------
  3385.   alias :lnx11a_perform_damage_effect :perform_damage_effect
  3386.   def perform_damage_effect
  3387.     # 元のメソッドを呼ぶ
  3388.     lnx11a_perform_damage_effect
  3389.     # シェイクを無効にしている場合、シェイクをクリア
  3390.     $game_troop.screen.clear_shake if LNX11::DISABLED_DAMAGE_SHAKE
  3391.   end
  3392.   #--------------------------------------------------------------------------
  3393.   # ● [再定義]:コラプス効果の実行
  3394.   #  アクターの[特徴>その他>消滅エフェクト]の設定を適用するようにします。
  3395.   #  処理内容は Game_Enemy のものとほぼ同一です。
  3396.   #--------------------------------------------------------------------------
  3397.   def perform_collapse_effect
  3398.     if $game_party.in_battle
  3399.       case collapse_type
  3400.       when 0
  3401.         @sprite_effect_type = :collapse
  3402.         Sound.play_actor_collapse
  3403.       when 1
  3404.         @sprite_effect_type = :boss_collapse
  3405.         Sound.play_boss_collapse1
  3406.       when 2
  3407.         @sprite_effect_type = :instant_collapse
  3408.       end
  3409.     end
  3410.   end
  3411.   #--------------------------------------------------------------------------
  3412.   # ● [追加]:グラフィック設定の配列を返す
  3413.   #--------------------------------------------------------------------------
  3414.   def graphic_name_index
  3415.     case LNX11::DEFAULT_BATTLER_GRAPHIC
  3416.     when 0 ; [@face_name, @face_index]
  3417.     when 1 ; [@character_name, @character_index]
  3418.     end
  3419.   end
  3420.   #--------------------------------------------------------------------------
  3421.   # ● [エイリアス]:グラフィックの変更
  3422.   #--------------------------------------------------------------------------
  3423.   alias :lnx11a_set_graphic :set_graphic
  3424.   def set_graphic(*args)
  3425.     face = graphic_name_index
  3426.     # 元のメソッドを呼ぶ
  3427.     lnx11a_set_graphic(*args)
  3428.     @refresh_battler_graphic = (face != graphic_name_index)
  3429.   end
  3430.   #--------------------------------------------------------------------------
  3431.   # ● [追加]:デフォルトバトラーグラフィックの取得
  3432.   #--------------------------------------------------------------------------
  3433.   def facebattler
  3434.     $game_temp.actor_battler_graphic[id]
  3435.   end
  3436.   def facebattler=(bitmap)
  3437.     facebattler.dispose if facebattler && !facebattler.disposed?
  3438.     $game_temp.actor_battler_graphic[id] = bitmap
  3439.   end
  3440.   #--------------------------------------------------------------------------
  3441.   # ● [追加]:後指定のバトラーグラフィックファイル名の取得
  3442.   #--------------------------------------------------------------------------
  3443.   def battler_graphic_name
  3444.     return @battler_graphic_name if @battler_graphic_name != nil
  3445.     @battler_graphic_name = ""
  3446.   end
  3447.   #--------------------------------------------------------------------------
  3448.   # ● [追加]:後指定のバトラーグラフィックファイル名の指定
  3449.   #--------------------------------------------------------------------------
  3450.   def battler_graphic_name=(filename)
  3451.     @battler_graphic_name = filename
  3452.     @refresh_battler_graphic = true
  3453.   end
  3454.   #--------------------------------------------------------------------------
  3455.   # ● [追加]:顔グラフィックを描画して返す
  3456.   #  処理内容は Window_Base の draw_face に準じたものです。
  3457.   #--------------------------------------------------------------------------
  3458.   def draw_face(face_name, face_index, enabled = true)
  3459.     fw = 96
  3460.     fh = 96
  3461.     # ビットマップを作成して返す
  3462.     bitmap = Cache.face(face_name)
  3463.     rect = Rect.new(face_index % 4 * fw, face_index / 4 * fh, fw, fh)
  3464.     face = Bitmap.new(fw, fh)
  3465.     color = LNX11::DEFAULT_BG_COLOR
  3466.     face.gradient_fill_rect(face.rect, color[0], color[1], true)
  3467.     face.blt(0, 0, bitmap, rect)
  3468.     bitmap.dispose
  3469.     face
  3470.   end
  3471.   #--------------------------------------------------------------------------
  3472.   # ● [追加]:歩行グラフィックを描画して返す
  3473.   #  処理内容は Window_Base の draw_character に準じたものです。
  3474.   #--------------------------------------------------------------------------
  3475.   def draw_character(character_name, character_index)
  3476.     return unless character_name
  3477.     bitmap = Cache.character(character_name)
  3478.     sign = character_name[/^[\!\$]./]
  3479.     if sign && sign.include?('$')
  3480.       cw = bitmap.width / 3
  3481.       ch = bitmap.height / 4
  3482.     else
  3483.       cw = bitmap.width / 12
  3484.       ch = bitmap.height / 8
  3485.     end
  3486.     n = character_index
  3487.     src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  3488.     character = Bitmap.new(cw, ch)
  3489.     color = LNX11::DEFAULT_BG_COLOR
  3490.     character.gradient_fill_rect(character.rect, color[0], color[1], true)
  3491.     character.blt(0, 0, bitmap, src_rect)
  3492.     character
  3493.   end
  3494.  
  3495.   #--------------------------------------------------------------------------
  3496.   # ● [追加]:デフォルトバトラーグラフィック設定
  3497.   #--------------------------------------------------------------------------
  3498.   def default_battler_graphic
  3499.     case LNX11::DEFAULT_BATTLER_GRAPHIC
  3500.     when 0 # 顔グラフィック
  3501.       self.facebattler = draw_face(@face_name, @face_index)
  3502.     when 1 # 歩行グラフィック
  3503.       self.facebattler = draw_character(@character_name, @character_index)
  3504.     end
  3505.   end
  3506.   #--------------------------------------------------------------------------
  3507.   # ● [追加]:バトラーグラフィックの更新
  3508.   #  Sprite_Batter が利用するオブジェクトを更新します。
  3509.   #--------------------------------------------------------------------------
  3510.   def update_battler_graphic
  3511.     @battler_hue = 0
  3512.     if !battler_graphic_name.empty?
  3513.       # スクリプトで指定されている
  3514.       @battler_name = @battler_graphic_name
  3515.       dispose_facebattler
  3516.     elsif !actor.default_battler_graphic.empty?
  3517.       # メモで指定されている
  3518.       @battler_name = actor.default_battler_graphic
  3519.       dispose_facebattler
  3520.     else
  3521.       # 何も指定されていない
  3522.       @battler_name = ""
  3523.       default_battler_graphic
  3524.     end
  3525.     # 更新したので更新フラグを取り消す
  3526.     @refresh_battler_graphic = false
  3527.   end
  3528.   #--------------------------------------------------------------------------
  3529.   # ● [追加]:バトラー用顔グラフィックの解放
  3530.   #--------------------------------------------------------------------------
  3531.   def dispose_facebattler
  3532.     return if self.facebattler == nil
  3533.     self.facebattler.dispose
  3534.     self.facebattler = nil
  3535.   end
  3536.   #--------------------------------------------------------------------------
  3537.   # ● [エイリアス]:レベルアップメッセージの表示
  3538.   #   レベルアップのポップアップを追加します。
  3539.   #--------------------------------------------------------------------------
  3540.   alias :lnx11a_display_level_up :display_level_up
  3541.   def display_level_up(new_skills)
  3542.     popup_data.popup_levelup(self) if $game_party.in_battle
  3543.     lnx11a_display_level_up(new_skills)
  3544.   end
  3545. end
  3546.  
  3547. #==============================================================================
  3548. # ■ Game_Enemy
  3549. #------------------------------------------------------------------------------
  3550. #  敵キャラを扱うクラスです。
  3551. #==============================================================================
  3552.  
  3553. class Game_Enemy < Game_Battler
  3554.   #--------------------------------------------------------------------------
  3555.   # ● 通常攻撃 アニメーション ID の取得
  3556.   #--------------------------------------------------------------------------
  3557.   def atk_animation
  3558.     # メモを参照
  3559.     enemy.atk_animation
  3560.   end
  3561. end
  3562.  
  3563. #==============================================================================
  3564. # ■ Game_Party
  3565. #------------------------------------------------------------------------------
  3566. #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
  3567. # スのインスタンスは $game_party で参照されます。
  3568. #==============================================================================
  3569.  
  3570. class Game_Party < Game_Unit
  3571.   #--------------------------------------------------------------------------
  3572.   # ● [追加]:公開インスタンス変数
  3573.   #--------------------------------------------------------------------------
  3574.   attr_accessor :actor_invisible     # アクター非表示
  3575.   attr_accessor :status_invisible    # バトルステータス非表示
  3576.   attr_accessor :actor_bg_invisible  # アクター背景非表示
  3577.   attr_accessor :last_party_command  # 最後に選択したパーティコマンド
  3578.   attr_accessor :members_screen_x          # バトルメンバー分のX座標配列
  3579.   attr_accessor :members_screen_x_nooffset # X:オフセットなし
  3580.   attr_accessor :members_screen_y          # バトルメンバー分のY座標配列
  3581.   attr_accessor :members_screen_z          # バトルメンバー分のZ座標配列
  3582.   #--------------------------------------------------------------------------
  3583.   # ● [追加]:バトルメンバーの座標設定
  3584.   #--------------------------------------------------------------------------
  3585.   def set_members_xyz
  3586.     return if members.size == 0
  3587.     # 座標をまとめて設定
  3588.     set_screen_x
  3589.     set_screen_y
  3590.     set_screen_z
  3591.   end
  3592.   #--------------------------------------------------------------------------
  3593.   # ● [追加]:バトルメンバーの座標設定
  3594.   #--------------------------------------------------------------------------
  3595.   def set_members_battle_graphic
  3596.     $game_party.battle_members.each {|actor| actor.update_battler_graphic}
  3597.   end
  3598.   #--------------------------------------------------------------------------
  3599.   # ● [追加]:バトル画面 X 座標の設定
  3600.   #  ここで設定した座標は Game_Actor や ステータス表示等で利用されます。
  3601.   #--------------------------------------------------------------------------
  3602.   def set_screen_x
  3603.     @members_screen_x = []
  3604.     @members_screen_x_nooffset = []
  3605.     padding = LNX11::ACTOR_PADDING[:side]
  3606.     if LNX11::ACTOR_CENTERING
  3607.       # アクターのセンタリングが有効
  3608.       a_spacing = LNX11::ACTOR_SPACING_ADJUST
  3609.       padding += (max_battle_members - battle_members.size) * a_spacing
  3610.       width = (Graphics.width - padding * 2) / battle_members.size
  3611.     else
  3612.       # アクターのセンタリングが無効
  3613.       width = (Graphics.width - padding * 2) / max_battle_members
  3614.     end
  3615.     battle_members.each_with_index do |actor, i|
  3616.       offset = LNX11::ACTOR_OFFSET[:x]
  3617.       @members_screen_x_nooffset[i] = width * i + width / 2 + padding
  3618.       @members_screen_x[i] = @members_screen_x_nooffset[i] + offset
  3619.       actor.screen_x = @members_screen_x[i]
  3620.     end
  3621.   end
  3622.   #--------------------------------------------------------------------------
  3623.   # ● [追加]:バトル画面 Y 座標の設定
  3624.   #  ここで設定した座標は Game_Actor や ステータス表示等で利用されます。
  3625.   #--------------------------------------------------------------------------
  3626.   def set_screen_y
  3627.     offset = LNX11::ACTOR_OFFSET[:y]
  3628.     ay = Graphics.height - LNX11::ACTOR_PADDING[:bottom] + offset
  3629.     @members_screen_y = Array.new(max_battle_members) {ay}
  3630.     battle_members.each {|actor| actor.screen_y = ay}
  3631.   end
  3632.   #--------------------------------------------------------------------------
  3633.   # ● [追加]:バトル画面 Z 座標の設定
  3634.   #--------------------------------------------------------------------------
  3635.   def set_screen_z
  3636.     # 便宜上、XYと同じように配列を作成しておく
  3637.     az = LNX11::ACTOR_SCREEN_TONE ? 150 : -10
  3638.     @members_screen_z = Array.new(max_battle_members) {az}
  3639.   end
  3640.   #--------------------------------------------------------------------------
  3641.   # ● [オーバーライド]:戦闘開始処理
  3642.   #--------------------------------------------------------------------------
  3643.   def on_battle_start
  3644.     super
  3645.     # バトルステータスの更新
  3646.     $game_temp.battle_status_refresh
  3647.   end
  3648. end
  3649.  
  3650. #==============================================================================
  3651. # ■ Game_Troop
  3652. #------------------------------------------------------------------------------
  3653. #  敵グループおよび戦闘に関するデータを扱うクラスです。
  3654. #==============================================================================
  3655.  
  3656. class Game_Troop < Game_Unit
  3657.   #--------------------------------------------------------------------------
  3658.   # ● [エイリアス]:セットアップ
  3659.   #  敵グループの座標修正処理を追加します。
  3660.   #--------------------------------------------------------------------------
  3661.   alias :lnx11a_setup :setup
  3662.   def setup(*args)
  3663.     # 元のメソッドを呼ぶ
  3664.     lnx11a_setup(*args)
  3665.     # 敵グループの座標修正
  3666.     @enemies.each do |enemy|
  3667.       # X:解像度がデフォルトでない場合に位置を補正する
  3668.       if LNX11::TROOP_X_SCREEN_FIX
  3669.         enemy.screen_x *= Graphics.width.to_f / 544
  3670.         enemy.screen_x.truncate
  3671.       end
  3672.       enemy.screen_y += LNX11::TROOP_Y_OFFSET
  3673.     end
  3674.   end
  3675.   #--------------------------------------------------------------------------
  3676.   # ● [エイリアス]:敵キャラ名の配列取得
  3677.   #--------------------------------------------------------------------------
  3678.   alias :lnx11a_enemy_names :enemy_names
  3679.   def enemy_names
  3680.     LNX11::MESSAGE_WINDOW_ENEMY_NAMES ? lnx11a_enemy_names : []
  3681.   end
  3682. end
  3683.  
  3684. #==============================================================================
  3685. # ■ Game_Message
  3686. #------------------------------------------------------------------------------
  3687. #  文章や選択肢などを表示するメッセージウィンドウの状態を扱うクラスです。
  3688. #==============================================================================
  3689.  
  3690. class Game_Message
  3691.   #--------------------------------------------------------------------------
  3692.   # ● [追加]:公開インスタンス変数
  3693.   #--------------------------------------------------------------------------
  3694.   attr_reader   :helpdisplay_texts        # 簡易ヘルプ配列
  3695.   #--------------------------------------------------------------------------
  3696.   # ● [追加]:簡易ヘルプ配列の取得
  3697.   #--------------------------------------------------------------------------
  3698.   def helpdisplay_texts
  3699.     return @helpdisplay_texts if @helpdisplay_texts
  3700.     @helpdisplay_texts = []
  3701.   end
  3702.   #--------------------------------------------------------------------------
  3703.   # ● [エイリアス]:クリア
  3704.   #--------------------------------------------------------------------------
  3705.   alias :lnx11a_clear :clear
  3706.   def clear
  3707.     # 元のメソッドを呼ぶ
  3708.     lnx11a_clear
  3709.     @helpdisplay_texts = []
  3710.     @add_disabled = false
  3711.   end
  3712.   #--------------------------------------------------------------------------
  3713.   # ● [エイリアス]:テキストの追加
  3714.   #--------------------------------------------------------------------------
  3715.   alias :lnx11a_add :add
  3716.   def add(text)
  3717.     # テキストの追加が禁止されてる場合、簡易ヘルプ表示用の配列に追加する
  3718.     if @add_disabled
  3719.       @helpdisplay_texts = [] unless @helpdisplay_texts
  3720.       @helpdisplay_texts.push(text)
  3721.     else
  3722.       # 元のメソッドを呼ぶ
  3723.       lnx11a_add(text)
  3724.     end
  3725.   end
  3726.   #--------------------------------------------------------------------------
  3727.   # ● [追加]:テキスト追加の禁止
  3728.   #--------------------------------------------------------------------------
  3729.   def add_disabled
  3730.     return if LNX11::MESSAGE_TYPE == 0
  3731.     @add_disabled = true
  3732.   end
  3733.   #--------------------------------------------------------------------------
  3734.   # ● [追加]:テキスト追加の禁止
  3735.   #--------------------------------------------------------------------------
  3736.   def add_enabled
  3737.     return if LNX11::MESSAGE_TYPE == 0
  3738.     @add_disabled = false
  3739.   end
  3740. end
  3741.  
  3742. #==============================================================================
  3743. # ■ Sprite_Battler
  3744. #------------------------------------------------------------------------------
  3745. #  バトラー表示用のスプライトです。
  3746. #==============================================================================
  3747.  
  3748. class Sprite_Battler < Sprite_Base
  3749.   #--------------------------------------------------------------------------
  3750.   # ● [追加]:ターゲットカーソルのバトラーの取得
  3751.   #--------------------------------------------------------------------------
  3752.   def cursor_battler
  3753.     $game_temp.target_cursor_sprite.battler
  3754.   end
  3755.   #--------------------------------------------------------------------------
  3756.   # ● [追加]:ターゲットカーソルの点滅状態に対応したシンボルを返す
  3757.   #--------------------------------------------------------------------------
  3758.   def cursor_effect
  3759.     $game_temp.target_cursor_sprite.blink ? :target_whiten : :command_whiten
  3760.   end
  3761.   #--------------------------------------------------------------------------
  3762.   # ● [追加]:対象選択フラッシュの設定
  3763.   #--------------------------------------------------------------------------
  3764.   def setup_cursor_effect
  3765.     if cursor_battler == @battler ||
  3766.        (cursor_battler == :party && @battler.actor?) ||
  3767.        ([:troop, :troop_random].include?(cursor_battler) && !@battler.actor?)
  3768.       if @effect_type == nil || @effect_type != cursor_effect
  3769.         start_effect(cursor_effect)
  3770.       end
  3771.     else
  3772.       # フラッシュエフェクト終了
  3773.       end_cursor_effect
  3774.     end
  3775.   end
  3776.   #--------------------------------------------------------------------------
  3777.   # ● [追加]:対象選択フラッシュの終了
  3778.   #--------------------------------------------------------------------------
  3779.   def end_cursor_effect
  3780.     if [:target_whiten, :command_whiten].include?(@effect_type)
  3781.       @effect_type = nil
  3782.       @effect_duration = 0
  3783.       revert_to_normal
  3784.     end
  3785.   end
  3786.   #--------------------------------------------------------------------------
  3787.   # ● [オーバーライド]:アニメーションスプライトの設定
  3788.   #--------------------------------------------------------------------------
  3789.   def animation_set_sprites(frame)
  3790.     o = self.opacity
  3791.     self.opacity = 255 if !@battler_visible || @effect_duration > 0
  3792.     # スーパークラスのメソッドを呼ぶ
  3793.     super(frame)
  3794.     self.opacity = o
  3795.   end
  3796.   #--------------------------------------------------------------------------
  3797.   # ● [オーバーライド]:アニメーションの原点設定
  3798.   #--------------------------------------------------------------------------
  3799.   def set_animation_origin
  3800.     # スーパークラスのメソッドを呼ぶ
  3801.     super
  3802.     # 画面アニメーションがアクターに再生されたら
  3803.     if @animation.position == 3 && @battler != nil && @battler.actor?
  3804.       # アニメーションのY座標を修正
  3805.       @ani_oy += LNX11::SCREEN_ANIMATION_OFFSET
  3806.     end
  3807.   end
  3808.   #--------------------------------------------------------------------------
  3809.   # ● [エイリアス]:転送元ビットマップの更新
  3810.   #--------------------------------------------------------------------------
  3811.   alias :lnx11a_update_bitmap :update_bitmap
  3812.   def update_bitmap
  3813.     if @battler.actor? && @battler.refresh_battler_graphic
  3814.       # バトラーグラフィックが変更されていれば更新する
  3815.       @battler.update_battler_graphic
  3816.     end
  3817.     if @battler.actor? && @battler.facebattler != nil
  3818.       # バトラー用顔グラフィックが作成されていれば、
  3819.       # それを Sprite の Bitmap とする
  3820.       new_bitmap = @battler.facebattler
  3821.       if bitmap != new_bitmap
  3822.         self.bitmap = new_bitmap
  3823.         init_visibility
  3824.       end
  3825.     else
  3826.       # 元のメソッドを呼ぶ
  3827.       lnx11a_update_bitmap
  3828.     end
  3829.   end
  3830.   #--------------------------------------------------------------------------
  3831.   # ● [エイリアス]:新しいアニメーションの設定
  3832.   #--------------------------------------------------------------------------
  3833.   alias :lnx11a_setup_new_animation :setup_new_animation
  3834.   def setup_new_animation
  3835.     lnx11a_setup_new_animation
  3836.     # ループアニメーションの設定
  3837.     if @battler.loop_animation_id > 0 && (@loop_animation == nil ||
  3838.        @battler.loop_animation_id != @loop_animation.id)
  3839.       animation = $data_animations[@battler.loop_animation_id]
  3840.       mirror = @battler.loop_animation_mirror
  3841.       start_loop_animation(animation, mirror)
  3842.     elsif @battler.loop_animation_id == 0 && @loop_animation
  3843.       end_loop_animation
  3844.     end
  3845.   end
  3846.   #--------------------------------------------------------------------------
  3847.   # ● [エイリアス]:新しいエフェクトの設定
  3848.   #--------------------------------------------------------------------------
  3849.   alias :lnx11a_setup_new_effect :setup_new_effect
  3850.   def setup_new_effect
  3851.     # 元のメソッドを呼ぶ
  3852.     lnx11a_setup_new_effect
  3853.     # フラッシュエフェクト設定
  3854.     if @battler_visible && cursor_battler
  3855.       setup_cursor_effect
  3856.     else
  3857.       # フラッシュエフェクト終了
  3858.       end_cursor_effect
  3859.     end
  3860.   end
  3861.   #--------------------------------------------------------------------------
  3862.   # ● [エイリアス]:エフェクトの開始
  3863.   #--------------------------------------------------------------------------
  3864.   alias :lnx11a_start_effect :start_effect
  3865.   def start_effect(effect_type)
  3866.     # エフェクト開始の追加
  3867.     @effect_type = effect_type
  3868.     case @effect_type
  3869.     when :target_whiten
  3870.       @effect_duration = 40
  3871.       @battler_visible = true
  3872.     when :command_whiten
  3873.       @effect_duration = 80
  3874.       @battler_visible = true
  3875.     end
  3876.     # 元のメソッドを呼ぶ
  3877.     lnx11a_start_effect(effect_type)
  3878.   end
  3879.   #--------------------------------------------------------------------------
  3880.   # ● [エイリアス]:エフェクトの更新
  3881.   #--------------------------------------------------------------------------
  3882.   alias :lnx11a_update_effect :update_effect
  3883.   def update_effect
  3884.     # エフェクト更新の追加
  3885.     if @effect_duration > 0
  3886.       @effect_duration -= 1
  3887.       case @effect_type
  3888.       when :target_whiten
  3889.         update_target_whiten
  3890.       when :command_whiten
  3891.         update_command_whiten
  3892.       end
  3893.       @effect_duration += 1
  3894.     end
  3895.     # 元のメソッドを呼ぶ
  3896.     lnx11a_update_effect
  3897.   end
  3898.   #--------------------------------------------------------------------------
  3899.   # ● [追加]:対象選択フラッシュエフェクトの更新
  3900.   #--------------------------------------------------------------------------
  3901.   def update_target_whiten
  3902.     alpha = @effect_duration < 20 ? @effect_duration : 40 - @effect_duration
  3903.     self.color.set(255, 255, 255, 0)
  3904.     self.color.alpha = (alpha + 1) * 2
  3905.   end
  3906.   #--------------------------------------------------------------------------
  3907.   # ● [追加]:コマンド選択フラッシュエフェクトの更新
  3908.   #--------------------------------------------------------------------------
  3909.   def update_command_whiten
  3910.     alpha = @effect_duration < 40 ? @effect_duration : 80 - @effect_duration
  3911.     self.color.set(255, 255, 255, 0)
  3912.     self.color.alpha = alpha * 2
  3913.   end
  3914.   #--------------------------------------------------------------------------
  3915.   # ● [追加]:高さの取得
  3916.   #--------------------------------------------------------------------------
  3917.   def bitmap_height
  3918.     self.bitmap.height
  3919.   end
  3920.   #--------------------------------------------------------------------------
  3921.   # ● [エイリアス]:位置の更新
  3922.   #--------------------------------------------------------------------------
  3923.   alias :lnx11a_update_position :update_position
  3924.   def update_position
  3925.     # 元のメソッドを呼ぶ
  3926.     lnx11a_update_position
  3927.     # 高さを更新
  3928.     @battler.bitmap_height = bitmap_height
  3929.     # 可視状態を更新
  3930.     self.visible = !$game_party.actor_invisible if @battler.actor?
  3931.   end
  3932.   if LNX11::ENHANCED_WHITEN
  3933.     # 白フラッシュを強めにする
  3934.     #------------------------------------------------------------------------
  3935.     # ● [再定義]:白フラッシュエフェクトの更新
  3936.     #------------------------------------------------------------------------
  3937.     def update_whiten
  3938.       self.color.set(255, 255, 255, 0)
  3939.       self.color.alpha = 192 - (16 - @effect_duration) * 12
  3940.     end
  3941.   end
  3942.   #--------------------------------------------------------------------------
  3943.   # ● ループアニメーションの追加
  3944.   #--------------------------------------------------------------------------
  3945.   #--------------------------------------------------------------------------
  3946.   # ● [追加]:クラス変数
  3947.   #--------------------------------------------------------------------------
  3948.   @@loop_ani_checker = []
  3949.   @@loop_ani_spr_checker = []
  3950.   #--------------------------------------------------------------------------
  3951.   # ● [エイリアス]:オブジェクト初期化
  3952.   #--------------------------------------------------------------------------
  3953.   alias :lnx11a_initialize :initialize
  3954.   def initialize(viewport, battler = nil)
  3955.     # 元のメソッドを呼ぶ
  3956.     lnx11a_initialize(viewport, battler)
  3957.     # ループアニメの残り時間
  3958.     @loop_ani_duration = 0
  3959.   end
  3960.   #--------------------------------------------------------------------------
  3961.   # ● [エイリアス]:解放
  3962.   #--------------------------------------------------------------------------
  3963.   alias :lnx11a_dispose :dispose
  3964.   def dispose
  3965.     # 元のメソッドを呼ぶ
  3966.     lnx11a_dispose
  3967.     # ループアニメを解放
  3968.     dispose_loop_animation
  3969.   end
  3970.   #--------------------------------------------------------------------------
  3971.   # ● [エイリアス]:フレーム更新
  3972.   #--------------------------------------------------------------------------
  3973.   alias :lnx11a_update :update
  3974.   def update
  3975.     # 元のメソッドを呼ぶ
  3976.     lnx11a_update
  3977.     update_loop_animation
  3978.     @@loop_ani_checker.clear
  3979.     @@loop_ani_spr_checker.clear
  3980.   end
  3981.   #--------------------------------------------------------------------------
  3982.   # ● [追加]:ループアニメーション表示中判定
  3983.   #--------------------------------------------------------------------------
  3984.   def loop_animation?
  3985.     @loop_animation != nil
  3986.   end
  3987.   #--------------------------------------------------------------------------
  3988.   # ● [追加]:ループアニメーションの開始
  3989.   #--------------------------------------------------------------------------
  3990.   def start_loop_animation(animation, mirror = false)
  3991.     dispose_loop_animation
  3992.     @loop_animation = animation
  3993.     if @loop_animation
  3994.       @loop_ani_mirror = mirror
  3995.       set_loop_animation_rate
  3996.       @loop_ani_duration = @loop_animation.frame_max * @loop_ani_rate + 1
  3997.       load_loop_animation_bitmap
  3998.       make_loop_animation_sprites
  3999.       set_loop_animation_origin
  4000.     end
  4001.   end
  4002.   #--------------------------------------------------------------------------
  4003.   # ● [追加]:ループアニメーションの速度を設定
  4004.   #--------------------------------------------------------------------------
  4005.   def set_loop_animation_rate
  4006.     if $lnx_include[:lnx09]
  4007.       # LNX09 を導入している
  4008.       default = LNX09::DEFAULT_BATTLE_SPEED_RATE
  4009.       if @loop_animation.speed_rate
  4010.         @loop_ani_rate = @loop_animation.speed_rate
  4011.       else
  4012.         @loop_ani_rate = default
  4013.       end
  4014.     else
  4015.       @loop_ani_rate = 4
  4016.     end
  4017.   end
  4018.   #--------------------------------------------------------------------------
  4019.   # ● [追加]:ループアニメーション グラフィックの読み込み
  4020.   #--------------------------------------------------------------------------
  4021.   def load_loop_animation_bitmap
  4022.     animation1_name = @loop_animation.animation1_name
  4023.     animation1_hue = @loop_animation.animation1_hue
  4024.     animation2_name = @loop_animation.animation2_name
  4025.     animation2_hue = @loop_animation.animation2_hue
  4026.     @loop_ani_bitmap1 = Cache.animation(animation1_name, animation1_hue)
  4027.     @loop_ani_bitmap2 = Cache.animation(animation2_name, animation2_hue)
  4028.     if @@_reference_count.include?(@loop_ani_bitmap1)
  4029.       @@_reference_count[@loop_ani_bitmap1] += 1
  4030.     else
  4031.       @@_reference_count[@loop_ani_bitmap1] = 1
  4032.     end
  4033.     if @@_reference_count.include?(@loop_ani_bitmap2)
  4034.       @@_reference_count[@loop_ani_bitmap2] += 1
  4035.     else
  4036.       @@_reference_count[@loop_ani_bitmap2] = 1
  4037.     end
  4038.     Graphics.frame_reset
  4039.   end
  4040.   #--------------------------------------------------------------------------
  4041.   # ● [追加]:ループアニメーションスプライトの作成
  4042.   #--------------------------------------------------------------------------
  4043.   def make_loop_animation_sprites
  4044.     @loop_ani_sprites = []
  4045.     if @use_sprite && !@@loop_ani_spr_checker.include?(@loop_animation)
  4046.       16.times do
  4047.         sprite = ::Sprite.new(viewport)
  4048.         sprite.visible = false
  4049.         @loop_ani_sprites.push(sprite)
  4050.       end
  4051.       if @loop_animation.position == 3
  4052.         @@loop_ani_spr_checker.push(@loop_animation)
  4053.       end
  4054.     end
  4055.     @loop_ani_duplicated = @@loop_ani_checker.include?(@loop_animation)
  4056.     if !@loop_ani_duplicated && @loop_animation.position == 3
  4057.       @@loop_ani_checker.push(@loop_animation)
  4058.     end
  4059.   end
  4060.   #--------------------------------------------------------------------------
  4061.   # ● [追加]:ループアニメーションの原点設定
  4062.   #--------------------------------------------------------------------------
  4063.   def set_loop_animation_origin
  4064.     if @loop_animation.position == 3
  4065.       if viewport == nil
  4066.         @loop_ani_ox = Graphics.width / 2
  4067.         @loop_ani_oy = Graphics.height / 2
  4068.       else
  4069.         @loop_ani_ox = viewport.rect.width / 2
  4070.         @loop_ani_oy = viewport.rect.height / 2
  4071.       end
  4072.     else
  4073.       @loop_ani_ox = x - ox + width / 2
  4074.       @loop_ani_oy = y - oy + height / 2
  4075.       if @loop_animation.position == 0
  4076.         @loop_ani_oy -= height / 2
  4077.       elsif @loop_animation.position == 2
  4078.         @loop_ani_oy += height / 2
  4079.       end
  4080.     end
  4081.   end
  4082.   #--------------------------------------------------------------------------
  4083.   # ● [追加]:ループアニメーションの解放
  4084.   #--------------------------------------------------------------------------
  4085.   def dispose_loop_animation
  4086.     if @loop_ani_bitmap1
  4087.       @@_reference_count[@loop_ani_bitmap1] -= 1
  4088.       if @@_reference_count[@loop_ani_bitmap1] == 0
  4089.         @loop_ani_bitmap1.dispose
  4090.       end
  4091.     end
  4092.     if @loop_ani_bitmap2
  4093.       @@_reference_count[@loop_ani_bitmap2] -= 1
  4094.       if @@_reference_count[@loop_ani_bitmap2] == 0
  4095.         @loop_ani_bitmap2.dispose
  4096.       end
  4097.     end
  4098.     if @loop_ani_sprites
  4099.       @loop_ani_sprites.each {|sprite| sprite.dispose }
  4100.       @loop_ani_sprites = nil
  4101.       @loop_animation = nil
  4102.     end
  4103.     @loop_ani_bitmap1 = nil
  4104.     @loop_ani_bitmap2 = nil
  4105.   end
  4106.   #--------------------------------------------------------------------------
  4107.   # ● [追加]:ループアニメーションの更新
  4108.   #--------------------------------------------------------------------------
  4109.   def update_loop_animation
  4110.     return unless loop_animation?
  4111.     @loop_ani_duration -= 1
  4112.     if @loop_ani_duration % @loop_ani_rate == 0
  4113.       if @loop_ani_duration > 0
  4114.         frame_index = @loop_animation.frame_max
  4115.         frame_index -= (@loop_ani_duration + @loop_ani_rate - 1) / @loop_ani_rate
  4116.         loop_animation_set_sprites(@loop_animation.frames[frame_index])
  4117.         @loop_animation.timings.each do |timing|
  4118.           loop_animation_process_timing(timing) if timing.frame == frame_index
  4119.         end
  4120.       else
  4121.         # 残り時間を再設定してループ
  4122.         @loop_ani_duration = @loop_animation.frame_max * @loop_ani_rate + 1
  4123.       end
  4124.     end
  4125.   end
  4126.   #--------------------------------------------------------------------------
  4127.   # ● [追加]:ループアニメーションの終了
  4128.   #--------------------------------------------------------------------------
  4129.   def end_loop_animation
  4130.     dispose_loop_animation
  4131.   end
  4132.   #--------------------------------------------------------------------------
  4133.   # ● [追加]:ループアニメーションスプライトの設定
  4134.   #     frame : フレームデータ(RPG::Animation::Frame)
  4135.   #--------------------------------------------------------------------------
  4136.   def loop_animation_set_sprites(frame)
  4137.     cell_data = frame.cell_data
  4138.     @loop_ani_sprites.each_with_index do |sprite, i|
  4139.       next unless sprite
  4140.       pattern = cell_data[i, 0]
  4141.       if !pattern || pattern < 0
  4142.         sprite.visible = false
  4143.         next
  4144.       end
  4145.       sprite.bitmap = pattern < 100 ? @loop_ani_bitmap1 : @loop_ani_bitmap2
  4146.       sprite.visible = true
  4147.       sprite.src_rect.set(pattern % 5 * 192,
  4148.         pattern % 100 / 5 * 192, 192, 192)
  4149.       if @loop_ani_mirror
  4150.         sprite.x = @loop_ani_ox - cell_data[i, 1]
  4151.         sprite.y = @loop_ani_oy + cell_data[i, 2]
  4152.         sprite.angle = (360 - cell_data[i, 4])
  4153.         sprite.mirror = (cell_data[i, 5] == 0)
  4154.       else
  4155.         sprite.x = @loop_ani_ox + cell_data[i, 1]
  4156.         sprite.y = @loop_ani_oy + cell_data[i, 2]
  4157.         sprite.angle = cell_data[i, 4]
  4158.         sprite.mirror = (cell_data[i, 5] == 1)
  4159.       end
  4160.       sprite.z = self.z + 316 + i
  4161.       sprite.ox = 96
  4162.       sprite.oy = 96
  4163.       sprite.zoom_x = cell_data[i, 3] / 100.0
  4164.       sprite.zoom_y = cell_data[i, 3] / 100.0
  4165.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4166.       sprite.blend_type = cell_data[i, 7]
  4167.     end
  4168.   end
  4169.   #--------------------------------------------------------------------------
  4170.   # ● [追加]:SE とフラッシュのタイミング処理
  4171.   #     timing : タイミングデータ(RPG::Animation::Timing)
  4172.   #--------------------------------------------------------------------------
  4173.   def loop_animation_process_timing(timing)
  4174.     timing.se.play unless @loop_ani_duplicated
  4175.     case timing.flash_scope
  4176.     when 1
  4177.       self.flash(timing.flash_color, timing.flash_duration * @loop_ani_rate)
  4178.     when 2
  4179.       if viewport && !@loop_ani_duplicated
  4180.         viewport.flash(timing.flash_color, timing.flash_duration * @loop_ani_rate)
  4181.       end
  4182.     when 3
  4183.       self.flash(nil, timing.flash_duration * @loop_ani_rate)
  4184.     end
  4185.   end
  4186. end
  4187.  
  4188. #==============================================================================
  4189. # ■ Spriteset_Battle
  4190. #------------------------------------------------------------------------------
  4191. #  バトル画面のスプライトをまとめたクラスです。
  4192. #==============================================================================
  4193.  
  4194. class Spriteset_Battle
  4195.   #--------------------------------------------------------------------------
  4196.   # ● [エイリアス]:オブジェクト初期化
  4197.   #--------------------------------------------------------------------------
  4198.   alias :lnx11a_initialize :initialize
  4199.   def initialize
  4200.     # 元のメソッドを呼ぶ
  4201.     lnx11a_initialize
  4202.     # アクターエリアの背景の作成
  4203.     create_actor_background
  4204.   end
  4205.   #--------------------------------------------------------------------------
  4206.   # ● [エイリアス]:解放
  4207.   #--------------------------------------------------------------------------
  4208.   alias :lnx11a_dispose :dispose
  4209.   def dispose
  4210.     # アクターエリアの背景の解放
  4211.     dispose_actor_background
  4212.     # 元のメソッドを呼ぶ
  4213.     lnx11a_dispose
  4214.   end
  4215.   #--------------------------------------------------------------------------
  4216.   # ● [エイリアス]:フレーム更新
  4217.   #--------------------------------------------------------------------------
  4218.   alias :lnx11a_update :update
  4219.   def update
  4220.     # 元のメソッドを呼ぶ
  4221.     lnx11a_update
  4222.     # アクターエリアの背景の更新
  4223.     update_actor_background
  4224.   end
  4225.   #--------------------------------------------------------------------------
  4226.   # ● [追加]:アクターのビューポート
  4227.   #--------------------------------------------------------------------------
  4228.   def actor_viewport
  4229.     LNX11::ACTOR_SCREEN_TONE ? @viewport1 : @viewport2
  4230.   end
  4231.   #--------------------------------------------------------------------------
  4232.   # ● [追加]:アクターエリアの背景の作成
  4233.   #--------------------------------------------------------------------------
  4234.   def create_actor_background
  4235.     return if LNX11::ACTOR_BACKGROUND == 0
  4236.     viewport = actor_viewport
  4237.     height = LNX11::ACTOR_BACKGROUND_HEIGHT
  4238.     case LNX11::ACTOR_BACKGROUND
  4239.     when 1
  4240.       # グラデーション
  4241.       @actor_background = Sprite.new
  4242.       back = Bitmap.new(Graphics.width, height)
  4243.       color = LNX11::ACTOR_BG_GRADIENT_COLOR
  4244.       back.gradient_fill_rect(back.rect, color[0], color[1], true)
  4245.       @actor_background.bitmap = back
  4246.     when 2
  4247.       # ウィンドウ
  4248.       @actor_background = Window_Base.new(0, 0, Graphics.width, height)
  4249.     else
  4250.       if LNX11::ACTOR_BACKGROUND.is_a?(String)
  4251.         # ファイル指定
  4252.         @actor_background = Sprite.new
  4253.         @actor_background.bitmap = Cache.system(LNX11::ACTOR_BACKGROUND)
  4254.         @actor_background.x = Graphics.width / 2
  4255.         @actor_background.ox = @actor_background.bitmap.width / 2
  4256.         height = @actor_background.bitmap.height
  4257.       end
  4258.     end
  4259.     @actor_background.viewport = viewport
  4260.     @actor_background.y = Graphics.height - height
  4261.     @actor_background.z = viewport == @viewport1 ? 120 : -20
  4262.     update_actor_background
  4263.   end
  4264.   #--------------------------------------------------------------------------
  4265.   # ● [追加]:アクターエリアの背景の解放
  4266.   #--------------------------------------------------------------------------
  4267.   def dispose_actor_background
  4268.     return unless @actor_background
  4269.     @actor_background.bitmap.dispose if @actor_background.is_a?(Sprite)
  4270.     @actor_background.dispose
  4271.   end
  4272.   #--------------------------------------------------------------------------
  4273.   # ● [追加]:アクターエリアの背景の更新
  4274.   #--------------------------------------------------------------------------
  4275.   def update_actor_background
  4276.     return unless @actor_background
  4277.     @actor_background.visible = !$game_party.actor_bg_invisible
  4278.   end
  4279.   #--------------------------------------------------------------------------
  4280.   # ● [再定義]:アクタースプライトの作成
  4281.   #--------------------------------------------------------------------------
  4282.   def create_actors
  4283.     # 座標とグラフィックの設定
  4284.     $game_party.set_members_xyz
  4285.     $game_party.set_members_battle_graphic
  4286.     # スプライトの作成
  4287.     viewport = actor_viewport
  4288.     @actor_sprites = $game_party.battle_members.collect do |actor|
  4289.       Sprite_Battler.new(viewport, actor)
  4290.     end
  4291.   end
  4292.   #--------------------------------------------------------------------------
  4293.   # ● [再定義]:アクタースプライトの更新
  4294.   #--------------------------------------------------------------------------
  4295.   def update_actors
  4296.     @actor_sprites.each {|sprite| sprite.update }
  4297.   end
  4298. end
  4299.  
  4300. #==============================================================================
  4301. # ■ Scene_Battle
  4302. #------------------------------------------------------------------------------
  4303. #  バトル画面の処理を行うクラスです。
  4304. #==============================================================================
  4305.  
  4306. class Scene_Battle < Scene_Base
  4307.   #--------------------------------------------------------------------------
  4308.   # ● [追加]:簡易ヘルプのメソッド設定
  4309.   #--------------------------------------------------------------------------
  4310.   def set_helpdisplay_methods
  4311.     BattleManager.update_for_wait_method = method(:update_for_wait)
  4312.     BattleManager.helpdisplay_set_method = method(:helpdisplay_set)
  4313.     BattleManager.helpdisplay_clear_method = method(:helpdisplay_clear)
  4314.     BattleManager.helpdisplay_wait_short_method=method(:helpdisplay_wait_short)
  4315.   end
  4316.   #--------------------------------------------------------------------------
  4317.   # ● [追加]:簡易ヘルプ表示
  4318.   #--------------------------------------------------------------------------
  4319.   def helpdisplay_set(item, duration = nil)
  4320.     @wait_short_disabled = false
  4321.     @targethelp_window.show.set_item(item)
  4322.     @targethelp_window.update
  4323.     wait(duration ? duration : 20)
  4324.   end
  4325.   #--------------------------------------------------------------------------
  4326.   # ● [追加]:簡易ヘルプ消去
  4327.   #--------------------------------------------------------------------------
  4328.   def helpdisplay_clear(duration = nil)
  4329.     return if !@targethelp_window.visible
  4330.     @wait_short_disabled = false
  4331.     @targethelp_window.clear
  4332.     @targethelp_window.hide
  4333.     wait(duration ? duration : 10)
  4334.   end
  4335.   #--------------------------------------------------------------------------
  4336.   # ● [追加]:簡易ヘルプ・短時間ウェイト
  4337.   #--------------------------------------------------------------------------
  4338.   def helpdisplay_wait_short
  4339.     return if !@targethelp_window.visible || @wait_short_disabled
  4340.     @wait_short_disabled = true # 連続で短時間ウェイトが実行されないように
  4341.     @targethelp_window.clear
  4342.     abs_wait_short
  4343.   end
  4344.   #--------------------------------------------------------------------------
  4345.   # ● [追加]:バトラーのエフェクト実行中?
  4346.   #--------------------------------------------------------------------------
  4347.   def battler_effect?
  4348.     @spriteset.effect?
  4349.   end
  4350.   #--------------------------------------------------------------------------
  4351.   # ● [エイリアス]:コマンド[逃げる]
  4352.   #--------------------------------------------------------------------------
  4353.   alias :lnx11a_command_escape :command_escape
  4354.   def command_escape
  4355.     @party_command_window.close
  4356.     @party_command_window.openness = 0 if LNX11::MESSAGE_TYPE == 2
  4357.     @status_window.unselect
  4358.     # 元のメソッドを呼ぶ
  4359.     lnx11a_command_escape
  4360.   end
  4361.   #--------------------------------------------------------------------------
  4362.   # ● [エイリアス]:スキル/アイテムの使用
  4363.   #--------------------------------------------------------------------------
  4364.   alias :lnx11a_use_item :use_item
  4365.   def use_item
  4366.     # 簡易ヘルプ表示
  4367.     item = @subject.current_action.item
  4368.     if LNX11::BATTLELOG_TYPE == 2 && !item.no_display
  4369.       helpdisplay_set(item, item.display_wait)
  4370.     end
  4371.     # 元のメソッドを呼ぶ
  4372.     lnx11a_use_item
  4373.     # 簡易ヘルプ消去・エフェクトが終わるまで待つ
  4374.     if LNX11::BATTLELOG_TYPE == 2
  4375.       wait(item.end_wait)
  4376.       helpdisplay_clear
  4377.     end
  4378.     wait_for_effect
  4379.   end
  4380.   #--------------------------------------------------------------------------
  4381.   # ● [エイリアス]:開始処理
  4382.   #--------------------------------------------------------------------------
  4383.   alias :lnx11a_start :start
  4384.   def start
  4385.     set_helpdisplay_methods
  4386.     @last_party_members = party_members
  4387.     $game_temp.method_battle_status_refresh = method(:refresh_status)
  4388.     $game_temp.clear_last_target_cursor
  4389.     $game_party.all_members.each {|actor| actor.last_actor_command = 0 }
  4390.     reset_sprite_effects
  4391.     standby_message_window_position
  4392.     create_targetcursor
  4393.     create_popup
  4394.     #元のメソッドを呼ぶ
  4395.     lnx11a_start
  4396.   end
  4397.   #--------------------------------------------------------------------------
  4398.   # ● [エイリアス]:終了処理
  4399.   #--------------------------------------------------------------------------
  4400.   alias :lnx11a_terminate :terminate
  4401.   def terminate
  4402.     dispose_targetcursor
  4403.     dispose_popup
  4404.     # 元のメソッドを呼ぶ
  4405.     lnx11a_terminate
  4406.   end
  4407.   #--------------------------------------------------------------------------
  4408.   # ● [追加]:アクターのスプライト情報の初期化
  4409.   #--------------------------------------------------------------------------
  4410.   def reset_sprite_effects
  4411.     $game_party.battle_members.each do |actor|
  4412.       actor.popup_delay_clear
  4413.       actor.set_state_animation
  4414.     end
  4415.   end
  4416.   #--------------------------------------------------------------------------
  4417.   # ● [エイリアス]:全ウィンドウの作成
  4418.   #--------------------------------------------------------------------------
  4419.   alias :lnx11a_create_all_windows :create_all_windows
  4420.   def create_all_windows
  4421.     # 元のメソッドを呼ぶ
  4422.     lnx11a_create_all_windows
  4423.     create_targethelp_window
  4424.   end
  4425.   #--------------------------------------------------------------------------
  4426.   # ● [エイリアス]:ステータスウィンドウの作成
  4427.   #--------------------------------------------------------------------------
  4428.   alias :lnx11a_create_status_window :create_status_window
  4429.   def create_status_window
  4430.     # 元のメソッドを呼ぶ
  4431.     lnx11a_create_status_window
  4432.     @status_window.set_xy
  4433.   end
  4434.   #--------------------------------------------------------------------------
  4435.   # ● [エイリアス]:情報表示ビューポートの作成
  4436.   #--------------------------------------------------------------------------
  4437.   alias :lnx11a_create_info_viewport :create_info_viewport
  4438.   def create_info_viewport
  4439.     # 元のメソッドを呼ぶ
  4440.     lnx11a_create_info_viewport
  4441.     # ビューポートを修正
  4442.     @info_viewport.rect.y = Graphics.height - LNX11::ACTOR_BACKGROUND_HEIGHT
  4443.     @info_viewport.rect.height = LNX11::ACTOR_BACKGROUND_HEIGHT
  4444.     @status_window.viewport = nil
  4445.   end
  4446.   #--------------------------------------------------------------------------
  4447.   # ● [エイリアス]:パーティコマンドウィンドウの作成
  4448.   #--------------------------------------------------------------------------
  4449.   alias :lnx11a_create_party_command_window :create_party_command_window
  4450.   def create_party_command_window
  4451.     # 元のメソッドを呼ぶ
  4452.     lnx11a_create_party_command_window
  4453.     @party_command_window.viewport = nil
  4454.   end
  4455.   #--------------------------------------------------------------------------
  4456.   # ● [エイリアス]:アクターコマンドウィンドウの作成
  4457.   #--------------------------------------------------------------------------
  4458.   alias :lnx11a_create_actor_command_window :create_actor_command_window
  4459.   def create_actor_command_window
  4460.     # 元のメソッドを呼ぶ
  4461.     lnx11a_create_actor_command_window
  4462.     @actor_command_window.viewport = nil
  4463.   end
  4464.   #--------------------------------------------------------------------------
  4465.   # ● [エイリアス]:ログウィンドウの作成
  4466.   #--------------------------------------------------------------------------
  4467.   alias :lnx11a_create_log_window :create_log_window
  4468.   def create_log_window
  4469.     # 元のメソッドを呼ぶ
  4470.     lnx11a_create_log_window
  4471.     # ウェイトメソッド
  4472.     @log_window.method_wait_for_animation = method(:wait_for_animation)
  4473.   end  
  4474.   #--------------------------------------------------------------------------
  4475.   # ● [追加]:ターゲットカーソルの作成
  4476.   #--------------------------------------------------------------------------
  4477.   def create_targetcursor
  4478.     @targetcursor = Sprite_TargetCursor.new
  4479.     $game_temp.target_cursor_sprite = @targetcursor
  4480.   end
  4481.   #--------------------------------------------------------------------------
  4482.   # ● [追加]:ターゲットカーソルの解放
  4483.   #--------------------------------------------------------------------------
  4484.   def dispose_targetcursor
  4485.     @targetcursor.dispose
  4486.   end
  4487.   #--------------------------------------------------------------------------
  4488.   # ● [追加]:ターゲットヘルプウィンドウの作成
  4489.   #--------------------------------------------------------------------------
  4490.   def create_targethelp_window
  4491.     @targethelp_window = Window_TargetHelp.new
  4492.     @targethelp_window.visible = false
  4493.     # ターゲット選択ウィンドウに関連付ける
  4494.     @actor_window.help_window = @targethelp_window
  4495.     @enemy_window.help_window = @targethelp_window
  4496.   end
  4497.   #--------------------------------------------------------------------------
  4498.   # ● [追加]:ポップアップの作成
  4499.   #--------------------------------------------------------------------------
  4500.   def create_popup
  4501.     $game_temp.popup_data = Popup_Data.new
  4502.   end
  4503.   #--------------------------------------------------------------------------
  4504.   # ● [追加]:ポップアップの解放
  4505.   #--------------------------------------------------------------------------
  4506.   def dispose_popup
  4507.     $game_temp.popup_data.dispose
  4508.   end
  4509.   #--------------------------------------------------------------------------
  4510.   # ● [追加]:ポップアップデータの取得
  4511.   #--------------------------------------------------------------------------
  4512.   def popup_data
  4513.     $game_temp.popup_data
  4514.   end
  4515.   #--------------------------------------------------------------------------
  4516.   # ● [エイリアス]:フレーム更新(基本)
  4517.   #--------------------------------------------------------------------------
  4518.   alias :lnx11a_update_basic :update_basic
  4519.   def update_basic
  4520.     # 元のメソッドを呼ぶ
  4521.     lnx11a_update_basic
  4522.     # 追加したオブジェクトの更新
  4523.     update_targetcursor
  4524.     update_popup
  4525.     refresh_actors
  4526.   end
  4527.   #--------------------------------------------------------------------------
  4528.   # ● [追加]:パーティメンバーの ID 配列の取得
  4529.   #--------------------------------------------------------------------------
  4530.   def party_members
  4531.     $game_party.battle_members.collect {|actor| actor.id }
  4532.   end
  4533.   #--------------------------------------------------------------------------
  4534.   # ● [追加]:メンバーが入れ替わったらオブジェクトを再作成する
  4535.   #--------------------------------------------------------------------------
  4536.   def refresh_actors
  4537.     a_party_members = party_members
  4538.     return if @last_party_members == a_party_members
  4539.     @last_party_members = a_party_members
  4540.     $game_party.battle_members.each {|actor| actor.sprite_effect_type=:appear }
  4541.     reset_sprite_effects
  4542.     @spriteset.dispose_actors
  4543.     @spriteset.create_actors
  4544.     status_clear
  4545.     refresh_status
  4546.     Graphics.frame_reset
  4547.   end
  4548.   #--------------------------------------------------------------------------
  4549.   # ● [追加]:ステータスウィンドウの情報を更新(メンバー交代用)
  4550.   #--------------------------------------------------------------------------
  4551.   def status_clear
  4552.     @status_window.all_clear
  4553.   end
  4554.   #--------------------------------------------------------------------------
  4555.   # ● [追加]:メッセージウィンドウの位置の初期化
  4556.   #  毎フレーム呼び出すことで、イベントコマンド以外のメッセージの位置を
  4557.   # 固定します。
  4558.   #--------------------------------------------------------------------------
  4559.   def standby_message_window_position
  4560.     $game_message.background = LNX11::MESSAGE_WINDOW_BACKGROUND
  4561.     $game_message.position = LNX11::MESSAGE_WINDOW_POSITION
  4562.   end
  4563.   #--------------------------------------------------------------------------
  4564.   # ● [再定義]:メッセージウィンドウを開く処理の更新
  4565.   #    ステータスウィンドウなどが閉じ終わるまでオープン度を 0 にする。
  4566.   #--------------------------------------------------------------------------
  4567.   def update_message_open
  4568.     if $game_message.busy?
  4569.       @party_command_window.close
  4570.       @actor_command_window.close
  4571.       $game_temp.battlelog_clear = true
  4572.     else
  4573.       standby_message_window_position
  4574.     end
  4575.   end
  4576.   #--------------------------------------------------------------------------
  4577.   # ● [追加]:ターゲットカーソル更新
  4578.   #--------------------------------------------------------------------------
  4579.   def update_targetcursor
  4580.     # 選択中のバトラーの座標を設定する
  4581.     if @actor_window.active
  4582.       # アクター選択ウィンドウがアクティブ
  4583.       @targetcursor.set(@actor_window.targetcursor, true)
  4584.     elsif @enemy_window.active
  4585.       # 敵キャラ選択ウィンドウがアクティブ
  4586.       @targetcursor.set(@enemy_window.targetcursor, true)
  4587.     elsif @status_window.index >= 0
  4588.       # ステータスウィンドウがアクティブ
  4589.       @targetcursor.set(@status_window.actor)
  4590.     else
  4591.       # どれもアクティブでない場合は非表示
  4592.       @targetcursor.hide
  4593.     end
  4594.     @targetcursor.update
  4595.   end
  4596.   #--------------------------------------------------------------------------
  4597.   # ● [追加]:ポップアップ更新
  4598.   #--------------------------------------------------------------------------
  4599.   def update_popup
  4600.     # ポップアップスプライトの更新
  4601.     popup_data.update
  4602.   end  
  4603.   #--------------------------------------------------------------------------
  4604.   # ● [エイリアス]:パーティコマンド選択の開始
  4605.   #--------------------------------------------------------------------------
  4606.   alias :lnx11a_start_party_command_selection :start_party_command_selection
  4607.   def start_party_command_selection
  4608.     # 元のメソッドを呼ぶ
  4609.     lnx11a_start_party_command_selection
  4610.     # バトルログ削除
  4611.     @log_window.lines_clear
  4612.     $game_temp.battlelog_clear = LNX11::STORAGE_TURNEND_CLEAR
  4613.     @actor_command = false
  4614.     # 2ターン目以降のパーテイコマンドスキップ
  4615.     return unless @party_command_skip
  4616.     @party_command_skip = false
  4617.     command_fight if !scene_changing? && @party_command_window.active
  4618.   end
  4619.   #--------------------------------------------------------------------------
  4620.   # ● [エイリアス]:アクターコマンド選択の開始
  4621.   #--------------------------------------------------------------------------
  4622.   alias :lnx11a_start_actor_command_selection :start_actor_command_selection
  4623.   def start_actor_command_selection
  4624.     # 元のメソッドを呼ぶ
  4625.     lnx11a_start_actor_command_selection
  4626.     @actor_command = true
  4627.   end
  4628.   #--------------------------------------------------------------------------
  4629.   # ● [エイリアス]:ターン終了
  4630.   #--------------------------------------------------------------------------
  4631.   alias :lnx11a_turn_end :turn_end
  4632.   def turn_end
  4633.     @party_command_skip = (LNX11::PARTY_COMMAND_SKIP && @actor_command)
  4634.     @actor_command = false
  4635.     # 元のメソッドを呼ぶ
  4636.     lnx11a_turn_end
  4637.   end
  4638.   #--------------------------------------------------------------------------
  4639.   # ● [追加]:アクターの選択したアイテム・スキルを返す
  4640.   #--------------------------------------------------------------------------
  4641.   def actor_selection_item
  4642.     case @actor_command_window.current_symbol
  4643.     when :attack ; $data_skills[BattleManager.actor.attack_skill_id]
  4644.     when :skill  ; @skill
  4645.     when :item   ; @item
  4646.     when :guard  ; $data_skills[BattleManager.actor.guard_skill_id]
  4647.     else ; nil
  4648.     end
  4649.   end
  4650.   #--------------------------------------------------------------------------
  4651.   # ● [エイリアス]:コマンド[防御]
  4652.   #--------------------------------------------------------------------------
  4653.   alias :lnx11a_command_guard :command_guard
  4654.   def command_guard
  4655.     if LNX11::GUARD_TARGET_CHECKE
  4656.       BattleManager.actor.input.set_guard
  4657.       # アクター選択
  4658.       select_actor_selection
  4659.     else
  4660.       # 元のメソッドを呼ぶ
  4661.       lnx11a_command_guard
  4662.     end
  4663.   end
  4664.   #--------------------------------------------------------------------------
  4665.   # ● [エイリアス]:アクター選択の開始
  4666.   #--------------------------------------------------------------------------
  4667.   alias :lnx11a_select_actor_selection :select_actor_selection
  4668.   def select_actor_selection
  4669.     # ターゲットチェック
  4670.     @actor_window.set_target(actor_selection_item)
  4671.     # 元のメソッドを呼ぶ
  4672.     lnx11a_select_actor_selection
  4673.     # ターゲットチェック
  4674.     @actor_window.set_target_refresh(actor_selection_item, BattleManager.actor)
  4675.   end
  4676.   #--------------------------------------------------------------------------
  4677.   # ● [エイリアス]:敵キャラ選択の開始
  4678.   #--------------------------------------------------------------------------
  4679.   alias :lnx11a_select_enemy_selection :select_enemy_selection
  4680.   def select_enemy_selection
  4681.     # ターゲットチェック
  4682.     @enemy_window.set_target(actor_selection_item)
  4683.     # 元のメソッドを呼ぶ
  4684.     lnx11a_select_enemy_selection
  4685.     # ターゲットチェック
  4686.     @enemy_window.set_target_refresh(actor_selection_item, BattleManager.actor)
  4687.   end
  4688.   #--------------------------------------------------------------------------
  4689.   # ● [エイリアス]アクター[キャンセル]
  4690.   #--------------------------------------------------------------------------
  4691.   alias :lnx11a_on_actor_cancel :on_actor_cancel
  4692.   def on_actor_cancel
  4693.     # 元のメソッドを呼ぶ
  4694.     lnx11a_on_actor_cancel
  4695.     # 防御の場合
  4696.     case @actor_command_window.current_symbol
  4697.     when :guard
  4698.       @actor_command_window.activate
  4699.     end    
  4700.   end
  4701.   #--------------------------------------------------------------------------
  4702.   # ● [エイリアス]:攻撃アニメーションの表示
  4703.   #--------------------------------------------------------------------------
  4704.   alias :lnx11a_show_attack_animation :show_attack_animation
  4705.   def show_attack_animation(targets)
  4706.     if @subject.actor?
  4707.       lnx11a_show_attack_animation(targets)
  4708.     else
  4709.       # 敵の通常攻撃アニメーション
  4710.       show_normal_animation(targets, @subject.atk_animation, false)
  4711.     end
  4712.   end
  4713. end
  4714.  
  4715. #==============================================================================
  4716. # ■ LNX11_Window_ActiveVisible
  4717. #------------------------------------------------------------------------------
  4718. #  バトル画面でターゲット選択中にウィンドウを非表示にするための
  4719. # ウィンドウ用モジュールです。
  4720. # ウィンドウの active と visible を連動させる役割があります。
  4721. # Window_ActorCommand,Window_BattleSkill, Window_BattleItem で
  4722. # インクルードされます。
  4723. #==============================================================================
  4724.  
  4725. module LNX11_Window_ActiveVisible
  4726.   #--------------------------------------------------------------------------
  4727.   # ● [オーバーライド]:ウィンドウのアクティブ化
  4728.   #--------------------------------------------------------------------------
  4729.   def activate
  4730.     self.show
  4731.     super
  4732.   end
  4733.   #--------------------------------------------------------------------------
  4734.   # ● [オーバーライド]:ウィンドウの非アクティブ化
  4735.   #--------------------------------------------------------------------------
  4736.   def deactivate
  4737.     @help_window != nil ? self.hide : self.visible = false
  4738.     super
  4739.   end
  4740. end
  4741.  
  4742. #==============================================================================
  4743. # ■ LNX11_Window_FittingList
  4744. #------------------------------------------------------------------------------
  4745. #  バトル画面のスキルリスト・アイテムリストを項目数に合わせてリサイズする
  4746. # ウィンドウ用モジュールです。
  4747. # Window_BattleSkill, Window_BattleItem でインクルードされます。
  4748. #==============================================================================
  4749.  
  4750. module LNX11_Window_FittingList
  4751.   #--------------------------------------------------------------------------
  4752.   # ● [追加]:ウィンドウの高さ(最大)
  4753.   #--------------------------------------------------------------------------
  4754.   def max_height
  4755.     @info_viewport.rect.y - @help_window.height
  4756.   end
  4757.   #--------------------------------------------------------------------------
  4758.   # ● [オーバーライド]:リフレッシュ
  4759.   #--------------------------------------------------------------------------
  4760.   def refresh
  4761.     make_item_list
  4762.     self.height = [fitting_height(row_max), max_height].min
  4763.     super
  4764.     self.oy = 0
  4765.   end
  4766. end
  4767.  
  4768. #==============================================================================
  4769. # ■ LNX11_Window_TargetHelp
  4770. #------------------------------------------------------------------------------
  4771. #  バトル画面で、ターゲット選択中にヘルプウィンドウを表示するための
  4772. # ウィンドウ用モジュールです。
  4773. # Window_BattleActor, Window_BattleEnemy でインクルードされます。
  4774. #==============================================================================
  4775.  
  4776. module LNX11_Window_TargetHelp
  4777.   #--------------------------------------------------------------------------
  4778.   # ● [追加]:ターゲットチェック
  4779.   #--------------------------------------------------------------------------
  4780.   def set_target(actor_selection_item)
  4781.     @cursor_fix = @cursor_all = @cursor_random = false
  4782.     item = actor_selection_item
  4783.     if actor_selection_item && !item.lnx11a_need_selection?
  4784.       # カーソルを固定
  4785.       @cursor_fix = true
  4786.       # 全体
  4787.       @cursor_all = item.for_all?
  4788.       # ランダム
  4789.       if item.for_random?
  4790.         @cursor_all = true
  4791.         @cursor_random = true
  4792.         @random_number = item.number_of_targets
  4793.       end
  4794.     end
  4795.     # 戦闘不能の味方が対象か?
  4796.     @dead_friend = item.for_dead_friend?
  4797.   end
  4798.   #--------------------------------------------------------------------------
  4799.   # ● [追加]:ターゲットチェック(リフレッシュ後)
  4800.   #--------------------------------------------------------------------------
  4801.   def set_target_refresh(actor_selection_item, actor)
  4802.     item = actor_selection_item
  4803.     # 使用者が対象なら、使用者にカーソルを合わせる
  4804.     select($game_party.members.index(actor)) if @cursor_fix && item.for_user?      
  4805.   end
  4806.   #--------------------------------------------------------------------------
  4807.   # ● [オーバーライド]:ウィンドウの表示
  4808.   #--------------------------------------------------------------------------
  4809.   def show
  4810.     @help_window.show
  4811.     super
  4812.   end
  4813.   #--------------------------------------------------------------------------
  4814.   # ● [オーバーライド]:ウィンドウの非表示
  4815.   #--------------------------------------------------------------------------
  4816.   def hide
  4817.     @help_window.hide
  4818.     super
  4819.   end
  4820. end
  4821.  
  4822. #==============================================================================
  4823. # ■ [追加]:Window_TargetHelp
  4824. #------------------------------------------------------------------------------
  4825. #  ターゲットの名前情報やスキルやアイテムの名前を表示します。
  4826. #==============================================================================
  4827.  
  4828. class Window_TargetHelp < Window_Help
  4829.   #--------------------------------------------------------------------------
  4830.   # ● 公開インスタンス変数
  4831.   #--------------------------------------------------------------------------
  4832.   attr_accessor :random_number  # 効果範囲ランダムの数
  4833.   #--------------------------------------------------------------------------
  4834.   # ● [オーバーライド]:オブジェクト初期化
  4835.   #--------------------------------------------------------------------------
  4836.   def initialize
  4837.     super(1) # 1行ヘルプ
  4838.   end
  4839.   #--------------------------------------------------------------------------
  4840.   # ● [オーバーライド]:ウィンドウの非表示
  4841.   #--------------------------------------------------------------------------
  4842.   def hide
  4843.     super
  4844.     clear
  4845.   end
  4846.   #--------------------------------------------------------------------------
  4847.   # ● [オーバーライド]:アイテム名設定
  4848.   #     item : スキル、アイテム、バトラー等
  4849.   #--------------------------------------------------------------------------
  4850.   def set_item(item)
  4851.     set_text(item ? item : "") # itemの説明ではなく、item自体を渡すようにする
  4852.   end
  4853.   #--------------------------------------------------------------------------
  4854.   # ● ゲージ幅
  4855.   #--------------------------------------------------------------------------
  4856.   def gauge_width
  4857.     LNX11::HELP_PARAM_WIDTH
  4858.   end
  4859.   #--------------------------------------------------------------------------
  4860.   # ● ゲージ幅(余白を含む)
  4861.   #--------------------------------------------------------------------------  
  4862.   def gauge_width_spacing
  4863.     LNX11::HELP_PARAM_WIDTH + 4
  4864.   end
  4865.   #--------------------------------------------------------------------------
  4866.   # ● パラメータエリアの幅
  4867.   #--------------------------------------------------------------------------  
  4868.   def param_width(size)
  4869.     gauge_width_spacing * size
  4870.   end
  4871.   #--------------------------------------------------------------------------
  4872.   # ● 効果範囲ランダムの数の取得
  4873.   #--------------------------------------------------------------------------
  4874.   def random_number
  4875.     # 全角にして返す
  4876.     @random_number.to_s.tr('0-9','0-9')
  4877.   end
  4878.   #--------------------------------------------------------------------------
  4879.   # ● [オーバーライド]:リフレッシュ
  4880.   #--------------------------------------------------------------------------
  4881.   def refresh
  4882.     contents.clear
  4883.     if @text == :party
  4884.       draw_text(contents.rect, "All Members", 1)
  4885.     elsif @text == :troop
  4886.       draw_text(contents.rect, "All Enemies", 1)
  4887.     elsif @text == :troop_random
  4888.       case LNX11::RANDOMSCOPE_DISPLAY
  4889.       when 0 ; draw_text(contents.rect, "All Enemies (Random)", 1)
  4890.       when 1 ; draw_text(contents.rect, "#{random_number} Random Enemies", 1)
  4891.       end
  4892.     elsif @text.is_a?(Game_Battler)
  4893.       # 選択対象の情報を描画
  4894.       draw_target_info
  4895.     elsif @text.is_a?(RPG::UsableItem)
  4896.       # アイテムかスキルならアイテム名を描画
  4897.       draw_item_name_help(@text)
  4898.     else
  4899.       # 通常のテキスト
  4900.       super
  4901.     end
  4902.   end
  4903.   #--------------------------------------------------------------------------
  4904.   # ● 選択対象の情報の描画
  4905.   #--------------------------------------------------------------------------
  4906.   def draw_target_info
  4907.     # バトラー情報の描画
  4908.     param = @text.actor? ? LNX11::HELP_ACTOR_PARAM : LNX11::HELP_ENEMY_PARAM
  4909.     # ゲージ付きステータス配列
  4910.     status = [param[:hp],param[:mp],param[:tp]&&$data_system.opt_display_tp]
  4911.     # 名前
  4912.     x = contents_width / 2 - contents.text_size(@text.name).width / 2
  4913.     name_width = contents.text_size(@text.name).width + 4
  4914.     if !status.include?(true)
  4915.       # ゲージ付きステータスを描画しない場合
  4916.       draw_targethelp_name(@text, x, name_width, param[:hp])
  4917.       x += name_width
  4918.       state_width = contents_width - x
  4919.     else
  4920.       # ゲージ付きステータスを描画する場合
  4921.       status.delete(false)
  4922.       x -= param_width(status.size) / 2
  4923.       draw_targethelp_name(@text, x, name_width, param[:hp])
  4924.       x += name_width
  4925.       state_width = contents_width - x - param_width(status.size)
  4926.     end
  4927.     # ステートアイコン
  4928.     if param[:state]
  4929.       draw_actor_icons(@text, x, 0, state_width)
  4930.     end
  4931.     # パラメータの描画
  4932.     x = contents_width - param_width(status.size)
  4933.     # HP
  4934.     if param[:hp]
  4935.       draw_actor_hp(@text, x, 0, gauge_width)
  4936.       x += gauge_width_spacing
  4937.     end
  4938.     # MP
  4939.     if param[:mp]
  4940.       draw_actor_mp(@text, x, 0, gauge_width)
  4941.       x += gauge_width_spacing
  4942.     end
  4943.     # TP
  4944.     if param[:tp] && $data_system.opt_display_tp
  4945.       draw_actor_tp(@text, x, 0, gauge_width)
  4946.       x += gauge_width_spacing
  4947.     end
  4948.   end
  4949.   #--------------------------------------------------------------------------
  4950.   # ● ターゲットの名前描画
  4951.   #--------------------------------------------------------------------------
  4952.   def draw_targethelp_name(actor, x, name_width, hp)
  4953.     if hp
  4954.       # HPゲージを伴う場合(HPが少ない場合、名前の色が変化する)
  4955.       draw_actor_name(actor, x, 0, name_width)
  4956.     else
  4957.       text = actor.name
  4958.       draw_text(x, 0, text_size(text).width + 4, line_height, text)
  4959.     end
  4960.   end
  4961.   #--------------------------------------------------------------------------
  4962.   # ● アイテムの描画(中央揃え)
  4963.   #--------------------------------------------------------------------------
  4964.   def draw_item_name_help(item)
  4965.     case LNX11::HELPDISPLAY_TYPE
  4966.     when 0 # アイコン+名前
  4967.       w = contents.text_size(@text.name).width + 28
  4968.     when 1 # 名前のみ
  4969.       w = contents.text_size(@text.name).width + 4
  4970.     end
  4971.     # 簡易説明文の描画
  4972.     if !@text.short_description.empty?
  4973.       des = LNX11::HELPDISPLAY_DESCRIPTION
  4974.       contents.font.size = des[:size]
  4975.       text = des[:delimiter] + @text.short_description
  4976.       rect = contents.text_size(text)
  4977.       w += rect.width
  4978.       x = (contents_width - w) / 2
  4979.       y = (line_height - rect.height) / 2
  4980.       draw_text(x, y, w, line_height, text, 2)
  4981.       reset_font_settings
  4982.     end
  4983.     # 名前の描画
  4984.     x = (contents_width - w) / 2
  4985.     case LNX11::HELPDISPLAY_TYPE
  4986.     when 0 # アイコン+名前
  4987.       draw_item_name(@text, x, 0, true, w)
  4988.     when 1 # 名前のみ
  4989.       draw_text(x, 0, contents_width, line_height, @text.name)
  4990.     end
  4991.   end
  4992. end
  4993.  
  4994. #==============================================================================
  4995. # ■ Window_PartyCommand
  4996. #------------------------------------------------------------------------------
  4997. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  4998. #==============================================================================
  4999.  
  5000. class Window_PartyCommand < Window_Command
  5001.   #--------------------------------------------------------------------------
  5002.   # ● [エイリアス]:オブジェクト初期化
  5003.   #--------------------------------------------------------------------------
  5004.   alias :lnx11a_initialize :initialize
  5005.   def initialize
  5006.     $game_party.last_party_command = nil
  5007.     # 元のメソッドを呼ぶ
  5008.     lnx11a_initialize
  5009.     # 座標を設定
  5010.     self.x = LNX11::PARTY_COMMAND_XY[:x]
  5011.     self.y = LNX11::PARTY_COMMAND_XY[:y]
  5012.   end
  5013.   #--------------------------------------------------------------------------
  5014.   # ● [オーバーライド]:ウィンドウ幅の取得
  5015.   #--------------------------------------------------------------------------
  5016.   def window_width
  5017.     return LNX11::PARTY_COMMAND_WIDTH
  5018.   end
  5019.   #--------------------------------------------------------------------------
  5020.   # ● [オーバーライド]:表示行数の取得
  5021.   #--------------------------------------------------------------------------
  5022.   def visible_line_number
  5023.     return LNX11::PARTY_COMMAND_HORIZON ? 1 : @list.size
  5024.   end
  5025.   #--------------------------------------------------------------------------
  5026.   # ● [オーバーライド]:桁数の取得
  5027.   #--------------------------------------------------------------------------
  5028.   def col_max
  5029.     return LNX11::PARTY_COMMAND_HORIZON ? @list.size : 1
  5030.   end
  5031.   #--------------------------------------------------------------------------
  5032.   # ● [オーバーライド]:アライメントの取得
  5033.   #--------------------------------------------------------------------------
  5034.   def alignment
  5035.     return LNX11::PARTY_COMMAND_ALIGNMENT
  5036.   end
  5037.   #--------------------------------------------------------------------------
  5038.   # ● [オーバーライド]:横に項目が並ぶときの空白の幅を取得
  5039.   #--------------------------------------------------------------------------
  5040.   def spacing
  5041.     return 8
  5042.   end
  5043.   #--------------------------------------------------------------------------
  5044.   # ● [オーバーライド]:ウィンドウを開く
  5045.   #--------------------------------------------------------------------------
  5046.   def open
  5047.     super
  5048.     # 最後に選択したコマンドを選択
  5049.     return self unless LNX11::LAST_PARTY_COMMAND
  5050.     last_command = $game_party.last_party_command
  5051.     if last_command && @list.include?(last_command)
  5052.       select(@list.index(last_command))
  5053.     end
  5054.     self
  5055.   end
  5056.   #--------------------------------------------------------------------------
  5057.   # ● [エイリアス]:ウィンドウを閉じる
  5058.   #--------------------------------------------------------------------------
  5059.   def close
  5060.     super
  5061.     # 選択したコマンドを記憶
  5062.     $game_party.last_party_command = @list[index] if index >= 0
  5063.     self
  5064.   end
  5065. end
  5066.  
  5067. #==============================================================================
  5068. # ■ Window_ActorCommand
  5069. #------------------------------------------------------------------------------
  5070. #  バトル画面で、アクターの行動を選択するウィンドウです。
  5071. #==============================================================================
  5072.  
  5073. class Window_ActorCommand < Window_Command
  5074.   include LNX11_Window_ActiveVisible
  5075.   #--------------------------------------------------------------------------
  5076.   # ● [オーバーライド]:ウィンドウ幅の取得
  5077.   #--------------------------------------------------------------------------
  5078.   def window_width
  5079.     return LNX11::ACTOR_COMMAND_WIDTH
  5080.   end
  5081.   #--------------------------------------------------------------------------
  5082.   # ● [オーバーライド]:表示行数の取得
  5083.   #--------------------------------------------------------------------------
  5084.   def visible_line_number
  5085.     list_size = LNX11::ACTOR_COMMAND_NOSCROLL ? @list.size : 4
  5086.     return LNX11::ACTOR_COMMAND_HORIZON ? 1 : list_size
  5087.   end
  5088.   #--------------------------------------------------------------------------
  5089.   # ● [オーバーライド]:桁数の取得
  5090.   #--------------------------------------------------------------------------
  5091.   def col_max
  5092.     return LNX11::ACTOR_COMMAND_HORIZON ? [@list.size, 1].max :  1
  5093.   end
  5094.   #--------------------------------------------------------------------------
  5095.   # ● [オーバーライド]:アライメントの取得
  5096.   #--------------------------------------------------------------------------
  5097.   def alignment
  5098.     return LNX11::ACTOR_COMMAND_ALIGNMENT
  5099.   end
  5100.   #--------------------------------------------------------------------------
  5101.   # ● [オーバーライド]:横に項目が並ぶときの空白の幅を取得
  5102.   #--------------------------------------------------------------------------
  5103.   def spacing
  5104.     return 8
  5105.   end
  5106.   #--------------------------------------------------------------------------
  5107.   # ● [追加]:X 座標をアクターに合わせる
  5108.   #--------------------------------------------------------------------------
  5109.   def actor_x(actor)
  5110.     ax = $game_party.members_screen_x_nooffset[actor.index] - self.width / 2
  5111.     pad = LNX11::STATUS_SIDE_PADDING / 2
  5112.     # 画面内に収める
  5113.     self.x = [[ax, pad].max, Graphics.width - pad - self.width].min
  5114.     self.x += LNX11::ACTOR_COMMAND_OFFSET[:x]
  5115.   end
  5116.   #--------------------------------------------------------------------------
  5117.   # ● [追加]:Y 座標をアクターに合わせる
  5118.   #--------------------------------------------------------------------------
  5119.   def actor_y(actor)
  5120.     self.y = actor.screen_y_top - self.height
  5121.     self.y += LNX11::ACTOR_COMMAND_OFFSET[:y]
  5122.   end
  5123.   #--------------------------------------------------------------------------
  5124.   # ● [追加]:固定 Y 座標
  5125.   #--------------------------------------------------------------------------
  5126.   def screen_y
  5127.     if LNX11::ACTOR_COMMAND_Y_POSITION == 0
  5128.       self.y = Graphics.height - self.height + LNX11::ACTOR_COMMAND_OFFSET[:y]
  5129.     else
  5130.       self.y = LNX11::ACTOR_COMMAND_OFFSET[:y]
  5131.     end
  5132.   end
  5133.   #--------------------------------------------------------------------------
  5134.   # ● [エイリアス]:セットアップ
  5135.   #--------------------------------------------------------------------------
  5136.   alias :lnx11a_setup :setup
  5137.   def setup(actor)
  5138.     # 前のアクターのコマンドを記憶
  5139.     @actor.last_actor_command = @list[index] if @actor
  5140.     # 元のメソッドを呼ぶ
  5141.     lnx11a_setup(actor)
  5142.     self.arrows_visible = !LNX11::ACTOR_COMMAND_NOSCROLL
  5143.     self.height = window_height
  5144.     self.oy = 0
  5145.     # アクターコマンドの表示位置で分岐
  5146.     case LNX11::ACTOR_COMMAND_POSITION
  5147.     when 0
  5148.       # アクターの頭上
  5149.       actor_x(actor)
  5150.       actor_y(actor)
  5151.     when 1
  5152.       # Y 座標固定
  5153.       actor_x(actor)
  5154.       screen_y
  5155.     when 2
  5156.       # XY固定
  5157.       self.x = LNX11::ACTOR_COMMAND_OFFSET[:x]
  5158.       screen_y
  5159.     end
  5160.     # 最後に選択したコマンドを選択
  5161.     return unless LNX11::LAST_ACTOR_COMMAND
  5162.     last_command = @actor.last_actor_command
  5163.     if last_command && @list.include?(last_command)
  5164.       select(@list.index(last_command))
  5165.     end
  5166.   end
  5167. end
  5168.  
  5169. #==============================================================================
  5170. # ■ Window_BattleStatus
  5171. #------------------------------------------------------------------------------
  5172. #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
  5173. #==============================================================================
  5174.  
  5175. class Window_BattleStatus < Window_Selectable
  5176.   #--------------------------------------------------------------------------
  5177.   # ● [追加]:公開インスタンス変数
  5178.   #--------------------------------------------------------------------------
  5179.   attr_reader :min_offset   # ステータス描画 X 座標の位置修正
  5180.   #--------------------------------------------------------------------------
  5181.   # ● [エイリアス]:オブジェクト初期化
  5182.   #--------------------------------------------------------------------------
  5183.   alias :lnx11a_initialize :initialize
  5184.   def initialize
  5185.     @actor_last_status = Array.new($game_party.max_battle_members) { nil }    
  5186.     # 元のメソッドを呼ぶ
  5187.     lnx11a_initialize
  5188.     # ウィンドウを最初から表示
  5189.     self.openness = 255
  5190.     self.opacity = 0
  5191.     update_invisible
  5192.   end
  5193.   #--------------------------------------------------------------------------
  5194.   # ● [オーバーライド]:行の高さを取得
  5195.   #--------------------------------------------------------------------------
  5196.   def line_height
  5197.     return LNX11::STATUS_LINE_HEIGHT
  5198.   end
  5199.   #--------------------------------------------------------------------------
  5200.   # ● [オーバーライド]:標準パディングサイズの取得
  5201.   #--------------------------------------------------------------------------
  5202.   def standard_padding
  5203.     return 0
  5204.   end
  5205.   #--------------------------------------------------------------------------
  5206.   # ● [オーバーライド]:表示行数の取得
  5207.   #--------------------------------------------------------------------------
  5208.   def visible_line_number
  5209.     return $data_system.opt_display_tp ? 4 : 3
  5210.   end
  5211.   #--------------------------------------------------------------------------
  5212.   # ● [オーバーライド]:桁数の取得
  5213.   #--------------------------------------------------------------------------
  5214.   def col_max
  5215.     return [item_max, 1].max
  5216.   end
  5217.   #--------------------------------------------------------------------------
  5218.   # ● [オーバーライド]:横に項目が並ぶときの空白の幅を取得
  5219.   #--------------------------------------------------------------------------
  5220.   def spacing
  5221.     return 0
  5222.   end
  5223.   #--------------------------------------------------------------------------
  5224.   # ● [オーバーライド]:項目の高さを取得
  5225.   #--------------------------------------------------------------------------
  5226.   def item_height
  5227.     self.height
  5228.   end  
  5229.   #--------------------------------------------------------------------------
  5230.   # ● [再定義]:ウィンドウ幅の取得
  5231.   #--------------------------------------------------------------------------
  5232.   def window_width
  5233.     Graphics.width
  5234.   end
  5235.   #--------------------------------------------------------------------------
  5236.   # ● [エイリアス]:ウィンドウ高さの取得
  5237.   #--------------------------------------------------------------------------
  5238.   alias :lnx11a_window_height :window_height
  5239.   def window_height
  5240.     # 一行目(名前・ステート)の高さを確保する
  5241.     lnx11a_window_height - line_height + [24, line_height].max
  5242.   end
  5243.   #--------------------------------------------------------------------------
  5244.   # ● [オーバーライド]:カーソルの更新
  5245.   #--------------------------------------------------------------------------
  5246.   def update_cursor
  5247.     # カーソルを表示しない
  5248.     cursor_rect.empty
  5249.   end
  5250.   #--------------------------------------------------------------------------
  5251.   # ● [オーバーライド]:システム色の取得
  5252.   #  ゲージ幅が短すぎる場合、HP,MP,TP の文字を非表示にします。
  5253.   #--------------------------------------------------------------------------
  5254.   def system_color
  5255.     gauge_area_width - @min_offset >= 52 ? super : Color.new
  5256.   end  
  5257.   #--------------------------------------------------------------------------
  5258.   # ● [オーバーライド]:ゲージ背景色の取得
  5259.   #   ゲージの透明度を適用します。  
  5260.   #--------------------------------------------------------------------------
  5261.   def gauge_back_color
  5262.     color = super
  5263.     color.alpha *= LNX11::STATUS_GAUGE_OPACITY / 255.0
  5264.     color
  5265.   end
  5266.   #--------------------------------------------------------------------------
  5267.   # ● [オーバーライド]:ゲージの描画
  5268.   #   ゲージの透明度を適用します。
  5269.   #--------------------------------------------------------------------------
  5270.   def draw_gauge(x, y, width, rate, color1, color2)
  5271.     oparate = LNX11::STATUS_GAUGE_OPACITY / 255.0
  5272.     color1.alpha *= oparate
  5273.     color2.alpha *= oparate
  5274.     super
  5275.   end
  5276.   #--------------------------------------------------------------------------
  5277.   # ● [オーバーライド]:フレーム更新
  5278.   #--------------------------------------------------------------------------
  5279.   def update
  5280.     super
  5281.     update_invisible
  5282.   end
  5283.   #--------------------------------------------------------------------------
  5284.   # ● [追加]:表示状態更新
  5285.   #--------------------------------------------------------------------------
  5286.   def update_invisible
  5287.     self.contents_opacity = $game_party.status_invisible ? 0 : 255
  5288.   end  
  5289.   #--------------------------------------------------------------------------
  5290.   # ● [追加]:アクターオブジェクト取得
  5291.   #--------------------------------------------------------------------------
  5292.   def actor
  5293.     $game_party.members[@index]
  5294.   end
  5295.   #--------------------------------------------------------------------------
  5296.   # ● [追加]:座標の設定
  5297.   #--------------------------------------------------------------------------
  5298.   def set_xy
  5299.     # ステータス位置の調整:画面からはみ出ないようにする
  5300.     pw = $game_party.members_screen_x.last + LNX11::STATUS_OFFSET[:x]
  5301.     pw += gauge_area_width / 2
  5302.     right_end = Graphics.width - LNX11::STATUS_SIDE_PADDING
  5303.     min_offset = pw > right_end ? pw - right_end : 0
  5304.     # ステータスのオフセットを適用
  5305.     self.x = LNX11::STATUS_OFFSET[:x] - min_offset
  5306.     self.y = LNX11::STATUS_OFFSET[:y] + Graphics.height - self.height
  5307.     # ステータス幅の自動調整:位置を調整した分だけ幅を縮める
  5308.     @min_offset = LNX11::STATUS_AUTOADJUST ? min_offset : 0
  5309.   end
  5310.   #--------------------------------------------------------------------------
  5311.   # ● [再定義]:ゲージエリアの幅を取得
  5312.   #--------------------------------------------------------------------------
  5313.   def gauge_area_width
  5314.     return LNX11::STATUS_WIDTH
  5315.   end
  5316.   #--------------------------------------------------------------------------
  5317.   # ● [追加]:表示するステート数の取得
  5318.   #--------------------------------------------------------------------------
  5319.   def states(actor, width)
  5320.     icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
  5321.     icons.size
  5322.   end
  5323.   #--------------------------------------------------------------------------
  5324.   # ● [追加]:名前とステートの描画(1行表示)
  5325.   #  width の範囲で名前を左揃え、ステートアイコンを右揃えで描画します。
  5326.   # ステートを優先して表示するため、アイコンが多すぎて名前の表示領域が
  5327.   # 極端に狭くなる場合は名前を描画しません。
  5328.   #--------------------------------------------------------------------------
  5329.   def draw_actor_name_with_icons(actor, x, y, width = 128, draw_name = true)
  5330.     # アイコンのY座標補正
  5331.     iy = ([line_height, 24].max - 24) / 2
  5332.     # 名前のY座標補正
  5333.     ny = ([line_height, 24].max - LNX11::STATUS_NAME_SIZE) / 2
  5334.     # 表示するステート数を取得
  5335.     icon = states(actor, width)
  5336.     if icon > 0
  5337.       # 表示するべきステートがある場合
  5338.       name_width = width - icon * 24
  5339.       ix = x + width - icon * 24
  5340.       if name_width >= contents.font.size * 2 && draw_name
  5341.         # 名前の表示領域(width) が フォントサイズ * 2 以上なら両方を描画
  5342.         draw_actor_name(actor, x, y + ny,  name_width)
  5343.         iw = width - name_width
  5344.         draw_actor_icons(actor, ix, y + iy, iw)
  5345.       else
  5346.         # ステートのみ描画
  5347.         draw_actor_icons(actor, ix, y + iy, width)
  5348.       end
  5349.     elsif draw_name
  5350.       # ない場合、名前のみ描画
  5351.       draw_actor_name(actor, x, y + ny, width)
  5352.     end
  5353.   end
  5354.   #--------------------------------------------------------------------------
  5355.   # ● [再定義]:リフレッシュ
  5356.   #--------------------------------------------------------------------------
  5357.   def refresh
  5358.     set_xy
  5359.     draw_all_items
  5360.   end
  5361.   #--------------------------------------------------------------------------
  5362.   # ● [オーバーライド]:項目を描画する矩形の取得
  5363.   #--------------------------------------------------------------------------
  5364.   def item_rect(index)
  5365.     rect = super
  5366.     rect.x = $game_party.members_screen_x[index] - gauge_area_width / 2
  5367.     rect.width = gauge_area_width
  5368.     rect
  5369.   end
  5370.   #--------------------------------------------------------------------------
  5371.   # ● [再定義]:基本エリアの矩形を取得
  5372.   #--------------------------------------------------------------------------
  5373.   def basic_area_rect(index)
  5374.     rect = item_rect(index)
  5375.     rect
  5376.   end
  5377.   #--------------------------------------------------------------------------
  5378.   # ● [再定義]:ゲージエリアの矩形を取得
  5379.   #--------------------------------------------------------------------------
  5380.   def gauge_area_rect(index)
  5381.     rect = basic_area_rect(index)
  5382.     rect.y += [24, line_height].max
  5383.     rect.x += @min_offset
  5384.     rect
  5385.   end
  5386.   #--------------------------------------------------------------------------
  5387.   # ● [再定義]:基本エリアの描画
  5388.   #--------------------------------------------------------------------------
  5389.   def draw_basic_area(rect, actor)
  5390.     # フォントサイズ変更
  5391.     contents.font.size = [LNX11::STATUS_NAME_SIZE, 8].max
  5392.     # 名前とステートを描画
  5393.     dn = LNX11::STATUS_NAME_SIZE > 0 # 名前を描画するか?
  5394.     width = gauge_area_width - @min_offset
  5395.     rest  = width % 24
  5396.     width += 24 - rest if rest > 0
  5397.     draw_actor_name_with_icons(actor, rect.x, rect.y, width, dn)
  5398.     # フォントサイズを元に戻す
  5399.     reset_font_settings
  5400.   end
  5401.   #--------------------------------------------------------------------------
  5402.   # ● [エイリアス]:ゲージエリアの描画
  5403.   #--------------------------------------------------------------------------
  5404.   alias :lnx11a_draw_gauge_area :draw_gauge_area
  5405.   def draw_gauge_area(*args)
  5406.     # フォントサイズ変更
  5407.     contents.font.size = LNX11::STATUS_PARAM_SIZE
  5408.     # 元のメソッドを呼ぶ
  5409.     lnx11a_draw_gauge_area(*args)
  5410.     # フォントサイズを元に戻す
  5411.     reset_font_settings
  5412.   end
  5413.   #--------------------------------------------------------------------------
  5414.   # ● [再定義]:ゲージエリアの描画(TP あり)
  5415.   #--------------------------------------------------------------------------
  5416.   def draw_gauge_area_with_tp(rect, actor)
  5417.     width = gauge_area_width - @min_offset
  5418.     draw_actor_hp(actor, rect.x, rect.y,                   width)
  5419.     draw_actor_mp(actor, rect.x, rect.y + line_height,     width)
  5420.     draw_actor_tp(actor, rect.x, rect.y + line_height * 2, width)
  5421.   end
  5422.   #--------------------------------------------------------------------------
  5423.   # ● [再定義]:ゲージエリアの描画(TP なし)
  5424.   #--------------------------------------------------------------------------
  5425.   def draw_gauge_area_without_tp(rect, actor)
  5426.     draw_actor_hp(actor, rect.x, rect.y,               gauge_area_width)
  5427.     draw_actor_mp(actor, rect.x, rect.y + line_height, gauge_area_width)
  5428.   end
  5429.   #--------------------------------------------------------------------------
  5430.   # ● [再定義]:項目の描画
  5431.   #--------------------------------------------------------------------------
  5432.   def draw_item(index)
  5433.     actor = $game_party.battle_members[index]
  5434.     a_status = status(actor)
  5435.     # ステータスが変化した場合のみ描画する
  5436.     return if @actor_last_status[index] == a_status
  5437.     @actor_last_status[index] = a_status
  5438.     contents.clear_rect(item_rect(index))
  5439.     draw_basic_area(basic_area_rect(index), actor)
  5440.     draw_gauge_area(gauge_area_rect(index), actor)
  5441.   end
  5442.   #--------------------------------------------------------------------------
  5443.   # ● [追加]:アクターのステータス配列を返す
  5444.   #--------------------------------------------------------------------------
  5445.   def status(actor)
  5446.     if $data_system.opt_display_tp
  5447.       return [actor.name, actor.state_icons + actor.buff_icons,
  5448.               actor.mhp, actor.hp, actor.mmp, actor.mp, actor.max_tp, actor.tp]
  5449.     else
  5450.       # TP を除くステータス配列
  5451.       return [actor.name, actor.state_icons + actor.buff_icons,
  5452.               actor.mhp, actor.hp, actor.mmp, actor.mp]
  5453.     end
  5454.   end
  5455.   #--------------------------------------------------------------------------
  5456.   # ● [追加]:内容の消去
  5457.   #--------------------------------------------------------------------------
  5458.   def all_clear
  5459.     contents.clear
  5460.     @actor_last_status = Array.new($game_party.max_battle_members) { nil }    
  5461.   end
  5462. end
  5463.  
  5464. #==============================================================================
  5465. # ■ Window_BattleActor
  5466. #------------------------------------------------------------------------------
  5467. #  バトル画面で、行動対象のアクターを選択するウィンドウです。
  5468. # XPスタイルバトルではバトルステータスを非表示にしないため、
  5469. # 選択機能だけを持つ不可視のウィンドウとして扱います。
  5470. #==============================================================================
  5471.  
  5472. class Window_BattleActor < Window_BattleStatus
  5473.   include LNX11_Window_TargetHelp
  5474.   #--------------------------------------------------------------------------
  5475.   # ● [エイリアス]:オブジェクト初期化
  5476.   #--------------------------------------------------------------------------
  5477.   alias :lnx11a_wba_initialize :initialize
  5478.   def initialize(info_viewport)
  5479.     # 元のメソッドを呼ぶ
  5480.     lnx11a_wba_initialize(info_viewport)
  5481.     # ウィンドウを画面外に移動
  5482.     self.y = Graphics.height
  5483.   end
  5484.   #--------------------------------------------------------------------------
  5485.   # ● [オーバーライド]:ヘルプテキスト更新
  5486.   #--------------------------------------------------------------------------
  5487.   def update_help
  5488.     @help_window.set_item(targetcursor)
  5489.   end
  5490.   #--------------------------------------------------------------------------
  5491.   # ● [追加]:ターゲットカーソルに渡すオブジェクト
  5492.   #--------------------------------------------------------------------------
  5493.   def targetcursor
  5494.     @cursor_all ? :party : actor
  5495.   end
  5496.   #--------------------------------------------------------------------------
  5497.   # ● [オーバーライド]:ウィンドウ幅の取得
  5498.   #--------------------------------------------------------------------------
  5499.   def window_width
  5500.     64
  5501.   end
  5502.   #--------------------------------------------------------------------------
  5503.   # ● [オーバーライド]:全項目の描画
  5504.   #--------------------------------------------------------------------------
  5505.   def draw_all_items
  5506.     # 何もしない    
  5507.   end
  5508.   #--------------------------------------------------------------------------
  5509.   # ● [オーバーライド]:項目の描画
  5510.   #--------------------------------------------------------------------------
  5511.   def draw_item(index)
  5512.     # 何もしない
  5513.   end
  5514.   #--------------------------------------------------------------------------
  5515.   # ● [オーバーライド]:リフレッシュ
  5516.   #--------------------------------------------------------------------------
  5517.   def refresh
  5518.     # 何もしない
  5519.   end
  5520.   #--------------------------------------------------------------------------
  5521.   # ● [エイリアス]:ウィンドウの表示
  5522.   #--------------------------------------------------------------------------
  5523.   alias :lnx11a_show :show
  5524.   def show
  5525.     # 元のメソッドを呼ぶ
  5526.     lnx11a_show
  5527.     # 最後に選択したアクターを選択
  5528.     last_target = $game_temp.last_target_cursor[:actor]
  5529.     if last_target && $game_party.members.include?(last_target) &&
  5530.        LNX11::LAST_TARGET
  5531.       select($game_party.members.index(last_target))
  5532.     end
  5533.     # スマートターゲットセレクト
  5534.     if LNX11::SMART_TARGET_SELECT && !@cursor_fix
  5535.       if @dead_friend && (!last_target || last_target && last_target.alive?)
  5536.         dead_actor = $game_party.dead_members[0]
  5537.         select($game_party.members.index(dead_actor)) if dead_actor
  5538.       elsif !@dead_friend && (!last_target || last_target && last_target.dead?)
  5539.         alive_actor = $game_party.alive_members[0]
  5540.         select($game_party.members.index(alive_actor)) if alive_actor
  5541.       end
  5542.     end
  5543.     self
  5544.   end
  5545.   #--------------------------------------------------------------------------
  5546.   # ● [エイリアス]:ウィンドウの非表示
  5547.   #--------------------------------------------------------------------------
  5548.   alias :lnx11a_hide :hide
  5549.   def hide
  5550.     # 元のメソッドを呼ぶ
  5551.     lnx11a_hide
  5552.     # 選択したアクターを記憶
  5553.     $game_temp.last_target_cursor[:actor] = actor
  5554.     self
  5555.   end
  5556. end
  5557.  
  5558. #==============================================================================
  5559. # ■ Window_BattleEnemy
  5560. #------------------------------------------------------------------------------
  5561. #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。
  5562. # 横並びの不可視のウィンドウとして扱います。
  5563. #==============================================================================
  5564.  
  5565. class Window_BattleEnemy < Window_Selectable
  5566.   include LNX11_Window_TargetHelp
  5567.   #--------------------------------------------------------------------------
  5568.   # ● [エイリアス]:オブジェクト初期化
  5569.   #--------------------------------------------------------------------------
  5570.   alias :lnx11a_initialize :initialize
  5571.   def initialize(info_viewport)
  5572.     # 敵キャラオブジェクトの設定
  5573.     set_enemy
  5574.     # 元のメソッドを呼ぶ
  5575.     lnx11a_initialize(info_viewport)
  5576.     # ウィンドウを画面外に移動
  5577.     self.y = Graphics.height
  5578.   end
  5579.   #--------------------------------------------------------------------------
  5580.   # ● [追加]:敵キャラオブジェクトの設定
  5581.   #--------------------------------------------------------------------------
  5582.   def set_enemy
  5583.     if LNX11::TROOP_X_SORT
  5584.       @troop = $game_troop.alive_members.sort {|a,b| a.screen_x <=> b.screen_x}
  5585.     else
  5586.       @troop = $game_troop.alive_members
  5587.     end
  5588.   end
  5589.   #--------------------------------------------------------------------------
  5590.   # ● [再定義]:敵キャラオブジェクト取得
  5591.   #--------------------------------------------------------------------------
  5592.   def enemy
  5593.     @troop[@index]
  5594.   end
  5595.   #--------------------------------------------------------------------------
  5596.   # ● [オーバーライド]:ウィンドウ幅の取得
  5597.   #--------------------------------------------------------------------------
  5598.   def window_width
  5599.     64
  5600.   end
  5601.   #--------------------------------------------------------------------------
  5602.   # ● [オーバーライド]:指定行数に適合するウィンドウの高さを計算
  5603.   #--------------------------------------------------------------------------
  5604.   def fitting_height(line_number)
  5605.     super(1)
  5606.   end
  5607.   #--------------------------------------------------------------------------
  5608.   # ● [オーバーライド]:桁数の取得
  5609.   #--------------------------------------------------------------------------
  5610.   def col_max
  5611.     return item_max
  5612.   end
  5613.   #--------------------------------------------------------------------------
  5614.   # ● [オーバーライド]:ヘルプテキスト更新
  5615.   #--------------------------------------------------------------------------
  5616.   def update_help
  5617.     @help_window.random_number = @random_number
  5618.     @help_window.set_item(targetcursor)
  5619.   end
  5620.   #--------------------------------------------------------------------------
  5621.   # ● [追加]:ターゲットカーソルに渡すオブジェクト
  5622.   #--------------------------------------------------------------------------
  5623.   def targetcursor
  5624.     @cursor_all ? (@cursor_random ? :troop_random : :troop) : enemy
  5625.   end
  5626.   #--------------------------------------------------------------------------
  5627.   # ● [エイリアス]:ウィンドウの表示
  5628.   #--------------------------------------------------------------------------
  5629.   alias :lnx11a_show :show
  5630.   def show
  5631.     # 元のメソッドを呼ぶ
  5632.     lnx11a_show
  5633.     # 敵キャラオブジェクトの設定
  5634.     set_enemy
  5635.     return self unless LNX11::LAST_TARGET
  5636.     # 最後に選択した敵キャラを選択
  5637.     last_target = $game_temp.last_target_cursor[:enemy]
  5638.     if last_target && @troop.include?(last_target)
  5639.       select(@troop.index(last_target))
  5640.     end
  5641.     self
  5642.   end
  5643.   #--------------------------------------------------------------------------
  5644.   # ● [エイリアス]:ウィンドウの非表示
  5645.   #--------------------------------------------------------------------------
  5646.   alias :lnx11a_hide :hide
  5647.   def hide
  5648.     # 元のメソッドを呼ぶ
  5649.     lnx11a_hide
  5650.     # 選択した敵キャラを記憶
  5651.     $game_temp.last_target_cursor[:enemy] = enemy
  5652.     self
  5653.   end
  5654. end
  5655.  
  5656. #==============================================================================
  5657. # ■ Window_BattleSkill
  5658. #------------------------------------------------------------------------------
  5659. #  いくつかのモジュールをインクルードします。
  5660. #==============================================================================
  5661.  
  5662. class Window_BattleSkill < Window_SkillList
  5663.   include LNX11_Window_ActiveVisible
  5664.   include LNX11_Window_FittingList if LNX11::FITTING_LIST
  5665. end
  5666.  
  5667. #==============================================================================
  5668. # ■ Window_BattleItem
  5669. #------------------------------------------------------------------------------
  5670. #  いくつかのモジュールをインクルードします。
  5671. #==============================================================================
  5672.  
  5673. class Window_BattleItem < Window_ItemList
  5674.   include LNX11_Window_ActiveVisible
  5675.   include LNX11_Window_FittingList if LNX11::FITTING_LIST
  5676. end
  5677. # l:5582