Project1

标题: 關於物品詳細顯示腳本,如何在戰鬥中不會干擾戰鬥選項? [打印本页]

作者: a000b1745    时间: 2013-3-2 00:57
标题: 關於物品詳細顯示腳本,如何在戰鬥中不會干擾戰鬥選項?
本帖最后由 a000b1745 于 2013-3-2 00:59 编辑

以下是可以顯示詳細物品/技能/裝備資料的腳本~但是這個腳本在戰鬥中,我在查看技能詳細說明的時候,
角色的戰鬥選項(攻擊.魔法.特技.防禦等...)也會跟著跑,
有沒有辦法在戰鬥中呼出這個詳細顯示後,方向鍵不會去選戰鬥選項??
又或是乾脆讓戰鬥中無法開啟詳細說明的視窗??

{:2_253:}

RUBY 代码复制
  1. #==============================================================================
  2. # ★ RGSS3_アイテム詳細表示 Ver1.3
  3. #==============================================================================
  4. =begin
  5.  
  6. 作者:tomoaky
  7. webサイト:ひきも記 ([url]http://hikimoki.sakura.ne.jp/[/url])
  8.  
  9. アイテム(スキル)を選択中にXボタン(初期設定では Aキー)を押すことで
  10. 各パラメータ補正値などの詳細を別ウィンドウで表示することができます。
  11.  
  12. アイテム(スキル)のメモ欄に <詳細 説明文> と書けば 説明文 の部分が
  13. 効果(特徴)の欄に追加表示されます。複数の詳細タグを設定することもできます。
  14.  
  15. 使用禁止フラグとして設定したゲームスイッチ(初期設定では4,5番)を
  16. 使って機能を停止することができます。
  17.  
  18. === 注意点 ===
  19.   ・表示される特徴は最大10個、それ以上は省略されます
  20.  
  21.  
  22. 使用するゲームスイッチ(初期設定)
  23.   0004, 0005
  24.  
  25. 2012.02.17  Ver1.3
  26.  ・一部特徴の正負が正しく表示されない不具合を修正
  27.  ・スキルコスト拡張のHP消費とMP(TP)割合表示に対応
  28.  
  29. 2012.01.06  Ver1.12
  30.   ・装備の特徴:攻撃時ステートの値が正しく表示されない不具合を修正
  31.  ・ステータス表示拡張との競合不具合を修正
  32.  ・詳細表示に利用するボタンの設定を追加
  33.  
  34. 2011.12.19  Ver1.11
  35.   ・RGSS3_スキル習得システムに対応しました
  36.  
  37. 2011.12.18  Ver1.1
  38.  ・装備シーンのスロットウィンドウに対応しました
  39.   ・詳細タグによる効果(特徴)の追加表示機能を追加しました
  40.  
  41. 2011.12.17  Ver1.01
  42.  ・ステート付加に通常攻撃が設定されたスキルでエラー落ちする不具合を修正
  43.  
  44. 2011.12.15  Ver1.0
  45.   公開
  46.  
  47. =end
  48.  
  49. $tmscripts = {} unless $tmscripts
  50. $tmscripts["itwin"] = true
  51.  
  52. #==============================================================================
  53. # □ 設定項目
  54. #==============================================================================
  55. module TMITWIN
  56.   SW_NOUSE_ITEM_INFO  = 4   # アイテム詳細機能の使用禁止フラグスイッチ番号
  57.   SW_NOUSE_SKILL_INFO = 5   # スキル詳細機能の使用禁止フラグスイッチ番号
  58.  
  59.   FEATURE_X   = 256         # 特徴を描画するX座標
  60.   PARAM_WIDTH = 120         # 能力値を描画する幅
  61.  
  62.   # 特徴『攻撃時属性』の表示から除外する属性
  63.   EXCLUDE_ELEMENTS = [1]
  64.  
  65.   KEY_SYMBOL = :X           # 詳細表示に利用するボタンの設定
  66. end
  67.  
  68. #==============================================================================
  69. # ■ Vocab
  70. #==============================================================================
  71. module Vocab
  72.  
  73.   # 効果範囲
  74.   def self.scope(param_id)
  75.     case param_id
  76.     when 0; "なし"
  77.     when 1; "敵単体"
  78.     when 2; "敵全体"
  79.     when 3; "敵1体ランダム"
  80.     when 4; "敵2体ランダム"
  81.     when 5; "敵3体ランダム"
  82.     when 6; "敵4体ランダム"
  83.     when 7; "味方単体"
  84.     when 8; "味方全体"
  85.     when 9; "味方単体(戦闘不能)"
  86.     when 10; "味方全体(戦闘不能)"
  87.     when 11; "使用者"
  88.     end
  89.   end
  90.  
  91.   # ダメージタイプ
  92.   def self.damage_type(param_id)
  93.     case param_id
  94.     when 1; "HPダメージ"
  95.     when 2; "MPダメージ"
  96.     when 3; "HP回復"
  97.     when 4; "MP回復"
  98.     when 5; "HP吸収"
  99.     when 6; "MP吸収"
  100.     end
  101.   end
  102.  
  103.   # 追加能力値
  104.   def self.ex_param(param_id)
  105.     case param_id
  106.     when 0; "命中率"
  107.     when 1; "回避率"
  108.     when 2; "会心率"
  109.     when 3; "会心回避率"
  110.     when 4; "魔法回避率"
  111.     when 5; "魔法反射率"
  112.     when 6; "反撃率"
  113.     when 7; "HP自動回復"
  114.     when 8; "MP自動回復"
  115.     when 9; "TP自動回復"
  116.     end
  117.   end
  118.  
  119.   # 特殊能力値
  120.   def self.special_param(param_id)
  121.     case param_id
  122.     when 0; "狙われやすさ"
  123.     when 1; "防御効果"
  124.     when 2; "回復効果"
  125.     when 3; "薬の知識"
  126.     when 4; "MP消費"
  127.     when 5; "TPチャージ"
  128.     when 6; "物理ダメージ"
  129.     when 7; "魔法ダメージ"
  130.     when 8; "地形ダメージ"
  131.     when 9; "取得経験値"
  132.     end
  133.   end
  134.  
  135.   # 特殊フラグ
  136.   def self.special_flag(param_id)
  137.     case param_id
  138.     when 0; "自動戦闘"
  139.     when 1; "防御"
  140.     when 2; "身代わり"
  141.     when 3; "TP持ち越し"
  142.     end
  143.   end
  144. end
  145.  
  146. #==============================================================================
  147. # ■ Window_ItemList
  148. #==============================================================================
  149. class Window_ItemList
  150.   #--------------------------------------------------------------------------
  151.   # ● 決定やキャンセルなどのハンドリング処理
  152.   #--------------------------------------------------------------------------
  153.   alias tmitwin_window_itemlist_process_handling process_handling
  154.   def process_handling
  155.     tmitwin_window_itemlist_process_handling
  156.     return unless open? && active
  157.     return process_description if Input.trigger?(TMITWIN::KEY_SYMBOL)
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ○ 説明ボタンが押されたときの処理
  161.   #--------------------------------------------------------------------------
  162.   def process_description
  163.     unless $game_switches[TMITWIN::SW_NOUSE_ITEM_INFO]
  164.       if @data[index]
  165.         Sound.play_ok
  166.         Input.update
  167.         deactivate
  168.         call_handler(:description)
  169.       else
  170.         Sound.play_buzzer
  171.       end
  172.     end
  173.   end
  174. end
  175.  
  176. #==============================================================================
  177. # ■ Window_SkillList
  178. #==============================================================================
  179. class Window_SkillList
  180.   #--------------------------------------------------------------------------
  181.   # ● 決定やキャンセルなどのハンドリング処理
  182.   #--------------------------------------------------------------------------
  183.   alias tmitwin_window_skilllist_process_handling process_handling
  184.   def process_handling
  185.     tmitwin_window_skilllist_process_handling
  186.     return unless open? && active
  187.     return process_description if Input.trigger?(TMITWIN::KEY_SYMBOL)
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ○ 説明ボタンが押されたときの処理
  191.   #--------------------------------------------------------------------------
  192.   def process_description
  193.     unless $game_switches[TMITWIN::SW_NOUSE_SKILL_INFO]
  194.       if @data[index]
  195.         Sound.play_ok
  196.         Input.update
  197.         deactivate
  198.         call_handler(:description)
  199.       else
  200.         Sound.play_buzzer
  201.       end
  202.     end
  203.   end
  204. end
  205.  
  206. #==============================================================================
  207. # ■ Window_EquipSlot
  208. #==============================================================================
  209. class Window_EquipSlot
  210.   #--------------------------------------------------------------------------
  211.   # ● 決定やキャンセルなどのハンドリング処理
  212.   #--------------------------------------------------------------------------
  213.   alias tmitwin_window_equipslot_process_handling process_handling
  214.   def process_handling
  215.     tmitwin_window_equipslot_process_handling
  216.     return unless open? && active
  217.     return process_description if Input.trigger?(TMITWIN::KEY_SYMBOL)
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ○ 説明ボタンが押されたときの処理
  221.   #--------------------------------------------------------------------------
  222.   def process_description
  223.     unless $game_switches[TMITWIN::SW_NOUSE_ITEM_INFO]
  224.       if item
  225.         Sound.play_ok
  226.         Input.update
  227.         deactivate
  228.         call_handler(:description)
  229.       else
  230.         Sound.play_buzzer
  231.       end
  232.     end
  233.   end
  234. end
  235.  
  236. #==============================================================================
  237. # ■ Window_ShopBuy
  238. #==============================================================================
  239. class Window_ShopBuy
  240.   #--------------------------------------------------------------------------
  241.   # ● 決定やキャンセルなどのハンドリング処理
  242.   #--------------------------------------------------------------------------
  243.   alias tmitwin_window_shopbuy_process_handling process_handling
  244.   def process_handling
  245.     tmitwin_window_shopbuy_process_handling
  246.     return unless open? && active
  247.     return process_description if Input.trigger?(TMITWIN::KEY_SYMBOL)
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ○ 説明ボタンが押されたときの処理
  251.   #--------------------------------------------------------------------------
  252.   def process_description
  253.     unless $game_switches[TMITWIN::SW_NOUSE_ITEM_INFO]
  254.       if @data[index]
  255.         Sound.play_ok
  256.         Input.update
  257.         deactivate
  258.         call_handler(:description)
  259.       else
  260.         Sound.play_buzzer
  261.       end
  262.     end
  263.   end
  264. end
  265.  
  266. #==============================================================================
  267. # ■ Window_Message
  268. #==============================================================================
  269. class Window_Message
  270.   #--------------------------------------------------------------------------
  271.   # ● 全ウィンドウの作成
  272.   #--------------------------------------------------------------------------
  273.   alias tmitwin_window_message_create_all_windows create_all_windows
  274.   def create_all_windows
  275.     tmitwin_window_message_create_all_windows
  276.     @item_window.set_handler(:description, method(:on_item_description))
  277.     create_description_window
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ● 全ウィンドウの解放
  281.   #--------------------------------------------------------------------------
  282.   alias tmitwin_window_message_dispose_all_windows dispose_all_windows
  283.   def dispose_all_windows
  284.     tmitwin_window_message_dispose_all_windows
  285.     @description_window.dispose
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ● 全ウィンドウの更新
  289.   #--------------------------------------------------------------------------
  290.   alias tmitwin_window_message_update_all_windows update_all_windows
  291.   def update_all_windows
  292.     tmitwin_window_message_update_all_windows
  293.     @description_window.update if @description_window
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ● アイテムの選択処理 【再定義】
  297.   #--------------------------------------------------------------------------
  298.   def input_item
  299.     @item_window.start
  300.     Fiber.yield while (@item_window.active || @description_window.active)
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ○ アイテム詳細ウィンドウの作成
  304.   #--------------------------------------------------------------------------
  305.   def create_description_window
  306.     @description_window = Window_ItemDescription.new
  307.     @description_window.set_handler(:ok,     method(:on_description_ok))
  308.     @description_window.set_handler(:cancel, method(:on_description_cancel))
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ○ アイテム詳細[決定]
  312.   #--------------------------------------------------------------------------
  313.   def on_description_ok
  314.     Sound.play_ok
  315.     hide_sub_window(@description_window)
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ○ アイテム詳細[キャンセル]
  319.   #--------------------------------------------------------------------------
  320.   def on_description_cancel
  321.     Sound.play_cancel
  322.     hide_sub_window(@description_window)
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ○ アイテム[説明]
  326.   #--------------------------------------------------------------------------
  327.   def on_item_description
  328.     @description_window.refresh(@item_window.item)
  329.     show_sub_window(@description_window)
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ○ サブウィンドウの表示
  333.   #--------------------------------------------------------------------------
  334.   def show_sub_window(window)
  335.     @item_window.hide.deactivate
  336.     window.show.activate
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   # ○ サブウィンドウの非表示
  340.   #--------------------------------------------------------------------------
  341.   def hide_sub_window(window)
  342.     window.hide.deactivate
  343.     @item_window.show.activate
  344.   end
  345. end
  346.  
  347. #==============================================================================
  348. # □ Window_ItemDescription
  349. #==============================================================================
  350. class Window_ItemDescription < Window_Selectable
  351.   #--------------------------------------------------------------------------
  352.   # ● オブジェクト初期化
  353.   #--------------------------------------------------------------------------
  354.   def initialize
  355.     super(0, 0, Graphics.width, Graphics.height)
  356.     hide.deactivate
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● 決定やキャンセルなどのハンドリング処理
  360.   #--------------------------------------------------------------------------
  361.   def process_handling
  362.     super
  363.     return unless open? && active
  364.     return process_description if Input.trigger?(TMITWIN::KEY_SYMBOL)
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ○ 説明ボタンが押されたときの処理
  368.   #--------------------------------------------------------------------------
  369.   def process_description
  370.     Input.update
  371.     call_handler(:description)
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● リフレッシュ
  375.   #--------------------------------------------------------------------------
  376.   def refresh(item = nil)
  377.     return unless item
  378.     contents.clear
  379.     if item.class == RPG::Item
  380.       refresh_item(item)
  381.     elsif item.class == RPG::Skill
  382.       refresh_skill(item)
  383.     else
  384.       refresh_equip(item)
  385.     end
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # ○ アイテム詳細の描画
  389.   #--------------------------------------------------------------------------
  390.   def refresh_item(item)
  391.     draw_item_name(item, 0, line_height * 0)
  392.     draw_item_type(item, 320, line_height * 0)
  393.     draw_horz_line(line_height * 1)
  394.     draw_item_params(item, 32, line_height * 2)
  395.     draw_item_effects(item, TMITWIN::FEATURE_X, line_height * 2)
  396.     draw_base_price(item, 32, line_height * 11)
  397.     draw_horz_line(line_height * 13)
  398.     draw_text_ex(4, line_height * 14, item.description)
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ○ 武器(防具)詳細の描画
  402.   #--------------------------------------------------------------------------
  403.   def refresh_equip(item)
  404.     draw_item_name(item, 0, line_height * 0)
  405.     draw_item_type(item, 320, line_height * 0)
  406.     draw_horz_line(line_height * 1)
  407.     8.times {|i| draw_equip_param(item, 32, line_height * (i + 2), i) }
  408.     draw_base_price(item, 32, line_height * 11)
  409.     draw_equip_features(item, TMITWIN::FEATURE_X, line_height * 2)
  410.     draw_horz_line(line_height * 13)
  411.     draw_text_ex(4, line_height * 14, item.description)
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ○ スキル詳細の描画
  415.   #--------------------------------------------------------------------------
  416.   def refresh_skill(item)
  417.     draw_item_name(item, 0, line_height * 0)
  418.     draw_item_type(item, 320, line_height * 0)
  419.     draw_horz_line(line_height * 1)
  420.     draw_skill_params(item, 32, line_height * 2)
  421.     draw_item_effects(item, TMITWIN::FEATURE_X, line_height * 2)
  422.     draw_horz_line(line_height * 13)
  423.     draw_text_ex(4, line_height * 14, item.description)
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ○ タイプの描画
  427.   #--------------------------------------------------------------------------
  428.   def draw_item_type(item, x, y)
  429.     if item.class == RPG::Item
  430.       text = item.itype_id == 1 ? Vocab.item : Vocab.key_item
  431.     elsif item.class == RPG::Weapon
  432.       text = sprintf("%s [ %s ]", $data_system.terms.etypes[item.etype_id],
  433.         $data_system.weapon_types[item.wtype_id])
  434.     elsif item.class == RPG::Armor
  435.       text = sprintf("%s [ %s ]", $data_system.terms.etypes[item.etype_id],
  436.         $data_system.armor_types[item.atype_id])
  437.     elsif item.class == RPG::Skill
  438.       text = $data_system.skill_types[item.stype_id]
  439.       if item.required_wtype_id1 > 0 || item.required_wtype_id2 > 0
  440.         text += sprintf(" [ %s%s%s ]",
  441.           $data_system.weapon_types[item.required_wtype_id1] ||= "",
  442.           item.required_wtype_id1 > 0 && item.required_wtype_id2 > 0 ? " / " : "",
  443.           $data_system.weapon_types[item.required_wtype_id2] ||= "")
  444.       end
  445.     end
  446.     change_color(normal_color)
  447.     draw_text(x, y, contents.width - x, line_height, text)
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ○ アイテム能力値の描画
  451.   #--------------------------------------------------------------------------
  452.   def draw_item_params(item, x, y)
  453.     w = TMITWIN::PARAM_WIDTH
  454.     change_color(system_color)
  455.     draw_text(x, y + line_height * 0, w, line_height, "消耗")
  456.     draw_text(x, y + line_height * 1, w, line_height, "速度補正")
  457.     draw_text(x, y + line_height * 2, w, line_height, "成功率")
  458.     draw_text(x, y + line_height * 4, w, line_height, "効果範囲")
  459.     change_color(normal_color)
  460.     draw_text(x, y + line_height * 0, w + 36, line_height,
  461.       (item.consumable ? "する" : "しない"), 2)
  462.     draw_text(x, y + line_height * 1, w + 36, line_height, item.speed, 2)
  463.     draw_text(x, y + line_height * 2, w + 36, line_height,
  464.       sprintf("%d%%", item.success_rate), 2)
  465.     draw_text(x, y + line_height * 5, w + 36, line_height,
  466.       Vocab.scope(item.scope), 2)
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # ○ 装備能力値の描画
  470.   #--------------------------------------------------------------------------
  471.   def draw_equip_param(item, x, y, param_id)
  472.     w = TMITWIN::PARAM_WIDTH
  473.     change_color(system_color)
  474.     draw_text(x, y, w, line_height, Vocab::param(param_id))
  475.     change_color(normal_color)
  476.     draw_text(x + w, y, 36, line_height, item.params[param_id], 2)
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ○ スキル能力値の描画
  480.   #--------------------------------------------------------------------------
  481.   def draw_skill_params(item, x, y)
  482.     w = TMITWIN::PARAM_WIDTH
  483.     change_color(system_color)
  484.     if $tmscripts["skcost"]   # スキルコスト拡張に対応
  485.       draw_text(x, y + line_height * 0, w, line_height, "消費HP")
  486.       y += line_height
  487.     end
  488.     draw_text(x, y + line_height * 0, w, line_height, "消費MP")
  489.     draw_text(x, y + line_height * 1, w, line_height, "消費TP")
  490.     draw_text(x, y + line_height * 2, w, line_height, "速度補正")
  491.     draw_text(x, y + line_height * 3, w, line_height, "成功率")
  492.     draw_text(x, y + line_height * 5, w, line_height, "効果範囲")
  493.     change_color(normal_color)
  494.     mp_cost = item.mp_cost
  495.     tp_cost = item.tp_cost
  496.     if $tmscripts["skcost"]   # スキルコスト拡張に対応
  497.       n = item.hp_cost_rate
  498.       draw_text(x, y + line_height * -1, w + 36, line_height,
  499.         n > 0 ? sprintf("%d%%", n) : item.hp_cost, 2)
  500.       n = item.mp_cost_rate
  501.       mp_cost = sprintf("%d%%", n) if n > 0
  502.       n = item.tp_cost_rate
  503.       tp_cost = sprintf("%d%%", n) if n > 0
  504.     end
  505.     draw_text(x, y + line_height * 0, w + 36, line_height, mp_cost, 2)
  506.     draw_text(x, y + line_height * 1, w + 36, line_height, tp_cost, 2)
  507.     draw_text(x, y + line_height * 2, w + 36, line_height, item.speed, 2)
  508.     draw_text(x, y + line_height * 3, w + 36, line_height,
  509.       sprintf("%d%%", item.success_rate), 2)
  510.     draw_text(x, y + line_height * 6, w + 36, line_height,
  511.       Vocab.scope(item.scope), 2)
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # ○ 基本価格の描画
  515.   #--------------------------------------------------------------------------
  516.   def draw_base_price(item, x, y)
  517.     w = TMITWIN::PARAM_WIDTH
  518.     change_color(system_color)
  519.     draw_text(x, y, w, line_height, "基本価格")
  520.     n = item.price
  521.     draw_currency_value(n, Vocab::currency_unit, x, y + line_height, w + 36)
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ○ アイテムの効果の描画
  525.   #--------------------------------------------------------------------------
  526.   def draw_item_effects(item, x, y)
  527.     change_color(system_color)
  528.     draw_text(x, y, 48, line_height, "効果")
  529.     change_color(normal_color)
  530.     w = contents.width - TMITWIN::FEATURE_X - 32
  531.     if item.damage.type > 0   # ダメージ
  532.       y += line_height
  533.       text = Vocab.damage_type(item.damage.type)
  534.       if item.damage.element_id > 0
  535.         text += sprintf(" %s属性", $data_system.elements[item.damage.element_id])
  536.       end
  537.       draw_text(x + 32, y, w, line_height, text)
  538.     end
  539.     item.effects.each_with_index do |effect, i|
  540.       text = nil
  541.       case effect.code
  542.       when 11   # HP 回復
  543.         text = sprintf("%s回復", Vocab.hp)
  544.         if effect.value1 != 0
  545.           text += sprintf(" %d%%", (effect.value1 * 100).round)
  546.         end
  547.         text += sprintf(" %d", effect.value2) if effect.value2 != 0
  548.       when 12   # MP 回復
  549.         text = sprintf("%s回復", Vocab.mp)
  550.         if effect.value1 != 0
  551.           text += sprintf(" %d%%", (effect.value1 * 100).round)
  552.         end
  553.         text += sprintf(" %d", effect.value2) if effect.value2 != 0
  554.       when 13   # TP 回復
  555.         text = sprintf("%s回復 %d%%", Vocab.tp, effect.value1)
  556.       when 21   # ステート付加
  557.         if effect.data_id > 0
  558.           text = sprintf("%s付加 %d%%", $data_states[effect.data_id].name,
  559.             (effect.value1 * 100).round)
  560.         end
  561.       when 22   # ステート解除
  562.         text = sprintf("%s解除 %d%%", $data_states[effect.data_id].name,
  563.           (effect.value1 * 100).round)
  564.       when 31   # 能力強化
  565.         text = sprintf("%s上昇 %dターン", Vocab::param(effect.data_id),
  566.           effect.value1)
  567.       when 32   # 能力弱体
  568.         text = sprintf("%s低下 %dターン", Vocab::param(effect.data_id),
  569.           effect.value1)
  570.       when 33   # 能力強化の解除
  571.         text = sprintf("%s上昇解除", Vocab::param(effect.data_id))
  572.       when 34   # 能力弱体の解除
  573.         text = sprintf("%s低下解除", Vocab::param(effect.data_id))
  574.       when 41   # 特殊効果
  575.         text = "逃げる"
  576.       when 42   # 成長
  577.         text = sprintf("%s成長 +%d", Vocab::param(effect.data_id),
  578.           effect.value1)
  579.       when 43   # スキル習得
  580.         text = sprintf("%s習得", $data_skills[effect.data_id].name)
  581.       when 44   # コモンイベント
  582.         text = $data_common_events[effect.data_id].name
  583.       end
  584.       if text
  585.         y += line_height
  586.         draw_text(x + 32, y, w, line_height, text)
  587.       end
  588.       break if y == line_height * 12
  589.     end
  590.     if y < line_height * 12
  591.       item.note.each_line do |line|
  592.         if /<詳細\s+(.+)>/ =~ line
  593.           y += line_height
  594.           draw_text(x + 32, y, w, line_height, $1)
  595.           break if y == line_height * 12
  596.         end
  597.       end
  598.     end
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # ○ 装備の特徴の描画
  602.   #--------------------------------------------------------------------------
  603.   def draw_equip_features(item, x, y)
  604.     change_color(system_color)
  605.     draw_text(x, y, 48, line_height, "特徴")
  606.     change_color(normal_color)
  607.     w = contents.width - TMITWIN::FEATURE_X - 32
  608.     item.features.each_with_index do |feature, i|
  609.       text = nil
  610.       case feature.code
  611.       when 11   # 属性有効度
  612.         n = 100 - (feature.value * 100).round
  613.         text = sprintf("%s耐性#{"+" if n >= 0}%d%%",
  614.           $data_system.elements[feature.data_id], n)
  615.       when 12   # 弱体有効度
  616.         n = 100 - (feature.value * 100).round
  617.         text = sprintf("%s低下耐性#{"+" if n >= 0}%d%%",
  618.           Vocab::param(feature.data_id), n)
  619.       when 13   # ステート有効度
  620.         n = 100 - (feature.value * 100).round
  621.         text = sprintf("%s耐性#{"+" if n >= 0}%d%%",
  622.           $data_states[feature.data_id].name, n)
  623.       when 14   # ステート無効化
  624.         text = sprintf("%s無効", $data_states[feature.data_id].name)
  625.       when 21   # 通常能力値
  626.         n = (feature.value * 100).round - 100
  627.         text = sprintf("%s#{"+" if n >= 0}%d%%",
  628.           Vocab::param(feature.data_id), n)
  629.       when 22   # 追加能力値
  630.         n = (feature.value * 100).round
  631.         text = sprintf("%s#{"+" if n >= 0}%d%%",
  632.           Vocab::ex_param(feature.data_id), n)
  633.       when 23   # 特殊能力値
  634.         n = (feature.value * 100).round - 100
  635.         text = sprintf("%s#{"+" if n >= 0}%d%%",
  636.           Vocab::special_param(feature.data_id), n)
  637.       when 31   # 攻撃時属性
  638.         unless TMITWIN::EXCLUDE_ELEMENTS.include?(feature.data_id)
  639.           text = sprintf("%sに%s属性付与", Vocab.attack,
  640.             $data_system.elements[feature.data_id])
  641.         end
  642.       when 32   # 攻撃時ステート
  643.         n = (feature.value * 100).round
  644.         text = sprintf("%sに%s付与 %d%%", Vocab.attack,
  645.           $data_states[feature.data_id].name, n)
  646.       when 33   # 攻撃速度補正
  647.         text = sprintf("攻撃速度#{"+" if feature.value >= 0}%d",
  648.           feature.value)
  649.       when 34   # 攻撃追加回数
  650.         text = sprintf("攻撃回数#{"+" if feature.value >= 0}%d",
  651.           feature.value)
  652.       when 41   # スキルタイプ追加
  653.         text = sprintf("%s使用可能", $data_system.skill_types[feature.data_id])
  654.       when 42   # スキルタイプ封印
  655.         text = sprintf("%s使用不可", $data_system.skill_types[feature.data_id])
  656.       when 43   # スキル追加
  657.         text = sprintf("%s使用可能", $data_skills[feature.data_id].name)
  658.       when 44   # スキル封印
  659.         text = sprintf("%s使用不可", $data_skills[feature.data_id].name)
  660.       when 51   # 武器タイプ装備
  661.         text = sprintf("%s装備可能", $data_system.weapon_types[feature.data_id])
  662.       when 52   # 防具タイプ装備
  663.         text = sprintf("%s装備可能", $data_system.armor_types[feature.data_id])
  664.       when 61   # 行動回数追加
  665.         text = sprintf("連続行動 %d%%", (feature.value * 100).round)
  666.       when 62   # 特殊フラグ
  667.         text = Vocab.special_flag(feature.data_id)
  668.       end
  669.       if text
  670.         y += line_height
  671.         draw_text(x + 32, y, w, line_height, text)
  672.       end
  673.       break if i == 9
  674.     end
  675.     if y < line_height * 12
  676.       item.note.each_line do |line|
  677.         if /<詳細\s+(.+)>/ =~ line
  678.           y += line_height
  679.           draw_text(x + 32, y, w, line_height, $1)
  680.           break if y == line_height * 12
  681.         end
  682.       end
  683.     end
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # ○ 水平線の描画
  687.   #--------------------------------------------------------------------------
  688.   def draw_horz_line(y)
  689.     line_y = y + line_height / 2 - 1
  690.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  691.   end
  692.   #--------------------------------------------------------------------------
  693.   # ○ 水平線の色を取得
  694.   #--------------------------------------------------------------------------
  695.   def line_color
  696.     color = normal_color
  697.     color.alpha = 48
  698.     color
  699.   end
  700. end
  701.  
  702. #==============================================================================
  703. # ■ Scene_Base
  704. #==============================================================================
  705. class Scene_Base
  706.   #--------------------------------------------------------------------------
  707.   # ○ アイテム詳細ウィンドウの作成
  708.   #--------------------------------------------------------------------------
  709.   def create_description_window
  710.     @description_window = Window_ItemDescription.new
  711.     @description_window.set_handler(:ok,     method(:on_description_ok))
  712.     @description_window.set_handler(:cancel, method(:on_description_cancel))
  713.     @description_window.set_handler(:description, method(:on_description_cancel))
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # ○ アイテム詳細[決定]
  717.   #--------------------------------------------------------------------------
  718.   def on_description_ok
  719.     Sound.play_ok
  720.     hide_sub_window(@description_window)
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # ○ アイテム詳細[キャンセル]
  724.   #--------------------------------------------------------------------------
  725.   def on_description_cancel
  726.     Sound.play_cancel
  727.     hide_sub_window(@description_window)
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # ○ アイテム[説明]
  731.   #--------------------------------------------------------------------------
  732.   def on_item_description
  733.     @description_window.refresh(item)
  734.     show_sub_window(@description_window)
  735.   end
  736. end
  737.  
  738. #==============================================================================
  739. # ■ Scene_ItemBase
  740. #==============================================================================
  741. class Scene_ItemBase
  742.   #--------------------------------------------------------------------------
  743.   # ● 開始処理
  744.   #--------------------------------------------------------------------------
  745.   alias tmitwin_scene_itembase_start start
  746.   def start
  747.     tmitwin_scene_itembase_start
  748.     create_description_window
  749.   end
  750. end
  751.  
  752. #==============================================================================
  753. # ■ Scene_Item
  754. #==============================================================================
  755. class Scene_Item
  756.   #--------------------------------------------------------------------------
  757.   # ● アイテムウィンドウの作成
  758.   #--------------------------------------------------------------------------
  759.   alias tmitwin_scene_item_create_item_window create_item_window
  760.   def create_item_window
  761.     tmitwin_scene_item_create_item_window
  762.     @item_window.set_handler(:description, method(:on_item_description))
  763.   end
  764. end
  765.  
  766. #==============================================================================
  767. # ■ Scene_Skill
  768. #==============================================================================
  769. class Scene_Skill
  770.   #--------------------------------------------------------------------------
  771.   # ● アイテムウィンドウの作成
  772.   #--------------------------------------------------------------------------
  773.   alias tmitwin_scene_skill_create_item_window create_item_window
  774.   def create_item_window
  775.     tmitwin_scene_skill_create_item_window
  776.     @item_window.set_handler(:description, method(:on_item_description))
  777.   end
  778. end
  779.  
  780. #==============================================================================
  781. # ■ Scene_Equip
  782. #==============================================================================
  783. class Scene_Equip
  784.   #--------------------------------------------------------------------------
  785.   # ● 開始処理
  786.   #--------------------------------------------------------------------------
  787.   alias tmitwin_scene_equip_start start
  788.   def start
  789.     tmitwin_scene_equip_start
  790.     create_description_window
  791.   end
  792.   #--------------------------------------------------------------------------
  793.   # ● スロットウィンドウの作成
  794.   #--------------------------------------------------------------------------
  795.   alias tmitwin_scene_equip_create_slot_window create_slot_window
  796.   def create_slot_window
  797.     tmitwin_scene_equip_create_slot_window
  798.     @slot_window.set_handler(:description, method(:on_item_description))
  799.   end
  800.   #--------------------------------------------------------------------------
  801.   # ● アイテムウィンドウの作成
  802.   #--------------------------------------------------------------------------
  803.   alias tmitwin_scene_equip_create_item_window create_item_window
  804.   def create_item_window
  805.     tmitwin_scene_equip_create_item_window
  806.     @item_window.set_handler(:description, method(:on_item_description))
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ○ 現在選択されているアイテムの取得
  810.   #--------------------------------------------------------------------------
  811.   def item
  812.     (@item_window.index == -1 ? @slot_window : @item_window).item
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # ○ サブウィンドウの表示
  816.   #--------------------------------------------------------------------------
  817.   def show_sub_window(window)
  818.     @viewport.rect.width = 0
  819.     window.show.activate
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ○ サブウィンドウの非表示
  823.   #--------------------------------------------------------------------------
  824.   def hide_sub_window(window)
  825.     @viewport.rect.width = Graphics.width
  826.     window.hide.deactivate
  827.     (@item_window.index == -1 ? @slot_window : @item_window).activate
  828.   end
  829. end
  830.  
  831. #==============================================================================
  832. # ■ Scene_Shop
  833. #==============================================================================
  834. class Scene_Shop
  835.   #--------------------------------------------------------------------------
  836.   # ● 開始処理
  837.   #--------------------------------------------------------------------------
  838.   alias tmitwin_scene_shop_start start
  839.   def start
  840.     tmitwin_scene_shop_start
  841.     create_description_window
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   # ● 購入ウィンドウの作成
  845.   #--------------------------------------------------------------------------
  846.   alias tmitwin_scene_shop_create_buy_window create_buy_window
  847.   def create_buy_window
  848.     tmitwin_scene_shop_create_buy_window
  849.     @buy_window.set_handler(:description, method(:on_item_description))
  850.   end
  851.   #--------------------------------------------------------------------------
  852.   # ● 売却ウィンドウの作成
  853.   #--------------------------------------------------------------------------
  854.   alias tmitwin_scene_shop_create_sell_window create_sell_window
  855.   def create_sell_window
  856.     tmitwin_scene_shop_create_sell_window
  857.     @sell_window.set_handler(:description, method(:on_item_description))
  858.   end
  859.   #--------------------------------------------------------------------------
  860.   # ○ 現在選択されているアイテムの取得
  861.   #--------------------------------------------------------------------------
  862.   def item
  863.     if @sell_window.visible
  864.       @sell_window.item
  865.     elsif @buy_window.visible
  866.       @buy_window.item
  867.     end
  868.   end
  869.   #--------------------------------------------------------------------------
  870.   # ○ サブウィンドウの表示
  871.   #--------------------------------------------------------------------------
  872.   def show_sub_window(window)
  873.     @viewport.rect.width = 0
  874.     window.show.activate
  875.   end
  876.   #--------------------------------------------------------------------------
  877.   # ○ サブウィンドウの非表示
  878.   #--------------------------------------------------------------------------
  879.   def hide_sub_window(window)
  880.     @viewport.rect.width = Graphics.width
  881.     window.hide.deactivate
  882.     if @sell_window.visible
  883.       @sell_window.activate
  884.     elsif @buy_window.visible
  885.       @buy_window.activate
  886.     end
  887.   end
  888. end
  889.  
  890. #==============================================================================
  891. # ■ Scene_Battle
  892. #==============================================================================
  893. class Scene_Battle
  894.   #--------------------------------------------------------------------------
  895.   # ● 開始処理
  896.   #--------------------------------------------------------------------------
  897.   alias tmitwin_scene_battle_start start
  898.   def start
  899.     tmitwin_scene_battle_start
  900.     create_description_window
  901.   end
  902.   #--------------------------------------------------------------------------
  903.   # ● スキルウィンドウの作成
  904.   #--------------------------------------------------------------------------
  905.   alias tmitwin_scene_battle_create_skill_window create_skill_window
  906.   def create_skill_window
  907.     tmitwin_scene_battle_create_skill_window
  908.     @skill_window.set_handler(:description, method(:on_item_description))
  909.   end
  910.   #--------------------------------------------------------------------------
  911.   # ● アイテムウィンドウの作成
  912.   #--------------------------------------------------------------------------
  913.   alias tmitwin_scene_battle_create_item_window create_item_window
  914.   def create_item_window
  915.     tmitwin_scene_battle_create_item_window
  916.     @item_window.set_handler(:description, method(:on_item_description))
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ○ 現在選択されているアイテムの取得
  920.   #--------------------------------------------------------------------------
  921.   def item
  922.     if @item_window.visible
  923.       @item_window.item
  924.     elsif @skill_window.visible
  925.       @skill_window.item
  926.     end
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # ○ サブウィンドウの表示
  930.   #--------------------------------------------------------------------------
  931.   def show_sub_window(window)
  932.     @info_viewport.rect.width = 0
  933.     @help_window.x = Graphics.width
  934.     @item_window.x = Graphics.width
  935.     @skill_window.x = Graphics.width
  936.     window.show.activate
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ○ サブウィンドウの非表示
  940.   #--------------------------------------------------------------------------
  941.   def hide_sub_window(window)
  942.     @info_viewport.rect.width = Graphics.width
  943.     @help_window.x = 0
  944.     @item_window.x = 0
  945.     @skill_window.x = 0
  946.     window.hide.deactivate
  947.     if @item_window.visible
  948.       @item_window.activate
  949.     elsif @skill_window.visible
  950.       @skill_window.activate
  951.     end
  952.   end
  953. end
  954.  
  955. #==============================================================================
  956. # □ Scene_SkillLearn
  957. #==============================================================================
  958. class Scene_SkillLearn < Scene_Skill
  959.   #--------------------------------------------------------------------------
  960.   # ● アイテムウィンドウの作成
  961.   #--------------------------------------------------------------------------
  962.   alias tmitwin_scene_skilllearn_create_item_window create_item_window
  963.   def create_item_window
  964.     tmitwin_scene_skilllearn_create_item_window
  965.     @item_window.set_handler(:description, method(:on_item_description))
  966.   end
  967. end

作者: a000b1745    时间: 2013-3-3 00:17
我找到了!! 只要用了以下ATB腳本就會衝突!!
那有辦法解開這衝突嗎??{:2_284:}
(以下兩個腳本都要貼上才能運行ATB腳本)

RUBY 代码复制下载
  1. #==============================================================================
  2. # ** Victor Engine - Active Time Battle
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2012.12.16 > First release
  8. #  v 1.01 - 2012.12.24 > Fixed issue with changing party during battle
  9. #                      > Fixed ATB value during Surprise and Pre Emptive
  10. #                      > Fixed Command Window position to not cover the ATB
  11. #                      > Fixed issue with freezes after events
  12. #                      > Fixed issue with state timings
  13. #                      > Fixed issue with cast time at battle start
  14. #                      > Fixed issue with escape at battle start
  15. #                      > Added notetags <timed trigger: x> <cast protection: x>
  16. #                        and <delay protection>
  17. #                      > Fixed issue with command window not closing when
  18. #                        the actor is becomes unable to select action
  19. #  v 1.02 - 2012.12.30 > Compatibility with Leap Attack
  20. #                      > Fixed issue with Guard command and ATB Reverse
  21. #  v 1.03 - 2013.01.07 > Fixed issue with selection when all enemies are dead
  22. #  v 1.04 - 2013.01.24 > Fixed issue with skill, item and target windows not
  23. #                        closing when the actor is becomes unable to act
  24. #  v 1.05 - 2013.02.13 > Added notetag <atb speed: x%>
  25. #                      > Added setup for play a SE when the ATB is full
  26. #------------------------------------------------------------------------------
  27. #  This scripts changes the turn management of battles. The default turn based
  28. # system is replaced by an active time system, where the order of actions
  29. # are decided by individual time bars
  30. #------------------------------------------------------------------------------
  31. # Compatibility
  32. #   Requires the script 'Victor Engine - Basic Module' v 1.32 or higher
  33. #   If used with 'Victor Engine - Animated Battle' place this bellow it.
  34. #   If used with 'Victor Engine - Skip Battle Log' place this bellow it.
  35. #
  36. # * Overwrite methods
  37. #   class << BattleManager
  38. #     def next_command
  39. #     def prior_command
  40. #     def turn_start
  41. #     def turn_end
  42. #     def make_action_orders
  43. #
  44. #   class Game_Enemy < Game_Battler
  45. #     def conditions_met_turns?(param1, param2)
  46. #
  47. #   class Window_BattleStatus < Window_Selectable
  48. #     def window_width
  49. #     def draw_basic_area(rect, actor)
  50. #     def draw_gauge_area_with_tp(rect, actor)
  51. #     def draw_gauge_area_without_tp(rect, actor)
  52. #     def update
  53. #
  54. # * Alias methods
  55. #   class << BattleManager
  56. #     def init_members
  57. #     def battle_start
  58. #     def process_escape
  59. #
  60. #   class Game_System
  61. #     def initialize
  62. #
  63. #   class Game_Action
  64. #     def prepare
  65. #
  66. #   class Game_BattlerBase
  67. #     def inputable?
  68. #
  69. #   class Game_Battler < Game_BattlerBase
  70. #     def item_user_effect(user, item)
  71. #
  72. #   class Game_Enemy < Game_Battler
  73. #     def initialize(index, enemy_id)
  74. #
  75. #   class Spriteset_Battle
  76. #     def update_actors
  77. #
  78. #   class Window_BattleLog < Window_Selectable
  79. #     def last_text
  80. #
  81. #   class Window_ActorCommand < Window_Command
  82. #     def make_command_list
  83. #
  84. #------------------------------------------------------------------------------
  85. # Instructions:
  86. #  To instal the script, open you script editor and paste this script on
  87. #  a new section bellow the Materials section. This script must also
  88. #  be bellow the script 'Victor Engine - Basic'
  89. #
  90. #------------------------------------------------------------------------------
  91. # Actors, Classes, Enemies, Weapons, Armors, States, Skills and Items note tags:
  92. #   Tags to be used on Actors, Classes, Enemies, Weapons, Armors, States,
  93. #   Skills and Items note boxes.
  94. #
  95. #  <cast cancel: x%>
  96. #   Actions will have a chance of canceling spell casting of the targets.
  97. #     x : success rate
  98. #
  99. #  <atb delay: x%, y%>
  100. #   Actions will have a chance of delaying the ATB of the targets.
  101. #     x : success rate
  102. #     y : delay rate
  103. #
  104. #------------------------------------------------------------------------------
  105. # Actors, Classes, Enemies, Weapons, Armors and States note tags:
  106. #   Tags to be used on Actors, Classes, Enemies, Weapons, Armors and States
  107. #   note boxes.
  108. #
  109. #  <cast protection: x%>
  110. #   Reduce the success rate of a cast cancel action.
  111. #     x : reduction
  112. #
  113. #  <delay protection: x%>
  114. #   Reduce the success rate of a atb delay action.
  115. #     x : reduction
  116. #
  117. #  <atb speed: x%>
  118. #   Changes the rate of a atb fill speed. if the value is higher then 100%
  119. #   the bar fills faster, if it's lower than 100% the bar fills slower.
  120. #     x : speed rate
  121. #
  122. #------------------------------------------------------------------------------
  123. # Skills note tags:
  124. #   Tags to be used on Skills note boxes.
  125. #
  126. #  <cast time: x>
  127. #  <cast time: x, y>
  128. #   Actions with this will have a cast time before executing, you can add
  129. #   opitionally wich stat will be used to define the speed.
  130. #     x : cast speed (100 = default speed)
  131. #     y : stat (any valid battler stat)
  132. #
  133. #  <atb cost: x%>
  134. #   Changes the total ATB spent after executing an action. By default all
  135. #   actions cost 100% of the ATB. Can't be lower than 1%
  136. #     x : ATB cost rate
  137. #
  138. #------------------------------------------------------------------------------
  139. # States note tags:
  140. #   Tags to be used on States note boxes.
  141. #
  142. #  <timed trigger: x>
  143. #   There is two options for state auto-removal on the database: Action End
  144. #   and Turn End. This tag creates a third option, to make the state end
  145. #   and trigger after a set time.
  146. #     x : time for the trigger.
  147. #
  148. #------------------------------------------------------------------------------
  149. # Additional instructions:
  150. #
  151. #  The <cast cancel: x%> and <atb delay: x%, y%> will have effect only on
  152. #  physical actions when added to any object beside Skills and Items.
  153. #
  154. #  The <cast protection: x%> and <delay protection: x%> are multiplied by
  155. #  the cast cancel/atb delay rate. So if an action have 30% cast cancel, and
  156. #  the target have 50% cast protection, the cast cancel will be reduced to 15%
  157. #  Multiple cast cancel effects are added separately. So an action with 40%
  158. #  cast cancel and a target with 50%, 50% and 30% cast protection from different
  159. #  sourcers (let's say 3 different equips) will have the chance reduced to 7%
  160. #  (40 - 50% = 20%, 20% - 50% = 10%, 10% - 30% = 7%)
  161. #
  162. #  The <atb speed: x%> can be used to change the rate of a battler ATB speed
  163. #  without the need of changing the AGI of the battler. Can be used to create
  164. #  effect such as "Haste" and "Slow".
  165. #
  166. #  You can use script calls to change the wait mode and the atb speed
  167. #  $game_system.wait_mode = X
  168. #     :full_wait : time stop to select commands and actions
  169. #     :semi_wait : time stop to select actions
  170. #     :active    : time don't stop
  171. #
  172. #  $game_system.atb_speed = X
  173. #    1.0 = default speed
  174. #
  175. #==============================================================================
  176.  
  177. #==============================================================================
  178. # ** Victor Engine
  179. #------------------------------------------------------------------------------
  180. #   Setting module for the Victor Engine
  181. #==============================================================================
  182.  
  183. module Victor_Engine
  184.   #--------------------------------------------------------------------------
  185.   # * Wait mode
  186.   #   :full_wait : time stop to select commands and actions
  187.   #   :semi_wait : time stop to select actions
  188.   #   :active    : time don't stop
  189.   #--------------------------------------------------------------------------
  190.   VE_ATB_WAIT_MODE = :full_wait
  191.   #--------------------------------------------------------------------------
  192.   # * Action wait
  193.   #   if true, time will stop while executing actions
  194.   #--------------------------------------------------------------------------
  195.   VE_ATB_WAIT_ACTION = true
  196.   #--------------------------------------------------------------------------
  197.   # * Reverse ATB
  198.   #   This setting revert how the ATB works, instead waiting the bar to fill
  199.   #   up to select actions, you first select the action, the the bar start
  200.   #   to fill and the action is executed once it's full.
  201.   #--------------------------------------------------------------------------
  202.   VE_ATB_REVERSE = false
  203.   #--------------------------------------------------------------------------
  204.   # * Move status window
  205.   #   Setup this true to move the status window when the actor command
  206.   #   window or part command window shows up. If false, both windows will
  207.   #   be displayed above the status window.
  208.   #--------------------------------------------------------------------------
  209.   VE_MOVE_STATUS_WINDOW = true
  210.   #--------------------------------------------------------------------------
  211.   # * ATB Full Sound
  212.   #   Play a sound when the actor command window open. Leave nil for no sound
  213.   #   RPG::SE.new(filename, volume, pitch)
  214.   #--------------------------------------------------------------------------
  215.   VE_ATB_SOUND = RPG::SE.new("Decision2", 100, 100)
  216.   #--------------------------------------------------------------------------
  217.   # * Escape type
  218.   #   :party   : open party menu by pressing the cancel key
  219.   #   :command : add the "Escape" option to actors command list
  220.   #   :key     : press the set keys for a while to escape
  221.   #--------------------------------------------------------------------------
  222.   VE_ATB_ESCAPE_TYPE = :key
  223.   #--------------------------------------------------------------------------
  224.   # * Setup the key that must be pressed for escaping
  225.   #    :A >> keyboard Shift  :B >> keyboard X      :C >> keyboard Z
  226.   #    :X >> keyboard A      :Y >> keyboard S      :Z >> keyboard D
  227.   #    :L >> keyboard Q      :R >> keyboard W
  228.   #   adding more than one key makes need to press all of them at same time
  229.   #--------------------------------------------------------------------------
  230.   VE_ATB_ESCAPE_KEYS = [:R, :L]
  231.   #--------------------------------------------------------------------------
  232.   # * Escape time
  233.   #  Average escape time in frames to escape if VE_ATB_ESCAPE_TYPE = :key
  234.   #  This value vary based on the battlers stats and the ATB speed
  235.   #--------------------------------------------------------------------------
  236.   VE_ATB_ESCAPE_TIME = 200
  237.   #--------------------------------------------------------------------------
  238.   # * Escape text
  239.   #   Display escape text when trying to escape if VE_ATB_ESCAPE_TYPE = :key
  240.   #--------------------------------------------------------------------------
  241.   VE_ATB_ESCAPE_TEXT = true
  242.   #--------------------------------------------------------------------------
  243.   # * Turn count control
  244.   #  This is used to control how the turn count will increase, the turn count
  245.   #  control the battle event conditions
  246.   #   :time     : control by time (in frames)
  247.   #   :battlers : control by the number of alive battlers
  248.   #   :actions  : control by the number of actions executed
  249.   #--------------------------------------------------------------------------
  250.   VE_ATB_TURN_COUNT = :time
  251.   #--------------------------------------------------------------------------
  252.   # * Time count
  253.   #   Valid only if VE_ATB_TURN_COUNT = :time, setup the number of frames
  254.   #   needed to increase the turn count. Is influenced by the ATB speed
  255.   #--------------------------------------------------------------------------
  256.   VE_ATB_TIME_COUNT = 200
  257.   #--------------------------------------------------------------------------
  258.   # * Action count
  259.   #   Valid only if VE_ATB_TURN_COUNT = :actions, setup the number of actions
  260.   #   needed to increase the turn count
  261.   #--------------------------------------------------------------------------
  262.   VE_ATB_ACTION_COUNT = 10
  263.   #--------------------------------------------------------------------------
  264.   # * ATB speed
  265.   #   Multiplier that controls the speed of the ATB bars
  266.   #--------------------------------------------------------------------------
  267.   VE_ATB_SPEED = 1.0
  268.   #--------------------------------------------------------------------------
  269.   # * Speed modifier
  270.   #   Value used to control the influence of the stats on the ATB speed
  271.   #   Higher values reduce the influence of the stats on the speed.
  272.   #--------------------------------------------------------------------------
  273.   VE_speed_modifier = 50
  274.   #--------------------------------------------------------------------------
  275.   # * Start rate
  276.   #   Initial ATB value on battle start, a random value between 0 and X%
  277.   #--------------------------------------------------------------------------
  278.   VE_ATB_START_RATE = 15
  279.   #--------------------------------------------------------------------------
  280.   # * Reverse ATB Guard Time
  281.   #   With VE_ATB_REVERSE = true the guard time is set by this value, not
  282.   #   by the value set on the database
  283.   #--------------------------------------------------------------------------
  284.   VE_ATB_REVERSE_GUARD_TIME = 150
  285.   #--------------------------------------------------------------------------
  286.   # * Default magic cast
  287.   #   Setup a default cast speed for all magic skills.
  288.   #   Leave nil for no cast time.
  289.   #     100 = default speed (same as the default wait time for actions)
  290.   #--------------------------------------------------------------------------
  291.   VE_ATB_DEFAULT_CAST = nil
  292.   #--------------------------------------------------------------------------
  293.   # * Damage wait
  294.   #   Stop battler wait time during hurt animation. Available only for
  295.   #   Animated Battle
  296.   #--------------------------------------------------------------------------
  297.   VE_ATB_DAMAGE_WAIT = true
  298.   #--------------------------------------------------------------------------
  299.   # * Escaping animation
  300.   #   Add a steping animation while holding the escape key. Available only for
  301.   #   Animated Battle and if VE_ATB_ESCAPE_TYPE = :key
  302.   #--------------------------------------------------------------------------
  303.   VE_ATB_ESCAPING_ANIM = true
  304.   #--------------------------------------------------------------------------
  305.   # * Regenerarion Trigger
  306.   #  All regen effects triggers at same time no matter of the source, here
  307.   #  you can set when the regen trigger
  308.   #    :turn   : at the turn end
  309.   #    :action : at the action end
  310.   #    :timing : at fixed intervals
  311.   #   It's highly recomended to setup all regen and poison states with the
  312.   #   same auto-removal condition to ensure the duration match the trigger
  313.   #--------------------------------------------------------------------------
  314.   VE_ATB_REGEN_TRIGGER = :action
  315.   #--------------------------------------------------------------------------
  316.   # * Regenerarion Timing
  317.   #  Time for regen effects to apply if VE_ATB_REGEN_TRIGGER = :timing
  318.   #  Is influenced by the ATB speed
  319.   #--------------------------------------------------------------------------
  320.   VE_ATB_REGEN_TIMING = 300
  321.   #--------------------------------------------------------------------------
  322.   # * required
  323.   #   This method checks for the existance of the basic module and other
  324.   #   VE scripts required for this script to work, don't edit this
  325.   #--------------------------------------------------------------------------
  326.   def required(name, req, version, type = nil)
  327.     if !$imported[:ve_basic_module]
  328.       msg = "The script '%s' requires the script\n"
  329.       msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
  330.       msg += "Go to [url]http://victorscripts.wordpress.com/[/url] to download this script."
  331.       msgbox(sprintf(msg, self.script_name(name), version))
  332.       exit
  333.     else
  334.       self.required_script(name, req, version, type)
  335.     end
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # * script_name
  339.   #   Get the script name base on the imported value
  340.   #--------------------------------------------------------------------------
  341.   def script_name(name, ext = "VE")
  342.     name = name.to_s.gsub("_", " ").upcase.split
  343.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  344.     name.join(" ")
  345.   end
  346. end
  347.  
  348. $imported ||= {}
  349. $imported[:ve_active_time_battle] = 1.05
  350. Victor_Engine.required(:ve_active_time_battle, :ve_basic_module, 1.32, :above)
  351. Victor_Engine.required(:ve_active_time_battle, :ve_state_auto_apply, 1.00, :bellow)
  352. Victor_Engine.required(:ve_active_time_battle, :ve_damage_pop, 1.00, :bellow)
  353. Victor_Engine.required(:ve_active_time_battle, :ve_leap_attack, 1.00, :bellow)
  354. Victor_Engine.required(:ve_active_time_battle, :ve_cooperation_skill, 1.00, :bellow)
  355.  
  356. #==============================================================================
  357. # ** Vocab
  358. #------------------------------------------------------------------------------
  359. #  This module defines terms and messages. It defines some data as constant
  360. # variables. Terms in the database are obtained from $data_system.
  361. #==============================================================================
  362.  
  363. module Vocab
  364.  
  365.   # ATB stat name show above atb bar
  366.   VE_ATB_Name = "ATB"
  367.  
  368.   # Message displayed when trying to escape using VE_ATB_ESCAPE_TYPE = :key
  369.   VE_Escaping = "Escaping..."
  370.  
  371.   # Message displayed when can't escape using VE_ATB_ESCAPE_TYPE = :key
  372.   VE_CantEscape = "Can't escape!"
  373.  
  374. end
  375.  
  376. #==============================================================================
  377. # ** class RPG::BaseItem
  378. #------------------------------------------------------------------------------
  379. #  Superclass of actor, class, skill, item, weapon, armor, enemy, and state.
  380. #==============================================================================
  381.  
  382. class RPG::BaseItem
  383.   #--------------------------------------------------------------------------
  384.   # * New method: atb_speed
  385.   #--------------------------------------------------------------------------
  386.   def atb_speed
  387.     return @atb_speed if @atb_speed
  388.     @atb_speed = note =~ /<ATB SPEED: *(\d+)%?>/i ? [$1.to_f, 1].max / 100 : 1
  389.     @atb_speed
  390.   end
  391. end
  392.  
  393. #==============================================================================
  394. # ** RPG::UsableItem
  395. #------------------------------------------------------------------------------
  396. #  This is the superclass for skills and items.
  397. #==============================================================================
  398.  
  399. class RPG::UsableItem < RPG::BaseItem
  400.   #--------------------------------------------------------------------------
  401.   # * New method: castable?
  402.   #--------------------------------------------------------------------------
  403.   def castable?
  404.     (cast_speed && not_cooperation?) ? true : false
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # * New method: not_cooperation?
  408.   #--------------------------------------------------------------------------
  409.   def not_cooperation?
  410.     !$imported[:ve_cooperation_skill] || !cooperation?
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # * New method: cast_speed
  414.   #--------------------------------------------------------------------------
  415.   def cast_speed
  416.     regexp = /<CAST TIME: (\d+)(?:, *(\w+))?>/i
  417.     note   =~ regexp ? {spd: $1.to_i, stat: ($2 ? $2 : "agi")} : default_cast
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # * New method: default_cast
  421.   #--------------------------------------------------------------------------
  422.   def default_cast
  423.     speed = VE_ATB_DEFAULT_CAST
  424.     ((magical? && speed) || VE_ATB_REVERSE) ? {spd: speed, stat: "agi"} : nil
  425.   end
  426.   #--------------------------------------------------------------------------
  427.   # * New method: atb_cost
  428.   #--------------------------------------------------------------------------
  429.   def atb_cost
  430.     regexp = /<ATB COST: (\d+)%?>/i
  431.     note  =~ regexp ? [1.0 - ($1.to_f / 100), 0].max : 0
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # * New method: cast_cancel
  435.   #--------------------------------------------------------------------------
  436.   def cast_cancel
  437.     regexp = /<CAST CANCEL: (\d+)%?>/i
  438.     note  =~ regexp ? $1.to_f / 100 : 0
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # * New method: atb_delay
  442.   #--------------------------------------------------------------------------
  443.   def guard_skill?
  444.     effects.any? {|effect| effect.code == 21 && effect.data_id == 9 }
  445.   end
  446.   #--------------------------------------------------------------------------
  447.   # * New method: atb_delay
  448.   #--------------------------------------------------------------------------
  449.   def atb_delay
  450.     regexp = /<ATB DELAY: (\d+)%?, *([+-]?\d+)%?>/i
  451.     note   =~ regexp ? {rate: $1.to_f / 100, delay: $2.to_f / 100} :
  452.                        {rate: 0, delay: 0}
  453.   end
  454. end
  455.  
  456. #==============================================================================
  457. # ** RPG::State
  458. #------------------------------------------------------------------------------
  459. #  This is the data class for states
  460. #==============================================================================
  461.  
  462. class RPG::State < RPG::BaseItem
  463.   #--------------------------------------------------------------------------
  464.   # * Alias method: auto_removal_timing
  465.   #--------------------------------------------------------------------------
  466.   alias :auto_removal_timing_ve_active_time_battle :auto_removal_timing
  467.   def auto_removal_timing
  468.     timed_trigger ? 3 : auto_removal_timing_ve_active_time_battle
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # * New method: timed_trigger
  472.   #--------------------------------------------------------------------------
  473.   def timed_trigger
  474.     return @timed_trigger if @timed_trigger
  475.     return VE_ATB_REVERSE_GUARD_TIME if guard_state?
  476.     @timed_trigger = note =~ /<TIMED TRIGGER: (\d+)>/i ? $1.to_i : nil
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # * New method: guard_state?
  480.   #--------------------------------------------------------------------------
  481.   def guard_state?
  482.     features.any? {|ft| ft.code == 62 && ft.data_id == 1 }
  483.   end
  484. end
  485.  
  486. #==============================================================================
  487. # ** BattleManager
  488. #------------------------------------------------------------------------------
  489. #  This module handles the battle processing
  490. #==============================================================================
  491.  
  492. class << BattleManager
  493.   #--------------------------------------------------------------------------
  494.   # * Public Instance Variables
  495.   #--------------------------------------------------------------------------
  496.   attr_reader   :input_battlers
  497.   #--------------------------------------------------------------------------
  498.   # * Overwrite method: next_command
  499.   #--------------------------------------------------------------------------
  500.   def next_command
  501.     begin
  502.       return false if !actor || !actor.next_command
  503.     end until actor.inputable?
  504.     return true
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # * Overwrite method: prior_command
  508.   #--------------------------------------------------------------------------
  509.   def prior_command
  510.     begin
  511.       if !actor || !actor.prior_command
  512.         old_actor = actor
  513.         @actor_index -= 1
  514.         @actor_index %= $game_party.members.size
  515.         return false if old_actor == actor
  516.       end
  517.     end until actor.inputable?
  518.     return true
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # * Overwrite method: turn_start
  522.   #--------------------------------------------------------------------------
  523.   def turn_start
  524.     @phase = :turn
  525.     make_action_orders
  526.   end
  527.   #--------------------------------------------------------------------------
  528.   # * Overwrite method: turn_end
  529.   #--------------------------------------------------------------------------
  530.   def turn_end
  531.     @phase = :turn_end
  532.     $game_troop.increase_turn
  533.     @atb_turn_count = 0
  534.     @abt_turn_speed = setup_atb_turn_speed
  535.     all_battle_members.each do |battler|
  536.       battler.on_turn_end
  537.       next if scene_changing?
  538.       SceneManager.scene.refresh_status
  539.       SceneManager.scene.log_window.display_auto_affected_status(battler)
  540.       SceneManager.scene.log_window.wait_and_clear
  541.     end
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # * Overwrite method: make_action_orders
  545.   #--------------------------------------------------------------------------
  546.   def make_action_orders
  547.     @action_battlers += @active_members
  548.     @active_members.clear
  549.   end
  550.   #--------------------------------------------------------------------------
  551.   # * Alias method: init_members
  552.   #--------------------------------------------------------------------------
  553.   alias :init_members_ve_active_time_battle :init_members
  554.   def init_members
  555.     init_members_ve_active_time_battle   
  556.     @abt_turn_speed   = setup_atb_turn_speed
  557.     @escape_time      = 0
  558.     @atb_turn_count   = 0
  559.     @key_escape_count = 0
  560.     @input_battlers   = []
  561.     @active_members   = []
  562.     @action_battlers  = []
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # * Alias method: battle_start
  566.   #--------------------------------------------------------------------------
  567.   alias :battle_start_ve_active_time_battle :battle_start
  568.   def battle_start
  569.     battle_start_ve_active_time_battle
  570.     setup_initial_atb
  571.     @phase = :turn
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # * Alias method: process_escape
  575.   #--------------------------------------------------------------------------
  576.   alias :process_escape_ve_active_time_battle :process_escape
  577.   def process_escape
  578.     @preemptive = true if @escape_success
  579.     @escape_success = false
  580.     process_escape_ve_active_time_battle
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # * New method: update_atb
  584.   #--------------------------------------------------------------------------
  585.   def update_atb
  586.     clear_dead_atb
  587.     return if scene_changing?
  588.     return if $game_troop.interpreter.running?
  589.     return if SceneManager.scene.party_window?
  590.     return if $imported[:ve_animated_battle] && @escaping
  591.     update_timing
  592.     update_turn
  593.     update_all_atb
  594.     update_input
  595.     update_escaping
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # * New method: setup_initial_atb
  599.   #--------------------------------------------------------------------------
  600.   def setup_initial_atb
  601.     @escape_success = false
  602.     @key_escaping   = false
  603.     @escap_pose     = false
  604.     @party_escaping = false
  605.     all_battle_members.each {|battler| battler.cast_action = nil }
  606.     if @preemptive
  607.       $game_party.members.each {|battler| battler.atb = battler.max_atb }
  608.       $game_troop.members.each {|battler| battler.atb = 0 }
  609.     elsif @surprise
  610.       $game_party.members.each {|battler| battler.atb = 0 }
  611.       $game_troop.members.each {|battler| battler.atb = battler.max_atb }
  612.     else
  613.       all_battle_members.each {|battler| battler.preset_atb }
  614.     end
  615.   end
  616.   #--------------------------------------------------------------------------
  617.   # * New method: scene_changing?
  618.   #--------------------------------------------------------------------------
  619.   def scene_changing?
  620.     !SceneManager.scene_is?(Scene_Battle)
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # * New method: update_all_atb
  624.   #--------------------------------------------------------------------------
  625.   def update_all_atb
  626.     return if wating?
  627.     all_battle_members.each {|member| member.atb_update }
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # * New method: wating?
  631.   #--------------------------------------------------------------------------
  632.   def wating?
  633.     return true if scene_changing?
  634.     return true if $game_troop.interpreter.running?
  635.     return true if SceneManager.scene.full_wait?
  636.     return true if SceneManager.scene.semi_wait?
  637.     return true if wait_action?
  638.     return false
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # * New method: update_escaping
  642.   #--------------------------------------------------------------------------
  643.   def update_escaping
  644.     open_party_command   if VE_ATB_ESCAPE_TYPE == :party
  645.     process_party_escape if VE_ATB_ESCAPE_TYPE == :party && party_escape?
  646.     key_press_escape     if VE_ATB_ESCAPE_TYPE == :key
  647.     process_escape       if VE_ATB_ESCAPE_TYPE == :key   && key_escape?
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # * New method: open_party_command
  651.   #--------------------------------------------------------------------------
  652.   def open_party_command
  653.     return if scene_changing?
  654.     return if SceneManager.scene.windows_active?
  655.     SceneManager.scene.open_party_command_selection if Input.trigger?(:B)
  656.   end
  657.   #--------------------------------------------------------------------------
  658.   # * New method: party_escape?
  659.   #--------------------------------------------------------------------------
  660.   def party_escape?
  661.     $game_party.alive_members.all? {|actor| actor.atb_full? } &&
  662.     all_battle_members.all? {|battler| !active_battler?(battler) }
  663.   end
  664.   #--------------------------------------------------------------------------
  665.   # * New method: process_party_escape
  666.   #--------------------------------------------------------------------------
  667.   def process_party_escape
  668.     $game_party.members.each do |battler|
  669.       battler.atb = 0
  670.       battler.cast_action = nil
  671.       battler.clear_actions
  672.     end
  673.     @party_escaping = false
  674.     return if process_escape
  675.     turn_start
  676.     SceneManager.scene.battle_start_open_window unless scene_changing?
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # * New method: key_press_escape
  680.   #--------------------------------------------------------------------------
  681.   def key_press_escape
  682.     @key_escaping = VE_ATB_ESCAPE_KEYS.all? {|key| Input.press?(key)}
  683.     update_escape_time
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # * New method: key_escape?
  687.   #--------------------------------------------------------------------------
  688.   def key_escape?
  689.     all_battle_members.all? {|battler| !active?(battler) } && @escape_success
  690.   end
  691.   #--------------------------------------------------------------------------
  692.   # * New method: update_escape_time
  693.   #--------------------------------------------------------------------------
  694.   def update_escape_time
  695.     return if @escape_success
  696.     escaping? ? increase_escape_time : decrease_escape_time
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # * New method: increase_escape_time
  700.   #--------------------------------------------------------------------------
  701.   def increase_escape_time
  702.     reset_escape_pose if !reset_escape_pose?
  703.     @escap_pose = true
  704.     if BattleManager.can_escape?
  705.       @escape_time   = [@escape_time + 5 + rand, max_escape_time].min
  706.       @escape_success = @escape_time == max_escape_time
  707.     end
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # * New method: decrease_escape_time
  711.   #--------------------------------------------------------------------------
  712.   def decrease_escape_time
  713.     reset_escape_pose if reset_escape_pose?
  714.     @escap_pose  = false
  715.     @escape_time = [@escape_time - 1, 0].max
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # * New method: reset_escape_pose
  719.   #--------------------------------------------------------------------------
  720.   def reset_escape_pose
  721.     $game_party.alive_members.each {|actor| actor.reset_pose if !actor.active? }
  722.   end
  723.   #--------------------------------------------------------------------------
  724.   # * New method: reset_escape_pose?
  725.   #--------------------------------------------------------------------------
  726.   def reset_escape_pose?
  727.     $imported[:ve_animated_battle] && @escap_pose && VE_ATB_ESCAPING_ANIM
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # * New method: max_escape_time
  731.   #--------------------------------------------------------------------------
  732.   def max_escape_time
  733.     10.0 * VE_ATB_ESCAPE_TIME * @escape_ratio * $game_system.atb_speed
  734.   end
  735.   #--------------------------------------------------------------------------
  736.   # * New method: wait_action?
  737.   #--------------------------------------------------------------------------
  738.   def wait_action?
  739.     $imported[:ve_animated_battle]  && !scene_changing? &&
  740.     SceneManager.scene.wait_action? && SceneManager.scene.active?
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # * New method: update_turn
  744.   #--------------------------------------------------------------------------
  745.   def update_turn
  746.     return if wating?
  747.     increase_atb_turn_count(:time)
  748.     SceneManager.scene.turn_ending if @atb_turn_count >= @abt_turn_speed
  749.   end
  750.   #--------------------------------------------------------------------------
  751.   # * New method: update_timing
  752.   #--------------------------------------------------------------------------
  753.   def update_timing
  754.     return if wating?
  755.     all_battle_members.each {|battler| battler.on_timing }
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # * New method: update_input
  759.   #--------------------------------------------------------------------------
  760.   def update_input
  761.     all_battle_members.reverse.each do |battler|
  762.       next if (@party_escaping && battler.actor?) || !battler.ready?
  763.       @input_battlers.push(battler)
  764.       battler.on_action_start
  765.       skill_window.refresh if skill_window.active
  766.       item_window.refresh  if item_window.active
  767.     end
  768.     shift_input unless @input_battlers.empty?
  769.   end
  770.   #--------------------------------------------------------------------------
  771.   # * New method: skill_window
  772.   #--------------------------------------------------------------------------
  773.   def skill_window
  774.     SceneManager.scene.skill_window
  775.   end
  776.   #--------------------------------------------------------------------------
  777.   # * New method: item_window
  778.   #--------------------------------------------------------------------------
  779.   def item_window
  780.     SceneManager.scene.item_window
  781.   end
  782.   #--------------------------------------------------------------------------
  783.   # * New method: shift_input
  784.   #--------------------------------------------------------------------------
  785.   def shift_input
  786.     battler = @input_battlers.last
  787.     battler.actor? ? setup_action(battler) : setup_no_selection(battler)
  788.   end
  789.   #--------------------------------------------------------------------------
  790.   # * New method: setup_action
  791.   #--------------------------------------------------------------------------
  792.   def setup_action(battler)
  793.     return if scene_changing?
  794.     return if SceneManager.scene.windows_active? && battler.inputable?
  795.     return if battler.guard? && VE_ATB_REVERSE
  796.     battler.inputable? ? setup_selection(battler) : setup_no_selection(battler)
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # * New method: setup_selection
  800.   #--------------------------------------------------------------------------
  801.   def setup_selection(battler)
  802.     @actor_index = battler.index
  803.     battler.make_actions
  804.     SceneManager.scene.start_actor_command_selection
  805.     VE_ATB_SOUND.play if VE_ATB_SOUND
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # * New method: setup_no_selection
  809.   #--------------------------------------------------------------------------
  810.   def setup_no_selection(battler)
  811.     battler.turn_count += 1 if !battler.actor? && !battler.cast_action?
  812.     battler.make_actions
  813.     battler.setup_cast_action if battler.cast_action?
  814.     @input_battlers.delete(battler)
  815.     @active_members.push(battler)
  816.     turn_start
  817.   end
  818.   #--------------------------------------------------------------------------
  819.   # * New method: add_actor
  820.   #--------------------------------------------------------------------------
  821.   def add_actor(battler)
  822.     return unless input_battlers?(battler)
  823.     @input_battlers.delete(battler)
  824.     @active_members.push(battler)
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # * New method: active_battler?
  828.   #--------------------------------------------------------------------------
  829.   def active_battler?(battler)
  830.     @active_members.include?(battler) || @action_battlers.include?(battler) ||
  831.     @input_battlers.include?(battler) || battler.current_actor? ||
  832.     active?(battler)
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # * New method: input_battlers?
  836.   #--------------------------------------------------------------------------
  837.   def input_battlers?(battler)
  838.     @input_battlers.include?(battler)
  839.   end
  840.   #--------------------------------------------------------------------------
  841.   # * New method: all_battle_members
  842.   #--------------------------------------------------------------------------
  843.   def all_battle_members
  844.     $game_party.members + $game_troop.members
  845.   end
  846.   #--------------------------------------------------------------------------
  847.   # * New method: all_dead_members
  848.   #--------------------------------------------------------------------------
  849.   def all_dead_members
  850.     $game_party.dead_members + $game_troop.dead_members
  851.   end
  852.   #--------------------------------------------------------------------------
  853.   # * New method: delete_input
  854.   #--------------------------------------------------------------------------
  855.   def delete_input(battler)
  856.     @input_battlers.delete(battler)
  857.   end
  858.   #--------------------------------------------------------------------------
  859.   # * New method: clear_battler
  860.   #--------------------------------------------------------------------------
  861.   def clear_battler(battler)
  862.     @input_battlers.delete(battler)
  863.     @active_members.delete(battler)
  864.   end
  865.   #--------------------------------------------------------------------------
  866.   # * New method: escaping?
  867.   #--------------------------------------------------------------------------
  868.   def escaping?
  869.     @key_escaping
  870.   end
  871.   #--------------------------------------------------------------------------
  872.   # * New method: party_escaping?
  873.   #--------------------------------------------------------------------------
  874.   def party_escaping?
  875.     @party_escaping
  876.   end
  877.   #--------------------------------------------------------------------------
  878.   # * New method: active?
  879.   #--------------------------------------------------------------------------
  880.   def active?(battler)
  881.     $imported[:ve_animated_battle] && battler.poses.active?
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # * New method: setup_atb_turn_speed
  885.   #--------------------------------------------------------------------------
  886.   def setup_atb_turn_speed
  887.     case VE_ATB_TURN_COUNT
  888.     when :battlers then all_dead_members.size
  889.     when :actions  then VE_ATB_ACTION_COUNT
  890.     when :time     then VE_ATB_TIME_COUNT
  891.     end
  892.   end
  893.   #--------------------------------------------------------------------------
  894.   # * New method: clear_dead_atb
  895.   #--------------------------------------------------------------------------
  896.   def clear_dead_atb
  897.     all_dead_members.each do |battler|
  898.       next unless active_battler?(battler)
  899.       battler.atb = 0
  900.       @active_members.delete(battler)
  901.       @input_battlers.delete(battler)
  902.       @action_battlers.delete(battler)
  903.     end
  904.   end
  905.   #--------------------------------------------------------------------------
  906.   # * New method: increase_atb_turn_count
  907.   #--------------------------------------------------------------------------
  908.   def increase_atb_turn_count(type)
  909.     @atb_turn_count += $game_system.atb_speed if VE_ATB_TURN_COUNT == type
  910.   end
  911.   #--------------------------------------------------------------------------
  912.   # * New method: setup_escape
  913.   #--------------------------------------------------------------------------
  914.   def setup_escape
  915.     $game_party.members.each {|battler| delete_input(battler) }
  916.     @party_escaping = true
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # * New method: undo_escape
  920.   #--------------------------------------------------------------------------
  921.   def undo_escape
  922.     @party_escaping = false
  923.   end
  924.   #--------------------------------------------------------------------------
  925.   # * New method: turn_phase
  926.   #--------------------------------------------------------------------------
  927.   def turn_phase
  928.     @phase = :turn
  929.   end
  930. end
  931.  
  932. #==============================================================================
  933. # ** Game_System
  934. #------------------------------------------------------------------------------
  935. #  This class handles system-related data. Also manages vehicles and BGM, etc.
  936. # The instance of this class is referenced by $game_system.
  937. #==============================================================================
  938.  
  939. class Game_System
  940.   #--------------------------------------------------------------------------
  941.   # * Public Instance Variables
  942.   #--------------------------------------------------------------------------
  943.   attr_accessor :wait_mode
  944.   attr_accessor :atb_speed
  945.   #--------------------------------------------------------------------------
  946.   # * Alias method: initialize
  947.   #--------------------------------------------------------------------------
  948.   alias :initialize_ve_active_time_battle :initialize
  949.   def initialize
  950.     initialize_ve_active_time_battle
  951.     @wait_mode = VE_ATB_WAIT_MODE
  952.     @atb_speed = VE_ATB_SPEED
  953.   end
  954. end
  955.  
  956. #==============================================================================
  957. # ** Game_Action
  958. #------------------------------------------------------------------------------
  959. #  This class handles battle actions. This class is used within the
  960. # Game_Battler class.
  961. #==============================================================================
  962.  
  963. class Game_Action
  964.   #--------------------------------------------------------------------------
  965.   # * Alias method: prepare
  966.   #--------------------------------------------------------------------------
  967.   alias :prepare_ve_active_time_battle :prepare
  968.   def prepare
  969.     subject.atb = item ? subject.atb * item.atb_cost : 0
  970.     if item && item.castable? && !subject.cast_action? &&
  971.        !subject.confusion? && !forcing
  972.       subject.cast_action = self.clone
  973.       subject.skip_actions
  974.       subject.reset_pose if $imported[:ve_animated_battle]
  975.     else
  976.       subject.cast_action = nil if !forcing
  977.       prepare_ve_active_time_battle
  978.     end
  979.   end
  980. end
  981.  
  982. #==============================================================================
  983. # ** Game_BattlerBase
  984. #------------------------------------------------------------------------------
  985. #  This class handles battlers. It's used as a superclass of the Game_Battler
  986. # classes.
  987. #==============================================================================
  988.  
  989. class Game_BattlerBase
  990.   #--------------------------------------------------------------------------
  991.   # * Alias method: inputable?
  992.   #--------------------------------------------------------------------------
  993.   alias :inputable_ve_active_time_battle? :inputable?
  994.   def inputable?
  995.     inputable_ve_active_time_battle? && atb_full? && input? && !cast_action?
  996.   end
  997.   #--------------------------------------------------------------------------
  998.   # * Alias method: clear_states
  999.   #--------------------------------------------------------------------------  
  1000.   alias :clear_states_ve_active_time_battle :clear_states
  1001.   def clear_states
  1002.     clear_states_ve_active_time_battle
  1003.     @state_timing = {}
  1004.   end
  1005.   #--------------------------------------------------------------------------
  1006.   # * Alias method: erase_state
  1007.   #--------------------------------------------------------------------------
  1008.   alias :erase_state_ve_active_time_battle :erase_state
  1009.   def erase_state(state_id)
  1010.     erase_state_ve_active_time_battle(state_id)
  1011.     @state_timing.delete(state_id)
  1012.   end
  1013. end
  1014.  
  1015. #==============================================================================
  1016. # ** Game_Battler
  1017. #------------------------------------------------------------------------------
  1018. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  1019. # and Game_Enemy classes.
  1020. #==============================================================================
  1021.  
  1022. class Game_Battler < Game_BattlerBase
  1023.   #--------------------------------------------------------------------------
  1024.   # * Public Instance Variables
  1025.   #--------------------------------------------------------------------------
  1026.   attr_accessor :cast_action
  1027.   #--------------------------------------------------------------------------
  1028.   # * Overwite method: on_action_end
  1029.   #--------------------------------------------------------------------------
  1030.   def on_action_end
  1031.     @result.clear
  1032.     regenerate_all if VE_ATB_REGEN_TRIGGER == :action
  1033.     @result.clear  if VE_ATB_REGEN_TRIGGER == :action
  1034.     remove_states_auto(1)
  1035.     update_buff_turns
  1036.     remove_buffs_auto
  1037.   end
  1038.   #--------------------------------------------------------------------------
  1039.   # * Overwite method: on_turn_end
  1040.   #--------------------------------------------------------------------------
  1041.   def on_turn_end
  1042.     @result.clear
  1043.     remove_states_auto(2)
  1044.   end
  1045.   #--------------------------------------------------------------------------
  1046.   # * Alias method: remove_states_auto
  1047.   #--------------------------------------------------------------------------
  1048.   alias :remove_states_auto_ve_active_time_battle :remove_states_auto
  1049.   def remove_states_auto(timing)
  1050.     update_state_auto(timing)
  1051.     remove_states_auto_ve_active_time_battle(timing)
  1052.   end
  1053.   #--------------------------------------------------------------------------
  1054.   # * Alias method: item_user_effect
  1055.   #--------------------------------------------------------------------------
  1056.   alias :item_user_effect_ve_active_time_battle :item_user_effect
  1057.   def item_user_effect(user, item)
  1058.     item_user_effect_ve_active_time_battle(user, item)
  1059.     setup_cast_cancel(user, item)
  1060.     setup_atb_delay(user, item)
  1061.   end
  1062.   #--------------------------------------------------------------------------
  1063.   # * Alias method: reset_state_counts
  1064.   #--------------------------------------------------------------------------
  1065.   alias :reset_state_counts_ve_active_time_battle :reset_state_counts
  1066.   def reset_state_counts(state_id)
  1067.     reset_state_counts_ve_active_time_battle(state_id)
  1068.     state = $data_states[state_id]
  1069.     @state_timing[state_id] = state.timed_trigger if state.timed_trigger
  1070.   end
  1071.   #--------------------------------------------------------------------------
  1072.   # * New method: max_atb
  1073.   #--------------------------------------------------------------------------
  1074.   def max_atb
  1075.     @max_atb ||= 1000
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # * New method: atb
  1079.   #--------------------------------------------------------------------------
  1080.   def atb
  1081.     @atb ||= 0
  1082.   end
  1083.   #--------------------------------------------------------------------------
  1084.   # * New method: atb=
  1085.   #--------------------------------------------------------------------------
  1086.   def atb=(n)
  1087.     @atb = [[n, 0].max, max_atb].min
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # * New method: atb_freeze
  1091.   #--------------------------------------------------------------------------
  1092.   def atb_freeze
  1093.     @atb_freeze
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # * New method: regen_timing
  1097.   #--------------------------------------------------------------------------
  1098.   def regen_timing
  1099.     @regen_timing ||= 0
  1100.   end
  1101.   #--------------------------------------------------------------------------
  1102.   # * New method: regen_timing=
  1103.   #--------------------------------------------------------------------------
  1104.   def regen_timing=(n)
  1105.     @regen_timing = [[n, 0].max, VE_ATB_REGEN_TIMING].min
  1106.   end
  1107.   #--------------------------------------------------------------------------
  1108.   # * New method: regen_timing_full?
  1109.   #--------------------------------------------------------------------------
  1110.   def regen_timing_full?
  1111.     regen_timing == VE_ATB_REGEN_TIMING
  1112.   end
  1113.   #--------------------------------------------------------------------------
  1114.   # * New method: atb_freeze=
  1115.   #--------------------------------------------------------------------------
  1116.   def atb_freeze=(n)
  1117.     @atb_freeze = n
  1118.   end
  1119.   #--------------------------------------------------------------------------
  1120.   # * New method: atb_full?
  1121.   #--------------------------------------------------------------------------
  1122.   def atb_full?
  1123.     @atb == max_atb
  1124.   end
  1125.   #--------------------------------------------------------------------------
  1126.   # * New method: atb_rate
  1127.   #--------------------------------------------------------------------------
  1128.   def atb_rate
  1129.     atb.to_f / max_atb
  1130.   end
  1131.   #--------------------------------------------------------------------------
  1132.   # * New method: ready?
  1133.   #--------------------------------------------------------------------------
  1134.   def ready?
  1135.     movable? && atb_full? && !active_battler?
  1136.   end
  1137.   #--------------------------------------------------------------------------
  1138.   # * New method: cast_action?
  1139.   #--------------------------------------------------------------------------
  1140.   def cast_action?
  1141.     cast_action ? true : false
  1142.   end
  1143.   #--------------------------------------------------------------------------
  1144.   # * New method: preset_atb
  1145.   #--------------------------------------------------------------------------
  1146.   def preset_atb
  1147.     self.atb = max_atb * VE_ATB_START_RATE * rand / 100
  1148.   end
  1149.   #--------------------------------------------------------------------------
  1150.   # * New method: total_agi
  1151.   #--------------------------------------------------------------------------
  1152.   def total_agi
  1153.     SceneManager.scene.all_battle_members.inject(0.0) {|r, obj| r += obj.agi }
  1154.   end
  1155.   #--------------------------------------------------------------------------
  1156.   # * New method: atb_update
  1157.   #--------------------------------------------------------------------------
  1158.   def atb_update
  1159.     update_atb_freeze if atb_freeze?
  1160.     return if atb_wait?
  1161.     self.atb_freeze = nil
  1162.     self.atb += update_atb
  1163.     self.atb  = max_atb if VE_ATB_REVERSE && !cast_action?
  1164.   end
  1165.   #--------------------------------------------------------------------------
  1166.   # * New method: atb_freeze?
  1167.   #--------------------------------------------------------------------------
  1168.   def atb_freeze?
  1169.     !movable?
  1170.   end
  1171.   #--------------------------------------------------------------------------
  1172.   # * New method: update_atb
  1173.   #--------------------------------------------------------------------------
  1174.   def update_atb
  1175.     speed = cast_action? ? cast_speed : agi
  1176.     20.0 * $game_system.atb_speed * atb_speed_mod(speed) * speed_modifier
  1177.   end
  1178.   #--------------------------------------------------------------------------
  1179.   # * New method: atb_wait?
  1180.   #--------------------------------------------------------------------------
  1181.   def atb_wait?
  1182.     atb_full? || atb_freeze? || pause_damage? || current_actor? ||
  1183.     (actor? && BattleManager.escaping?)
  1184.   end
  1185.   #--------------------------------------------------------------------------
  1186.   # * New method: update_atb_freeze
  1187.   #--------------------------------------------------------------------------
  1188.   def update_atb_freeze
  1189.     self.cast_action = nil
  1190.     self.atb_freeze ||= self.atb
  1191.     self.atb_freeze  += update_atb
  1192.     atb_freeze_result unless @atb_freeze < max_atb
  1193.   end
  1194.   #--------------------------------------------------------------------------
  1195.   # * New method: atb_freeze_result
  1196.   #--------------------------------------------------------------------------
  1197.   def atb_freeze_result
  1198.     @result.clear
  1199.     remove_states_auto(1)
  1200.     regenerate_all if VE_ATB_REGEN_TRIGGER == :action
  1201.     self.atb_freeze = 0
  1202.   end
  1203.   #--------------------------------------------------------------------------
  1204.   # * New method: pause_damage?
  1205.   #--------------------------------------------------------------------------
  1206.   def pause_damage?
  1207.     VE_ATB_DAMAGE_WAIT && $imported[:ve_animated_battle] && poses.damage_pose?
  1208.   end
  1209.   #--------------------------------------------------------------------------
  1210.   # * New method: cast_speed
  1211.   #--------------------------------------------------------------------------
  1212.   def cast_speed
  1213.     return agi if !cast_action
  1214.     speed = cast_action.item.cast_speed
  1215.     speed[:spd] * send(make_symbol(speed[:stat])) / 100.0
  1216.   end
  1217.   #--------------------------------------------------------------------------
  1218.   # * New method: atb_speed_mod
  1219.   #--------------------------------------------------------------------------
  1220.   def atb_speed_mod(speed)
  1221.     (speed + [VE_speed_modifier, 0].max) / total_agi
  1222.   end
  1223.   #--------------------------------------------------------------------------
  1224.   # * New method: setup_cast_action
  1225.   #--------------------------------------------------------------------------
  1226.   def setup_cast_action
  1227.     @actions = [cast_action]
  1228.   end
  1229.   #--------------------------------------------------------------------------
  1230.   # * New method: setup_cast_cancel
  1231.   #--------------------------------------------------------------------------
  1232.   def setup_cast_cancel(user, item)
  1233.     rate  = item.cast_cancel
  1234.     rate += user.cast_cancel if item.physical?
  1235.     rate *= cast_protection
  1236.     execute_cast_cancel      if rand < rate && cast_action?
  1237.   end
  1238.   #--------------------------------------------------------------------------
  1239.   # * New method: setup_atb_delay
  1240.   #--------------------------------------------------------------------------
  1241.   def setup_atb_delay(user, item)
  1242.     rate  = item.atb_delay[:rate]
  1243.     rate += user.atb_delay[:rate] if item.physical?
  1244.     rate *= delay_protection
  1245.     execute_atb_delay(user, item) if rand < rate
  1246.   end
  1247.   #--------------------------------------------------------------------------
  1248.   # * New method: execute_cast_cancel
  1249.   #--------------------------------------------------------------------------
  1250.   def execute_cast_cancel
  1251.     skip_actions
  1252.     self.atb = 0
  1253.     self.cast_action = nil
  1254.   end
  1255.   #--------------------------------------------------------------------------
  1256.   # * New method: execute_atb_delay
  1257.   #--------------------------------------------------------------------------
  1258.   def execute_atb_delay(user, item)
  1259.     rate  = item.atb_delay[:delay]
  1260.     rate += user.atb_delay[:delay] if item.physical?
  1261.     self.atb -= max_atb * rate
  1262.   end
  1263.   #--------------------------------------------------------------------------
  1264.   # * New method: cast_cancel
  1265.   #--------------------------------------------------------------------------
  1266.   def cast_cancel
  1267.     regexp = /<CAST CANCEL: (\d+)%?>/i
  1268.     get_all_notes.scan(regexp).inject(0.0) {|r| r += ($1.to_f / 100) }
  1269.   end
  1270.   #--------------------------------------------------------------------------
  1271.   # * New method: atb_delay
  1272.   #--------------------------------------------------------------------------
  1273.   def atb_delay
  1274.     result = {}
  1275.     notes  = get_all_notes.dup
  1276.     regexp = /<ATB DELAY: (\d+)%?, *(\d+)%?>/i
  1277.     result[:rate]  = notes.scan(regexp).inject(0.0) {|r| r += ($1.to_f / 100) }
  1278.     result[:delay] = notes.scan(regexp).inject(0.0) {|r| r += ($1.to_f / 100) }
  1279.     result
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # * New method: cast_protection
  1283.   #--------------------------------------------------------------------------
  1284.   def cast_protection
  1285.     regexp = /<CAST PROTECTION: (\d+)%?>/i
  1286.     get_all_notes.scan(regexp).inject(1.0) {|r| r *= 1 - ($1.to_f / 100) }
  1287.   end
  1288.   #--------------------------------------------------------------------------
  1289.   # * New method: delay_protection
  1290.   #--------------------------------------------------------------------------
  1291.   def delay_protection
  1292.     regexp = /<DELAY PROTECTION: (\d+)%?>/i
  1293.     get_all_notes.scan(regexp).inject(1.0) {|r| r *= 1 - ($1.to_f / 100) }
  1294.   end
  1295.   #--------------------------------------------------------------------------
  1296.   # * New method: update_state_auto
  1297.   #--------------------------------------------------------------------------
  1298.   def update_state_auto(timing)
  1299.     states.each do |state|
  1300.       if @state_turns[state.id] > 0 && state.auto_removal_timing == timing
  1301.         @state_turns[state.id] -= 1
  1302.       end
  1303.     end
  1304.   end
  1305.   #--------------------------------------------------------------------------
  1306.   # * New method: on_timing
  1307.   #--------------------------------------------------------------------------
  1308.   def on_timing
  1309.     timing_regen
  1310.     remove_timing_states
  1311.   end
  1312.   #--------------------------------------------------------------------------
  1313.   # * New method: timing_regen
  1314.   #--------------------------------------------------------------------------
  1315.   def timing_regen
  1316.     return unless VE_ATB_REGEN_TRIGGER == :timing
  1317.     self.regen_timing += $game_system.atb_speed if regen?
  1318.     @result.clear     if regen_timing_full?
  1319.     regenerate_all    if regen_timing_full?
  1320.     @regen_timing = 0 if regen_timing_full? || !regen?
  1321.   end
  1322.   #--------------------------------------------------------------------------
  1323.   # * New method: remove_timing_states
  1324.   #--------------------------------------------------------------------------
  1325.   def remove_timing_states
  1326.     states.each do |state|
  1327.       next if state.auto_removal_timing != 3
  1328.       next if state.guard_state? && !VE_ATB_REVERSE
  1329.       @state_timing[state.id] -= $game_system.atb_speed
  1330.       if @state_turns[state.id] > 0 && @state_timing[state.id] <= 0
  1331.         @state_turns[state.id] -= 1
  1332.         @state_timing[state.id] = state.timed_trigger
  1333.       end
  1334.       remove_state(state.id) if @state_turns[state.id] == 0
  1335.     end
  1336.   end
  1337.   #--------------------------------------------------------------------------
  1338.   # * New method: regen?
  1339.   #--------------------------------------------------------------------------
  1340.   def regen?
  1341.     hrg != 0 || mrg != 0 || trg != 0
  1342.   end
  1343.   #--------------------------------------------------------------------------
  1344.   # * Overwite method: on_action_end
  1345.   #--------------------------------------------------------------------------
  1346.   def on_action_start
  1347.     make_actions
  1348.     remove_guard_state
  1349.   end
  1350.   #--------------------------------------------------------------------------
  1351.   # * Overwite method: remove_guard_state
  1352.   #--------------------------------------------------------------------------
  1353.   def remove_guard_state
  1354.     return if VE_ATB_REVERSE
  1355.     states.each do |state|
  1356.       next unless state.guard_state?
  1357.       remove_state(state.id)
  1358.       @damaged = true
  1359.     end
  1360.   end
  1361.   #--------------------------------------------------------------------------
  1362.   # * New method: skip_actions
  1363.   #--------------------------------------------------------------------------
  1364.   def skip_actions
  1365.     clear_actions
  1366.     @actions = [Game_Action.new(self)]
  1367.   end
  1368.   #--------------------------------------------------------------------------
  1369.   # * New method: active_battler?
  1370.   #--------------------------------------------------------------------------
  1371.   def active_battler?
  1372.     BattleManager.active_battler?(self)
  1373.   end
  1374.   #--------------------------------------------------------------------------
  1375.   # * New method: input?
  1376.   #--------------------------------------------------------------------------
  1377.   def input?
  1378.     BattleManager.input_battlers?(self)
  1379.   end
  1380.   #--------------------------------------------------------------------------
  1381.   # * New method: current_actor?
  1382.   #--------------------------------------------------------------------------
  1383.   def current_actor?
  1384.     SceneManager.scene_is?(Scene_Battle) && SceneManager.scene.subject == self
  1385.   end
  1386. end
  1387.  
  1388. #==============================================================================
  1389. # ** Game_Actor
  1390. #------------------------------------------------------------------------------
  1391. #  This class handles actors. It's used within the Game_Actors class
  1392. # ($game_actors) and referenced by the Game_Party class ($game_party).
  1393. #==============================================================================
  1394.  
  1395. class Game_Actor < Game_Battler
  1396.   #--------------------------------------------------------------------------
  1397.   # * New method: speed_modifier
  1398.   #--------------------------------------------------------------------------
  1399.   def speed_modifier
  1400.     list = [self.actor] + [self.class] + states + equips
  1401.     list.compact.inject(1.0) {|r, obj| r *= obj.atb_speed }
  1402.   end
  1403. end
  1404.  
  1405. #==============================================================================
  1406. # ** Game_Enemy
  1407. #------------------------------------------------------------------------------
  1408. #  This class handles enemy characters. It's used within the Game_Troop class
  1409. # ($game_troop).
  1410. #==============================================================================
  1411.  
  1412. class Game_Enemy < Game_Battler
  1413.   #--------------------------------------------------------------------------
  1414.   # * Public Instance Variables
  1415.   #--------------------------------------------------------------------------
  1416.   attr_accessor :turn_count
  1417.   #--------------------------------------------------------------------------
  1418.   # * Overwrite method: conditions_met_turns?
  1419.   #--------------------------------------------------------------------------
  1420.   def conditions_met_turns?(param1, param2)
  1421.     n = @turn_count
  1422.     if param2 == 0
  1423.       n == param1
  1424.     else
  1425.       n > 0 && n >= param1 && n % param2 == param1 % param2
  1426.     end
  1427.   end
  1428.   #--------------------------------------------------------------------------
  1429.   # * Alias method: initialize
  1430.   #--------------------------------------------------------------------------
  1431.   alias :initialize_ve_active_time_battle :initialize
  1432.   def initialize(index, enemy_id)
  1433.     initialize_ve_active_time_battle(index, enemy_id)
  1434.     @turn_count = 0
  1435.   end
  1436.   #--------------------------------------------------------------------------
  1437.   # * New method: speed_modifier
  1438.   #--------------------------------------------------------------------------
  1439.   def speed_modifier
  1440.     enemy.atb_speed * states.inject(1.0) {|r, state| r *= state.atb_speed }
  1441.   end
  1442. end
  1443.  
  1444. #==============================================================================
  1445. # ** Spriteset_Battle
  1446. #------------------------------------------------------------------------------
  1447. #  This class brings together battle screen sprites. It's used within the
  1448. # Scene_Battle class.
  1449. #==============================================================================
  1450.  
  1451. class Spriteset_Battle
  1452.   #--------------------------------------------------------------------------
  1453.   # * Alias method: update_actors
  1454.   #--------------------------------------------------------------------------
  1455.   alias :update_actors_ve_active_time_battle :update_actors
  1456.   def update_actors
  1457.     uptate_actors_atb
  1458.     update_actors_ve_active_time_battle
  1459.   end
  1460.   #--------------------------------------------------------------------------
  1461.   # * New method: uptate_actors_atb
  1462.   #--------------------------------------------------------------------------
  1463.   def uptate_actors_atb
  1464.     return if @atb_actors == $game_party.members
  1465.     $game_party.members.each do |actor|
  1466.       actor.preset_atb if @atb_actors && !@atb_actors.include?(actor)
  1467.     end
  1468.     @atb_actors = $game_party.members.dup
  1469.   end
  1470. end
  1471.  
  1472. #==============================================================================
  1473. # ** Window_Base
  1474. #------------------------------------------------------------------------------
  1475. #  This is a superclass of all windows in the game.
  1476. #==============================================================================
  1477.  
  1478. class Window_Base < Window
  1479.   #--------------------------------------------------------------------------
  1480.   # * Public Instance Variables
  1481.   #--------------------------------------------------------------------------
  1482.   attr_accessor :hidden
  1483. end
  1484.  
  1485. #==============================================================================
  1486. # ** Window_BattleLog
  1487. #------------------------------------------------------------------------------
  1488. #  This window shows the battle progress. Do not show the window frame.
  1489. #==============================================================================
  1490.  
  1491. class Window_BattleLog < Window_Selectable
  1492.   #--------------------------------------------------------------------------
  1493.   # * Alias method: last_text
  1494.   #--------------------------------------------------------------------------
  1495.   alias :last_text_ve_active_time_battle :last_text
  1496.   def last_text
  1497.     last_text_ve_active_time_battle ? last_text_ve_active_time_battle : ""
  1498.   end
  1499. end
  1500.  
  1501. #==============================================================================
  1502. # ** Window_ActorCommand
  1503. #------------------------------------------------------------------------------
  1504. #  This window is used to select actor commands, such as "Attack" or "Skill".
  1505. #==============================================================================
  1506.  
  1507. class Window_ActorCommand < Window_Command
  1508.   #--------------------------------------------------------------------------
  1509.   # * Alias method: make_command_list
  1510.   #--------------------------------------------------------------------------
  1511.   alias :make_command_list_ve_active_time_battle :make_command_list
  1512.   def make_command_list
  1513.     make_command_list_ve_active_time_battle
  1514.     add_escape_command if VE_ATB_ESCAPE_TYPE == :command
  1515.   end
  1516.   #--------------------------------------------------------------------------
  1517.   # * New method: add_escape_command
  1518.   #--------------------------------------------------------------------------
  1519.   def add_escape_command
  1520.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  1521.   end
  1522. end
  1523.  
  1524. #==============================================================================
  1525. # ** Window_BattleStatus
  1526. #------------------------------------------------------------------------------
  1527. #  Esta janela exibe as condições de todos membros do grupo na tela de batalha.
  1528. #==============================================================================
  1529.  
  1530. class Window_BattleStatus < Window_Selectable
  1531.   #--------------------------------------------------------------------------
  1532.   # * Overwrite method: window_width
  1533.   #--------------------------------------------------------------------------
  1534.   def window_width
  1535.     Graphics.width - ($data_system.opt_display_tp ? 0 : 128)
  1536.   end
  1537.   #--------------------------------------------------------------------------
  1538.   # * Overwrite method: draw_basic_area
  1539.   #--------------------------------------------------------------------------
  1540.   def draw_basic_area(rect, actor)
  1541.     width = $data_system.opt_display_tp ? 180 : 104
  1542.     draw_actor_name(actor, rect.x + 0, rect.y, 100)
  1543.     draw_actor_icons(actor, rect.x + 104, rect.y, [rect.width - width, 24].max)
  1544.   end
  1545.   #--------------------------------------------------------------------------
  1546.   # * Overwrite method: draw_gauge_area_with_tp
  1547.   #--------------------------------------------------------------------------
  1548.   def draw_gauge_area_with_tp(rect, actor)
  1549.     draw_actor_hp(actor, rect.x - 82, rect.y, 72)
  1550.     draw_actor_mp(actor, rect.x + 0, rect.y, 64)
  1551.     draw_actor_tp(actor, rect.x + 74, rect.y, 64)
  1552.     update_atb
  1553.   end
  1554.   #--------------------------------------------------------------------------
  1555.   # * Overwrite method: draw_gauge_area_without_tp
  1556.   #--------------------------------------------------------------------------
  1557.   def draw_gauge_area_without_tp(rect, actor)
  1558.     draw_actor_hp(actor, rect.x + 0, rect.y, 72)
  1559.     draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  1560.     update_atb
  1561.   end
  1562.   #--------------------------------------------------------------------------
  1563.   # * Overwrite method: update
  1564.   #--------------------------------------------------------------------------
  1565.   def update
  1566.     super
  1567.     update_atb
  1568.   end
  1569.   #--------------------------------------------------------------------------
  1570.   # * New method: update_atb
  1571.   #--------------------------------------------------------------------------
  1572.   def update_atb
  1573.     @count ||= 0
  1574.     @count  += 1
  1575.     return if @count % 2 != 0
  1576.     update_atb_bars
  1577.   end
  1578.   #--------------------------------------------------------------------------
  1579.   # * New method: update_atb_bars
  1580.   #--------------------------------------------------------------------------
  1581.   def update_atb_bars
  1582.     tp_adjust = $data_system.opt_display_tp ? 148 : 156
  1583.     item_max.times do |i|
  1584.       actor = $game_party.battle_members[i]
  1585.       rect  = gauge_area_rect(i)
  1586.       rect.x += tp_adjust
  1587.       contents.clear_rect(rect)
  1588.       draw_actor_atb(actor, rect.x, rect.y, 64)
  1589.     end
  1590.   end
  1591.   #--------------------------------------------------------------------------
  1592.   # * New method: draw_actor_atb
  1593.   #--------------------------------------------------------------------------
  1594.   def draw_actor_atb(actor, x, y, width = 124)
  1595.     color1 = setup_atb_color1(actor)
  1596.     color2 = setup_atb_color2(actor)
  1597.     draw_gauge(x, y, width, actor.atb_rate, color1, color2)
  1598.     change_color(system_color)
  1599.     draw_text(x, y, 30, line_height, Vocab::VE_ATB_Name)
  1600.   end
  1601.   #--------------------------------------------------------------------------
  1602.   # * New method: setup_atb_color1
  1603.   #--------------------------------------------------------------------------
  1604.   def setup_atb_color1(actor)
  1605.     return text_color(2) if actor.cast_action?
  1606.     return text_color(6) if BattleManager.party_escaping?
  1607.     return text_color(5)
  1608.   end
  1609.   #--------------------------------------------------------------------------
  1610.   # * New method: setup_atb_color2
  1611.   #--------------------------------------------------------------------------
  1612.   def setup_atb_color2(actor)
  1613.     return text_color(10) if actor.cast_action?
  1614.     return text_color(14) if BattleManager.party_escaping?
  1615.     return text_color(13)
  1616.   end
  1617. end
  1618.  
  1619. #==============================================================================
  1620. # ** Scene_Battle
  1621. #------------------------------------------------------------------------------
  1622. #  This class performs battle screen processing.
  1623. #==============================================================================
  1624.  
  1625. class Scene_Battle < Scene_Base
  1626.   #--------------------------------------------------------------------------
  1627.   # * Public Instance Variables
  1628.   #--------------------------------------------------------------------------
  1629.   attr_reader   :log_window
  1630.   attr_reader   :item_window
  1631.   attr_reader   :skill_window
  1632.   #--------------------------------------------------------------------------
  1633.   # * Overwrite method: update_info_viewport
  1634.   #--------------------------------------------------------------------------
  1635.   def update_all_windows
  1636.     update_active_windows
  1637.     super
  1638.   end
  1639.   #--------------------------------------------------------------------------
  1640.   # * Overwrite method: update_info_viewport
  1641.   #--------------------------------------------------------------------------
  1642.   def update_info_viewport
  1643.     if VE_MOVE_STATUS_WINDOW
  1644.       @move_info_wait  = 4 if @moved_info != windows_active?
  1645.       @move_info_wait -= 1
  1646.       move_info_viewport(0) if @party_command_window.active
  1647.       move_info_viewport(right_status_window)  if right_info_viewport
  1648.       move_info_viewport(center_status_window) if center_info_viewport
  1649.       @moved_info = windows_active?
  1650.     else
  1651.       move_info_viewport(128)
  1652.     end
  1653.     update_close_command_window
  1654.   end
  1655.   #--------------------------------------------------------------------------
  1656.   # * Overwrite method: turn_start
  1657.   #--------------------------------------------------------------------------
  1658.   def turn_start
  1659.     BattleManager.add_actor(BattleManager.actor)
  1660.     @close_command_wait   = 2
  1661.     @close_command_window = true
  1662.     @status_window.unselect
  1663.     BattleManager.turn_start
  1664.   end
  1665.   #--------------------------------------------------------------------------
  1666.   # * Overwrite method: start_party_command_selection
  1667.   #--------------------------------------------------------------------------
  1668.   def start_party_command_selection
  1669.   end
  1670.   #--------------------------------------------------------------------------
  1671.   # * Overwrite method: turn_end
  1672.   #--------------------------------------------------------------------------
  1673.   def turn_end
  1674.   end
  1675.   #--------------------------------------------------------------------------
  1676.   # * Alias method: battle_start
  1677.   #--------------------------------------------------------------------------
  1678.   alias :battle_start_ve_active_time_battle :battle_start
  1679.   def battle_start
  1680.     battle_start_ve_active_time_battle
  1681.     battle_start_open_window
  1682.   end
  1683.   #--------------------------------------------------------------------------
  1684.   # * Alias method: create_all_windows
  1685.   #--------------------------------------------------------------------------
  1686.   alias :create_all_windows_ve_active_time_battle :create_all_windows
  1687.   def create_all_windows
  1688.     create_all_windows_ve_active_time_battle
  1689.     create_escape_window
  1690.     @close_command_wait = 0
  1691.     @move_info_wait     = 4
  1692.   end
  1693.   #--------------------------------------------------------------------------
  1694.   # * Alias method: reate_party_command_window
  1695.   #--------------------------------------------------------------------------
  1696.   alias :create_party_command_window_ve_active_time_battle :create_party_command_window
  1697.   def create_party_command_window
  1698.     create_party_command_window_ve_active_time_battle
  1699.     unless VE_MOVE_STATUS_WINDOW
  1700.       @party_command_window.x = @party_command_window.width
  1701.     end
  1702.     @info_viewport.ox = center_status_window
  1703.   end
  1704.   #--------------------------------------------------------------------------
  1705.   # * Alias method: create_actor_command_window
  1706.   #--------------------------------------------------------------------------
  1707.   alias :create_command_window_ve_active_time_battle :create_actor_command_window
  1708.   def create_actor_command_window
  1709.     create_command_window_ve_active_time_battle
  1710.     @actor_command_window.set_handler(:escape,  method(:command_escape))
  1711.     if !VE_MOVE_STATUS_WINDOW
  1712.       @actor_command_window.x = @actor_command_window.width
  1713.     elsif $data_system.opt_display_tp
  1714.       @actor_command_window.x = Graphics.width + 128
  1715.     end
  1716.   end
  1717.   #--------------------------------------------------------------------------
  1718.   # * Alias method: update
  1719.   #--------------------------------------------------------------------------
  1720.   alias :update_ve_active_time_battle :update
  1721.   def update
  1722.     result = update_ve_active_time_battle
  1723.     BattleManager.update_atb unless result
  1724.     result
  1725.   end
  1726.   #--------------------------------------------------------------------------
  1727.   # * Alias method: update_basic
  1728.   #--------------------------------------------------------------------------
  1729.   alias :update_basic_ve_active_time_battle :update_basic
  1730.   def update_basic
  1731.     update_basic_ve_active_time_battle
  1732.     update_escape_window if VE_ATB_ESCAPE_TYPE == :key
  1733.   end
  1734.   #--------------------------------------------------------------------------
  1735.   # * Alias method: update_for_wait
  1736.   #--------------------------------------------------------------------------
  1737.   alias :update_for_wait_ve_active_time_battle :update_for_wait
  1738.   def update_for_wait
  1739.     update_for_wait_ve_active_time_battle
  1740.     BattleManager.update_atb if BattleManager.in_turn? && !wait_action?
  1741.   end
  1742.   #--------------------------------------------------------------------------
  1743.   # * Alias method: wait_for_message
  1744.   #--------------------------------------------------------------------------
  1745.   alias :wait_for_message_ve_active_time_battle :wait_for_message
  1746.   def wait_for_message
  1747.     wait_for_message_ve_active_time_battle
  1748.     open_windows
  1749.   end
  1750.   #--------------------------------------------------------------------------
  1751.   # * Atualização da mensagem aberta
  1752.   #--------------------------------------------------------------------------
  1753.   alias :update_message_open_ve_active_time_battle :update_message_open
  1754.   def update_message_open
  1755.     close_windows
  1756.     update_message_open_ve_active_time_battle
  1757.   end
  1758.   #--------------------------------------------------------------------------
  1759.   # * Alias method: start_actor_command_selection
  1760.   #--------------------------------------------------------------------------
  1761.   alias :start_actor_command_selection_ve_active_time_battle :start_actor_command_selection
  1762.   def start_actor_command_selection
  1763.     start_actor_command_selection_ve_active_time_battle
  1764.     @close_command_window = false
  1765.   end
  1766.   #--------------------------------------------------------------------------
  1767.   # * Alias method: process_action_end
  1768.   #--------------------------------------------------------------------------
  1769.   alias :process_action_end_ve_active_time_battle :process_action_end
  1770.   def process_action_end
  1771.     return if $imported[:ve_animated_battle] && @subject.poses.active?
  1772.     BattleManager.increase_atb_turn_count(:battlers)
  1773.     BattleManager.increase_atb_turn_count(:actions)
  1774.     process_action_end_ve_active_time_battle
  1775.   end
  1776.   #--------------------------------------------------------------------------
  1777.   # * Alias method: command_fight
  1778.   #--------------------------------------------------------------------------
  1779.   alias :command_fight_end_ve_active_time_battle :command_fight
  1780.   def command_fight
  1781.     command_fight_end_ve_active_time_battle
  1782.     @party_command_window.close
  1783.     BattleManager.undo_escape
  1784.   end
  1785.   #--------------------------------------------------------------------------
  1786.   # * Alias method: command_escape
  1787.   #--------------------------------------------------------------------------
  1788.   alias :command_escape_end_ve_active_time_battle :command_escape
  1789.   def command_escape
  1790.     if VE_ATB_ESCAPE_TYPE == :command
  1791.       BattleManager.actor.atb = 0
  1792.       command_escape_end_ve_active_time_battle
  1793.       battle_start_open_window
  1794.     else
  1795.       @party_command_window.close
  1796.       BattleManager.setup_escape
  1797.     end
  1798.   end
  1799.   #--------------------------------------------------------------------------
  1800.   # * Alias method: prior_command
  1801.   #--------------------------------------------------------------------------
  1802.   alias :prior_command_ve_active_time_battle :prior_command
  1803.   def prior_command
  1804.     prior_command_ve_active_time_battle
  1805.     open_party_command_selection if !BattleManager.actor.prior_command
  1806.   end
  1807.   #--------------------------------------------------------------------------
  1808.   # * Alias method: on_enemy_ok
  1809.   #--------------------------------------------------------------------------
  1810.   alias :on_enemy_ok_ve_active_time_battle :on_enemy_ok
  1811.   def on_enemy_ok
  1812.     return if !@enemy_window.enemy
  1813.     on_enemy_ok_ve_active_time_battle
  1814.   end
  1815.   #--------------------------------------------------------------------------
  1816.   # * Alias method: refresh_status
  1817.   #--------------------------------------------------------------------------
  1818.   alias :refresh_status_ve_active_time_battle :refresh_status
  1819.   def refresh_status
  1820.     refresh_status_ve_active_time_battle
  1821.     @skill_window.refresh if @skill_window.active
  1822.     @item_window.refresh  if @item_window.active
  1823.   end
  1824.   #--------------------------------------------------------------------------
  1825.   # * New method: update_close_command_window
  1826.   #--------------------------------------------------------------------------
  1827.   def update_close_command_window
  1828.     @close_command_wait -= 1
  1829.     if @close_command_wait == 0 && @close_command_window
  1830.       @actor_command_window.close
  1831.       @close_command_window = false
  1832.     end
  1833.   end
  1834.   #--------------------------------------------------------------------------
  1835.   # * New method: update_active_windows
  1836.   #--------------------------------------------------------------------------
  1837.   def update_active_windows
  1838.     @enemy_window.hide if @enemy_window.active && @enemy_window.item_max == 0
  1839.     @actor_window.hide if @actor_window.active && @actor_window.item_max == 0
  1840.     close_command_windows
  1841.   end
  1842.   #--------------------------------------------------------------------------
  1843.   # * New method: close_command_windows
  1844.   #--------------------------------------------------------------------------
  1845.   def close_command_windows
  1846.     return if !BattleManager.actor || BattleManager.actor.inputable?
  1847.     on_enemy_cancel if @enemy_window.active
  1848.     on_actor_cancel if @actor_window.active
  1849.     on_skill_cancel if @skill_window.active
  1850.     on_item_cancel  if @item_window.active
  1851.     @actor_command_window.close.deactivate
  1852.     @skill_window.deactivate
  1853.     @item_window.deactivate
  1854.     @actor_window.deactivate
  1855.     @enemy_window.deactivate
  1856.     BattleManager.clear_actor
  1857.     next_command
  1858.   end
  1859.   #--------------------------------------------------------------------------
  1860.   # * New method: create_escape_window
  1861.   #--------------------------------------------------------------------------
  1862.   def create_escape_window
  1863.     @escape_window = Window_Help.new(1)
  1864.     @escape_window.openness = 0
  1865.   end
  1866.   #--------------------------------------------------------------------------
  1867.   # * New method: update_escape_window
  1868.   #--------------------------------------------------------------------------
  1869.   def update_escape_window
  1870.     escaping = BattleManager.escaping?
  1871.     open_escape_window   if  escaping && @escape_window.openness == 0
  1872.     @escape_window.close if !escaping && @escape_window.openness != 0
  1873.   end
  1874.   #--------------------------------------------------------------------------
  1875.   # * New method: open_escape_window
  1876.   #--------------------------------------------------------------------------
  1877.   def open_escape_window
  1878.     return if BattleManager.can_escape? && !VE_ATB_ESCAPE_TEXT
  1879.     txt = BattleManager.can_escape? ? Vocab::VE_Escaping : Vocab::VE_CantEscape
  1880.     @escape_window.set_text(txt)
  1881.     @escape_window.open
  1882.   end
  1883.   #--------------------------------------------------------------------------
  1884.   # * New method: on_turn_end
  1885.   #--------------------------------------------------------------------------
  1886.   def on_turn_end
  1887.   end
  1888.   #--------------------------------------------------------------------------
  1889.   # * New method: close_windows
  1890.   #--------------------------------------------------------------------------
  1891.   def close_windows
  1892.     if $game_message.busy? && !@status_window.close?
  1893.       command_windows.each {|window| window.hidden ||= window.open?  }
  1894.       @help_window.close
  1895.       @item_window.close
  1896.       @skill_window.close
  1897.       @actor_window.close
  1898.       @enemy_window.close
  1899.     end
  1900.   end
  1901.   #--------------------------------------------------------------------------
  1902.   # * New method: open_windows
  1903.   #--------------------------------------------------------------------------
  1904.   def open_windows
  1905.     command_windows.each do |window|
  1906.       window.open if window.hidden
  1907.       window.hidden = false
  1908.     end
  1909.   end
  1910.   #--------------------------------------------------------------------------
  1911.   # * New method: command_windows
  1912.   #--------------------------------------------------------------------------
  1913.   def command_windows
  1914.     [@party_command_window, @actor_command_window, @help_window, @skill_window,
  1915.      @item_window, @actor_window, @enemy_window, @status_window]
  1916.   end
  1917.   #--------------------------------------------------------------------------
  1918.   # * New method: battle_start_open_window
  1919.   #--------------------------------------------------------------------------
  1920.   def battle_start_open_window
  1921.     unless scene_changing?
  1922.       refresh_status
  1923.       @status_window.unselect
  1924.       @status_window.open
  1925.     end
  1926.   end
  1927.   #--------------------------------------------------------------------------
  1928.   # * New method: open_party_command_selection
  1929.   #--------------------------------------------------------------------------
  1930.   def open_party_command_selection
  1931.     return if scene_changing? || VE_ATB_ESCAPE_TYPE != :party
  1932.     BattleManager.delete_input(BattleManager.actor)
  1933.     refresh_status
  1934.     @status_window.unselect
  1935.     @status_window.open
  1936.     @actor_command_window.close.deactivate
  1937.     @party_command_window.setup
  1938.   end
  1939.   #--------------------------------------------------------------------------
  1940.   # * New method: wait_action?
  1941.   #--------------------------------------------------------------------------
  1942.   def wait_action?
  1943.     VE_ATB_WAIT_ACTION
  1944.   end
  1945.   #--------------------------------------------------------------------------
  1946.   # * New method: full_wait?
  1947.   #--------------------------------------------------------------------------
  1948.   def full_wait?
  1949.     $game_system.wait_mode == :full_wait && windows_active?(true)
  1950.   end
  1951.   #--------------------------------------------------------------------------
  1952.   # * New method: semi_wait?
  1953.   #--------------------------------------------------------------------------
  1954.   def semi_wait?
  1955.     $game_system.wait_mode == :semi_wait && windows_active?(false)
  1956.   end
  1957.   #--------------------------------------------------------------------------
  1958.   # * New method: party_window?
  1959.   #--------------------------------------------------------------------------
  1960.   def party_window?
  1961.     @party_command_window.active
  1962.   end
  1963.   #--------------------------------------------------------------------------
  1964.   # * New method: windows_active?
  1965.   #--------------------------------------------------------------------------
  1966.   def windows_active?(command = true)
  1967.     (command && @actor_command_window.active)   || @skill_window.active ||
  1968.     @item_window.active || @actor_window.active || @enemy_window.active
  1969.   end
  1970.   #--------------------------------------------------------------------------
  1971.   # * New method: turn_ending
  1972.   #--------------------------------------------------------------------------
  1973.   def turn_ending
  1974.     BattleManager.turn_end
  1975.     process_event
  1976.     BattleManager.turn_phase
  1977.   end
  1978.   #--------------------------------------------------------------------------
  1979.   # * New method: right_status_window
  1980.   #--------------------------------------------------------------------------
  1981.   def right_status_window
  1982.     256 - (Graphics.width - @status_window.width)
  1983.   end
  1984.   #--------------------------------------------------------------------------
  1985.   # * New method: center_status_window
  1986.   #--------------------------------------------------------------------------
  1987.   def center_status_window
  1988.     128 - (Graphics.width - @status_window.width) / 2
  1989.   end
  1990.   #--------------------------------------------------------------------------
  1991.   # * New method: right_info_viewport
  1992.   #--------------------------------------------------------------------------
  1993.   def right_info_viewport
  1994.     !@party_command_window.active && windows_active? && @move_info_wait < 0
  1995.   end
  1996.   #--------------------------------------------------------------------------
  1997.   # * New method: center_info_viewport
  1998.   #--------------------------------------------------------------------------
  1999.   def center_info_viewport
  2000.     !@party_command_window.active && !windows_active? && @move_info_wait < 0
  2001.   end
  2002. end


RUBY 代码复制下载
  1. #==============================================================================
  2. # ** Victor Engine - Basic Module
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2011.12.19 > First release
  8. #  v 1.01 - 2011.12.21 > Added Event Troop notes
  9. #  v 1.02 - 2011.12.22 > Added character frames value
  10. #  v 1.03 - 2011.12.30 > Added Actor and Enemy notes
  11. #  v 1.04 - 2012.01.01 > Added party average level and map actors
  12. #  v 1.05 - 2012.01.04 > Compatibility with Characters Scripts
  13. #  v 1.06 - 2012.01.07 > Compatibility with Fog and Light Effect
  14. #                      > Added new Sprite Character functions
  15. #  v 1.07 - 2012.01.11 > Compatibility with Control Text and Codes
  16. #  v 1.08 - 2012.01.13 > Compatibility with Trait Control
  17. #  v 1.09 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
  18. #  v 1.10 - 2012.01.18 > Compatibility with Automatic Battlers
  19. #  v 1.11 - 2012.01.26 > Compatibility with Followers Options
  20. #                        Compatibility with Animated Battle beta
  21. #  v 1.12 - 2012.02.08 > Compatibility with Animated Battle
  22. #  v 1.13 - 2012.02.18 > Fix for non RTP dependant encrypted projects
  23. #  v 1.14 - 2012.03.11 > Better version handling and required messages
  24. #  v 1.15 - 2012.03.11 > Added level variable for enemies (to avoid crashes)
  25. #  v 1.16 - 2012.03.21 > Compatibility with Follower Control
  26. #  v 1.17 - 2012.03.22 > Compatibility with Follower Control new method
  27. #  v 1.18 - 2012.03.22 > Added Battler Types tag support
  28. #  v 1.19 - 2012.05.20 > Compatibility with Map Turn Battle
  29. #  v 1.20 - 2012.05.21 > Fix for older RMVXa versions
  30. #  v 1.21 - 2012.05.29 > Compatibility with Pixel Movement
  31. #  v 1.22 - 2012.07.02 > Compatibility with Terrain States
  32. #  v 1.23 - 2012.07.03 > Fix for Pixel Movement
  33. #  v 1.24 - 2012.07.17 > Compatibility with Critical Hit Effects
  34. #  v 1.25 - 2012.07.24 > Compatibility with Moving Plaforms
  35. #  v 1.26 - 2012.07.30 > Compatibility with Automatic Battlers
  36. #  v 1.27 - 2012.08.01 > Compatibility with Custom Slip Effect
  37. #  v 1.28 - 2012.08.01 > Compatibility with Custom Slip Effect v 1.01
  38. #  v 1.29 - 2012.11.03 > Fixed returning value division by 0 error.
  39. #  v 1.30 - 2012.12.13 > Compatibility with State Graphics
  40. #  v 1.31 - 2012.12.16 > Compatibility with Active Time Battle
  41. #  v 1.32 - 2012.12.24 > Compatibility with Active Time Battle v 1.01
  42. #  v 1.33 - 2012.12.30 > Compatibility with Leap Attack
  43. #  v 1.34 - 2013.01.07 > Compatibility with Critical Hit Effects v 1.01
  44. #  v 1.35 - 2013.02.13 > Compatibility with Cooperation Skills
  45. #------------------------------------------------------------------------------
  46. #   This is the basic script for the system from Victory Engine and is
  47. # required to use the scripts from the engine. This script offer some new
  48. # functions to be used within many scripts of the engine.
  49. #------------------------------------------------------------------------------
  50. # Compatibility
  51. #   Required for the Victor Engine
  52. #
  53. # * Overwrite methods
  54. #   class << Cache
  55. #     def self.character(filename)
  56. #
  57. #   class Sprite_Character < Sprite_Base
  58. #     def set_character_bitmap
  59. #
  60. #   class Game_Battler < Game_BattlerBase
  61. #     def item_effect_recover_hp(user, item, effect)
  62. #     def item_effect_recover_mp(user, item, effect)
  63. #     def item_effect_gain_tp
  64. #
  65. # * Alias methods
  66. #   class Game_Interpreter
  67. #     def command_108
  68. #
  69. #   class Window_Base < Window
  70. #     def convert_escape_characters(text)
  71. #
  72. #------------------------------------------------------------------------------
  73. # Instructions:
  74. #  To instal the script, open you script editor and paste this script on
  75. #  a new section bellow the Materials section.
  76. #
  77. #------------------------------------------------------------------------------
  78. # New functions
  79. #
  80. # * Random number between two vales
  81. #   rand_between(min, max)
  82. #    min : min value
  83. #    max : max value
  84. #   Can be called from any class, this method return an random value between
  85. #   two specific numbers
  86. #
  87. # * Random array value
  88. #   <Array>.random
  89. #   <Array>.random!
  90. #   Returns a random object from the array, the method .random! is destructive,
  91. #   removing the value returned from the array.
  92. #
  93. # * Sum of the numeric values of a array
  94. #   <Array>.sum
  95. #   Returns the sum of all numeric values
  96. #
  97. # * Average of all numeric values from the array
  98. #   <Array>.average(float = false)
  99. #    float : float flag
  100. #   Returns the average of all numeric values, if floa is true, the value
  101. #   returned is a float, otherwise it's a integer.
  102. #
  103. # * Note for events
  104. #   <Event>.note
  105. #   By default, events doesn't have note boxes. This command allows to use
  106. #   comments as note boxes, following the same format as the ones on the
  107. #   database. Returns all comments on the active page of the event.
  108. #
  109. # * Comment calls
  110. #   <Event>.comment_call
  111. #   Another function for comment boxes, by default, they have absolutely no
  112. #   effect in game when called. But this method allows to make the comment
  113. #   box to behave like an script call, but with the versatility of the
  114. #   note boxes. Remember that the commands will only take effect if there
  115. #   is scripts to respond to the comment code.
  116. #
  117. #==============================================================================
  118.  
  119. #==============================================================================
  120. # ** Victor Engine
  121. #------------------------------------------------------------------------------
  122. #   Setting module for the Victor Engine
  123. #==============================================================================
  124.  
  125. module Victor_Engine
  126.   #--------------------------------------------------------------------------
  127.   # * New method: required_script
  128.   #--------------------------------------------------------------------------
  129.   def self.required_script(name, req, version, type = 0)
  130.     if type != :bellow && (!$imported[req] || $imported[req] < version)
  131.       msg = "The script '%s' requires the script\n"
  132.       case type
  133.       when :above
  134.         msg += "'%s' v%s or higher above it to work properly\n"
  135.       else
  136.         msg += "'%s' v%s or higher to work properly\n"
  137.       end
  138.       msg += "Go to [url]http://victorscripts.wordpress.com/[/url] to download this script."
  139.       self.exit_message(msg, name, req, version)
  140.     elsif type == :bellow && $imported[req]
  141.       msg =  "The script '%s' requires the script\n"
  142.       msg += "'%s' to be put bellow it\n"
  143.       msg += "move the scripts to the proper position"
  144.       self.exit_message(msg, name, req, version)
  145.     end
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # * New method: exit_message
  149.   #--------------------------------------------------------------------------
  150.   def self.exit_message(message, name, req, version)
  151.     name = self.script_name(name)
  152.     req  = self.script_name(req)
  153.     msgbox(sprintf(message, name, req, version))
  154.     exit
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # * New method: script_name
  158.   #--------------------------------------------------------------------------
  159.   def self.script_name(name, ext = "VE")
  160.     name = name.to_s.gsub("_", " ").upcase.split
  161.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  162.     name.join(" ")
  163.   end
  164. end
  165.  
  166. $imported ||= {}
  167. $imported[:ve_basic_module] = 1.35
  168.  
  169. #==============================================================================
  170. # ** Object
  171. #------------------------------------------------------------------------------
  172. #  This class is the superclass of all other classes.
  173. #==============================================================================
  174.  
  175. class Object
  176.   #--------------------------------------------------------------------------
  177.   # * Include setting module
  178.   #--------------------------------------------------------------------------
  179.   include Victor_Engine
  180.   #-------------------------------------------------------------------------
  181.   # * New method: rand_between
  182.   #-------------------------------------------------------------------------
  183.   def rand_between(min, max)
  184.     min + rand(max - min + 1)
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # * New method: numeric?
  188.   #--------------------------------------------------------------------------
  189.   def numeric?
  190.     return false
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # * New method: string?
  194.   #--------------------------------------------------------------------------
  195.   def string?
  196.     return false
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # * New method: array?
  200.   #--------------------------------------------------------------------------
  201.   def array?
  202.     return false
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # * New method: float?
  206.   #--------------------------------------------------------------------------
  207.   def float?
  208.     return false
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # * New method: symbol?
  212.   #--------------------------------------------------------------------------
  213.   def symbol?
  214.     return false
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # * New method: item?
  218.   #--------------------------------------------------------------------------
  219.   def item?
  220.     return false
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # * New method: skill?
  224.   #--------------------------------------------------------------------------
  225.   def skill?
  226.     return false
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # * New method: file_exist?
  230.   #--------------------------------------------------------------------------
  231.   def file_exist?(path, filename)
  232.     $file_list ||= {}
  233.     $file_list[path + filename] ||= file_test(path, filename)
  234.     $file_list[path + filename]
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # * New method: get_file_list
  238.   #--------------------------------------------------------------------------
  239.   def file_test(path, filename)
  240.     bitmap = Cache.load_bitmap(path, filename) rescue nil
  241.     bitmap ? true : false
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * New method: character_exist?
  245.   #--------------------------------------------------------------------------
  246.   def character_exist?(filename)
  247.     file_exist?("Graphics/Characters/", filename)
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # * New method: battler_exist?
  251.   #--------------------------------------------------------------------------
  252.   def battler_exist?(filename)
  253.     file_exist?("Graphics/Battlers/", filename)
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # * New method: face_exist?
  257.   #--------------------------------------------------------------------------
  258.   def face_exist?(filename)
  259.     file_exist?("Graphics/Faces/", filename)
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # * New method: get_filename
  263.   #--------------------------------------------------------------------------
  264.   def get_filename
  265.     "[\"'“‘]([^\"'”‘”’]+)[\"'”’]"
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # * New method: get_all_values
  269.   #--------------------------------------------------------------------------
  270.   def get_all_values(value1, value2 = nil)
  271.     value2 = value1 unless value2
  272.     /<#{value1}>((?:[^<]|<[^\/])*)<\/#{value2}>/im
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # * New method: make_symbol
  276.   #--------------------------------------------------------------------------
  277.   def make_symbol(string)
  278.     string.downcase.gsub(" ", "_").to_sym
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # * New method: make_string
  282.   #--------------------------------------------------------------------------
  283.   def make_string(symbol)
  284.     symbol.to_s.gsub("_", " ").upcase
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # * New method: returning_value
  288.   #--------------------------------------------------------------------------
  289.   def returning_value(i, x)
  290.     y = [x * 2, 1].max
  291.     i % y  >= x ? (x * 2) - i % y : i % y
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # New method: in_rect?
  295.   #--------------------------------------------------------------------------
  296.   def in_rect?(w, h, x1, y1, x2, y2, fx = 0)
  297.     aw, ah, ax, ay, bx, by = setup_area(w, h, x1, y1, x2, y2, fx)
  298.     bx > ax - aw && bx < ax + aw && by > ay - ah && by < ay + ah
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # New method: in_radius?
  302.   #--------------------------------------------------------------------------
  303.   def in_radius?(w, h, x1, y1, x2, y2, fx = 0)
  304.     aw, ah, ax, ay, bx, by = setup_area(w, h, x1, y1, x2, y2, fx)
  305.     ((bx - ax) ** 2 / aw ** 2) + ((by - ay) ** 2 / ah ** 2) <= 1
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # New method: setup_area
  309.   #--------------------------------------------------------------------------
  310.   def setup_area(w, h, x1, y1, x2, y2, fx)
  311.     aw = w
  312.     ah = h * aw
  313.     ax = x1
  314.     ay = y1
  315.     bx = x2
  316.     by = y2
  317.     bx += fx / 4 if ax > bx
  318.     bx -= fx / 4 if ax < bx
  319.     [aw, ah, ax, ay, bx, by]
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # * New method: get_param_id
  323.   #--------------------------------------------------------------------------
  324.   def get_param_id(text)
  325.     case text.upcase
  326.     when "MAXHP", "HP" then 0
  327.     when "MAXMP", "MP" then 1
  328.     when "ATK" then 2
  329.     when "DEF" then 3
  330.     when "MAT" then 4
  331.     when "MDF" then 5
  332.     when "AGI" then 6
  333.     when "LUK" then 7
  334.     end
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # * New method: get_param_text
  338.   #--------------------------------------------------------------------------
  339.   def get_param_text(id)
  340.     case id
  341.     when 0 then "HP"
  342.     when 1 then "MP"
  343.     when 2 then "ATK"
  344.     when 3 then "DEF"
  345.     when 4 then "MAT"
  346.     when 5 then "MDF"
  347.     when 6 then "AGI"
  348.     when 7 then "LUK"
  349.     end
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # * New method: get_xparam_id
  353.   #--------------------------------------------------------------------------
  354.   def get_xparam_id(text)
  355.     case text.upcase
  356.     when "HIT" then 0
  357.     when "EVA" then 1
  358.     when "CRI" then 2
  359.     when "CEV" then 3
  360.     when "MEV" then 4
  361.     when "MRF" then 5
  362.     when "CNT" then 6
  363.     when "HRG" then 7
  364.     when "MRG" then 8
  365.     when "TRG" then 9
  366.     end
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # * New method: get_xparam_text
  370.   #--------------------------------------------------------------------------
  371.   def get_xparam_text(id)
  372.     case id
  373.     when 0 then "HIT"
  374.     when 1 then "EVA"
  375.     when 2 then "CRI"
  376.     when 3 then "CEV"
  377.     when 4 then "MEV"
  378.     when 5 then "MRF"
  379.     when 6 then "CNT"
  380.     when 7 then "HRG"
  381.     when 8 then "MRG"
  382.     when 9 then "TRG"
  383.     end
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # * New method: get_sparam_id
  387.   #--------------------------------------------------------------------------
  388.   def get_sparam_id(text)
  389.     case text.upcase
  390.     when "TGR" then 0
  391.     when "GRD" then 1
  392.     when "REC" then 2
  393.     when "PHA" then 3
  394.     when "MCR" then 4
  395.     when "TCR" then 5
  396.     when "PDR" then 6
  397.     when "MDR" then 7
  398.     when "FDR" then 8
  399.     when "EXR" then 9
  400.     end
  401.   end
  402.   #--------------------------------------------------------------------------
  403.   # * New method: get_sparam_text
  404.   #--------------------------------------------------------------------------
  405.   def get_sparam_text(id)
  406.     case id
  407.     when 0 then "TGR"
  408.     when 1 then "GRD"
  409.     when 2 then "REC"
  410.     when 3 then "PHA"
  411.     when 4 then "MCR"
  412.     when 5 then "TCR"
  413.     when 6 then "PDR"
  414.     when 7 then "MDR"
  415.     when 8 then "FDR"
  416.     when 9 then "EXR"
  417.     end
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # * New method: get_cond
  421.   #--------------------------------------------------------------------------
  422.   def get_cond(text)
  423.     case text.upcase
  424.     when "HIGHER"    then ">"
  425.     when "LOWER"     then "<"
  426.     when "EQUAL"     then "=="
  427.     when "DIFFERENT" then "!="
  428.     else "!="
  429.     end
  430.   end
  431. end
  432.  
  433. #==============================================================================
  434. # ** String
  435. #------------------------------------------------------------------------------
  436. #  The string class. Can handle character sequences of arbitrary lengths.
  437. #==============================================================================
  438.  
  439. class String
  440.   #--------------------------------------------------------------------------
  441.   # * New method: string?
  442.   #--------------------------------------------------------------------------
  443.   def string?
  444.     return true
  445.   end
  446. end
  447.  
  448. #==============================================================================
  449. # ** String
  450. #------------------------------------------------------------------------------
  451. #  The class that represents symbols.
  452. #==============================================================================
  453.  
  454. class Symbol
  455.   #--------------------------------------------------------------------------
  456.   # * New method: symbol?
  457.   #--------------------------------------------------------------------------
  458.   def symbol?
  459.     return true
  460.   end
  461. end
  462.  
  463. #==============================================================================
  464. # ** Numeric
  465. #------------------------------------------------------------------------------
  466. #  This is the abstract class for numbers.
  467. #==============================================================================
  468.  
  469. class Numeric
  470.   #--------------------------------------------------------------------------
  471.   # * New method: numeric?
  472.   #--------------------------------------------------------------------------
  473.   def numeric?
  474.     return true
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # * New method: ceil?
  478.   #--------------------------------------------------------------------------
  479.   def ceil?
  480.     return false
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # * New method: to_ceil
  484.   #--------------------------------------------------------------------------
  485.   def to_ceil
  486.     self > 0 ? self.abs.ceil : -self.abs.ceil
  487.   end
  488. end
  489.  
  490. #==============================================================================
  491. # ** Float
  492. #------------------------------------------------------------------------------
  493. #  This is the abstract class for the floating point values.
  494. #==============================================================================
  495.  
  496. class Float
  497.   #--------------------------------------------------------------------------
  498.   # * New method: float?
  499.   #--------------------------------------------------------------------------
  500.   def float?
  501.     return true
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # * New method: ceil?
  505.   #--------------------------------------------------------------------------
  506.   def ceil?
  507.     self != self.ceil
  508.   end
  509. end
  510.  
  511. #==============================================================================
  512. # ** Array     
  513. #------------------------------------------------------------------------------
  514. #  This class store arbitrary Ruby objects.
  515. #==============================================================================
  516.  
  517. class Array
  518.   #--------------------------------------------------------------------------
  519.   # * New method: array?
  520.   #--------------------------------------------------------------------------
  521.   def array?
  522.     return true
  523.   end
  524.   #-------------------------------------------------------------------------
  525.   # * New method: random
  526.   #-------------------------------------------------------------------------
  527.   def random
  528.     self[rand(size)]
  529.   end
  530.   #-------------------------------------------------------------------------
  531.   # * New method: random!
  532.   #-------------------------------------------------------------------------
  533.   def random!
  534.     self.delete_at(rand(size))
  535.   end
  536.   #---------------------------------------------------------------------------
  537.   # * New method: sum
  538.   #---------------------------------------------------------------------------
  539.   def sum
  540.     self.inject(0) {|r, n| r += (n.numeric? ? n : 0)}
  541.   end
  542.   #---------------------------------------------------------------------------
  543.   # * New method: average
  544.   #---------------------------------------------------------------------------
  545.   def average(float = false)
  546.     self.sum / [(float ? size.to_f : size.to_i), 1].max
  547.   end
  548.   #---------------------------------------------------------------------------
  549.   # * New method: next_item
  550.   #---------------------------------------------------------------------------
  551.   def next_item
  552.     item = self.shift
  553.     self.push(item)
  554.     item
  555.   end
  556.   #---------------------------------------------------------------------------
  557.   # * New method: previous_item
  558.   #---------------------------------------------------------------------------
  559.   def previous_item
  560.     item = self.pop
  561.     self.unshift(item)
  562.     item
  563.   end
  564. end
  565.  
  566. #==============================================================================
  567. # ** RPG::Troop::Page
  568. #------------------------------------------------------------------------------
  569. #  This is the data class for battle events (pages).
  570. #==============================================================================
  571.  
  572. class RPG::Troop::Page
  573.   #--------------------------------------------------------------------------
  574.   # * New method: note
  575.   #--------------------------------------------------------------------------
  576.   def note
  577.     return "" if !@list || @list.size <= 0
  578.     comment_list = []
  579.     @list.each do |item|
  580.       next unless item && (item.code == 108 || item.code == 408)
  581.       comment_list.push(item.parameters[0])
  582.     end
  583.     comment_list.join("\r\n")
  584.   end
  585. end
  586.  
  587. #==============================================================================
  588. # ** RPG::UsableItem
  589. #------------------------------------------------------------------------------
  590. #  This is the superclass for skills and items.
  591. #==============================================================================
  592.  
  593. class RPG::UsableItem < RPG::BaseItem
  594.   #--------------------------------------------------------------------------
  595.   # * New method: for_all_targets?
  596.   #--------------------------------------------------------------------------
  597.   def for_all_targets?
  598.     return false
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # * New method: element_set
  602.   #--------------------------------------------------------------------------
  603.   def element_set
  604.     [damage.element_id]
  605.   end
  606. end
  607.  
  608. #==============================================================================
  609. # ** RPG::Skill
  610. #------------------------------------------------------------------------------
  611. #  This is the data class for skills.
  612. #==============================================================================
  613.  
  614. class RPG::Skill < RPG::UsableItem
  615.   #--------------------------------------------------------------------------
  616.   # * New method: item?
  617.   #--------------------------------------------------------------------------
  618.   def item?
  619.     return false
  620.   end
  621.   #--------------------------------------------------------------------------
  622.   # * New method: skill?
  623.   #--------------------------------------------------------------------------
  624.   def skill?
  625.     return true
  626.   end
  627.   #--------------------------------------------------------------------------
  628.   # * New method: type_set
  629.   #--------------------------------------------------------------------------
  630.   def type_set
  631.     [stype_id]
  632.   end  
  633. end
  634.  
  635. #==============================================================================
  636. # ** RPG::Item
  637. #------------------------------------------------------------------------------
  638. #  This is the data class for items.
  639. #==============================================================================
  640.  
  641. class RPG::Item < RPG::UsableItem
  642.   #--------------------------------------------------------------------------
  643.   # * New method: item?
  644.   #--------------------------------------------------------------------------
  645.   def item?
  646.     return true
  647.   end
  648.   #--------------------------------------------------------------------------
  649.   # * New method: skill?
  650.   #--------------------------------------------------------------------------
  651.   def skill?
  652.     return false
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # * New method: type_set
  656.   #--------------------------------------------------------------------------
  657.   def type_set
  658.     [itype_id]
  659.   end
  660. end
  661.  
  662. #==============================================================================
  663. # ** Cache
  664. #------------------------------------------------------------------------------
  665. #  This module loads each of graphics, creates a Bitmap object, and retains it.
  666. # To speed up load times and conserve memory, this module holds the created
  667. # Bitmap object in the internal hash, allowing the program to return
  668. # preexisting objects when the same bitmap is requested again.
  669. #==============================================================================
  670.  
  671. class << Cache
  672.   #--------------------------------------------------------------------------
  673.   # * Overwrite method: character
  674.   #--------------------------------------------------------------------------
  675.   def character(filename, hue = 0)
  676.     load_bitmap("Graphics/Characters/", filename, hue)
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # * New method: cache
  680.   #--------------------------------------------------------------------------
  681.   def cache
  682.     @cache
  683.   end
  684. end
  685.  
  686. #==============================================================================
  687. # ** BattleManager
  688. #------------------------------------------------------------------------------
  689. #  This module handles the battle processing
  690. #==============================================================================
  691.  
  692. class << BattleManager
  693.   #--------------------------------------------------------------------------
  694.   # * New method: all_battle_members
  695.   #--------------------------------------------------------------------------
  696.   def all_battle_members
  697.     $game_party.members + $game_troop.members
  698.   end
  699.   #--------------------------------------------------------------------------
  700.   # * New method: all_dead_members
  701.   #--------------------------------------------------------------------------
  702.   def all_dead_members
  703.     $game_party.dead_members + $game_troop.dead_members
  704.   end
  705.   #--------------------------------------------------------------------------
  706.   # * New method: all_movable_members
  707.   #--------------------------------------------------------------------------
  708.   def all_movable_members
  709.     $game_party.movable_members + $game_troop.movable_members
  710.   end
  711. end
  712.  
  713. #==============================================================================
  714. # ** Game_BattlerBase
  715. #------------------------------------------------------------------------------
  716. #  This class handles battlers. It's used as a superclass of the Game_Battler
  717. # classes.
  718. #==============================================================================
  719.  
  720. class Game_BattlerBase
  721.   #--------------------------------------------------------------------------
  722.   # * Public Instance Variables
  723.   #--------------------------------------------------------------------------
  724.   attr_reader   :buffs
  725.   #--------------------------------------------------------------------------
  726.   # * New method: get_param
  727.   #--------------------------------------------------------------------------
  728.   def get_param(text)
  729.     case text.upcase
  730.     when "MAXHP" then self.mhp
  731.     when "MAXMP" then self.mmp
  732.     when "MAXTP" then self.max_tp
  733.     else eval("self.#{text.downcase}")
  734.     end
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # * New method: type
  738.   #--------------------------------------------------------------------------
  739.   def type
  740.     list = []
  741.     get_all_notes.scan(/<BATTLER TYPE: ((?:\w+ *,? *)+)>/i) do
  742.       $1.scan(/(\d+)/i) { list.push(make_symbol($1)) }
  743.     end
  744.     list.uniq
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # * New method: danger?
  748.   #--------------------------------------------------------------------------
  749.   def danger?
  750.     hp < mhp * 25 / 100
  751.   end
  752.   #--------------------------------------------------------------------------
  753.   # * New method: sprite
  754.   #--------------------------------------------------------------------------
  755.   def sprite
  756.     valid = SceneManager.scene_is?(Scene_Battle) && SceneManager.scene.spriteset
  757.     valid ? SceneManager.scene.spriteset.sprite(self) : nil
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # * New method: element_set
  761.   #--------------------------------------------------------------------------
  762.   def element_set(item)
  763.     element_set  = item.element_set
  764.     element_set += atk_elements if item.damage.element_id < 0
  765.     element_set.delete(0)
  766.     element_set.compact
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # * New method: add_state_normal
  770.   #--------------------------------------------------------------------------
  771.   def add_state_normal(state_id, rate = 1, user = self)
  772.     chance  = rate
  773.     chance *= state_rate(state_id)
  774.     chance *= luk_effect_rate(user)
  775.     add_state(state_id) if rand < chance
  776.   end
  777.   #--------------------------------------------------------------------------
  778.   # * New method: damaged?
  779.   #--------------------------------------------------------------------------
  780.   def damaged?
  781.     @result.hp_damage != 0 || @result.mp_damage != 0 || @result.tp_damage != 0
  782.   end
  783.   #--------------------------------------------------------------------------
  784.   # * New method: mtp
  785.   #--------------------------------------------------------------------------
  786.   def mtp
  787.     return 100
  788.   end
  789. end
  790.  
  791. #==============================================================================
  792. # ** Game_Battler
  793. #------------------------------------------------------------------------------
  794. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  795. # and Game_Enemy classes.
  796. #==============================================================================
  797.  
  798. class Game_Battler < Game_BattlerBase
  799.   #--------------------------------------------------------------------------
  800.   # * Overwrite method: item_effect_recover_hp
  801.   #--------------------------------------------------------------------------
  802.   def item_effect_recover_hp(user, item, effect)
  803.     value = item_value_recover_hp(user, item, effect).to_i
  804.     @result.hp_damage -= value
  805.     @result.success    = true
  806.     self.hp += value
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # * Overwrite method: item_effect_recover_mp
  810.   #--------------------------------------------------------------------------
  811.   def item_effect_recover_mp(user, item, effect)
  812.     value = item_value_recover_mp(user, item, effect).to_i
  813.     @result.mp_damage -= value
  814.     @result.success    = true if value != 0
  815.     self.mp += value
  816.   end
  817.   #--------------------------------------------------------------------------
  818.   # * Overwrite method: item_effect_gain_tp
  819.   #--------------------------------------------------------------------------
  820.   def item_effect_gain_tp(user, item, effect)
  821.     value    = item_value_recover_tp(user, item, effect)
  822.     self.tp += value
  823.   end
  824.   #--------------------------------------------------------------------------
  825.   # * New method: item_value_recover_hp
  826.   #--------------------------------------------------------------------------
  827.   def item_value_recover_hp(user, item, effect)
  828.     value  = (mhp * effect.value1 + effect.value2) * rec
  829.     value *= user.pha if item.is_a?(RPG::Item)
  830.     value
  831.   end
  832.   #--------------------------------------------------------------------------
  833.   # * New method: item_value_recover_mp
  834.   #--------------------------------------------------------------------------
  835.   def item_value_recover_mp(user, item, effect)
  836.     value  = (mmp * effect.value1 + effect.value2) * rec
  837.     value *= user.pha if item.is_a?(RPG::Item)
  838.     value
  839.   end
  840.   #--------------------------------------------------------------------------
  841.   # * New method: item_value_recover_tp
  842.   #--------------------------------------------------------------------------
  843.   def item_value_recover_tp(user, item, effect)
  844.     effect.value1.to_i
  845.   end
  846.   #--------------------------------------------------------------------------
  847.   # * New method: cri_rate
  848.   #--------------------------------------------------------------------------
  849.   def cri_rate(user, item)
  850.     user.cri
  851.   end
  852.   #--------------------------------------------------------------------------
  853.   # * New method: cri_eva
  854.   #--------------------------------------------------------------------------
  855.   def cri_eva(user, item)
  856.     cev
  857.   end
  858.   #--------------------------------------------------------------------------
  859.   # * New method: setup_critical
  860.   #--------------------------------------------------------------------------
  861.   def setup_critical(user, item)
  862.     cri_rate(user, item) * (1 - cri_eva(user, item))
  863.   end
  864. end
  865.  
  866. #==============================================================================
  867. # ** Game_Enemy
  868. #------------------------------------------------------------------------------
  869. #  This class handles enemy characters. It's used within the Game_Troop class
  870. # ($game_troop).
  871. #==============================================================================
  872.  
  873. class Game_Enemy < Game_Battler
  874.   #--------------------------------------------------------------------------
  875.   # * New method: id
  876.   #--------------------------------------------------------------------------
  877.   def id
  878.     @enemy_id
  879.   end
  880.   #--------------------------------------------------------------------------
  881.   # * New method: note
  882.   #--------------------------------------------------------------------------
  883.   def note
  884.     enemy ? enemy.note : ""
  885.   end
  886.   #--------------------------------------------------------------------------
  887.   # * New method: get_all_notes
  888.   #--------------------------------------------------------------------------
  889.   def get_all_notes(*args)
  890.     notes  = ""
  891.     notes += note if !args.include?(:self)
  892.     states.compact.each {|state| notes += state.note } if !args.include?(:state)
  893.     notes
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # * New method: get_all_objects
  897.   #--------------------------------------------------------------------------
  898.   def get_all_objects(*args)
  899.     result = []
  900.     result += [self] if !args.include?(:self)
  901.     result += states.compact if !args.include?(:state)
  902.     result
  903.   end
  904.   #--------------------------------------------------------------------------
  905.   # * New method: level
  906.   #--------------------------------------------------------------------------
  907.   def level
  908.     return 1
  909.   end
  910.   #--------------------------------------------------------------------------
  911.   # * New method: skill_learn?
  912.   #--------------------------------------------------------------------------
  913.   def skill_learn?(skill)
  914.     skill.skill? && skills.include?(skill)
  915.   end
  916.   #--------------------------------------------------------------------------
  917.   # * New method: skills
  918.   #--------------------------------------------------------------------------
  919.   def skills
  920.     (enemy_actions | added_skills).sort.collect {|id| $data_skills[id] }
  921.   end
  922.   #--------------------------------------------------------------------------
  923.   # * New method: enemy_actions
  924.   #--------------------------------------------------------------------------
  925.   def enemy_actions
  926.     enemy.actions.collect {|action| action.skill_id }
  927.   end
  928. end
  929.  
  930. #==============================================================================
  931. # ** Game_Actor
  932. #------------------------------------------------------------------------------
  933. #  This class handles actors. It's used within the Game_Actors class
  934. # ($game_actors) and referenced by the Game_Party class ($game_party).
  935. #==============================================================================
  936.  
  937. class Game_Actor < Game_Battler
  938.   #--------------------------------------------------------------------------
  939.   # * New method: note
  940.   #--------------------------------------------------------------------------
  941.   def note
  942.     actor ? actor.note : ""
  943.   end
  944.   #--------------------------------------------------------------------------
  945.   # * New method: hue
  946.   #--------------------------------------------------------------------------
  947.   def hue
  948.     @hue ? @hue : 0
  949.   end
  950.   #--------------------------------------------------------------------------
  951.   # * New method: get_all_notes
  952.   #--------------------------------------------------------------------------
  953.   def get_all_notes(*args)
  954.     notes = ""
  955.     notes += note if !args.include?(:self)
  956.     notes += self.class.note if !args.include?(:class)
  957.     equips.compact.each {|equip| notes += equip.note } if !args.include?(:equip)
  958.     states.compact.each {|state| notes += state.note } if !args.include?(:state)
  959.     notes
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # * New method: get_all_objects
  963.   #--------------------------------------------------------------------------
  964.   def get_all_objects(*args)
  965.     result = []
  966.     result += [self] if !args.include?(:self)
  967.     result += [self.class]   if !args.include?(:class)
  968.     result += equips.compact if !args.include?(:equip)
  969.     result += states.compact if !args.include?(:state)
  970.     result
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # * New method: in_active_party?
  974.   #--------------------------------------------------------------------------
  975.   def in_active_party?
  976.     $game_party.battle_members.include?(self)
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # * New method: in_reserve_party?
  980.   #--------------------------------------------------------------------------
  981.   def in_reserve_party?
  982.     $game_party.reserve_members.include?(self)
  983.   end
  984.   #--------------------------------------------------------------------------
  985.   # * New method: in_party?
  986.   #--------------------------------------------------------------------------
  987.   def in_party?
  988.     $game_party.all_members.include?(self)
  989.   end
  990.   #--------------------------------------------------------------------------
  991.   # * New method: map_animation
  992.   #--------------------------------------------------------------------------
  993.   def map_animation(id)
  994.     $game_map.actors.each do |member|
  995.       member.animation_id = id if member.actor == self
  996.     end
  997.   end
  998.   #--------------------------------------------------------------------------
  999.   # * New method: on_damage_floor
  1000.   #--------------------------------------------------------------------------
  1001.   def on_damage_floor?
  1002.     $game_player.on_damage_floor?
  1003.   end
  1004. end
  1005.  
  1006. #==============================================================================
  1007. # ** Game_Unit
  1008. #------------------------------------------------------------------------------
  1009. #  This class handles units. It's used as a superclass of the Game_Party and
  1010. # Game_Troop classes.
  1011. #==============================================================================
  1012.  
  1013. class Game_Unit
  1014.   #--------------------------------------------------------------------------
  1015.   # * New method: refresh
  1016.   #--------------------------------------------------------------------------
  1017.   def refresh
  1018.     members.each {|member| member.refresh }
  1019.   end
  1020. end
  1021.  
  1022. #==============================================================================
  1023. # ** Game_Party
  1024. #------------------------------------------------------------------------------
  1025. #  This class handles the party. It includes information on amount of gold
  1026. # and items. The instance of this class is referenced by $game_party.
  1027. #==============================================================================
  1028.  
  1029. class Game_Party < Game_Unit
  1030.   #--------------------------------------------------------------------------
  1031.   # * New method: average_level
  1032.   #--------------------------------------------------------------------------
  1033.   def average_level
  1034.     battle_members.collect {|actor| actor.level }.average
  1035.   end
  1036.   #--------------------------------------------------------------------------
  1037.   # * New method: reserve_members
  1038.   #--------------------------------------------------------------------------
  1039.   def reserve_members
  1040.     all_members - battle_members
  1041.   end
  1042. end
  1043.  
  1044. #==============================================================================
  1045. # ** Game_Map
  1046. #------------------------------------------------------------------------------
  1047. #  This class handles maps. It includes scrolling and passage determination
  1048. # functions. The instance of this class is referenced by $game_map.
  1049. #==============================================================================
  1050.  
  1051. class Game_Map
  1052.   #--------------------------------------------------------------------------
  1053.   # * New method: event_list
  1054.   #--------------------------------------------------------------------------
  1055.   def event_list
  1056.     events.values
  1057.   end
  1058.   #--------------------------------------------------------------------------
  1059.   # * New method: note
  1060.   #--------------------------------------------------------------------------
  1061.   def note
  1062.     @map ? @map.note : ""
  1063.   end
  1064.   #--------------------------------------------------------------------------
  1065.   # * New method: vehicles
  1066.   #--------------------------------------------------------------------------
  1067.   def vehicles
  1068.     @vehicles
  1069.   end
  1070.   #--------------------------------------------------------------------------
  1071.   # * New method: map_events
  1072.   #--------------------------------------------------------------------------
  1073.   def map_events
  1074.     @map.events
  1075.   end
  1076.   #--------------------------------------------------------------------------
  1077.   # * New method: actors
  1078.   #--------------------------------------------------------------------------
  1079.   def actors
  1080.     [$game_player] + $game_player.followers.visible_followers
  1081.   end
  1082. end
  1083.  
  1084. #==============================================================================
  1085. # ** Game_CharacterBase
  1086. #------------------------------------------------------------------------------
  1087. #  This class deals with characters. Common to all characters, stores basic
  1088. # data, such as coordinates and graphics. It's used as a superclass of the
  1089. # Game_Character class.
  1090. #==============================================================================
  1091.  
  1092. class Game_CharacterBase
  1093.   #--------------------------------------------------------------------------
  1094.   # * Public Instance Variables
  1095.   #--------------------------------------------------------------------------
  1096.   attr_accessor :move_speed
  1097.   attr_accessor :move_frequency
  1098.   #--------------------------------------------------------------------------
  1099.   # * New method: player?
  1100.   #--------------------------------------------------------------------------
  1101.   def player?
  1102.     return false
  1103.   end
  1104.   #--------------------------------------------------------------------------
  1105.   # * New method: event?
  1106.   #--------------------------------------------------------------------------
  1107.   def event?
  1108.     return false
  1109.   end
  1110.   #--------------------------------------------------------------------------
  1111.   # * New method: follower?
  1112.   #--------------------------------------------------------------------------
  1113.   def follower?
  1114.     return false
  1115.   end
  1116.   #--------------------------------------------------------------------------
  1117.   # * New method: vehicle?
  1118.   #--------------------------------------------------------------------------
  1119.   def vehicle?
  1120.     return false
  1121.   end
  1122.   #--------------------------------------------------------------------------
  1123.   # * New method: frames
  1124.   #--------------------------------------------------------------------------
  1125.   def frames
  1126.     return 3
  1127.   end
  1128.   #--------------------------------------------------------------------------
  1129.   # * New method: hue
  1130.   #--------------------------------------------------------------------------
  1131.   def hue
  1132.     @hue ? @hue : 0
  1133.   end
  1134. end
  1135.  
  1136. #==============================================================================
  1137. # ** Game_Character
  1138. #------------------------------------------------------------------------------
  1139. #  This class deals with characters. It's used as a superclass of the
  1140. # Game_Player and Game_Event classes.
  1141. #==============================================================================
  1142.  
  1143. class Game_Character < Game_CharacterBase
  1144.   #--------------------------------------------------------------------------
  1145.   # * New method: move_toward_position
  1146.   #--------------------------------------------------------------------------
  1147.   def move_toward_position(x, y)
  1148.     sx = distance_x_from(x)
  1149.     sy = distance_y_from(y)
  1150.     if sx.abs > sy.abs
  1151.       move_straight(sx > 0 ? 4 : 6)
  1152.       move_straight(sy > 0 ? 8 : 2) if !@move_succeed && sy != 0
  1153.     elsif sy != 0
  1154.       move_straight(sy > 0 ? 8 : 2)
  1155.       move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx != 0
  1156.     end
  1157.   end
  1158.   #--------------------------------------------------------------------------
  1159.   # * New method: move_toward_position
  1160.   #--------------------------------------------------------------------------
  1161.   def turn_toward_position(x, y)
  1162.     sx = distance_x_from(x)
  1163.     sy = distance_y_from(y)
  1164.     if sx.abs > sy.abs
  1165.       set_direction(sx > 0 ? 4 : 6)
  1166.     elsif sy != 0
  1167.       set_direction(sy > 0 ? 8 : 2)
  1168.     end
  1169.   end
  1170. end
  1171.  
  1172. #==============================================================================
  1173. # ** Game_Player
  1174. #------------------------------------------------------------------------------
  1175. #  This class handles the player.
  1176. # The instance of this class is referenced by $game_map.
  1177. #==============================================================================
  1178.  
  1179. class Game_Player < Game_Character
  1180.   #--------------------------------------------------------------------------
  1181.   # * New method: player?
  1182.   #--------------------------------------------------------------------------
  1183.   def player?
  1184.     return true
  1185.   end
  1186.   #--------------------------------------------------------------------------
  1187.   # * New method: perform_transfer
  1188.   #--------------------------------------------------------------------------
  1189.   def new_map_id
  1190.     @new_map_id
  1191.   end
  1192.   #--------------------------------------------------------------------------
  1193.   # * New method: hue
  1194.   #--------------------------------------------------------------------------
  1195.   def hue
  1196.     actor ? actor.hue : 0
  1197.   end
  1198. end
  1199.  
  1200. #==============================================================================
  1201. # ** Game_Follower
  1202. #------------------------------------------------------------------------------
  1203. #  This class handles the followers. Followers are the actors of the party
  1204. # that follows the leader in a line. It's used within the Game_Followers class.
  1205. #==============================================================================
  1206.  
  1207. class Game_Follower < Game_Character
  1208.   #--------------------------------------------------------------------------
  1209.   # * New method: follower?
  1210.   #--------------------------------------------------------------------------
  1211.   def follower?
  1212.     return true
  1213.   end
  1214.   #--------------------------------------------------------------------------
  1215.   # * New method: index
  1216.   #--------------------------------------------------------------------------
  1217.   def index
  1218.     @member_index
  1219.   end
  1220.   #--------------------------------------------------------------------------
  1221.   # * New method: gathering?
  1222.   #--------------------------------------------------------------------------
  1223.   def gathering?
  1224.     $game_player.followers.gathering? && !gather?
  1225.   end
  1226. end
  1227.  
  1228. #==============================================================================
  1229. # ** Game_Followers
  1230. #------------------------------------------------------------------------------
  1231. #  This class handles the followers. It's a wrapper for the built-in class
  1232. # "Array." It's used within the Game_Player class.
  1233. #==============================================================================
  1234.  
  1235. class Game_Followers
  1236.   #--------------------------------------------------------------------------
  1237.   # * New method: get_actor
  1238.   #--------------------------------------------------------------------------
  1239.   def get_actor(id)
  1240.     list = [$game_player] + visible_followers
  1241.     list.select {|follower| follower.actor && follower.actor.id == id }.first
  1242.   end
  1243.   #--------------------------------------------------------------------------
  1244.   # * Method fix: visble_folloers
  1245.   #--------------------------------------------------------------------------
  1246.   unless method_defined?(:visible_followers)
  1247.     def visible_followers; visible_folloers; end
  1248.   end
  1249. end
  1250.  
  1251. #==============================================================================
  1252. # ** Game_Vehicle
  1253. #------------------------------------------------------------------------------
  1254. #  This class handles vehicles. It's used within the Game_Map class. If there
  1255. # are no vehicles on the current map, the coordinates is set to (-1,-1).
  1256. #==============================================================================
  1257.  
  1258. class Game_Vehicle < Game_Character
  1259.   #--------------------------------------------------------------------------
  1260.   # * New method: vehicle?
  1261.   #--------------------------------------------------------------------------
  1262.   def vehicle?
  1263.     return true
  1264.   end
  1265.   #--------------------------------------------------------------------------
  1266.   # * New method: map_id
  1267.   #--------------------------------------------------------------------------
  1268.   def map_id
  1269.     @map_id
  1270.   end
  1271.   #--------------------------------------------------------------------------
  1272.   # * New method: type
  1273.   #--------------------------------------------------------------------------
  1274.   def type
  1275.     @type
  1276.   end
  1277.   #--------------------------------------------------------------------------
  1278.   # * New method: aerial?
  1279.   #--------------------------------------------------------------------------
  1280.   def aerial?
  1281.     type == :airship
  1282.   end
  1283.   #--------------------------------------------------------------------------
  1284.   # * New method: above?
  1285.   #--------------------------------------------------------------------------
  1286.   def above?
  1287.     aerial?
  1288.   end
  1289. end
  1290.  
  1291. #==============================================================================
  1292. # ** Game_Event
  1293. #------------------------------------------------------------------------------
  1294. #  This class deals with events. It handles functions including event page
  1295. # switching via condition determinants, and running parallel process events.
  1296. # It's used within the Game_Map class.
  1297. #==============================================================================
  1298.  
  1299. class Game_Event < Game_Character
  1300.   #--------------------------------------------------------------------------
  1301.   # * New method: name
  1302.   #--------------------------------------------------------------------------
  1303.   def name
  1304.     @event.name
  1305.   end
  1306.   #--------------------------------------------------------------------------
  1307.   # * New method: event?
  1308.   #--------------------------------------------------------------------------
  1309.   def event?
  1310.     return true
  1311.   end
  1312.   #--------------------------------------------------------------------------
  1313.   # * New method: erased?
  1314.   #--------------------------------------------------------------------------
  1315.   def erased?
  1316.     @erased
  1317.   end
  1318.   #--------------------------------------------------------------------------
  1319.   # * New method: note
  1320.   #--------------------------------------------------------------------------
  1321.   def note
  1322.     return ""     if !@page || !@page.list || @page.list.size <= 0
  1323.     return @notes if @notes && @page.list == @note_page
  1324.     @note_page = @page.list.dup
  1325.     comment_list = []
  1326.     @page.list.each do |item|
  1327.       next unless item && (item.code == 108 || item.code == 408)
  1328.       comment_list.push(item.parameters[0])
  1329.     end
  1330.     @notes = comment_list.join("\r\n")
  1331.     @notes
  1332.   end  
  1333. end
  1334.  
  1335. #==============================================================================
  1336. # ** Game_Interpreter
  1337. #------------------------------------------------------------------------------
  1338. #  An interpreter for executing event commands. This class is used within the
  1339. # Game_Map, Game_Troop, and Game_Event classes.
  1340. #==============================================================================
  1341.  
  1342. class Game_Interpreter
  1343.   #--------------------------------------------------------------------------
  1344.   # * Alias method: command_108
  1345.   #--------------------------------------------------------------------------
  1346.   alias :command_108_ve_basic_module :command_108
  1347.   def command_108
  1348.     command_108_ve_basic_module
  1349.     comment_call
  1350.   end
  1351.   #--------------------------------------------------------------------------
  1352.   # * New method: comment_call
  1353.   #--------------------------------------------------------------------------
  1354.   def comment_call
  1355.   end
  1356.   #--------------------------------------------------------------------------
  1357.   # * New method: note
  1358.   #--------------------------------------------------------------------------
  1359.   def note
  1360.     @comments ? @comments.join("\r\n") : ""
  1361.   end
  1362. end
  1363.  
  1364. #==============================================================================
  1365. # ** Game_Animation
  1366. #------------------------------------------------------------------------------
  1367. #  Classe that handles Animation data
  1368. #==============================================================================
  1369.  
  1370. class Game_Animation
  1371.   #--------------------------------------------------------------------------
  1372.   # * Public Instance Variables
  1373.   #--------------------------------------------------------------------------
  1374.   attr_accessor :ox
  1375.   attr_accessor :oy
  1376.   attr_accessor :rate
  1377.   attr_accessor :zoom
  1378.   attr_accessor :loop
  1379.   attr_accessor :type
  1380.   attr_accessor :map_x
  1381.   attr_accessor :map_y
  1382.   attr_accessor :mirror
  1383.   attr_accessor :follow
  1384.   attr_accessor :height
  1385.   attr_accessor :bitmap1
  1386.   attr_accessor :bitmap2
  1387.   attr_accessor :sprites
  1388.   attr_accessor :duration
  1389.   attr_accessor :direction
  1390.   attr_accessor :duplicated
  1391.   #--------------------------------------------------------------------------
  1392.   # * New method: initialize
  1393.   #--------------------------------------------------------------------------
  1394.   def initialize(animation, mirror, user = nil)
  1395.     @animation = animation
  1396.     @rate      = animation.name =~ /<RATE: ([+-]?\d+)>/i ? [$1.to_i, 1].max : 4
  1397.     @zoom      = animation.name =~ /<ZOOM: (\d+)%?>/i ? $1.to_i / 100.0 : 1.0
  1398.     @follow    = animation.name =~ /<FOLLOW>/i ? true : false
  1399.     @mirror    = mirror
  1400.     @duration  = frame_max * @rate
  1401.     @direction = user.anim_direction if user
  1402.     @sprites   = []
  1403.     bellow     = animation.name =~ /<BELLOW>/i
  1404.     above      = animation.name =~ /<ABOVE>/i
  1405.     @height    = bellow ? -1 : above ? 300 : 1
  1406.   end
  1407.   #--------------------------------------------------------------------------
  1408.   # * New method: data
  1409.   #--------------------------------------------------------------------------  
  1410.   def data
  1411.     @animation
  1412.   end
  1413.   #--------------------------------------------------------------------------
  1414.   # * New method: id
  1415.   #--------------------------------------------------------------------------  
  1416.   def id
  1417.     @animation.id
  1418.   end
  1419.   #--------------------------------------------------------------------------
  1420.   # * New method: name
  1421.   #--------------------------------------------------------------------------  
  1422.   def name
  1423.     @animation.name
  1424.   end
  1425.   #--------------------------------------------------------------------------
  1426.   # * New method: frame_max
  1427.   #--------------------------------------------------------------------------
  1428.   def frame_max
  1429.     @animation.frame_max
  1430.   end
  1431.   #--------------------------------------------------------------------------
  1432.   # * New method: position
  1433.   #--------------------------------------------------------------------------
  1434.   def position
  1435.     @animation.position
  1436.   end
  1437.   #--------------------------------------------------------------------------
  1438.   # * New method: animation1_name
  1439.   #--------------------------------------------------------------------------
  1440.   def animation1_name
  1441.     @animation.animation1_name
  1442.   end
  1443.   #--------------------------------------------------------------------------
  1444.   # * New method: animation2_name
  1445.   #--------------------------------------------------------------------------
  1446.   def animation2_name
  1447.     @animation.animation2_name
  1448.   end
  1449.   #--------------------------------------------------------------------------
  1450.   # * New method: animation1_hue
  1451.   #--------------------------------------------------------------------------
  1452.   def animation1_hue
  1453.     @animation.animation1_hue
  1454.   end
  1455.   #--------------------------------------------------------------------------
  1456.   # * New method: animation2_hue
  1457.   #--------------------------------------------------------------------------
  1458.   def animation2_hue
  1459.     @animation.animation2_hue
  1460.   end
  1461.   #--------------------------------------------------------------------------
  1462.   # * New method: frames
  1463.   #--------------------------------------------------------------------------
  1464.   def frames
  1465.     @animation.frames
  1466.   end
  1467.   #--------------------------------------------------------------------------
  1468.   # * New method: timings
  1469.   #--------------------------------------------------------------------------
  1470.   def timings
  1471.     @animation.timings
  1472.   end
  1473. end
  1474.  
  1475. #==============================================================================
  1476. # ** Sprite_Character
  1477. #------------------------------------------------------------------------------
  1478. #  This sprite is used to display characters. It observes a instance of the
  1479. # Game_Character class and automatically changes sprite conditions.
  1480. #==============================================================================
  1481.  
  1482. class Sprite_Character < Sprite_Base
  1483.   #--------------------------------------------------------------------------
  1484.   # * Overwrite method: set_character_bitmap
  1485.   #--------------------------------------------------------------------------
  1486.   def set_character_bitmap
  1487.     update_character_info
  1488.     set_bitmap
  1489.     set_bitmap_position
  1490.   end
  1491.   #--------------------------------------------------------------------------
  1492.   # * New method: center_y
  1493.   #--------------------------------------------------------------------------
  1494.   def actor?
  1495.     @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
  1496.   end
  1497.   #--------------------------------------------------------------------------
  1498.   # * New method: center_y
  1499.   #--------------------------------------------------------------------------
  1500.   def actor
  1501.     actor? ? @character.actor : nil
  1502.   end
  1503.   #--------------------------------------------------------------------------
  1504.   # * New method: update_character_info
  1505.   #--------------------------------------------------------------------------
  1506.   def update_character_info
  1507.   end
  1508.   #--------------------------------------------------------------------------
  1509.   # * New method: hue
  1510.   #--------------------------------------------------------------------------
  1511.   def hue
  1512.     @character.hue
  1513.   end
  1514.   #--------------------------------------------------------------------------
  1515.   # * New method: set_bitmap
  1516.   #--------------------------------------------------------------------------
  1517.   def set_bitmap
  1518.     self.bitmap = Cache.character(set_bitmap_name, hue)
  1519.   end
  1520.   #--------------------------------------------------------------------------
  1521.   # * New method: set_bitmap_name
  1522.   #--------------------------------------------------------------------------
  1523.   def set_bitmap_name
  1524.     @character_name
  1525.   end
  1526.   #--------------------------------------------------------------------------
  1527.   # * New method: set_bitmap_position
  1528.   #--------------------------------------------------------------------------
  1529.   def set_bitmap_position
  1530.     sign = get_sign
  1531.     if sign && sign.include?('$')
  1532.       @cw = bitmap.width / @character.frames
  1533.       @ch = bitmap.height / 4
  1534.     else
  1535.       @cw = bitmap.width / (@character.frames * 4)
  1536.       @ch = bitmap.height / 8
  1537.     end
  1538.     self.ox = @cw / 2
  1539.     self.oy = @ch
  1540.   end
  1541.   #--------------------------------------------------------------------------
  1542.   # * New method: get_sign
  1543.   #--------------------------------------------------------------------------
  1544.   def get_sign
  1545.     @character_name[/^[\!\$]./]
  1546.   end
  1547. end
  1548.  
  1549. #==============================================================================
  1550. # ** Sprite_Battler
  1551. #------------------------------------------------------------------------------
  1552. #  This sprite is used to display battlers. It observes a instance of the
  1553. # Game_Battler class and automatically changes sprite conditions.
  1554. #==============================================================================
  1555.  
  1556. class Sprite_Battler < Sprite_Base
  1557.   #--------------------------------------------------------------------------
  1558.   # * Public Instance Variables
  1559.   #--------------------------------------------------------------------------
  1560.   attr_accessor :dmg_mirror
  1561.   #--------------------------------------------------------------------------
  1562.   # * New method: center_x
  1563.   #--------------------------------------------------------------------------
  1564.   def center_x
  1565.     self.ox
  1566.   end
  1567.   #--------------------------------------------------------------------------
  1568.   # * New method: center_y
  1569.   #--------------------------------------------------------------------------
  1570.   def center_y
  1571.     self.oy / 2
  1572.   end
  1573. end
  1574.  
  1575. #==============================================================================
  1576. # ** Spriteset_Battle
  1577. #------------------------------------------------------------------------------
  1578. #  This class brings together battle screen sprites. It's used within the
  1579. # Scene_Battle class.
  1580. #==============================================================================
  1581.  
  1582. class Spriteset_Battle
  1583.   #--------------------------------------------------------------------------
  1584.   # * Public Instance Variables
  1585.   #--------------------------------------------------------------------------
  1586.   attr_reader   :viewport1
  1587.   #--------------------------------------------------------------------------
  1588.   # * New method: sprite
  1589.   #--------------------------------------------------------------------------
  1590.   def sprite(subject)
  1591.     battler_sprites.compact.select {|sprite| sprite.battler == subject }.first
  1592.   end
  1593. end
  1594.  
  1595. #==============================================================================
  1596. # ** Window_Base
  1597. #------------------------------------------------------------------------------
  1598. #  This is a superclass of all windows in the game.
  1599. #==============================================================================
  1600.  
  1601. class Window_Base < Window
  1602.   #--------------------------------------------------------------------------
  1603.   # * Alias method: convert_escape_characters
  1604.   #--------------------------------------------------------------------------
  1605.   alias :convert_escape_ve_basic_module :convert_escape_characters
  1606.   def convert_escape_characters(text)
  1607.     result = text.to_s.clone
  1608.     result = text_replace(result)
  1609.     result = convert_escape_ve_basic_module(text)
  1610.     result
  1611.   end
  1612.   #--------------------------------------------------------------------------
  1613.   # * New method: text_replace
  1614.   #--------------------------------------------------------------------------
  1615.   def text_replace(result)
  1616.     result.gsub!(/\r/) { "" }
  1617.     result.gsub!(/\\/) { "\e" }
  1618.     result
  1619.   end
  1620. end
  1621.  
  1622. #==============================================================================
  1623. # ** Scene_Battle
  1624. #------------------------------------------------------------------------------
  1625. #  This class performs battle screen processing.
  1626. #==============================================================================
  1627.  
  1628. class Scene_Battle < Scene_Base
  1629.   #--------------------------------------------------------------------------
  1630.   # * Public Instance Variables
  1631.   #--------------------------------------------------------------------------
  1632.   attr_reader   :subject
  1633.   attr_reader   :spriteset
  1634. end
  1635.  
  1636. #==============================================================================
  1637. # ** Scene_Battle
  1638. #------------------------------------------------------------------------------
  1639. #  This class performs map screen processing.
  1640. #==============================================================================
  1641.  
  1642. class Scene_Map < Scene_Base
  1643.   #--------------------------------------------------------------------------
  1644.   # * Public Instance Variables
  1645.   #--------------------------------------------------------------------------
  1646.   attr_reader   :spriteset
  1647. end


作者: a000b1745    时间: 2013-3-4 17:16
自己頂一下...
有達人能幫幫吗?
作者: Sion    时间: 2013-3-4 18:34
你在原脚本里找到对应的地方,自己加那么一句:
  1. class Window_ItemList
  2.   #--------------------------------------------------------------------------
  3.   # ● 決定やキャンセルなどのハンドリング処理
  4.   #--------------------------------------------------------------------------
  5.   alias tmitwin_window_itemlist_process_handling process_handling
  6.   def process_handling
  7.     tmitwin_window_itemlist_process_handling
  8.     return if SceneManager.scene_is?(Scene_Battle) ################### 加这一句
  9.     return unless open? && active
  10.     return process_description if Input.trigger?(TMITWIN::KEY_SYMBOL)
  11.   end

  12. class Window_SkillList
  13.   #--------------------------------------------------------------------------
  14.   # ● 決定やキャンセルなどのハンドリング処理
  15.   #--------------------------------------------------------------------------
  16.   alias tmitwin_window_skilllist_process_handling process_handling
  17.   def process_handling
  18.     tmitwin_window_skilllist_process_handling
  19.     return if SceneManager.scene_is?(Scene_Battle) ################### 加这一句
  20.     return unless open? && active
  21.     return process_description if Input.trigger?(TMITWIN::KEY_SYMBOL)
  22.   end
复制代码
战斗中按A键就不会弹出说明了
作者: a000b1745    时间: 2013-3-4 19:34
感謝!!
雖然無法在戰鬥中查詢詳細訊息,但看來也只能這樣做了{:2_275:}

謝謝你~!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1